From 92806ecb85123081809707421401df2eeb9fd6c8 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 5 Apr 2023 22:53:23 +0100 Subject: [PATCH 001/128] 2023.04 GA --- ...rrect-constant-name-in-RAM-init-code.patch | 136 ------------------ sources | 2 +- uboot-tools.spec | 10 +- 3 files changed, 7 insertions(+), 141 deletions(-) delete mode 100644 rockchip-Fix-incorrect-constant-name-in-RAM-init-code.patch diff --git a/rockchip-Fix-incorrect-constant-name-in-RAM-init-code.patch b/rockchip-Fix-incorrect-constant-name-in-RAM-init-code.patch deleted file mode 100644 index 381105d..0000000 --- a/rockchip-Fix-incorrect-constant-name-in-RAM-init-code.patch +++ /dev/null @@ -1,136 +0,0 @@ -From patchwork Thu Mar 30 21:51:14 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: David Sebek -X-Patchwork-Id: 1763526 -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20210112 header.b=Ur2Foz7G; - 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 ECDSA (P-384)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4PnccK6Hkyz1yY8 - for ; Fri, 31 Mar 2023 08:53:21 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 504A385F3F; - Thu, 30 Mar 2023 23:53:19 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="Ur2Foz7G"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id D179285F40; Thu, 30 Mar 2023 23:52: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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-qv1-xf36.google.com (mail-qv1-xf36.google.com - [IPv6:2607:f8b0:4864:20::f36]) - (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 2033985F3F - for ; Thu, 30 Mar 2023 23:52:38 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=dasebek@gmail.com -Received: by mail-qv1-xf36.google.com with SMTP id kr22so1200478qvb.5 - for ; Thu, 30 Mar 2023 14:52:38 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20210112; t=1680213157; - h=content-transfer-encoding:mime-version:message-id:date:subject:cc - :to:from:from:to:cc:subject:date:message-id:reply-to; - bh=WlhaDeGiQSnfOs2/9s0KCU263BnBJ6NBdaytsU9sg7g=; - b=Ur2Foz7G2I7plUDBFoUSZnvUqm1qe6isgeZchzTJizjuyScb9aIr+l4Y7kNOOQGdc/ - i8jKZkeikuONySQd2OO0XRKZNsG/OFDotB5PuxnuzojmdEHLUeXPR4vVr2U7w1evC0FV - WsRdQjKNHExVuqC6pCdfDypiLeHxlI3xjzZAX1ZdZ3vL1HpjEdOz5F+LkX4/q2n+k8hQ - 6kj71uph8Vc1tfmdNLxaVOCuSLjBjtKSvwQwndqfZhp55MBSwZOBC7E79tzprByA+2jm - gPusk25eDFTS4KdF99vyViFflzZcdCOd/3aivHFm22w8656KQMnTYqdcg+FVhbWCvXMB - boWw== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20210112; t=1680213157; - h=content-transfer-encoding:mime-version:message-id:date:subject:cc - :to:from:x-gm-message-state:from:to:cc:subject:date:message-id - :reply-to; - bh=WlhaDeGiQSnfOs2/9s0KCU263BnBJ6NBdaytsU9sg7g=; - b=ju+uXKxSg4L6GOqfy8tiSrBoKUIlAScW/CP1ukEGXtEXfQBiFwcqNzCc3Sj6j9Bdg1 - oLjqUkd0VXXt/hSpdFlSPOP8eqY9tHRLv8BJkRjlIuuCJDRNEAUUEeQhs9Q3EqltT1r7 - IPyM/TrkpuUWbr0PYVKQy2MUFTM1BK1UnqrJ9nKdQ21P+IbMhFz3LkTGbR0mIyW3aBws - Lafp9pABfuq4IomjoHD04o2f3M499dxlzmeSWM5VM4G6Jn/fDhvUZQhKU/vOdJVICUBM - eTp2laeeQo3dU45NqTZAuHRExqWvXVfhRPCOjVhv4NGd1ZhXTyJlw58Sq8t1kogMaZYZ - Ig8g== -X-Gm-Message-State: AAQBX9dHjWPG3k4IU3/uooZuMWlvPPp07Gf3iAuGftQx7/rI9tIH2/9E - 2RpZKACqRmNgqLHljBDY0Ikog6vfLUjUCQ== -X-Google-Smtp-Source: - AKy350ZwCjCcvTc/JU/KbyOydxFmq/ZQNkIyCK/MsKcufgGLOKBKj9hxPMBrRLLgXzD6BdzMNiAVSA== -X-Received: by 2002:ad4:5c6b:0:b0:5ce:7b40:8999 with SMTP id - i11-20020ad45c6b000000b005ce7b408999mr45081108qvh.22.1680213156729; - Thu, 30 Mar 2023 14:52:36 -0700 (PDT) -Received: from pc4.lan ([2605:a601:a620:5c00::d89]) - by smtp.gmail.com with ESMTPSA id - k5-20020a0cebc5000000b005dd8b9345d3sm129269qvq.107.2023.03.30.14.52.36 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Thu, 30 Mar 2023 14:52:36 -0700 (PDT) -From: David Sebek -To: u-boot@lists.denx.de -Cc: jagan@amarulasolutions.com, kever.yang@rock-chips.com, - David Sebek -Subject: [PATCH 1/1] rockchip: Fix incorrect constant name in RAM init code -Date: Thu, 30 Mar 2023 17:51:14 -0400 -Message-Id: <20230330215114.248481-1-dasebek@gmail.com> -X-Mailer: git-send-email 2.40.0 -MIME-Version: 1.0 -X-Mailman-Approved-At: Thu, 30 Mar 2023 23:53:17 +0200 -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 - -A condition in the rk3399 RAM initialization code used the old -CONFIG_RAM_RK3399_LPDDR4 constant name. This commit changes the -condition to use the correct CONFIG_RAM_ROCKCHIP_LPDDR4 constant. -Reviewed-by: Simon Glass ---- - drivers/ram/rockchip/sdram_rk3399.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c -index b1fea04e84..963a05c244 100644 ---- a/drivers/ram/rockchip/sdram_rk3399.c -+++ b/drivers/ram/rockchip/sdram_rk3399.c -@@ -2954,7 +2954,7 @@ static int sdram_init(struct dram_info *dram, - params->ch[ch].cap_info.rank = rank; - } - --#if defined(CONFIG_RAM_RK3399_LPDDR4) -+#if defined(CONFIG_RAM_ROCKCHIP_LPDDR4) - /* LPDDR4 needs to be trained at 400MHz */ - lpddr4_set_rate(dram, params, 0); - params->base.ddr_freq = dfs_cfgs_lpddr4[0].base.ddr_freq / MHz; diff --git a/sources b/sources index 154228d..6466983 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.04-rc5.tar.bz2) = e953585d3b59f53aec1e17179fe5c84cbc56d5a5150815aaf9b01a73dc6384a9cbe89e6848f8c4fd85c00bf61de4487018fa6df9411caff2f0c9a8a175a5dd28 +SHA512 (u-boot-2023.04.tar.bz2) = 31a44083af8084cd657c08233f485ff9503002bbaf95114c6135d483881fa14dc5a1b7ab42fd91f1fdd6b330556e76958d475280115018cb59c62b6ab4b508e6 diff --git a/uboot-tools.spec b/uboot-tools.spec index 42ac2eb..5169271 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc5 +#global candidate rc0 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.04 -Release: 0.4%{?candidate:.%{candidate}}%{?dist} +Release: 1%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -25,7 +25,6 @@ Patch2: smbios-Simplify-reporting-of-unknown-values.patch # RPi - uses RPI firmware device tree for HAT support Patch3: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements -Patch5: rockchip-Fix-incorrect-constant-name-in-RAM-init-code.patch Patch6: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch BuildRequires: bc @@ -99,7 +98,7 @@ do rk3328=(evb-rk3328 nanopi-r2s-rk3328 rock64-rk3328 rock-pi-e-rk3328 roc-cc-rk3328) if [[ " ${rk3328[*]} " == *" $board "* ]]; then echo "Board: $board using rk3328" - cp /usr/share/arm-trusted-firmware/rk3328/* builds/$(echo $board)/ + cp /usr/share/arm-trusted-firmware/rk3328/bl31.elf builds/$(echo $board)/atf-bl31 fi rk3399=(evb-rk3399 ficus-rk3399 firefly-rk3399 khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 leez-rk3399 nanopc-t4-rk3399 nanopi-m4-2gb-rk3399 nanopi-m4b-rk3399 nanopi-m4-rk3399 nanopi-neo4-rk3399 nanopi-r4s-rk3399 orangepi-rk3399 pinebook-pro-rk3399 pinephone-pro-rk3399 puma-rk3399 rock960-rk3399 rock-pi-4c-rk3399 rock-pi-4-rk3399 rock-pi-n10-rk3399pro rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399) if [[ " ${rk3399[*]} " == *" $board "* ]]; then @@ -211,6 +210,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Tue Apr 04 2023 Peter Robinson - 2023.04-1 +- Update to 2023.04 GA + * Tue Mar 28 2023 Peter Robinson - 2023.04-0.4.rc5 - Update to 2023.04 RC5 - Drop upstreamed patches From 4bf4670e83129691d4218dc9c68d922ab8c2e048 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 17 May 2023 23:06:15 +0100 Subject: [PATCH 002/128] 2023.07 RC2 --- sources | 2 +- uboot-tools.spec | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sources b/sources index 6466983..882178d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.04.tar.bz2) = 31a44083af8084cd657c08233f485ff9503002bbaf95114c6135d483881fa14dc5a1b7ab42fd91f1fdd6b330556e76958d475280115018cb59c62b6ab4b508e6 +SHA512 (u-boot-2023.07-rc2.tar.bz2) = 88c17e7b835a78e93e39e2e455dcaa7bd1dc5abb7fbced36bc5ecdcacd3bd8633a36bdf4411cb3dbb59f8f6ae26d7dc4f9f3664290112e706ca0546033adba83 diff --git a/uboot-tools.spec b/uboot-tools.spec index e754741..bc8cfbf 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -#global candidate rc0 +%global candidate rc2 %if 0%{?rhel} %bcond_with toolsonly %else @@ -6,8 +6,8 @@ %endif Name: uboot-tools -Version: 2023.04 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Version: 2023.07 +Release: 0.1%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -210,6 +210,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Wed May 17 2023 Peter Robinson - 2023.07-0.1.rc2 +- Update to 2023.07 RC2 + * Tue Apr 04 2023 Peter Robinson - 2023.04-1 - Update to 2023.04 GA From 181c3671e7ce1141f3611610f1532b6133e5d8cd Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 29 May 2023 22:02:20 +0100 Subject: [PATCH 003/128] 2023.07 RC3 --- sources | 2 +- uboot-tools.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sources b/sources index 882178d..3ef372f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.07-rc2.tar.bz2) = 88c17e7b835a78e93e39e2e455dcaa7bd1dc5abb7fbced36bc5ecdcacd3bd8633a36bdf4411cb3dbb59f8f6ae26d7dc4f9f3664290112e706ca0546033adba83 +SHA512 (u-boot-2023.07-rc3.tar.bz2) = 2fc12ec0be56603931122063926e5edcb5464cc033f9bb79b07fdfa80a3045ccb5dd17703515f794406e109a5f2ad32e1a22909567d1d7ad2251bae2f70ed4a2 diff --git a/uboot-tools.spec b/uboot-tools.spec index bc8cfbf..6306df5 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc2 +%global candidate rc3 %if 0%{?rhel} %bcond_with toolsonly %else From 7733014fef4351f4ab9b128ca847eb0f96620f92 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sun, 11 Jun 2023 18:33:50 +0100 Subject: [PATCH 004/128] Fixes for the Pinephone Pro --- rockchip-PinePhone-Pro-fixes.patch | 127 +++++++++++++++++++++++++++++ uboot-tools.spec | 6 +- 2 files changed, 132 insertions(+), 1 deletion(-) create mode 100644 rockchip-PinePhone-Pro-fixes.patch diff --git a/rockchip-PinePhone-Pro-fixes.patch b/rockchip-PinePhone-Pro-fixes.patch new file mode 100644 index 0000000..74d0bab --- /dev/null +++ b/rockchip-PinePhone-Pro-fixes.patch @@ -0,0 +1,127 @@ +From 671b2e758900f4a733d6840b2f39bc24dd63cfdb Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Thu, 25 May 2023 14:18:17 +0200 +Subject: [PATCH] i2c: rockchip: De-initialize the bus after start bit failure + +Failure can happen when i2c is used without initializing pinctrl properly, +which U-Boot happily allows in SPL. Without this fix, further I2C access would +fail, even after proper pinctrl initialization. + +Signed-off-by: Ondrej Jirman +Cc: Heiko Schocher +Reviewed-by: Kever Yang +Reviewed-by: Heiko Schocher +--- + drivers/i2c/rk_i2c.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c +index f8fac45b6ca..9927af94a80 100644 +--- a/drivers/i2c/rk_i2c.c ++++ b/drivers/i2c/rk_i2c.c +@@ -342,7 +342,7 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, + int nmsgs) + { + struct rk_i2c *i2c = dev_get_priv(bus); +- int ret; ++ int ret = 0; + + debug("i2c_xfer: %d messages\n", nmsgs); + for (; nmsgs > 0; nmsgs--, msg++) { +@@ -356,14 +356,15 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, + } + if (ret) { + debug("i2c_write: error sending\n"); +- return -EREMOTEIO; ++ ret = -EREMOTEIO; ++ break; + } + } + + rk_i2c_send_stop_bit(i2c); + rk_i2c_disable(i2c); + +- return 0; ++ return ret; + } + + int rockchip_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) +-- +2.41.0 + +From 1af5e42f170d2c4b944beeb875b80ec7f061038a Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Thu, 25 May 2023 15:27:08 +0200 +Subject: [PATCH] pinephone-pro: Fix I/O port voltage (GPIO3D4A is 1.8V) + +This fixes access to camera sensor over I2C during probe time in +the kernel. (Kernel will fix I/0 port voltage by itself, but the +timing depends on probe order of the drivers, so the fix can +come after the camera sensor driver already failed to probe.) + +Signed-off-by: Ondrej Jirman +Cc: Kever Yang +Reviewed-by: Kever Yang +--- + board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +index eb639cd0d07..b6ccbb9c1c4 100644 +--- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c ++++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +@@ -15,7 +15,8 @@ + #include + #include + +-#define GRF_IO_VSEL_BT565_SHIFT 0 ++#define GRF_IO_VSEL_BT565_GPIO2AB 1 ++#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2 + #define PMUGRF_CON0_VSEL_SHIFT 8 + + #ifndef CONFIG_SPL_BUILD +@@ -48,7 +49,8 @@ static void setup_iodomain(void) + syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); + + /* BT565 is in 1.8v domain */ +- rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); ++ rk_setreg(&grf->io_vsel, ++ GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A); + + /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ + rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); +-- +2.41.0 + +From 6a7f8be74b44013513e51f5e7979dcc410ca2723 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Sun, 11 Jun 2023 18:13:19 +0100 +Subject: [PATCH] rockchip: Pinephone Pro: Add DDR RAM type config + +Add the RAM_ROCKCHIP_LPDDR4 to fix the Pinephone Pro booting. +When the configs were updated in 26f92be07e2 it somehow broke +the PPP boot process so let's fix it. + +Signed-off-by: Peter Robinson +CC: Jagan Teki +CC: Kever Yang + +--- + configs/pinephone-pro-rk3399_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig +index 4edea88665f..e4a8beeb1ab 100644 +--- a/configs/pinephone-pro-rk3399_defconfig ++++ b/configs/pinephone-pro-rk3399_defconfig +@@ -73,6 +73,7 @@ CONFIG_PMIC_RK8XX=y + CONFIG_REGULATOR_PWM=y + CONFIG_REGULATOR_RK8XX=y + CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM_ROCKCHIP_LPDDR4=y + CONFIG_DM_RNG=y + CONFIG_RNG_ROCKCHIP=y + CONFIG_BAUDRATE=1500000 +-- +2.41.0 + diff --git a/uboot-tools.spec b/uboot-tools.spec index e754741..98eb8d8 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.04 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Release: 2%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -26,6 +26,7 @@ Patch2: smbios-Simplify-reporting-of-unknown-values.patch Patch3: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements Patch6: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch +Patch7: rockchip-PinePhone-Pro-fixes.patch BuildRequires: bc BuildRequires: bison @@ -210,6 +211,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Sun Jun 11 2023 Peter Robinson - 2023.04-2 +- Fixes for the Pinephone Pro + * Tue Apr 04 2023 Peter Robinson - 2023.04-1 - Update to 2023.04 GA From 0d5f023cd64a9872009673990bdb3c2bf9bfe609 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sun, 11 Jun 2023 21:27:31 +0100 Subject: [PATCH 005/128] Fixes for the Pinephone Pro, RockPro64 --- ...rockpro64-Build-u-boot-rockchip-spi..patch | 41 ++++++ rockchip-PinePhone-Pro-fixes.patch | 127 ++++++++++++++++++ uboot-tools.spec | 8 +- 3 files changed, 175 insertions(+), 1 deletion(-) create mode 100644 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch create mode 100644 rockchip-PinePhone-Pro-fixes.patch diff --git a/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch b/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch new file mode 100644 index 0000000..7ab4bbd --- /dev/null +++ b/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch @@ -0,0 +1,41 @@ +From ed5ffb3b53690a47333b931301a3765b9588b5dc Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Sun, 11 Jun 2023 21:22:41 +0100 +Subject: [PATCH] Revert "rockchip: rockpro64: Build u-boot-rockchip-spi.bin" + +This reverts commit 5713135ecc75660684ff3eb6cfba7bc11eb6433c. +--- + configs/rockpro64-rk3399_defconfig | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig +index f41c0306790..0ca2cecade2 100644 +--- a/configs/rockpro64-rk3399_defconfig ++++ b/configs/rockpro64-rk3399_defconfig +@@ -11,7 +11,6 @@ CONFIG_ENV_OFFSET=0x3F8000 + CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64" + CONFIG_DM_RESET=y + CONFIG_ROCKCHIP_RK3399=y +-CONFIG_ROCKCHIP_SPI_IMAGE=y + CONFIG_TARGET_ROCKPRO64_RK3399=y + CONFIG_SPL_STACK=0x400000 + CONFIG_DEBUG_UART_BASE=0xFF1A0000 +@@ -21,7 +20,6 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y +-CONFIG_LTO=y + CONFIG_SPL_FIT_SIGNATURE=y + CONFIG_BOOTSTAGE=y + CONFIG_BOOTSTAGE_REPORT=y +@@ -39,7 +37,6 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000 + CONFIG_SPL_STACK_R=y + CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 + CONFIG_SPL_SPI_LOAD=y +-CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 + CONFIG_TPL=y + CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y +-- +2.41.0 + diff --git a/rockchip-PinePhone-Pro-fixes.patch b/rockchip-PinePhone-Pro-fixes.patch new file mode 100644 index 0000000..74d0bab --- /dev/null +++ b/rockchip-PinePhone-Pro-fixes.patch @@ -0,0 +1,127 @@ +From 671b2e758900f4a733d6840b2f39bc24dd63cfdb Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Thu, 25 May 2023 14:18:17 +0200 +Subject: [PATCH] i2c: rockchip: De-initialize the bus after start bit failure + +Failure can happen when i2c is used without initializing pinctrl properly, +which U-Boot happily allows in SPL. Without this fix, further I2C access would +fail, even after proper pinctrl initialization. + +Signed-off-by: Ondrej Jirman +Cc: Heiko Schocher +Reviewed-by: Kever Yang +Reviewed-by: Heiko Schocher +--- + drivers/i2c/rk_i2c.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c +index f8fac45b6ca..9927af94a80 100644 +--- a/drivers/i2c/rk_i2c.c ++++ b/drivers/i2c/rk_i2c.c +@@ -342,7 +342,7 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, + int nmsgs) + { + struct rk_i2c *i2c = dev_get_priv(bus); +- int ret; ++ int ret = 0; + + debug("i2c_xfer: %d messages\n", nmsgs); + for (; nmsgs > 0; nmsgs--, msg++) { +@@ -356,14 +356,15 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, + } + if (ret) { + debug("i2c_write: error sending\n"); +- return -EREMOTEIO; ++ ret = -EREMOTEIO; ++ break; + } + } + + rk_i2c_send_stop_bit(i2c); + rk_i2c_disable(i2c); + +- return 0; ++ return ret; + } + + int rockchip_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) +-- +2.41.0 + +From 1af5e42f170d2c4b944beeb875b80ec7f061038a Mon Sep 17 00:00:00 2001 +From: Ondrej Jirman +Date: Thu, 25 May 2023 15:27:08 +0200 +Subject: [PATCH] pinephone-pro: Fix I/O port voltage (GPIO3D4A is 1.8V) + +This fixes access to camera sensor over I2C during probe time in +the kernel. (Kernel will fix I/0 port voltage by itself, but the +timing depends on probe order of the drivers, so the fix can +come after the camera sensor driver already failed to probe.) + +Signed-off-by: Ondrej Jirman +Cc: Kever Yang +Reviewed-by: Kever Yang +--- + board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +index eb639cd0d07..b6ccbb9c1c4 100644 +--- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c ++++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c +@@ -15,7 +15,8 @@ + #include + #include + +-#define GRF_IO_VSEL_BT565_SHIFT 0 ++#define GRF_IO_VSEL_BT565_GPIO2AB 1 ++#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2 + #define PMUGRF_CON0_VSEL_SHIFT 8 + + #ifndef CONFIG_SPL_BUILD +@@ -48,7 +49,8 @@ static void setup_iodomain(void) + syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); + + /* BT565 is in 1.8v domain */ +- rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); ++ rk_setreg(&grf->io_vsel, ++ GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A); + + /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ + rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); +-- +2.41.0 + +From 6a7f8be74b44013513e51f5e7979dcc410ca2723 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Sun, 11 Jun 2023 18:13:19 +0100 +Subject: [PATCH] rockchip: Pinephone Pro: Add DDR RAM type config + +Add the RAM_ROCKCHIP_LPDDR4 to fix the Pinephone Pro booting. +When the configs were updated in 26f92be07e2 it somehow broke +the PPP boot process so let's fix it. + +Signed-off-by: Peter Robinson +CC: Jagan Teki +CC: Kever Yang + +--- + configs/pinephone-pro-rk3399_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig +index 4edea88665f..e4a8beeb1ab 100644 +--- a/configs/pinephone-pro-rk3399_defconfig ++++ b/configs/pinephone-pro-rk3399_defconfig +@@ -73,6 +73,7 @@ CONFIG_PMIC_RK8XX=y + CONFIG_REGULATOR_PWM=y + CONFIG_REGULATOR_RK8XX=y + CONFIG_PWM_ROCKCHIP=y ++CONFIG_RAM_ROCKCHIP_LPDDR4=y + CONFIG_DM_RNG=y + CONFIG_RNG_ROCKCHIP=y + CONFIG_BAUDRATE=1500000 +-- +2.41.0 + diff --git a/uboot-tools.spec b/uboot-tools.spec index 6306df5..43fc748 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.07 -Release: 0.1%{?candidate:.%{candidate}}%{?dist} +Release: 0.2%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -26,6 +26,8 @@ Patch2: smbios-Simplify-reporting-of-unknown-values.patch Patch3: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements Patch6: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch +Patch7: rockchip-PinePhone-Pro-fixes.patch +Patch8: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch BuildRequires: bc BuildRequires: bison @@ -210,6 +212,10 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Sun Jun 11 2023 Peter Robinson - 2023.07-0.2.rc3 +- Update to 2023.07 RC3 +- Fixes for the Pinephone Pro, RockPro64 + * Wed May 17 2023 Peter Robinson - 2023.07-0.1.rc2 - Update to 2023.07 RC2 From 9f5ba74ae09adf9c7c158cf68985a173260c27dc Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 12 Jun 2023 22:33:53 +0100 Subject: [PATCH 006/128] 2023.07 RC4 --- rockchip-PinePhone-Pro-fixes.patch | 51 ------------------------------ sources | 2 +- uboot-tools.spec | 7 ++-- 3 files changed, 6 insertions(+), 54 deletions(-) diff --git a/rockchip-PinePhone-Pro-fixes.patch b/rockchip-PinePhone-Pro-fixes.patch index 74d0bab..826ab23 100644 --- a/rockchip-PinePhone-Pro-fixes.patch +++ b/rockchip-PinePhone-Pro-fixes.patch @@ -1,54 +1,3 @@ -From 671b2e758900f4a733d6840b2f39bc24dd63cfdb Mon Sep 17 00:00:00 2001 -From: Ondrej Jirman -Date: Thu, 25 May 2023 14:18:17 +0200 -Subject: [PATCH] i2c: rockchip: De-initialize the bus after start bit failure - -Failure can happen when i2c is used without initializing pinctrl properly, -which U-Boot happily allows in SPL. Without this fix, further I2C access would -fail, even after proper pinctrl initialization. - -Signed-off-by: Ondrej Jirman -Cc: Heiko Schocher -Reviewed-by: Kever Yang -Reviewed-by: Heiko Schocher ---- - drivers/i2c/rk_i2c.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c -index f8fac45b6ca..9927af94a80 100644 ---- a/drivers/i2c/rk_i2c.c -+++ b/drivers/i2c/rk_i2c.c -@@ -342,7 +342,7 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, - int nmsgs) - { - struct rk_i2c *i2c = dev_get_priv(bus); -- int ret; -+ int ret = 0; - - debug("i2c_xfer: %d messages\n", nmsgs); - for (; nmsgs > 0; nmsgs--, msg++) { -@@ -356,14 +356,15 @@ static int rockchip_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, - } - if (ret) { - debug("i2c_write: error sending\n"); -- return -EREMOTEIO; -+ ret = -EREMOTEIO; -+ break; - } - } - - rk_i2c_send_stop_bit(i2c); - rk_i2c_disable(i2c); - -- return 0; -+ return ret; - } - - int rockchip_i2c_set_bus_speed(struct udevice *bus, unsigned int speed) --- -2.41.0 - From 1af5e42f170d2c4b944beeb875b80ec7f061038a Mon Sep 17 00:00:00 2001 From: Ondrej Jirman Date: Thu, 25 May 2023 15:27:08 +0200 diff --git a/sources b/sources index 3ef372f..eeeb20d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.07-rc3.tar.bz2) = 2fc12ec0be56603931122063926e5edcb5464cc033f9bb79b07fdfa80a3045ccb5dd17703515f794406e109a5f2ad32e1a22909567d1d7ad2251bae2f70ed4a2 +SHA512 (u-boot-2023.07-rc4.tar.bz2) = 523e0e63960921f3fa5a6cbb4d73b5326e4a95c81e7dc74dcca5e460d2a37209fbd2622db636358f6d7e4b0fdd715d4587f021a0d722b95808b65db2998b6fcf diff --git a/uboot-tools.spec b/uboot-tools.spec index 43fc748..0e2d64d 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc3 +%global candidate rc4 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.07 -Release: 0.2%{?candidate:.%{candidate}}%{?dist} +Release: 0.3%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -212,6 +212,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Mon Jun 12 2023 Peter Robinson - 2023.07-0.3.rc4 +- Update to 2023.07 RC4 + * Sun Jun 11 2023 Peter Robinson - 2023.07-0.2.rc3 - Update to 2023.07 RC3 - Fixes for the Pinephone Pro, RockPro64 From a66ab5dbb0f5d8bbba2f7064d42cab56751f645b Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 16 Jun 2023 10:43:01 +0100 Subject: [PATCH 007/128] Disable NFS --- 0001-disable-NFS-support-by-default.patch | 35 +++++++++++++++++++++++ uboot-tools.spec | 8 ++++-- 2 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 0001-disable-NFS-support-by-default.patch diff --git a/0001-disable-NFS-support-by-default.patch b/0001-disable-NFS-support-by-default.patch new file mode 100644 index 0000000..b520b15 --- /dev/null +++ b/0001-disable-NFS-support-by-default.patch @@ -0,0 +1,35 @@ +From 31dc49dee987500b0d5b5b536b6da2f3fbfd5b59 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Tue, 13 Jun 2023 09:36:50 +0100 +Subject: [v1] disable NFS support by default + +While NFS is widely used in data centres, and private +networks it's quite a nuanced usecase for device firmware. +A lot of devices already disable it. + +Various network protocols should really be opt in, not opt +out, because they add extra size and are potential attack +vectors from a security PoV. In the NFS case it doesn't +really make sense for a lot of devices like tables, SBCs etc. +It's also something we don't really want for SystemReady-IR +due to security concerns. + +Signed-off-by: Peter Robinson +--- + +v1: drop RFC tag + + cmd/Kconfig | 1 - + +diff --git a/cmd/Kconfig b/cmd/Kconfig +index 365371fb511..a193929cec4 100644 +--- a/cmd/Kconfig ++++ b/cmd/Kconfig +@@ -1848,7 +1848,6 @@ config CMD_RARP + + config CMD_NFS + bool "nfs" +- default y + help + Boot image via network using NFS protocol. + diff --git a/uboot-tools.spec b/uboot-tools.spec index 0e2d64d..f035f7d 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.07 -Release: 0.3%{?candidate:.%{candidate}}%{?dist} +Release: 0.4%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -20,10 +20,11 @@ Source1: aarch64-boards # Needed to find DT on boot partition that's not the first partition Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch Patch2: smbios-Simplify-reporting-of-unknown-values.patch +Patch3: 0001-disable-NFS-support-by-default.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support -Patch3: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch +Patch5: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements Patch6: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch Patch7: rockchip-PinePhone-Pro-fixes.patch @@ -212,6 +213,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Fri Jun 16 2023 Peter Robinson - 2023.07-0.4.rc4 +- Disable NFS by default + * Mon Jun 12 2023 Peter Robinson - 2023.07-0.3.rc4 - Update to 2023.07 RC4 From bb667eb6c94fd70a33386260d04b06269b0c4572 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 11 Jul 2023 15:37:44 +0100 Subject: [PATCH 008/128] 2023.07 GA --- ...rockpro64-Build-u-boot-rockchip-spi..patch | 8 ++--- fix-release-rev.patch | 11 +++++++ rockchip-PinePhone-Pro-fixes.patch | 33 ------------------- sources | 2 +- uboot-tools.spec | 13 +++++--- 5 files changed, 24 insertions(+), 43 deletions(-) create mode 100644 fix-release-rev.patch diff --git a/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch b/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch index 7ab4bbd..30e4ad8 100644 --- a/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch +++ b/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch @@ -12,7 +12,7 @@ diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defco index f41c0306790..0ca2cecade2 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig -@@ -11,7 +11,6 @@ CONFIG_ENV_OFFSET=0x3F8000 +@@ -11,7 +11,6 @@ CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3399=y @@ -20,15 +20,15 @@ index f41c0306790..0ca2cecade2 100644 CONFIG_TARGET_ROCKPRO64_RK3399=y CONFIG_SPL_STACK=0x400000 CONFIG_DEBUG_UART_BASE=0xFF1A0000 -@@ -21,7 +20,6 @@ CONFIG_SPL_SPI=y +@@ -21,7 +20,6 @@ CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y -CONFIG_LTO=y CONFIG_SPL_FIT_SIGNATURE=y + CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_BOOTSTAGE=y - CONFIG_BOOTSTAGE_REPORT=y -@@ -39,7 +37,6 @@ CONFIG_SPL_BSS_MAX_SIZE=0x2000 +@@ -40,7 +38,6 @@ CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 CONFIG_SPL_SPI_LOAD=y diff --git a/fix-release-rev.patch b/fix-release-rev.patch new file mode 100644 index 0000000..ad78eeb --- /dev/null +++ b/fix-release-rev.patch @@ -0,0 +1,11 @@ +--- u-boot-2023.07/Makefile.orig 2023-07-11 11:47:16.996315851 +0100 ++++ u-boot-2023.07/Makefile 2023-07-11 11:47:31.049391730 +0100 +@@ -3,7 +3,7 @@ + VERSION = 2023 + PATCHLEVEL = 07 + SUBLEVEL = +-EXTRAVERSION = -rc6 ++EXTRAVERSION = + NAME = + + # *DOCUMENTATION* diff --git a/rockchip-PinePhone-Pro-fixes.patch b/rockchip-PinePhone-Pro-fixes.patch index 826ab23..5e07490 100644 --- a/rockchip-PinePhone-Pro-fixes.patch +++ b/rockchip-PinePhone-Pro-fixes.patch @@ -41,36 +41,3 @@ index eb639cd0d07..b6ccbb9c1c4 100644 rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); -- 2.41.0 - -From 6a7f8be74b44013513e51f5e7979dcc410ca2723 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 11 Jun 2023 18:13:19 +0100 -Subject: [PATCH] rockchip: Pinephone Pro: Add DDR RAM type config - -Add the RAM_ROCKCHIP_LPDDR4 to fix the Pinephone Pro booting. -When the configs were updated in 26f92be07e2 it somehow broke -the PPP boot process so let's fix it. - -Signed-off-by: Peter Robinson -CC: Jagan Teki -CC: Kever Yang - ---- - configs/pinephone-pro-rk3399_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig -index 4edea88665f..e4a8beeb1ab 100644 ---- a/configs/pinephone-pro-rk3399_defconfig -+++ b/configs/pinephone-pro-rk3399_defconfig -@@ -73,6 +73,7 @@ CONFIG_PMIC_RK8XX=y - CONFIG_REGULATOR_PWM=y - CONFIG_REGULATOR_RK8XX=y - CONFIG_PWM_ROCKCHIP=y -+CONFIG_RAM_ROCKCHIP_LPDDR4=y - CONFIG_DM_RNG=y - CONFIG_RNG_ROCKCHIP=y - CONFIG_BAUDRATE=1500000 --- -2.41.0 - diff --git a/sources b/sources index eeeb20d..150374f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.07-rc4.tar.bz2) = 523e0e63960921f3fa5a6cbb4d73b5326e4a95c81e7dc74dcca5e460d2a37209fbd2622db636358f6d7e4b0fdd715d4587f021a0d722b95808b65db2998b6fcf +SHA512 (u-boot-2023.07.tar.bz2) = c11c2dd8e44babf7d5c15c28587139f0fa7e73833bf6d4902b46780a6ed2199d007db4fec579f10b041da478dfa8c6c21e6cee76cfd65ec6cc6860c116bbc0fb diff --git a/uboot-tools.spec b/uboot-tools.spec index f035f7d..34209a0 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc4 +#global candidate rc0 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.07 -Release: 0.4%{?candidate:.%{candidate}}%{?dist} +Release: 1%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -21,14 +21,14 @@ Source1: aarch64-boards Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch Patch2: smbios-Simplify-reporting-of-unknown-values.patch Patch3: 0001-disable-NFS-support-by-default.patch +Patch4: fix-release-rev.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support Patch5: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements Patch6: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch -Patch7: rockchip-PinePhone-Pro-fixes.patch -Patch8: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch +Patch7: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch BuildRequires: bc BuildRequires: bison @@ -199,7 +199,7 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %files %doc README doc/develop/distro.rst doc/README.gpt -%doc doc/README.rockchip doc/develop/uefi doc/uImage.FIT doc/arch/arm64.rst +%doc doc/README.rockchip doc/develop/uefi doc/usage doc/arch/arm64.rst %doc builds/docs/* doc/board/amlogic/ doc/board/rockchip/ %{_bindir}/* %{_mandir}/man1/mkimage.1* @@ -213,6 +213,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Tue Jul 11 2023 Peter Robinson - 2023.07-1 +- Update to 2023.07 GA + * Fri Jun 16 2023 Peter Robinson - 2023.07-0.4.rc4 - Disable NFS by default From 1a686adf3732fa2fd9f348601518648c86009475 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 22 Jul 2023 16:57:06 +0000 Subject: [PATCH 009/128] Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild Signed-off-by: Fedora Release Engineering --- uboot-tools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 34209a0..dae5485 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.07 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Release: 2%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -213,6 +213,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Sat Jul 22 2023 Fedora Release Engineering - 2023.07-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild + * Tue Jul 11 2023 Peter Robinson - 2023.07-1 - Update to 2023.07 GA From c7752f4a3223e10fa6ac66874e25d5dcfe23eb8f Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 19 Aug 2023 12:52:49 +0100 Subject: [PATCH 010/128] 2023.10 RC2 --- 0001-disable-NFS-support-by-default.patch | 35 -- disable-VBE-by-default.patch | 28 ++ enable-bootmenu-by-default.patch | 49 +++ fix-release-rev.patch | 11 - rock64-small-fixes.patch | 476 ++++++++++++++++++++++ sources | 2 +- uboot-tools.spec | 16 +- 7 files changed, 564 insertions(+), 53 deletions(-) delete mode 100644 0001-disable-NFS-support-by-default.patch create mode 100644 disable-VBE-by-default.patch create mode 100644 enable-bootmenu-by-default.patch delete mode 100644 fix-release-rev.patch create mode 100644 rock64-small-fixes.patch diff --git a/0001-disable-NFS-support-by-default.patch b/0001-disable-NFS-support-by-default.patch deleted file mode 100644 index b520b15..0000000 --- a/0001-disable-NFS-support-by-default.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 31dc49dee987500b0d5b5b536b6da2f3fbfd5b59 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Tue, 13 Jun 2023 09:36:50 +0100 -Subject: [v1] disable NFS support by default - -While NFS is widely used in data centres, and private -networks it's quite a nuanced usecase for device firmware. -A lot of devices already disable it. - -Various network protocols should really be opt in, not opt -out, because they add extra size and are potential attack -vectors from a security PoV. In the NFS case it doesn't -really make sense for a lot of devices like tables, SBCs etc. -It's also something we don't really want for SystemReady-IR -due to security concerns. - -Signed-off-by: Peter Robinson ---- - -v1: drop RFC tag - - cmd/Kconfig | 1 - - -diff --git a/cmd/Kconfig b/cmd/Kconfig -index 365371fb511..a193929cec4 100644 ---- a/cmd/Kconfig -+++ b/cmd/Kconfig -@@ -1848,7 +1848,6 @@ config CMD_RARP - - config CMD_NFS - bool "nfs" -- default y - help - Boot image via network using NFS protocol. - diff --git a/disable-VBE-by-default.patch b/disable-VBE-by-default.patch new file mode 100644 index 0000000..dffa9fc --- /dev/null +++ b/disable-VBE-by-default.patch @@ -0,0 +1,28 @@ +From 02513d9ecc38d11ffc051ed59529e11f82164785 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Fri, 18 Aug 2023 13:28:05 +0100 +Subject: [PATCH] disable VBE by default + +Fedora doesn't support the VBE boot method, disable it +to reduce size and remove a possible boot attack vector. + +Signed-off-by: Peter Robinson +--- + boot/Kconfig | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/boot/Kconfig b/boot/Kconfig +index e8fb03b8016..467b09e2350 100644 +--- a/boot/Kconfig ++++ b/boot/Kconfig +@@ -526,7 +526,6 @@ config BOOTMETH_EFILOADER + config BOOTMETH_VBE + bool "Bootdev support for Verified Boot for Embedded" + depends on FIT +- default y + select BOOTMETH_GLOBAL + select EVENT + help +-- +2.41.0 + diff --git a/enable-bootmenu-by-default.patch b/enable-bootmenu-by-default.patch new file mode 100644 index 0000000..1ecd514 --- /dev/null +++ b/enable-bootmenu-by-default.patch @@ -0,0 +1,49 @@ +From a956480a6d52ae90ef4a46275c2ee29a4074de36 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Fri, 18 Aug 2023 23:10:42 +0100 +Subject: [PATCH] enable bootmenu by default + +We want the boot menu on all Fedora devices as it makes +it a whole lot more user friendly. + +Signed-off-by: Peter Robinson +--- + boot/Kconfig | 2 ++ + cmd/Kconfig | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/boot/Kconfig b/boot/Kconfig +index 467b09e2350..ad67b1f65a6 100644 +--- a/boot/Kconfig ++++ b/boot/Kconfig +@@ -1281,6 +1281,7 @@ config BOOTDELAY + + config AUTOBOOT_KEYED + bool "Stop autobooting via specific input key / string" ++ default y + help + This option enables stopping (aborting) of the automatic + boot feature only by issuing a specific input key or +@@ -1433,6 +1434,7 @@ config AUTOBOOT_MENUKEY + + config AUTOBOOT_MENU_SHOW + bool "Show a menu on boot" ++ default y + depends on CMD_BOOTMENU + help + This enables the boot menu, controlled by environment variables +diff --git a/cmd/Kconfig b/cmd/Kconfig +index 43ca10f69cc..3d39f2914cc 100644 +--- a/cmd/Kconfig ++++ b/cmd/Kconfig +@@ -413,6 +413,7 @@ source lib/efi_selftest/Kconfig + + config CMD_BOOTMENU + bool "bootmenu" ++ default y + select MENU + select CHARSET + help +-- +2.41.0 + diff --git a/fix-release-rev.patch b/fix-release-rev.patch deleted file mode 100644 index ad78eeb..0000000 --- a/fix-release-rev.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- u-boot-2023.07/Makefile.orig 2023-07-11 11:47:16.996315851 +0100 -+++ u-boot-2023.07/Makefile 2023-07-11 11:47:31.049391730 +0100 -@@ -3,7 +3,7 @@ - VERSION = 2023 - PATCHLEVEL = 07 - SUBLEVEL = --EXTRAVERSION = -rc6 -+EXTRAVERSION = - NAME = - - # *DOCUMENTATION* diff --git a/rock64-small-fixes.patch b/rock64-small-fixes.patch new file mode 100644 index 0000000..5ea77fb --- /dev/null +++ b/rock64-small-fixes.patch @@ -0,0 +1,476 @@ +From patchwork Wed Jun 14 12:43:12 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Peter Robinson +X-Patchwork-Id: 1794950 +X-Patchwork-Delegate: ykai007@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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=) +Authentication-Results: legolas.ozlabs.org; + dkim=pass (2048-bit key; + unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=FZFn9vAY; + 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 ECDSA (P-384)) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qh4qN0nXtz20WR + for ; Wed, 14 Jun 2023 22:44:00 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id E188F86167; + Wed, 14 Jun 2023 14:43:40 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="FZFn9vAY"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 4CE61860AA; Wed, 14 Jun 2023 14:43:37 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no + version=3.4.2 +Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com + [IPv6:2a00:1450:4864:20::133]) + (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 BEECA860C3 + for ; Wed, 14 Jun 2023 14:43:34 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=pbrobinson@gmail.com +Received: by mail-lf1-x133.google.com with SMTP id + 2adb3069b0e04-4f642a24568so8546568e87.2 + for ; Wed, 14 Jun 2023 05:43:34 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1686746614; x=1689338614; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=sjzdpxK2W2UaYKf4Dbb6vo2R4h51tHoSQv2PLAL+ytA=; + b=FZFn9vAYzx95g5Cma3VU7TW3RzrwGrr2DTEZogYSk3tr58CXaHbRCJAD8suFJLbB18 + 4Uh25vZecFfXajC8z3+nGc/G+yLjO4p+uHq9laCmR1d/OjJadseCHzdHF2vgrMFi4x3U + c2A7F/JYazfKq/1McGMyMsI899Ot9xB8lffElanhTShEGmUwMjSzvalWbJA9ZUkisJvX + 1lfsoPk+26gamlPG4QftIFmXpxUf5pcRqA7pSzgOWyGcPSb8e5HBvcMnMTlNaRSNcjKs + k+TnZww3gSKjD+VxWck1VwgeEK8X4cPgV6HyI4TSSnjWSn2qjy6YW8eJWS4K/h+48RWn + 5VKA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1686746614; x=1689338614; + 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=sjzdpxK2W2UaYKf4Dbb6vo2R4h51tHoSQv2PLAL+ytA=; + b=TIUdzRnLC89Ao7oVBZZH1iJgNXJg4bFp54s574ftCbOZSDxA49ZHH8ULPGzHpCG0ze + ffGZYszi+DbRLFr92kxE5wgmGjiMapn8MfDaNs5tFm31rBk7QeHIwNH2WwHmmERtGSfi + NbA6vIBYmQFUgdc2GxAfmwQkmyEqnlZUwxz43Goz6W7OnoYofitm9fM2P5JAjVEC9B4g + 3zqxZDCIEJmgTHUpPWgqM1QwJtQA9trNTMJESxsTocqABFS+cCPJCj9HitbWYe3TNGeG + JT6Ma3umJF+whshi0h/4csqV5wCXy5FHEC0nx/p88Tq+o/zCveJu1f16B8PQ3baaIw6n + Bj3Q== +X-Gm-Message-State: AC+VfDwm3GSwcQOMRo9W3rdlJIQd8KXeHulIsQkeI3v53WVLSbA4UQji + Er6vsMhWXQhyhjlcr1WdCnc= +X-Google-Smtp-Source: + ACHHUZ6pFh8GXXZTuMA7izeqjUHeS1gbvk8BisDz2HsWH0v5R9/HJDxhuCGwt4wFH7TA2hi2Y/haJg== +X-Received: by 2002:a19:4359:0:b0:4f3:b4a9:a619 with SMTP id + m25-20020a194359000000b004f3b4a9a619mr7072659lfj.40.1686746613623; + Wed, 14 Jun 2023 05:43:33 -0700 (PDT) +Received: from morpheus.home.roving-it.com + (3.e.2.0.0.0.0.0.0.0.0.0.0.0.0.0.1.8.6.2.1.1.b.f.0.b.8.0.1.0.0.2.ip6.arpa. + [2001:8b0:fb11:2681::2e3]) by smtp.googlemail.com with ESMTPSA id + g26-20020a7bc4da000000b003f60e143d38sm17329161wmk.11.2023.06.14.05.43.33 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 14 Jun 2023 05:43:33 -0700 (PDT) +From: Peter Robinson +To: "Matwey V. Kornilov" , + Simon Glass , Philipp Tomsich , + Kever Yang , u-boot@lists.denx.de +Cc: Peter Robinson +Subject: [PATCH 2/4] config: rock64: enable efuse for stable mac addr +Date: Wed, 14 Jun 2023 13:43:12 +0100 +Message-ID: <20230614124329.244462-2-pbrobinson@gmail.com> +X-Mailer: git-send-email 2.41.0 +In-Reply-To: <20230614124329.244462-1-pbrobinson@gmail.com> +References: <20230614124329.244462-1-pbrobinson@gmail.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 + +Enable the rockchip efuse driver on the Rock64 to +provide a stable ethernet address on the device. + +Signed-off-by: Peter Robinson +Reviewed-by: Kever Yang +--- + +While the rockchip efuse driver currently has issues on rk3328 due to, I believe, it +not being properly initialised in ATF, enabling it at least provides a stable MAC +adress on the NIC which I think makes it worthwhile + + configs/rock64-rk3328_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig +index 1da9b0545a5..97ac8734d1b 100644 +--- a/configs/rock64-rk3328_defconfig ++++ b/configs/rock64-rk3328_defconfig +@@ -74,6 +74,7 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y + CONFIG_MISC=y ++CONFIG_ROCKCHIP_EFUSE=y + CONFIG_MMC_DW=y + CONFIG_MMC_DW_ROCKCHIP=y + CONFIG_SPI_FLASH_GIGADEVICE=y + +From patchwork Wed Jun 14 12:43:13 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Peter Robinson +X-Patchwork-Id: 1794951 +X-Patchwork-Delegate: ykai007@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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=) +Authentication-Results: legolas.ozlabs.org; + dkim=pass (2048-bit key; + unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=WIV1zbyE; + 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 ECDSA (P-384)) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qh4qf6BLXz20WR + for ; Wed, 14 Jun 2023 22:44:14 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 5B12B86146; + Wed, 14 Jun 2023 14:43:44 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="WIV1zbyE"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 5200686146; Wed, 14 Jun 2023 14:43:39 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no + version=3.4.2 +Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com + [IPv6:2a00:1450:4864:20::336]) + (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 0F3CC860FE + for ; Wed, 14 Jun 2023 14:43:35 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=pbrobinson@gmail.com +Received: by mail-wm1-x336.google.com with SMTP id + 5b1f17b1804b1-3f8c74af64fso5587725e9.1 + for ; Wed, 14 Jun 2023 05:43:35 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1686746614; x=1689338614; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=Jne9SqWnJdgDpj5mkPbP6jWrorHm2Ewr8ivuyd1zKBQ=; + b=WIV1zbyEf76/AZV4av4Ab6kytOWNx4Cgr8LFRAVy0DIDj6GKOPyPg7yVsSUOtkkQPR + 4plpstbCTo2xN/epjgrDc70Y2XNal4Y8c8EZIDkfSPn7mVN3vBZscIpajCVK9oMY006G + hQ/3lRYirYKtJbAOt5oRXWqGqXdlrfXMqhDA9dRla5l3J1Px77QZiE7/czqNeryTcrSC + nQJKPLOKXZZwzI7Dcv4QtfBMI2zpkStKYCHynOnD96H1Fm/CRfc4RmKiW3UgJVfCn5eC + 5QHH+onIEDk91Izuk4qry+RAGnMwqv7WthL3hMJY2+gMuJiGbTyNsQZ2VAoD1qgVHXY9 + p/mg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1686746614; x=1689338614; + 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=Jne9SqWnJdgDpj5mkPbP6jWrorHm2Ewr8ivuyd1zKBQ=; + b=bPn3UB+Nr7fgBm9Vrhg5MVBNiRLiVAR6TPvKWbUGhJ4kytAVtZPyUZrO2FJgbWkSay + uQG5vH7K+ytlJdki06QVI8h99N241iYpSqqA2GjEMWCkes4ATEyMuC112uBb66PpjHJR + 44wpSYTUdxyNSVbtOC5svYFBrcOtrWn3XptxoCrPswBAXXMloirTxyh3TqUOond2NNDc + 7cgEcz1aIYnW2s9BPIZSuCrTO491tBU3Rcd1ubL+7gbMX/Z4hG0fgUdPU6pf4oxQNZ78 + kYue8TdOqV/ksCbzxgMFPXPrwmAVAuodAoaRpDH449SvEr9TNT+k1SJEve21VwZCyZAN + k/3w== +X-Gm-Message-State: AC+VfDz+euUQ/kYf5v84y5arXPpq6LOLBmbUqMFIVVB7/TmpcGsagHMr + v64fxEF0CGVXk4pqvA+7upE= +X-Google-Smtp-Source: + ACHHUZ47g7ktmMWUGnTvkK4deYzNa9InQuYnEmy91+AuY7+Avu9rVE/HmGTqh7XE7FzZF8tB2Wscww== +X-Received: by 2002:a05:600c:364f:b0:3f6:c8c:7048 with SMTP id + y15-20020a05600c364f00b003f60c8c7048mr10715141wmq.20.1686746614238; + Wed, 14 Jun 2023 05:43:34 -0700 (PDT) +Received: from morpheus.home.roving-it.com + (3.e.2.0.0.0.0.0.0.0.0.0.0.0.0.0.1.8.6.2.1.1.b.f.0.b.8.0.1.0.0.2.ip6.arpa. + [2001:8b0:fb11:2681::2e3]) by smtp.googlemail.com with ESMTPSA id + g26-20020a7bc4da000000b003f60e143d38sm17329161wmk.11.2023.06.14.05.43.33 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 14 Jun 2023 05:43:33 -0700 (PDT) +From: Peter Robinson +To: "Matwey V. Kornilov" , + Simon Glass , Philipp Tomsich , + Kever Yang , u-boot@lists.denx.de +Cc: Peter Robinson +Subject: [PATCH 3/4] rockchip: dts: rk3328: Add rng details to u-boot.dtsi +Date: Wed, 14 Jun 2023 13:43:13 +0100 +Message-ID: <20230614124329.244462-3-pbrobinson@gmail.com> +X-Mailer: git-send-email 2.41.0 +In-Reply-To: <20230614124329.244462-1-pbrobinson@gmail.com> +References: <20230614124329.244462-1-pbrobinson@gmail.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 the rk3328 rng details to the u-boot.dtsi and +enable the RNG on the Rock64 to be able to provide +a rnadom seed via UEFI. + +Signed-off-by: Peter Robinson +--- + +The DT snippet will allow this to be enabled on other rk3328 devices but +I only have the Rock54 to test on. + + arch/arm/dts/rk3328-u-boot.dtsi | 6 ++++++ + configs/rock64-rk3328_defconfig | 2 ++ + 2 files changed, 8 insertions(+) + +diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi +index ce96ce40a73..a9f2536de2a 100644 +--- a/arch/arm/dts/rk3328-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-u-boot.dtsi +@@ -26,6 +26,12 @@ + 0x0 0xff720000 0x0 0x1000 + 0x0 0xff798000 0x0 0x1000>; + }; ++ ++ rng: rng@ff060000 { ++ compatible = "rockchip,cryptov1-rng"; ++ reg = <0x0 0xff060000 0x0 0x4000>; ++ status = "okay"; ++ }; + }; + + &cru { +diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig +index 97ac8734d1b..1820deee373 100644 +--- a/configs/rock64-rk3328_defconfig ++++ b/configs/rock64-rk3328_defconfig +@@ -77,6 +77,8 @@ CONFIG_MISC=y + CONFIG_ROCKCHIP_EFUSE=y + CONFIG_MMC_DW=y + CONFIG_MMC_DW_ROCKCHIP=y ++CONFIG_DM_RNG=y ++CONFIG_RNG_ROCKCHIP=y + CONFIG_SPI_FLASH_GIGADEVICE=y + CONFIG_ETH_DESIGNWARE=y + CONFIG_GMAC_ROCKCHIP=y + +From patchwork Wed Jun 14 12:43:14 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Peter Robinson +X-Patchwork-Id: 1794952 +X-Patchwork-Delegate: ykai007@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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=) +Authentication-Results: legolas.ozlabs.org; + dkim=pass (2048-bit key; + unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=Fk8Gn/bp; + 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 ECDSA (P-384) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qh4qx1cDFz20WR + for ; Wed, 14 Jun 2023 22:44:29 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 42BE586140; + Wed, 14 Jun 2023 14:43:47 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="Fk8Gn/bp"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 5363386119; Wed, 14 Jun 2023 14:43:40 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no + version=3.4.2 +Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com + [IPv6:2a00:1450:4864:20::432]) + (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 92EA186130 + for ; Wed, 14 Jun 2023 14:43:35 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=pbrobinson@gmail.com +Received: by mail-wr1-x432.google.com with SMTP id + ffacd0b85a97d-31110aea814so555f8f.2 + for ; Wed, 14 Jun 2023 05:43:35 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1686746615; x=1689338615; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=GunsDF8pMC87eoXzdmDNRZz8DMTMTGTC8JJJKs0JxI4=; + b=Fk8Gn/bpnLP7olTGYnvDxvwbEfNNa1rl1mPZ4QelJXPFqGN4+shTjFbREgSRC/dMtW + yRez1jgUlJRK7lz8uY+O+exV8NdCbcHbzvdQtHDCDnQqLKjgIPVMjLyH5VIJECxjXc8/ + FuocNJXIdjBBfLC1msErM2xm850WcNYbIZ+hPDOwpMTYitpqvM3xhwL6vIJlsBw6BqaC + C5MKw4jWH3KCYzU6kqLsP3reuse4YwOUK8BoRfC130ebJzm2MhRdj1xfOvTMNGNNKO9b + Ii5zq3BB7VZqdM3vFNWva7lFwc6nzvSx026CBWC04UbxKmp2qd8WgU/GHTgnV8lcL/sz + 5uBQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1686746615; x=1689338615; + 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=GunsDF8pMC87eoXzdmDNRZz8DMTMTGTC8JJJKs0JxI4=; + b=ZU+X/vMacHAmhpPxEEwUnlvwe6qSQQDPnUVljh0mCFS+0MlJyOgFlaJdQKr4qZ9028 + 5HU/u7kr7mvPN4LvU1sVBZ4QlyI8rrgzMl576uvBb3rZ8AQ5aQJCvUrYOPUilPyNbhWq + lDMZCjWuHeKLpwutkyLveGg0yVgYz8i4STe35fH7B3q60K/v+y9G8wFJUdN+XV8c2+Gx + MTSE42FF8tOnHkXPIFXmh4LKO5BQWAHQuYadILsFo2pUahMfroOaCT2xVQzDmC+Ur76L + Bw1TPPC/b69/qHFZwuG0/5e6ansfMs1oO6DCGOIMxLzJch7c6VC/WJql/xOnO/c4os12 + swLw== +X-Gm-Message-State: AC+VfDy9BKAtjnGx6ud2kU6GAYtOOxIFuTpeAhT+l9wtZ+C3zpK6T+ld + CD+kjgM7Fs3oCfEFfoOLmJE= +X-Google-Smtp-Source: + ACHHUZ6WCesQBbBQ0kQoCj860p1GMKM0o6UKw7uiH/CWAXkwqPWFIEw+YhmaoR6ynnvAzLDQ3IbsCw== +X-Received: by 2002:adf:fec4:0:b0:30f:ce9a:7632 with SMTP id + q4-20020adffec4000000b0030fce9a7632mr3527925wrs.67.1686746614858; + Wed, 14 Jun 2023 05:43:34 -0700 (PDT) +Received: from morpheus.home.roving-it.com + (3.e.2.0.0.0.0.0.0.0.0.0.0.0.0.0.1.8.6.2.1.1.b.f.0.b.8.0.1.0.0.2.ip6.arpa. + [2001:8b0:fb11:2681::2e3]) by smtp.googlemail.com with ESMTPSA id + g26-20020a7bc4da000000b003f60e143d38sm17329161wmk.11.2023.06.14.05.43.34 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 14 Jun 2023 05:43:34 -0700 (PDT) +From: Peter Robinson +To: "Matwey V. Kornilov" , + Simon Glass , Philipp Tomsich , + Kever Yang , u-boot@lists.denx.de +Cc: Peter Robinson +Subject: [PATCH 4/4] rockchip: dts: rk3328: rock64: Align spi flash entry +Date: Wed, 14 Jun 2023 13:43:14 +0100 +Message-ID: <20230614124329.244462-4-pbrobinson@gmail.com> +X-Mailer: git-send-email 2.41.0 +In-Reply-To: <20230614124329.244462-1-pbrobinson@gmail.com> +References: <20230614124329.244462-1-pbrobinson@gmail.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 + +Align the SPI flash entry with upstream. There's no need +to diverge here. + +Signed-off-by: Peter Robinson +Reviewed-by: Kever Yang +--- + arch/arm/dts/rk3328-rock64-u-boot.dtsi | 2 +- + arch/arm/dts/rk3328-rock64.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/dts/rk3328-rock64-u-boot.dtsi b/arch/arm/dts/rk3328-rock64-u-boot.dtsi +index 849854302ee..6904515b969 100644 +--- a/arch/arm/dts/rk3328-rock64-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-rock64-u-boot.dtsi +@@ -54,7 +54,7 @@ + }; + + &spi0 { +- spi_flash: spiflash@0 { ++ spi_flash: flash@0 { + bootph-all; + }; + }; +diff --git a/arch/arm/dts/rk3328-rock64.dts b/arch/arm/dts/rk3328-rock64.dts +index 1b0f7e4551e..f69a38f42d2 100644 +--- a/arch/arm/dts/rk3328-rock64.dts ++++ b/arch/arm/dts/rk3328-rock64.dts +@@ -345,7 +345,7 @@ + &spi0 { + status = "okay"; + +- spiflash@0 { ++ flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + diff --git a/sources b/sources index 150374f..1504d9e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.07.tar.bz2) = c11c2dd8e44babf7d5c15c28587139f0fa7e73833bf6d4902b46780a6ed2199d007db4fec579f10b041da478dfa8c6c21e6cee76cfd65ec6cc6860c116bbc0fb +SHA512 (u-boot-2023.10-rc2.tar.bz2) = cc3cd85c84e1d7d8e45244f330709ad5ecf918ee42aac4de565ca5e1e1cde25e89b1a8672aaac04c0bf830e36192a72caabfde3baf6633c68fa76103768be201 diff --git a/uboot-tools.spec b/uboot-tools.spec index dae5485..5774bc2 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -#global candidate rc0 +%global candidate rc2 %if 0%{?rhel} %bcond_with toolsonly %else @@ -6,8 +6,8 @@ %endif Name: uboot-tools -Version: 2023.07 -Release: 2%{?candidate:.%{candidate}}%{?dist} +Version: 2023.10 +Release: 0.1%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -20,15 +20,16 @@ Source1: aarch64-boards # Needed to find DT on boot partition that's not the first partition Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch Patch2: smbios-Simplify-reporting-of-unknown-values.patch -Patch3: 0001-disable-NFS-support-by-default.patch -Patch4: fix-release-rev.patch +Patch3: disable-VBE-by-default.patch +Patch4: enable-bootmenu-by-default.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support Patch5: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements Patch6: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch -Patch7: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch +Patch7: rock64-small-fixes.patch +#Patch7: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch BuildRequires: bc BuildRequires: bison @@ -213,6 +214,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Fri Aug 18 2023 Peter Robinson - 2023.10-0.1.rc2 +- Update to 2023.10 RC2 + * Sat Jul 22 2023 Fedora Release Engineering - 2023.07-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild From 99f3204130b5d9f77717f67c1fa08e9e06f003e5 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 19 Aug 2023 14:33:37 +0100 Subject: [PATCH 011/128] Raspberry Pi standard boot --- rpi-Convert-to-standard-boot.patch | 892 +++++++++++++++++++++++++++++ uboot-tools.spec | 6 +- 2 files changed, 897 insertions(+), 1 deletion(-) create mode 100644 rpi-Convert-to-standard-boot.patch diff --git a/rpi-Convert-to-standard-boot.patch b/rpi-Convert-to-standard-boot.patch new file mode 100644 index 0000000..de02728 --- /dev/null +++ b/rpi-Convert-to-standard-boot.patch @@ -0,0 +1,892 @@ +From patchwork Thu Jul 27 21:54:28 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Simon Glass +X-Patchwork-Id: 1813968 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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=) +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 + header.s=google header.b=N1JBl/Ip; + 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 ECDSA (P-384)) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4RBl1V3MSFz1yZb + for ; Fri, 28 Jul 2023 07:55:10 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 29D6686883; + Thu, 27 Jul 2023 23:54:50 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +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=chromium.org header.i=@chromium.org + header.b="N1JBl/Ip"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id BFC74863EE; Thu, 27 Jul 2023 23:54:44 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no + version=3.4.2 +Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com + [IPv6:2607:f8b0:4864:20::12d]) + (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 A9CE3867A8 + for ; Thu, 27 Jul 2023 23:54:41 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sjg@chromium.org +Received: by mail-il1-x12d.google.com with SMTP id + e9e14a558f8ab-3466725f0beso6233385ab.1 + for ; Thu, 27 Jul 2023 14:54:41 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=chromium.org; s=google; t=1690494880; x=1691099680; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=PfW4qtLSfZ+bnC9lQwrjMDVmboUSfVp8v4ohkW8rjNg=; + b=N1JBl/IpuUO0bR2jxCF4K6S6GW+xv1r7HlydRFhGC+Y0jR6zVXjPOQITlZBrwEARlk + THRvjpw5qRIedk0NNo/pQCKKQqruScbjKPYX1OBI4dK8j/HkC/GExnZkrzqJlvtCNqRi + vd32bzFnA0G7Sw/tWm/fMJuxGDvemFLzoLQgg= +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1690494880; x=1691099680; + 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=PfW4qtLSfZ+bnC9lQwrjMDVmboUSfVp8v4ohkW8rjNg=; + b=htLAMKMTT/T5aB5rrz1DwCj312u/yXPKNVhy1hUQl0xUxGmuV261y4snpFJIp92LWY + bPTp84aFfLtyyJhH6BRikYrtWYDX1XpPE35ADFLtlQMM5GIU9q0hkifkPd7abPqf9CjN + 34tE1/jfbEQ9DVjGSSH+XObnLtGLjO2UX0/c9ws1veWcDD9e9lre0Tr0FdMyy+r4RdCC + V39BVGSWBW9Mr3+y6MVHLCblg21I+/bjRp2nviWmZbeJhx4cKepnzFGfm5KjWnIujj0D + Y86K9+ZBDN2NRnIyfK6oPrQqLMSObWKrzxurO93MsbUXmBc8FJqZwyN2XUixqo8t6Kso + pNvg== +X-Gm-Message-State: ABy/qLb0K45Zq6AUJT2FpWarTb3YBaFoeytG1lXRxYdhcArX6FKSUhG7 + DkuKoL8etDw0hNEDFIyMz2KF4qEO37wmml3Qc3M= +X-Google-Smtp-Source: + APBJJlG54VUHOmyZVhkSmMpIiz5S/hblBzg2zwJFl+9fxJRZJWQN2zHspMrpRxc36G3YPyvYcXHJ4A== +X-Received: by 2002:a05:6e02:1ba5:b0:347:6f47:bb2 with SMTP id + n5-20020a056e021ba500b003476f470bb2mr889940ili.19.1690494880268; + Thu, 27 Jul 2023 14:54:40 -0700 (PDT) +Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) + by smtp.gmail.com with ESMTPSA id + n28-20020a02cc1c000000b00430245071ddsm679215jap.176.2023.07.27.14.54.39 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Thu, 27 Jul 2023 14:54:40 -0700 (PDT) +From: Simon Glass +To: U-Boot Mailing List +Cc: Tom Rini , Peter Robinson , + Simon Glass , Albert Aribaud , + Matthias Brugger , Stephen Warren , + Stephen Warren +Subject: [RESEND PATCH v3 1/3] arm: rpi: Switch to standard boot +Date: Thu, 27 Jul 2023 15:54:28 -0600 +Message-ID: <20230727215433.578830-2-sjg@chromium.org> +X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog +In-Reply-To: <20230727215433.578830-1-sjg@chromium.org> +References: <20230727215433.578830-1-sjg@chromium.org> +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 + +Drop use of the distro scripts and use standard boot instead. + +We don't need to specify the mmc devices individually, since they are +used in order from 0 to 2, and standard boot uses that order anyway. + +Signed-off-by: Simon Glass +--- + +Changes in v3: +- Rebase to -master + +Changes in v2: +- Rebase to -next + + configs/rpi_0_w_defconfig | 1 + + configs/rpi_2_defconfig | 1 + + configs/rpi_3_32b_defconfig | 1 + + configs/rpi_3_b_plus_defconfig | 1 + + configs/rpi_3_defconfig | 1 + + configs/rpi_4_32b_defconfig | 1 + + configs/rpi_4_defconfig | 1 + + configs/rpi_arm64_defconfig | 1 + + configs/rpi_defconfig | 1 + + include/configs/rpi.h | 38 ++-------------------------------- + 10 files changed, 11 insertions(+), 36 deletions(-) + +diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig +index 5da334a8bcf9..7554e671e2ca 100644 +--- a/configs/rpi_0_w_defconfig ++++ b/configs/rpi_0_w_defconfig +@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-zero-w" + CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y +diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig +index 990862160712..653f78bec1e8 100644 +--- a/configs/rpi_2_defconfig ++++ b/configs/rpi_2_defconfig +@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2836-rpi-2-b" + CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y +diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig +index 80885aa9488d..305f1dacfd46 100644 +--- a/configs/rpi_3_32b_defconfig ++++ b/configs/rpi_3_32b_defconfig +@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" + CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y +diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig +index 0acce8b883f8..f36f1258aa6d 100644 +--- a/configs/rpi_3_b_plus_defconfig ++++ b/configs/rpi_3_b_plus_defconfig +@@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b-plus" + CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y +diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig +index bb6fe128061b..a0d8be42537f 100644 +--- a/configs/rpi_3_defconfig ++++ b/configs/rpi_3_defconfig +@@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" + CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y +diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig +index f6213340971e..71f61c52e52d 100644 +--- a/configs/rpi_4_32b_defconfig ++++ b/configs/rpi_4_32b_defconfig +@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_DM_RESET=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_PCI=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y +diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig +index bbc0fd6c649a..fa2c05da21e8 100644 +--- a/configs/rpi_4_defconfig ++++ b/configs/rpi_4_defconfig +@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_DM_RESET=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_PCI=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y +diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig +index 5d9a273cb920..3e64573b70b1 100644 +--- a/configs/rpi_arm64_defconfig ++++ b/configs/rpi_arm64_defconfig +@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_DM_RESET=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_PCI=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y +diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig +index 550b8dcb9587..4b8e402c89d4 100644 +--- a/configs/rpi_defconfig ++++ b/configs/rpi_defconfig +@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b" + CONFIG_SYS_PROMPT="U-Boot> " + CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 ++CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y + CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y +diff --git a/include/configs/rpi.h b/include/configs/rpi.h +index 4da982f73578..4160db2d8e14 100644 +--- a/include/configs/rpi.h ++++ b/include/configs/rpi.h +@@ -122,47 +122,13 @@ + "fdt_addr_r=0x02600000\0" \ + "ramdisk_addr_r=0x02700000\0" + +-#if IS_ENABLED(CONFIG_CMD_MMC) +- #define BOOT_TARGET_MMC(func) \ +- func(MMC, mmc, 0) \ +- func(MMC, mmc, 1) \ +- func(MMC, mmc, 2) +-#else +- #define BOOT_TARGET_MMC(func) +-#endif +- +-#if IS_ENABLED(CONFIG_CMD_USB) +- #define BOOT_TARGET_USB(func) func(USB, usb, 0) +-#else +- #define BOOT_TARGET_USB(func) +-#endif +- +-#if CONFIG_IS_ENABLED(CMD_PXE) +- #define BOOT_TARGET_PXE(func) func(PXE, pxe, na) +-#else +- #define BOOT_TARGET_PXE(func) +-#endif +- +-#if CONFIG_IS_ENABLED(CMD_DHCP) +- #define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na) +-#else +- #define BOOT_TARGET_DHCP(func) +-#endif +- +-#define BOOT_TARGET_DEVICES(func) \ +- BOOT_TARGET_MMC(func) \ +- BOOT_TARGET_USB(func) \ +- BOOT_TARGET_PXE(func) \ +- BOOT_TARGET_DHCP(func) +- +-#include ++#define BOOT_TARGETS "mmc usb pxe dhcp" + + #define CFG_EXTRA_ENV_SETTINGS \ + "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ + ENV_DEVICE_SETTINGS \ + ENV_DFU_SETTINGS \ + ENV_MEM_LAYOUT_SETTINGS \ +- BOOTENV +- ++ "boot_targets=" BOOT_TARGETS "\0" + + #endif + +From patchwork Thu Jul 27 21:54:29 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Simon Glass +X-Patchwork-Id: 1813969 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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=) +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 + header.s=google header.b=nzf25ZVl; + 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 ECDSA (P-384) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4RBl1p1S1xz1yZb + for ; Fri, 28 Jul 2023 07:55:26 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id CEB4186898; + Thu, 27 Jul 2023 23:55:12 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +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=chromium.org header.i=@chromium.org + header.b="nzf25ZVl"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id A550186437; Thu, 27 Jul 2023 23:54: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.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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no + version=3.4.2 +Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com + [IPv6:2607:f8b0:4864:20::d35]) + (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 848728687F + for ; Thu, 27 Jul 2023 23:54:42 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sjg@chromium.org +Received: by mail-io1-xd35.google.com with SMTP id + ca18e2360f4ac-7906614bc90so37744039f.3 + for ; Thu, 27 Jul 2023 14:54:42 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=chromium.org; s=google; t=1690494881; x=1691099681; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=rvJFSxuX2uR5MvGPMP0r8JMhRHphT9SXIfCxnVxNK0U=; + b=nzf25ZVlr+TPb8i9KPe94q+xnslw0eiim8ufkD20J+REgYqV1+bfKhPYKo45AkO/Cs + 4b6fZA33NLf5U7qgGo7v+urHNiAPER6YN1bXI9hJSNAEtM13z2v621IsEFffyVMcM85C + 4AMfUiBclfET9Wn0oQnsQ5JK94HV4jlQugZzQ= +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1690494881; x=1691099681; + 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=rvJFSxuX2uR5MvGPMP0r8JMhRHphT9SXIfCxnVxNK0U=; + b=SWZg15tnmLFbQbK+nDA8NsoxsfTOrSK/kUZE8JUBjXnb/EfYfPfZWjBXdTlOT0hTzs + Do1oyQ0GpF9az6Cx1cJaNL+6/ndCRmpmhbQqCvSRgBsAKnQp00cgnet2sm4yVWfiF5PX + 2qaBEeb9gg636lDes6X4aWDvc+t+OzxAlyoh09leqtoNsYaZ9IaM0yoiS8fr0BiqJMrg + MSYnMIsBLMm+jhgQFf2e8ur5tdy7JpF2W9IWlzTu24aMYaDO7jzv2OPLE4yabyZoUIxZ + VGKiZBQssS0Xb/sjea7V65wIws1WhJUfrh088lrlqAdsj+ZlnkWnVhBhlZPR+tkRHWJZ + HcHw== +X-Gm-Message-State: ABy/qLaVdYCT7tOkUReGBSdg/9KznV2sYfo8iTdWbZcW3wegZxOZfpEX + rfBbszTe7MI5Zzj4HA69r3jTlgsxblkKBaKi4I0= +X-Google-Smtp-Source: + APBJJlGWO4DcArS83mKgiEVe92ZPEk/c3kJN6Gj7ZAwNVPMXoPhbtveScu/4+gTrfnrjCxTkZP9a3g== +X-Received: by 2002:a05:6602:682:b0:787:1d53:e6cc with SMTP id + dp2-20020a056602068200b007871d53e6ccmr874039iob.21.1690494881076; + Thu, 27 Jul 2023 14:54:41 -0700 (PDT) +Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) + by smtp.gmail.com with ESMTPSA id + n28-20020a02cc1c000000b00430245071ddsm679215jap.176.2023.07.27.14.54.40 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Thu, 27 Jul 2023 14:54:40 -0700 (PDT) +From: Simon Glass +To: U-Boot Mailing List +Cc: Tom Rini , Peter Robinson , + Simon Glass , Matthias Brugger , + Stephen Warren , Stephen Warren +Subject: [RESEND PATCH v3 2/3] rpi: Disable DISTRO_DEFAULTS +Date: Thu, 27 Jul 2023 15:54:29 -0600 +Message-ID: <20230727215433.578830-3-sjg@chromium.org> +X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog +In-Reply-To: <20230727215433.578830-1-sjg@chromium.org> +References: <20230727215433.578830-1-sjg@chromium.org> +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 + +Disable this option to reclaim some space, since bootstd requires less +functionality to operate (e.g. hush parser). + +Signed-off-by: Simon Glass +--- + +(no changes since v2) + +Changes in v2: +- Add new patch to disable DISTRO_DEFAULTS + + configs/rpi_0_w_defconfig | 1 - + configs/rpi_2_defconfig | 1 - + configs/rpi_3_32b_defconfig | 1 - + configs/rpi_3_b_plus_defconfig | 1 - + configs/rpi_3_defconfig | 1 - + configs/rpi_4_32b_defconfig | 1 - + configs/rpi_4_defconfig | 1 - + configs/rpi_arm64_defconfig | 1 - + configs/rpi_defconfig | 1 - + 9 files changed, 9 deletions(-) + +diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig +index 7554e671e2ca..3167bfbe48f7 100644 +--- a/configs/rpi_0_w_defconfig ++++ b/configs/rpi_0_w_defconfig +@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set +diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig +index 653f78bec1e8..883dab161702 100644 +--- a/configs/rpi_2_defconfig ++++ b/configs/rpi_2_defconfig +@@ -15,7 +15,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set +diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig +index 305f1dacfd46..5ff7d987a431 100644 +--- a/configs/rpi_3_32b_defconfig ++++ b/configs/rpi_3_32b_defconfig +@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set +diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig +index f36f1258aa6d..31f2a6eb310c 100644 +--- a/configs/rpi_3_b_plus_defconfig ++++ b/configs/rpi_3_b_plus_defconfig +@@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set +diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig +index a0d8be42537f..fa6e1507d640 100644 +--- a/configs/rpi_3_defconfig ++++ b/configs/rpi_3_defconfig +@@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set +diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig +index 71f61c52e52d..55bf6c0770f0 100644 +--- a/configs/rpi_4_32b_defconfig ++++ b/configs/rpi_4_32b_defconfig +@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_PCI=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + CONFIG_PREBOOT="pci enum; usb start;" + # CONFIG_DISPLAY_CPUINFO is not set +diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig +index fa2c05da21e8..6679cce9a165 100644 +--- a/configs/rpi_4_defconfig ++++ b/configs/rpi_4_defconfig +@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_PCI=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + CONFIG_PREBOOT="pci enum; usb start;" + # CONFIG_DISPLAY_CPUINFO is not set +diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig +index 3e64573b70b1..26e29ffb5a1f 100644 +--- a/configs/rpi_arm64_defconfig ++++ b/configs/rpi_arm64_defconfig +@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_PCI=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + CONFIG_PREBOOT="pci enum; usb start;" + # CONFIG_DISPLAY_CPUINFO is not set +diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig +index 4b8e402c89d4..0ac5efec717b 100644 +--- a/configs/rpi_defconfig ++++ b/configs/rpi_defconfig +@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y + CONFIG_SYS_LOAD_ADDR=0x1000000 + CONFIG_BOOTSTD_DEFAULTS=y + CONFIG_OF_BOARD_SETUP=y +-CONFIG_DISTRO_DEFAULTS=y + CONFIG_USE_PREBOOT=y + # CONFIG_DISPLAY_CPUINFO is not set + # CONFIG_DISPLAY_BOARDINFO is not set + +From patchwork Thu Jul 27 21:54:30 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Simon Glass +X-Patchwork-Id: 1813970 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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=) +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 + header.s=google header.b=mBws8fys; + 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 ECDSA (P-384)) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4RBl220N1zz1yZb + for ; Fri, 28 Jul 2023 07:55:38 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 7E187868A9; + Thu, 27 Jul 2023 23:55:29 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +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=chromium.org header.i=@chromium.org + header.b="mBws8fys"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 7F3798687F; Thu, 27 Jul 2023 23:54:47 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no + version=3.4.2 +Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com + [IPv6:2607:f8b0:4864:20::d31]) + (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 6FD6A86883 + for ; Thu, 27 Jul 2023 23:54:43 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sjg@chromium.org +Received: by mail-io1-xd31.google.com with SMTP id + ca18e2360f4ac-7878e573827so57883239f.1 + for ; Thu, 27 Jul 2023 14:54:43 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=chromium.org; s=google; t=1690494882; x=1691099682; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=YMeq2z0BceWJEeXZ+KPCl2/DO9snM/APf71IQJ8+EHM=; + b=mBws8fysMfDnws5xSckJmwYoFnbO4f08B6wlUEznhDpb/FVohJO+FmfQbnHUDUDsSy + Ee6d5JuG8wVUQSapqqsi2JXsNwfvnzsA0e7QaUoJptoauwkl1oKG+AZ91ThkEcjXdL6O + RK775AhnEeLE5jMuVBfe9uFq6Re05aeM+vdsU= +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1690494882; x=1691099682; + 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=YMeq2z0BceWJEeXZ+KPCl2/DO9snM/APf71IQJ8+EHM=; + b=JCEGP9SG2bCGvzpYyon4ZvzAorqfIf8zfk2pJUGBNzjUUgshrJ61sNPKq511ECI9Iq + 4yxAoqYQDXgSv32IWK7fI0cGnv7QlyXjPSVE42G6W+gO2BZAnd0nUhwVSoV4Llz1vwx5 + RVOUfXyUZVtm/98JYyMavbvbNvnFy2RmefMLDz3Q3ES8eb7l8KclgtnPTpvsNdO4pw4W + MVzDzaNyuZq1tfHjYJz1UTC7G5rfiqkgThZbvc0VAa3wEnxtT4xxFIfebHKkyqbLqQ/6 + CfuFspsQDYnNZ4pVUaM9P6SWPzRKLIFCThE3AZDKEjW9hb9O1MOTzablkioHKNFipH2v + 8aPw== +X-Gm-Message-State: ABy/qLbiMvFNCnHAWkxWhayqbqcbzPbE/txTwyh8SaP8/5b7BdEzsSap + DdDHhSzoDCe+X4IQmkeApNsbmjJmALrfhBJBa1E= +X-Google-Smtp-Source: + APBJJlE+7X+YHtsSdv0glv6+7e+JF2c+SP9bOM3kvNRjEtcpLydgTQTDsxizlaaU3s5ZzSPXDsW9LQ== +X-Received: by 2002:a6b:d902:0:b0:786:cd9b:1ccd with SMTP id + r2-20020a6bd902000000b00786cd9b1ccdmr812254ioc.0.1690494881976; + Thu, 27 Jul 2023 14:54:41 -0700 (PDT) +Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) + by smtp.gmail.com with ESMTPSA id + n28-20020a02cc1c000000b00430245071ddsm679215jap.176.2023.07.27.14.54.41 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Thu, 27 Jul 2023 14:54:41 -0700 (PDT) +From: Simon Glass +To: U-Boot Mailing List +Cc: Tom Rini , Peter Robinson , + Simon Glass , Albert Aribaud , + Matthias Brugger , Stephen Warren , + Stephen Warren +Subject: [RESEND PATCH v3 3/3] arm: rpi: Switch to a text environment +Date: Thu, 27 Jul 2023 15:54:30 -0600 +Message-ID: <20230727215433.578830-4-sjg@chromium.org> +X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog +In-Reply-To: <20230727215433.578830-1-sjg@chromium.org> +References: <20230727215433.578830-1-sjg@chromium.org> +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 + +Use the new environment format so we can drop most of the config.h file. + +Signed-off-by: Simon Glass +--- + +(no changes since v1) + + board/raspberrypi/rpi/rpi.env | 77 ++++++++++++++++++++++++++ + include/configs/rpi.h | 100 ---------------------------------- + 2 files changed, 77 insertions(+), 100 deletions(-) + create mode 100644 board/raspberrypi/rpi/rpi.env + +diff --git a/board/raspberrypi/rpi/rpi.env b/board/raspberrypi/rpi/rpi.env +new file mode 100644 +index 000000000000..30228285edde +--- /dev/null ++++ b/board/raspberrypi/rpi/rpi.env +@@ -0,0 +1,77 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++ ++/* environment for Raspberry Pi boards */ ++ ++dhcpuboot=usb start; dhcp u-boot.uimg; bootm ++ ++/* Environment */ ++stdin=serial,usbkbd ++stdout=serial,vidconsole ++stderr=serial,vidconsole ++ ++/* DFU over USB/UDC */ ++#ifdef CONFIG_CMD_DFU ++dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1; ++ config.txt fat 0 1; ++#ifdef CONFIG_ARM64 ++dfu_alt_info+=Image fat 0 1 ++#else ++dfu_alt_info+=zImage fat 0 1 ++#endif ++#endif /* CONFIG_CMD_DFU */ ++ ++/* ++ * Memory layout for where various images get loaded by boot scripts: ++ * ++ * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. ++ * ++ * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, ++ * newer versions place it in high memory. So prevent U-Boot from doing its own ++ * DTB + initrd relocation so that we won't accidentally relocate the initrd ++ * over the firmware-loaded DTB and generally try to lay out things starting ++ * from the bottom of RAM. ++ * ++ * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, ++ * it must be within the first 128M of RAM in order for the kernel's ++ * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed ++ * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The ++ * decompressor also likes to relocate itself to right past the end of the ++ * decompressed kernel, so in total the sum of the compressed and ++ * decompressed kernel needs to be reserved. ++ * ++ * For Aarch64, the kernel image is uncompressed and must be loaded at ++ * text_offset bytes (specified in the header of the Image) into a 2MB ++ * boundary. The 'booti' command relocates the image if necessary. Linux uses ++ * a default text_offset of 0x80000. In summary, loading at 0x80000 ++ * satisfies all these constraints and reserving memory up to 0x02400000 ++ * permits fairly large (roughly 36M) kernels. ++ * ++ * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't ++ * conflict with something else. Reserving 1M for each of them at ++ * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. ++ * ++ * On ARM, both the DTB and any possible initrd must be loaded such that they ++ * fit inside the lowmem mapping in Linux. In practice, this usually means not ++ * more than ~700M away from the start of the kernel image but this number can ++ * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line ++ * parameter given to the kernel. So reserving memory from low to high ++ * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for ++ * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. ++ * Even with the smallest possible CPU-GPU memory split of the CPU getting ++ * only 64M, the remaining 25M starting at 0x02700000 should allow quite ++ * large initrds before they start colliding with U-Boot. ++ */ ++#ifdef CONFIG_ARM64 ++fdt_high=ffffffffffffffff ++initrd_high=ffffffffffffffff ++#else ++fdt_high=ffffffff ++initrd_high=ffffffff ++#endif ++kernel_addr_r=0x00080000 ++scriptaddr=0x02400000 ++pxefile_addr_r=0x02500000 ++fdt_addr_r=0x02600000 ++ramdisk_addr_r=0x02700000 ++ ++boot_targets=mmc usb pxe dhcp +diff --git a/include/configs/rpi.h b/include/configs/rpi.h +index 4160db2d8e14..8e56bdc84a89 100644 +--- a/include/configs/rpi.h ++++ b/include/configs/rpi.h +@@ -13,8 +13,6 @@ + #include + #endif + +-/* Architecture, CPU, etc.*/ +- + /* Use SoC timer for AArch32, but architected timer for AArch64 */ + #ifndef CONFIG_ARM64 + #define CFG_SYS_TIMER_RATE 1000000 +@@ -33,102 +31,4 @@ + */ + #define CFG_SYS_SDRAM_SIZE SZ_128M + +-/* Devices */ +-/* LCD */ +- +-/* DFU over USB/UDC */ +-#ifdef CONFIG_CMD_DFU +-#ifdef CONFIG_ARM64 +-#define KERNEL_FILENAME "Image" +-#else +-#define KERNEL_FILENAME "zImage" +-#endif +- +-#define ENV_DFU_SETTINGS \ +- "dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;" \ +- "config.txt fat 0 1;" \ +- KERNEL_FILENAME " fat 0 1\0" +-#else +-#define ENV_DFU_SETTINGS "" +-#endif +- +-/* Console configuration */ +- +-/* Environment */ +- +-/* Shell */ +- +-/* Environment */ +-#define ENV_DEVICE_SETTINGS \ +- "stdin=serial,usbkbd\0" \ +- "stdout=serial,vidconsole\0" \ +- "stderr=serial,vidconsole\0" +- +-#ifdef CONFIG_ARM64 +-#define FDT_HIGH "ffffffffffffffff" +-#define INITRD_HIGH "ffffffffffffffff" +-#else +-#define FDT_HIGH "ffffffff" +-#define INITRD_HIGH "ffffffff" +-#endif +- +-/* +- * Memory layout for where various images get loaded by boot scripts: +- * +- * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. +- * +- * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, +- * newer versions place it in high memory. So prevent U-Boot from doing its own +- * DTB + initrd relocation so that we won't accidentally relocate the initrd +- * over the firmware-loaded DTB and generally try to lay out things starting +- * from the bottom of RAM. +- * +- * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, +- * it must be within the first 128M of RAM in order for the kernel's +- * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed +- * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The +- * decompressor also likes to relocate itself to right past the end of the +- * decompressed kernel, so in total the sum of the compressed and and +- * decompressed kernel needs to be reserved. +- * +- * For Aarch64, the kernel image is uncompressed and must be loaded at +- * text_offset bytes (specified in the header of the Image) into a 2MB +- * boundary. The 'booti' command relocates the image if necessary. Linux uses +- * a default text_offset of 0x80000. In summary, loading at 0x80000 +- * satisfies all these constraints and reserving memory up to 0x02400000 +- * permits fairly large (roughly 36M) kernels. +- * +- * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't +- * conflict with something else. Reserving 1M for each of them at +- * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. +- * +- * On ARM, both the DTB and any possible initrd must be loaded such that they +- * fit inside the lowmem mapping in Linux. In practice, this usually means not +- * more than ~700M away from the start of the kernel image but this number can +- * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line +- * parameter given to the kernel. So reserving memory from low to high +- * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for +- * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. +- * Even with the smallest possible CPU-GPU memory split of the CPU getting +- * only 64M, the remaining 25M starting at 0x02700000 should allow quite +- * large initrds before they start colliding with U-Boot. +- */ +-#define ENV_MEM_LAYOUT_SETTINGS \ +- "fdt_high=" FDT_HIGH "\0" \ +- "initrd_high=" INITRD_HIGH "\0" \ +- "kernel_addr_r=0x00080000\0" \ +- "scriptaddr=0x02400000\0" \ +- "pxefile_addr_r=0x02500000\0" \ +- "fdt_addr_r=0x02600000\0" \ +- "ramdisk_addr_r=0x02700000\0" +- +-#define BOOT_TARGETS "mmc usb pxe dhcp" +- +-#define CFG_EXTRA_ENV_SETTINGS \ +- "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ +- ENV_DEVICE_SETTINGS \ +- ENV_DFU_SETTINGS \ +- ENV_MEM_LAYOUT_SETTINGS \ +- "boot_targets=" BOOT_TARGETS "\0" +- + #endif diff --git a/uboot-tools.spec b/uboot-tools.spec index 5774bc2..bd19b50 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.10 -Release: 0.1%{?candidate:.%{candidate}}%{?dist} +Release: 0.2%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -30,6 +30,7 @@ Patch5: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch Patch6: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch Patch7: rock64-small-fixes.patch #Patch7: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch +Patch8: rpi-Convert-to-standard-boot.patch BuildRequires: bc BuildRequires: bison @@ -214,6 +215,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Sat Aug 19 2023 Peter Robinson - 2023.10-0.2.rc2 +- Add patch for Raspberry Pi boot + * Fri Aug 18 2023 Peter Robinson - 2023.10-0.1.rc2 - Update to 2023.10 RC2 From c151f709dedf15e1c47633d72d73cf0518814e93 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 21 Aug 2023 20:11:07 +0100 Subject: [PATCH 012/128] Add patch to speed up firmware UEFI video output --- Add-video-damage-tracking.patch | 4136 +++++++++++++++++++++++++++++++ uboot-tools.spec | 16 +- 2 files changed, 4146 insertions(+), 6 deletions(-) create mode 100644 Add-video-damage-tracking.patch diff --git a/Add-video-damage-tracking.patch b/Add-video-damage-tracking.patch new file mode 100644 index 0000000..3cfd387 --- /dev/null +++ b/Add-video-damage-tracking.patch @@ -0,0 +1,4136 @@ +From patchwork Mon Aug 21 13:50:58 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823643 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=jAFdt8C3; + 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 4RTv611rHqz1yg0 + for ; Mon, 21 Aug 2023 23:51:37 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 69F2487066; + Mon, 21 Aug 2023 15:51:29 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="jAFdt8C3"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 71CEC8706D; Mon, 21 Aug 2023 15:51:28 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com + [IPv6:2a00:1450:4864:20::32e]) + (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 3320B87062 + for ; Mon, 21 Aug 2023 15:51:25 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wm1-x32e.google.com with SMTP id + 5b1f17b1804b1-3fef56f7222so2727775e9.2 + for ; Mon, 21 Aug 2023 06:51:25 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625884; x=1693230684; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=0KM0F1+WkNhDdn0zbbXHFFjqAdCr64hX7QvIzy6/iyI=; + b=jAFdt8C3owZgLvkS3GxcS5N+GiTxn30Z/xJkqzPDEYfC0PDH1kIsDI4pb6eHKAFVBt + PLqr4R9Sdmb05o76fez0U9nTmmv97QjcaeHGc0adZliwf33YdMgotCTaUiHc/nhkpLWw + c8rHP6jWgFPGn5Y45QEtPjQFEuV0nP0SkMONJorI+ci6NUadDN8X0tZNK5GoF1lvhF4o + mQZs5xJfJ6evaIBX7srcue8NUq4BtyhQ18vVYm0nCIPEltA23PBpkcejhCv6g5o/4puI + sgF/+jj8BhBQFKhPEIktVLWcqveScR/ngqiv1iDRHrCL6flPhtCsrpShY+rzilzpJdtC + fkJQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625884; x=1693230684; + 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=0KM0F1+WkNhDdn0zbbXHFFjqAdCr64hX7QvIzy6/iyI=; + b=gWHm6TE1o6bFZMTHoyWCi4QgdvFQkn06zRip9uOn3HqDzCG7KLnrXsFUdYdugOcadS + yQH0TYQ9YCGnJEItFC8+BAPuij69++YczOI2dzUQz6ejqfjFnTORccJmFginC+ZQynSw + ygcqWBt7iXKWwm2BNaTOS0ZbXxZuQrdebM6QD55CSsB+YnJ/21Q4txo4VOIzT+g2LmU4 + YhR1Ec8+2HGk3w1oWalKPpGcBc3y3y7ADgy/Kt0L4pFhAmBewW+wlGtrTxdoIbRmcMwx + 6xx1bS9ZrdHzFpTAB7myHjowwbIvRmhpNDr1e+ROx71myEhCEhnz0o6tjGmHTmebIiZB + Axiw== +X-Gm-Message-State: AOJu0Yw7o7394U5eAr5ipSyfIWmc1YVzBHdp8jslW0qPlsoIXMjiuI6c + SaZaVpf+ZihLZ51797OE439hQFEZL4o= +X-Google-Smtp-Source: + AGHT+IGiiJu3kdw60kWynu1HizRmCX0l3/hesikD0kGHzt9jbq6D24m4A0InLSpbaBLDcUVjniBVKA== +X-Received: by 2002:a05:600c:3799:b0:3fe:2011:a7ce with SMTP id + o25-20020a05600c379900b003fe2011a7cemr5345546wmr.6.1692625884228; + Mon, 21 Aug 2023 06:51:24 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.22 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:23 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 01/13] video: test: Split copy frame buffer check into a + function +Date: Mon, 21 Aug 2023 16:50:58 +0300 +Message-Id: <20230821135111.3558478-2-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +While checking frame buffer contents, the video tests also check if the +copy frame buffer contents match the main frame buffer. To test if only +the modified regions are updated after a sync, we will need to create +situations where the two are mismatched. Split this check into another +function that we can skip calling, since we won't want it to error on +those mismatched cases. + +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Add patch "video: test: Split copy frame buffer check into a function" + + test/dm/video.c | 69 +++++++++++++++++++++++++++++++++++++++++-------- + 1 file changed, 58 insertions(+), 11 deletions(-) + +diff --git a/test/dm/video.c b/test/dm/video.c +index d907f681600b..641a6250100a 100644 +--- a/test/dm/video.c ++++ b/test/dm/video.c +@@ -55,9 +55,6 @@ DM_TEST(dm_test_video_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + * size of the compressed data. This provides a pretty good level of + * certainty and the resulting tests need only check a single value. + * +- * If the copy framebuffer is enabled, this compares it to the main framebuffer +- * too. +- * + * @uts: Test state + * @dev: Video device + * Return: compressed size of the frame buffer, or -ve on error +@@ -66,7 +63,6 @@ static int compress_frame_buffer(struct unit_test_state *uts, + struct udevice *dev) + { + struct video_priv *priv = dev_get_uclass_priv(dev); +- struct video_priv *uc_priv = dev_get_uclass_priv(dev); + uint destlen; + void *dest; + int ret; +@@ -82,16 +78,34 @@ static int compress_frame_buffer(struct unit_test_state *uts, + if (ret) + return ret; + +- /* Check here that the copy frame buffer is working correctly */ +- if (IS_ENABLED(CONFIG_VIDEO_COPY)) { +- ut_assertf(!memcmp(uc_priv->fb, uc_priv->copy_fb, +- uc_priv->fb_size), +- "Copy framebuffer does not match fb"); +- } +- + return destlen; + } + ++/** ++ * check_copy_frame_buffer() - Compare main frame buffer to copy ++ * ++ * If the copy frame buffer is enabled, this compares it to the main ++ * frame buffer. Normally they should have the same contents after a ++ * sync. ++ * ++ * @uts: Test state ++ * @dev: Video device ++ * Return: 0, or -ve on error ++ */ ++static int check_copy_frame_buffer(struct unit_test_state *uts, ++ struct udevice *dev) ++{ ++ struct video_priv *priv = dev_get_uclass_priv(dev); ++ ++ if (!IS_ENABLED(CONFIG_VIDEO_COPY)) ++ return 0; ++ ++ ut_assertf(!memcmp(priv->fb, priv->copy_fb, priv->fb_size), ++ "Copy framebuffer does not match fb"); ++ ++ return 0; ++} ++ + /* + * Call this function at any point to halt and show the current display. Be + * sure to run the test with the -l flag. +@@ -155,24 +169,30 @@ static int dm_test_video_text(struct unit_test_state *uts) + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_putc_xy(con, 0, 0, 'a'); + ut_asserteq(79, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + vidconsole_putc_xy(con, 0, 0, ' '); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + for (i = 0; i < 20; i++) + vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); + ut_asserteq(273, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + vidconsole_set_row(con, 0, WHITE); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + for (i = 0; i < 20; i++) + vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); + ut_asserteq(273, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -191,24 +211,30 @@ static int dm_test_video_text_12x22(struct unit_test_state *uts) + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "12x22", 0)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_putc_xy(con, 0, 0, 'a'); + ut_asserteq(89, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + vidconsole_putc_xy(con, 0, 0, ' '); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + for (i = 0; i < 20; i++) + vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); + ut_asserteq(363, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + vidconsole_set_row(con, 0, WHITE); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + for (i = 0; i < 20; i++) + vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); + ut_asserteq(363, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -226,6 +252,7 @@ static int dm_test_video_chars(struct unit_test_state *uts) + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + vidconsole_put_string(con, test_string); + ut_asserteq(466, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -247,19 +274,23 @@ static int dm_test_video_ansi(struct unit_test_state *uts) + video_clear(con->parent); + video_sync(con->parent, false); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* test clear escape sequence: [2J */ + vidconsole_put_string(con, "A\tB\tC"ANSI_ESC"[2J"); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* test set-cursor: [%d;%df */ + vidconsole_put_string(con, "abc"ANSI_ESC"[2;2fab"ANSI_ESC"[4;4fcd"); + ut_asserteq(143, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* test colors (30-37 fg color, 40-47 bg color) */ + vidconsole_put_string(con, ANSI_ESC"[30;41mfoo"); /* black on red */ + vidconsole_put_string(con, ANSI_ESC"[33;44mbar"); /* yellow on blue */ + ut_asserteq(272, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -292,11 +323,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* Check display wrap */ + for (i = 0; i < 120; i++) + vidconsole_put_char(con, 'A' + i % 50); + ut_asserteq(wrap_size, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* Check display scrolling */ + for (i = 0; i < SCROLL_LINES; i++) { +@@ -304,11 +337,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, + vidconsole_put_char(con, '\n'); + } + ut_asserteq(scroll_size, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* If we scroll enough, the screen becomes blank again */ + for (i = 0; i < SCROLL_LINES; i++) + vidconsole_put_char(con, '\n'); + ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -383,6 +418,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); + ut_asserteq(1368, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -402,6 +438,7 @@ static int dm_test_video_bmp8(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); + ut_asserteq(1247, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -425,6 +462,7 @@ static int dm_test_video_bmp16(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); + ut_asserteq(3700, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -448,6 +486,7 @@ static int dm_test_video_bmp24(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); + ut_asserteq(3656, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -471,6 +510,7 @@ static int dm_test_video_bmp24_32(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); + ut_asserteq(6827, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -489,6 +529,7 @@ static int dm_test_video_bmp32(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); + ut_asserteq(2024, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -505,6 +546,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); + ut_asserteq(1368, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -524,6 +566,7 @@ static int dm_test_video_comp_bmp32(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); + ut_asserteq(2024, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -543,6 +586,7 @@ static int dm_test_video_comp_bmp8(struct unit_test_state *uts) + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); + ut_asserteq(1247, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -558,6 +602,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_put_string(con, test_string); + ut_asserteq(12174, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -579,6 +624,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_put_string(con, test_string); + ut_asserteq(34287, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } +@@ -600,6 +646,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_put_string(con, test_string); + ut_asserteq(29471, compress_frame_buffer(uts, dev)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + } + +From patchwork Mon Aug 21 13:50:59 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823644 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=mYzIbw17; + 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 4RTv6B5sZGz1yYZ + for ; Mon, 21 Aug 2023 23:51:46 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id AD34B8706B; + Mon, 21 Aug 2023 15:51:31 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="mYzIbw17"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 5EF078707C; Mon, 21 Aug 2023 15:51: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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com + [IPv6:2a00:1450:4864:20::42b]) + (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 8B77787069 + for ; Mon, 21 Aug 2023 15:51:27 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x42b.google.com with SMTP id + ffacd0b85a97d-307d20548adso2907788f8f.0 + for ; Mon, 21 Aug 2023 06:51:27 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625887; x=1693230687; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=2OB7382go0g6JBjezy6TmzGfi6gIlYCFDFe4xM7HRw8=; + b=mYzIbw17s5ut2Lj8TmUyEmZZuMpoWf/YpZMisLloBGvTOI6o9/p8nP2M17yjk++h8P + 8+GH169jMY+6EuzecVUKktHLjLULhqcSGVgb+K8TH4Z0MkPhLZg6u+23TnjErs5v1VYS + +euy4y8wSAudLGdJHtR26NtBqeJHDFiK6ves/aUe6PVWoPVDofUTUC53I4mvF96uWF8K + NxLW9B5KIoY0T2WpxZUDwabQASQORqw1sA33K5oTD5OvFTS081ZnJT9otEq9+EgTySU5 + e9RQTRRZ1lstBqBTAQHRXPAniy7qhyu+ptlO9RhqLC6R08WOBN8Fwz7r4fVsnuuGMEgm + CatQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625887; x=1693230687; + 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=2OB7382go0g6JBjezy6TmzGfi6gIlYCFDFe4xM7HRw8=; + b=ChLsD8uyfsbRsBr3u3v4RBW8IRqsNDwAduakdrWkASxSDmmx1fr/AROSBC5feYGGDe + hS2CHTTA7mzZBgx65Trp5EItwl/T+Vp9i6ot9yz9QlTUNNEcPawZEdr+wrwsTgDaxH2v + snQjENvBTKP8nVEyAFqDmM2dOMLBHKEnI/a8MuKKZMuMu9dujekXUR7zTMOWyhTLK6Gc + D8F+qwz8FIhnEGMc1i1LvXmjDCs7delvdWCetg6JqpaHZUQQc6Ru03gSKWXkedKTdHsF + IFdkr4qm3W7Rsy2BwYQZN2XrZO5IuLkQjVOtfryPfMGux/37jUX8zNJ0y+TL8k42PlEC + Xicw== +X-Gm-Message-State: AOJu0YwlYwARbrwNV25POhyWxcoym3cQztI8SjGOeCzdsQys/HqRUQV+ + wqnhOKThUMfcGC8MZ8gLFE2KT2+SxVA= +X-Google-Smtp-Source: + AGHT+IHSYU3/G4dWV8P3egqgpph9YxOl4+mH1vDWUtosphrFiVQk7BNu/zdvNsUiJiU3qzGO9VCxdg== +X-Received: by 2002:a5d:44cf:0:b0:313:f33c:24c4 with SMTP id + z15-20020a5d44cf000000b00313f33c24c4mr4457731wrr.39.1692625886757; + Mon, 21 Aug 2023 06:51:26 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.24 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:26 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 02/13] video: test: Support checking copy frame buffer + contents +Date: Mon, 21 Aug 2023 16:50:59 +0300 +Message-Id: <20230821135111.3558478-3-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 video tests have a helper function to generate a pseudo-digest of +frame buffer contents, but it only does so for the main one. There is +another check that the copy frame buffer is the same as that. But +neither is enough to test if only the modified regions are copied to the +copy frame buffer, since we will want the two to be different in very +specific ways. + +Add a boolean argument to the existing helper function to indicate which +frame buffer we want to inspect, and update the existing callers. + +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Add patch "video: test: Support checking copy frame buffer contents" + + test/dm/video.c | 76 ++++++++++++++++++++++++++----------------------- + 1 file changed, 41 insertions(+), 35 deletions(-) + +diff --git a/test/dm/video.c b/test/dm/video.c +index 641a6250100a..b9ff3da10c18 100644 +--- a/test/dm/video.c ++++ b/test/dm/video.c +@@ -57,22 +57,28 @@ DM_TEST(dm_test_video_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + * + * @uts: Test state + * @dev: Video device ++ * @use_copy: Use copy frame buffer if available + * Return: compressed size of the frame buffer, or -ve on error + */ + static int compress_frame_buffer(struct unit_test_state *uts, +- struct udevice *dev) ++ struct udevice *dev, ++ bool use_copy) + { + struct video_priv *priv = dev_get_uclass_priv(dev); + uint destlen; + void *dest; + int ret; + ++ if (!IS_ENABLED(CONFIG_VIDEO_COPY)) ++ use_copy = false; ++ + destlen = priv->fb_size; + dest = malloc(priv->fb_size); + if (!dest) + return -ENOMEM; + ret = BZ2_bzBuffToBuffCompress(dest, &destlen, +- priv->fb, priv->fb_size, ++ use_copy ? priv->copy_fb : priv->fb, ++ priv->fb_size, + 3, 0, 0); + free(dest); + if (ret) +@@ -168,30 +174,30 @@ static int dm_test_video_text(struct unit_test_state *uts) + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_putc_xy(con, 0, 0, 'a'); +- ut_asserteq(79, compress_frame_buffer(uts, dev)); ++ ut_asserteq(79, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + vidconsole_putc_xy(con, 0, 0, ' '); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + for (i = 0; i < 20; i++) + vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); +- ut_asserteq(273, compress_frame_buffer(uts, dev)); ++ ut_asserteq(273, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + vidconsole_set_row(con, 0, WHITE); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + for (i = 0; i < 20; i++) + vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); +- ut_asserteq(273, compress_frame_buffer(uts, dev)); ++ ut_asserteq(273, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -210,30 +216,30 @@ static int dm_test_video_text_12x22(struct unit_test_state *uts) + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "12x22", 0)); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_putc_xy(con, 0, 0, 'a'); +- ut_asserteq(89, compress_frame_buffer(uts, dev)); ++ ut_asserteq(89, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + vidconsole_putc_xy(con, 0, 0, ' '); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + for (i = 0; i < 20; i++) + vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); +- ut_asserteq(363, compress_frame_buffer(uts, dev)); ++ ut_asserteq(363, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + vidconsole_set_row(con, 0, WHITE); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + for (i = 0; i < 20; i++) + vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i); +- ut_asserteq(363, compress_frame_buffer(uts, dev)); ++ ut_asserteq(363, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -251,7 +257,7 @@ static int dm_test_video_chars(struct unit_test_state *uts) + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); + vidconsole_put_string(con, test_string); +- ut_asserteq(466, compress_frame_buffer(uts, dev)); ++ ut_asserteq(466, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -273,23 +279,23 @@ static int dm_test_video_ansi(struct unit_test_state *uts) + /* reference clear: */ + video_clear(con->parent); + video_sync(con->parent, false); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* test clear escape sequence: [2J */ + vidconsole_put_string(con, "A\tB\tC"ANSI_ESC"[2J"); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* test set-cursor: [%d;%df */ + vidconsole_put_string(con, "abc"ANSI_ESC"[2;2fab"ANSI_ESC"[4;4fcd"); +- ut_asserteq(143, compress_frame_buffer(uts, dev)); ++ ut_asserteq(143, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* test colors (30-37 fg color, 40-47 bg color) */ + vidconsole_put_string(con, ANSI_ESC"[30;41mfoo"); /* black on red */ + vidconsole_put_string(con, ANSI_ESC"[33;44mbar"); /* yellow on blue */ +- ut_asserteq(272, compress_frame_buffer(uts, dev)); ++ ut_asserteq(272, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -322,13 +328,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + ut_assertok(vidconsole_select_font(con, "8x16", 0)); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* Check display wrap */ + for (i = 0; i < 120; i++) + vidconsole_put_char(con, 'A' + i % 50); +- ut_asserteq(wrap_size, compress_frame_buffer(uts, dev)); ++ ut_asserteq(wrap_size, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* Check display scrolling */ +@@ -336,13 +342,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, + vidconsole_put_char(con, 'A' + i % 50); + vidconsole_put_char(con, '\n'); + } +- ut_asserteq(scroll_size, compress_frame_buffer(uts, dev)); ++ ut_asserteq(scroll_size, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + /* If we scroll enough, the screen becomes blank again */ + for (i = 0; i < SCROLL_LINES; i++) + vidconsole_put_char(con, '\n'); +- ut_asserteq(46, compress_frame_buffer(uts, dev)); ++ ut_asserteq(46, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -417,7 +423,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts) + ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); +- ut_asserteq(1368, compress_frame_buffer(uts, dev)); ++ ut_asserteq(1368, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -437,7 +443,7 @@ static int dm_test_video_bmp8(struct unit_test_state *uts) + ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); +- ut_asserteq(1247, compress_frame_buffer(uts, dev)); ++ ut_asserteq(1247, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -461,7 +467,7 @@ static int dm_test_video_bmp16(struct unit_test_state *uts) + &src_len)); + + ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); +- ut_asserteq(3700, compress_frame_buffer(uts, dev)); ++ ut_asserteq(3700, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -485,7 +491,7 @@ static int dm_test_video_bmp24(struct unit_test_state *uts) + &src_len)); + + ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); +- ut_asserteq(3656, compress_frame_buffer(uts, dev)); ++ ut_asserteq(3656, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -509,7 +515,7 @@ static int dm_test_video_bmp24_32(struct unit_test_state *uts) + &src_len)); + + ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); +- ut_asserteq(6827, compress_frame_buffer(uts, dev)); ++ ut_asserteq(6827, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -528,7 +534,7 @@ static int dm_test_video_bmp32(struct unit_test_state *uts) + ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); +- ut_asserteq(2024, compress_frame_buffer(uts, dev)); ++ ut_asserteq(2024, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -545,7 +551,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts) + ut_assertok(read_file(uts, "tools/logos/denx-comp.bmp", &addr)); + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); +- ut_asserteq(1368, compress_frame_buffer(uts, dev)); ++ ut_asserteq(1368, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -565,7 +571,7 @@ static int dm_test_video_comp_bmp32(struct unit_test_state *uts) + ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); +- ut_asserteq(2024, compress_frame_buffer(uts, dev)); ++ ut_asserteq(2024, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -585,7 +591,7 @@ static int dm_test_video_comp_bmp8(struct unit_test_state *uts) + ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); + + ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); +- ut_asserteq(1247, compress_frame_buffer(uts, dev)); ++ ut_asserteq(1247, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -601,7 +607,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_put_string(con, test_string); +- ut_asserteq(12174, compress_frame_buffer(uts, dev)); ++ ut_asserteq(12174, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -623,7 +629,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_put_string(con, test_string); +- ut_asserteq(34287, compress_frame_buffer(uts, dev)); ++ ut_asserteq(34287, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; +@@ -645,7 +651,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) + ut_assertok(video_get_nologo(uts, &dev)); + ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); + vidconsole_put_string(con, test_string); +- ut_asserteq(29471, compress_frame_buffer(uts, dev)); ++ ut_asserteq(29471, compress_frame_buffer(uts, dev, false)); + ut_assertok(check_copy_frame_buffer(uts, dev)); + + return 0; + +From patchwork Mon Aug 21 13:51:00 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823645 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=h0nfUUKH; + 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 4RTv6P02TYz1yYZ + for ; Mon, 21 Aug 2023 23:51:56 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id F40E487071; + Mon, 21 Aug 2023 15:51:33 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="h0nfUUKH"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id EFD6D87069; Mon, 21 Aug 2023 15:51:32 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 +Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com + [IPv6:2a00:1450:4864:20::42c]) + (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 0028587074 + for ; Mon, 21 Aug 2023 15:51:29 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x42c.google.com with SMTP id + ffacd0b85a97d-319779f0347so2987491f8f.1 + for ; Mon, 21 Aug 2023 06:51:29 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625889; x=1693230689; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=Ls20OKhVk8mknnS6GLFBhmTjxLz0/7fKNgK2nzSEs6M=; + b=h0nfUUKHqteSaQqflnkXT9zc90H1nKLTOoG4B78CtKhSKUI/thuMDU61AtN+enWvFJ + MdvU9OW3jOHeg+LRrxur+6+N4V9k4nGhm2BGwtj56A1DDfCLgk5+Vg38dhi1a24kfBH9 + d5w6HXOg3wdMizdTsyL0PbugSX7K9ByL9XKpH646NdsnqcikQNdmT2OeiGAmonEmHXAa + FII1SypkiZ5TOFcJx9N4X2XqMM3CNxyUsDs6+AV4dTPnjtXaElWj1fQcz8bLn/9q88/X + UCvE35N4Y37FFgb+5uTi+00hcLIavYKYrLEpNAclnl9NKFSUAUJyabqQM0+riy1OSMHF + 5YBw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625889; x=1693230689; + 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=Ls20OKhVk8mknnS6GLFBhmTjxLz0/7fKNgK2nzSEs6M=; + b=Gmm/6GKzL921nU50fcXK4FdwCaAc1DVbDj7ilfjHfBXRaw/k3mmUZ/l5nbwGsTUYUU + VX6nd+xFgekVSP5Cns7th6+jnbBBaoaCZUfZYGIhQjEH3JMxxpo17+eNdfCTuo7TjTdl + MtWwxmceukhRiNql2W7VOHfb5CXBxorcXXcy3szcEJOlzxIqqUDQcLjNgoe5d2Kpkv9Y + 6qkNp6XFyfQCMAMGjF68T5eViaLcvFHFIsvmjXlMU7Ohhhm2We4SK9nBsr6gUgyaxmNs + qBLKVZKf+iC9WptVFbXhAML6gJZJo+JQu/tGHHfLf7rm/WT+1VhmDKBgpU1CzA8BRqcG + t+og== +X-Gm-Message-State: AOJu0YxCm+p57uF96KzOW9kggq2KLZimSeriKFH9gpv8fgoy+ddR1X7S + 9HsUigoZFUND3/u7rp+XB9qHn3dcZTU= +X-Google-Smtp-Source: + AGHT+IEwSW6rIF+3ua5ruA0V/p8R0SXlrxBIJRwdiP9dn7nhkL8gMfhxYppZ2c8jWSzauubY8xUVnQ== +X-Received: by 2002:adf:e482:0:b0:31a:dc27:e10 with SMTP id + i2-20020adfe482000000b0031adc270e10mr4721868wrm.65.1692625889315; + Mon, 21 Aug 2023 06:51:29 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.27 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:28 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 03/13] video: test: Test partial updates of hardware frame + buffer +Date: Mon, 21 Aug 2023 16:51:00 +0300 +Message-Id: <20230821135111.3558478-4-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +With VIDEO_COPY enabled, only the modified parts of the frame buffer are +intended to be copied to the hardware. Add a test that checks this, by +overwriting contents we prepared without telling the video uclass and +then checking if the overwritten contents have been redrawn on the next +sync. + +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Add patch "video: test: Test partial updates of hardware frame buffer" + + test/dm/video.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 54 insertions(+) + +diff --git a/test/dm/video.c b/test/dm/video.c +index b9ff3da10c18..e4bd27a6b76f 100644 +--- a/test/dm/video.c ++++ b/test/dm/video.c +@@ -657,3 +657,57 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) + return 0; + } + DM_TEST(dm_test_video_truetype_bs, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); ++ ++/* Test partial rendering onto hardware frame buffer */ ++static int dm_test_video_copy(struct unit_test_state *uts) ++{ ++ struct sandbox_sdl_plat *plat; ++ struct video_uc_plat *uc_plat; ++ struct udevice *dev, *con; ++ struct video_priv *priv; ++ const char *test_string = "\n\tCriticism may not be agreeable, but it is necessary.\t"; ++ ulong addr; ++ ++ if (!IS_ENABLED(CONFIG_VIDEO_COPY)) ++ return -EAGAIN; ++ ++ ut_assertok(uclass_find_first_device(UCLASS_VIDEO, &dev)); ++ ut_assertnonnull(dev); ++ uc_plat = dev_get_uclass_plat(dev); ++ uc_plat->hide_logo = true; ++ plat = dev_get_plat(dev); ++ plat->font_size = 32; ++ ut_assert(!device_active(dev)); ++ ut_assertok(uclass_first_device_err(UCLASS_VIDEO, &dev)); ++ ut_assertnonnull(dev); ++ priv = dev_get_uclass_priv(dev); ++ ++ ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); ++ ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); ++ ++ ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ++ vidconsole_put_string(con, "\n\n\n\n\n"); ++ vidconsole_put_string(con, test_string); ++ vidconsole_put_string(con, test_string); ++ ++ ut_asserteq(6678, compress_frame_buffer(uts, dev, false)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); ++ ++ /* ++ * Secretly clear the hardware frame buffer, but in a different ++ * color (black) to see which parts will be overwritten. ++ */ ++ memset(priv->copy_fb, 0, priv->fb_size); ++ ++ /* ++ * We should have the full content on the main buffer, but only ++ * the new content should have been copied to the copy buffer. ++ */ ++ vidconsole_put_string(con, test_string); ++ vidconsole_put_string(con, test_string); ++ ut_asserteq(7589, compress_frame_buffer(uts, dev, false)); ++ ut_asserteq(5278, compress_frame_buffer(uts, dev, true)); ++ ++ return 0; ++} ++DM_TEST(dm_test_video_copy, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +From patchwork Mon Aug 21 13:51:01 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823647 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=bU3qjQR0; + 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 4RTv6c2SWvz1yYZ + for ; Mon, 21 Aug 2023 23:52:08 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 4441F87070; + Mon, 21 Aug 2023 15:51:36 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="bU3qjQR0"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 3848287075; Mon, 21 Aug 2023 15:51:35 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com + [IPv6:2a00:1450:4864:20::42c]) + (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 841D2869B6 + for ; Mon, 21 Aug 2023 15:51:32 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x42c.google.com with SMTP id + ffacd0b85a97d-31aec0a1a8bso1211537f8f.0 + for ; Mon, 21 Aug 2023 06:51:32 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625892; x=1693230692; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=edVipA0fXjfO2+yIw/Pp5VvEle3RKuzWiUXEb/KCl5I=; + b=bU3qjQR0xHT3knwMAc4fOHXpeWOGcUonKhClh1IfqxsqOHWeRbIi1W1OtDuPIyv8dX + CyIHX30R+SQr8o+T5xSFf4E4kwRpsqOzh2mXOD3dzuYzJPkreOM5clQMgmyn2JGs+nON + KDztnOSqesV2IvPZqdr61bxJTw/SjXqRXGc7/YkT7OWwlaug26E+DbzP7Xt+plHDVz/9 + 6OB5zFxUapwX0mqxb6jbNAz17TvjQ5qIviNkCRZUZ2vseEB78BwHajxkNCG4jVOaQDON + aJWc+UOFyWJ3jLmQ+cOJgR+J0SoF3VAVYhbYaYviNV2DiaBPLPL9axirby/hW4Kx2waB + YKAg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625892; x=1693230692; + 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=edVipA0fXjfO2+yIw/Pp5VvEle3RKuzWiUXEb/KCl5I=; + b=STc6gYqDRe7JtT56BIezfKTd0PQe87I83hDC5mL+8D0AqUp1RiJPnPt9MWIAVfO63j + plu8RveodelqOd26zWzlFDepTA+jfvcAgOePHLLLx3YiAidxIWD6d0SVlG+zagmUlHzm + HGscQ+3iGYhTHAGxc10UHaQcMlCmyeWecwIjxXBpM85g6puunYrN14aYfsp6E0ODCLMg + 9HAD2Zx5b++HK3yE7Ld6hientRzVXxwURTL5ehSSO2AX95YMagfKaP767VvupWtB18du + 5Lfk0k60qTxe3Xlamnm8bdoRofuIyLLaSZ+0M7lAsEPPsS4QRGn+m7MwI8YTlRIU8wFQ + cYSQ== +X-Gm-Message-State: AOJu0YwPPIi0QLYKGPNa9T+XPhwof7rD3VBA3kfub7MM4xEG6u6r8puq + cSLl/n+w1P2LSAPH1AWswz3SS227DdQ= +X-Google-Smtp-Source: + AGHT+IFAUyNsvOmdhjdIygYhsv/SH6hvXItfwiWsY14vr3nwQ9J7A0Q0Y71M8WvaFJdxn7mmOeZlrg== +X-Received: by 2002:a5d:44c8:0:b0:317:e9d7:9387 with SMTP id + z8-20020a5d44c8000000b00317e9d79387mr7196865wrr.25.1692625891911; + Mon, 21 Aug 2023 06:51:31 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.30 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:31 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 04/13] dm: video: Add damage tracking API +Date: Mon, 21 Aug 2023 16:51:01 +0300 +Message-Id: <20230821135111.3558478-5-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +We are going to introduce image damage tracking to fasten up screen +refresh on large displays. This patch adds damage tracking for up to +one rectangle of the screen which is typically enough to hold blt or +text print updates. Callers into this API and a reduced dcache flush +code path will follow in later patches. + +Signed-off-by: Alexander Graf +Reported-by: Da Xue +[Alper: Use xstart/yend, document new fields, return void from + video_damage(), declare priv, drop headers, use IS_ENABLED()] +Co-developed-by: Alper Nebi Yasak +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Use xstart, ystart, xend, yend as names for damage region +- Document damage struct and fields in struct video_priv comment +- Return void from video_damage() +- Fix undeclared priv error in video_sync() +- Drop unused headers from video-uclass.c +- Use IS_ENABLED() instead of CONFIG_IS_ENABLED() + +Changes in v4: +- Move damage clear to patch "dm: video: Add damage tracking API" +- Simplify first damage logic +- Remove VIDEO_DAMAGE default for ARM + +Changes in v3: +- Adapt to always assume DM is used + +Changes in v2: +- Remove ifdefs + + drivers/video/Kconfig | 13 ++++++++++++ + drivers/video/video-uclass.c | 41 +++++++++++++++++++++++++++++++++--- + include/video.h | 32 ++++++++++++++++++++++++++-- + 3 files changed, 81 insertions(+), 5 deletions(-) + +diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig +index fe43fbd7004a..97f494a1340b 100644 +--- a/drivers/video/Kconfig ++++ b/drivers/video/Kconfig +@@ -92,6 +92,19 @@ config VIDEO_COPY + To use this, your video driver must set @copy_base in + struct video_uc_plat. + ++config VIDEO_DAMAGE ++ bool "Enable damage tracking of frame buffer regions" ++ help ++ On some machines (most ARM), the display frame buffer resides in ++ RAM. To make the display controller pick up screen updates, we ++ have to flush frame buffer contents from CPU caches into RAM which ++ can be a slow operation. ++ ++ This feature adds damage tracking to collect information about regions ++ that received updates. When we want to sync, we then only flush ++ regions of the frame buffer that were modified before, speeding up ++ screen refreshes significantly. ++ + config BACKLIGHT_PWM + bool "Generic PWM based Backlight Driver" + depends on BACKLIGHT && DM_PWM +diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c +index 8f268fc4063f..447689581668 100644 +--- a/drivers/video/video-uclass.c ++++ b/drivers/video/video-uclass.c +@@ -351,9 +351,39 @@ void video_set_default_colors(struct udevice *dev, bool invert) + priv->colour_bg = video_index_to_colour(priv, back); + } + ++/* Notify about changes in the frame buffer */ ++void video_damage(struct udevice *vid, int x, int y, int width, int height) ++{ ++ struct video_priv *priv = dev_get_uclass_priv(vid); ++ int xend = x + width; ++ int yend = y + height; ++ ++ if (!IS_ENABLED(CONFIG_VIDEO_DAMAGE)) ++ return; ++ ++ if (x > priv->xsize) ++ return; ++ ++ if (y > priv->ysize) ++ return; ++ ++ if (xend > priv->xsize) ++ xend = priv->xsize; ++ ++ if (yend > priv->ysize) ++ yend = priv->ysize; ++ ++ /* Span a rectangle across all old and new damage */ ++ priv->damage.xstart = min(x, priv->damage.xstart); ++ priv->damage.ystart = min(y, priv->damage.ystart); ++ priv->damage.xend = max(xend, priv->damage.xend); ++ priv->damage.yend = max(yend, priv->damage.yend); ++} ++ + /* Flush video activity to the caches */ + int video_sync(struct udevice *vid, bool force) + { ++ struct video_priv *priv = dev_get_uclass_priv(vid); + struct video_ops *ops = video_get_ops(vid); + int ret; + +@@ -369,15 +399,12 @@ int video_sync(struct udevice *vid, bool force) + * out whether it exists? For now, ARM is safe. + */ + #if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) +- struct video_priv *priv = dev_get_uclass_priv(vid); +- + if (priv->flush_dcache) { + flush_dcache_range((ulong)priv->fb, + ALIGN((ulong)priv->fb + priv->fb_size, + CONFIG_SYS_CACHELINE_SIZE)); + } + #elif defined(CONFIG_VIDEO_SANDBOX_SDL) +- struct video_priv *priv = dev_get_uclass_priv(vid); + static ulong last_sync; + + if (force || get_timer(last_sync) > 100) { +@@ -385,6 +412,14 @@ int video_sync(struct udevice *vid, bool force) + last_sync = get_timer(0); + } + #endif ++ ++ if (IS_ENABLED(CONFIG_VIDEO_DAMAGE)) { ++ priv->damage.xstart = priv->xsize; ++ priv->damage.ystart = priv->ysize; ++ priv->damage.xend = 0; ++ priv->damage.yend = 0; ++ } ++ + return 0; + } + +diff --git a/include/video.h b/include/video.h +index 66d109ca5da6..a522f33949e5 100644 +--- a/include/video.h ++++ b/include/video.h +@@ -85,6 +85,11 @@ enum video_format { + * @fb_size: Frame buffer size + * @copy_fb: Copy of the frame buffer to keep up to date; see struct + * video_uc_plat ++ * @damage: A bounding box of framebuffer regions updated since last sync ++ * @damage.xstart: X start position in pixels from the left ++ * @damage.ystart: Y start position in pixels from the top ++ * @damage.xend: X end position in pixels from the left ++ * @damage.xend: Y end position in pixels from the top + * @line_length: Length of each frame buffer line, in bytes. This can be + * set by the driver, but if not, the uclass will set it after + * probing +@@ -112,6 +117,12 @@ struct video_priv { + void *fb; + int fb_size; + void *copy_fb; ++ struct { ++ int xstart; ++ int ystart; ++ int xend; ++ int yend; ++ } damage; + int line_length; + u32 colour_fg; + u32 colour_bg; +@@ -254,8 +265,9 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, + * @return: 0 on success, error code otherwise + * + * Some frame buffers are cached or have a secondary frame buffer. This +- * function syncs these up so that the current contents of the U-Boot frame +- * buffer are displayed to the user. ++ * function syncs the damaged parts of them up so that the current contents ++ * of the U-Boot frame buffer are displayed to the user. It clears the damage ++ * buffer. + */ + int video_sync(struct udevice *vid, bool force); + +@@ -375,6 +387,22 @@ static inline int video_sync_copy_all(struct udevice *dev) + + #endif + ++/** ++ * video_damage() - Notify the video subsystem about screen updates. ++ * ++ * @vid: Device to sync ++ * @x: Upper left X coordinate of the damaged rectangle ++ * @y: Upper left Y coordinate of the damaged rectangle ++ * @width: Width of the damaged rectangle ++ * @height: Height of the damaged rectangle ++ * ++ * Some frame buffers are cached or have a secondary frame buffer. This ++ * function notifies the video subsystem about rectangles that were updated ++ * within the frame buffer. They may only get written to the screen on the ++ * next call to video_sync(). ++ */ ++void video_damage(struct udevice *vid, int x, int y, int width, int height); ++ + /** + * video_is_active() - Test if one video device it active + * + +From patchwork Mon Aug 21 13:51:02 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823648 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=BdIntNrw; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4RTv6p6cj3z1yYZ + for ; Mon, 21 Aug 2023 23:52:18 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 8A59F87086; + Mon, 21 Aug 2023 15:51:40 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="BdIntNrw"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 3C3FD867A0; Mon, 21 Aug 2023 15:51:39 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 +Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com + [IPv6:2a00:1450:4864:20::42c]) + (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 546E686F0A + for ; Mon, 21 Aug 2023 15:51:35 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x42c.google.com with SMTP id + ffacd0b85a97d-31c3df710bdso1066363f8f.1 + for ; Mon, 21 Aug 2023 06:51:35 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625895; x=1693230695; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=rfyiNp4RS7b8BQCxsUs1afKXNK4WMu1bUdXxDQXJn1U=; + b=BdIntNrw+JbVTri7AodJPuA4KoTwuid2ByavDMP+gEZwSfMkjrlWlFROWNdM4E2KeC + btsSXcPQO3jMnyoxVbS5g4DL2PkXPHNZO/Lw5Db4La4RGjoB4ks8w4G1nQ5kVo8NIXlQ + 7da1BVmm9tlV2cmt2LVuLp3WDWvgE5vJ9kVj8BH8fjD+gKc5wVOKtRIPJnqL8Eqj55A5 + y8xjVcW5ldxVps2jj0kE7Mq8LG2R6Bd37Zsw+Dq3Cj/1khMgLkYog8/Nf+k2uYXPQpjA + TS03XR6eJ7GQcRUf0iWft80hVZMVk6KF2AWuF04HcJ/goyNj4MGGFun0tanDYNImJzv0 + A/8A== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625895; x=1693230695; + 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=rfyiNp4RS7b8BQCxsUs1afKXNK4WMu1bUdXxDQXJn1U=; + b=N71LYmMnxX45xKNJxNk72goiD3Cf5e0f3znUaZ/B4Ue95/rqpwn6vLQvhNkxjyJjKz + QxOUGBKeP4pdGPJD2eVZgEA1+8cyBu3q0BssvtHzLuXCZtgGmVE+jhS1ZplzCePV5HDq + cpjabmm8tLydQpgXN42bXGeg5S7C2hbuWb9P1yFz0T2VRKDhKfnBacDMMyCM77q885Xq + scmyG9QS6JjzzhlNCx2LAvunQyb5Ub3Jeac6w62kdW5d82X5hQ7R5IuMhO6HB9cXSoIL + q4cciYJYPkkgJo7cJBCGs9hpoG7mAiYugMX3xvTX0AozIxV+I0RqRnIaeK4YPRctAqDa + B+ZQ== +X-Gm-Message-State: AOJu0Yzo17fP4SdOljTzWNaDUk2p0KMalzHe92zD3l/uyJxeFYnVtZ6Z + JKO6vwp7AEEfITHacMlSfDnu20sRQPA= +X-Google-Smtp-Source: + AGHT+IEaweUWG6MdegfaF+T8dg4D4mXuTL2UTLikuqRhtfAyLWNc6xApEfO0HHPUExbseBScRw20SA== +X-Received: by 2002:a5d:44d1:0:b0:313:f94f:3b15 with SMTP id + z17-20020a5d44d1000000b00313f94f3b15mr5140696wrr.2.1692625894567; + Mon, 21 Aug 2023 06:51:34 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.32 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:34 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 05/13] dm: video: Add damage notification on display fills +Date: Mon, 21 Aug 2023 16:51:02 +0300 +Message-Id: <20230821135111.3558478-6-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +Let's report the video damage when we fill parts of the screen. This +way we can later lazily flush only relevant regions to hardware. + +Signed-off-by: Alexander Graf +Reported-by: Da Xue +[Alper: Call video_damage() in video_fill_part(), edit commit message] +Signed-off-by: Alper Nebi Yasak +--- +Does video_fill_part() need a video_sync(dev, false) here? + +Changes in v5: +- Call video_damage() also in video_fill_part() + + drivers/video/video-uclass.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c +index 447689581668..ebf409d839f0 100644 +--- a/drivers/video/video-uclass.c ++++ b/drivers/video/video-uclass.c +@@ -203,6 +203,8 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, + if (ret) + return ret; + ++ video_damage(dev, xstart, ystart, xend - xstart, yend - ystart); ++ + return 0; + } + +@@ -249,6 +251,8 @@ int video_fill(struct udevice *dev, u32 colour) + if (ret) + return ret; + ++ video_damage(dev, 0, 0, priv->xsize, priv->ysize); ++ + return video_sync(dev, false); + } + + +From patchwork Mon Aug 21 13:51:03 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823649 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=oaK1+upy; + 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 4RTv712FN9z1yYZ + for ; Mon, 21 Aug 2023 23:52:29 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id D08B3867A0; + Mon, 21 Aug 2023 15:51:42 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="oaK1+upy"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 8D15587084; Mon, 21 Aug 2023 15:51:40 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com + [IPv6:2a00:1450:4864:20::436]) + (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 DA4E1869B6 + for ; Mon, 21 Aug 2023 15:51:37 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x436.google.com with SMTP id + ffacd0b85a97d-317f1c480eeso3049475f8f.2 + for ; Mon, 21 Aug 2023 06:51:37 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625897; x=1693230697; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=7yrfRyMChh1ygDQtR1jl9BYhd6F+V0coaR3saA65Ao8=; + b=oaK1+upyGYfwOr4/nZR8RIRT+Yn2PZ+2dy2+GMSjffIkOUvAA4SwUrsuBUHVmQ+cIg + Q0F+D60Mp5/MzkFm9rwAnrQpO2uJb9esI/U8crcERtM+p1p5iKU9VNHrwRjlzB4VfG3E + 1rFRNOOhGpyPBS6RY+cJD557cLeGMoVUsQbv3xfnShrQg142CAOgzdQ4AtJ3FYRDngOc + QiczfO53zpeOnZjhBAa5aw7TDgIqHuR1bYCYIRraWJdIl9Cxa6ZDN1IozoPg6hutV+SE + 77oOM9VfIYyC8B3q6wdaduzcH0Qgeq3IEzfE54DLVtS/yT5z2vJiPtnfnV2pXzjU01Iq + l7Fg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625897; x=1693230697; + 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=7yrfRyMChh1ygDQtR1jl9BYhd6F+V0coaR3saA65Ao8=; + b=NgyE/5/ABpribqDY5ykRBi/ftUfa+3meGxemZJPAl2gCi2+PfUEbrdHMbSPz/8nbY9 + qS/5UPv+41yRmDLmqeaNK/RXif7qV+CdVrg4K7xD0x/HbezXsIvKSc6rs5IqPqQvp0lx + JDuescRAcyrjtBjBFIAsrOx0+GynSijvWQArLcJRL330eiNnBn0HYRiVFqfEy3jpv5Hz + 13zk9q/GW8Hc7GRtA+FAkeUqJ3t8VaRzHLfoUJO3zFS8bWXgnWUAbCx0OOB9MahUqvyv + s/jpw79ZhFlhzO/Nwa63SlfQi+T3dAiYQ3kpBDgz7YFjSxvYaFYJDW3ihVDv8VTIiLdl + WB8Q== +X-Gm-Message-State: AOJu0YwqmT7iLKiUZblbrZz+UE4GebW514Sdllsg7NS//fk35AzXbHd7 + 7wXdC1ugEQP9Gez3jIRiAyQs4cDTcVc= +X-Google-Smtp-Source: + AGHT+IHO/arCmWeM8GYL18CXATu4Sh++TdyEswajL5QnvTaImLdSHvMUo+xc/gBkyHdBnNYS/qgvaQ== +X-Received: by 2002:adf:cd0b:0:b0:31c:3013:9fa5 with SMTP id + w11-20020adfcd0b000000b0031c30139fa5mr3560706wrm.59.1692625897248; + Mon, 21 Aug 2023 06:51:37 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.35 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:36 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 06/13] vidconsole: Add damage notifications to all + vidconsole drivers +Date: Mon, 21 Aug 2023 16:51:03 +0300 +Message-Id: <20230821135111.3558478-7-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +Now that we have a damage tracking API, let's populate damage done by +vidconsole drivers. We try to declare as little memory as damaged as +possible. + +Signed-off-by: Alexander Graf +Reported-by: Da Xue +[Alper: Rebase for met->baseline, fontdata->height/width, make rotated + console_putc_xy() damages pass tests, edit patch message] +Co-developed-by: Alper Nebi Yasak +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Use met->baseline instead of priv->baseline +- Use fontdata->height/width instead of VIDEO_FONT_HEIGHT/WIDTH +- Update console_rotate.c video_damage() calls to pass video tests +- Remove mention about not having minimal damage for console_rotate.c + +Changes in v2: +- Fix ranges in truetype target +- Limit rotate to necessary damage + + drivers/video/console_normal.c | 18 +++++++++++ + drivers/video/console_rotate.c | 54 ++++++++++++++++++++++++++++++++ + drivers/video/console_truetype.c | 21 +++++++++++++ + drivers/video/video-uclass.c | 1 + + 4 files changed, 94 insertions(+) + +diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c +index 413c7abee9e1..a19ce6a2bc11 100644 +--- a/drivers/video/console_normal.c ++++ b/drivers/video/console_normal.c +@@ -39,6 +39,12 @@ static int console_set_row(struct udevice *dev, uint row, int clr) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ 0, ++ fontdata->height * row, ++ vid_priv->xsize, ++ fontdata->height); ++ + return 0; + } + +@@ -60,6 +66,12 @@ static int console_move_rows(struct udevice *dev, uint rowdst, + if (ret) + return ret; + ++ video_damage(dev->parent, ++ 0, ++ fontdata->height * rowdst, ++ vid_priv->xsize, ++ fontdata->height * count); ++ + return 0; + } + +@@ -90,6 +102,12 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ x, ++ y, ++ fontdata->width, ++ fontdata->height); ++ + ret = vidconsole_sync_copy(dev, start, line); + if (ret) + return ret; +diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c +index 65358a1c6e74..6c3e7c1bb8dc 100644 +--- a/drivers/video/console_rotate.c ++++ b/drivers/video/console_rotate.c +@@ -36,6 +36,12 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ vid_priv->xsize - ((row + 1) * fontdata->height), ++ 0, ++ fontdata->height, ++ vid_priv->ysize); ++ + return 0; + } + +@@ -64,6 +70,12 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, + dst += vid_priv->line_length; + } + ++ video_damage(dev->parent, ++ vid_priv->xsize - ((rowdst + count) * fontdata->height), ++ 0, ++ count * fontdata->height, ++ vid_priv->ysize); ++ + return 0; + } + +@@ -96,6 +108,12 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ vid_priv->xsize - y - fontdata->height, ++ linenum - 1, ++ fontdata->height, ++ fontdata->width); ++ + return VID_TO_POS(fontdata->width); + } + +@@ -121,6 +139,12 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ 0, ++ vid_priv->ysize - (row + 1) * fontdata->height, ++ vid_priv->xsize, ++ fontdata->height); ++ + return 0; + } + +@@ -142,6 +166,12 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, + vidconsole_memmove(dev, dst, src, + fontdata->height * vid_priv->line_length * count); + ++ video_damage(dev->parent, ++ 0, ++ vid_priv->ysize - (rowdst + count) * fontdata->height, ++ vid_priv->xsize, ++ count * fontdata->height); ++ + return 0; + } + +@@ -174,6 +204,12 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ x - fontdata->width + 1, ++ linenum - fontdata->height + 1, ++ fontdata->width, ++ fontdata->height); ++ + return VID_TO_POS(fontdata->width); + } + +@@ -198,6 +234,12 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ row * fontdata->height, ++ 0, ++ fontdata->height, ++ vid_priv->ysize); ++ + return 0; + } + +@@ -224,6 +266,12 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, + dst += vid_priv->line_length; + } + ++ video_damage(dev->parent, ++ rowdst * fontdata->height, ++ 0, ++ count * fontdata->height, ++ vid_priv->ysize); ++ + return 0; + } + +@@ -255,6 +303,12 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ y, ++ linenum - fontdata->width + 1, ++ fontdata->height, ++ fontdata->width); ++ + return VID_TO_POS(fontdata->width); + } + +diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c +index 0f9bb49e44f7..0adbf9cc3d67 100644 +--- a/drivers/video/console_truetype.c ++++ b/drivers/video/console_truetype.c +@@ -178,6 +178,7 @@ struct console_tt_priv { + static int console_truetype_set_row(struct udevice *dev, uint row, int clr) + { + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); ++ struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct console_tt_priv *priv = dev_get_priv(dev); + struct console_tt_metrics *met = priv->cur_met; + void *end, *line; +@@ -221,6 +222,12 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) + if (ret) + return ret; + ++ video_damage(dev->parent, ++ 0, ++ vc_priv->y_charsize * row, ++ vid_priv->xsize, ++ vc_priv->y_charsize); ++ + return 0; + } + +@@ -228,6 +235,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, + uint rowsrc, uint count) + { + struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); ++ struct vidconsole_priv *vc_priv = dev_get_uclass_priv(dev); + struct console_tt_priv *priv = dev_get_priv(dev); + struct console_tt_metrics *met = priv->cur_met; + void *dst; +@@ -246,6 +254,12 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, + for (i = 0; i < priv->pos_ptr; i++) + priv->pos[i].ypos -= diff; + ++ video_damage(dev->parent, ++ 0, ++ vc_priv->y_charsize * rowdst, ++ vid_priv->xsize, ++ vc_priv->y_charsize * count); ++ + return 0; + } + +@@ -403,6 +417,13 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, + + line += vid_priv->line_length; + } ++ ++ video_damage(dev->parent, ++ VID_TO_PIXEL(x) + xoff, ++ y + met->baseline + yoff, ++ width, ++ height); ++ + ret = vidconsole_sync_copy(dev, start, line); + if (ret) + return ret; +diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c +index ebf409d839f0..8bfcbc88dda7 100644 +--- a/drivers/video/video-uclass.c ++++ b/drivers/video/video-uclass.c +@@ -199,6 +199,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, + } + line += priv->line_length; + } ++ + ret = video_sync_copy(dev, start, line); + if (ret) + return ret; + +From patchwork Mon Aug 21 13:51:04 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823650 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=i+1wSJUC; + 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 4RTv7B5SVxz1yYZ + for ; Mon, 21 Aug 2023 23:52:38 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 2380887084; + Mon, 21 Aug 2023 15:51:45 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="i+1wSJUC"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 2081087081; Mon, 21 Aug 2023 15:51:43 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 +Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com + [IPv6:2a00:1450:4864:20::329]) + (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 45F8E8707A + for ; Mon, 21 Aug 2023 15:51:40 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wm1-x329.google.com with SMTP id + 5b1f17b1804b1-3fee600dce6so18065515e9.1 + for ; Mon, 21 Aug 2023 06:51:40 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625900; x=1693230700; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=du9K8HAMfjDBv9t9zq9p8Zs+vCZHJ6g2zmB7iSzSF7o=; + b=i+1wSJUCYpv3D2Y4WhFT+a+eXACMjCfu9K5FQkWQdC2smyIukzPLOT9TKll1BIlZ+S + 0BSrF+Vp8/DGT40HSh+wXWV4jYRbGaai6uC9HETzas7pJ6Qhy+ffz2UKdEYLi1VLHsaq + X75Z5dWmXphu9f83rAKezE9CYHm+PJtfCCmN6nzYmKby9xzdvEmPjC4JmCjqvh+sqORE + Bzxq55zbOUyTxIzqT01tuFNOw/v8W0H5dQ6fFOCzvxrMmYV1xWY68YL/0QqfqG2DG5q1 + XPDS0Sgg6L+yzBD2e/I0iNDZaFfXRDq4jvWBkELBWMrWm1880C9/qHFlPwFRRUlHYf+M + 4DSQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625900; x=1693230700; + 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=du9K8HAMfjDBv9t9zq9p8Zs+vCZHJ6g2zmB7iSzSF7o=; + b=ejVU1hfEMyFZ7BfMSqaYec4EUOoA0M467Rm/YLD9WqMi6MKcePqHndqYIVtBdIb8pl + jE/EUHhBvvRp1Bn9zpDfUbCUk27iKZaqWwqAa4ZLknDsCStzGovzG2+wKem8yoP2H1jp + e5tUVYZa2/MESz/zDnwWZV528p3+eHhCUUWBwTCt3plzb+SWqR1j0T40nBrUB+tDj1b0 + VYDTZvDCxDhQRGlLmMYX8QtWf/waAzPl5ePXvPhus06aR5+7O2V28M8yF2xRcceFSIQR + 4T2k/MBwCdM1+mpz6TnKB+zjN6Kj0TmPzEo9o6Pcc/lXWY0kRniuHFu0fzE84gOcGlOi + Xfyw== +X-Gm-Message-State: AOJu0YxMuk5t4Hh2FasrdRfRr0tLxX8vAgGS5cfNm5tZpbvKz9V6ip/a + g8C3FsqqNAKybynks3ECaaBXn+kLAr4= +X-Google-Smtp-Source: + AGHT+IE0aHC9IeAZ9om6v+CX5lhGhaikzyvs7K+JjasiPPxFotFPaEOG+0SHfy/L4wW7iRlvWFh0mw== +X-Received: by 2002:a5d:568f:0:b0:317:e5ec:8767 with SMTP id + f15-20020a5d568f000000b00317e5ec8767mr4615501wrv.21.1692625899711; + Mon, 21 Aug 2023 06:51:39 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.37 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:39 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 07/13] video: test: Test video damage tracking via + vidconsole +Date: Mon, 21 Aug 2023 16:51:04 +0300 +Message-Id: <20230821135111.3558478-8-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +With VIDEO_DAMAGE, the video uclass tracks updated regions of the frame +buffer in order to avoid unnecessary work during a video sync. Enable +the config in sandbox and add a test for it, by printing strings at a +few locations and checking the tracked region. + +Signed-off-by: Alper Nebi Yasak +--- +This is hard to test because most things issue video syncs that process +and reset the damaged region. + +Changes in v5: +- Add patch "video: test: Test video damage tracking via vidconsole" + + configs/sandbox_defconfig | 1 + + test/dm/video.c | 56 +++++++++++++++++++++++++++++++++++++++ + 2 files changed, 57 insertions(+) + +diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig +index 259f31f26cee..51b820f13121 100644 +--- a/configs/sandbox_defconfig ++++ b/configs/sandbox_defconfig +@@ -307,6 +307,7 @@ CONFIG_USB_ETH_CDC=y + CONFIG_VIDEO=y + CONFIG_VIDEO_FONT_SUN12X22=y + CONFIG_VIDEO_COPY=y ++CONFIG_VIDEO_DAMAGE=y + CONFIG_CONSOLE_ROTATION=y + CONFIG_CONSOLE_TRUETYPE=y + CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y +diff --git a/test/dm/video.c b/test/dm/video.c +index e4bd27a6b76f..8c7d9800a42e 100644 +--- a/test/dm/video.c ++++ b/test/dm/video.c +@@ -711,3 +711,59 @@ static int dm_test_video_copy(struct unit_test_state *uts) + return 0; + } + DM_TEST(dm_test_video_copy, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); ++ ++/* Test video damage tracking */ ++static int dm_test_video_damage(struct unit_test_state *uts) ++{ ++ struct sandbox_sdl_plat *plat; ++ struct udevice *dev, *con; ++ struct video_priv *priv; ++ const char *test_string_1 = "Criticism may not be agreeable, "; ++ const char *test_string_2 = "but it is necessary."; ++ const char *test_string_3 = "It fulfils the same function as pain in the human body."; ++ ++ if (!IS_ENABLED(CONFIG_VIDEO_DAMAGE)) ++ return -EAGAIN; ++ ++ ut_assertok(uclass_find_device(UCLASS_VIDEO, 0, &dev)); ++ ut_assert(!device_active(dev)); ++ plat = dev_get_plat(dev); ++ plat->font_size = 32; ++ ++ ut_assertok(video_get_nologo(uts, &dev)); ++ ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ++ priv = dev_get_uclass_priv(dev); ++ ++ vidconsole_position_cursor(con, 14, 10); ++ vidconsole_put_string(con, test_string_2); ++ ut_asserteq(449, priv->damage.xstart); ++ ut_asserteq(325, priv->damage.ystart); ++ ut_asserteq(661, priv->damage.xend); ++ ut_asserteq(350, priv->damage.yend); ++ ++ vidconsole_position_cursor(con, 7, 5); ++ vidconsole_put_string(con, test_string_1); ++ ut_asserteq(225, priv->damage.xstart); ++ ut_asserteq(164, priv->damage.ystart); ++ ut_asserteq(661, priv->damage.xend); ++ ut_asserteq(350, priv->damage.yend); ++ ++ vidconsole_position_cursor(con, 21, 15); ++ vidconsole_put_string(con, test_string_3); ++ ut_asserteq(225, priv->damage.xstart); ++ ut_asserteq(164, priv->damage.ystart); ++ ut_asserteq(1280, priv->damage.xend); ++ ut_asserteq(510, priv->damage.yend); ++ ++ video_sync(dev, false); ++ ut_asserteq(priv->xsize, priv->damage.xstart); ++ ut_asserteq(priv->ysize, priv->damage.ystart); ++ ut_asserteq(0, priv->damage.xend); ++ ut_asserteq(0, priv->damage.yend); ++ ++ ut_asserteq(7339, compress_frame_buffer(uts, dev, false)); ++ ut_assertok(check_copy_frame_buffer(uts, dev)); ++ ++ return 0; ++} ++DM_TEST(dm_test_video_damage, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +From patchwork Mon Aug 21 13:51:05 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823651 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=mvjKik+t; + 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 4RTv7M6kVWz1yYZ + for ; Mon, 21 Aug 2023 23:52:47 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 6CAC987085; + Mon, 21 Aug 2023 15:51:46 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="mvjKik+t"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 6192687085; Mon, 21 Aug 2023 15:51:45 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 +Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com + [IPv6:2a00:1450:4864:20::336]) + (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 D1E718706A + for ; Mon, 21 Aug 2023 15:51:42 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wm1-x336.google.com with SMTP id + 5b1f17b1804b1-3fee17aebc8so20256405e9.0 + for ; Mon, 21 Aug 2023 06:51:42 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625902; x=1693230702; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=OUPwGyIUGhu07FwRipI6J5nz3cUBWpffvk0k2vprnLg=; + b=mvjKik+ts2RRqakLQOi9t7J1i101HYF0aguRZ/P4y3h8SvaC+jrWNXPy+MyUiGFatO + EW5N4iqonVrCvE+i19nnSxA3TW5G5ItgSDTN6yq5TEp806h08MC17nKgCuRk/Urg+Nkj + ZewK+CW+lOR6k2kB8LtZylmeke1YHCeGMXq9VMK1hsm4co4hgSx0ZJ1OXiP5+tc4mVug + L2WSO1+ILyeHTT0N/dHw3FHShX08Y0SisUe32K946KofaqN6teHjb172uNMPVvd4Nk1S + G2GYNvIigYOzyXNzeBRUDXG3TkK8+ioXwBLZ4iqTsf77Dc0p2ePFbhc23gHzBcKBpUSc + O2nA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625902; x=1693230702; + 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=OUPwGyIUGhu07FwRipI6J5nz3cUBWpffvk0k2vprnLg=; + b=PY5C635/8jWW5ixQ4L1L3j9qeTGHNNV7zdPW6utGplgCgNorieSsCHQweRvRmMeEuD + MFr4iXeMz4fuhtbE79McVeS1D2v3BXvw2DX52qn7G6MlWSp/OVuocmhZPavm+DsYq7wJ + D//vupLeuSNo0SXsniHXWL8NlKNfz7qnozFFui+kEvO0IwOmVbDRI99V9uZM3ng9hERg + y3hKkIFQSgXYtPJ+4h3reOPhrZLXW5t/o9rXjgeC+l6WyxkI6UASNgww0aC0iwiIg40B + enEpHJN00lL6FOkCuYsMay4itv3ydNVuzZHbW7w6tmgDHIWKLg4yi4tFuiSgl+EnJluq + pqDw== +X-Gm-Message-State: AOJu0YzfIxtWigpVmRfL01E4NvwPLzRkCCjd173t25icCTVna47obihz + mXXbV/Xvlo7hwqge7/MU2LnnCJaUcgE= +X-Google-Smtp-Source: + AGHT+IFzj3fGJ3yOnSTVNmg3QQIrMsHdzvHVI7a3IQjx0jS8kD0qBSvWJ3Z5+c4jA0D6oPZBiuGxwA== +X-Received: by 2002:a5d:6811:0:b0:319:8a5a:ab5e with SMTP id + w17-20020a5d6811000000b003198a5aab5emr4349395wru.38.1692625902291; + Mon, 21 Aug 2023 06:51:42 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.40 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:41 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 08/13] video: Add damage notification on bmp display +Date: Mon, 21 Aug 2023 16:51:05 +0300 +Message-Id: <20230821135111.3558478-9-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +Let's report the video damage when we draw a bitmap on the screen. This +way we can later lazily flush only relevant regions to hardware. + +Signed-off-by: Alexander Graf +Reported-by: Da Xue +Reviewed-by: Simon Glass +Signed-off-by: Alper Nebi Yasak +--- + +(no changes since v1) + + drivers/video/video_bmp.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c +index 45f003c8251a..10943b9ca19f 100644 +--- a/drivers/video/video_bmp.c ++++ b/drivers/video/video_bmp.c +@@ -460,6 +460,8 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, + break; + }; + ++ video_damage(dev, x, y, width, height); ++ + /* Find the position of the top left of the image in the framebuffer */ + fb = (uchar *)(priv->fb + y * priv->line_length + x * bpix / 8); + ret = video_sync_copy(dev, start, fb); + +From patchwork Mon Aug 21 13:51:06 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823652 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=rvkBTDGo; + 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 4RTv7Y6TNDz1yYZ + for ; Mon, 21 Aug 2023 23:52:57 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id B23478708D; + Mon, 21 Aug 2023 15:51:48 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="rvkBTDGo"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id E994E87081; Mon, 21 Aug 2023 15:51:47 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 +Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com + [IPv6:2a00:1450:4864:20::430]) + (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 4A29E8708E + for ; Mon, 21 Aug 2023 15:51:45 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x430.google.com with SMTP id + ffacd0b85a97d-31427ddd3fbso3057122f8f.0 + for ; Mon, 21 Aug 2023 06:51:45 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625905; x=1693230705; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=NHWfOmBWnCfG15vLo7N7Y/b5x/nSoPE0dmgy30xOm9Q=; + b=rvkBTDGokSsZ+zHSmCyephYHOa1zCgYEH1V/eHcDIaJehG3LF1h3ZetBhv0F1WCnRL + dg0OqSl4nhT+d01IqkhLNI1FTeIJQeE/FHwY83jActydA9RdIKB97V7VAmOnABjsedPs + n/m1fNRUpKdpm/TBglBcCWTlhrozxmO+plcVOAjMhNlQQGUGkRo1eq/yHOw8pzfiIQVT + 4G4hJi3ePKSsEYbd1YuMZSkrzN70N+Erw/eeRb2QAdkn4J6xcJyPMEWirh7uNV2erutB + ZzxtmQOTBV9y19HeQkYKJeCnpReJ2LaLzTJj72ehPZpZqbYfj67OE+MeCC6Yt/m3YILh + fpGQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625905; x=1693230705; + 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=NHWfOmBWnCfG15vLo7N7Y/b5x/nSoPE0dmgy30xOm9Q=; + b=i5Ecd9fdl1ZJU0VqAc78F3Pmf9jo/gquJagwYJOv+0Gs8ayWCAJVUNkBV1a10fi3YU + uHNi0JjDvPtp8HPET+X5ywPbVDMbGOtad+ZjijeZL+mbC+Zc+lN2Oy35AoZjAeiYYqcL + qr+tjpJBWmj7lsr4rZ+Tqpc5m93dDUcxAeKZeOas3KQ+oM/S5zaPEb6puDJuVXTGbx9/ + NF+fyUg6I5MN+ZrT/+2pj8da5MpJaSlYzzymyg7JmdELwMKcBJsOuVNFfj+kXHLAmapY + MCO+hRidacGMoSYFLc/PHU7rU1qZqAWuizW35JPJmGYWschbDBhU5HWTPkJ8ifdZ9dqO + 7kkA== +X-Gm-Message-State: AOJu0YxlhwAy04+v9sqR7+z6BpzMYlqGrKNxnrBV5TAuFHvCn94+0y5X + UCsHr11K/guiHrF8/+oTMNTEUjwCaRQ= +X-Google-Smtp-Source: + AGHT+IF9A6Dqme3W/tV3JyovhEsU6i4A15qi8QyYKIlOrt7P6EPMkzmv+B+4oB2S58BxD/9oTr/SHQ== +X-Received: by 2002:a5d:4988:0:b0:31a:e6c2:770d with SMTP id + r8-20020a5d4988000000b0031ae6c2770dmr4196623wrq.36.1692625904737; + Mon, 21 Aug 2023 06:51:44 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.42 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:44 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 09/13] efi_loader: GOP: Add damage notification on BLT +Date: Mon, 21 Aug 2023 16:51:06 +0300 +Message-Id: <20230821135111.3558478-10-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +Now that we have a damage tracking API, let's populate damage done by +UEFI payloads when they BLT data onto the screen. + +Signed-off-by: Alexander Graf +Reported-by: Da Xue +Reviewed-by: Heinrich Schuchardt +[Alper: Add struct comment for new member] +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Document new vdev field in struct efi_gop_obj comment + +Changes in v4: +- Skip damage on EfiBltVideoToBltBuffer + +Changes in v3: +- Adapt to always assume DM is used + +Changes in v2: +- Remove ifdefs from gop + + lib/efi_loader/efi_gop.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c +index 778b693f983a..db6535e080c4 100644 +--- a/lib/efi_loader/efi_gop.c ++++ b/lib/efi_loader/efi_gop.c +@@ -24,6 +24,7 @@ static const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; + * @ops: graphical output protocol interface + * @info: graphical output mode information + * @mode: graphical output mode ++ * @vdev: backing video device + * @bpix: bits per pixel + * @fb: frame buffer + */ +@@ -32,6 +33,7 @@ struct efi_gop_obj { + struct efi_gop ops; + struct efi_gop_mode_info info; + struct efi_gop_mode mode; ++ struct udevice *vdev; + /* Fields we only have access to during init */ + u32 bpix; + void *fb; +@@ -120,6 +122,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, + u32 *fb32 = gopobj->fb; + u16 *fb16 = gopobj->fb; + struct efi_gop_pixel *buffer = __builtin_assume_aligned(bufferp, 4); ++ bool blt_to_video = (operation != EFI_BLT_VIDEO_TO_BLT_BUFFER); + + if (delta) { + /* Check for 4 byte alignment */ +@@ -243,6 +246,9 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, + dlineoff += dwidth; + } + ++ if (blt_to_video) ++ video_damage(gopobj->vdev, dx, dy, width, height); ++ + return EFI_SUCCESS; + } + +@@ -548,6 +554,7 @@ efi_status_t efi_gop_register(void) + gopobj->info.pixels_per_scanline = col; + gopobj->bpix = bpix; + gopobj->fb = fb; ++ gopobj->vdev = vdev; + + return EFI_SUCCESS; + } + +From patchwork Mon Aug 21 13:51:07 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823653 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=SJ3CoTwS; + 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 4RTv7l6Gwbz1yYZ + for ; Mon, 21 Aug 2023 23:53:07 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 04C3A87091; + Mon, 21 Aug 2023 15:51:52 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="SJ3CoTwS"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 79C6786F0A; Mon, 21 Aug 2023 15:51: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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 +Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com + [IPv6:2a00:1450:4864:20::435]) + (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 E3F3B86E80 + for ; Mon, 21 Aug 2023 15:51:47 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x435.google.com with SMTP id + ffacd0b85a97d-31aeef88a55so1551204f8f.2 + for ; Mon, 21 Aug 2023 06:51:47 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625907; x=1693230707; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=l/DCoXVnGlEMqWseytQAYuhC9MvrFlVv7QEu+lzOB9U=; + b=SJ3CoTwShv0m1a2l77IYGRiPJhE773qxJozbJ8TLkbWb/Fs3vzMjaetMjO1LteCIix + nxWVY9KC93yaMYqJT6SqYWKi1BaFToYnd6muvummJcQpRouAllJWg2nVkF0e6rb8GdHn + kEvHDvCo4Xq4Lrpvs6/W0ONesn+kGcCJbX3+BARXOoTD87bHAQpb5gcTr6FjYwUraYf/ + 31t1qEak7+tRD5cuPx0ItVaX8KSHeAMuueL0gEw6Wt64zNUyAO7W7cCRNJFMIsBkB2Lw + IOsoOk7kBgIqU/InShFLnIoLlW9EafAood5bDff+/ADKYaXgkgxpBbWQWgtF6tmmvjGO + gfgg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625907; x=1693230707; + 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=l/DCoXVnGlEMqWseytQAYuhC9MvrFlVv7QEu+lzOB9U=; + b=Tx8Anl+tKgGLw4YpMhb5VbWFhDaaZ7izCBtT/Mun3zxxONGjrw/1uYrQVf/HxeEzcw + 0VQqKGIC9Kek3RaHw20BGPdbmmDTmaVo3IGNrikhp2qDmM0bBH2AVbn0K5MV5t9dwKsA + U5D/cFon6pqj8sco6Dd5oVBskjrgqlgNtd3HXzCrfuFmFtsXxecVmlgKOnnE8Kj+CGGI + D2EMM/0yQCq/vuxC4/ISIiaRk0/6GCX55V8DYg+claM+h691kk/LGeEGXJqs5X1wFGQU + EZeKiKrY2VvqZ7yOXoriyel6QE7BvHmCmurDC+oji/do1hnGp/6NPxPFV/ABKsRmjPGY + V6Eg== +X-Gm-Message-State: AOJu0YxqpYt8rTBNvBZ9hiz/qYI+xhkc2uURaJNeyYssFbd+tACGWJtX + 6fE/7qVWobRKTs1ZWXtn3qcomaeF/nc= +X-Google-Smtp-Source: + AGHT+IHlrJ5IlwhVESQ4N6S+FeCJPNau4Ry7TWJN4H6yUmdpI19HJsGEPwtYtoPvcLuI4yNltjc9CQ== +X-Received: by 2002:a5d:4483:0:b0:317:dada:2417 with SMTP id + j3-20020a5d4483000000b00317dada2417mr4326536wrq.31.1692625907186; + Mon, 21 Aug 2023 06:51:47 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.45 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:46 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 10/13] video: Only dcache flush damaged lines +Date: Mon, 21 Aug 2023 16:51:07 +0300 +Message-Id: <20230821135111.3558478-11-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +Now that we have a damage area tells us which parts of the frame buffer +actually need updating, let's only dcache flush those on video_sync() +calls. With this optimization in place, frame buffer updates - especially +on large screen such as 4k displays - speed up significantly. + +Signed-off-by: Alexander Graf +Reported-by: Da Xue +[Alper: Use damage.xstart/yend, IS_ENABLED()] +Co-developed-by: Alper Nebi Yasak +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Use xstart, ystart, xend, yend as names for damage region +- Use IS_ENABLED() instead of CONFIG_IS_ENABLED() + +Changes in v2: +- Fix dcache range; we were flushing too much before +- Remove ifdefs + + drivers/video/video-uclass.c | 41 +++++++++++++++++++++++++++++++----- + 1 file changed, 36 insertions(+), 5 deletions(-) + +diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c +index 8bfcbc88dda7..a50220bcc684 100644 +--- a/drivers/video/video-uclass.c ++++ b/drivers/video/video-uclass.c +@@ -385,6 +385,41 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) + priv->damage.yend = max(yend, priv->damage.yend); + } + ++#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) ++static void video_flush_dcache(struct udevice *vid) ++{ ++ struct video_priv *priv = dev_get_uclass_priv(vid); ++ ++ if (!priv->flush_dcache) ++ return; ++ ++ if (!IS_ENABLED(CONFIG_VIDEO_DAMAGE)) { ++ flush_dcache_range((ulong)priv->fb, ++ ALIGN((ulong)priv->fb + priv->fb_size, ++ CONFIG_SYS_CACHELINE_SIZE)); ++ ++ return; ++ } ++ ++ if (priv->damage.xend && priv->damage.yend) { ++ int lstart = priv->damage.xstart * VNBYTES(priv->bpix); ++ int lend = priv->damage.xend * VNBYTES(priv->bpix); ++ int y; ++ ++ for (y = priv->damage.ystart; y < priv->damage.yend; y++) { ++ ulong fb = (ulong)priv->fb; ++ ulong start = fb + (y * priv->line_length) + lstart; ++ ulong end = start + lend - lstart; ++ ++ start = ALIGN_DOWN(start, CONFIG_SYS_CACHELINE_SIZE); ++ end = ALIGN(end, CONFIG_SYS_CACHELINE_SIZE); ++ ++ flush_dcache_range(start, end); ++ } ++ } ++} ++#endif ++ + /* Flush video activity to the caches */ + int video_sync(struct udevice *vid, bool force) + { +@@ -404,11 +439,7 @@ int video_sync(struct udevice *vid, bool force) + * out whether it exists? For now, ARM is safe. + */ + #if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) +- if (priv->flush_dcache) { +- flush_dcache_range((ulong)priv->fb, +- ALIGN((ulong)priv->fb + priv->fb_size, +- CONFIG_SYS_CACHELINE_SIZE)); +- } ++ video_flush_dcache(vid); + #elif defined(CONFIG_VIDEO_SANDBOX_SDL) + static ulong last_sync; + + +From patchwork Mon Aug 21 13:51:08 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823654 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=JgtEabWc; + 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 4RTv7w4Mskz1yYZ + for ; Mon, 21 Aug 2023 23:53:16 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 4790487096; + Mon, 21 Aug 2023 15:51:54 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="JgtEabWc"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 102DC87096; Mon, 21 Aug 2023 15:51:54 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 +Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com + [IPv6:2a00:1450:4864:20::429]) + (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 4AFE187098 + for ; Mon, 21 Aug 2023 15:51:50 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x429.google.com with SMTP id + ffacd0b85a97d-31c3726cc45so1247414f8f.0 + for ; Mon, 21 Aug 2023 06:51:50 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625910; x=1693230710; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=NdoZCMaizC3Y759MOjDBPu1VoZ+fIm/Lqzoh+gR4stQ=; + b=JgtEabWcIca2ALjUCCqGgXmUf5MREa+Jm3Yt8fmf6mwr8MrhP5Iu7KssN+MMQbAxKO + cl+LarTpXoK8lh4x2WmdcUKViUJdCAMCFJCk6vdMhIFAjaBH1Sqhudg315eFGharTw6G + 7FFSDdE1ZAablttQmfgcm59Ilk5+2QRAFycWcOiue5yFfF8RSAAAF8UHkl7rKxgQKHCO + NWC3P4PdjYEtaQFoJ4R5txJ07Wdvoptc9JVL9WGf4wSL5X6fm+SbalQaW3YgFuKNy0fk + 0+lmUOMDOXmwx4iGWZd6+LRFXYEZGCZ95AvjoDF83ZlL9Nu1oUvB/qzH7PRJatx6j/mw + J8Zw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625910; x=1693230710; + 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=NdoZCMaizC3Y759MOjDBPu1VoZ+fIm/Lqzoh+gR4stQ=; + b=ATA2PnRfDc2gQVzxEqGIcgBsTvJvkOPNl2NSZEoxqmZfEe/94an/QM50JhcxX0wNEA + 0HpCsEsyDLhFnjW4APp/TYwLoc0mbRD/T517DYROiuJLUSRxyO/NApA1qyRJpVQTqpRc + dRZ5hG5VoUH3oHfwZN1abRKxbIogLNiJhSSNDvjA01RYJwTZY6Fq8xUJCYp9gI28/OI0 + oZ0SA+qdXZ4UvNR/uqun2tysI+JnatTKlbwSfCF7q/sj5AfH/VNk3EqNROuXlIBRMWI8 + pgosvMd73/GvTMQvsWPgGNNc3fhZgcnLKIoQFKdoqCeSFAufSLREsoWPLMMH1xXuh1lG + JKFQ== +X-Gm-Message-State: AOJu0YyKi/tYIN4uVjau5AbbNkJPzybGF79aUx+ls+uiyxVTGeu0zy64 + aMCSasGPaxyg+ogYkqU0Dx/1q3mIbnM= +X-Google-Smtp-Source: + AGHT+IHsb00O74X0NrGSp+Znx7MktY8oHr2PL7yyjJMmEkZVU5lzx7Wg/Yr0hFddlw1zsptntp6etA== +X-Received: by 2002:a05:6000:1cce:b0:314:ca7:f30b with SMTP id + bf14-20020a0560001cce00b003140ca7f30bmr5251008wrb.54.1692625909678; + Mon, 21 Aug 2023 06:51:49 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.47 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:49 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 11/13] video: Use VIDEO_DAMAGE for VIDEO_COPY +Date: Mon, 21 Aug 2023 16:51:08 +0300 +Message-Id: <20230821135111.3558478-12-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +CONFIG_VIDEO_COPY implemented a range-based copying mechanism: If we +print a single character, it will always copy the full range of bytes +from the top left corner of the character to the lower right onto the +uncached frame buffer. This includes pretty much the full line contents +of the printed character. + +Since we now have proper damage tracking, let's make use of that to reduce +the amount of data we need to copy. With this patch applied, we will only +copy the tiny rectangle surrounding characters when we print them, +speeding up the video console. + +After this, changes to the main frame buffer are not immediately copied +to the copy frame buffer, but postponed until the next video device +sync. So issue an explicit sync before inspecting the copy frame buffer +contents for the video tests. + +Signed-off-by: Alexander Graf +[Alper: Rebase for fontdata->height/w, fill_part(), fix memmove(dev), + drop from defconfig, use damage.xstart/yend, use IS_ENABLED(), + call video_sync() before copy_fb check, update video_copy test] +Co-developed-by: Alper Nebi Yasak +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Remove video_sync_copy() also from video_fill(), video_fill_part() +- Fix memmove() calls by removing the extra dev argument +- Call video_sync() before checking copy_fb in video tests +- Use xstart, ystart, xend, yend as names for damage region +- Use met->baseline instead of priv->baseline +- Use fontdata->height/width instead of VIDEO_FONT_HEIGHT/WIDTH +- Use xstart, ystart, xend, yend as names for damage region +- Use IS_ENABLED() instead of CONFIG_IS_ENABLED() +- Drop VIDEO_DAMAGE from sandbox defconfig added in a new patch +- Update dm_test_video_copy test added in a new patch + +Changes in v3: +- Make VIDEO_COPY always select VIDEO_DAMAGE + +Changes in v2: +- Add patch "video: Use VIDEO_DAMAGE for VIDEO_COPY" + + configs/sandbox_defconfig | 1 - + drivers/video/Kconfig | 5 ++ + drivers/video/console_normal.c | 13 +---- + drivers/video/console_rotate.c | 44 +++----------- + drivers/video/console_truetype.c | 16 +---- + drivers/video/vidconsole-uclass.c | 16 ----- + drivers/video/video-uclass.c | 97 ++++++++----------------------- + drivers/video/video_bmp.c | 7 --- + include/video.h | 37 ------------ + include/video_console.h | 52 ----------------- + test/dm/video.c | 3 +- + 11 files changed, 43 insertions(+), 248 deletions(-) + +diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig +index 51b820f13121..259f31f26cee 100644 +--- a/configs/sandbox_defconfig ++++ b/configs/sandbox_defconfig +@@ -307,7 +307,6 @@ CONFIG_USB_ETH_CDC=y + CONFIG_VIDEO=y + CONFIG_VIDEO_FONT_SUN12X22=y + CONFIG_VIDEO_COPY=y +-CONFIG_VIDEO_DAMAGE=y + CONFIG_CONSOLE_ROTATION=y + CONFIG_CONSOLE_TRUETYPE=y + CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y +diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig +index 97f494a1340b..b3fbd9d7d9ca 100644 +--- a/drivers/video/Kconfig ++++ b/drivers/video/Kconfig +@@ -83,11 +83,14 @@ config VIDEO_PCI_DEFAULT_FB_SIZE + + config VIDEO_COPY + bool "Enable copying the frame buffer to a hardware copy" ++ select VIDEO_DAMAGE + help + On some machines (e.g. x86), reading from the frame buffer is very + slow because it is uncached. To improve performance, this feature + allows the frame buffer to be kept in cached memory (allocated by + U-Boot) and then copied to the hardware frame-buffer as needed. ++ It uses the VIDEO_DAMAGE feature to keep track of regions to copy ++ and will only copy actually touched regions. + + To use this, your video driver must set @copy_base in + struct video_uc_plat. +@@ -105,6 +108,8 @@ config VIDEO_DAMAGE + regions of the frame buffer that were modified before, speeding up + screen refreshes significantly. + ++ It is also used by VIDEO_COPY to identify which regions changed. ++ + config BACKLIGHT_PWM + bool "Generic PWM based Backlight Driver" + depends on BACKLIGHT && DM_PWM +diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c +index a19ce6a2bc11..c44aa09473a3 100644 +--- a/drivers/video/console_normal.c ++++ b/drivers/video/console_normal.c +@@ -35,10 +35,6 @@ static int console_set_row(struct udevice *dev, uint row, int clr) + fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); + end = dst; + +- ret = vidconsole_sync_copy(dev, line, end); +- if (ret) +- return ret; +- + video_damage(dev->parent, + 0, + fontdata->height * row, +@@ -57,14 +53,11 @@ static int console_move_rows(struct udevice *dev, uint rowdst, + void *dst; + void *src; + int size; +- int ret; + + dst = vid_priv->fb + rowdst * fontdata->height * vid_priv->line_length; + src = vid_priv->fb + rowsrc * fontdata->height * vid_priv->line_length; + size = fontdata->height * vid_priv->line_length * count; +- ret = vidconsole_memmove(dev, dst, src, size); +- if (ret) +- return ret; ++ memmove(dst, src, size); + + video_damage(dev->parent, + 0, +@@ -108,10 +101,6 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch) + fontdata->width, + fontdata->height); + +- ret = vidconsole_sync_copy(dev, start, line); +- if (ret) +- return ret; +- + return VID_TO_POS(fontdata->width); + } + +diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c +index 6c3e7c1bb8dc..6e9067d1c7fb 100644 +--- a/drivers/video/console_rotate.c ++++ b/drivers/video/console_rotate.c +@@ -21,7 +21,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) + int pbytes = VNBYTES(vid_priv->bpix); + void *start, *dst, *line; + int i, j; +- int ret; + + start = vid_priv->fb + vid_priv->line_length - + (row + 1) * fontdata->height * pbytes; +@@ -32,9 +31,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) + fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); + line += vid_priv->line_length; + } +- ret = vidconsole_sync_copy(dev, start, line); +- if (ret) +- return ret; + + video_damage(dev->parent, + vid_priv->xsize - ((row + 1) * fontdata->height), +@@ -54,7 +50,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, + int pbytes = VNBYTES(vid_priv->bpix); + void *dst; + void *src; +- int j, ret; ++ int j; + + dst = vid_priv->fb + vid_priv->line_length - + (rowdst + count) * fontdata->height * pbytes; +@@ -62,10 +58,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, + (rowsrc + count) * fontdata->height * pbytes; + + for (j = 0; j < vid_priv->ysize; j++) { +- ret = vidconsole_memmove(dev, dst, src, +- fontdata->height * pbytes * count); +- if (ret) +- return ret; ++ memmove(dst, src, fontdata->height * pbytes * count); + src += vid_priv->line_length; + dst += vid_priv->line_length; + } +@@ -104,10 +97,6 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) + return ret; + + /* We draw backwards from 'start, so account for the first line */ +- ret = vidconsole_sync_copy(dev, start - vid_priv->line_length, line); +- if (ret) +- return ret; +- + video_damage(dev->parent, + vid_priv->xsize - y - fontdata->height, + linenum - 1, +@@ -125,7 +114,7 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) + struct video_fontdata *fontdata = priv->fontdata; + void *start, *line, *dst, *end; + int pixels = fontdata->height * vid_priv->xsize; +- int i, ret; ++ int i; + int pbytes = VNBYTES(vid_priv->bpix); + + start = vid_priv->fb + vid_priv->ysize * vid_priv->line_length - +@@ -135,9 +124,6 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) + for (i = 0; i < pixels; i++) + fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); + end = dst; +- ret = vidconsole_sync_copy(dev, start, end); +- if (ret) +- return ret; + + video_damage(dev->parent, + 0, +@@ -163,8 +149,7 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, + vid_priv->line_length; + src = end - (rowsrc + count) * fontdata->height * + vid_priv->line_length; +- vidconsole_memmove(dev, dst, src, +- fontdata->height * vid_priv->line_length * count); ++ memmove(dst, src, fontdata->height * vid_priv->line_length * count); + + video_damage(dev->parent, + 0, +@@ -199,11 +184,6 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) + if (ret) + return ret; + +- /* Add 4 bytes to allow for the first pixel writen */ +- ret = vidconsole_sync_copy(dev, start + 4, line); +- if (ret) +- return ret; +- + video_damage(dev->parent, + x - fontdata->width + 1, + linenum - fontdata->height + 1, +@@ -220,7 +200,7 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) + struct video_fontdata *fontdata = priv->fontdata; + int pbytes = VNBYTES(vid_priv->bpix); + void *start, *dst, *line; +- int i, j, ret; ++ int i, j; + + start = vid_priv->fb + row * fontdata->height * pbytes; + line = start; +@@ -230,9 +210,6 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) + fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); + line += vid_priv->line_length; + } +- ret = vidconsole_sync_copy(dev, start, line); +- if (ret) +- return ret; + + video_damage(dev->parent, + row * fontdata->height, +@@ -252,16 +229,13 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, + int pbytes = VNBYTES(vid_priv->bpix); + void *dst; + void *src; +- int j, ret; ++ int j; + + dst = vid_priv->fb + rowdst * fontdata->height * pbytes; + src = vid_priv->fb + rowsrc * fontdata->height * pbytes; + + for (j = 0; j < vid_priv->ysize; j++) { +- ret = vidconsole_memmove(dev, dst, src, +- fontdata->height * pbytes * count); +- if (ret) +- return ret; ++ memmove(dst, src, fontdata->height * pbytes * count); + src += vid_priv->line_length; + dst += vid_priv->line_length; + } +@@ -296,10 +270,6 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch) + line = start; + + ret = fill_char_horizontally(pfont, &line, vid_priv, fontdata, NORMAL_DIRECTION); +- if (ret) +- return ret; +- /* Add a line to allow for the first pixels writen */ +- ret = vidconsole_sync_copy(dev, start + vid_priv->line_length, line); + if (ret) + return ret; + +diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c +index 0adbf9cc3d67..07bb0af71311 100644 +--- a/drivers/video/console_truetype.c ++++ b/drivers/video/console_truetype.c +@@ -182,7 +182,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) + struct console_tt_priv *priv = dev_get_priv(dev); + struct console_tt_metrics *met = priv->cur_met; + void *end, *line; +- int ret; + + line = vid_priv->fb + row * met->font_size * vid_priv->line_length; + end = line + met->font_size * vid_priv->line_length; +@@ -218,9 +217,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) + default: + return -ENOSYS; + } +- ret = vidconsole_sync_copy(dev, line, end); +- if (ret) +- return ret; + + video_damage(dev->parent, + 0, +@@ -240,14 +236,11 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, + struct console_tt_metrics *met = priv->cur_met; + void *dst; + void *src; +- int i, diff, ret; ++ int i, diff; + + dst = vid_priv->fb + rowdst * met->font_size * vid_priv->line_length; + src = vid_priv->fb + rowsrc * met->font_size * vid_priv->line_length; +- ret = vidconsole_memmove(dev, dst, src, met->font_size * +- vid_priv->line_length * count); +- if (ret) +- return ret; ++ memmove(dst, src, met->font_size * vid_priv->line_length * count); + + /* Scroll up our position history */ + diff = (rowsrc - rowdst) * met->font_size; +@@ -280,7 +273,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, + u8 *bits, *data; + int advance; + void *start, *end, *line; +- int row, ret; ++ int row; + + /* First get some basic metrics about this character */ + stbtt_GetCodepointHMetrics(font, ch, &advance, &lsb); +@@ -424,9 +417,6 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, + width, + height); + +- ret = vidconsole_sync_copy(dev, start, line); +- if (ret) +- return ret; + free(data); + + return width_frac; +diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c +index 05f930478096..27a1e8ec3e49 100644 +--- a/drivers/video/vidconsole-uclass.c ++++ b/drivers/video/vidconsole-uclass.c +@@ -682,22 +682,6 @@ UCLASS_DRIVER(vidconsole) = { + .per_device_auto = sizeof(struct vidconsole_priv), + }; + +-#ifdef CONFIG_VIDEO_COPY +-int vidconsole_sync_copy(struct udevice *dev, void *from, void *to) +-{ +- struct udevice *vid = dev_get_parent(dev); +- +- return video_sync_copy(vid, from, to); +-} +- +-int vidconsole_memmove(struct udevice *dev, void *dst, const void *src, +- int size) +-{ +- memmove(dst, src, size); +- return vidconsole_sync_copy(dev, dst, dst + size); +-} +-#endif +- + int vidconsole_clear_and_reset(struct udevice *dev) + { + int ret; +diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c +index a50220bcc684..c79499252a22 100644 +--- a/drivers/video/video-uclass.c ++++ b/drivers/video/video-uclass.c +@@ -160,7 +160,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, + struct video_priv *priv = dev_get_uclass_priv(dev); + void *start, *line; + int pixels = xend - xstart; +- int row, i, ret; ++ int row, i; + + start = priv->fb + ystart * priv->line_length; + start += xstart * VNBYTES(priv->bpix); +@@ -200,10 +200,6 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, + line += priv->line_length; + } + +- ret = video_sync_copy(dev, start, line); +- if (ret) +- return ret; +- + video_damage(dev, xstart, ystart, xend - xstart, yend - ystart); + + return 0; +@@ -223,7 +219,6 @@ int video_reserve_from_bloblist(struct video_handoff *ho) + int video_fill(struct udevice *dev, u32 colour) + { + struct video_priv *priv = dev_get_uclass_priv(dev); +- int ret; + + switch (priv->bpix) { + case VIDEO_BPP16: +@@ -248,9 +243,6 @@ int video_fill(struct udevice *dev, u32 colour) + memset(priv->fb, colour, priv->fb_size); + break; + } +- ret = video_sync_copy(dev, priv->fb, priv->fb + priv->fb_size); +- if (ret) +- return ret; + + video_damage(dev, 0, 0, priv->xsize, priv->ysize); + +@@ -420,6 +412,27 @@ static void video_flush_dcache(struct udevice *vid) + } + #endif + ++static void video_flush_copy(struct udevice *vid) ++{ ++ struct video_priv *priv = dev_get_uclass_priv(vid); ++ ++ if (!priv->copy_fb) ++ return; ++ ++ if (priv->damage.xend && priv->damage.yend) { ++ int lstart = priv->damage.xstart * VNBYTES(priv->bpix); ++ int lend = priv->damage.xend * VNBYTES(priv->bpix); ++ int y; ++ ++ for (y = priv->damage.ystart; y < priv->damage.yend; y++) { ++ ulong offset = (y * priv->line_length) + lstart; ++ ulong len = lend - lstart; ++ ++ memcpy(priv->copy_fb + offset, priv->fb + offset, len); ++ } ++ } ++} ++ + /* Flush video activity to the caches */ + int video_sync(struct udevice *vid, bool force) + { +@@ -427,6 +440,9 @@ int video_sync(struct udevice *vid, bool force) + struct video_ops *ops = video_get_ops(vid); + int ret; + ++ if (IS_ENABLED(CONFIG_VIDEO_COPY)) ++ video_flush_copy(vid); ++ + if (ops && ops->video_sync) { + ret = ops->video_sync(vid); + if (ret) +@@ -503,69 +519,6 @@ int video_get_ysize(struct udevice *dev) + return priv->ysize; + } + +-#ifdef CONFIG_VIDEO_COPY +-int video_sync_copy(struct udevice *dev, void *from, void *to) +-{ +- struct video_priv *priv = dev_get_uclass_priv(dev); +- +- if (priv->copy_fb) { +- long offset, size; +- +- /* Find the offset of the first byte to copy */ +- if ((ulong)to > (ulong)from) { +- size = to - from; +- offset = from - priv->fb; +- } else { +- size = from - to; +- offset = to - priv->fb; +- } +- +- /* +- * Allow a bit of leeway for valid requests somewhere near the +- * frame buffer +- */ +- if (offset < -priv->fb_size || offset > 2 * priv->fb_size) { +-#ifdef DEBUG +- char str[120]; +- +- snprintf(str, sizeof(str), +- "[** FAULT sync_copy fb=%p, from=%p, to=%p, offset=%lx]", +- priv->fb, from, to, offset); +- console_puts_select_stderr(true, str); +-#endif +- return -EFAULT; +- } +- +- /* +- * Silently crop the memcpy. This allows callers to avoid doing +- * this themselves. It is common for the end pointer to go a +- * few lines after the end of the frame buffer, since most of +- * the update algorithms terminate a line after their last write +- */ +- if (offset + size > priv->fb_size) { +- size = priv->fb_size - offset; +- } else if (offset < 0) { +- size += offset; +- offset = 0; +- } +- +- memcpy(priv->copy_fb + offset, priv->fb + offset, size); +- } +- +- return 0; +-} +- +-int video_sync_copy_all(struct udevice *dev) +-{ +- struct video_priv *priv = dev_get_uclass_priv(dev); +- +- video_sync_copy(dev, priv->fb, priv->fb + priv->fb_size); +- +- return 0; +-} +- +-#endif +- + #define SPLASH_DECL(_name) \ + extern u8 __splash_ ## _name ## _begin[]; \ + extern u8 __splash_ ## _name ## _end[] +diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c +index 10943b9ca19f..da2bbe864a03 100644 +--- a/drivers/video/video_bmp.c ++++ b/drivers/video/video_bmp.c +@@ -268,7 +268,6 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, + enum video_format eformat; + struct bmp_color_table_entry *palette; + int hdr_size; +- int ret; + + if (!bmp || !(bmp->header.signature[0] == 'B' && + bmp->header.signature[1] == 'M')) { +@@ -462,11 +461,5 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, + + video_damage(dev, x, y, width, height); + +- /* Find the position of the top left of the image in the framebuffer */ +- fb = (uchar *)(priv->fb + y * priv->line_length + x * bpix / 8); +- ret = video_sync_copy(dev, start, fb); +- if (ret) +- return log_ret(ret); +- + return video_sync(dev, false); + } +diff --git a/include/video.h b/include/video.h +index a522f33949e5..42e57b44188d 100644 +--- a/include/video.h ++++ b/include/video.h +@@ -350,43 +350,6 @@ void video_set_default_colors(struct udevice *dev, bool invert); + */ + int video_default_font_height(struct udevice *dev); + +-#ifdef CONFIG_VIDEO_COPY +-/** +- * vidconsole_sync_copy() - Sync back to the copy framebuffer +- * +- * This ensures that the copy framebuffer has the same data as the framebuffer +- * for a particular region. It should be called after the framebuffer is updated +- * +- * @from and @to can be in either order. The region between them is synced. +- * +- * @dev: Vidconsole device being updated +- * @from: Start/end address within the framebuffer (->fb) +- * @to: Other address within the frame buffer +- * Return: 0 if OK, -EFAULT if the start address is before the start of the +- * frame buffer start +- */ +-int video_sync_copy(struct udevice *dev, void *from, void *to); +- +-/** +- * video_sync_copy_all() - Sync the entire framebuffer to the copy +- * +- * @dev: Vidconsole device being updated +- * Return: 0 (always) +- */ +-int video_sync_copy_all(struct udevice *dev); +-#else +-static inline int video_sync_copy(struct udevice *dev, void *from, void *to) +-{ +- return 0; +-} +- +-static inline int video_sync_copy_all(struct udevice *dev) +-{ +- return 0; +-} +- +-#endif +- + /** + * video_damage() - Notify the video subsystem about screen updates. + * +diff --git a/include/video_console.h b/include/video_console.h +index 2694e44f6ecf..caadeb878989 100644 +--- a/include/video_console.h ++++ b/include/video_console.h +@@ -404,56 +404,4 @@ void vidconsole_list_fonts(struct udevice *dev); + */ + int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep); + +-#ifdef CONFIG_VIDEO_COPY +-/** +- * vidconsole_sync_copy() - Sync back to the copy framebuffer +- * +- * This ensures that the copy framebuffer has the same data as the framebuffer +- * for a particular region. It should be called after the framebuffer is updated +- * +- * @from and @to can be in either order. The region between them is synced. +- * +- * @dev: Vidconsole device being updated +- * @from: Start/end address within the framebuffer (->fb) +- * @to: Other address within the frame buffer +- * Return: 0 if OK, -EFAULT if the start address is before the start of the +- * frame buffer start +- */ +-int vidconsole_sync_copy(struct udevice *dev, void *from, void *to); +- +-/** +- * vidconsole_memmove() - Perform a memmove() within the frame buffer +- * +- * This handles a memmove(), e.g. for scrolling. It also updates the copy +- * framebuffer. +- * +- * @dev: Vidconsole device being updated +- * @dst: Destination address within the framebuffer (->fb) +- * @src: Source address within the framebuffer (->fb) +- * @size: Number of bytes to transfer +- * Return: 0 if OK, -EFAULT if the start address is before the start of the +- * frame buffer start +- */ +-int vidconsole_memmove(struct udevice *dev, void *dst, const void *src, +- int size); +-#else +- +-#include +- +-static inline int vidconsole_sync_copy(struct udevice *dev, void *from, +- void *to) +-{ +- return 0; +-} +- +-static inline int vidconsole_memmove(struct udevice *dev, void *dst, +- const void *src, int size) +-{ +- memmove(dst, src, size); +- +- return 0; +-} +- +-#endif +- + #endif +diff --git a/test/dm/video.c b/test/dm/video.c +index 8c7d9800a42e..4c3bcd26e94f 100644 +--- a/test/dm/video.c ++++ b/test/dm/video.c +@@ -106,6 +106,7 @@ static int check_copy_frame_buffer(struct unit_test_state *uts, + if (!IS_ENABLED(CONFIG_VIDEO_COPY)) + return 0; + ++ video_sync(dev, false); + ut_assertf(!memcmp(priv->fb, priv->copy_fb, priv->fb_size), + "Copy framebuffer does not match fb"); + +@@ -706,7 +707,7 @@ static int dm_test_video_copy(struct unit_test_state *uts) + vidconsole_put_string(con, test_string); + vidconsole_put_string(con, test_string); + ut_asserteq(7589, compress_frame_buffer(uts, dev, false)); +- ut_asserteq(5278, compress_frame_buffer(uts, dev, true)); ++ ut_asserteq(4127, compress_frame_buffer(uts, dev, true)); + + return 0; + } + +From patchwork Mon Aug 21 13:51:09 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823655 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=Q9fX66MT; + 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 4RTv8541j7z1yYZ + for ; Mon, 21 Aug 2023 23:53:25 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 909B287075; + Mon, 21 Aug 2023 15:51:56 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="Q9fX66MT"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 801C187082; Mon, 21 Aug 2023 15:51:55 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 +Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com + [IPv6:2a00:1450:4864:20::431]) + (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 D67548709E + for ; Mon, 21 Aug 2023 15:51:52 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wr1-x431.google.com with SMTP id + ffacd0b85a97d-317716a4622so3055294f8f.1 + for ; Mon, 21 Aug 2023 06:51:52 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625912; x=1693230712; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=pB2qI48avq9qUXnFEl+wSnmS8SG0cxx3SZjicfp6H7M=; + b=Q9fX66MTTcUQaIK9Ypbt13c6159mxahNRVYZb/qRcTZRgB9DWf7SyL5B6iwaerzl6H + V/NgeKQknUqjdF1rx5cN+0oUlRjL/uqf2PRT1u/2iPSTrLx9ImfxO59U1v7bkAyqsRHD + 9d/OLcbkmN2dqLKXGEJEhw9wRWn6PflMZfMjZfJ6PgDh1lldO8RAGdA+f9Wv0Uqs/CHY + M6HHFEIenHnWt15i3RWPMrP09rbx4OkOqYNXz1V/3BWUxb3tRe+1IqwA2n/oEpR5c0PM + YcGRP1tNM3yqfxG53IdsPPiujOtSHSbvtWSyefvk7z3wSlVPYMzicea8BirSi8/Ag/R0 + CJ5A== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625912; x=1693230712; + 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=pB2qI48avq9qUXnFEl+wSnmS8SG0cxx3SZjicfp6H7M=; + b=L5dQ5I1/r76Ec7WfGFYq1iqhI4RaRdXt+61BNvttoSzkuI28cDeE9IYg5h41YdBzNd + t6sNriBN4Qc+mGdOBHQb7hoI62tzka68Qd18eexmWznS1lz73CJWNA6nW0T2heZpmRnx + frQSxlPNxv5FZ2eXSdZLRIhWG0T0L+B+G/6B665+1/N1tvTFCLsToL2GaiGnEskSn3rJ + wQPY7b2lG/xkfWZiNERig8/6ZMW5R3QQDdOucA/FVYuHY4/dr+9UuPEHaimYzTwzN6AM + aehqXj0h7YO8NjF9HG1n1T4hEYq0FKqbcb2t+hLAUBpzGBjLNrpCdWa9LzQWN0EEJw8H + /ijQ== +X-Gm-Message-State: AOJu0YwwdmeqIA0FUSFZkbrYH8d4F3YWnny6MkSqZvX6DQEtu9Y/TVK7 + x418Ed0mXh7BUNyNIuPNquOOpbM3J+o= +X-Google-Smtp-Source: + AGHT+IFpiAY2BjXpJaKJJodzwN7aKj9YFF3eAkfmZgRFnB94o3W7mQtEZgXERHeKNVbIpRB5HlMypw== +X-Received: by 2002:a05:6000:1205:b0:31c:4f80:9f7 with SMTP id + e5-20020a056000120500b0031c4f8009f7mr1593479wrx.45.1692625912317; + Mon, 21 Aug 2023 06:51:52 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.50 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:51 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 12/13] video: Always compile cache flushing code +Date: Mon, 21 Aug 2023 16:51:09 +0300 +Message-Id: <20230821135111.3558478-13-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +The dcache flushing code path was conditional on ARM && !DCACHE config +options. However, dcaches exist on other platforms as well and may need +clearing if their driver requires it. + +Simplify the compile logic and always enable the dcache flush logic in +the video core. That way, drivers can always rely on it to call the arch +specific callbacks. + +This will increase code size for non-ARM platforms with CONFIG_VIDEO=y +slightly. + +Reported-by: Heinrich Schuchardt +Signed-off-by: Alexander Graf +Reviewed-by: Simon Glass +Signed-off-by: Alper Nebi Yasak +--- + +(no changes since v4) + +Changes in v4: +- Add patch "video: Always compile cache flushing code" + + drivers/video/video-uclass.c | 14 +++++--------- + 1 file changed, 5 insertions(+), 9 deletions(-) + +diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c +index c79499252a22..3f9ddaadd15d 100644 +--- a/drivers/video/video-uclass.c ++++ b/drivers/video/video-uclass.c +@@ -377,11 +377,13 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) + priv->damage.yend = max(yend, priv->damage.yend); + } + +-#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) + static void video_flush_dcache(struct udevice *vid) + { + struct video_priv *priv = dev_get_uclass_priv(vid); + ++ if (CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) ++ return; ++ + if (!priv->flush_dcache) + return; + +@@ -410,7 +412,6 @@ static void video_flush_dcache(struct udevice *vid) + } + } + } +-#endif + + static void video_flush_copy(struct udevice *vid) + { +@@ -449,14 +450,9 @@ int video_sync(struct udevice *vid, bool force) + return ret; + } + +- /* +- * flush_dcache_range() is declared in common.h but it seems that some +- * architectures do not actually implement it. Is there a way to find +- * out whether it exists? For now, ARM is safe. +- */ +-#if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) + video_flush_dcache(vid); +-#elif defined(CONFIG_VIDEO_SANDBOX_SDL) ++ ++#if defined(CONFIG_VIDEO_SANDBOX_SDL) + static ulong last_sync; + + if (force || get_timer(last_sync) > 100) { + +From patchwork Mon Aug 21 13:51:10 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Alper Nebi Yasak +X-Patchwork-Id: 1823656 +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=gmail.com header.i=@gmail.com header.a=rsa-sha256 + header.s=20221208 header.b=LXQ9F9oF; + 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 4RTv8G1ylrz1yYZ + for ; Mon, 21 Aug 2023 23:53:34 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id D63BC87082; + Mon, 21 Aug 2023 15:51:59 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="LXQ9F9oF"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 6DC358709F; Mon, 21 Aug 2023 15:51:58 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, + SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com + [IPv6:2a00:1450:4864:20::329]) + (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 B9E5887094 + for ; Mon, 21 Aug 2023 15:51:55 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=gmail.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=alpernebiyasak@gmail.com +Received: by mail-wm1-x329.google.com with SMTP id + 5b1f17b1804b1-3fee5ddc23eso19328245e9.1 + for ; Mon, 21 Aug 2023 06:51:55 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=gmail.com; s=20221208; t=1692625915; x=1693230715; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=q4KbQNgBgg/jRM/b8KJaE0YjvGZTzMRikT8MXE6mjwI=; + b=LXQ9F9oF17Es3W44Ien7NWJ7ymwABfjmSOFUn1nlvsBdcyw9b3O/o8ulQCpUwqhXho + Lsoff11Pmwlo87siidtGiRDX/BRiaZ8rBVWjS3jgK+U6RDPcwNCfR7otgNlLLaNyAd4w + BCXHT1+90WvAX/9alOvPUYlvUkP1t/S15/C+bUJWxok5Nf6l5iGthuNMWvZFFiUdQ8yR + 02AJastvoFpsYlAJI+JY69q6OhIhuxvdeDVc81dEOKzKkkEOdENJDmT6pJI4fiWlgwEE + iSJz97xC4lCSs+y5RPJTJfxE97zWwduKphPAN75dLRw0vnBYyqeXIo4ERx4uO7ku2jHf + 8feQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20221208; t=1692625915; x=1693230715; + 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=q4KbQNgBgg/jRM/b8KJaE0YjvGZTzMRikT8MXE6mjwI=; + b=VOZaSadRyfgFoQTc22AZ+r/0BSY4/MskC2GhVnMFg1gAc1bBAg7PJOyNu3x0V3ICuX + w68LWLVRLSaTmnF46xARtATTh8hJhyj7k3/oD4mNclUIyfmx/9vTSXJLn1MsG6m3TL8z + l5QNyUjNlgAK+YeuYH6zQl/yp5lmAF4EaOg5ITz+eLN2lf10QPYS18/bVbvNQ0Q2cwIN + FH+i7NhTRVoeExDFNVEFO11ZI3CJiAzpMC4WhI6OucHDWGIzEGcQKOYu9FfgwOfF5dVY + Yc6qjX3w9zhbwV3LA/grMncdSA9joMxVkWJwvFFD+6AlVLgin7DH8EDaIOtENT/RD/qq + Hjvw== +X-Gm-Message-State: AOJu0YyYX84n+767GB59OryFC5m/WbElRHO2Ix8D2HaL8Wnef45wnjme + 9nuXLuU5B1juuVwSn7QqTlnSVvjWNGQ= +X-Google-Smtp-Source: + AGHT+IER2mHBuKBsYnQ3qf+DOtUzSQystkj8v17bWgFVK+zSLUhwLW9BOExvB2cO0RXSrx1vnjzR/w== +X-Received: by 2002:adf:e711:0:b0:317:e542:80a8 with SMTP id + c17-20020adfe711000000b00317e54280a8mr4968619wrm.15.1692625915025; + Mon, 21 Aug 2023 06:51:55 -0700 (PDT) +Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id + r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.52 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 21 Aug 2023 06:51:54 -0700 (PDT) +From: Alper Nebi Yasak +To: u-boot@lists.denx.de +Cc: Kever Yang , + Jagan Teki , + Andre Przywara , + Svyatoslav Ryhel , Alexander Graf , + Philipp Tomsich , Andrew Davis , + Da Xue , Heinrich Schuchardt , + Patrice Chotard , + Patrick Delaunay , + Derald Woods , + Anatolij Gustschin , + uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , + Matthias Brugger , u-boot-amlogic@groups.io, + Ilias Apalodimas , + Neil Armstrong , + Alper Nebi Yasak +Subject: [PATCH v5 13/13] video: Enable VIDEO_DAMAGE for drivers that need it +Date: Mon, 21 Aug 2023 16:51:10 +0300 +Message-Id: <20230821135111.3558478-14-alpernebiyasak@gmail.com> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> +References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 + +From: Alexander Graf + +Some drivers call video_set_flush_dcache() to indicate that they want to +have the dcache flushed for the frame buffer. These drivers benefit from +our new video damage control, because we can reduce the amount of memory +that gets flushed significantly. + +This patch enables video damage control for all device drivers that call +video_set_flush_dcache() to make sure they benefit from it. + +Signed-off-by: Alexander Graf +[Alper: Add to VIDEO_TIDSS, imply instead of select] +Co-developed-by: Alper Nebi Yasak +Signed-off-by: Alper Nebi Yasak +--- + +Changes in v5: +- Imply VIDEO_DAMAGE for video drivers instead of selecting it +- Imply VIDEO_DAMAGE also for VIDEO_TIDSS + +Changes in v4: +- Add patch "video: Enable VIDEO_DAMAGE for drivers that need it" + + arch/arm/mach-omap2/omap3/Kconfig | 1 + + arch/arm/mach-sunxi/Kconfig | 1 + + drivers/video/Kconfig | 8 ++++++++ + drivers/video/exynos/Kconfig | 1 + + drivers/video/imx/Kconfig | 1 + + drivers/video/meson/Kconfig | 1 + + drivers/video/rockchip/Kconfig | 1 + + drivers/video/stm32/Kconfig | 1 + + drivers/video/tegra20/Kconfig | 1 + + drivers/video/tidss/Kconfig | 1 + + 10 files changed, 17 insertions(+) + +diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig +index 671e4791c67f..fd858f7b50f2 100644 +--- a/arch/arm/mach-omap2/omap3/Kconfig ++++ b/arch/arm/mach-omap2/omap3/Kconfig +@@ -113,6 +113,7 @@ config TARGET_NOKIA_RX51 + select CMDLINE_TAG + select INITRD_TAG + select REVISION_TAG ++ imply VIDEO_DAMAGE + + config TARGET_TAO3530 + bool "TAO3530" +diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig +index 9d5df2c10273..fb4478ea32e8 100644 +--- a/arch/arm/mach-sunxi/Kconfig ++++ b/arch/arm/mach-sunxi/Kconfig +@@ -813,6 +813,7 @@ config VIDEO_SUNXI + depends on !SUN50I_GEN_H6 + select VIDEO + select DISPLAY ++ imply VIDEO_DAMAGE + imply VIDEO_DT_SIMPLEFB + default y + ---help--- +diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig +index b3fbd9d7d9ca..185dbb1f8390 100644 +--- a/drivers/video/Kconfig ++++ b/drivers/video/Kconfig +@@ -499,6 +499,7 @@ config VIDEO_LCD_ANX9804 + + config ATMEL_LCD + bool "Atmel LCD panel support" ++ imply VIDEO_DAMAGE + depends on ARCH_AT91 + + config ATMEL_LCD_BGR555 +@@ -508,6 +509,7 @@ config ATMEL_LCD_BGR555 + + config VIDEO_BCM2835 + bool "Display support for BCM2835" ++ imply VIDEO_DAMAGE + help + The graphics processor already sets up the display so this driver + simply checks the resolution and then sets up the frame buffer with +@@ -654,6 +656,7 @@ source "drivers/video/meson/Kconfig" + + config VIDEO_MVEBU + bool "Armada XP LCD controller" ++ imply VIDEO_DAMAGE + ---help--- + Support for the LCD controller integrated in the Marvell + Armada XP SoC. +@@ -688,6 +691,7 @@ config NXP_TDA19988 + + config ATMEL_HLCD + bool "Enable ATMEL video support using HLCDC" ++ imply VIDEO_DAMAGE + help + HLCDC supports video output to an attached LCD panel. + +@@ -764,6 +768,7 @@ source "drivers/video/tidss/Kconfig" + + config VIDEO_TEGRA124 + bool "Enable video support on Tegra124" ++ imply VIDEO_DAMAGE + help + Tegra124 supports many video output options including eDP and + HDMI. At present only eDP is supported by U-Boot. This option +@@ -778,6 +783,7 @@ source "drivers/video/imx/Kconfig" + + config VIDEO_MXS + bool "Enable video support on i.MX28/i.MX6UL/i.MX7 SoCs" ++ imply VIDEO_DAMAGE + help + Enable framebuffer driver for i.MX28/i.MX6UL/i.MX7 processors + +@@ -840,6 +846,7 @@ config VIDEO_DW_MIPI_DSI + + config VIDEO_SIMPLE + bool "Simple display driver for preconfigured display" ++ imply VIDEO_DAMAGE + help + Enables a simple generic display driver which utilizes the + simple-framebuffer devicetree bindings. +@@ -858,6 +865,7 @@ config VIDEO_DT_SIMPLEFB + + config VIDEO_MCDE_SIMPLE + bool "Simple driver for ST-Ericsson MCDE with preconfigured display" ++ imply VIDEO_DAMAGE + help + Enables a simple display driver for ST-Ericsson MCDE + (Multichannel Display Engine), which reads the configuration from +diff --git a/drivers/video/exynos/Kconfig b/drivers/video/exynos/Kconfig +index 599d19d5ecc2..a2cf752aac03 100644 +--- a/drivers/video/exynos/Kconfig ++++ b/drivers/video/exynos/Kconfig +@@ -12,6 +12,7 @@ config EXYNOS_DP + + config EXYNOS_FB + bool "Exynos FIMD support" ++ imply VIDEO_DAMAGE + + config EXYNOS_MIPI_DSIM + bool "Exynos MIPI DSI support" +diff --git a/drivers/video/imx/Kconfig b/drivers/video/imx/Kconfig +index 34e8b640595b..5db3e5c0499e 100644 +--- a/drivers/video/imx/Kconfig ++++ b/drivers/video/imx/Kconfig +@@ -2,6 +2,7 @@ + config VIDEO_IPUV3 + bool "i.MX IPUv3 Core video support" + depends on VIDEO && (MX5 || MX6) ++ imply VIDEO_DAMAGE + help + This enables framebuffer driver for i.MX processors working + on the IPUv3(Image Processing Unit) internal graphic processor. +diff --git a/drivers/video/meson/Kconfig b/drivers/video/meson/Kconfig +index 3c2d72d019b8..fcf486ca0a3a 100644 +--- a/drivers/video/meson/Kconfig ++++ b/drivers/video/meson/Kconfig +@@ -8,5 +8,6 @@ config VIDEO_MESON + bool "Enable Amlogic Meson video support" + depends on VIDEO + select DISPLAY ++ imply VIDEO_DAMAGE + help + Enable Amlogic Meson Video Processing Unit video support. +diff --git a/drivers/video/rockchip/Kconfig b/drivers/video/rockchip/Kconfig +index 01804dcb1cc8..0f4550a29e38 100644 +--- a/drivers/video/rockchip/Kconfig ++++ b/drivers/video/rockchip/Kconfig +@@ -11,6 +11,7 @@ + menuconfig VIDEO_ROCKCHIP + bool "Enable Rockchip Video Support" + depends on VIDEO ++ imply VIDEO_DAMAGE + help + Rockchip SoCs provide video output capabilities for High-Definition + Multimedia Interface (HDMI), Low-voltage Differential Signalling +diff --git a/drivers/video/stm32/Kconfig b/drivers/video/stm32/Kconfig +index 48066063e4c5..c354c402c288 100644 +--- a/drivers/video/stm32/Kconfig ++++ b/drivers/video/stm32/Kconfig +@@ -8,6 +8,7 @@ + menuconfig VIDEO_STM32 + bool "Enable STM32 video support" + depends on VIDEO ++ imply VIDEO_DAMAGE + help + STM32 supports many video output options including RGB and + DSI. This option enables these supports which can be used on +diff --git a/drivers/video/tegra20/Kconfig b/drivers/video/tegra20/Kconfig +index f5c4843e1191..2232b0b3ff53 100644 +--- a/drivers/video/tegra20/Kconfig ++++ b/drivers/video/tegra20/Kconfig +@@ -1,6 +1,7 @@ + config VIDEO_TEGRA20 + bool "Enable Display Controller support on Tegra20 and Tegra 30" + depends on OF_CONTROL ++ imply VIDEO_DAMAGE + help + T20/T30 support video output to an attached LCD panel as well as + other options such as HDMI. Only the LCD is supported in U-Boot. +diff --git a/drivers/video/tidss/Kconfig b/drivers/video/tidss/Kconfig +index 95086f3a5d66..3291b3ceb8d5 100644 +--- a/drivers/video/tidss/Kconfig ++++ b/drivers/video/tidss/Kconfig +@@ -11,6 +11,7 @@ + menuconfig VIDEO_TIDSS + bool "Enable TIDSS video support" + depends on VIDEO ++ imply VIDEO_DAMAGE + help + TIDSS supports video output options LVDS and + DPI . This option enables these supports which can be used on diff --git a/uboot-tools.spec b/uboot-tools.spec index bd19b50..ede4905 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.10 -Release: 0.2%{?candidate:.%{candidate}}%{?dist} +Release: 0.3%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -22,15 +22,16 @@ Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch Patch2: smbios-Simplify-reporting-of-unknown-values.patch Patch3: disable-VBE-by-default.patch Patch4: enable-bootmenu-by-default.patch +Patch5: Add-video-damage-tracking.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support -Patch5: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch +Patch10: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements -Patch6: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch -Patch7: rock64-small-fixes.patch -#Patch7: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch -Patch8: rpi-Convert-to-standard-boot.patch +Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch +Patch12: rock64-small-fixes.patch +#Patch12: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch +Patch13: rpi-Convert-to-standard-boot.patch BuildRequires: bc BuildRequires: bison @@ -215,6 +216,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Mon Aug 21 2023 Peter Robinson - 2023.10-0.3.rc2 +- Add patch to speed up firmware UEFI video output + * Sat Aug 19 2023 Peter Robinson - 2023.10-0.2.rc2 - Add patch for Raspberry Pi boot From 4798befe9560325fc14d29a3a1d800404ea3c4ea Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 21 Aug 2023 22:05:15 +0100 Subject: [PATCH 013/128] 2023.10 RC3 --- rock64-small-fixes.patch | 476 --------------------------------------- sources | 2 +- uboot-tools.spec | 8 +- 3 files changed, 6 insertions(+), 480 deletions(-) delete mode 100644 rock64-small-fixes.patch diff --git a/rock64-small-fixes.patch b/rock64-small-fixes.patch deleted file mode 100644 index 5ea77fb..0000000 --- a/rock64-small-fixes.patch +++ /dev/null @@ -1,476 +0,0 @@ -From patchwork Wed Jun 14 12:43:12 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Peter Robinson -X-Patchwork-Id: 1794950 -X-Patchwork-Delegate: ykai007@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=FZFn9vAY; - 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 ECDSA (P-384)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qh4qN0nXtz20WR - for ; Wed, 14 Jun 2023 22:44:00 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id E188F86167; - Wed, 14 Jun 2023 14:43:40 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="FZFn9vAY"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 4CE61860AA; Wed, 14 Jun 2023 14:43:37 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no - version=3.4.2 -Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com - [IPv6:2a00:1450:4864:20::133]) - (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 BEECA860C3 - for ; Wed, 14 Jun 2023 14:43:34 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=pbrobinson@gmail.com -Received: by mail-lf1-x133.google.com with SMTP id - 2adb3069b0e04-4f642a24568so8546568e87.2 - for ; Wed, 14 Jun 2023 05:43:34 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1686746614; x=1689338614; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=sjzdpxK2W2UaYKf4Dbb6vo2R4h51tHoSQv2PLAL+ytA=; - b=FZFn9vAYzx95g5Cma3VU7TW3RzrwGrr2DTEZogYSk3tr58CXaHbRCJAD8suFJLbB18 - 4Uh25vZecFfXajC8z3+nGc/G+yLjO4p+uHq9laCmR1d/OjJadseCHzdHF2vgrMFi4x3U - c2A7F/JYazfKq/1McGMyMsI899Ot9xB8lffElanhTShEGmUwMjSzvalWbJA9ZUkisJvX - 1lfsoPk+26gamlPG4QftIFmXpxUf5pcRqA7pSzgOWyGcPSb8e5HBvcMnMTlNaRSNcjKs - k+TnZww3gSKjD+VxWck1VwgeEK8X4cPgV6HyI4TSSnjWSn2qjy6YW8eJWS4K/h+48RWn - 5VKA== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1686746614; x=1689338614; - 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=sjzdpxK2W2UaYKf4Dbb6vo2R4h51tHoSQv2PLAL+ytA=; - b=TIUdzRnLC89Ao7oVBZZH1iJgNXJg4bFp54s574ftCbOZSDxA49ZHH8ULPGzHpCG0ze - ffGZYszi+DbRLFr92kxE5wgmGjiMapn8MfDaNs5tFm31rBk7QeHIwNH2WwHmmERtGSfi - NbA6vIBYmQFUgdc2GxAfmwQkmyEqnlZUwxz43Goz6W7OnoYofitm9fM2P5JAjVEC9B4g - 3zqxZDCIEJmgTHUpPWgqM1QwJtQA9trNTMJESxsTocqABFS+cCPJCj9HitbWYe3TNGeG - JT6Ma3umJF+whshi0h/4csqV5wCXy5FHEC0nx/p88Tq+o/zCveJu1f16B8PQ3baaIw6n - Bj3Q== -X-Gm-Message-State: AC+VfDwm3GSwcQOMRo9W3rdlJIQd8KXeHulIsQkeI3v53WVLSbA4UQji - Er6vsMhWXQhyhjlcr1WdCnc= -X-Google-Smtp-Source: - ACHHUZ6pFh8GXXZTuMA7izeqjUHeS1gbvk8BisDz2HsWH0v5R9/HJDxhuCGwt4wFH7TA2hi2Y/haJg== -X-Received: by 2002:a19:4359:0:b0:4f3:b4a9:a619 with SMTP id - m25-20020a194359000000b004f3b4a9a619mr7072659lfj.40.1686746613623; - Wed, 14 Jun 2023 05:43:33 -0700 (PDT) -Received: from morpheus.home.roving-it.com - (3.e.2.0.0.0.0.0.0.0.0.0.0.0.0.0.1.8.6.2.1.1.b.f.0.b.8.0.1.0.0.2.ip6.arpa. - [2001:8b0:fb11:2681::2e3]) by smtp.googlemail.com with ESMTPSA id - g26-20020a7bc4da000000b003f60e143d38sm17329161wmk.11.2023.06.14.05.43.33 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 14 Jun 2023 05:43:33 -0700 (PDT) -From: Peter Robinson -To: "Matwey V. Kornilov" , - Simon Glass , Philipp Tomsich , - Kever Yang , u-boot@lists.denx.de -Cc: Peter Robinson -Subject: [PATCH 2/4] config: rock64: enable efuse for stable mac addr -Date: Wed, 14 Jun 2023 13:43:12 +0100 -Message-ID: <20230614124329.244462-2-pbrobinson@gmail.com> -X-Mailer: git-send-email 2.41.0 -In-Reply-To: <20230614124329.244462-1-pbrobinson@gmail.com> -References: <20230614124329.244462-1-pbrobinson@gmail.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 - -Enable the rockchip efuse driver on the Rock64 to -provide a stable ethernet address on the device. - -Signed-off-by: Peter Robinson -Reviewed-by: Kever Yang ---- - -While the rockchip efuse driver currently has issues on rk3328 due to, I believe, it -not being properly initialised in ATF, enabling it at least provides a stable MAC -adress on the NIC which I think makes it worthwhile - - configs/rock64-rk3328_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig -index 1da9b0545a5..97ac8734d1b 100644 ---- a/configs/rock64-rk3328_defconfig -+++ b/configs/rock64-rk3328_defconfig -@@ -74,6 +74,7 @@ CONFIG_FASTBOOT_CMD_OEM_FORMAT=y - CONFIG_ROCKCHIP_GPIO=y - CONFIG_SYS_I2C_ROCKCHIP=y - CONFIG_MISC=y -+CONFIG_ROCKCHIP_EFUSE=y - CONFIG_MMC_DW=y - CONFIG_MMC_DW_ROCKCHIP=y - CONFIG_SPI_FLASH_GIGADEVICE=y - -From patchwork Wed Jun 14 12:43:13 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Peter Robinson -X-Patchwork-Id: 1794951 -X-Patchwork-Delegate: ykai007@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=WIV1zbyE; - 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 ECDSA (P-384)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qh4qf6BLXz20WR - for ; Wed, 14 Jun 2023 22:44:14 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 5B12B86146; - Wed, 14 Jun 2023 14:43:44 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="WIV1zbyE"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 5200686146; Wed, 14 Jun 2023 14:43:39 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no - version=3.4.2 -Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com - [IPv6:2a00:1450:4864:20::336]) - (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 0F3CC860FE - for ; Wed, 14 Jun 2023 14:43:35 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=pbrobinson@gmail.com -Received: by mail-wm1-x336.google.com with SMTP id - 5b1f17b1804b1-3f8c74af64fso5587725e9.1 - for ; Wed, 14 Jun 2023 05:43:35 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1686746614; x=1689338614; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=Jne9SqWnJdgDpj5mkPbP6jWrorHm2Ewr8ivuyd1zKBQ=; - b=WIV1zbyEf76/AZV4av4Ab6kytOWNx4Cgr8LFRAVy0DIDj6GKOPyPg7yVsSUOtkkQPR - 4plpstbCTo2xN/epjgrDc70Y2XNal4Y8c8EZIDkfSPn7mVN3vBZscIpajCVK9oMY006G - hQ/3lRYirYKtJbAOt5oRXWqGqXdlrfXMqhDA9dRla5l3J1Px77QZiE7/czqNeryTcrSC - nQJKPLOKXZZwzI7Dcv4QtfBMI2zpkStKYCHynOnD96H1Fm/CRfc4RmKiW3UgJVfCn5eC - 5QHH+onIEDk91Izuk4qry+RAGnMwqv7WthL3hMJY2+gMuJiGbTyNsQZ2VAoD1qgVHXY9 - p/mg== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1686746614; x=1689338614; - 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=Jne9SqWnJdgDpj5mkPbP6jWrorHm2Ewr8ivuyd1zKBQ=; - b=bPn3UB+Nr7fgBm9Vrhg5MVBNiRLiVAR6TPvKWbUGhJ4kytAVtZPyUZrO2FJgbWkSay - uQG5vH7K+ytlJdki06QVI8h99N241iYpSqqA2GjEMWCkes4ATEyMuC112uBb66PpjHJR - 44wpSYTUdxyNSVbtOC5svYFBrcOtrWn3XptxoCrPswBAXXMloirTxyh3TqUOond2NNDc - 7cgEcz1aIYnW2s9BPIZSuCrTO491tBU3Rcd1ubL+7gbMX/Z4hG0fgUdPU6pf4oxQNZ78 - kYue8TdOqV/ksCbzxgMFPXPrwmAVAuodAoaRpDH449SvEr9TNT+k1SJEve21VwZCyZAN - k/3w== -X-Gm-Message-State: AC+VfDz+euUQ/kYf5v84y5arXPpq6LOLBmbUqMFIVVB7/TmpcGsagHMr - v64fxEF0CGVXk4pqvA+7upE= -X-Google-Smtp-Source: - ACHHUZ47g7ktmMWUGnTvkK4deYzNa9InQuYnEmy91+AuY7+Avu9rVE/HmGTqh7XE7FzZF8tB2Wscww== -X-Received: by 2002:a05:600c:364f:b0:3f6:c8c:7048 with SMTP id - y15-20020a05600c364f00b003f60c8c7048mr10715141wmq.20.1686746614238; - Wed, 14 Jun 2023 05:43:34 -0700 (PDT) -Received: from morpheus.home.roving-it.com - (3.e.2.0.0.0.0.0.0.0.0.0.0.0.0.0.1.8.6.2.1.1.b.f.0.b.8.0.1.0.0.2.ip6.arpa. - [2001:8b0:fb11:2681::2e3]) by smtp.googlemail.com with ESMTPSA id - g26-20020a7bc4da000000b003f60e143d38sm17329161wmk.11.2023.06.14.05.43.33 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 14 Jun 2023 05:43:33 -0700 (PDT) -From: Peter Robinson -To: "Matwey V. Kornilov" , - Simon Glass , Philipp Tomsich , - Kever Yang , u-boot@lists.denx.de -Cc: Peter Robinson -Subject: [PATCH 3/4] rockchip: dts: rk3328: Add rng details to u-boot.dtsi -Date: Wed, 14 Jun 2023 13:43:13 +0100 -Message-ID: <20230614124329.244462-3-pbrobinson@gmail.com> -X-Mailer: git-send-email 2.41.0 -In-Reply-To: <20230614124329.244462-1-pbrobinson@gmail.com> -References: <20230614124329.244462-1-pbrobinson@gmail.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 the rk3328 rng details to the u-boot.dtsi and -enable the RNG on the Rock64 to be able to provide -a rnadom seed via UEFI. - -Signed-off-by: Peter Robinson ---- - -The DT snippet will allow this to be enabled on other rk3328 devices but -I only have the Rock54 to test on. - - arch/arm/dts/rk3328-u-boot.dtsi | 6 ++++++ - configs/rock64-rk3328_defconfig | 2 ++ - 2 files changed, 8 insertions(+) - -diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi -index ce96ce40a73..a9f2536de2a 100644 ---- a/arch/arm/dts/rk3328-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-u-boot.dtsi -@@ -26,6 +26,12 @@ - 0x0 0xff720000 0x0 0x1000 - 0x0 0xff798000 0x0 0x1000>; - }; -+ -+ rng: rng@ff060000 { -+ compatible = "rockchip,cryptov1-rng"; -+ reg = <0x0 0xff060000 0x0 0x4000>; -+ status = "okay"; -+ }; - }; - - &cru { -diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig -index 97ac8734d1b..1820deee373 100644 ---- a/configs/rock64-rk3328_defconfig -+++ b/configs/rock64-rk3328_defconfig -@@ -77,6 +77,8 @@ CONFIG_MISC=y - CONFIG_ROCKCHIP_EFUSE=y - CONFIG_MMC_DW=y - CONFIG_MMC_DW_ROCKCHIP=y -+CONFIG_DM_RNG=y -+CONFIG_RNG_ROCKCHIP=y - CONFIG_SPI_FLASH_GIGADEVICE=y - CONFIG_ETH_DESIGNWARE=y - CONFIG_GMAC_ROCKCHIP=y - -From patchwork Wed Jun 14 12:43:14 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Peter Robinson -X-Patchwork-Id: 1794952 -X-Patchwork-Delegate: ykai007@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=Fk8Gn/bp; - 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 ECDSA (P-384) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4Qh4qx1cDFz20WR - for ; Wed, 14 Jun 2023 22:44:29 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 42BE586140; - Wed, 14 Jun 2023 14:43:47 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="Fk8Gn/bp"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 5363386119; Wed, 14 Jun 2023 14:43:40 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no - version=3.4.2 -Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com - [IPv6:2a00:1450:4864:20::432]) - (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 92EA186130 - for ; Wed, 14 Jun 2023 14:43:35 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=pbrobinson@gmail.com -Received: by mail-wr1-x432.google.com with SMTP id - ffacd0b85a97d-31110aea814so555f8f.2 - for ; Wed, 14 Jun 2023 05:43:35 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1686746615; x=1689338615; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=GunsDF8pMC87eoXzdmDNRZz8DMTMTGTC8JJJKs0JxI4=; - b=Fk8Gn/bpnLP7olTGYnvDxvwbEfNNa1rl1mPZ4QelJXPFqGN4+shTjFbREgSRC/dMtW - yRez1jgUlJRK7lz8uY+O+exV8NdCbcHbzvdQtHDCDnQqLKjgIPVMjLyH5VIJECxjXc8/ - FuocNJXIdjBBfLC1msErM2xm850WcNYbIZ+hPDOwpMTYitpqvM3xhwL6vIJlsBw6BqaC - C5MKw4jWH3KCYzU6kqLsP3reuse4YwOUK8BoRfC130ebJzm2MhRdj1xfOvTMNGNNKO9b - Ii5zq3BB7VZqdM3vFNWva7lFwc6nzvSx026CBWC04UbxKmp2qd8WgU/GHTgnV8lcL/sz - 5uBQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1686746615; x=1689338615; - 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=GunsDF8pMC87eoXzdmDNRZz8DMTMTGTC8JJJKs0JxI4=; - b=ZU+X/vMacHAmhpPxEEwUnlvwe6qSQQDPnUVljh0mCFS+0MlJyOgFlaJdQKr4qZ9028 - 5HU/u7kr7mvPN4LvU1sVBZ4QlyI8rrgzMl576uvBb3rZ8AQ5aQJCvUrYOPUilPyNbhWq - lDMZCjWuHeKLpwutkyLveGg0yVgYz8i4STe35fH7B3q60K/v+y9G8wFJUdN+XV8c2+Gx - MTSE42FF8tOnHkXPIFXmh4LKO5BQWAHQuYadILsFo2pUahMfroOaCT2xVQzDmC+Ur76L - Bw1TPPC/b69/qHFZwuG0/5e6ansfMs1oO6DCGOIMxLzJch7c6VC/WJql/xOnO/c4os12 - swLw== -X-Gm-Message-State: AC+VfDy9BKAtjnGx6ud2kU6GAYtOOxIFuTpeAhT+l9wtZ+C3zpK6T+ld - CD+kjgM7Fs3oCfEFfoOLmJE= -X-Google-Smtp-Source: - ACHHUZ6WCesQBbBQ0kQoCj860p1GMKM0o6UKw7uiH/CWAXkwqPWFIEw+YhmaoR6ynnvAzLDQ3IbsCw== -X-Received: by 2002:adf:fec4:0:b0:30f:ce9a:7632 with SMTP id - q4-20020adffec4000000b0030fce9a7632mr3527925wrs.67.1686746614858; - Wed, 14 Jun 2023 05:43:34 -0700 (PDT) -Received: from morpheus.home.roving-it.com - (3.e.2.0.0.0.0.0.0.0.0.0.0.0.0.0.1.8.6.2.1.1.b.f.0.b.8.0.1.0.0.2.ip6.arpa. - [2001:8b0:fb11:2681::2e3]) by smtp.googlemail.com with ESMTPSA id - g26-20020a7bc4da000000b003f60e143d38sm17329161wmk.11.2023.06.14.05.43.34 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 14 Jun 2023 05:43:34 -0700 (PDT) -From: Peter Robinson -To: "Matwey V. Kornilov" , - Simon Glass , Philipp Tomsich , - Kever Yang , u-boot@lists.denx.de -Cc: Peter Robinson -Subject: [PATCH 4/4] rockchip: dts: rk3328: rock64: Align spi flash entry -Date: Wed, 14 Jun 2023 13:43:14 +0100 -Message-ID: <20230614124329.244462-4-pbrobinson@gmail.com> -X-Mailer: git-send-email 2.41.0 -In-Reply-To: <20230614124329.244462-1-pbrobinson@gmail.com> -References: <20230614124329.244462-1-pbrobinson@gmail.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 - -Align the SPI flash entry with upstream. There's no need -to diverge here. - -Signed-off-by: Peter Robinson -Reviewed-by: Kever Yang ---- - arch/arm/dts/rk3328-rock64-u-boot.dtsi | 2 +- - arch/arm/dts/rk3328-rock64.dts | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/arch/arm/dts/rk3328-rock64-u-boot.dtsi b/arch/arm/dts/rk3328-rock64-u-boot.dtsi -index 849854302ee..6904515b969 100644 ---- a/arch/arm/dts/rk3328-rock64-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-rock64-u-boot.dtsi -@@ -54,7 +54,7 @@ - }; - - &spi0 { -- spi_flash: spiflash@0 { -+ spi_flash: flash@0 { - bootph-all; - }; - }; -diff --git a/arch/arm/dts/rk3328-rock64.dts b/arch/arm/dts/rk3328-rock64.dts -index 1b0f7e4551e..f69a38f42d2 100644 ---- a/arch/arm/dts/rk3328-rock64.dts -+++ b/arch/arm/dts/rk3328-rock64.dts -@@ -345,7 +345,7 @@ - &spi0 { - status = "okay"; - -- spiflash@0 { -+ flash@0 { - compatible = "jedec,spi-nor"; - reg = <0>; - diff --git a/sources b/sources index 1504d9e..0fa4df0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.10-rc2.tar.bz2) = cc3cd85c84e1d7d8e45244f330709ad5ecf918ee42aac4de565ca5e1e1cde25e89b1a8672aaac04c0bf830e36192a72caabfde3baf6633c68fa76103768be201 +SHA512 (u-boot-2023.10-rc3.tar.bz2) = 920190c47faca085c44fbd747669379f47461e3a3de5041e6a0d28d073116f1b18b0711876fb3c49eacd130e6fd2aa9d5ec84cb5fe0b2f7617b2438804317e81 diff --git a/uboot-tools.spec b/uboot-tools.spec index ede4905..478b255 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc2 +%global candidate rc3 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.10 -Release: 0.3%{?candidate:.%{candidate}}%{?dist} +Release: 0.4%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -29,7 +29,6 @@ Patch5: Add-video-damage-tracking.patch Patch10: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch -Patch12: rock64-small-fixes.patch #Patch12: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch Patch13: rpi-Convert-to-standard-boot.patch @@ -216,6 +215,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Mon Aug 21 2023 Peter Robinson - 2023.10-0.4.rc3 +- Update to 2023.10 RC3 + * Mon Aug 21 2023 Peter Robinson - 2023.10-0.3.rc2 - Add patch to speed up firmware UEFI video output From 6cd0d073d6dd336a82d1b646c7f80f6982c7a37e Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 21 Oct 2023 10:16:31 +0100 Subject: [PATCH 014/128] 2023.10, initial pass at DT detection fix --- Add-video-damage-tracking.patch | 13 - aarch64-boards | 2 - ...all-bootdevs-in-a-boot_targets-entry.patch | 213 +++++ rpi-Convert-to-standard-boot.patch | 892 ------------------ sources | 2 +- uboot-tools.spec | 14 +- ...atic-management-for-removable-medias.patch | 550 +++++++++++ 7 files changed, 772 insertions(+), 914 deletions(-) create mode 100644 bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch delete mode 100644 rpi-Convert-to-standard-boot.patch create mode 100644 uefi-Boot-var-automatic-management-for-removable-medias.patch diff --git a/Add-video-damage-tracking.patch b/Add-video-damage-tracking.patch index 3cfd387..5e78df8 100644 --- a/Add-video-damage-tracking.patch +++ b/Add-video-damage-tracking.patch @@ -3947,7 +3947,6 @@ Changes in v5: Changes in v4: - Add patch "video: Enable VIDEO_DAMAGE for drivers that need it" - arch/arm/mach-omap2/omap3/Kconfig | 1 + arch/arm/mach-sunxi/Kconfig | 1 + drivers/video/Kconfig | 8 ++++++++ drivers/video/exynos/Kconfig | 1 + @@ -3959,18 +3958,6 @@ Changes in v4: drivers/video/tidss/Kconfig | 1 + 10 files changed, 17 insertions(+) -diff --git a/arch/arm/mach-omap2/omap3/Kconfig b/arch/arm/mach-omap2/omap3/Kconfig -index 671e4791c67f..fd858f7b50f2 100644 ---- a/arch/arm/mach-omap2/omap3/Kconfig -+++ b/arch/arm/mach-omap2/omap3/Kconfig -@@ -113,6 +113,7 @@ config TARGET_NOKIA_RX51 - select CMDLINE_TAG - select INITRD_TAG - select REVISION_TAG -+ imply VIDEO_DAMAGE - - config TARGET_TAO3530 - bool "TAO3530" diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 9d5df2c10273..fb4478ea32e8 100644 --- a/arch/arm/mach-sunxi/Kconfig diff --git a/aarch64-boards b/aarch64-boards index 63adc19..ac90276 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -76,8 +76,6 @@ rock-pi-n10-rk3399pro rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399 -rpi_3 -rpi_4 rpi_arm64 sopine_baseboard starqltechn diff --git a/bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch b/bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch new file mode 100644 index 0000000..8ab2759 --- /dev/null +++ b/bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch @@ -0,0 +1,213 @@ +From patchwork Sat Sep 23 20:50:15 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Simon Glass +X-Patchwork-Id: 1838641 +X-Patchwork-Delegate: sjg@chromium.org +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 + header.s=google header.b=KG3aXwv5; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4RtLr82vCNz1ynH + for ; Sun, 24 Sep 2023 06:50:30 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id C5750868D8; + Sat, 23 Sep 2023 22:50:24 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +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=chromium.org header.i=@chromium.org + header.b="KG3aXwv5"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id E66458698D; Sat, 23 Sep 2023 22:50:23 +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 mail-io1-xd35.google.com (mail-io1-xd35.google.com + [IPv6:2607:f8b0:4864:20::d35]) + (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 739828684C + for ; Sat, 23 Sep 2023 22:50:21 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sjg@chromium.org +Received: by mail-io1-xd35.google.com with SMTP id + ca18e2360f4ac-79fa4ff8220so82788439f.3 + for ; Sat, 23 Sep 2023 13:50:21 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=chromium.org; s=google; t=1695502220; x=1696107020; darn=lists.denx.de; + h=content-transfer-encoding:mime-version:message-id:date:subject:cc + :to:from:from:to:cc:subject:date:message-id:reply-to; + bh=fcy5WkVBoc7uoRrzJTdjAvllGuUSUwfIiQ5P7MPqanU=; + b=KG3aXwv5HvtWYkt2G7n3DcwAsa2xdEa6uyrBRWhucS+3OUN5eZ79edhY+dVDuwuEAL + I/Ci/8cflRdX1s9cv7mPYw2tXHkWnudM3Jwyw+72113wGGZG+e1q9i0wvb+MmxxK4lDM + ApdxnzfJunDfWMC4zu0PhcdG39ZcuC82Ezgcc= +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1695502220; x=1696107020; + h=content-transfer-encoding:mime-version:message-id:date:subject:cc + :to:from:x-gm-message-state:from:to:cc:subject:date:message-id + :reply-to; + bh=fcy5WkVBoc7uoRrzJTdjAvllGuUSUwfIiQ5P7MPqanU=; + b=UNAm2llXUYdkTNewaIJpX2/kKkDsigJYBX1Ch147g7NChNygnu0Glr6Ya3Cw6WpHIG + OzXCeyakwC/pjiea0NTxHVU01HvJOlAiZwBZoQMMnavjUuSAdMqDCSLIndWzRhOARHfS + ksVozUDoXyyT/gV0XsaczFQgdgBImzMU7OR4NRnNalhSl2iZqYqt/TJ3Ftciv0KfxrcB + CrNKVLlJySDCY+svy4oHY0uID6SHsIAGjKBEAE1x9VhZ1jtpTJE4Zzrqa4nrrt+oEgus + A44BAwUrpks5SSMYfllyvb2A/OavxCiknMLIS7ENPr4izxS2EvAZcqH0KhFUUzD5aDXf + XmKg== +X-Gm-Message-State: AOJu0YwjY6Rk6HbA8DutFJQwzzA4q1TI/KwnuD1ZteWezSPjeMGyx26P + qvXFutS0QtYRlcVbGETlNS4BhMXg2YyAsItRSoI= +X-Google-Smtp-Source: + AGHT+IE/HwkByEI0cMcKWYghOMoUVXCzjV4a68DB17kNo1TCDUCCFa07idjIRi4hzVA51WQbE/JX/w== +X-Received: by 2002:a05:6e02:19cd:b0:34f:f5a4:3e68 with SMTP id + r13-20020a056e0219cd00b0034ff5a43e68mr4812478ill.30.1695502219881; + Sat, 23 Sep 2023 13:50:19 -0700 (PDT) +Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. + [73.14.173.85]) by smtp.gmail.com with ESMTPSA id + i8-20020a056e020ec800b0034fda29890asm691408ilk.10.2023.09.23.13.50.19 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Sat, 23 Sep 2023 13:50:19 -0700 (PDT) +From: Simon Glass +To: U-Boot Mailing List +Cc: Date Huang , Tom Rini , + =?utf-8?q?Vincent_Stehl=C3=A9?= , + Simon Glass +Subject: [PATCH] bootstd: Scan all bootdevs in a boot_targets entry +Date: Sat, 23 Sep 2023 14:50:15 -0600 +Message-ID: <20230923205017.1754340-1-sjg@chromium.org> +X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog +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 + +When the boot_targets environment variable is used with the distro-boot +scripts, each device is included individually. For example, if there +are three mmc devices, then we will have something like: + + boot_targets="mmc0 mmc1 mmc2" + +In contrast, standard boot supports specifying just the uclass, i.e.: + + boot_targets="mmc" + +The intention is that this should scan all MMC devices, but in fact it +currently only scans the first. + +Update the logic to handle this case, without required BOOTSTD_FULL to +be enabled. + +I believe at least three people reported this, but I found two. + +Signed-off-by: Simon Glass +Reported-by: Date Huang +Reported-by: Vincent Stehlé +--- + + boot/bootdev-uclass.c | 3 ++- + boot/bootflow.c | 21 +++++++++++++++++++-- + test/boot/bootdev.c | 10 ++++++++++ + 3 files changed, 31 insertions(+), 3 deletions(-) + +diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c +index fa52bc3a9c4e..5a60cf223c79 100644 +--- a/boot/bootdev-uclass.c ++++ b/boot/bootdev-uclass.c +@@ -460,10 +460,11 @@ int bootdev_find_by_label(const char *label, struct udevice **devp, + * if no sequence number was provided, we must scan all + * bootdevs for this media uclass + */ +- if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && seq == -1) ++ if (seq == -1) + method_flags |= BOOTFLOW_METHF_SINGLE_UCLASS; + if (method_flagsp) + *method_flagsp = method_flags; ++ log_debug("method flags %x\n", method_flags); + return 0; + } + log_debug("- no device in %s\n", media->name); +diff --git a/boot/bootflow.c b/boot/bootflow.c +index 81b5829d5b37..74abf3e17d7e 100644 +--- a/boot/bootflow.c ++++ b/boot/bootflow.c +@@ -260,8 +260,25 @@ static int iter_incr(struct bootflow_iter *iter) + } else { + log_debug("labels %p\n", iter->labels); + if (iter->labels) { +- ret = bootdev_next_label(iter, &dev, +- &method_flags); ++ /* ++ * when the label is "mmc" we want to scan all ++ * mmc bootdevs, not just the first. See ++ * bootdev_find_by_label() where this flag is ++ * set up ++ */ ++ if (iter->method_flags & BOOTFLOW_METHF_SINGLE_UCLASS) { ++ uclass_next_device(&dev); ++ log_debug("looking for next device %s: %s\n", ++ iter->dev->name, ++ dev ? dev->name : ""); ++ } else { ++ dev = NULL; ++ } ++ if (!dev) { ++ log_debug("looking at next label\n"); ++ ret = bootdev_next_label(iter, &dev, ++ &method_flags); ++ } + } else { + ret = bootdev_next_prio(iter, &dev); + method_flags = 0; +diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c +index 6b29213416db..c5f14a7a1323 100644 +--- a/test/boot/bootdev.c ++++ b/test/boot/bootdev.c +@@ -221,6 +221,16 @@ static int bootdev_test_order(struct unit_test_state *uts) + ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); + bootflow_iter_uninit(&iter); + ++ /* Make sure it scans a bootdevs in each target */ ++ ut_assertok(env_set("boot_targets", "mmc spi")); ++ ut_asserteq(0, bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); ++ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ++ ut_asserteq(3, iter.num_devs); ++ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); ++ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); ++ bootflow_iter_uninit(&iter); ++ + return 0; + } + BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); diff --git a/rpi-Convert-to-standard-boot.patch b/rpi-Convert-to-standard-boot.patch deleted file mode 100644 index de02728..0000000 --- a/rpi-Convert-to-standard-boot.patch +++ /dev/null @@ -1,892 +0,0 @@ -From patchwork Thu Jul 27 21:54:28 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Simon Glass -X-Patchwork-Id: 1813968 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 - header.s=google header.b=N1JBl/Ip; - 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 ECDSA (P-384)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4RBl1V3MSFz1yZb - for ; Fri, 28 Jul 2023 07:55:10 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 29D6686883; - Thu, 27 Jul 2023 23:54:50 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -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=chromium.org header.i=@chromium.org - header.b="N1JBl/Ip"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id BFC74863EE; Thu, 27 Jul 2023 23:54:44 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no - version=3.4.2 -Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com - [IPv6:2607:f8b0:4864:20::12d]) - (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 A9CE3867A8 - for ; Thu, 27 Jul 2023 23:54:41 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sjg@chromium.org -Received: by mail-il1-x12d.google.com with SMTP id - e9e14a558f8ab-3466725f0beso6233385ab.1 - for ; Thu, 27 Jul 2023 14:54:41 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=chromium.org; s=google; t=1690494880; x=1691099680; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=PfW4qtLSfZ+bnC9lQwrjMDVmboUSfVp8v4ohkW8rjNg=; - b=N1JBl/IpuUO0bR2jxCF4K6S6GW+xv1r7HlydRFhGC+Y0jR6zVXjPOQITlZBrwEARlk - THRvjpw5qRIedk0NNo/pQCKKQqruScbjKPYX1OBI4dK8j/HkC/GExnZkrzqJlvtCNqRi - vd32bzFnA0G7Sw/tWm/fMJuxGDvemFLzoLQgg= -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1690494880; x=1691099680; - 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=PfW4qtLSfZ+bnC9lQwrjMDVmboUSfVp8v4ohkW8rjNg=; - b=htLAMKMTT/T5aB5rrz1DwCj312u/yXPKNVhy1hUQl0xUxGmuV261y4snpFJIp92LWY - bPTp84aFfLtyyJhH6BRikYrtWYDX1XpPE35ADFLtlQMM5GIU9q0hkifkPd7abPqf9CjN - 34tE1/jfbEQ9DVjGSSH+XObnLtGLjO2UX0/c9ws1veWcDD9e9lre0Tr0FdMyy+r4RdCC - V39BVGSWBW9Mr3+y6MVHLCblg21I+/bjRp2nviWmZbeJhx4cKepnzFGfm5KjWnIujj0D - Y86K9+ZBDN2NRnIyfK6oPrQqLMSObWKrzxurO93MsbUXmBc8FJqZwyN2XUixqo8t6Kso - pNvg== -X-Gm-Message-State: ABy/qLb0K45Zq6AUJT2FpWarTb3YBaFoeytG1lXRxYdhcArX6FKSUhG7 - DkuKoL8etDw0hNEDFIyMz2KF4qEO37wmml3Qc3M= -X-Google-Smtp-Source: - APBJJlG54VUHOmyZVhkSmMpIiz5S/hblBzg2zwJFl+9fxJRZJWQN2zHspMrpRxc36G3YPyvYcXHJ4A== -X-Received: by 2002:a05:6e02:1ba5:b0:347:6f47:bb2 with SMTP id - n5-20020a056e021ba500b003476f470bb2mr889940ili.19.1690494880268; - Thu, 27 Jul 2023 14:54:40 -0700 (PDT) -Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) - by smtp.gmail.com with ESMTPSA id - n28-20020a02cc1c000000b00430245071ddsm679215jap.176.2023.07.27.14.54.39 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Thu, 27 Jul 2023 14:54:40 -0700 (PDT) -From: Simon Glass -To: U-Boot Mailing List -Cc: Tom Rini , Peter Robinson , - Simon Glass , Albert Aribaud , - Matthias Brugger , Stephen Warren , - Stephen Warren -Subject: [RESEND PATCH v3 1/3] arm: rpi: Switch to standard boot -Date: Thu, 27 Jul 2023 15:54:28 -0600 -Message-ID: <20230727215433.578830-2-sjg@chromium.org> -X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog -In-Reply-To: <20230727215433.578830-1-sjg@chromium.org> -References: <20230727215433.578830-1-sjg@chromium.org> -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 - -Drop use of the distro scripts and use standard boot instead. - -We don't need to specify the mmc devices individually, since they are -used in order from 0 to 2, and standard boot uses that order anyway. - -Signed-off-by: Simon Glass ---- - -Changes in v3: -- Rebase to -master - -Changes in v2: -- Rebase to -next - - configs/rpi_0_w_defconfig | 1 + - configs/rpi_2_defconfig | 1 + - configs/rpi_3_32b_defconfig | 1 + - configs/rpi_3_b_plus_defconfig | 1 + - configs/rpi_3_defconfig | 1 + - configs/rpi_4_32b_defconfig | 1 + - configs/rpi_4_defconfig | 1 + - configs/rpi_arm64_defconfig | 1 + - configs/rpi_defconfig | 1 + - include/configs/rpi.h | 38 ++-------------------------------- - 10 files changed, 11 insertions(+), 36 deletions(-) - -diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig -index 5da334a8bcf9..7554e671e2ca 100644 ---- a/configs/rpi_0_w_defconfig -+++ b/configs/rpi_0_w_defconfig -@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-zero-w" - CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y -diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig -index 990862160712..653f78bec1e8 100644 ---- a/configs/rpi_2_defconfig -+++ b/configs/rpi_2_defconfig -@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2836-rpi-2-b" - CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y -diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig -index 80885aa9488d..305f1dacfd46 100644 ---- a/configs/rpi_3_32b_defconfig -+++ b/configs/rpi_3_32b_defconfig -@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" - CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y -diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig -index 0acce8b883f8..f36f1258aa6d 100644 ---- a/configs/rpi_3_b_plus_defconfig -+++ b/configs/rpi_3_b_plus_defconfig -@@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b-plus" - CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y -diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig -index bb6fe128061b..a0d8be42537f 100644 ---- a/configs/rpi_3_defconfig -+++ b/configs/rpi_3_defconfig -@@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b" - CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y -diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig -index f6213340971e..71f61c52e52d 100644 ---- a/configs/rpi_4_32b_defconfig -+++ b/configs/rpi_4_32b_defconfig -@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_DM_RESET=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_PCI=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y -diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig -index bbc0fd6c649a..fa2c05da21e8 100644 ---- a/configs/rpi_4_defconfig -+++ b/configs/rpi_4_defconfig -@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_DM_RESET=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_PCI=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y -diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig -index 5d9a273cb920..3e64573b70b1 100644 ---- a/configs/rpi_arm64_defconfig -+++ b/configs/rpi_arm64_defconfig -@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_DM_RESET=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_PCI=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y -diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig -index 550b8dcb9587..4b8e402c89d4 100644 ---- a/configs/rpi_defconfig -+++ b/configs/rpi_defconfig -@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b" - CONFIG_SYS_PROMPT="U-Boot> " - CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 -+CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y - CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y -diff --git a/include/configs/rpi.h b/include/configs/rpi.h -index 4da982f73578..4160db2d8e14 100644 ---- a/include/configs/rpi.h -+++ b/include/configs/rpi.h -@@ -122,47 +122,13 @@ - "fdt_addr_r=0x02600000\0" \ - "ramdisk_addr_r=0x02700000\0" - --#if IS_ENABLED(CONFIG_CMD_MMC) -- #define BOOT_TARGET_MMC(func) \ -- func(MMC, mmc, 0) \ -- func(MMC, mmc, 1) \ -- func(MMC, mmc, 2) --#else -- #define BOOT_TARGET_MMC(func) --#endif -- --#if IS_ENABLED(CONFIG_CMD_USB) -- #define BOOT_TARGET_USB(func) func(USB, usb, 0) --#else -- #define BOOT_TARGET_USB(func) --#endif -- --#if CONFIG_IS_ENABLED(CMD_PXE) -- #define BOOT_TARGET_PXE(func) func(PXE, pxe, na) --#else -- #define BOOT_TARGET_PXE(func) --#endif -- --#if CONFIG_IS_ENABLED(CMD_DHCP) -- #define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na) --#else -- #define BOOT_TARGET_DHCP(func) --#endif -- --#define BOOT_TARGET_DEVICES(func) \ -- BOOT_TARGET_MMC(func) \ -- BOOT_TARGET_USB(func) \ -- BOOT_TARGET_PXE(func) \ -- BOOT_TARGET_DHCP(func) -- --#include -+#define BOOT_TARGETS "mmc usb pxe dhcp" - - #define CFG_EXTRA_ENV_SETTINGS \ - "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ - ENV_DEVICE_SETTINGS \ - ENV_DFU_SETTINGS \ - ENV_MEM_LAYOUT_SETTINGS \ -- BOOTENV -- -+ "boot_targets=" BOOT_TARGETS "\0" - - #endif - -From patchwork Thu Jul 27 21:54:29 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Simon Glass -X-Patchwork-Id: 1813969 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 - header.s=google header.b=nzf25ZVl; - 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 ECDSA (P-384) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4RBl1p1S1xz1yZb - for ; Fri, 28 Jul 2023 07:55:26 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id CEB4186898; - Thu, 27 Jul 2023 23:55:12 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -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=chromium.org header.i=@chromium.org - header.b="nzf25ZVl"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id A550186437; Thu, 27 Jul 2023 23:54: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.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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no - version=3.4.2 -Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com - [IPv6:2607:f8b0:4864:20::d35]) - (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 848728687F - for ; Thu, 27 Jul 2023 23:54:42 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sjg@chromium.org -Received: by mail-io1-xd35.google.com with SMTP id - ca18e2360f4ac-7906614bc90so37744039f.3 - for ; Thu, 27 Jul 2023 14:54:42 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=chromium.org; s=google; t=1690494881; x=1691099681; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=rvJFSxuX2uR5MvGPMP0r8JMhRHphT9SXIfCxnVxNK0U=; - b=nzf25ZVlr+TPb8i9KPe94q+xnslw0eiim8ufkD20J+REgYqV1+bfKhPYKo45AkO/Cs - 4b6fZA33NLf5U7qgGo7v+urHNiAPER6YN1bXI9hJSNAEtM13z2v621IsEFffyVMcM85C - 4AMfUiBclfET9Wn0oQnsQ5JK94HV4jlQugZzQ= -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1690494881; x=1691099681; - 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=rvJFSxuX2uR5MvGPMP0r8JMhRHphT9SXIfCxnVxNK0U=; - b=SWZg15tnmLFbQbK+nDA8NsoxsfTOrSK/kUZE8JUBjXnb/EfYfPfZWjBXdTlOT0hTzs - Do1oyQ0GpF9az6Cx1cJaNL+6/ndCRmpmhbQqCvSRgBsAKnQp00cgnet2sm4yVWfiF5PX - 2qaBEeb9gg636lDes6X4aWDvc+t+OzxAlyoh09leqtoNsYaZ9IaM0yoiS8fr0BiqJMrg - MSYnMIsBLMm+jhgQFf2e8ur5tdy7JpF2W9IWlzTu24aMYaDO7jzv2OPLE4yabyZoUIxZ - VGKiZBQssS0Xb/sjea7V65wIws1WhJUfrh088lrlqAdsj+ZlnkWnVhBhlZPR+tkRHWJZ - HcHw== -X-Gm-Message-State: ABy/qLaVdYCT7tOkUReGBSdg/9KznV2sYfo8iTdWbZcW3wegZxOZfpEX - rfBbszTe7MI5Zzj4HA69r3jTlgsxblkKBaKi4I0= -X-Google-Smtp-Source: - APBJJlGWO4DcArS83mKgiEVe92ZPEk/c3kJN6Gj7ZAwNVPMXoPhbtveScu/4+gTrfnrjCxTkZP9a3g== -X-Received: by 2002:a05:6602:682:b0:787:1d53:e6cc with SMTP id - dp2-20020a056602068200b007871d53e6ccmr874039iob.21.1690494881076; - Thu, 27 Jul 2023 14:54:41 -0700 (PDT) -Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) - by smtp.gmail.com with ESMTPSA id - n28-20020a02cc1c000000b00430245071ddsm679215jap.176.2023.07.27.14.54.40 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Thu, 27 Jul 2023 14:54:40 -0700 (PDT) -From: Simon Glass -To: U-Boot Mailing List -Cc: Tom Rini , Peter Robinson , - Simon Glass , Matthias Brugger , - Stephen Warren , Stephen Warren -Subject: [RESEND PATCH v3 2/3] rpi: Disable DISTRO_DEFAULTS -Date: Thu, 27 Jul 2023 15:54:29 -0600 -Message-ID: <20230727215433.578830-3-sjg@chromium.org> -X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog -In-Reply-To: <20230727215433.578830-1-sjg@chromium.org> -References: <20230727215433.578830-1-sjg@chromium.org> -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 - -Disable this option to reclaim some space, since bootstd requires less -functionality to operate (e.g. hush parser). - -Signed-off-by: Simon Glass ---- - -(no changes since v2) - -Changes in v2: -- Add new patch to disable DISTRO_DEFAULTS - - configs/rpi_0_w_defconfig | 1 - - configs/rpi_2_defconfig | 1 - - configs/rpi_3_32b_defconfig | 1 - - configs/rpi_3_b_plus_defconfig | 1 - - configs/rpi_3_defconfig | 1 - - configs/rpi_4_32b_defconfig | 1 - - configs/rpi_4_defconfig | 1 - - configs/rpi_arm64_defconfig | 1 - - configs/rpi_defconfig | 1 - - 9 files changed, 9 deletions(-) - -diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig -index 7554e671e2ca..3167bfbe48f7 100644 ---- a/configs/rpi_0_w_defconfig -+++ b/configs/rpi_0_w_defconfig -@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - # CONFIG_DISPLAY_CPUINFO is not set - # CONFIG_DISPLAY_BOARDINFO is not set -diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig -index 653f78bec1e8..883dab161702 100644 ---- a/configs/rpi_2_defconfig -+++ b/configs/rpi_2_defconfig -@@ -15,7 +15,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - # CONFIG_DISPLAY_CPUINFO is not set - # CONFIG_DISPLAY_BOARDINFO is not set -diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig -index 305f1dacfd46..5ff7d987a431 100644 ---- a/configs/rpi_3_32b_defconfig -+++ b/configs/rpi_3_32b_defconfig -@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - # CONFIG_DISPLAY_CPUINFO is not set - # CONFIG_DISPLAY_BOARDINFO is not set -diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig -index f36f1258aa6d..31f2a6eb310c 100644 ---- a/configs/rpi_3_b_plus_defconfig -+++ b/configs/rpi_3_b_plus_defconfig -@@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - # CONFIG_DISPLAY_CPUINFO is not set - # CONFIG_DISPLAY_BOARDINFO is not set -diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig -index a0d8be42537f..fa6e1507d640 100644 ---- a/configs/rpi_3_defconfig -+++ b/configs/rpi_3_defconfig -@@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - # CONFIG_DISPLAY_CPUINFO is not set - # CONFIG_DISPLAY_BOARDINFO is not set -diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig -index 71f61c52e52d..55bf6c0770f0 100644 ---- a/configs/rpi_4_32b_defconfig -+++ b/configs/rpi_4_32b_defconfig -@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_PCI=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - CONFIG_PREBOOT="pci enum; usb start;" - # CONFIG_DISPLAY_CPUINFO is not set -diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig -index fa2c05da21e8..6679cce9a165 100644 ---- a/configs/rpi_4_defconfig -+++ b/configs/rpi_4_defconfig -@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_PCI=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - CONFIG_PREBOOT="pci enum; usb start;" - # CONFIG_DISPLAY_CPUINFO is not set -diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig -index 3e64573b70b1..26e29ffb5a1f 100644 ---- a/configs/rpi_arm64_defconfig -+++ b/configs/rpi_arm64_defconfig -@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_PCI=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - CONFIG_PREBOOT="pci enum; usb start;" - # CONFIG_DISPLAY_CPUINFO is not set -diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig -index 4b8e402c89d4..0ac5efec717b 100644 ---- a/configs/rpi_defconfig -+++ b/configs/rpi_defconfig -@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y - CONFIG_SYS_LOAD_ADDR=0x1000000 - CONFIG_BOOTSTD_DEFAULTS=y - CONFIG_OF_BOARD_SETUP=y --CONFIG_DISTRO_DEFAULTS=y - CONFIG_USE_PREBOOT=y - # CONFIG_DISPLAY_CPUINFO is not set - # CONFIG_DISPLAY_BOARDINFO is not set - -From patchwork Thu Jul 27 21:54:30 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Simon Glass -X-Patchwork-Id: 1813970 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 - header.s=google header.b=mBws8fys; - 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 ECDSA (P-384)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4RBl220N1zz1yZb - for ; Fri, 28 Jul 2023 07:55:38 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 7E187868A9; - Thu, 27 Jul 2023 23:55:29 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -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=chromium.org header.i=@chromium.org - header.b="mBws8fys"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 7F3798687F; Thu, 27 Jul 2023 23:54:47 +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,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no - version=3.4.2 -Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com - [IPv6:2607:f8b0:4864:20::d31]) - (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 6FD6A86883 - for ; Thu, 27 Jul 2023 23:54:43 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sjg@chromium.org -Received: by mail-io1-xd31.google.com with SMTP id - ca18e2360f4ac-7878e573827so57883239f.1 - for ; Thu, 27 Jul 2023 14:54:43 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=chromium.org; s=google; t=1690494882; x=1691099682; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=YMeq2z0BceWJEeXZ+KPCl2/DO9snM/APf71IQJ8+EHM=; - b=mBws8fysMfDnws5xSckJmwYoFnbO4f08B6wlUEznhDpb/FVohJO+FmfQbnHUDUDsSy - Ee6d5JuG8wVUQSapqqsi2JXsNwfvnzsA0e7QaUoJptoauwkl1oKG+AZ91ThkEcjXdL6O - RK775AhnEeLE5jMuVBfe9uFq6Re05aeM+vdsU= -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1690494882; x=1691099682; - 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=YMeq2z0BceWJEeXZ+KPCl2/DO9snM/APf71IQJ8+EHM=; - b=JCEGP9SG2bCGvzpYyon4ZvzAorqfIf8zfk2pJUGBNzjUUgshrJ61sNPKq511ECI9Iq - 4yxAoqYQDXgSv32IWK7fI0cGnv7QlyXjPSVE42G6W+gO2BZAnd0nUhwVSoV4Llz1vwx5 - RVOUfXyUZVtm/98JYyMavbvbNvnFy2RmefMLDz3Q3ES8eb7l8KclgtnPTpvsNdO4pw4W - MVzDzaNyuZq1tfHjYJz1UTC7G5rfiqkgThZbvc0VAa3wEnxtT4xxFIfebHKkyqbLqQ/6 - CfuFspsQDYnNZ4pVUaM9P6SWPzRKLIFCThE3AZDKEjW9hb9O1MOTzablkioHKNFipH2v - 8aPw== -X-Gm-Message-State: ABy/qLbiMvFNCnHAWkxWhayqbqcbzPbE/txTwyh8SaP8/5b7BdEzsSap - DdDHhSzoDCe+X4IQmkeApNsbmjJmALrfhBJBa1E= -X-Google-Smtp-Source: - APBJJlE+7X+YHtsSdv0glv6+7e+JF2c+SP9bOM3kvNRjEtcpLydgTQTDsxizlaaU3s5ZzSPXDsW9LQ== -X-Received: by 2002:a6b:d902:0:b0:786:cd9b:1ccd with SMTP id - r2-20020a6bd902000000b00786cd9b1ccdmr812254ioc.0.1690494881976; - Thu, 27 Jul 2023 14:54:41 -0700 (PDT) -Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) - by smtp.gmail.com with ESMTPSA id - n28-20020a02cc1c000000b00430245071ddsm679215jap.176.2023.07.27.14.54.41 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Thu, 27 Jul 2023 14:54:41 -0700 (PDT) -From: Simon Glass -To: U-Boot Mailing List -Cc: Tom Rini , Peter Robinson , - Simon Glass , Albert Aribaud , - Matthias Brugger , Stephen Warren , - Stephen Warren -Subject: [RESEND PATCH v3 3/3] arm: rpi: Switch to a text environment -Date: Thu, 27 Jul 2023 15:54:30 -0600 -Message-ID: <20230727215433.578830-4-sjg@chromium.org> -X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog -In-Reply-To: <20230727215433.578830-1-sjg@chromium.org> -References: <20230727215433.578830-1-sjg@chromium.org> -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 - -Use the new environment format so we can drop most of the config.h file. - -Signed-off-by: Simon Glass ---- - -(no changes since v1) - - board/raspberrypi/rpi/rpi.env | 77 ++++++++++++++++++++++++++ - include/configs/rpi.h | 100 ---------------------------------- - 2 files changed, 77 insertions(+), 100 deletions(-) - create mode 100644 board/raspberrypi/rpi/rpi.env - -diff --git a/board/raspberrypi/rpi/rpi.env b/board/raspberrypi/rpi/rpi.env -new file mode 100644 -index 000000000000..30228285edde ---- /dev/null -+++ b/board/raspberrypi/rpi/rpi.env -@@ -0,0 +1,77 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+ -+/* environment for Raspberry Pi boards */ -+ -+dhcpuboot=usb start; dhcp u-boot.uimg; bootm -+ -+/* Environment */ -+stdin=serial,usbkbd -+stdout=serial,vidconsole -+stderr=serial,vidconsole -+ -+/* DFU over USB/UDC */ -+#ifdef CONFIG_CMD_DFU -+dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1; -+ config.txt fat 0 1; -+#ifdef CONFIG_ARM64 -+dfu_alt_info+=Image fat 0 1 -+#else -+dfu_alt_info+=zImage fat 0 1 -+#endif -+#endif /* CONFIG_CMD_DFU */ -+ -+/* -+ * Memory layout for where various images get loaded by boot scripts: -+ * -+ * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. -+ * -+ * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, -+ * newer versions place it in high memory. So prevent U-Boot from doing its own -+ * DTB + initrd relocation so that we won't accidentally relocate the initrd -+ * over the firmware-loaded DTB and generally try to lay out things starting -+ * from the bottom of RAM. -+ * -+ * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, -+ * it must be within the first 128M of RAM in order for the kernel's -+ * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed -+ * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The -+ * decompressor also likes to relocate itself to right past the end of the -+ * decompressed kernel, so in total the sum of the compressed and -+ * decompressed kernel needs to be reserved. -+ * -+ * For Aarch64, the kernel image is uncompressed and must be loaded at -+ * text_offset bytes (specified in the header of the Image) into a 2MB -+ * boundary. The 'booti' command relocates the image if necessary. Linux uses -+ * a default text_offset of 0x80000. In summary, loading at 0x80000 -+ * satisfies all these constraints and reserving memory up to 0x02400000 -+ * permits fairly large (roughly 36M) kernels. -+ * -+ * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't -+ * conflict with something else. Reserving 1M for each of them at -+ * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. -+ * -+ * On ARM, both the DTB and any possible initrd must be loaded such that they -+ * fit inside the lowmem mapping in Linux. In practice, this usually means not -+ * more than ~700M away from the start of the kernel image but this number can -+ * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line -+ * parameter given to the kernel. So reserving memory from low to high -+ * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for -+ * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. -+ * Even with the smallest possible CPU-GPU memory split of the CPU getting -+ * only 64M, the remaining 25M starting at 0x02700000 should allow quite -+ * large initrds before they start colliding with U-Boot. -+ */ -+#ifdef CONFIG_ARM64 -+fdt_high=ffffffffffffffff -+initrd_high=ffffffffffffffff -+#else -+fdt_high=ffffffff -+initrd_high=ffffffff -+#endif -+kernel_addr_r=0x00080000 -+scriptaddr=0x02400000 -+pxefile_addr_r=0x02500000 -+fdt_addr_r=0x02600000 -+ramdisk_addr_r=0x02700000 -+ -+boot_targets=mmc usb pxe dhcp -diff --git a/include/configs/rpi.h b/include/configs/rpi.h -index 4160db2d8e14..8e56bdc84a89 100644 ---- a/include/configs/rpi.h -+++ b/include/configs/rpi.h -@@ -13,8 +13,6 @@ - #include - #endif - --/* Architecture, CPU, etc.*/ -- - /* Use SoC timer for AArch32, but architected timer for AArch64 */ - #ifndef CONFIG_ARM64 - #define CFG_SYS_TIMER_RATE 1000000 -@@ -33,102 +31,4 @@ - */ - #define CFG_SYS_SDRAM_SIZE SZ_128M - --/* Devices */ --/* LCD */ -- --/* DFU over USB/UDC */ --#ifdef CONFIG_CMD_DFU --#ifdef CONFIG_ARM64 --#define KERNEL_FILENAME "Image" --#else --#define KERNEL_FILENAME "zImage" --#endif -- --#define ENV_DFU_SETTINGS \ -- "dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;" \ -- "config.txt fat 0 1;" \ -- KERNEL_FILENAME " fat 0 1\0" --#else --#define ENV_DFU_SETTINGS "" --#endif -- --/* Console configuration */ -- --/* Environment */ -- --/* Shell */ -- --/* Environment */ --#define ENV_DEVICE_SETTINGS \ -- "stdin=serial,usbkbd\0" \ -- "stdout=serial,vidconsole\0" \ -- "stderr=serial,vidconsole\0" -- --#ifdef CONFIG_ARM64 --#define FDT_HIGH "ffffffffffffffff" --#define INITRD_HIGH "ffffffffffffffff" --#else --#define FDT_HIGH "ffffffff" --#define INITRD_HIGH "ffffffff" --#endif -- --/* -- * Memory layout for where various images get loaded by boot scripts: -- * -- * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this. -- * -- * Older versions of the boot firmware place the firmware-loaded DTB at 0x100, -- * newer versions place it in high memory. So prevent U-Boot from doing its own -- * DTB + initrd relocation so that we won't accidentally relocate the initrd -- * over the firmware-loaded DTB and generally try to lay out things starting -- * from the bottom of RAM. -- * -- * kernel_addr_r has different constraints on ARM and Aarch64. For 32-bit ARM, -- * it must be within the first 128M of RAM in order for the kernel's -- * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed -- * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The -- * decompressor also likes to relocate itself to right past the end of the -- * decompressed kernel, so in total the sum of the compressed and and -- * decompressed kernel needs to be reserved. -- * -- * For Aarch64, the kernel image is uncompressed and must be loaded at -- * text_offset bytes (specified in the header of the Image) into a 2MB -- * boundary. The 'booti' command relocates the image if necessary. Linux uses -- * a default text_offset of 0x80000. In summary, loading at 0x80000 -- * satisfies all these constraints and reserving memory up to 0x02400000 -- * permits fairly large (roughly 36M) kernels. -- * -- * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't -- * conflict with something else. Reserving 1M for each of them at -- * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty. -- * -- * On ARM, both the DTB and any possible initrd must be loaded such that they -- * fit inside the lowmem mapping in Linux. In practice, this usually means not -- * more than ~700M away from the start of the kernel image but this number can -- * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line -- * parameter given to the kernel. So reserving memory from low to high -- * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for -- * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000. -- * Even with the smallest possible CPU-GPU memory split of the CPU getting -- * only 64M, the remaining 25M starting at 0x02700000 should allow quite -- * large initrds before they start colliding with U-Boot. -- */ --#define ENV_MEM_LAYOUT_SETTINGS \ -- "fdt_high=" FDT_HIGH "\0" \ -- "initrd_high=" INITRD_HIGH "\0" \ -- "kernel_addr_r=0x00080000\0" \ -- "scriptaddr=0x02400000\0" \ -- "pxefile_addr_r=0x02500000\0" \ -- "fdt_addr_r=0x02600000\0" \ -- "ramdisk_addr_r=0x02700000\0" -- --#define BOOT_TARGETS "mmc usb pxe dhcp" -- --#define CFG_EXTRA_ENV_SETTINGS \ -- "dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \ -- ENV_DEVICE_SETTINGS \ -- ENV_DFU_SETTINGS \ -- ENV_MEM_LAYOUT_SETTINGS \ -- "boot_targets=" BOOT_TARGETS "\0" -- - #endif diff --git a/sources b/sources index 0fa4df0..1ef8db1 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.10-rc3.tar.bz2) = 920190c47faca085c44fbd747669379f47461e3a3de5041e6a0d28d073116f1b18b0711876fb3c49eacd130e6fd2aa9d5ec84cb5fe0b2f7617b2438804317e81 +SHA512 (u-boot-2023.10.tar.bz2) = f238a69b9cc08ee0a69ea8ca2fa26975f2f2ede14e978b4db274b1e4095e43af0052307ac39034658a72ec9706951cd03c0f316d0591f391adecaf2cc9496fc4 diff --git a/uboot-tools.spec b/uboot-tools.spec index 478b255..d4ae06f 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc3 +#global candidate rc0 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.10 -Release: 0.4%{?candidate:.%{candidate}}%{?dist} +Release: 0.7%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -16,13 +16,12 @@ ExcludeArch: s390x Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}%{?candidate:-%{candidate}}.tar.bz2 Source1: aarch64-boards -# Fedoraisms patches -# Needed to find DT on boot partition that's not the first partition -Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch +Patch1: uefi-Boot-var-automatic-management-for-removable-medias.patch Patch2: smbios-Simplify-reporting-of-unknown-values.patch Patch3: disable-VBE-by-default.patch Patch4: enable-bootmenu-by-default.patch Patch5: Add-video-damage-tracking.patch +Patch6: bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support @@ -30,7 +29,6 @@ Patch10: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch # Rockchips improvements Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch #Patch12: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch -Patch13: rpi-Convert-to-standard-boot.patch BuildRequires: bc BuildRequires: bison @@ -215,6 +213,10 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Mon Oct 02 2023 Peter Robinson - 2023.10-0.7 +- Update to 2023.10 GA +- Some upstream fixes + * Mon Aug 21 2023 Peter Robinson - 2023.10-0.4.rc3 - Update to 2023.10 RC3 diff --git a/uefi-Boot-var-automatic-management-for-removable-medias.patch b/uefi-Boot-var-automatic-management-for-removable-medias.patch new file mode 100644 index 0000000..aa8db6c --- /dev/null +++ b/uefi-Boot-var-automatic-management-for-removable-medias.patch @@ -0,0 +1,550 @@ +From patchwork Mon Oct 16 06:45:24 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Masahisa Kojima +X-Patchwork-Id: 1849182 +X-Patchwork-Delegate: trini@ti.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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=Ul1XEHOs; + 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 4S874K5Xxfz20Pd + for ; Mon, 16 Oct 2023 17:48:49 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id CEAE986C65; + Mon, 16 Oct 2023 08:47:35 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="Ul1XEHOs"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 8D53786DB3; Mon, 16 Oct 2023 08:47: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,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 mail-pf1-x42e.google.com (mail-pf1-x42e.google.com + [IPv6:2607:f8b0:4864:20::42e]) + (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 CDE3A86E17 + for ; Mon, 16 Oct 2023 08:47:09 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=masahisa.kojima@linaro.org +Received: by mail-pf1-x42e.google.com with SMTP id + d2e1a72fcca58-6b9af7d41d2so1095255b3a.0 + for ; Sun, 15 Oct 2023 23:47:09 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1697438827; x=1698043627; darn=lists.denx.de; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=a4zZ4HlSkK/oY3qfyV9r1nYVhNuROFuLhRstgf1Rv2c=; + b=Ul1XEHOsGM4s5ZXhl8izVuRgdzwBvimAZkXuoqhECUyzZ5Ez0xE4L1Hg3jaebkJtT4 + Obo7iWdiOztGGXAQsCc6aArrMkn5aWaxldZj3Pk7wiMXDQQwkaTGjRCvrTsNYEXGqaYa + lgGsDUHQY9XV9evUyGDM53AoPvEQpMUn6Ise6OpLox6UUZP1F50ibABAcCqCaWEz+1nq + 4lVN8G9iVN+cmBLHgyABIM/ySQviS1kOYG+YTltUb5HvVaMxir4vqsa4+x6vd/tTxXMk + 56wvCrB5HMNqfSgdipSasXwMLCFgHXkBq93i2kbuzMIQ7Ysvv3C8BVI0G+1f6oLwENLk + e/CQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1697438827; x=1698043627; + 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=a4zZ4HlSkK/oY3qfyV9r1nYVhNuROFuLhRstgf1Rv2c=; + b=OcOEUqe358XOG7Zc6Hy+FF1rfaLYWmEF0A8OizdzAhGDLivYKjNd4BoOEHO4KvOACh + FZMZ1CB92hAiYJu1Ndf90dBBML5rNhQNU2W7UeXtS71umYvHozHLjFpF1yhECni/jQQU + 4oOX+5SMFsICbIbh7s4rTv7wQiw9WfipvTiPbJAhIlFiWT90CFt3hyN8/9KlKbl0Sclz + gllfdag+B/kpFHp53cH9u/zyihobAX9mjV7UWzK5LavAIv6z62RlsRMaICfqqhzWdiCQ + HVNQr2zZEmvsRXg8I0bE1n51DSkTLQ3tXeACm5nhLyxgtyqWwailoFeacOUsF7GMlCcD + qEbw== +X-Gm-Message-State: AOJu0YzjJEUEStoUb3N4IXyZxHifoMSiHxGU6B4mx7PQowC7gzvn1TnE + xTthn5FBg1s44Z9M4SsWxKIzkdvcmlpYkXlx7zA= +X-Google-Smtp-Source: + AGHT+IHbD6oyEamNHq3LhzVqk9GmlOVQEB1PUP0LTuRVh232jV1wx8mVR7sYKvotrVqHEVfJnRLFMA== +X-Received: by 2002:a05:6a00:1511:b0:690:4362:7011 with SMTP id + q17-20020a056a00151100b0069043627011mr35009133pfu.24.1697438827170; + Sun, 15 Oct 2023 23:47:07 -0700 (PDT) +Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id + fa13-20020a056a002d0d00b006b1c14a493fsm5242447pfb.71.2023.10.15.23.47.06 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Sun, 15 Oct 2023 23:47:06 -0700 (PDT) +From: Masahisa Kojima +To: u-boot@lists.denx.de +Cc: Heinrich Schuchardt , + Ilias Apalodimas , + Simon Glass , + Takahiro Akashi , + Michal Simek , Raymond Mao , + Masahisa Kojima , + Joao Marcos Costa , + Thomas Petazzoni , + Miquel Raynal +Subject: [PATCH v7 7/9] Boot var automatic management for removable medias +Date: Mon, 16 Oct 2023 15:45:24 +0900 +Message-Id: <20231016064526.2410856-8-masahisa.kojima@linaro.org> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20231016064526.2410856-1-masahisa.kojima@linaro.org> +References: <20231016064526.2410856-1-masahisa.kojima@linaro.org> +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 + +From: Raymond Mao + +Changes for complying to EFI spec §3.5.1.1 +'Removable Media Boot Behavior'. +Boot variables can be automatically generated during a removable +media is probed. At the same time, unused boot variables will be +detected and removed. + +Please note that currently the function 'efi_disk_remove' has no +ability to distinguish below two scenarios +a) Unplugging of a removable media under U-Boot +b) U-Boot exiting and booting an OS +Thus currently the boot variables management is not added into +'efi_disk_remove' to avoid boot options being added/erased +repeatedly under scenario b) during power cycles +See TODO comments under function 'efi_disk_remove' for more details + +The original efi_secboot tests expect that BootOrder EFI variable +is not defined. With this commit, the BootOrder EFI variable is +automatically added when the disk is detected. The original +efi_secboot tests end up with unexpected failure. +The efi_secboot tests need to be modified to explicitly set +the BootOrder EFI variable. + +squashfs ls test is also affected by this modification, need to +clear the previous state before squashfs ls test starts. + +Co-developed-by: Masahisa Kojima +Signed-off-by: Masahisa Kojima +Signed-off-by: Raymond Mao +Reviewed-by: Heinrich Schuchardt +Reviewed-by: Ilias Apalodimas +Signed-off-by: Joao Marcos Costa +Reviewed-by: Joao Marcos Costa +--- + lib/efi_loader/efi_disk.c | 18 ++++++++ + lib/efi_loader/efi_setup.c | 7 ++++ + test/py/tests/test_efi_secboot/test_signed.py | 42 +++++++++---------- + .../test_efi_secboot/test_signed_intca.py | 14 +++---- + .../tests/test_efi_secboot/test_unsigned.py | 14 +++---- + .../test_fs/test_squashfs/test_sqfs_ls.py | 6 +++ + 6 files changed, 66 insertions(+), 35 deletions(-) + +diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c +index f0d76113b0..b808a7fe62 100644 +--- a/lib/efi_loader/efi_disk.c ++++ b/lib/efi_loader/efi_disk.c +@@ -690,6 +690,13 @@ int efi_disk_probe(void *ctx, struct event *event) + return -1; + } + ++ /* only do the boot option management when UEFI sub-system is initialized */ ++ if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR) && efi_obj_list_initialized == EFI_SUCCESS) { ++ ret = efi_bootmgr_update_media_device_boot_option(); ++ if (ret != EFI_SUCCESS) ++ return -1; ++ } ++ + return 0; + } + +@@ -742,6 +749,17 @@ int efi_disk_remove(void *ctx, struct event *event) + dev_tag_del(dev, DM_TAG_EFI); + + return 0; ++ ++ /* ++ * TODO A flag to distinguish below 2 different scenarios of this ++ * function call is needed: ++ * a) Unplugging of a removable media under U-Boot ++ * b) U-Boot exiting and booting an OS ++ * In case of scenario a), efi_bootmgr_update_media_device_boot_option() ++ * needs to be invoked here to update the boot options and remove the ++ * unnecessary ones. ++ */ ++ + } + + /** +diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c +index e6de685e87..37359a77bb 100644 +--- a/lib/efi_loader/efi_setup.c ++++ b/lib/efi_loader/efi_setup.c +@@ -245,6 +245,13 @@ efi_status_t efi_init_obj_list(void) + if (ret != EFI_SUCCESS) + goto out; + ++ if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { ++ /* update boot option after variable service initialized */ ++ ret = efi_bootmgr_update_media_device_boot_option(); ++ if (ret != EFI_SUCCESS) ++ goto out; ++ } ++ + /* Define supported languages */ + ret = efi_init_platform_lang(); + if (ret != EFI_SUCCESS) +diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py +index ca52e853d8..2f862a259a 100644 +--- a/test/py/tests/test_efi_secboot/test_signed.py ++++ b/test/py/tests/test_efi_secboot/test_signed.py +@@ -29,7 +29,7 @@ class TestEfiSignedImage(object): + output = u_boot_console.run_command_list([ + 'host bind 0 %s' % disk_img, + 'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'bootefi bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -37,7 +37,7 @@ class TestEfiSignedImage(object): + # Test Case 1b, run unsigned image if no PK + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi -s ""', +- 'efidebug boot next 2', ++ 'efidebug boot order 2', + 'bootefi bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -59,13 +59,13 @@ class TestEfiSignedImage(object): + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert('\'HELLO1\' failed' in ''.join(output)) + assert('efi_start_image() returned: 26' in ''.join(output)) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi -s ""', +- 'efidebug boot next 2', ++ 'efidebug boot order 2', + 'efidebug test bootmgr']) + assert '\'HELLO2\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -77,12 +77,12 @@ class TestEfiSignedImage(object): + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 2', ++ 'efidebug boot order 2', + 'efidebug test bootmgr']) + assert '\'HELLO2\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'bootefi bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -105,7 +105,7 @@ class TestEfiSignedImage(object): + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -117,7 +117,7 @@ class TestEfiSignedImage(object): + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -143,7 +143,7 @@ class TestEfiSignedImage(object): + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -170,7 +170,7 @@ class TestEfiSignedImage(object): + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -181,7 +181,7 @@ class TestEfiSignedImage(object): + 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db']) + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -193,7 +193,7 @@ class TestEfiSignedImage(object): + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -205,7 +205,7 @@ class TestEfiSignedImage(object): + 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize dbx']) + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -230,7 +230,7 @@ class TestEfiSignedImage(object): + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -254,7 +254,7 @@ class TestEfiSignedImage(object): + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'bootefi bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -265,7 +265,7 @@ class TestEfiSignedImage(object): + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -279,7 +279,7 @@ class TestEfiSignedImage(object): + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -307,7 +307,7 @@ class TestEfiSignedImage(object): + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -330,7 +330,7 @@ class TestEfiSignedImage(object): + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -349,7 +349,7 @@ class TestEfiSignedImage(object): + output = u_boot_console.run_command_list([ + 'host bind 0 %s' % disk_img, + 'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld_forged.efi.signed -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert('hELLO, world!' in ''.join(output)) + +@@ -364,7 +364,7 @@ class TestEfiSignedImage(object): + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) + assert 'Failed to set EFI variable' not in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert(not 'hELLO, world!' in ''.join(output)) + assert('\'HELLO1\' failed' in ''.join(output)) +diff --git a/test/py/tests/test_efi_secboot/test_signed_intca.py b/test/py/tests/test_efi_secboot/test_signed_intca.py +index d8d599d22f..8d9a5f3e7f 100644 +--- a/test/py/tests/test_efi_secboot/test_signed_intca.py ++++ b/test/py/tests/test_efi_secboot/test_signed_intca.py +@@ -40,7 +40,7 @@ class TestEfiSignedImageIntca(object): + + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO_a host 0:1 /helloworld.efi.signed_a -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO_a\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -49,7 +49,7 @@ class TestEfiSignedImageIntca(object): + # Test Case 1b, signed and authenticated by root CA + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 2 HELLO_ab host 0:1 /helloworld.efi.signed_ab -s ""', +- 'efidebug boot next 2', ++ 'efidebug boot order 2', + 'bootefi bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -71,7 +71,7 @@ class TestEfiSignedImageIntca(object): + + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO_abc\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -81,7 +81,7 @@ class TestEfiSignedImageIntca(object): + output = u_boot_console.run_command_list([ + 'fatload host 0:1 4000000 db_b.auth', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO_abc\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +@@ -91,7 +91,7 @@ class TestEfiSignedImageIntca(object): + output = u_boot_console.run_command_list([ + 'fatload host 0:1 4000000 db_c.auth', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -117,7 +117,7 @@ class TestEfiSignedImageIntca(object): + + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert 'Hello, world!' in ''.join(output) + # Or, +@@ -129,7 +129,7 @@ class TestEfiSignedImageIntca(object): + output = u_boot_console.run_command_list([ + 'fatload host 0:1 4000000 dbx_c.auth', + 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert '\'HELLO_abc\' failed' in ''.join(output) + assert 'efi_start_image() returned: 26' in ''.join(output) +diff --git a/test/py/tests/test_efi_secboot/test_unsigned.py b/test/py/tests/test_efi_secboot/test_unsigned.py +index df63f0df08..7c078f220d 100644 +--- a/test/py/tests/test_efi_secboot/test_unsigned.py ++++ b/test/py/tests/test_efi_secboot/test_unsigned.py +@@ -36,11 +36,11 @@ class TestEfiUnsignedImage(object): + + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'bootefi bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert 'efi_start_image() returned: 26' in ''.join(output) + assert 'Hello, world!' not in ''.join(output) +@@ -65,7 +65,7 @@ class TestEfiUnsignedImage(object): + + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'bootefi bootmgr']) + assert 'Hello, world!' in ''.join(output) + +@@ -89,11 +89,11 @@ class TestEfiUnsignedImage(object): + + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'bootefi bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert 'efi_start_image() returned: 26' in ''.join(output) + assert 'Hello, world!' not in ''.join(output) +@@ -107,11 +107,11 @@ class TestEfiUnsignedImage(object): + + output = u_boot_console.run_command_list([ + 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""', +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'bootefi bootmgr']) + assert '\'HELLO\' failed' in ''.join(output) + output = u_boot_console.run_command_list([ +- 'efidebug boot next 1', ++ 'efidebug boot order 1', + 'efidebug test bootmgr']) + assert 'efi_start_image() returned: 26' in ''.join(output) + assert 'Hello, world!' not in ''.join(output) +diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py +index 527a556ed8..3b8118104f 100644 +--- a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py ++++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py +@@ -118,6 +118,12 @@ def test_sqfs_ls(u_boot_console): + """ + build_dir = u_boot_console.config.build_dir + ++ # If the EFI subsystem is enabled, default file(e.g. EFI/BOOT/BOOTAA64.EFI) ++ # is scanned when the new disk is detected. This ends up with the unexpected ++ # output at the first 'sqfsls' command. ++ # Clear the previous state. ++ u_boot_console.restart_uboot() ++ + # setup test environment + check_mksquashfs_version() + generate_sqfs_src_dir(build_dir) From d9dd20bdd05472ae2e3d0a81e6e5469d69341887 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 23 Oct 2023 15:42:39 +0100 Subject: [PATCH 015/128] Further potential upstream fixes --- ...all-bootdevs-in-a-boot_targets-entry.patch | 213 ------ ...d-Test-and-boot_targets-improvements.patch | 626 ++++++++++++++++++ uboot-tools.spec | 10 +- 3 files changed, 633 insertions(+), 216 deletions(-) delete mode 100644 bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch create mode 100644 bootstd-Test-and-boot_targets-improvements.patch diff --git a/bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch b/bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch deleted file mode 100644 index 8ab2759..0000000 --- a/bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch +++ /dev/null @@ -1,213 +0,0 @@ -From patchwork Sat Sep 23 20:50:15 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Simon Glass -X-Patchwork-Id: 1838641 -X-Patchwork-Delegate: sjg@chromium.org -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 - header.s=google header.b=KG3aXwv5; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4RtLr82vCNz1ynH - for ; Sun, 24 Sep 2023 06:50:30 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id C5750868D8; - Sat, 23 Sep 2023 22:50:24 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -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=chromium.org header.i=@chromium.org - header.b="KG3aXwv5"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id E66458698D; Sat, 23 Sep 2023 22:50:23 +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 mail-io1-xd35.google.com (mail-io1-xd35.google.com - [IPv6:2607:f8b0:4864:20::d35]) - (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 739828684C - for ; Sat, 23 Sep 2023 22:50:21 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sjg@chromium.org -Received: by mail-io1-xd35.google.com with SMTP id - ca18e2360f4ac-79fa4ff8220so82788439f.3 - for ; Sat, 23 Sep 2023 13:50:21 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=chromium.org; s=google; t=1695502220; x=1696107020; darn=lists.denx.de; - h=content-transfer-encoding:mime-version:message-id:date:subject:cc - :to:from:from:to:cc:subject:date:message-id:reply-to; - bh=fcy5WkVBoc7uoRrzJTdjAvllGuUSUwfIiQ5P7MPqanU=; - b=KG3aXwv5HvtWYkt2G7n3DcwAsa2xdEa6uyrBRWhucS+3OUN5eZ79edhY+dVDuwuEAL - I/Ci/8cflRdX1s9cv7mPYw2tXHkWnudM3Jwyw+72113wGGZG+e1q9i0wvb+MmxxK4lDM - ApdxnzfJunDfWMC4zu0PhcdG39ZcuC82Ezgcc= -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1695502220; x=1696107020; - h=content-transfer-encoding:mime-version:message-id:date:subject:cc - :to:from:x-gm-message-state:from:to:cc:subject:date:message-id - :reply-to; - bh=fcy5WkVBoc7uoRrzJTdjAvllGuUSUwfIiQ5P7MPqanU=; - b=UNAm2llXUYdkTNewaIJpX2/kKkDsigJYBX1Ch147g7NChNygnu0Glr6Ya3Cw6WpHIG - OzXCeyakwC/pjiea0NTxHVU01HvJOlAiZwBZoQMMnavjUuSAdMqDCSLIndWzRhOARHfS - ksVozUDoXyyT/gV0XsaczFQgdgBImzMU7OR4NRnNalhSl2iZqYqt/TJ3Ftciv0KfxrcB - CrNKVLlJySDCY+svy4oHY0uID6SHsIAGjKBEAE1x9VhZ1jtpTJE4Zzrqa4nrrt+oEgus - A44BAwUrpks5SSMYfllyvb2A/OavxCiknMLIS7ENPr4izxS2EvAZcqH0KhFUUzD5aDXf - XmKg== -X-Gm-Message-State: AOJu0YwjY6Rk6HbA8DutFJQwzzA4q1TI/KwnuD1ZteWezSPjeMGyx26P - qvXFutS0QtYRlcVbGETlNS4BhMXg2YyAsItRSoI= -X-Google-Smtp-Source: - AGHT+IE/HwkByEI0cMcKWYghOMoUVXCzjV4a68DB17kNo1TCDUCCFa07idjIRi4hzVA51WQbE/JX/w== -X-Received: by 2002:a05:6e02:19cd:b0:34f:f5a4:3e68 with SMTP id - r13-20020a056e0219cd00b0034ff5a43e68mr4812478ill.30.1695502219881; - Sat, 23 Sep 2023 13:50:19 -0700 (PDT) -Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. - [73.14.173.85]) by smtp.gmail.com with ESMTPSA id - i8-20020a056e020ec800b0034fda29890asm691408ilk.10.2023.09.23.13.50.19 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Sat, 23 Sep 2023 13:50:19 -0700 (PDT) -From: Simon Glass -To: U-Boot Mailing List -Cc: Date Huang , Tom Rini , - =?utf-8?q?Vincent_Stehl=C3=A9?= , - Simon Glass -Subject: [PATCH] bootstd: Scan all bootdevs in a boot_targets entry -Date: Sat, 23 Sep 2023 14:50:15 -0600 -Message-ID: <20230923205017.1754340-1-sjg@chromium.org> -X-Mailer: git-send-email 2.42.0.515.g380fc7ccd1-goog -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 - -When the boot_targets environment variable is used with the distro-boot -scripts, each device is included individually. For example, if there -are three mmc devices, then we will have something like: - - boot_targets="mmc0 mmc1 mmc2" - -In contrast, standard boot supports specifying just the uclass, i.e.: - - boot_targets="mmc" - -The intention is that this should scan all MMC devices, but in fact it -currently only scans the first. - -Update the logic to handle this case, without required BOOTSTD_FULL to -be enabled. - -I believe at least three people reported this, but I found two. - -Signed-off-by: Simon Glass -Reported-by: Date Huang -Reported-by: Vincent Stehlé ---- - - boot/bootdev-uclass.c | 3 ++- - boot/bootflow.c | 21 +++++++++++++++++++-- - test/boot/bootdev.c | 10 ++++++++++ - 3 files changed, 31 insertions(+), 3 deletions(-) - -diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c -index fa52bc3a9c4e..5a60cf223c79 100644 ---- a/boot/bootdev-uclass.c -+++ b/boot/bootdev-uclass.c -@@ -460,10 +460,11 @@ int bootdev_find_by_label(const char *label, struct udevice **devp, - * if no sequence number was provided, we must scan all - * bootdevs for this media uclass - */ -- if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && seq == -1) -+ if (seq == -1) - method_flags |= BOOTFLOW_METHF_SINGLE_UCLASS; - if (method_flagsp) - *method_flagsp = method_flags; -+ log_debug("method flags %x\n", method_flags); - return 0; - } - log_debug("- no device in %s\n", media->name); -diff --git a/boot/bootflow.c b/boot/bootflow.c -index 81b5829d5b37..74abf3e17d7e 100644 ---- a/boot/bootflow.c -+++ b/boot/bootflow.c -@@ -260,8 +260,25 @@ static int iter_incr(struct bootflow_iter *iter) - } else { - log_debug("labels %p\n", iter->labels); - if (iter->labels) { -- ret = bootdev_next_label(iter, &dev, -- &method_flags); -+ /* -+ * when the label is "mmc" we want to scan all -+ * mmc bootdevs, not just the first. See -+ * bootdev_find_by_label() where this flag is -+ * set up -+ */ -+ if (iter->method_flags & BOOTFLOW_METHF_SINGLE_UCLASS) { -+ uclass_next_device(&dev); -+ log_debug("looking for next device %s: %s\n", -+ iter->dev->name, -+ dev ? dev->name : ""); -+ } else { -+ dev = NULL; -+ } -+ if (!dev) { -+ log_debug("looking at next label\n"); -+ ret = bootdev_next_label(iter, &dev, -+ &method_flags); -+ } - } else { - ret = bootdev_next_prio(iter, &dev); - method_flags = 0; -diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c -index 6b29213416db..c5f14a7a1323 100644 ---- a/test/boot/bootdev.c -+++ b/test/boot/bootdev.c -@@ -221,6 +221,16 @@ static int bootdev_test_order(struct unit_test_state *uts) - ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); - bootflow_iter_uninit(&iter); - -+ /* Make sure it scans a bootdevs in each target */ -+ ut_assertok(env_set("boot_targets", "mmc spi")); -+ ut_asserteq(0, bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); -+ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); -+ ut_asserteq(3, iter.num_devs); -+ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); -+ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); -+ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); -+ bootflow_iter_uninit(&iter); -+ - return 0; - } - BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); diff --git a/bootstd-Test-and-boot_targets-improvements.patch b/bootstd-Test-and-boot_targets-improvements.patch new file mode 100644 index 0000000..68f1223 --- /dev/null +++ b/bootstd-Test-and-boot_targets-improvements.patch @@ -0,0 +1,626 @@ +From patchwork Mon Oct 23 07:02:11 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Simon Glass +X-Patchwork-Id: 1853514 +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 + header.s=google header.b=ft1tNW5r; + 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 4SDR4l2QBzz202k + for ; Mon, 23 Oct 2023 18:04:07 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 3591D87893; + Mon, 23 Oct 2023 09:03:57 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +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=chromium.org header.i=@chromium.org + header.b="ft1tNW5r"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 74EC18789D; Mon, 23 Oct 2023 09:03:55 +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 mail-oi1-x22f.google.com (mail-oi1-x22f.google.com + [IPv6:2607:f8b0:4864:20::22f]) + (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 5F22E87874 + for ; Mon, 23 Oct 2023 09:03:53 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sjg@chromium.org +Received: by mail-oi1-x22f.google.com with SMTP id + 5614622812f47-3b2ea7cca04so2216594b6e.2 + for ; Mon, 23 Oct 2023 00:03:53 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=chromium.org; s=google; t=1698044632; x=1698649432; darn=lists.denx.de; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=cIwvqOWntoH56aVh+uK5vSKMw8BFeAK+5xfygEqOPIs=; + b=ft1tNW5rHnnlnf552nQnVvJdgHJqUOIPR89PZQ12NUAyrlDzlzOEdzF55vs0bmokXJ + czzGmRw8FwBvmzO/fekIxGsNzg40U5ypkgqj13Plvj07iGgJvNLbwmOGyYwpTD86eBO8 + HxWQUCwgkoFZldu1VLcZHUzw69U1vUVcLpDqE= +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1698044632; x=1698649432; + 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=cIwvqOWntoH56aVh+uK5vSKMw8BFeAK+5xfygEqOPIs=; + b=AvcWPKPeRESlQnvwva3Yydv23E8Q1GOx+sH830m0arYUvEW4+J/TkXRzyM0Z8amaDR + 4dvztcY+Hh54LqVGw9cD0R65sHvXrvqUPURdBpVFT3yX2LhoN7ZxPD1EcKy9Hqr3ATlJ + 9eOCuyD+UHHeMAIvdTR918uaO5Bja38XSaNAzNV57JBYkDgWJeNK9OBHBuJj2Y2sTNZ1 + poF5sGH839p3nx69X+ImsEwsgz8JIZFnwe4WBsXMMM13hVQ1ZDpdhKzKI7ai1jE67Ixo + 4hOXD6ACVKkBijBRqW8t2V1Wf12AAun1z+mrhyFaq/UgyxuplGyHQHWGmwL7maxTzdVv + IX4A== +X-Gm-Message-State: AOJu0YwtYv7Lh6kUp+eOTO6dV8tIAMnl+FJU9kPSXGHNBjxPmbWNgo0/ + gEs6R/iZt+vLqxRzuubv1ROzFkNfj6SlCXza5g7l1A== +X-Google-Smtp-Source: + AGHT+IHvJm5/lr6rXt08U65SxntTogh09qTfiLs2+CF8IjsSnkkTeqbhy/o2f2YjHn0GHRZ0TtCNpA== +X-Received: by 2002:a05:6808:e85:b0:3b2:d8cb:8e14 with SMTP id + k5-20020a0568080e8500b003b2d8cb8e14mr11558910oil.28.1698044631920; + Mon, 23 Oct 2023 00:03:51 -0700 (PDT) +Received: from sjg1.roam.corp.google.com ([202.144.206.130]) + by smtp.gmail.com with ESMTPSA id + u187-20020a6279c4000000b006bde8e1f0adsm5910841pfc.98.2023.10.23.00.03.49 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 23 Oct 2023 00:03:51 -0700 (PDT) +From: Simon Glass +To: U-Boot Mailing List +Cc: Heinrich Schuchardt , + Guillaume Gardet , Tom Rini , + Simon Glass +Subject: [PATCH 2/4] bootstd: Expand boot-ordering test to include USB +Date: Mon, 23 Oct 2023 00:02:11 -0700 +Message-ID: + <20231023000211.2.I9d49d1e28d3ef75af768dc20bb491e4c82e4ab76@changeid> +X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog +In-Reply-To: <20231023070216.394709-1-sjg@chromium.org> +References: <20231023070216.394709-1-sjg@chromium.org> +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 + +Scan the USB bus as well, so we can check that different uclasses work +correctly in boot_targets + +update the function comment with more detail. + +Signed-off-by: Simon Glass +--- + + test/boot/bootdev.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c +index 6b29213416db..7228f545e9e6 100644 +--- a/test/boot/bootdev.c ++++ b/test/boot/bootdev.c +@@ -190,12 +190,21 @@ static int bootdev_test_any(struct unit_test_state *uts) + BOOTSTD_TEST(bootdev_test_any, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_ETH_BOOTDEV); + +-/* Check bootdev ordering with the bootdev-order property */ ++/* ++ * Check bootdev ordering with the bootdev-order property and boot_targets ++ * environment variable ++ */ + static int bootdev_test_order(struct unit_test_state *uts) + { + struct bootflow_iter iter; + struct bootflow bflow; + ++ test_set_skip_delays(true); ++ ++ /* Start up USB which gives us three additional bootdevs */ ++ usb_started = false; ++ ut_assertok(run_command("usb start", 0)); ++ + /* + * First try the order set by the bootdev-order property + * Like all sandbox unit tests this relies on the devicetree setting up +@@ -213,12 +222,14 @@ static int bootdev_test_order(struct unit_test_state *uts) + bootflow_iter_uninit(&iter); + + /* Use the environment variable to override it */ +- ut_assertok(env_set("boot_targets", "mmc1 mmc2")); ++ ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb")); + ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); +- ut_asserteq(2, iter.num_devs); ++ ut_asserteq(3, iter.num_devs); + ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name); + ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("usb_mass_storage.lun0.bootdev", ++ iter.dev_used[2]->name); + bootflow_iter_uninit(&iter); + + return 0; + +From patchwork Mon Oct 23 07:02:12 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Simon Glass +X-Patchwork-Id: 1853515 +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 + header.s=google header.b=aYxxWBdy; + 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 4SDR4z5WcTz202k + for ; Mon, 23 Oct 2023 18:04:19 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id A279B878A9; + Mon, 23 Oct 2023 09:03:59 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +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=chromium.org header.i=@chromium.org + header.b="aYxxWBdy"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 231CE878B2; Mon, 23 Oct 2023 09:03:59 +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 mail-pf1-x431.google.com (mail-pf1-x431.google.com + [IPv6:2607:f8b0:4864:20::431]) + (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 E9DE187874 + for ; Mon, 23 Oct 2023 09:03:56 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sjg@chromium.org +Received: by mail-pf1-x431.google.com with SMTP id + d2e1a72fcca58-6bd73395bceso2113746b3a.0 + for ; Mon, 23 Oct 2023 00:03:56 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=chromium.org; s=google; t=1698044635; x=1698649435; darn=lists.denx.de; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=8b4yhHi8HkVDVyxmZZ8a/B9oJfD95880A8O7ScnCUlA=; + b=aYxxWBdy/wJMQ/tjjK8Fxa3hq2jB+RQ/GZvaC5Z3WX/PHTfrcBBEncxnUjhKGVpRDX + W+KcG58tqawI84z5bFLFL0b9sW2fogOlQatvQajdAUe47BPNqB6QAhnJi9Kz7r/r9Gs6 + NNgvS1a0l6YIH9C//eL4UL+4CZAI3w/xuJglw= +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1698044635; x=1698649435; + 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=8b4yhHi8HkVDVyxmZZ8a/B9oJfD95880A8O7ScnCUlA=; + b=I5RQ7op3C0RGr709+nlAxagLQLSvqp2mbM2boS7Q037eSoibAVpk4mZ4eybB3mgH7s + CU7QPLmTk89Z+nypz02nbdWiiDUxCGGmjyWllc8F1lpiyjdILqp5njd+8mukVbhujjua + wbRX/7IaEywz0hp5/4jlTO+cz+b6t8VrLGXFFR8MJNzfchp2hHCRDypg8K/GlpfN9Vrh + SeZuMbw7X3R9vJf+qkLzCYC4bKuMUFgXrXnL/ZNgq+cmMfXFwT5f92+aIq8MvTuIIJMI + krBCjES1iIXXHLKw7aF3b1EC0+alfvtIAfIjK8UhAiTW019VbZ/uyxJbG+XG2ZLxkJPB + QhTQ== +X-Gm-Message-State: AOJu0YxXE6hDpzTCrR02q/+ia8kFUD/3VJLYeldwCaUAM/ZjNFiglRSk + N+4b2ozl4hRwo7qO57OeOxowm5MFBDGdy9h+8WGPjQ== +X-Google-Smtp-Source: + AGHT+IEjnpgei2u9GBHpMxAqISqdKlCrvD572cRfntnploYm1RPfc2ermsDOfWBp72z4zSgZo07dRw== +X-Received: by 2002:a05:6a00:1817:b0:68e:3616:604a with SMTP id + y23-20020a056a00181700b0068e3616604amr11976822pfa.8.1698044635168; + Mon, 23 Oct 2023 00:03:55 -0700 (PDT) +Received: from sjg1.roam.corp.google.com ([202.144.206.130]) + by smtp.gmail.com with ESMTPSA id + u187-20020a6279c4000000b006bde8e1f0adsm5910841pfc.98.2023.10.23.00.03.52 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 23 Oct 2023 00:03:54 -0700 (PDT) +From: Simon Glass +To: U-Boot Mailing List +Cc: Heinrich Schuchardt , + Guillaume Gardet , Tom Rini , + Simon Glass +Subject: [PATCH 3/4] bootstd: Correct logic for single uclass +Date: Mon, 23 Oct 2023 00:02:12 -0700 +Message-ID: + <20231023000211.3.Icefe7db8f3c1ddc3624f95ca5dc89b81ef97eab4@changeid> +X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog +In-Reply-To: <20231023070216.394709-1-sjg@chromium.org> +References: <20231023070216.394709-1-sjg@chromium.org> +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 current logic for "bootflow mmc" is flawed since it checks the +uclass of the bootdev instead of its parent, the media device. Correct +this and add a test that covers this scenario. + +Signed-off-by: Simon Glass +--- + + boot/bootflow.c | 24 ++++++++++++++++++++++-- + test/boot/bootdev.c | 13 +++++++++++++ + 2 files changed, 35 insertions(+), 2 deletions(-) + +diff --git a/boot/bootflow.c b/boot/bootflow.c +index 6ef62e1d1896..7f5b0e942078 100644 +--- a/boot/bootflow.c ++++ b/boot/bootflow.c +@@ -155,6 +155,27 @@ static void bootflow_iter_set_dev(struct bootflow_iter *iter, + } + } + ++/** ++ * scan_next_in_uclass() - Scan for the next bootdev in the same media uclass ++ * ++ * Move through the following bootdevs until we find another in this media ++ * uclass, or run out ++ * ++ * @devp: On entry, the device to check, on exit the new device, or NULL if ++ * there is none ++ */ ++static void scan_next_in_uclass(struct udevice **devp) ++{ ++ struct udevice *dev = *devp; ++ enum uclass_id cur_id = device_get_uclass_id(dev->parent); ++ ++ do { ++ uclass_find_next_device(&dev); ++ } while (dev && cur_id != device_get_uclass_id(dev->parent)); ++ ++ *devp = dev; ++} ++ + /** + * iter_incr() - Move to the next item (method, part, bootdev) + * +@@ -230,8 +251,7 @@ static int iter_incr(struct bootflow_iter *iter) + &method_flags); + } else if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && + (iter->flags & BOOTFLOWIF_SINGLE_UCLASS)) { +- /* Move to the next bootdev in this uclass */ +- uclass_find_next_device(&dev); ++ scan_next_in_uclass(&dev); + if (!dev) { + log_debug("finished uclass %s\n", + dev_get_uclass_name(dev)); +diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c +index 7228f545e9e6..637861748057 100644 +--- a/test/boot/bootdev.c ++++ b/test/boot/bootdev.c +@@ -232,6 +232,19 @@ static int bootdev_test_order(struct unit_test_state *uts) + iter.dev_used[2]->name); + bootflow_iter_uninit(&iter); + ++ /* Try a single uclass */ ++ ut_assertok(env_set("boot_targets", NULL)); ++ ut_assertok(bootflow_scan_first(NULL, "mmc", &iter, 0, &bflow)); ++ ut_asserteq(2, iter.num_devs); ++ ++ /* Now scan pass mmc1 and make sure that only mmc0 shows up */ ++ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ++ ut_asserteq(3, iter.num_devs); ++ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); ++ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); ++ bootflow_iter_uninit(&iter); ++ + return 0; + } + BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); + +From patchwork Mon Oct 23 07:02:13 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Simon Glass +X-Patchwork-Id: 1853516 +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 + header.s=google header.b=g7MVFEGd; + 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 4SDR5C2s5gz202k + for ; Mon, 23 Oct 2023 18:04:31 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 1A36A87880; + Mon, 23 Oct 2023 09:04:04 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +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=chromium.org header.i=@chromium.org + header.b="g7MVFEGd"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 2EC9687897; Mon, 23 Oct 2023 09:04:03 +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 mail-oi1-x22d.google.com (mail-oi1-x22d.google.com + [IPv6:2607:f8b0:4864:20::22d]) + (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 F1B5887880 + for ; Mon, 23 Oct 2023 09:04:00 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=chromium.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sjg@chromium.org +Received: by mail-oi1-x22d.google.com with SMTP id + 5614622812f47-3af604c3f8fso2266068b6e.1 + for ; Mon, 23 Oct 2023 00:04:00 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=chromium.org; s=google; t=1698044639; x=1698649439; darn=lists.denx.de; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=ZQHdVZoqu6vL//0Rc8e1SX1+2VK3djq3hW1NDOA/VUc=; + b=g7MVFEGdmwlVgYbQvsUlLUH8u5YdqRAZZ7IGvJkKw+t9TgR7CBLAz6FTbcUqCf7ix3 + ka6wz36z3I7e9+8Vu/XxtfjMh+FsE2MmR1pR8WtODlM2rNTfjAL7SzMzFwNNdBolnbaF + YEgrsCKckVERiDmY6ZcR1st7af2v4Zd3IMEjU= +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1698044639; x=1698649439; + 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=ZQHdVZoqu6vL//0Rc8e1SX1+2VK3djq3hW1NDOA/VUc=; + b=dmetYCxcqOdjG06nNcEgNsHTXN2i2yJe2yaTu9+igYWthZh3jBPskXE+lqfItnIeWl + 7Ti/qjE0EfHZfEfg2qVDuxSbj3zUqB8FRtcGV9rNXUn6NCsu3+zbWL03hsVUpc3vryFx + jWRyDrV2iQXJFbTcXuutCHCXNMwcCuHwGgN1nSfK/4Dxxw4T8y/c0y2O8gb1V3cURCB4 + iIUvgFjuI6Cr+EVLkWuTmm292mJryz7Wnj14Gvh1f3kgdWqfDOCJHBmSu2DImC0KGlsU + 5OwVzpagMZfWwuofbsHzRRvhzjEWAFhbwaIB7TeQMQBQfO+eAJ4ItsCll1m4KCusAJtm + fq2w== +X-Gm-Message-State: AOJu0YyL+7DxZXljBQhaS2gWBuhvR5uESsc040WsnLpteLMvL8txONvN + ASxmZ+0rltdSHxuUUw73ZNSNctboaLQkz2ygO4kSZg== +X-Google-Smtp-Source: + AGHT+IEn4DDw7VvfhcVhjZx6AfZZp+iDzM6s6RxSA4wM8oGRbEEwrJxjkMtDfxGtuPQjJkuiEWQW+w== +X-Received: by 2002:a05:6808:4d4:b0:3a7:44da:d5e6 with SMTP id + a20-20020a05680804d400b003a744dad5e6mr9586643oie.38.1698044639506; + Mon, 23 Oct 2023 00:03:59 -0700 (PDT) +Received: from sjg1.roam.corp.google.com ([202.144.206.130]) + by smtp.gmail.com with ESMTPSA id + u187-20020a6279c4000000b006bde8e1f0adsm5910841pfc.98.2023.10.23.00.03.55 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Mon, 23 Oct 2023 00:03:59 -0700 (PDT) +From: Simon Glass +To: U-Boot Mailing List +Cc: Heinrich Schuchardt , + Guillaume Gardet , Tom Rini , + Simon Glass , Date Huang , + =?utf-8?q?Vincent_Stehl=C3=A9?= , + Ivan Ivanov +Subject: [PATCH 4/4] bootstd: Scan all bootdevs in a boot_targets entry (take + 2) +Date: Mon, 23 Oct 2023 00:02:13 -0700 +Message-ID: + <20231023000211.4.Ie4e7ba290d4957a88bebf306ca39f46618d9c363@changeid> +X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog +In-Reply-To: <20231023070216.394709-1-sjg@chromium.org> +References: <20231023070216.394709-1-sjg@chromium.org> +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 + +When the boot_targets environment variable is used with the distro-boot +scripts, each device is included individually. For example, if there +are three mmc devices, then we will have something like: + + boot_targets="mmc0 mmc1 mmc2" + +In contrast, standard boot supports specifying just the uclass, i.e.: + + boot_targets="mmc" + +The intention is that this should scan all MMC devices, but in fact it +currently only scans the first. + +Update the logic to handle this case, without required BOOTSTD_FULL to +be enabled. + +Signed-off-by: Simon Glass +Reported-by: Date Huang +Reported-by: Vincent Stehlé +Reported-by: Ivan Ivanov +--- + + boot/bootdev-uclass.c | 3 ++- + boot/bootflow.c | 22 ++++++++++++++++++++-- + test/boot/bootdev.c | 32 ++++++++++++++++++++++++++++++-- + 3 files changed, 52 insertions(+), 5 deletions(-) + +diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c +index 974ddee5d2fa..44ae98a9269c 100644 +--- a/boot/bootdev-uclass.c ++++ b/boot/bootdev-uclass.c +@@ -469,10 +469,11 @@ int bootdev_find_by_label(const char *label, struct udevice **devp, + * if no sequence number was provided, we must scan all + * bootdevs for this media uclass + */ +- if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && seq == -1) ++ if (seq == -1) + method_flags |= BOOTFLOW_METHF_SINGLE_UCLASS; + if (method_flagsp) + *method_flagsp = method_flags; ++ log_debug("method flags %x\n", method_flags); + return 0; + } + log_debug("- no device in %s\n", media->name); +diff --git a/boot/bootflow.c b/boot/bootflow.c +index 7f5b0e942078..be543c8588cc 100644 +--- a/boot/bootflow.c ++++ b/boot/bootflow.c +@@ -280,8 +280,26 @@ static int iter_incr(struct bootflow_iter *iter) + } else { + log_debug("labels %p\n", iter->labels); + if (iter->labels) { +- ret = bootdev_next_label(iter, &dev, +- &method_flags); ++ /* ++ * when the label is "mmc" we want to scan all ++ * mmc bootdevs, not just the first. See ++ * bootdev_find_by_label() where this flag is ++ * set up ++ */ ++ if (iter->method_flags & ++ BOOTFLOW_METHF_SINGLE_UCLASS) { ++ scan_next_in_uclass(&dev); ++ log_debug("looking for next device %s: %s\n", ++ iter->dev->name, ++ dev ? dev->name : ""); ++ } else { ++ dev = NULL; ++ } ++ if (!dev) { ++ log_debug("looking at next label\n"); ++ ret = bootdev_next_label(iter, &dev, ++ &method_flags); ++ } + } else { + ret = bootdev_next_prio(iter, &dev); + method_flags = 0; +diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c +index 637861748057..0702fccdae60 100644 +--- a/test/boot/bootdev.c ++++ b/test/boot/bootdev.c +@@ -225,7 +225,7 @@ static int bootdev_test_order(struct unit_test_state *uts) + ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb")); + ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); +- ut_asserteq(3, iter.num_devs); ++ ut_asserteq(5, iter.num_devs); + ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name); + ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); + ut_asserteq_str("usb_mass_storage.lun0.bootdev", +@@ -237,7 +237,20 @@ static int bootdev_test_order(struct unit_test_state *uts) + ut_assertok(bootflow_scan_first(NULL, "mmc", &iter, 0, &bflow)); + ut_asserteq(2, iter.num_devs); + +- /* Now scan pass mmc1 and make sure that only mmc0 shows up */ ++ /* Now scan past mmc1 and make sure that only mmc0 shows up */ ++ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ++ ut_asserteq(3, iter.num_devs); ++ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); ++ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); ++ bootflow_iter_uninit(&iter); ++ ++ /* Try a single uclass with boot_targets */ ++ ut_assertok(env_set("boot_targets", "mmc")); ++ ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); ++ ut_asserteq(2, iter.num_devs); ++ ++ /* Now scan past mmc1 and make sure that only mmc0 shows up */ + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); + ut_asserteq(3, iter.num_devs); + ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); +@@ -245,6 +258,21 @@ static int bootdev_test_order(struct unit_test_state *uts) + ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); + bootflow_iter_uninit(&iter); + ++ /* Try a single uclass with boot_targets */ ++ ut_assertok(env_set("boot_targets", "mmc usb")); ++ ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); ++ ut_asserteq(2, iter.num_devs); ++ ++ /* Now scan past mmc1 and make sure that the 3 USB devices show up */ ++ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ++ ut_asserteq(6, iter.num_devs); ++ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); ++ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); ++ ut_asserteq_str("usb_mass_storage.lun0.bootdev", ++ iter.dev_used[3]->name); ++ bootflow_iter_uninit(&iter); ++ + return 0; + } + BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); diff --git a/uboot-tools.spec b/uboot-tools.spec index d4ae06f..931adf6 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2023.10 -Release: 0.7%{?candidate:.%{candidate}}%{?dist} +Release: 0.8%{?candidate:.%{candidate}}%{?dist} Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -16,12 +16,13 @@ ExcludeArch: s390x Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}%{?candidate:-%{candidate}}.tar.bz2 Source1: aarch64-boards -Patch1: uefi-Boot-var-automatic-management-for-removable-medias.patch +Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch Patch2: smbios-Simplify-reporting-of-unknown-values.patch Patch3: disable-VBE-by-default.patch Patch4: enable-bootmenu-by-default.patch Patch5: Add-video-damage-tracking.patch -Patch6: bootstd-Scan-all-bootdevs-in-a-boot_targets-entry.patch +Patch6: uefi-Boot-var-automatic-management-for-removable-medias.patch +Patch7: bootstd-Test-and-boot_targets-improvements.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support @@ -213,6 +214,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Mon Oct 23 2023 Peter Robinson - 2023.10-0.8 +- Further potential upstream fixes + * Mon Oct 02 2023 Peter Robinson - 2023.10-0.7 - Update to 2023.10 GA - Some upstream fixes From f1d098b8a047795f7e510498357361467f618fab Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 31 Oct 2023 11:41:30 +0000 Subject: [PATCH 016/128] Add epoch --- uboot-tools.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 931adf6..4706710 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,8 @@ Name: uboot-tools Version: 2023.10 -Release: 0.8%{?candidate:.%{candidate}}%{?dist} +Release: 0.9%{?candidate:.%{candidate}}%{?dist} +Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ URL: http://www.denx.de/wiki/U-Boot @@ -214,6 +215,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Tue Oct 31 2023 Peter Robinson - 1:2023.10-0.9 +- Rebuild + * Mon Oct 23 2023 Peter Robinson - 2023.10-0.8 - Further potential upstream fixes From 69521310e4200bb293a5a3cafa30926a9caa4885 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 24 Nov 2023 17:34:22 +0000 Subject: [PATCH 017/128] 2024.01 RC3 --- ...Simplify-reporting-of-unknown-values.patch | 115 ++++ ...to-the-default-DT-if-sysinfo-nodes-a.patch | 242 ++++++++ ...Simplify-reporting-of-unknown-values.patch | 544 ------------------ sources | 2 +- uboot-tools.spec | 20 +- 5 files changed, 370 insertions(+), 553 deletions(-) create mode 100644 0001-smbios-Simplify-reporting-of-unknown-values.patch create mode 100644 0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch delete mode 100644 smbios-Simplify-reporting-of-unknown-values.patch diff --git a/0001-smbios-Simplify-reporting-of-unknown-values.patch b/0001-smbios-Simplify-reporting-of-unknown-values.patch new file mode 100644 index 0000000..6fd5dde --- /dev/null +++ b/0001-smbios-Simplify-reporting-of-unknown-values.patch @@ -0,0 +1,115 @@ +From 6eb1fce7ca692b211ca467040cfe25a750ecc0fe Mon Sep 17 00:00:00 2001 +From: Ilias Apalodimas +Date: Tue, 6 Sep 2022 16:44:25 +0300 +Subject: [PATCH 1/2] smbios: Simplify reporting of unknown values + +If a value is not valid during the DT or SYSINFO parsing, we explicitly +set that to "Unknown Product" and "Unknown" for the product and +manufacturer respectively. It's cleaner if we move the checks insisde +smbios_add_string() and always report "Unknown" regardless of the missing +field. + +pre-patch dmidecode + +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: Unknown + Product Name: Unknown Product + Version: Not Specified + Serial Number: Not Specified + UUID: Not Settable + Wake-up Type: Reserved + SKU Number: Not Specified + Family: Not Specified + +[...] + +post-patch dmidecode: + +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: Unknown + Product Name: Unknown + Version: Unknown + Serial Number: Unknown + UUID: Not Settable + Wake-up Type: Reserved + SKU Number: Unknown + Family: Unknown +[...] + +Signed-off-by: Ilias Apalodimas +Reviewed-by: Peter Robinson +Tested-by: Peter Robinson +--- + lib/smbios.c | 17 +++-------------- + 1 file changed, 3 insertions(+), 14 deletions(-) + +diff --git a/lib/smbios.c b/lib/smbios.c +index d7f4999e8b2a..fcc8686993ef 100644 +--- a/lib/smbios.c ++++ b/lib/smbios.c +@@ -102,7 +102,7 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) + int i = 1; + char *p = ctx->eos; + +- if (!*str) ++ if (!str || !*str) + str = "Unknown"; + + for (;;) { +@@ -151,8 +151,7 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, + const char *str; + + str = ofnode_read_string(ctx->node, prop); +- if (str) +- return smbios_add_string(ctx, str); ++ return smbios_add_string(ctx, str); + } + + return 0; +@@ -231,7 +230,7 @@ static int smbios_write_type0(ulong *current, int handle, + t->vendor = smbios_add_string(ctx, "U-Boot"); + + t->bios_ver = smbios_add_prop(ctx, "version"); +- if (!t->bios_ver) ++ if (!strcmp(ctx->last_str, "Unknown")) + t->bios_ver = smbios_add_string(ctx, PLAIN_VERSION); + if (t->bios_ver) + gd->smbios_version = ctx->last_str; +@@ -281,11 +280,7 @@ static int smbios_write_type1(ulong *current, int handle, + fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle); + smbios_set_eos(ctx, t->eos); + t->manufacturer = smbios_add_prop(ctx, "manufacturer"); +- if (!t->manufacturer) +- t->manufacturer = smbios_add_string(ctx, "Unknown"); + t->product_name = smbios_add_prop(ctx, "product"); +- if (!t->product_name) +- t->product_name = smbios_add_string(ctx, "Unknown Product"); + t->version = smbios_add_prop_si(ctx, "version", + SYSINFO_ID_SMBIOS_SYSTEM_VERSION); + if (serial_str) { +@@ -315,11 +310,7 @@ static int smbios_write_type2(ulong *current, int handle, + fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle); + smbios_set_eos(ctx, t->eos); + t->manufacturer = smbios_add_prop(ctx, "manufacturer"); +- if (!t->manufacturer) +- t->manufacturer = smbios_add_string(ctx, "Unknown"); + t->product_name = smbios_add_prop(ctx, "product"); +- if (!t->product_name) +- t->product_name = smbios_add_string(ctx, "Unknown Product"); + t->version = smbios_add_prop_si(ctx, "version", + SYSINFO_ID_SMBIOS_BASEBOARD_VERSION); + t->asset_tag_number = smbios_add_prop(ctx, "asset-tag"); +@@ -344,8 +335,6 @@ static int smbios_write_type3(ulong *current, int handle, + fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle); + smbios_set_eos(ctx, t->eos); + t->manufacturer = smbios_add_prop(ctx, "manufacturer"); +- if (!t->manufacturer) +- t->manufacturer = smbios_add_string(ctx, "Unknown"); + t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP; + t->bootup_state = SMBIOS_STATE_SAFE; + t->power_supply_state = SMBIOS_STATE_SAFE; +-- +2.40.1 + diff --git a/0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch b/0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch new file mode 100644 index 0000000..a256b9b --- /dev/null +++ b/0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch @@ -0,0 +1,242 @@ +From ed67997890981fda4f859cb96e523a0ec5b58042 Mon Sep 17 00:00:00 2001 +From: Ilias Apalodimas +Date: Tue, 6 Sep 2022 16:44:26 +0300 +Subject: [PATCH 2/2] smbios: Fallback to the default DT if sysinfo nodes are + missing + +In order to fill in the SMBIOS tables U-Boot currently relies on a +"u-boot,sysinfo-smbios" compatible node. This is fine for the boards +that already include such nodes. However with some recent EFI changes, +the majority of boards can boot up distros, which usually rely on +things like dmidecode etc for their reporting. For boards that +lack this special node the SMBIOS output looks like: + +System Information + Manufacturer: Unknown + Product Name: Unknown + Version: Unknown + Serial Number: Unknown + UUID: Not Settable + Wake-up Type: Reserved + SKU Number: Unknown + Family: Unknown + +This looks problematic since most of the info are "Unknown". The DT spec +specifies standard properties containing relevant information like +'model' and 'compatible' for which the suggested format is +. So let's add a last resort to our current +smbios parsing. If none of the sysinfo properties are found, we can +scan the root node for 'model' and 'compatible'. + +pre-patch dmidecode: + +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: Unknown + Product Name: Unknown + Version: Unknown + Serial Number: Unknown + UUID: Not Settable + Wake-up Type: Reserved + SKU Number: Unknown + Family: Unknown + +Handle 0x0002, DMI type 2, 14 bytes +Base Board Information + Manufacturer: Unknown + Product Name: Unknown + Version: Unknown + Serial Number: Not Specified + Asset Tag: Unknown + Features: + Board is a hosting board + Location In Chassis: Not Specified + Chassis Handle: 0x0000 + Type: Motherboard + +Handle 0x0003, DMI type 3, 21 bytes +Chassis Information + Manufacturer: Unknown + Type: Desktop + Lock: Not Present + Version: Not Specified + Serial Number: Not Specified + Asset Tag: Not Specified + Boot-up State: Safe + Power Supply State: Safe + Thermal State: Safe + Security Status: None + OEM Information: 0x00000000 + Height: Unspecified + Number Of Power Cords: Unspecified + Contained Elements: 0 + + +post-pastch dmidecode: + +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: socionext,developer-box + Product Name: Socionext Developer Box + Version: Unknown + Serial Number: Unknown + UUID: Not Settable + Wake-up Type: Reserved + SKU Number: Unknown + Family: Unknown + +Handle 0x0002, DMI type 2, 14 bytes +Base Board Information + Manufacturer: socionext,developer-box + Product Name: Socionext Developer Box + Version: Unknown + Serial Number: Not Specified + Asset Tag: Unknown + Features: + Board is a hosting board + Location In Chassis: Not Specified + Chassis Handle: 0x0000 + Type: Motherboard + +Handle 0x0003, DMI type 3, 21 bytes +Chassis Information + Manufacturer: socionext,developer-box + Type: Desktop + Lock: Not Present + Version: Not Specified + Serial Number: Not Specified + Asset Tag: Not Specified + Boot-up State: Safe + Power Supply State: Safe + Thermal State: Safe + Security Status: None + OEM Information: 0x00000000 + Height: Unspecified + Number Of Power Cords: Unspecified + Contained Elements: 0 + + +Signed-off-by: Ilias Apalodimas +Reviewed-by: Peter Robinson +Tested-by: Peter Robinson +--- + lib/smbios.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 64 insertions(+), 4 deletions(-) + +diff --git a/lib/smbios.c b/lib/smbios.c +index fcc8686993ef..9c8e34625e65 100644 +--- a/lib/smbios.c ++++ b/lib/smbios.c +@@ -9,11 +9,13 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include ++#include + #ifdef CONFIG_CPU + #include + #include +@@ -43,6 +45,25 @@ + + DECLARE_GLOBAL_DATA_PTR; + ++/** ++ * struct map_sysinfo - Mapping of sysinfo strings to DT ++ * ++ * @sysinfo_str: sysinfo string ++ * @dt_str: DT string ++ * @max: Max index of the tokenized string to pick. First element is 0 ++ * ++ */ ++struct map_sysinfo { ++ const char *sysinfo_str; ++ const char *dt_str; ++ int max; ++}; ++ ++static const struct map_sysinfo sysinfo_to_dt[] = { ++ { .sysinfo_str = "product", .dt_str = "model", 1 }, ++ { .sysinfo_str = "manufacturer", .dt_str = "compatible", 0 }, ++}; ++ + /** + * struct smbios_ctx - context for writing SMBIOS tables + * +@@ -87,6 +108,18 @@ struct smbios_write_method { + const char *subnode_name; + }; + ++static const struct map_sysinfo *convert_sysinfo_to_dt(const char *sysinfo_str) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(sysinfo_to_dt); i++) { ++ if (!strcmp(sysinfo_str, sysinfo_to_dt[i].sysinfo_str)) ++ return &sysinfo_to_dt[i]; ++ } ++ ++ return NULL; ++} ++ + /** + * smbios_add_string() - add a string to the string area + * +@@ -139,19 +172,46 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) + static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, + int sysinfo_id) + { ++ int ret = 0; ++ + if (sysinfo_id && ctx->dev) { + char val[SMBIOS_STR_MAX]; +- int ret; + + ret = sysinfo_get_str(ctx->dev, sysinfo_id, sizeof(val), val); + if (!ret) + return smbios_add_string(ctx, val); + } ++ + if (IS_ENABLED(CONFIG_OF_CONTROL)) { +- const char *str; ++ const char *str = NULL; ++ char str_tmp[128]; ++ char *token; + +- str = ofnode_read_string(ctx->node, prop); +- return smbios_add_string(ctx, str); ++ /* ++ * If the node is not valid fallback and try the entire DT ++ * so we can at least fill in maufacturer and board type ++ */ ++ if (!ofnode_valid(ctx->node)) { ++ const struct map_sysinfo *nprop; ++ ++ nprop = convert_sysinfo_to_dt(prop); ++ if (nprop) { ++ int cnt = 0; ++ ++ str = ofnode_read_string(ofnode_root(), nprop->dt_str); ++ strncpy(str_tmp, str, sizeof(str_tmp)); ++ token = strtok(str_tmp, ","); ++ while (token != NULL && cnt <= nprop->max) { ++ str = token; ++ token = strtok(NULL, ","); ++ cnt++; ++ } ++ } ++ } else { ++ str = ofnode_read_string(ctx->node, prop); ++ } ++ ret = smbios_add_string(ctx, str); ++ return ret; + } + + return 0; +-- +2.40.1 + diff --git a/smbios-Simplify-reporting-of-unknown-values.patch b/smbios-Simplify-reporting-of-unknown-values.patch deleted file mode 100644 index 0aef8e7..0000000 --- a/smbios-Simplify-reporting-of-unknown-values.patch +++ /dev/null @@ -1,544 +0,0 @@ -From patchwork Tue Sep 6 13:44:25 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Ilias Apalodimas -X-Patchwork-Id: 1674857 -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=wUY2RcfH; - 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 ECDSA (P-384)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4MMRT72TCPz1yhd - for ; Tue, 6 Sep 2022 23:44:43 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 498F2849CE; - Tue, 6 Sep 2022 15:44:39 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="wUY2RcfH"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id A8842849CF; Tue, 6 Sep 2022 15:44:37 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com - [IPv6:2a00:1450:4864:20::52d]) - (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 403A5849AA - for ; Tue, 6 Sep 2022 15:44:35 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org -Received: by mail-ed1-x52d.google.com with SMTP id x73so8243364ede.10 - for ; Tue, 06 Sep 2022 06:44:35 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; - h=content-transfer-encoding:mime-version:message-id:date:subject:cc - :to:from:from:to:cc:subject:date; - bh=YBbhuTYZcGSI4FSsstTIADofj6ZEC8vsTpd/U8gWDlU=; - b=wUY2RcfHqhMQ1dgd2my7jtmfsgHjAF8xFa3HnTkB/tUGQL/oQyls7ODcVui/VImHlf - Ah33xwYqK1nwEuoS8HqkWcksTr48pKf/EikkkBbHif0XnfS4oySI3RHo7WW6Yi8HQUoP - tbuQ3LPSYgo+62HaqTYVoJ2g6jc1qiEFe/+y6hR2BfmyKd0g/SxwLS9P1QuQosdhX+uO - DKWWukFYFV06Nn7x/3oiyoXq33VAWatgQBv/sPC7dBgh/EpnobDpI8NhNhJAkFIcAUrU - B91PBwNRtB1Lsf+Eo3WjLtQbinL3h/VvogRSvZEoKCmHY5dbTYB8G1uNzksnK6QecIRu - q9qA== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20210112; - h=content-transfer-encoding:mime-version:message-id:date:subject:cc - :to:from:x-gm-message-state:from:to:cc:subject:date; - bh=YBbhuTYZcGSI4FSsstTIADofj6ZEC8vsTpd/U8gWDlU=; - b=KfQ/P0sYI7szdfgs6GA5oPXctzQ8yfxjRs7PgVHFg7jl09SeFl3jpKzaMGbC7GlEgM - JXt2VP6w9TndL/D71cR8w9BObY2mZJoLRP/s25LpSU6izkisnuueyGeqKegGEfGE+4B3 - 9xaG/EUlPZmHlAem6bOf9Dl6lE5WkT6SnTDopwODIbcTAWlIa8Gjtw9XBaaa8iRnVuTn - S3IwY9R7DLaSFBQXTVHmAYnhCc2b5XCRKlSNwmDE65+LqvOdAu3MTbA5/YyL9pEPjHi9 - 4q0ZQksAE0olpQQwxyjHrvz7h7ktSuJoesa/A4dX3PEbzSbBmPI1CGtPy27/luAUCH3F - e8Vw== -X-Gm-Message-State: ACgBeo2YRons+T+T1+BdP4+uyEFge3LrQ/gS2VYwuVZg325XGZ8HVnXH - Lq8no+qriMaFPrto6+L889ufiYLHsm+dZQ== -X-Google-Smtp-Source: - AA6agR6coLdFIB45xwZJzpltd9Qfi6bEAn6J22G77ibwSDNyt1L1YbxRL9dlK4pmf9A6n2RN31Ug2w== -X-Received: by 2002:aa7:c84f:0:b0:446:2bfb:5a63 with SMTP id - g15-20020aa7c84f000000b004462bfb5a63mr17498596edt.172.1662471874779; - Tue, 06 Sep 2022 06:44:34 -0700 (PDT) -Received: from localhost.localdomain ([46.103.15.185]) - by smtp.gmail.com with ESMTPSA id - p23-20020a056402501700b0043ba7df7a42sm8473330eda.26.2022.09.06.06.44.33 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Tue, 06 Sep 2022 06:44:34 -0700 (PDT) -From: Ilias Apalodimas -To: u-boot@lists.denx.de -Cc: trini@konsulko.com, sjg@chromium.org, heinrich.schuchardt@canonical.com, - pbrobinson@gmail.com, Ilias Apalodimas -Subject: [PATCH 1/2] smbios: Simplify reporting of unknown values -Date: Tue, 6 Sep 2022 16:44:25 +0300 -Message-Id: <20220906134426.53748-1-ilias.apalodimas@linaro.org> -X-Mailer: git-send-email 2.37.2 -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.6 at phobos.denx.de -X-Virus-Status: Clean - -If a value is not valid during the DT or SYSINFO parsing, we explicitly -set that to "Unknown Product" and "Unknown" for the product and -manufacturer respectively. It's cleaner if we move the checks insisde -smbios_add_string() and always report "Unknown" regardless of the missing -field. - -pre-patch dmidecode - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown Product - Version: Not Specified - Serial Number: Not Specified - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Not Specified - Family: Not Specified - -Handle 0x0002, DMI type 2, 14 bytes -Base Board Information - Manufacturer: Unknown - Product Name: Unknown Product - Version: Not Specified - Serial Number: Not Specified - Asset Tag: Not Specified - Features: - Board is a hosting board - Location In Chassis: Not Specified - Chassis Handle: 0x0000 - Type: Motherboard - - -post-patch dmidecode: - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown - -Handle 0x0002, DMI type 2, 14 bytes -Base Board Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Not Specified - Asset Tag: Unknown - Features: - Board is a hosting board - Location In Chassis: Not Specified - Chassis Handle: 0x0000 - Type: Motherboard - -Signed-off-by: Ilias Apalodimas ---- - lib/smbios.c | 17 +++-------------- - 1 file changed, 3 insertions(+), 14 deletions(-) - -diff --git a/lib/smbios.c b/lib/smbios.c -index d7f4999e8b2a..fcc8686993ef 100644 ---- a/lib/smbios.c -+++ b/lib/smbios.c -@@ -102,7 +102,7 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) - int i = 1; - char *p = ctx->eos; - -- if (!*str) -+ if (!str || !*str) - str = "Unknown"; - - for (;;) { -@@ -151,8 +151,7 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, - const char *str; - - str = ofnode_read_string(ctx->node, prop); -- if (str) -- return smbios_add_string(ctx, str); -+ return smbios_add_string(ctx, str); - } - - return 0; -@@ -231,7 +230,7 @@ static int smbios_write_type0(ulong *current, int handle, - t->vendor = smbios_add_string(ctx, "U-Boot"); - - t->bios_ver = smbios_add_prop(ctx, "version"); -- if (!t->bios_ver) -+ if (!strcmp(ctx->last_str, "Unknown")) - t->bios_ver = smbios_add_string(ctx, PLAIN_VERSION); - if (t->bios_ver) - gd->smbios_version = ctx->last_str; -@@ -281,11 +280,7 @@ static int smbios_write_type1(ulong *current, int handle, - fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle); - smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); - t->product_name = smbios_add_prop(ctx, "product"); -- if (!t->product_name) -- t->product_name = smbios_add_string(ctx, "Unknown Product"); - t->version = smbios_add_prop_si(ctx, "version", - SYSINFO_ID_SMBIOS_SYSTEM_VERSION); - if (serial_str) { -@@ -315,11 +310,7 @@ static int smbios_write_type2(ulong *current, int handle, - fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle); - smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); - t->product_name = smbios_add_prop(ctx, "product"); -- if (!t->product_name) -- t->product_name = smbios_add_string(ctx, "Unknown Product"); - t->version = smbios_add_prop_si(ctx, "version", - SYSINFO_ID_SMBIOS_BASEBOARD_VERSION); - t->asset_tag_number = smbios_add_prop(ctx, "asset-tag"); -@@ -344,8 +335,6 @@ static int smbios_write_type3(ulong *current, int handle, - fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle); - smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); - t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP; - t->bootup_state = SMBIOS_STATE_SAFE; - t->power_supply_state = SMBIOS_STATE_SAFE; - -From patchwork Tue Sep 6 13:44:26 2022 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Ilias Apalodimas -X-Patchwork-Id: 1674858 -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -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=) -Authentication-Results: legolas.ozlabs.org; - dkim=pass (2048-bit key; - unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=wBCOiKYw; - 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 ECDSA (P-384)) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4MMRTM5pHRz1yhk - for ; Tue, 6 Sep 2022 23:44:55 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 3639F849EA; - Tue, 6 Sep 2022 15:44:53 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="wBCOiKYw"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id E57FC84A1A; Tue, 6 Sep 2022 15:44:51 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com - [IPv6:2a00:1450:4864:20::52f]) - (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 60CD0849AA - for ; Tue, 6 Sep 2022 15:44:49 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org -Received: by mail-ed1-x52f.google.com with SMTP id z21so5172669edi.1 - for ; Tue, 06 Sep 2022 06:44:49 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date; - bh=KsGBN7dLy4q3TeQQmsDywPtn2m3V5eSK1ppBgO8D3xg=; - b=wBCOiKYwM4mGDZUo6l68tblLVt57cCnO0dlzFPj9+m6cwKXe3agxiM3w4t9T5c822i - vHmFd2F08bUrX81t/h4PDzg0mngbB9Rc9o4i3td1G9Zw6NdmogU7T7gEUyKKcTc80AWl - QbbYgxulWB5Eg2dTQ3tlb2xmb5BU1/X0zl/rOC6l89urohdQtpIJ4XgFlijFlBgxh8XD - aHytniLKGTLlVdJAIobcF9aM/ihpO7LPTDZ4SPCBt4t9+UWGW7vuTPDPDkCRiaaFestv - 9P32ZrGj43CH92zBQtpgZICS0UhzD3oYWJkwsmFbfxddgY5VD5SQi69VzD1CfFOvTGgX - 5HBg== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20210112; - 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; - bh=KsGBN7dLy4q3TeQQmsDywPtn2m3V5eSK1ppBgO8D3xg=; - b=h1yL2aMN8ooI48PrqxwSNjw+MAj6qGtRMJjV8AWmRfv7nVQ97I/cXbauy/NItVEWP0 - eO4WFqVMQO+xyGn1S5w0MXYGVbEpVNxf0gwM7n7Ad+K2E2PDHyu6glGTvcqCW11gPGOJ - uNDyo6pu7OtmOBso2OaL5eMGhw66ZGqQbzlQtO0mhqJf1RtQ9fRduRZrfTzAR9wIrM4Y - qR3iK6b4O97tu0W0SctGf3rCNzI2bDv/zBKRvfSJ6q7s4DhLDxBJyQjySBo0Ee6UIwKc - 5q8zldycF/JfIbqzlJe6DaeoeDbzJ7qLBPvDmxQ7owSV9ftEa8lh/IIdPn13uDL2Bxjz - WLbg== -X-Gm-Message-State: ACgBeo0DsGDn9dDw7GQ5K44iwyXJqKH0pM3NWFxuDlmBNzKLyzH8SEzb - 03ImCopxuD/6oyVtH7ygeEl2Cc6GlNzVNQ== -X-Google-Smtp-Source: - AA6agR6kpp8KIkqO+/pui5Dy7mRTrk+S2U0k99eVOJv3PGkIDZ8H0oqIBypOwW5nogFds0FAjF4TXg== -X-Received: by 2002:a05:6402:f18:b0:44d:9a45:394 with SMTP id - i24-20020a0564020f1800b0044d9a450394mr12375719eda.138.1662471889015; - Tue, 06 Sep 2022 06:44:49 -0700 (PDT) -Received: from localhost.localdomain ([46.103.15.185]) - by smtp.gmail.com with ESMTPSA id - p23-20020a056402501700b0043ba7df7a42sm8473330eda.26.2022.09.06.06.44.48 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Tue, 06 Sep 2022 06:44:48 -0700 (PDT) -From: Ilias Apalodimas -To: u-boot@lists.denx.de -Cc: trini@konsulko.com, sjg@chromium.org, heinrich.schuchardt@canonical.com, - pbrobinson@gmail.com, Ilias Apalodimas -Subject: [PATCH 2/2] smbios: Fallback to the default DT if sysinfo nodes are - missing -Date: Tue, 6 Sep 2022 16:44:26 +0300 -Message-Id: <20220906134426.53748-2-ilias.apalodimas@linaro.org> -X-Mailer: git-send-email 2.37.2 -In-Reply-To: <20220906134426.53748-1-ilias.apalodimas@linaro.org> -References: <20220906134426.53748-1-ilias.apalodimas@linaro.org> -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.6 at phobos.denx.de -X-Virus-Status: Clean - -In order to fill in the SMBIOS tables U-Boot currently relies on a -"u-boot,sysinfo-smbios" compatible node. This is fine for the boards -that already include such nodes. However with some recent EFI changes, -the majority of boards can boot up distros, which usually rely on -things like dmidecode etc for their reporting. For boards that -lack this special node the SMBIOS output looks like: - -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown - -This looks problematic since most of the info are "Unknown". The DT spec -specifies standard properties containing relevant information like -'model' and 'compatible' for which the suggested format is -. So let's add a last resort to our current -smbios parsing. If none of the sysinfo properties are found, we can -scan the root node for 'model' and 'compatible'. - -pre-patch dmidecode: - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown - -Handle 0x0002, DMI type 2, 14 bytes -Base Board Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Not Specified - Asset Tag: Unknown - Features: - Board is a hosting board - Location In Chassis: Not Specified - Chassis Handle: 0x0000 - Type: Motherboard - -Handle 0x0003, DMI type 3, 21 bytes -Chassis Information - Manufacturer: Unknown - Type: Desktop - Lock: Not Present - Version: Not Specified - Serial Number: Not Specified - Asset Tag: Not Specified - Boot-up State: Safe - Power Supply State: Safe - Thermal State: Safe - Security Status: None - OEM Information: 0x00000000 - Height: Unspecified - Number Of Power Cords: Unspecified - Contained Elements: 0 - - -post-pastch dmidecode: - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: socionext,developer-box - Product Name: Socionext Developer Box - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown - -Handle 0x0002, DMI type 2, 14 bytes -Base Board Information - Manufacturer: socionext,developer-box - Product Name: Socionext Developer Box - Version: Unknown - Serial Number: Not Specified - Asset Tag: Unknown - Features: - Board is a hosting board - Location In Chassis: Not Specified - Chassis Handle: 0x0000 - Type: Motherboard - -Handle 0x0003, DMI type 3, 21 bytes -Chassis Information - Manufacturer: socionext,developer-box - Type: Desktop - Lock: Not Present - Version: Not Specified - Serial Number: Not Specified - Asset Tag: Not Specified - Boot-up State: Safe - Power Supply State: Safe - Thermal State: Safe - Security Status: None - OEM Information: 0x00000000 - Height: Unspecified - Number Of Power Cords: Unspecified - Contained Elements: 0 - - -Signed-off-by: Ilias Apalodimas ---- - lib/smbios.c | 41 +++++++++++++++++++++++++++++++++++++++-- - 1 file changed, 39 insertions(+), 2 deletions(-) - -diff --git a/lib/smbios.c b/lib/smbios.c -index fcc8686993ef..f2eb961f514b 100644 ---- a/lib/smbios.c -+++ b/lib/smbios.c -@@ -43,6 +43,20 @@ - - DECLARE_GLOBAL_DATA_PTR; - -+/** -+ * struct sysifno_to_dt - Mapping of sysinfo strings to DT -+ * -+ * @sysinfo_str: sysinfo string -+ * @dt_str: DT string -+ */ -+static const struct { -+ const char *sysinfo_str; -+ const char *dt_str; -+} sysifno_to_dt[] = { -+ { .sysinfo_str = "product", .dt_str = "model" }, -+ { .sysinfo_str = "manufacturer", .dt_str = "compatible" }, -+}; -+ - /** - * struct smbios_ctx - context for writing SMBIOS tables - * -@@ -87,6 +101,18 @@ struct smbios_write_method { - const char *subnode_name; - }; - -+static const char *convert_sysinfo_to_dt(const char *sysinfo_str) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(sysifno_to_dt); i++) { -+ if (!strcmp(sysinfo_str, sysifno_to_dt[i].sysinfo_str)) -+ return sysifno_to_dt[i].dt_str; -+ } -+ -+ return NULL; -+} -+ - /** - * smbios_add_string() - add a string to the string area - * -@@ -148,9 +174,20 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, - return smbios_add_string(ctx, val); - } - if (IS_ENABLED(CONFIG_OF_CONTROL)) { -- const char *str; -+ const char *str = NULL; - -- str = ofnode_read_string(ctx->node, prop); -+ /* -+ * If the node is not valid fallback and try the entire DT -+ * so we can at least fill in maufacturer and board type -+ */ -+ if (!ofnode_valid(ctx->node)) { -+ const char *nprop = convert_sysinfo_to_dt(prop); -+ -+ if (nprop) -+ str = ofnode_read_string(ofnode_root(), nprop); -+ } else { -+ str = ofnode_read_string(ctx->node, prop); -+ } - return smbios_add_string(ctx, str); - } - diff --git a/sources b/sources index 1ef8db1..a04670b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2023.10.tar.bz2) = f238a69b9cc08ee0a69ea8ca2fa26975f2f2ede14e978b4db274b1e4095e43af0052307ac39034658a72ec9706951cd03c0f316d0591f391adecaf2cc9496fc4 +SHA512 (u-boot-2024.01-rc3.tar.bz2) = 51a45e6a0008ef04570b6357518c85fd22604be0090ad5bf1dc7c821eb34ea33441314c49128dd0bd3084406b7138497044bb47f7e57d38a680768fb9f2f6577 diff --git a/uboot-tools.spec b/uboot-tools.spec index 4706710..798f97d 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -#global candidate rc0 +%global candidate rc3 %if 0%{?rhel} %bcond_with toolsonly %else @@ -6,8 +6,8 @@ %endif Name: uboot-tools -Version: 2023.10 -Release: 0.9%{?candidate:.%{candidate}}%{?dist} +Version: 2024.01 +Release: 0.1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -18,12 +18,13 @@ Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}%{?candidate:-%{candid Source1: aarch64-boards Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch -Patch2: smbios-Simplify-reporting-of-unknown-values.patch -Patch3: disable-VBE-by-default.patch -Patch4: enable-bootmenu-by-default.patch -Patch5: Add-video-damage-tracking.patch +Patch2: disable-VBE-by-default.patch +Patch3: 0001-smbios-Simplify-reporting-of-unknown-values.patch +Patch4: 0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch +Patch5: enable-bootmenu-by-default.patch Patch6: uefi-Boot-var-automatic-management-for-removable-medias.patch -Patch7: bootstd-Test-and-boot_targets-improvements.patch +#Patch6: Add-video-damage-tracking.patch +#Patch7: bootstd-Test-and-boot_targets-improvements.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support @@ -215,6 +216,9 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Fri Nov 24 2023 Peter Robinson - 1:2024.01-0.1.rc3 +- Update to 2024.01 RC3 + * Tue Oct 31 2023 Peter Robinson - 1:2023.10-0.9 - Rebuild From 2989b728b025d157b42b6a9c5e6f9664df1a590e Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 25 Nov 2023 09:18:23 +0000 Subject: [PATCH 018/128] Rebase patches for new release --- Add-video-damage-tracking.patch | 2026 ++--------------- ...d-Test-and-boot_targets-improvements.patch | 626 ----- uboot-tools.spec | 3 +- 3 files changed, 150 insertions(+), 2505 deletions(-) delete mode 100644 bootstd-Test-and-boot_targets-improvements.patch diff --git a/Add-video-damage-tracking.patch b/Add-video-damage-tracking.patch index 5e78df8..7ba10f6 100644 --- a/Add-video-damage-tracking.patch +++ b/Add-video-damage-tracking.patch @@ -1,133 +1,8 @@ -From patchwork Mon Aug 21 13:50:58 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823643 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=jAFdt8C3; - 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 4RTv611rHqz1yg0 - for ; Mon, 21 Aug 2023 23:51:37 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 69F2487066; - Mon, 21 Aug 2023 15:51:29 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="jAFdt8C3"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 71CEC8706D; Mon, 21 Aug 2023 15:51:28 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com - [IPv6:2a00:1450:4864:20::32e]) - (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 3320B87062 - for ; Mon, 21 Aug 2023 15:51:25 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wm1-x32e.google.com with SMTP id - 5b1f17b1804b1-3fef56f7222so2727775e9.2 - for ; Mon, 21 Aug 2023 06:51:25 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625884; x=1693230684; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=0KM0F1+WkNhDdn0zbbXHFFjqAdCr64hX7QvIzy6/iyI=; - b=jAFdt8C3owZgLvkS3GxcS5N+GiTxn30Z/xJkqzPDEYfC0PDH1kIsDI4pb6eHKAFVBt - PLqr4R9Sdmb05o76fez0U9nTmmv97QjcaeHGc0adZliwf33YdMgotCTaUiHc/nhkpLWw - c8rHP6jWgFPGn5Y45QEtPjQFEuV0nP0SkMONJorI+ci6NUadDN8X0tZNK5GoF1lvhF4o - mQZs5xJfJ6evaIBX7srcue8NUq4BtyhQ18vVYm0nCIPEltA23PBpkcejhCv6g5o/4puI - sgF/+jj8BhBQFKhPEIktVLWcqveScR/ngqiv1iDRHrCL6flPhtCsrpShY+rzilzpJdtC - fkJQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625884; x=1693230684; - 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=0KM0F1+WkNhDdn0zbbXHFFjqAdCr64hX7QvIzy6/iyI=; - b=gWHm6TE1o6bFZMTHoyWCi4QgdvFQkn06zRip9uOn3HqDzCG7KLnrXsFUdYdugOcadS - yQH0TYQ9YCGnJEItFC8+BAPuij69++YczOI2dzUQz6ejqfjFnTORccJmFginC+ZQynSw - ygcqWBt7iXKWwm2BNaTOS0ZbXxZuQrdebM6QD55CSsB+YnJ/21Q4txo4VOIzT+g2LmU4 - YhR1Ec8+2HGk3w1oWalKPpGcBc3y3y7ADgy/Kt0L4pFhAmBewW+wlGtrTxdoIbRmcMwx - 6xx1bS9ZrdHzFpTAB7myHjowwbIvRmhpNDr1e+ROx71myEhCEhnz0o6tjGmHTmebIiZB - Axiw== -X-Gm-Message-State: AOJu0Yw7o7394U5eAr5ipSyfIWmc1YVzBHdp8jslW0qPlsoIXMjiuI6c - SaZaVpf+ZihLZ51797OE439hQFEZL4o= -X-Google-Smtp-Source: - AGHT+IGiiJu3kdw60kWynu1HizRmCX0l3/hesikD0kGHzt9jbq6D24m4A0InLSpbaBLDcUVjniBVKA== -X-Received: by 2002:a05:600c:3799:b0:3fe:2011:a7ce with SMTP id - o25-20020a05600c379900b003fe2011a7cemr5345546wmr.6.1692625884228; - Mon, 21 Aug 2023 06:51:24 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.22 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:23 -0700 (PDT) +From 79c2ed100ee9b901d676567e73ea4ebde84f15bc Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 01/13] video: test: Split copy frame buffer check into a - function Date: Mon, 21 Aug 2023 16:50:58 +0300 -Message-Id: <20230821135111.3558478-2-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 +Subject: [PATCH 01/13] video: test: Split copy frame buffer check into a + function While checking frame buffer contents, the video tests also check if the copy frame buffer contents match the main frame buffer. To test if only @@ -137,16 +12,13 @@ function that we can skip calling, since we won't want it to error on those mismatched cases. Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- - -Changes in v5: -- Add patch "video: test: Split copy frame buffer check into a function" - test/dm/video.c | 69 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/test/dm/video.c b/test/dm/video.c -index d907f681600b..641a6250100a 100644 +index d907f681600..641a6250100 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -55,9 +55,6 @@ DM_TEST(dm_test_video_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); @@ -427,138 +299,14 @@ index d907f681600b..641a6250100a 100644 return 0; } +-- +2.43.0 -From patchwork Mon Aug 21 13:50:59 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823644 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=mYzIbw17; - 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 4RTv6B5sZGz1yYZ - for ; Mon, 21 Aug 2023 23:51:46 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id AD34B8706B; - Mon, 21 Aug 2023 15:51:31 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="mYzIbw17"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 5EF078707C; Mon, 21 Aug 2023 15:51: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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com - [IPv6:2a00:1450:4864:20::42b]) - (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 8B77787069 - for ; Mon, 21 Aug 2023 15:51:27 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x42b.google.com with SMTP id - ffacd0b85a97d-307d20548adso2907788f8f.0 - for ; Mon, 21 Aug 2023 06:51:27 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625887; x=1693230687; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=2OB7382go0g6JBjezy6TmzGfi6gIlYCFDFe4xM7HRw8=; - b=mYzIbw17s5ut2Lj8TmUyEmZZuMpoWf/YpZMisLloBGvTOI6o9/p8nP2M17yjk++h8P - 8+GH169jMY+6EuzecVUKktHLjLULhqcSGVgb+K8TH4Z0MkPhLZg6u+23TnjErs5v1VYS - +euy4y8wSAudLGdJHtR26NtBqeJHDFiK6ves/aUe6PVWoPVDofUTUC53I4mvF96uWF8K - NxLW9B5KIoY0T2WpxZUDwabQASQORqw1sA33K5oTD5OvFTS081ZnJT9otEq9+EgTySU5 - e9RQTRRZ1lstBqBTAQHRXPAniy7qhyu+ptlO9RhqLC6R08WOBN8Fwz7r4fVsnuuGMEgm - CatQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625887; x=1693230687; - 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=2OB7382go0g6JBjezy6TmzGfi6gIlYCFDFe4xM7HRw8=; - b=ChLsD8uyfsbRsBr3u3v4RBW8IRqsNDwAduakdrWkASxSDmmx1fr/AROSBC5feYGGDe - hS2CHTTA7mzZBgx65Trp5EItwl/T+Vp9i6ot9yz9QlTUNNEcPawZEdr+wrwsTgDaxH2v - snQjENvBTKP8nVEyAFqDmM2dOMLBHKEnI/a8MuKKZMuMu9dujekXUR7zTMOWyhTLK6Gc - D8F+qwz8FIhnEGMc1i1LvXmjDCs7delvdWCetg6JqpaHZUQQc6Ru03gSKWXkedKTdHsF - IFdkr4qm3W7Rsy2BwYQZN2XrZO5IuLkQjVOtfryPfMGux/37jUX8zNJ0y+TL8k42PlEC - Xicw== -X-Gm-Message-State: AOJu0YwlYwARbrwNV25POhyWxcoym3cQztI8SjGOeCzdsQys/HqRUQV+ - wqnhOKThUMfcGC8MZ8gLFE2KT2+SxVA= -X-Google-Smtp-Source: - AGHT+IHSYU3/G4dWV8P3egqgpph9YxOl4+mH1vDWUtosphrFiVQk7BNu/zdvNsUiJiU3qzGO9VCxdg== -X-Received: by 2002:a5d:44cf:0:b0:313:f33c:24c4 with SMTP id - z15-20020a5d44cf000000b00313f33c24c4mr4457731wrr.39.1692625886757; - Mon, 21 Aug 2023 06:51:26 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.24 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:26 -0700 (PDT) +From eb6a5cd225f0818e5dec2253e0c676142c3835a1 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 02/13] video: test: Support checking copy frame buffer - contents Date: Mon, 21 Aug 2023 16:50:59 +0300 -Message-Id: <20230821135111.3558478-3-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 +Subject: [PATCH 02/13] video: test: Support checking copy frame buffer + contents The video tests have a helper function to generate a pseudo-digest of frame buffer contents, but it only does so for the main one. There is @@ -571,16 +319,13 @@ Add a boolean argument to the existing helper function to indicate which frame buffer we want to inspect, and update the existing callers. Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- - -Changes in v5: -- Add patch "video: test: Support checking copy frame buffer contents" - test/dm/video.c | 76 ++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/test/dm/video.c b/test/dm/video.c -index 641a6250100a..b9ff3da10c18 100644 +index 641a6250100..b9ff3da10c1 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -57,22 +57,28 @@ DM_TEST(dm_test_video_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); @@ -865,137 +610,14 @@ index 641a6250100a..b9ff3da10c18 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; +-- +2.43.0 -From patchwork Mon Aug 21 13:51:00 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823645 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=h0nfUUKH; - 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 4RTv6P02TYz1yYZ - for ; Mon, 21 Aug 2023 23:51:56 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id F40E487071; - Mon, 21 Aug 2023 15:51:33 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="h0nfUUKH"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id EFD6D87069; Mon, 21 Aug 2023 15:51:32 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 -Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com - [IPv6:2a00:1450:4864:20::42c]) - (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 0028587074 - for ; Mon, 21 Aug 2023 15:51:29 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x42c.google.com with SMTP id - ffacd0b85a97d-319779f0347so2987491f8f.1 - for ; Mon, 21 Aug 2023 06:51:29 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625889; x=1693230689; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=Ls20OKhVk8mknnS6GLFBhmTjxLz0/7fKNgK2nzSEs6M=; - b=h0nfUUKHqteSaQqflnkXT9zc90H1nKLTOoG4B78CtKhSKUI/thuMDU61AtN+enWvFJ - MdvU9OW3jOHeg+LRrxur+6+N4V9k4nGhm2BGwtj56A1DDfCLgk5+Vg38dhi1a24kfBH9 - d5w6HXOg3wdMizdTsyL0PbugSX7K9ByL9XKpH646NdsnqcikQNdmT2OeiGAmonEmHXAa - FII1SypkiZ5TOFcJx9N4X2XqMM3CNxyUsDs6+AV4dTPnjtXaElWj1fQcz8bLn/9q88/X - UCvE35N4Y37FFgb+5uTi+00hcLIavYKYrLEpNAclnl9NKFSUAUJyabqQM0+riy1OSMHF - 5YBw== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625889; x=1693230689; - 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=Ls20OKhVk8mknnS6GLFBhmTjxLz0/7fKNgK2nzSEs6M=; - b=Gmm/6GKzL921nU50fcXK4FdwCaAc1DVbDj7ilfjHfBXRaw/k3mmUZ/l5nbwGsTUYUU - VX6nd+xFgekVSP5Cns7th6+jnbBBaoaCZUfZYGIhQjEH3JMxxpo17+eNdfCTuo7TjTdl - MtWwxmceukhRiNql2W7VOHfb5CXBxorcXXcy3szcEJOlzxIqqUDQcLjNgoe5d2Kpkv9Y - 6qkNp6XFyfQCMAMGjF68T5eViaLcvFHFIsvmjXlMU7Ohhhm2We4SK9nBsr6gUgyaxmNs - qBLKVZKf+iC9WptVFbXhAML6gJZJo+JQu/tGHHfLf7rm/WT+1VhmDKBgpU1CzA8BRqcG - t+og== -X-Gm-Message-State: AOJu0YxCm+p57uF96KzOW9kggq2KLZimSeriKFH9gpv8fgoy+ddR1X7S - 9HsUigoZFUND3/u7rp+XB9qHn3dcZTU= -X-Google-Smtp-Source: - AGHT+IEwSW6rIF+3ua5ruA0V/p8R0SXlrxBIJRwdiP9dn7nhkL8gMfhxYppZ2c8jWSzauubY8xUVnQ== -X-Received: by 2002:adf:e482:0:b0:31a:dc27:e10 with SMTP id - i2-20020adfe482000000b0031adc270e10mr4721868wrm.65.1692625889315; - Mon, 21 Aug 2023 06:51:29 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.27 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:28 -0700 (PDT) +From 4c80b655e5c82acd1573e80668747d8ef25deb83 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 03/13] video: test: Test partial updates of hardware frame - buffer Date: Mon, 21 Aug 2023 16:51:00 +0300 -Message-Id: <20230821135111.3558478-4-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 +Subject: [PATCH 03/13] video: test: Test partial updates of hardware frame + buffer With VIDEO_COPY enabled, only the modified parts of the frame buffer are intended to be copied to the hardware. Add a test that checks this, by @@ -1004,16 +626,13 @@ then checking if the overwritten contents have been redrawn on the next sync. Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- - -Changes in v5: -- Add patch "video: test: Test partial updates of hardware frame buffer" - test/dm/video.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/test/dm/video.c b/test/dm/video.c -index b9ff3da10c18..e4bd27a6b76f 100644 +index b9ff3da10c1..e4bd27a6b76 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -657,3 +657,57 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) @@ -1074,138 +693,13 @@ index b9ff3da10c18..e4bd27a6b76f 100644 + return 0; +} +DM_TEST(dm_test_video_copy, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +-- +2.43.0 -From patchwork Mon Aug 21 13:51:01 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823647 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=bU3qjQR0; - 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 4RTv6c2SWvz1yYZ - for ; Mon, 21 Aug 2023 23:52:08 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 4441F87070; - Mon, 21 Aug 2023 15:51:36 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="bU3qjQR0"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 3848287075; Mon, 21 Aug 2023 15:51:35 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com - [IPv6:2a00:1450:4864:20::42c]) - (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 841D2869B6 - for ; Mon, 21 Aug 2023 15:51:32 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x42c.google.com with SMTP id - ffacd0b85a97d-31aec0a1a8bso1211537f8f.0 - for ; Mon, 21 Aug 2023 06:51:32 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625892; x=1693230692; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=edVipA0fXjfO2+yIw/Pp5VvEle3RKuzWiUXEb/KCl5I=; - b=bU3qjQR0xHT3knwMAc4fOHXpeWOGcUonKhClh1IfqxsqOHWeRbIi1W1OtDuPIyv8dX - CyIHX30R+SQr8o+T5xSFf4E4kwRpsqOzh2mXOD3dzuYzJPkreOM5clQMgmyn2JGs+nON - KDztnOSqesV2IvPZqdr61bxJTw/SjXqRXGc7/YkT7OWwlaug26E+DbzP7Xt+plHDVz/9 - 6OB5zFxUapwX0mqxb6jbNAz17TvjQ5qIviNkCRZUZ2vseEB78BwHajxkNCG4jVOaQDON - aJWc+UOFyWJ3jLmQ+cOJgR+J0SoF3VAVYhbYaYviNV2DiaBPLPL9axirby/hW4Kx2waB - YKAg== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625892; x=1693230692; - 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=edVipA0fXjfO2+yIw/Pp5VvEle3RKuzWiUXEb/KCl5I=; - b=STc6gYqDRe7JtT56BIezfKTd0PQe87I83hDC5mL+8D0AqUp1RiJPnPt9MWIAVfO63j - plu8RveodelqOd26zWzlFDepTA+jfvcAgOePHLLLx3YiAidxIWD6d0SVlG+zagmUlHzm - HGscQ+3iGYhTHAGxc10UHaQcMlCmyeWecwIjxXBpM85g6puunYrN14aYfsp6E0ODCLMg - 9HAD2Zx5b++HK3yE7Ld6hientRzVXxwURTL5ehSSO2AX95YMagfKaP767VvupWtB18du - 5Lfk0k60qTxe3Xlamnm8bdoRofuIyLLaSZ+0M7lAsEPPsS4QRGn+m7MwI8YTlRIU8wFQ - cYSQ== -X-Gm-Message-State: AOJu0YwPPIi0QLYKGPNa9T+XPhwof7rD3VBA3kfub7MM4xEG6u6r8puq - cSLl/n+w1P2LSAPH1AWswz3SS227DdQ= -X-Google-Smtp-Source: - AGHT+IFAUyNsvOmdhjdIygYhsv/SH6hvXItfwiWsY14vr3nwQ9J7A0Q0Y71M8WvaFJdxn7mmOeZlrg== -X-Received: by 2002:a5d:44c8:0:b0:317:e9d7:9387 with SMTP id - z8-20020a5d44c8000000b00317e9d79387mr7196865wrr.25.1692625891911; - Mon, 21 Aug 2023 06:51:31 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.30 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:31 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 04/13] dm: video: Add damage tracking API -Date: Mon, 21 Aug 2023 16:51:01 +0300 -Message-Id: <20230821135111.3558478-5-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From 40f4addde7e05ce94fb74cd7d6795265ad282de6 Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:01 +0300 +Subject: [PATCH 04/13] dm: video: Add damage tracking API We are going to introduce image damage tracking to fasten up screen refresh on large displays. This patch adds damage tracking for up to @@ -1219,34 +713,15 @@ Reported-by: Da Xue video_damage(), declare priv, drop headers, use IS_ENABLED()] Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- - -Changes in v5: -- Use xstart, ystart, xend, yend as names for damage region -- Document damage struct and fields in struct video_priv comment -- Return void from video_damage() -- Fix undeclared priv error in video_sync() -- Drop unused headers from video-uclass.c -- Use IS_ENABLED() instead of CONFIG_IS_ENABLED() - -Changes in v4: -- Move damage clear to patch "dm: video: Add damage tracking API" -- Simplify first damage logic -- Remove VIDEO_DAMAGE default for ARM - -Changes in v3: -- Adapt to always assume DM is used - -Changes in v2: -- Remove ifdefs - drivers/video/Kconfig | 13 ++++++++++++ drivers/video/video-uclass.c | 41 +++++++++++++++++++++++++++++++++--- include/video.h | 32 ++++++++++++++++++++++++++-- 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index fe43fbd7004a..97f494a1340b 100644 +index ab927641bb7..ac3edbfdb54 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -92,6 +92,19 @@ config VIDEO_COPY @@ -1270,7 +745,7 @@ index fe43fbd7004a..97f494a1340b 100644 bool "Generic PWM based Backlight Driver" depends on BACKLIGHT && DM_PWM diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 8f268fc4063f..447689581668 100644 +index f743ed74c81..9888a580bfd 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -351,9 +351,39 @@ void video_set_default_colors(struct udevice *dev, bool invert) @@ -1345,10 +820,10 @@ index 8f268fc4063f..447689581668 100644 } diff --git a/include/video.h b/include/video.h -index 66d109ca5da6..a522f33949e5 100644 +index 4d8df9baaad..1310195f307 100644 --- a/include/video.h +++ b/include/video.h -@@ -85,6 +85,11 @@ enum video_format { +@@ -88,6 +88,11 @@ enum video_format { * @fb_size: Frame buffer size * @copy_fb: Copy of the frame buffer to keep up to date; see struct * video_uc_plat @@ -1360,7 +835,7 @@ index 66d109ca5da6..a522f33949e5 100644 * @line_length: Length of each frame buffer line, in bytes. This can be * set by the driver, but if not, the uclass will set it after * probing -@@ -112,6 +117,12 @@ struct video_priv { +@@ -115,6 +120,12 @@ struct video_priv { void *fb; int fb_size; void *copy_fb; @@ -1373,7 +848,7 @@ index 66d109ca5da6..a522f33949e5 100644 int line_length; u32 colour_fg; u32 colour_bg; -@@ -254,8 +265,9 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -257,8 +268,9 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, * @return: 0 on success, error code otherwise * * Some frame buffers are cached or have a secondary frame buffer. This @@ -1385,7 +860,7 @@ index 66d109ca5da6..a522f33949e5 100644 */ int video_sync(struct udevice *vid, bool force); -@@ -375,6 +387,22 @@ static inline int video_sync_copy_all(struct udevice *dev) +@@ -378,6 +390,22 @@ static inline int video_sync_copy_all(struct udevice *dev) #endif @@ -1408,139 +883,13 @@ index 66d109ca5da6..a522f33949e5 100644 /** * video_is_active() - Test if one video device it active * +-- +2.43.0 -From patchwork Mon Aug 21 13:51:02 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823648 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=BdIntNrw; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4RTv6p6cj3z1yYZ - for ; Mon, 21 Aug 2023 23:52:18 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 8A59F87086; - Mon, 21 Aug 2023 15:51:40 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="BdIntNrw"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 3C3FD867A0; Mon, 21 Aug 2023 15:51:39 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 -Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com - [IPv6:2a00:1450:4864:20::42c]) - (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 546E686F0A - for ; Mon, 21 Aug 2023 15:51:35 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x42c.google.com with SMTP id - ffacd0b85a97d-31c3df710bdso1066363f8f.1 - for ; Mon, 21 Aug 2023 06:51:35 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625895; x=1693230695; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=rfyiNp4RS7b8BQCxsUs1afKXNK4WMu1bUdXxDQXJn1U=; - b=BdIntNrw+JbVTri7AodJPuA4KoTwuid2ByavDMP+gEZwSfMkjrlWlFROWNdM4E2KeC - btsSXcPQO3jMnyoxVbS5g4DL2PkXPHNZO/Lw5Db4La4RGjoB4ks8w4G1nQ5kVo8NIXlQ - 7da1BVmm9tlV2cmt2LVuLp3WDWvgE5vJ9kVj8BH8fjD+gKc5wVOKtRIPJnqL8Eqj55A5 - y8xjVcW5ldxVps2jj0kE7Mq8LG2R6Bd37Zsw+Dq3Cj/1khMgLkYog8/Nf+k2uYXPQpjA - TS03XR6eJ7GQcRUf0iWft80hVZMVk6KF2AWuF04HcJ/goyNj4MGGFun0tanDYNImJzv0 - A/8A== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625895; x=1693230695; - 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=rfyiNp4RS7b8BQCxsUs1afKXNK4WMu1bUdXxDQXJn1U=; - b=N71LYmMnxX45xKNJxNk72goiD3Cf5e0f3znUaZ/B4Ue95/rqpwn6vLQvhNkxjyJjKz - QxOUGBKeP4pdGPJD2eVZgEA1+8cyBu3q0BssvtHzLuXCZtgGmVE+jhS1ZplzCePV5HDq - cpjabmm8tLydQpgXN42bXGeg5S7C2hbuWb9P1yFz0T2VRKDhKfnBacDMMyCM77q885Xq - scmyG9QS6JjzzhlNCx2LAvunQyb5Ub3Jeac6w62kdW5d82X5hQ7R5IuMhO6HB9cXSoIL - q4cciYJYPkkgJo7cJBCGs9hpoG7mAiYugMX3xvTX0AozIxV+I0RqRnIaeK4YPRctAqDa - B+ZQ== -X-Gm-Message-State: AOJu0Yzo17fP4SdOljTzWNaDUk2p0KMalzHe92zD3l/uyJxeFYnVtZ6Z - JKO6vwp7AEEfITHacMlSfDnu20sRQPA= -X-Google-Smtp-Source: - AGHT+IEaweUWG6MdegfaF+T8dg4D4mXuTL2UTLikuqRhtfAyLWNc6xApEfO0HHPUExbseBScRw20SA== -X-Received: by 2002:a5d:44d1:0:b0:313:f94f:3b15 with SMTP id - z17-20020a5d44d1000000b00313f94f3b15mr5140696wrr.2.1692625894567; - Mon, 21 Aug 2023 06:51:34 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.32 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:34 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 05/13] dm: video: Add damage notification on display fills -Date: Mon, 21 Aug 2023 16:51:02 +0300 -Message-Id: <20230821135111.3558478-6-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From 38f85c1620b99691bc0bd06a18c7173386a0a846 Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:02 +0300 +Subject: [PATCH 05/13] dm: video: Add damage notification on display fills Let's report the video damage when we fill parts of the screen. This way we can later lazily flush only relevant regions to hardware. @@ -1549,17 +898,13 @@ Signed-off-by: Alexander Graf Reported-by: Da Xue [Alper: Call video_damage() in video_fill_part(), edit commit message] Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- -Does video_fill_part() need a video_sync(dev, false) here? - -Changes in v5: -- Call video_damage() also in video_fill_part() - drivers/video/video-uclass.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 447689581668..ebf409d839f0 100644 +index 9888a580bfd..09172f1f7f4 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -203,6 +203,8 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, @@ -1580,140 +925,14 @@ index 447689581668..ebf409d839f0 100644 return video_sync(dev, false); } +-- +2.43.0 -From patchwork Mon Aug 21 13:51:03 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823649 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=oaK1+upy; - 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 4RTv712FN9z1yYZ - for ; Mon, 21 Aug 2023 23:52:29 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id D08B3867A0; - Mon, 21 Aug 2023 15:51:42 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="oaK1+upy"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 8D15587084; Mon, 21 Aug 2023 15:51:40 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com - [IPv6:2a00:1450:4864:20::436]) - (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 DA4E1869B6 - for ; Mon, 21 Aug 2023 15:51:37 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x436.google.com with SMTP id - ffacd0b85a97d-317f1c480eeso3049475f8f.2 - for ; Mon, 21 Aug 2023 06:51:37 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625897; x=1693230697; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=7yrfRyMChh1ygDQtR1jl9BYhd6F+V0coaR3saA65Ao8=; - b=oaK1+upyGYfwOr4/nZR8RIRT+Yn2PZ+2dy2+GMSjffIkOUvAA4SwUrsuBUHVmQ+cIg - Q0F+D60Mp5/MzkFm9rwAnrQpO2uJb9esI/U8crcERtM+p1p5iKU9VNHrwRjlzB4VfG3E - 1rFRNOOhGpyPBS6RY+cJD557cLeGMoVUsQbv3xfnShrQg142CAOgzdQ4AtJ3FYRDngOc - QiczfO53zpeOnZjhBAa5aw7TDgIqHuR1bYCYIRraWJdIl9Cxa6ZDN1IozoPg6hutV+SE - 77oOM9VfIYyC8B3q6wdaduzcH0Qgeq3IEzfE54DLVtS/yT5z2vJiPtnfnV2pXzjU01Iq - l7Fg== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625897; x=1693230697; - 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=7yrfRyMChh1ygDQtR1jl9BYhd6F+V0coaR3saA65Ao8=; - b=NgyE/5/ABpribqDY5ykRBi/ftUfa+3meGxemZJPAl2gCi2+PfUEbrdHMbSPz/8nbY9 - qS/5UPv+41yRmDLmqeaNK/RXif7qV+CdVrg4K7xD0x/HbezXsIvKSc6rs5IqPqQvp0lx - JDuescRAcyrjtBjBFIAsrOx0+GynSijvWQArLcJRL330eiNnBn0HYRiVFqfEy3jpv5Hz - 13zk9q/GW8Hc7GRtA+FAkeUqJ3t8VaRzHLfoUJO3zFS8bWXgnWUAbCx0OOB9MahUqvyv - s/jpw79ZhFlhzO/Nwa63SlfQi+T3dAiYQ3kpBDgz7YFjSxvYaFYJDW3ihVDv8VTIiLdl - WB8Q== -X-Gm-Message-State: AOJu0YwqmT7iLKiUZblbrZz+UE4GebW514Sdllsg7NS//fk35AzXbHd7 - 7wXdC1ugEQP9Gez3jIRiAyQs4cDTcVc= -X-Google-Smtp-Source: - AGHT+IHO/arCmWeM8GYL18CXATu4Sh++TdyEswajL5QnvTaImLdSHvMUo+xc/gBkyHdBnNYS/qgvaQ== -X-Received: by 2002:adf:cd0b:0:b0:31c:3013:9fa5 with SMTP id - w11-20020adfcd0b000000b0031c30139fa5mr3560706wrm.59.1692625897248; - Mon, 21 Aug 2023 06:51:37 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.35 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:36 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 06/13] vidconsole: Add damage notifications to all - vidconsole drivers -Date: Mon, 21 Aug 2023 16:51:03 +0300 -Message-Id: <20230821135111.3558478-7-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From 77425d7aca92bf734e51cf36fad658adc53cb57d Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:03 +0300 +Subject: [PATCH 06/13] vidconsole: Add damage notifications to all vidconsole + drivers Now that we have a damage tracking API, let's populate damage done by vidconsole drivers. We try to declare as little memory as damaged as @@ -1725,18 +944,8 @@ Reported-by: Da Xue console_putc_xy() damages pass tests, edit patch message] Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- - -Changes in v5: -- Use met->baseline instead of priv->baseline -- Use fontdata->height/width instead of VIDEO_FONT_HEIGHT/WIDTH -- Update console_rotate.c video_damage() calls to pass video tests -- Remove mention about not having minimal damage for console_rotate.c - -Changes in v2: -- Fix ranges in truetype target -- Limit rotate to necessary damage - drivers/video/console_normal.c | 18 +++++++++++ drivers/video/console_rotate.c | 54 ++++++++++++++++++++++++++++++++ drivers/video/console_truetype.c | 21 +++++++++++++ @@ -1744,7 +953,7 @@ Changes in v2: 4 files changed, 94 insertions(+) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c -index 413c7abee9e1..a19ce6a2bc11 100644 +index a0231293f31..ad7ce860e9d 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -39,6 +39,12 @@ static int console_set_row(struct udevice *dev, uint row, int clr) @@ -1787,7 +996,7 @@ index 413c7abee9e1..a19ce6a2bc11 100644 if (ret) return ret; diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c -index 65358a1c6e74..6c3e7c1bb8dc 100644 +index 65358a1c6e7..6c3e7c1bb8d 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -36,6 +36,12 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) @@ -1908,10 +1117,10 @@ index 65358a1c6e74..6c3e7c1bb8dc 100644 } diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c -index 0f9bb49e44f7..0adbf9cc3d67 100644 +index 14fb81e9563..c0a5ad1a51e 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c -@@ -178,6 +178,7 @@ struct console_tt_priv { +@@ -190,6 +190,7 @@ struct console_tt_store { static int console_truetype_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -1919,7 +1128,7 @@ index 0f9bb49e44f7..0adbf9cc3d67 100644 struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *end, *line; -@@ -221,6 +222,12 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -233,6 +234,12 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1932,7 +1141,7 @@ index 0f9bb49e44f7..0adbf9cc3d67 100644 return 0; } -@@ -228,6 +235,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -240,6 +247,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, uint rowsrc, uint count) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -1940,7 +1149,7 @@ index 0f9bb49e44f7..0adbf9cc3d67 100644 struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *dst; -@@ -246,6 +254,12 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -258,6 +266,12 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, for (i = 0; i < priv->pos_ptr; i++) priv->pos[i].ypos -= diff; @@ -1953,7 +1162,7 @@ index 0f9bb49e44f7..0adbf9cc3d67 100644 return 0; } -@@ -403,6 +417,13 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, +@@ -415,6 +429,13 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, line += vid_priv->line_length; } @@ -1968,7 +1177,7 @@ index 0f9bb49e44f7..0adbf9cc3d67 100644 if (ret) return ret; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index ebf409d839f0..8bfcbc88dda7 100644 +index 09172f1f7f4..06e344f415c 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -199,6 +199,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, @@ -1979,138 +1188,13 @@ index ebf409d839f0..8bfcbc88dda7 100644 ret = video_sync_copy(dev, start, line); if (ret) return ret; +-- +2.43.0 -From patchwork Mon Aug 21 13:51:04 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823650 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=i+1wSJUC; - 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 4RTv7B5SVxz1yYZ - for ; Mon, 21 Aug 2023 23:52:38 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 2380887084; - Mon, 21 Aug 2023 15:51:45 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="i+1wSJUC"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 2081087081; Mon, 21 Aug 2023 15:51:43 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 -Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com - [IPv6:2a00:1450:4864:20::329]) - (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 45F8E8707A - for ; Mon, 21 Aug 2023 15:51:40 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wm1-x329.google.com with SMTP id - 5b1f17b1804b1-3fee600dce6so18065515e9.1 - for ; Mon, 21 Aug 2023 06:51:40 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625900; x=1693230700; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=du9K8HAMfjDBv9t9zq9p8Zs+vCZHJ6g2zmB7iSzSF7o=; - b=i+1wSJUCYpv3D2Y4WhFT+a+eXACMjCfu9K5FQkWQdC2smyIukzPLOT9TKll1BIlZ+S - 0BSrF+Vp8/DGT40HSh+wXWV4jYRbGaai6uC9HETzas7pJ6Qhy+ffz2UKdEYLi1VLHsaq - X75Z5dWmXphu9f83rAKezE9CYHm+PJtfCCmN6nzYmKby9xzdvEmPjC4JmCjqvh+sqORE - Bzxq55zbOUyTxIzqT01tuFNOw/v8W0H5dQ6fFOCzvxrMmYV1xWY68YL/0QqfqG2DG5q1 - XPDS0Sgg6L+yzBD2e/I0iNDZaFfXRDq4jvWBkELBWMrWm1880C9/qHFlPwFRRUlHYf+M - 4DSQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625900; x=1693230700; - 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=du9K8HAMfjDBv9t9zq9p8Zs+vCZHJ6g2zmB7iSzSF7o=; - b=ejVU1hfEMyFZ7BfMSqaYec4EUOoA0M467Rm/YLD9WqMi6MKcePqHndqYIVtBdIb8pl - jE/EUHhBvvRp1Bn9zpDfUbCUk27iKZaqWwqAa4ZLknDsCStzGovzG2+wKem8yoP2H1jp - e5tUVYZa2/MESz/zDnwWZV528p3+eHhCUUWBwTCt3plzb+SWqR1j0T40nBrUB+tDj1b0 - VYDTZvDCxDhQRGlLmMYX8QtWf/waAzPl5ePXvPhus06aR5+7O2V28M8yF2xRcceFSIQR - 4T2k/MBwCdM1+mpz6TnKB+zjN6Kj0TmPzEo9o6Pcc/lXWY0kRniuHFu0fzE84gOcGlOi - Xfyw== -X-Gm-Message-State: AOJu0YxMuk5t4Hh2FasrdRfRr0tLxX8vAgGS5cfNm5tZpbvKz9V6ip/a - g8C3FsqqNAKybynks3ECaaBXn+kLAr4= -X-Google-Smtp-Source: - AGHT+IE0aHC9IeAZ9om6v+CX5lhGhaikzyvs7K+JjasiPPxFotFPaEOG+0SHfy/L4wW7iRlvWFh0mw== -X-Received: by 2002:a5d:568f:0:b0:317:e5ec:8767 with SMTP id - f15-20020a5d568f000000b00317e5ec8767mr4615501wrv.21.1692625899711; - Mon, 21 Aug 2023 06:51:39 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.37 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:39 -0700 (PDT) +From b44368015bdea3e71cb1c392afa124e6d26ab798 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 07/13] video: test: Test video damage tracking via - vidconsole Date: Mon, 21 Aug 2023 16:51:04 +0300 -Message-Id: <20230821135111.3558478-8-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 +Subject: [PATCH 07/13] video: test: Test video damage tracking via vidconsole With VIDEO_DAMAGE, the video uclass tracks updated regions of the frame buffer in order to avoid unnecessary work during a video sync. Enable @@ -2118,22 +1202,17 @@ the config in sandbox and add a test for it, by printing strings at a few locations and checking the tracked region. Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- -This is hard to test because most things issue video syncs that process -and reset the damaged region. - -Changes in v5: -- Add patch "video: test: Test video damage tracking via vidconsole" - configs/sandbox_defconfig | 1 + test/dm/video.c | 56 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index 259f31f26cee..51b820f13121 100644 +index bc5bcb2a623..fa6b23f365c 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig -@@ -307,6 +307,7 @@ CONFIG_USB_ETH_CDC=y +@@ -311,6 +311,7 @@ CONFIG_USB_ETH_CDC=y CONFIG_VIDEO=y CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_VIDEO_COPY=y @@ -2142,7 +1221,7 @@ index 259f31f26cee..51b820f13121 100644 CONFIG_CONSOLE_TRUETYPE=y CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y diff --git a/test/dm/video.c b/test/dm/video.c -index e4bd27a6b76f..8c7d9800a42e 100644 +index e4bd27a6b76..8c7d9800a42 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -711,3 +711,59 @@ static int dm_test_video_copy(struct unit_test_state *uts) @@ -2205,139 +1284,13 @@ index e4bd27a6b76f..8c7d9800a42e 100644 + return 0; +} +DM_TEST(dm_test_video_damage, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +-- +2.43.0 -From patchwork Mon Aug 21 13:51:05 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823651 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=mvjKik+t; - 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 4RTv7M6kVWz1yYZ - for ; Mon, 21 Aug 2023 23:52:47 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 6CAC987085; - Mon, 21 Aug 2023 15:51:46 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="mvjKik+t"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 6192687085; Mon, 21 Aug 2023 15:51:45 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 -Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com - [IPv6:2a00:1450:4864:20::336]) - (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 D1E718706A - for ; Mon, 21 Aug 2023 15:51:42 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wm1-x336.google.com with SMTP id - 5b1f17b1804b1-3fee17aebc8so20256405e9.0 - for ; Mon, 21 Aug 2023 06:51:42 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625902; x=1693230702; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=OUPwGyIUGhu07FwRipI6J5nz3cUBWpffvk0k2vprnLg=; - b=mvjKik+ts2RRqakLQOi9t7J1i101HYF0aguRZ/P4y3h8SvaC+jrWNXPy+MyUiGFatO - EW5N4iqonVrCvE+i19nnSxA3TW5G5ItgSDTN6yq5TEp806h08MC17nKgCuRk/Urg+Nkj - ZewK+CW+lOR6k2kB8LtZylmeke1YHCeGMXq9VMK1hsm4co4hgSx0ZJ1OXiP5+tc4mVug - L2WSO1+ILyeHTT0N/dHw3FHShX08Y0SisUe32K946KofaqN6teHjb172uNMPVvd4Nk1S - G2GYNvIigYOzyXNzeBRUDXG3TkK8+ioXwBLZ4iqTsf77Dc0p2ePFbhc23gHzBcKBpUSc - O2nA== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625902; x=1693230702; - 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=OUPwGyIUGhu07FwRipI6J5nz3cUBWpffvk0k2vprnLg=; - b=PY5C635/8jWW5ixQ4L1L3j9qeTGHNNV7zdPW6utGplgCgNorieSsCHQweRvRmMeEuD - MFr4iXeMz4fuhtbE79McVeS1D2v3BXvw2DX52qn7G6MlWSp/OVuocmhZPavm+DsYq7wJ - D//vupLeuSNo0SXsniHXWL8NlKNfz7qnozFFui+kEvO0IwOmVbDRI99V9uZM3ng9hERg - y3hKkIFQSgXYtPJ+4h3reOPhrZLXW5t/o9rXjgeC+l6WyxkI6UASNgww0aC0iwiIg40B - enEpHJN00lL6FOkCuYsMay4itv3ydNVuzZHbW7w6tmgDHIWKLg4yi4tFuiSgl+EnJluq - pqDw== -X-Gm-Message-State: AOJu0YzfIxtWigpVmRfL01E4NvwPLzRkCCjd173t25icCTVna47obihz - mXXbV/Xvlo7hwqge7/MU2LnnCJaUcgE= -X-Google-Smtp-Source: - AGHT+IFzj3fGJ3yOnSTVNmg3QQIrMsHdzvHVI7a3IQjx0jS8kD0qBSvWJ3Z5+c4jA0D6oPZBiuGxwA== -X-Received: by 2002:a5d:6811:0:b0:319:8a5a:ab5e with SMTP id - w17-20020a5d6811000000b003198a5aab5emr4349395wru.38.1692625902291; - Mon, 21 Aug 2023 06:51:42 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.40 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:41 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 08/13] video: Add damage notification on bmp display -Date: Mon, 21 Aug 2023 16:51:05 +0300 -Message-Id: <20230821135111.3558478-9-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From 9278f6c9492b0a7960a6ee2294a524ef150bf1cb Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:05 +0300 +Subject: [PATCH 08/13] video: Add damage notification on bmp display Let's report the video damage when we draw a bitmap on the screen. This way we can later lazily flush only relevant regions to hardware. @@ -2347,14 +1300,11 @@ Reported-by: Da Xue Reviewed-by: Simon Glass Signed-off-by: Alper Nebi Yasak --- - -(no changes since v1) - drivers/video/video_bmp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c -index 45f003c8251a..10943b9ca19f 100644 +index 45f003c8251..10943b9ca19 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -460,6 +460,8 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, @@ -2366,138 +1316,13 @@ index 45f003c8251a..10943b9ca19f 100644 /* Find the position of the top left of the image in the framebuffer */ fb = (uchar *)(priv->fb + y * priv->line_length + x * bpix / 8); ret = video_sync_copy(dev, start, fb); +-- +2.43.0 -From patchwork Mon Aug 21 13:51:06 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823652 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=rvkBTDGo; - 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 4RTv7Y6TNDz1yYZ - for ; Mon, 21 Aug 2023 23:52:57 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id B23478708D; - Mon, 21 Aug 2023 15:51:48 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="rvkBTDGo"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id E994E87081; Mon, 21 Aug 2023 15:51:47 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 -Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com - [IPv6:2a00:1450:4864:20::430]) - (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 4A29E8708E - for ; Mon, 21 Aug 2023 15:51:45 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x430.google.com with SMTP id - ffacd0b85a97d-31427ddd3fbso3057122f8f.0 - for ; Mon, 21 Aug 2023 06:51:45 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625905; x=1693230705; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=NHWfOmBWnCfG15vLo7N7Y/b5x/nSoPE0dmgy30xOm9Q=; - b=rvkBTDGokSsZ+zHSmCyephYHOa1zCgYEH1V/eHcDIaJehG3LF1h3ZetBhv0F1WCnRL - dg0OqSl4nhT+d01IqkhLNI1FTeIJQeE/FHwY83jActydA9RdIKB97V7VAmOnABjsedPs - n/m1fNRUpKdpm/TBglBcCWTlhrozxmO+plcVOAjMhNlQQGUGkRo1eq/yHOw8pzfiIQVT - 4G4hJi3ePKSsEYbd1YuMZSkrzN70N+Erw/eeRb2QAdkn4J6xcJyPMEWirh7uNV2erutB - ZzxtmQOTBV9y19HeQkYKJeCnpReJ2LaLzTJj72ehPZpZqbYfj67OE+MeCC6Yt/m3YILh - fpGQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625905; x=1693230705; - 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=NHWfOmBWnCfG15vLo7N7Y/b5x/nSoPE0dmgy30xOm9Q=; - b=i5Ecd9fdl1ZJU0VqAc78F3Pmf9jo/gquJagwYJOv+0Gs8ayWCAJVUNkBV1a10fi3YU - uHNi0JjDvPtp8HPET+X5ywPbVDMbGOtad+ZjijeZL+mbC+Zc+lN2Oy35AoZjAeiYYqcL - qr+tjpJBWmj7lsr4rZ+Tqpc5m93dDUcxAeKZeOas3KQ+oM/S5zaPEb6puDJuVXTGbx9/ - NF+fyUg6I5MN+ZrT/+2pj8da5MpJaSlYzzymyg7JmdELwMKcBJsOuVNFfj+kXHLAmapY - MCO+hRidacGMoSYFLc/PHU7rU1qZqAWuizW35JPJmGYWschbDBhU5HWTPkJ8ifdZ9dqO - 7kkA== -X-Gm-Message-State: AOJu0YxlhwAy04+v9sqR7+z6BpzMYlqGrKNxnrBV5TAuFHvCn94+0y5X - UCsHr11K/guiHrF8/+oTMNTEUjwCaRQ= -X-Google-Smtp-Source: - AGHT+IF9A6Dqme3W/tV3JyovhEsU6i4A15qi8QyYKIlOrt7P6EPMkzmv+B+4oB2S58BxD/9oTr/SHQ== -X-Received: by 2002:a5d:4988:0:b0:31a:e6c2:770d with SMTP id - r8-20020a5d4988000000b0031ae6c2770dmr4196623wrq.36.1692625904737; - Mon, 21 Aug 2023 06:51:44 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.42 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:44 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 09/13] efi_loader: GOP: Add damage notification on BLT -Date: Mon, 21 Aug 2023 16:51:06 +0300 -Message-Id: <20230821135111.3558478-10-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From b56b97ef176a2753a9827d761760a829eece00d0 Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:06 +0300 +Subject: [PATCH 09/13] efi_loader: GOP: Add damage notification on BLT Now that we have a damage tracking API, let's populate damage done by UEFI payloads when they BLT data onto the screen. @@ -2507,28 +1332,16 @@ Reported-by: Da Xue Reviewed-by: Heinrich Schuchardt [Alper: Add struct comment for new member] Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- - -Changes in v5: -- Document new vdev field in struct efi_gop_obj comment - -Changes in v4: -- Skip damage on EfiBltVideoToBltBuffer - -Changes in v3: -- Adapt to always assume DM is used - -Changes in v2: -- Remove ifdefs from gop - lib/efi_loader/efi_gop.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c -index 778b693f983a..db6535e080c4 100644 +index a09db31eb46..ede77af1fe4 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c -@@ -24,6 +24,7 @@ static const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; +@@ -25,6 +25,7 @@ static const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; * @ops: graphical output protocol interface * @info: graphical output mode information * @mode: graphical output mode @@ -2536,7 +1349,7 @@ index 778b693f983a..db6535e080c4 100644 * @bpix: bits per pixel * @fb: frame buffer */ -@@ -32,6 +33,7 @@ struct efi_gop_obj { +@@ -33,6 +34,7 @@ struct efi_gop_obj { struct efi_gop ops; struct efi_gop_mode_info info; struct efi_gop_mode mode; @@ -2544,7 +1357,7 @@ index 778b693f983a..db6535e080c4 100644 /* Fields we only have access to during init */ u32 bpix; void *fb; -@@ -120,6 +122,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, +@@ -121,6 +123,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, u32 *fb32 = gopobj->fb; u16 *fb16 = gopobj->fb; struct efi_gop_pixel *buffer = __builtin_assume_aligned(bufferp, 4); @@ -2552,7 +1365,7 @@ index 778b693f983a..db6535e080c4 100644 if (delta) { /* Check for 4 byte alignment */ -@@ -243,6 +246,9 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, +@@ -244,6 +247,9 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, dlineoff += dwidth; } @@ -2562,147 +1375,21 @@ index 778b693f983a..db6535e080c4 100644 return EFI_SUCCESS; } -@@ -548,6 +554,7 @@ efi_status_t efi_gop_register(void) +@@ -550,6 +556,7 @@ efi_status_t efi_gop_register(void) gopobj->info.pixels_per_scanline = col; gopobj->bpix = bpix; - gopobj->fb = fb; + gopobj->fb = map_sysmem(fb_base, fb_size); + gopobj->vdev = vdev; return EFI_SUCCESS; } +-- +2.43.0 -From patchwork Mon Aug 21 13:51:07 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823653 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=SJ3CoTwS; - 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 4RTv7l6Gwbz1yYZ - for ; Mon, 21 Aug 2023 23:53:07 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 04C3A87091; - Mon, 21 Aug 2023 15:51:52 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="SJ3CoTwS"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 79C6786F0A; Mon, 21 Aug 2023 15:51: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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 -Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com - [IPv6:2a00:1450:4864:20::435]) - (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 E3F3B86E80 - for ; Mon, 21 Aug 2023 15:51:47 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x435.google.com with SMTP id - ffacd0b85a97d-31aeef88a55so1551204f8f.2 - for ; Mon, 21 Aug 2023 06:51:47 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625907; x=1693230707; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=l/DCoXVnGlEMqWseytQAYuhC9MvrFlVv7QEu+lzOB9U=; - b=SJ3CoTwShv0m1a2l77IYGRiPJhE773qxJozbJ8TLkbWb/Fs3vzMjaetMjO1LteCIix - nxWVY9KC93yaMYqJT6SqYWKi1BaFToYnd6muvummJcQpRouAllJWg2nVkF0e6rb8GdHn - kEvHDvCo4Xq4Lrpvs6/W0ONesn+kGcCJbX3+BARXOoTD87bHAQpb5gcTr6FjYwUraYf/ - 31t1qEak7+tRD5cuPx0ItVaX8KSHeAMuueL0gEw6Wt64zNUyAO7W7cCRNJFMIsBkB2Lw - IOsoOk7kBgIqU/InShFLnIoLlW9EafAood5bDff+/ADKYaXgkgxpBbWQWgtF6tmmvjGO - gfgg== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625907; x=1693230707; - 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=l/DCoXVnGlEMqWseytQAYuhC9MvrFlVv7QEu+lzOB9U=; - b=Tx8Anl+tKgGLw4YpMhb5VbWFhDaaZ7izCBtT/Mun3zxxONGjrw/1uYrQVf/HxeEzcw - 0VQqKGIC9Kek3RaHw20BGPdbmmDTmaVo3IGNrikhp2qDmM0bBH2AVbn0K5MV5t9dwKsA - U5D/cFon6pqj8sco6Dd5oVBskjrgqlgNtd3HXzCrfuFmFtsXxecVmlgKOnnE8Kj+CGGI - D2EMM/0yQCq/vuxC4/ISIiaRk0/6GCX55V8DYg+claM+h691kk/LGeEGXJqs5X1wFGQU - EZeKiKrY2VvqZ7yOXoriyel6QE7BvHmCmurDC+oji/do1hnGp/6NPxPFV/ABKsRmjPGY - V6Eg== -X-Gm-Message-State: AOJu0YxqpYt8rTBNvBZ9hiz/qYI+xhkc2uURaJNeyYssFbd+tACGWJtX - 6fE/7qVWobRKTs1ZWXtn3qcomaeF/nc= -X-Google-Smtp-Source: - AGHT+IHlrJ5IlwhVESQ4N6S+FeCJPNau4Ry7TWJN4H6yUmdpI19HJsGEPwtYtoPvcLuI4yNltjc9CQ== -X-Received: by 2002:a5d:4483:0:b0:317:dada:2417 with SMTP id - j3-20020a5d4483000000b00317dada2417mr4326536wrq.31.1692625907186; - Mon, 21 Aug 2023 06:51:47 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.45 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:46 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 10/13] video: Only dcache flush damaged lines -Date: Mon, 21 Aug 2023 16:51:07 +0300 -Message-Id: <20230821135111.3558478-11-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From e77793c6320f827b4f8efc06bd55d38037b6373e Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:07 +0300 +Subject: [PATCH 10/13] video: Only dcache flush damaged lines Now that we have a damage area tells us which parts of the frame buffer actually need updating, let's only dcache flush those on video_sync() @@ -2715,20 +1402,11 @@ Reported-by: Da Xue Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak --- - -Changes in v5: -- Use xstart, ystart, xend, yend as names for damage region -- Use IS_ENABLED() instead of CONFIG_IS_ENABLED() - -Changes in v2: -- Fix dcache range; we were flushing too much before -- Remove ifdefs - drivers/video/video-uclass.c | 41 +++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 8bfcbc88dda7..a50220bcc684 100644 +index 06e344f415c..ac2141892bf 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -385,6 +385,41 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) @@ -2786,138 +1464,13 @@ index 8bfcbc88dda7..a50220bcc684 100644 #elif defined(CONFIG_VIDEO_SANDBOX_SDL) static ulong last_sync; +-- +2.43.0 -From patchwork Mon Aug 21 13:51:08 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823654 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=JgtEabWc; - 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 4RTv7w4Mskz1yYZ - for ; Mon, 21 Aug 2023 23:53:16 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 4790487096; - Mon, 21 Aug 2023 15:51:54 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="JgtEabWc"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 102DC87096; Mon, 21 Aug 2023 15:51:54 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 -Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com - [IPv6:2a00:1450:4864:20::429]) - (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 4AFE187098 - for ; Mon, 21 Aug 2023 15:51:50 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x429.google.com with SMTP id - ffacd0b85a97d-31c3726cc45so1247414f8f.0 - for ; Mon, 21 Aug 2023 06:51:50 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625910; x=1693230710; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=NdoZCMaizC3Y759MOjDBPu1VoZ+fIm/Lqzoh+gR4stQ=; - b=JgtEabWcIca2ALjUCCqGgXmUf5MREa+Jm3Yt8fmf6mwr8MrhP5Iu7KssN+MMQbAxKO - cl+LarTpXoK8lh4x2WmdcUKViUJdCAMCFJCk6vdMhIFAjaBH1Sqhudg315eFGharTw6G - 7FFSDdE1ZAablttQmfgcm59Ilk5+2QRAFycWcOiue5yFfF8RSAAAF8UHkl7rKxgQKHCO - NWC3P4PdjYEtaQFoJ4R5txJ07Wdvoptc9JVL9WGf4wSL5X6fm+SbalQaW3YgFuKNy0fk - 0+lmUOMDOXmwx4iGWZd6+LRFXYEZGCZ95AvjoDF83ZlL9Nu1oUvB/qzH7PRJatx6j/mw - J8Zw== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625910; x=1693230710; - 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=NdoZCMaizC3Y759MOjDBPu1VoZ+fIm/Lqzoh+gR4stQ=; - b=ATA2PnRfDc2gQVzxEqGIcgBsTvJvkOPNl2NSZEoxqmZfEe/94an/QM50JhcxX0wNEA - 0HpCsEsyDLhFnjW4APp/TYwLoc0mbRD/T517DYROiuJLUSRxyO/NApA1qyRJpVQTqpRc - dRZ5hG5VoUH3oHfwZN1abRKxbIogLNiJhSSNDvjA01RYJwTZY6Fq8xUJCYp9gI28/OI0 - oZ0SA+qdXZ4UvNR/uqun2tysI+JnatTKlbwSfCF7q/sj5AfH/VNk3EqNROuXlIBRMWI8 - pgosvMd73/GvTMQvsWPgGNNc3fhZgcnLKIoQFKdoqCeSFAufSLREsoWPLMMH1xXuh1lG - JKFQ== -X-Gm-Message-State: AOJu0YyKi/tYIN4uVjau5AbbNkJPzybGF79aUx+ls+uiyxVTGeu0zy64 - aMCSasGPaxyg+ogYkqU0Dx/1q3mIbnM= -X-Google-Smtp-Source: - AGHT+IHsb00O74X0NrGSp+Znx7MktY8oHr2PL7yyjJMmEkZVU5lzx7Wg/Yr0hFddlw1zsptntp6etA== -X-Received: by 2002:a05:6000:1cce:b0:314:ca7:f30b with SMTP id - bf14-20020a0560001cce00b003140ca7f30bmr5251008wrb.54.1692625909678; - Mon, 21 Aug 2023 06:51:49 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.47 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:49 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 11/13] video: Use VIDEO_DAMAGE for VIDEO_COPY -Date: Mon, 21 Aug 2023 16:51:08 +0300 -Message-Id: <20230821135111.3558478-12-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From e9d51b4dcbfa43aa0e4d2b4f285bf94c295603e4 Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:08 +0300 +Subject: [PATCH 11/13] video: Use VIDEO_DAMAGE for VIDEO_COPY CONFIG_VIDEO_COPY implemented a range-based copying mechanism: If we print a single character, it will always copy the full range of bytes @@ -2942,25 +1495,6 @@ Signed-off-by: Alexander Graf Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak --- - -Changes in v5: -- Remove video_sync_copy() also from video_fill(), video_fill_part() -- Fix memmove() calls by removing the extra dev argument -- Call video_sync() before checking copy_fb in video tests -- Use xstart, ystart, xend, yend as names for damage region -- Use met->baseline instead of priv->baseline -- Use fontdata->height/width instead of VIDEO_FONT_HEIGHT/WIDTH -- Use xstart, ystart, xend, yend as names for damage region -- Use IS_ENABLED() instead of CONFIG_IS_ENABLED() -- Drop VIDEO_DAMAGE from sandbox defconfig added in a new patch -- Update dm_test_video_copy test added in a new patch - -Changes in v3: -- Make VIDEO_COPY always select VIDEO_DAMAGE - -Changes in v2: -- Add patch "video: Use VIDEO_DAMAGE for VIDEO_COPY" - configs/sandbox_defconfig | 1 - drivers/video/Kconfig | 5 ++ drivers/video/console_normal.c | 13 +---- @@ -2975,10 +1509,10 @@ Changes in v2: 11 files changed, 43 insertions(+), 248 deletions(-) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index 51b820f13121..259f31f26cee 100644 +index fa6b23f365c..bc5bcb2a623 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig -@@ -307,7 +307,6 @@ CONFIG_USB_ETH_CDC=y +@@ -311,7 +311,6 @@ CONFIG_USB_ETH_CDC=y CONFIG_VIDEO=y CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_VIDEO_COPY=y @@ -2987,7 +1521,7 @@ index 51b820f13121..259f31f26cee 100644 CONFIG_CONSOLE_TRUETYPE=y CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index 97f494a1340b..b3fbd9d7d9ca 100644 +index ac3edbfdb54..438cf3d4899 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -83,11 +83,14 @@ config VIDEO_PCI_DEFAULT_FB_SIZE @@ -3015,7 +1549,7 @@ index 97f494a1340b..b3fbd9d7d9ca 100644 bool "Generic PWM based Backlight Driver" depends on BACKLIGHT && DM_PWM diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c -index a19ce6a2bc11..c44aa09473a3 100644 +index ad7ce860e9d..5625dbb8d08 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c @@ -35,10 +35,6 @@ static int console_set_row(struct udevice *dev, uint row, int clr) @@ -3057,7 +1591,7 @@ index a19ce6a2bc11..c44aa09473a3 100644 } diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c -index 6c3e7c1bb8dc..6e9067d1c7fb 100644 +index 6c3e7c1bb8d..6e9067d1c7f 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c @@ -21,7 +21,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) @@ -3201,10 +1735,10 @@ index 6c3e7c1bb8dc..6e9067d1c7fb 100644 return ret; diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c -index 0adbf9cc3d67..07bb0af71311 100644 +index c0a5ad1a51e..7aa1cdaef88 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c -@@ -182,7 +182,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -194,7 +194,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *end, *line; @@ -3212,7 +1746,7 @@ index 0adbf9cc3d67..07bb0af71311 100644 line = vid_priv->fb + row * met->font_size * vid_priv->line_length; end = line + met->font_size * vid_priv->line_length; -@@ -218,9 +217,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -230,9 +229,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) default: return -ENOSYS; } @@ -3222,7 +1756,7 @@ index 0adbf9cc3d67..07bb0af71311 100644 video_damage(dev->parent, 0, -@@ -240,14 +236,11 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -252,14 +248,11 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, struct console_tt_metrics *met = priv->cur_met; void *dst; void *src; @@ -3239,7 +1773,7 @@ index 0adbf9cc3d67..07bb0af71311 100644 /* Scroll up our position history */ diff = (rowsrc - rowdst) * met->font_size; -@@ -280,7 +273,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, +@@ -292,7 +285,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, u8 *bits, *data; int advance; void *start, *end, *line; @@ -3248,7 +1782,7 @@ index 0adbf9cc3d67..07bb0af71311 100644 /* First get some basic metrics about this character */ stbtt_GetCodepointHMetrics(font, ch, &advance, &lsb); -@@ -424,9 +417,6 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, +@@ -436,9 +429,6 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, width, height); @@ -3259,10 +1793,10 @@ index 0adbf9cc3d67..07bb0af71311 100644 return width_frac; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c -index 05f930478096..27a1e8ec3e49 100644 +index 22d55df71f6..16b38a27d39 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c -@@ -682,22 +682,6 @@ UCLASS_DRIVER(vidconsole) = { +@@ -751,22 +751,6 @@ UCLASS_DRIVER(vidconsole) = { .per_device_auto = sizeof(struct vidconsole_priv), }; @@ -3286,7 +1820,7 @@ index 05f930478096..27a1e8ec3e49 100644 { int ret; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index a50220bcc684..c79499252a22 100644 +index ac2141892bf..afbd4670240 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -160,7 +160,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, @@ -3436,7 +1970,7 @@ index a50220bcc684..c79499252a22 100644 extern u8 __splash_ ## _name ## _begin[]; \ extern u8 __splash_ ## _name ## _end[] diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c -index 10943b9ca19f..da2bbe864a03 100644 +index 10943b9ca19..da2bbe864a0 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c @@ -268,7 +268,6 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, @@ -3460,10 +1994,10 @@ index 10943b9ca19f..da2bbe864a03 100644 return video_sync(dev, false); } diff --git a/include/video.h b/include/video.h -index a522f33949e5..42e57b44188d 100644 +index 1310195f307..29eff3c0900 100644 --- a/include/video.h +++ b/include/video.h -@@ -350,43 +350,6 @@ void video_set_default_colors(struct udevice *dev, bool invert); +@@ -353,43 +353,6 @@ void video_set_default_colors(struct udevice *dev, bool invert); */ int video_default_font_height(struct udevice *dev); @@ -3508,10 +2042,10 @@ index a522f33949e5..42e57b44188d 100644 * video_damage() - Notify the video subsystem about screen updates. * diff --git a/include/video_console.h b/include/video_console.h -index 2694e44f6ecf..caadeb878989 100644 +index bde67fa9a5a..43bc7db489a 100644 --- a/include/video_console.h +++ b/include/video_console.h -@@ -404,56 +404,4 @@ void vidconsole_list_fonts(struct udevice *dev); +@@ -527,56 +527,4 @@ void vidconsole_list_fonts(struct udevice *dev); */ int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep); @@ -3569,7 +2103,7 @@ index 2694e44f6ecf..caadeb878989 100644 - #endif diff --git a/test/dm/video.c b/test/dm/video.c -index 8c7d9800a42e..4c3bcd26e94f 100644 +index 8c7d9800a42..4c3bcd26e94 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -106,6 +106,7 @@ static int check_copy_frame_buffer(struct unit_test_state *uts, @@ -3589,139 +2123,13 @@ index 8c7d9800a42e..4c3bcd26e94f 100644 return 0; } +-- +2.43.0 -From patchwork Mon Aug 21 13:51:09 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823655 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=Q9fX66MT; - 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 4RTv8541j7z1yYZ - for ; Mon, 21 Aug 2023 23:53:25 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 909B287075; - Mon, 21 Aug 2023 15:51:56 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="Q9fX66MT"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 801C187082; Mon, 21 Aug 2023 15:51:55 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.2 -Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com - [IPv6:2a00:1450:4864:20::431]) - (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 D67548709E - for ; Mon, 21 Aug 2023 15:51:52 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wr1-x431.google.com with SMTP id - ffacd0b85a97d-317716a4622so3055294f8f.1 - for ; Mon, 21 Aug 2023 06:51:52 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625912; x=1693230712; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=pB2qI48avq9qUXnFEl+wSnmS8SG0cxx3SZjicfp6H7M=; - b=Q9fX66MTTcUQaIK9Ypbt13c6159mxahNRVYZb/qRcTZRgB9DWf7SyL5B6iwaerzl6H - V/NgeKQknUqjdF1rx5cN+0oUlRjL/uqf2PRT1u/2iPSTrLx9ImfxO59U1v7bkAyqsRHD - 9d/OLcbkmN2dqLKXGEJEhw9wRWn6PflMZfMjZfJ6PgDh1lldO8RAGdA+f9Wv0Uqs/CHY - M6HHFEIenHnWt15i3RWPMrP09rbx4OkOqYNXz1V/3BWUxb3tRe+1IqwA2n/oEpR5c0PM - YcGRP1tNM3yqfxG53IdsPPiujOtSHSbvtWSyefvk7z3wSlVPYMzicea8BirSi8/Ag/R0 - CJ5A== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625912; x=1693230712; - 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=pB2qI48avq9qUXnFEl+wSnmS8SG0cxx3SZjicfp6H7M=; - b=L5dQ5I1/r76Ec7WfGFYq1iqhI4RaRdXt+61BNvttoSzkuI28cDeE9IYg5h41YdBzNd - t6sNriBN4Qc+mGdOBHQb7hoI62tzka68Qd18eexmWznS1lz73CJWNA6nW0T2heZpmRnx - frQSxlPNxv5FZ2eXSdZLRIhWG0T0L+B+G/6B665+1/N1tvTFCLsToL2GaiGnEskSn3rJ - wQPY7b2lG/xkfWZiNERig8/6ZMW5R3QQDdOucA/FVYuHY4/dr+9UuPEHaimYzTwzN6AM - aehqXj0h7YO8NjF9HG1n1T4hEYq0FKqbcb2t+hLAUBpzGBjLNrpCdWa9LzQWN0EEJw8H - /ijQ== -X-Gm-Message-State: AOJu0YwwdmeqIA0FUSFZkbrYH8d4F3YWnny6MkSqZvX6DQEtu9Y/TVK7 - x418Ed0mXh7BUNyNIuPNquOOpbM3J+o= -X-Google-Smtp-Source: - AGHT+IFpiAY2BjXpJaKJJodzwN7aKj9YFF3eAkfmZgRFnB94o3W7mQtEZgXERHeKNVbIpRB5HlMypw== -X-Received: by 2002:a05:6000:1205:b0:31c:4f80:9f7 with SMTP id - e5-20020a056000120500b0031c4f8009f7mr1593479wrx.45.1692625912317; - Mon, 21 Aug 2023 06:51:52 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.50 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:51 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 12/13] video: Always compile cache flushing code -Date: Mon, 21 Aug 2023 16:51:09 +0300 -Message-Id: <20230821135111.3558478-13-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From 8831933fcc6cf60308e6ede438409717ab1a94a6 Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:09 +0300 +Subject: [PATCH 12/13] video: Always compile cache flushing code The dcache flushing code path was conditional on ARM && !DCACHE config options. However, dcaches exist on other platforms as well and may need @@ -3739,17 +2147,11 @@ Signed-off-by: Alexander Graf Reviewed-by: Simon Glass Signed-off-by: Alper Nebi Yasak --- - -(no changes since v4) - -Changes in v4: -- Add patch "video: Always compile cache flushing code" - drivers/video/video-uclass.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index c79499252a22..3f9ddaadd15d 100644 +index afbd4670240..2c7777261ad 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -377,11 +377,13 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) @@ -3792,139 +2194,13 @@ index c79499252a22..3f9ddaadd15d 100644 static ulong last_sync; if (force || get_timer(last_sync) > 100) { +-- +2.43.0 -From patchwork Mon Aug 21 13:51:10 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Alper Nebi Yasak -X-Patchwork-Id: 1823656 -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=gmail.com header.i=@gmail.com header.a=rsa-sha256 - header.s=20221208 header.b=LXQ9F9oF; - 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 4RTv8G1ylrz1yYZ - for ; Mon, 21 Aug 2023 23:53:34 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id D63BC87082; - Mon, 21 Aug 2023 15:51:59 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="LXQ9F9oF"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 6DC358709F; Mon, 21 Aug 2023 15:51:58 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, - SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com - [IPv6:2a00:1450:4864:20::329]) - (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 B9E5887094 - for ; Mon, 21 Aug 2023 15:51:55 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=gmail.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=alpernebiyasak@gmail.com -Received: by mail-wm1-x329.google.com with SMTP id - 5b1f17b1804b1-3fee5ddc23eso19328245e9.1 - for ; Mon, 21 Aug 2023 06:51:55 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=gmail.com; s=20221208; t=1692625915; x=1693230715; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=q4KbQNgBgg/jRM/b8KJaE0YjvGZTzMRikT8MXE6mjwI=; - b=LXQ9F9oF17Es3W44Ien7NWJ7ymwABfjmSOFUn1nlvsBdcyw9b3O/o8ulQCpUwqhXho - Lsoff11Pmwlo87siidtGiRDX/BRiaZ8rBVWjS3jgK+U6RDPcwNCfR7otgNlLLaNyAd4w - BCXHT1+90WvAX/9alOvPUYlvUkP1t/S15/C+bUJWxok5Nf6l5iGthuNMWvZFFiUdQ8yR - 02AJastvoFpsYlAJI+JY69q6OhIhuxvdeDVc81dEOKzKkkEOdENJDmT6pJI4fiWlgwEE - iSJz97xC4lCSs+y5RPJTJfxE97zWwduKphPAN75dLRw0vnBYyqeXIo4ERx4uO7ku2jHf - 8feQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20221208; t=1692625915; x=1693230715; - 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=q4KbQNgBgg/jRM/b8KJaE0YjvGZTzMRikT8MXE6mjwI=; - b=VOZaSadRyfgFoQTc22AZ+r/0BSY4/MskC2GhVnMFg1gAc1bBAg7PJOyNu3x0V3ICuX - w68LWLVRLSaTmnF46xARtATTh8hJhyj7k3/oD4mNclUIyfmx/9vTSXJLn1MsG6m3TL8z - l5QNyUjNlgAK+YeuYH6zQl/yp5lmAF4EaOg5ITz+eLN2lf10QPYS18/bVbvNQ0Q2cwIN - FH+i7NhTRVoeExDFNVEFO11ZI3CJiAzpMC4WhI6OucHDWGIzEGcQKOYu9FfgwOfF5dVY - Yc6qjX3w9zhbwV3LA/grMncdSA9joMxVkWJwvFFD+6AlVLgin7DH8EDaIOtENT/RD/qq - Hjvw== -X-Gm-Message-State: AOJu0YyYX84n+767GB59OryFC5m/WbElRHO2Ix8D2HaL8Wnef45wnjme - 9nuXLuU5B1juuVwSn7QqTlnSVvjWNGQ= -X-Google-Smtp-Source: - AGHT+IER2mHBuKBsYnQ3qf+DOtUzSQystkj8v17bWgFVK+zSLUhwLW9BOExvB2cO0RXSrx1vnjzR/w== -X-Received: by 2002:adf:e711:0:b0:317:e542:80a8 with SMTP id - c17-20020adfe711000000b00317e54280a8mr4968619wrm.15.1692625915025; - Mon, 21 Aug 2023 06:51:55 -0700 (PDT) -Received: from ALPER-PC.. ([178.233.24.1]) by smtp.gmail.com with ESMTPSA id - r11-20020a5d4e4b000000b00317b063590fsm12600049wrt.55.2023.08.21.06.51.52 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 21 Aug 2023 06:51:54 -0700 (PDT) -From: Alper Nebi Yasak -To: u-boot@lists.denx.de -Cc: Kever Yang , - Jagan Teki , - Andre Przywara , - Svyatoslav Ryhel , Alexander Graf , - Philipp Tomsich , Andrew Davis , - Da Xue , Heinrich Schuchardt , - Patrice Chotard , - Patrick Delaunay , - Derald Woods , - Anatolij Gustschin , - uboot-stm32@st-md-mailman.stormreply.com, Simon Glass , - Matthias Brugger , u-boot-amlogic@groups.io, - Ilias Apalodimas , - Neil Armstrong , - Alper Nebi Yasak -Subject: [PATCH v5 13/13] video: Enable VIDEO_DAMAGE for drivers that need it -Date: Mon, 21 Aug 2023 16:51:10 +0300 -Message-Id: <20230821135111.3558478-14-alpernebiyasak@gmail.com> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20230821135111.3558478-1-alpernebiyasak@gmail.com> -References: <20230821135111.3558478-1-alpernebiyasak@gmail.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 - +From 676104d8420152c97321c4fa22bb925fb139dd66 Mon Sep 17 00:00:00 2001 From: Alexander Graf +Date: Mon, 21 Aug 2023 16:51:10 +0300 +Subject: [PATCH 13/13] video: Enable VIDEO_DAMAGE for drivers that need it Some drivers call video_set_flush_dcache() to indicate that they want to have the dcache flushed for the frame buffer. These drivers benefit from @@ -3938,32 +2214,25 @@ Signed-off-by: Alexander Graf [Alper: Add to VIDEO_TIDSS, imply instead of select] Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak +Reviewed-by: Simon Glass --- - -Changes in v5: -- Imply VIDEO_DAMAGE for video drivers instead of selecting it -- Imply VIDEO_DAMAGE also for VIDEO_TIDSS - -Changes in v4: -- Add patch "video: Enable VIDEO_DAMAGE for drivers that need it" - - arch/arm/mach-sunxi/Kconfig | 1 + - drivers/video/Kconfig | 8 ++++++++ - drivers/video/exynos/Kconfig | 1 + - drivers/video/imx/Kconfig | 1 + - drivers/video/meson/Kconfig | 1 + - drivers/video/rockchip/Kconfig | 1 + - drivers/video/stm32/Kconfig | 1 + - drivers/video/tegra20/Kconfig | 1 + - drivers/video/tidss/Kconfig | 1 + - 10 files changed, 17 insertions(+) + arch/arm/mach-sunxi/Kconfig | 1 + + drivers/video/Kconfig | 8 ++++++++ + drivers/video/exynos/Kconfig | 1 + + drivers/video/imx/Kconfig | 1 + + drivers/video/meson/Kconfig | 1 + + drivers/video/rockchip/Kconfig | 1 + + drivers/video/stm32/Kconfig | 1 + + drivers/video/tegra20/Kconfig | 1 + + drivers/video/tidss/Kconfig | 1 + + 9 files changed, 16 insertions(+) diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig -index 9d5df2c10273..fb4478ea32e8 100644 +index a4a8d8e9445..1d32a3140bf 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -813,6 +813,7 @@ config VIDEO_SUNXI - depends on !SUN50I_GEN_H6 +@@ -846,6 +846,7 @@ config VIDEO_SUNXI + depends on !SUNXI_GEN_NCAT2 select VIDEO select DISPLAY + imply VIDEO_DAMAGE @@ -3971,7 +2240,7 @@ index 9d5df2c10273..fb4478ea32e8 100644 default y ---help--- diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index b3fbd9d7d9ca..185dbb1f8390 100644 +index 438cf3d4899..a736ee6724c 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -499,6 +499,7 @@ config VIDEO_LCD_ANX9804 @@ -4039,7 +2308,7 @@ index b3fbd9d7d9ca..185dbb1f8390 100644 Enables a simple display driver for ST-Ericsson MCDE (Multichannel Display Engine), which reads the configuration from diff --git a/drivers/video/exynos/Kconfig b/drivers/video/exynos/Kconfig -index 599d19d5ecc2..a2cf752aac03 100644 +index 599d19d5ecc..a2cf752aac0 100644 --- a/drivers/video/exynos/Kconfig +++ b/drivers/video/exynos/Kconfig @@ -12,6 +12,7 @@ config EXYNOS_DP @@ -4051,7 +2320,7 @@ index 599d19d5ecc2..a2cf752aac03 100644 config EXYNOS_MIPI_DSIM bool "Exynos MIPI DSI support" diff --git a/drivers/video/imx/Kconfig b/drivers/video/imx/Kconfig -index 34e8b640595b..5db3e5c0499e 100644 +index 34e8b640595..5db3e5c0499 100644 --- a/drivers/video/imx/Kconfig +++ b/drivers/video/imx/Kconfig @@ -2,6 +2,7 @@ @@ -4063,7 +2332,7 @@ index 34e8b640595b..5db3e5c0499e 100644 This enables framebuffer driver for i.MX processors working on the IPUv3(Image Processing Unit) internal graphic processor. diff --git a/drivers/video/meson/Kconfig b/drivers/video/meson/Kconfig -index 3c2d72d019b8..fcf486ca0a3a 100644 +index 3c2d72d019b..fcf486ca0a3 100644 --- a/drivers/video/meson/Kconfig +++ b/drivers/video/meson/Kconfig @@ -8,5 +8,6 @@ config VIDEO_MESON @@ -4074,7 +2343,7 @@ index 3c2d72d019b8..fcf486ca0a3a 100644 help Enable Amlogic Meson Video Processing Unit video support. diff --git a/drivers/video/rockchip/Kconfig b/drivers/video/rockchip/Kconfig -index 01804dcb1cc8..0f4550a29e38 100644 +index 01804dcb1cc..0f4550a29e3 100644 --- a/drivers/video/rockchip/Kconfig +++ b/drivers/video/rockchip/Kconfig @@ -11,6 +11,7 @@ @@ -4086,7 +2355,7 @@ index 01804dcb1cc8..0f4550a29e38 100644 Rockchip SoCs provide video output capabilities for High-Definition Multimedia Interface (HDMI), Low-voltage Differential Signalling diff --git a/drivers/video/stm32/Kconfig b/drivers/video/stm32/Kconfig -index 48066063e4c5..c354c402c288 100644 +index 48066063e4c..c354c402c28 100644 --- a/drivers/video/stm32/Kconfig +++ b/drivers/video/stm32/Kconfig @@ -8,6 +8,7 @@ @@ -4098,7 +2367,7 @@ index 48066063e4c5..c354c402c288 100644 STM32 supports many video output options including RGB and DSI. This option enables these supports which can be used on diff --git a/drivers/video/tegra20/Kconfig b/drivers/video/tegra20/Kconfig -index f5c4843e1191..2232b0b3ff53 100644 +index f5c4843e119..2232b0b3ff5 100644 --- a/drivers/video/tegra20/Kconfig +++ b/drivers/video/tegra20/Kconfig @@ -1,6 +1,7 @@ @@ -4110,7 +2379,7 @@ index f5c4843e1191..2232b0b3ff53 100644 T20/T30 support video output to an attached LCD panel as well as other options such as HDMI. Only the LCD is supported in U-Boot. diff --git a/drivers/video/tidss/Kconfig b/drivers/video/tidss/Kconfig -index 95086f3a5d66..3291b3ceb8d5 100644 +index 95086f3a5d6..3291b3ceb8d 100644 --- a/drivers/video/tidss/Kconfig +++ b/drivers/video/tidss/Kconfig @@ -11,6 +11,7 @@ @@ -4121,3 +2390,6 @@ index 95086f3a5d66..3291b3ceb8d5 100644 help TIDSS supports video output options LVDS and DPI . This option enables these supports which can be used on +-- +2.43.0 + diff --git a/bootstd-Test-and-boot_targets-improvements.patch b/bootstd-Test-and-boot_targets-improvements.patch deleted file mode 100644 index 68f1223..0000000 --- a/bootstd-Test-and-boot_targets-improvements.patch +++ /dev/null @@ -1,626 +0,0 @@ -From patchwork Mon Oct 23 07:02:11 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Simon Glass -X-Patchwork-Id: 1853514 -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 - header.s=google header.b=ft1tNW5r; - 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 4SDR4l2QBzz202k - for ; Mon, 23 Oct 2023 18:04:07 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 3591D87893; - Mon, 23 Oct 2023 09:03:57 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -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=chromium.org header.i=@chromium.org - header.b="ft1tNW5r"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 74EC18789D; Mon, 23 Oct 2023 09:03:55 +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 mail-oi1-x22f.google.com (mail-oi1-x22f.google.com - [IPv6:2607:f8b0:4864:20::22f]) - (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 5F22E87874 - for ; Mon, 23 Oct 2023 09:03:53 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sjg@chromium.org -Received: by mail-oi1-x22f.google.com with SMTP id - 5614622812f47-3b2ea7cca04so2216594b6e.2 - for ; Mon, 23 Oct 2023 00:03:53 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=chromium.org; s=google; t=1698044632; x=1698649432; darn=lists.denx.de; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=cIwvqOWntoH56aVh+uK5vSKMw8BFeAK+5xfygEqOPIs=; - b=ft1tNW5rHnnlnf552nQnVvJdgHJqUOIPR89PZQ12NUAyrlDzlzOEdzF55vs0bmokXJ - czzGmRw8FwBvmzO/fekIxGsNzg40U5ypkgqj13Plvj07iGgJvNLbwmOGyYwpTD86eBO8 - HxWQUCwgkoFZldu1VLcZHUzw69U1vUVcLpDqE= -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1698044632; x=1698649432; - 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=cIwvqOWntoH56aVh+uK5vSKMw8BFeAK+5xfygEqOPIs=; - b=AvcWPKPeRESlQnvwva3Yydv23E8Q1GOx+sH830m0arYUvEW4+J/TkXRzyM0Z8amaDR - 4dvztcY+Hh54LqVGw9cD0R65sHvXrvqUPURdBpVFT3yX2LhoN7ZxPD1EcKy9Hqr3ATlJ - 9eOCuyD+UHHeMAIvdTR918uaO5Bja38XSaNAzNV57JBYkDgWJeNK9OBHBuJj2Y2sTNZ1 - poF5sGH839p3nx69X+ImsEwsgz8JIZFnwe4WBsXMMM13hVQ1ZDpdhKzKI7ai1jE67Ixo - 4hOXD6ACVKkBijBRqW8t2V1Wf12AAun1z+mrhyFaq/UgyxuplGyHQHWGmwL7maxTzdVv - IX4A== -X-Gm-Message-State: AOJu0YwtYv7Lh6kUp+eOTO6dV8tIAMnl+FJU9kPSXGHNBjxPmbWNgo0/ - gEs6R/iZt+vLqxRzuubv1ROzFkNfj6SlCXza5g7l1A== -X-Google-Smtp-Source: - AGHT+IHvJm5/lr6rXt08U65SxntTogh09qTfiLs2+CF8IjsSnkkTeqbhy/o2f2YjHn0GHRZ0TtCNpA== -X-Received: by 2002:a05:6808:e85:b0:3b2:d8cb:8e14 with SMTP id - k5-20020a0568080e8500b003b2d8cb8e14mr11558910oil.28.1698044631920; - Mon, 23 Oct 2023 00:03:51 -0700 (PDT) -Received: from sjg1.roam.corp.google.com ([202.144.206.130]) - by smtp.gmail.com with ESMTPSA id - u187-20020a6279c4000000b006bde8e1f0adsm5910841pfc.98.2023.10.23.00.03.49 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 23 Oct 2023 00:03:51 -0700 (PDT) -From: Simon Glass -To: U-Boot Mailing List -Cc: Heinrich Schuchardt , - Guillaume Gardet , Tom Rini , - Simon Glass -Subject: [PATCH 2/4] bootstd: Expand boot-ordering test to include USB -Date: Mon, 23 Oct 2023 00:02:11 -0700 -Message-ID: - <20231023000211.2.I9d49d1e28d3ef75af768dc20bb491e4c82e4ab76@changeid> -X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog -In-Reply-To: <20231023070216.394709-1-sjg@chromium.org> -References: <20231023070216.394709-1-sjg@chromium.org> -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 - -Scan the USB bus as well, so we can check that different uclasses work -correctly in boot_targets - -update the function comment with more detail. - -Signed-off-by: Simon Glass ---- - - test/boot/bootdev.c | 17 ++++++++++++++--- - 1 file changed, 14 insertions(+), 3 deletions(-) - -diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c -index 6b29213416db..7228f545e9e6 100644 ---- a/test/boot/bootdev.c -+++ b/test/boot/bootdev.c -@@ -190,12 +190,21 @@ static int bootdev_test_any(struct unit_test_state *uts) - BOOTSTD_TEST(bootdev_test_any, UT_TESTF_DM | UT_TESTF_SCAN_FDT | - UT_TESTF_ETH_BOOTDEV); - --/* Check bootdev ordering with the bootdev-order property */ -+/* -+ * Check bootdev ordering with the bootdev-order property and boot_targets -+ * environment variable -+ */ - static int bootdev_test_order(struct unit_test_state *uts) - { - struct bootflow_iter iter; - struct bootflow bflow; - -+ test_set_skip_delays(true); -+ -+ /* Start up USB which gives us three additional bootdevs */ -+ usb_started = false; -+ ut_assertok(run_command("usb start", 0)); -+ - /* - * First try the order set by the bootdev-order property - * Like all sandbox unit tests this relies on the devicetree setting up -@@ -213,12 +222,14 @@ static int bootdev_test_order(struct unit_test_state *uts) - bootflow_iter_uninit(&iter); - - /* Use the environment variable to override it */ -- ut_assertok(env_set("boot_targets", "mmc1 mmc2")); -+ ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb")); - ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); - ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); -- ut_asserteq(2, iter.num_devs); -+ ut_asserteq(3, iter.num_devs); - ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name); - ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); -+ ut_asserteq_str("usb_mass_storage.lun0.bootdev", -+ iter.dev_used[2]->name); - bootflow_iter_uninit(&iter); - - return 0; - -From patchwork Mon Oct 23 07:02:12 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Simon Glass -X-Patchwork-Id: 1853515 -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 - header.s=google header.b=aYxxWBdy; - 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 4SDR4z5WcTz202k - for ; Mon, 23 Oct 2023 18:04:19 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id A279B878A9; - Mon, 23 Oct 2023 09:03:59 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -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=chromium.org header.i=@chromium.org - header.b="aYxxWBdy"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 231CE878B2; Mon, 23 Oct 2023 09:03:59 +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 mail-pf1-x431.google.com (mail-pf1-x431.google.com - [IPv6:2607:f8b0:4864:20::431]) - (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 E9DE187874 - for ; Mon, 23 Oct 2023 09:03:56 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sjg@chromium.org -Received: by mail-pf1-x431.google.com with SMTP id - d2e1a72fcca58-6bd73395bceso2113746b3a.0 - for ; Mon, 23 Oct 2023 00:03:56 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=chromium.org; s=google; t=1698044635; x=1698649435; darn=lists.denx.de; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=8b4yhHi8HkVDVyxmZZ8a/B9oJfD95880A8O7ScnCUlA=; - b=aYxxWBdy/wJMQ/tjjK8Fxa3hq2jB+RQ/GZvaC5Z3WX/PHTfrcBBEncxnUjhKGVpRDX - W+KcG58tqawI84z5bFLFL0b9sW2fogOlQatvQajdAUe47BPNqB6QAhnJi9Kz7r/r9Gs6 - NNgvS1a0l6YIH9C//eL4UL+4CZAI3w/xuJglw= -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1698044635; x=1698649435; - 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=8b4yhHi8HkVDVyxmZZ8a/B9oJfD95880A8O7ScnCUlA=; - b=I5RQ7op3C0RGr709+nlAxagLQLSvqp2mbM2boS7Q037eSoibAVpk4mZ4eybB3mgH7s - CU7QPLmTk89Z+nypz02nbdWiiDUxCGGmjyWllc8F1lpiyjdILqp5njd+8mukVbhujjua - wbRX/7IaEywz0hp5/4jlTO+cz+b6t8VrLGXFFR8MJNzfchp2hHCRDypg8K/GlpfN9Vrh - SeZuMbw7X3R9vJf+qkLzCYC4bKuMUFgXrXnL/ZNgq+cmMfXFwT5f92+aIq8MvTuIIJMI - krBCjES1iIXXHLKw7aF3b1EC0+alfvtIAfIjK8UhAiTW019VbZ/uyxJbG+XG2ZLxkJPB - QhTQ== -X-Gm-Message-State: AOJu0YxXE6hDpzTCrR02q/+ia8kFUD/3VJLYeldwCaUAM/ZjNFiglRSk - N+4b2ozl4hRwo7qO57OeOxowm5MFBDGdy9h+8WGPjQ== -X-Google-Smtp-Source: - AGHT+IEjnpgei2u9GBHpMxAqISqdKlCrvD572cRfntnploYm1RPfc2ermsDOfWBp72z4zSgZo07dRw== -X-Received: by 2002:a05:6a00:1817:b0:68e:3616:604a with SMTP id - y23-20020a056a00181700b0068e3616604amr11976822pfa.8.1698044635168; - Mon, 23 Oct 2023 00:03:55 -0700 (PDT) -Received: from sjg1.roam.corp.google.com ([202.144.206.130]) - by smtp.gmail.com with ESMTPSA id - u187-20020a6279c4000000b006bde8e1f0adsm5910841pfc.98.2023.10.23.00.03.52 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 23 Oct 2023 00:03:54 -0700 (PDT) -From: Simon Glass -To: U-Boot Mailing List -Cc: Heinrich Schuchardt , - Guillaume Gardet , Tom Rini , - Simon Glass -Subject: [PATCH 3/4] bootstd: Correct logic for single uclass -Date: Mon, 23 Oct 2023 00:02:12 -0700 -Message-ID: - <20231023000211.3.Icefe7db8f3c1ddc3624f95ca5dc89b81ef97eab4@changeid> -X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog -In-Reply-To: <20231023070216.394709-1-sjg@chromium.org> -References: <20231023070216.394709-1-sjg@chromium.org> -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 current logic for "bootflow mmc" is flawed since it checks the -uclass of the bootdev instead of its parent, the media device. Correct -this and add a test that covers this scenario. - -Signed-off-by: Simon Glass ---- - - boot/bootflow.c | 24 ++++++++++++++++++++++-- - test/boot/bootdev.c | 13 +++++++++++++ - 2 files changed, 35 insertions(+), 2 deletions(-) - -diff --git a/boot/bootflow.c b/boot/bootflow.c -index 6ef62e1d1896..7f5b0e942078 100644 ---- a/boot/bootflow.c -+++ b/boot/bootflow.c -@@ -155,6 +155,27 @@ static void bootflow_iter_set_dev(struct bootflow_iter *iter, - } - } - -+/** -+ * scan_next_in_uclass() - Scan for the next bootdev in the same media uclass -+ * -+ * Move through the following bootdevs until we find another in this media -+ * uclass, or run out -+ * -+ * @devp: On entry, the device to check, on exit the new device, or NULL if -+ * there is none -+ */ -+static void scan_next_in_uclass(struct udevice **devp) -+{ -+ struct udevice *dev = *devp; -+ enum uclass_id cur_id = device_get_uclass_id(dev->parent); -+ -+ do { -+ uclass_find_next_device(&dev); -+ } while (dev && cur_id != device_get_uclass_id(dev->parent)); -+ -+ *devp = dev; -+} -+ - /** - * iter_incr() - Move to the next item (method, part, bootdev) - * -@@ -230,8 +251,7 @@ static int iter_incr(struct bootflow_iter *iter) - &method_flags); - } else if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && - (iter->flags & BOOTFLOWIF_SINGLE_UCLASS)) { -- /* Move to the next bootdev in this uclass */ -- uclass_find_next_device(&dev); -+ scan_next_in_uclass(&dev); - if (!dev) { - log_debug("finished uclass %s\n", - dev_get_uclass_name(dev)); -diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c -index 7228f545e9e6..637861748057 100644 ---- a/test/boot/bootdev.c -+++ b/test/boot/bootdev.c -@@ -232,6 +232,19 @@ static int bootdev_test_order(struct unit_test_state *uts) - iter.dev_used[2]->name); - bootflow_iter_uninit(&iter); - -+ /* Try a single uclass */ -+ ut_assertok(env_set("boot_targets", NULL)); -+ ut_assertok(bootflow_scan_first(NULL, "mmc", &iter, 0, &bflow)); -+ ut_asserteq(2, iter.num_devs); -+ -+ /* Now scan pass mmc1 and make sure that only mmc0 shows up */ -+ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); -+ ut_asserteq(3, iter.num_devs); -+ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); -+ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); -+ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); -+ bootflow_iter_uninit(&iter); -+ - return 0; - } - BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); - -From patchwork Mon Oct 23 07:02:13 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Simon Glass -X-Patchwork-Id: 1853516 -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 - header.s=google header.b=g7MVFEGd; - 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 4SDR5C2s5gz202k - for ; Mon, 23 Oct 2023 18:04:31 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 1A36A87880; - Mon, 23 Oct 2023 09:04:04 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -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=chromium.org header.i=@chromium.org - header.b="g7MVFEGd"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 2EC9687897; Mon, 23 Oct 2023 09:04:03 +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 mail-oi1-x22d.google.com (mail-oi1-x22d.google.com - [IPv6:2607:f8b0:4864:20::22d]) - (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 F1B5887880 - for ; Mon, 23 Oct 2023 09:04:00 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=chromium.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sjg@chromium.org -Received: by mail-oi1-x22d.google.com with SMTP id - 5614622812f47-3af604c3f8fso2266068b6e.1 - for ; Mon, 23 Oct 2023 00:04:00 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=chromium.org; s=google; t=1698044639; x=1698649439; darn=lists.denx.de; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=ZQHdVZoqu6vL//0Rc8e1SX1+2VK3djq3hW1NDOA/VUc=; - b=g7MVFEGdmwlVgYbQvsUlLUH8u5YdqRAZZ7IGvJkKw+t9TgR7CBLAz6FTbcUqCf7ix3 - ka6wz36z3I7e9+8Vu/XxtfjMh+FsE2MmR1pR8WtODlM2rNTfjAL7SzMzFwNNdBolnbaF - YEgrsCKckVERiDmY6ZcR1st7af2v4Zd3IMEjU= -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1698044639; x=1698649439; - 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=ZQHdVZoqu6vL//0Rc8e1SX1+2VK3djq3hW1NDOA/VUc=; - b=dmetYCxcqOdjG06nNcEgNsHTXN2i2yJe2yaTu9+igYWthZh3jBPskXE+lqfItnIeWl - 7Ti/qjE0EfHZfEfg2qVDuxSbj3zUqB8FRtcGV9rNXUn6NCsu3+zbWL03hsVUpc3vryFx - jWRyDrV2iQXJFbTcXuutCHCXNMwcCuHwGgN1nSfK/4Dxxw4T8y/c0y2O8gb1V3cURCB4 - iIUvgFjuI6Cr+EVLkWuTmm292mJryz7Wnj14Gvh1f3kgdWqfDOCJHBmSu2DImC0KGlsU - 5OwVzpagMZfWwuofbsHzRRvhzjEWAFhbwaIB7TeQMQBQfO+eAJ4ItsCll1m4KCusAJtm - fq2w== -X-Gm-Message-State: AOJu0YyL+7DxZXljBQhaS2gWBuhvR5uESsc040WsnLpteLMvL8txONvN - ASxmZ+0rltdSHxuUUw73ZNSNctboaLQkz2ygO4kSZg== -X-Google-Smtp-Source: - AGHT+IEn4DDw7VvfhcVhjZx6AfZZp+iDzM6s6RxSA4wM8oGRbEEwrJxjkMtDfxGtuPQjJkuiEWQW+w== -X-Received: by 2002:a05:6808:4d4:b0:3a7:44da:d5e6 with SMTP id - a20-20020a05680804d400b003a744dad5e6mr9586643oie.38.1698044639506; - Mon, 23 Oct 2023 00:03:59 -0700 (PDT) -Received: from sjg1.roam.corp.google.com ([202.144.206.130]) - by smtp.gmail.com with ESMTPSA id - u187-20020a6279c4000000b006bde8e1f0adsm5910841pfc.98.2023.10.23.00.03.55 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Mon, 23 Oct 2023 00:03:59 -0700 (PDT) -From: Simon Glass -To: U-Boot Mailing List -Cc: Heinrich Schuchardt , - Guillaume Gardet , Tom Rini , - Simon Glass , Date Huang , - =?utf-8?q?Vincent_Stehl=C3=A9?= , - Ivan Ivanov -Subject: [PATCH 4/4] bootstd: Scan all bootdevs in a boot_targets entry (take - 2) -Date: Mon, 23 Oct 2023 00:02:13 -0700 -Message-ID: - <20231023000211.4.Ie4e7ba290d4957a88bebf306ca39f46618d9c363@changeid> -X-Mailer: git-send-email 2.42.0.655.g421f12c284-goog -In-Reply-To: <20231023070216.394709-1-sjg@chromium.org> -References: <20231023070216.394709-1-sjg@chromium.org> -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 - -When the boot_targets environment variable is used with the distro-boot -scripts, each device is included individually. For example, if there -are three mmc devices, then we will have something like: - - boot_targets="mmc0 mmc1 mmc2" - -In contrast, standard boot supports specifying just the uclass, i.e.: - - boot_targets="mmc" - -The intention is that this should scan all MMC devices, but in fact it -currently only scans the first. - -Update the logic to handle this case, without required BOOTSTD_FULL to -be enabled. - -Signed-off-by: Simon Glass -Reported-by: Date Huang -Reported-by: Vincent Stehlé -Reported-by: Ivan Ivanov ---- - - boot/bootdev-uclass.c | 3 ++- - boot/bootflow.c | 22 ++++++++++++++++++++-- - test/boot/bootdev.c | 32 ++++++++++++++++++++++++++++++-- - 3 files changed, 52 insertions(+), 5 deletions(-) - -diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c -index 974ddee5d2fa..44ae98a9269c 100644 ---- a/boot/bootdev-uclass.c -+++ b/boot/bootdev-uclass.c -@@ -469,10 +469,11 @@ int bootdev_find_by_label(const char *label, struct udevice **devp, - * if no sequence number was provided, we must scan all - * bootdevs for this media uclass - */ -- if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && seq == -1) -+ if (seq == -1) - method_flags |= BOOTFLOW_METHF_SINGLE_UCLASS; - if (method_flagsp) - *method_flagsp = method_flags; -+ log_debug("method flags %x\n", method_flags); - return 0; - } - log_debug("- no device in %s\n", media->name); -diff --git a/boot/bootflow.c b/boot/bootflow.c -index 7f5b0e942078..be543c8588cc 100644 ---- a/boot/bootflow.c -+++ b/boot/bootflow.c -@@ -280,8 +280,26 @@ static int iter_incr(struct bootflow_iter *iter) - } else { - log_debug("labels %p\n", iter->labels); - if (iter->labels) { -- ret = bootdev_next_label(iter, &dev, -- &method_flags); -+ /* -+ * when the label is "mmc" we want to scan all -+ * mmc bootdevs, not just the first. See -+ * bootdev_find_by_label() where this flag is -+ * set up -+ */ -+ if (iter->method_flags & -+ BOOTFLOW_METHF_SINGLE_UCLASS) { -+ scan_next_in_uclass(&dev); -+ log_debug("looking for next device %s: %s\n", -+ iter->dev->name, -+ dev ? dev->name : ""); -+ } else { -+ dev = NULL; -+ } -+ if (!dev) { -+ log_debug("looking at next label\n"); -+ ret = bootdev_next_label(iter, &dev, -+ &method_flags); -+ } - } else { - ret = bootdev_next_prio(iter, &dev); - method_flags = 0; -diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c -index 637861748057..0702fccdae60 100644 ---- a/test/boot/bootdev.c -+++ b/test/boot/bootdev.c -@@ -225,7 +225,7 @@ static int bootdev_test_order(struct unit_test_state *uts) - ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb")); - ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); - ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); -- ut_asserteq(3, iter.num_devs); -+ ut_asserteq(5, iter.num_devs); - ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name); - ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); - ut_asserteq_str("usb_mass_storage.lun0.bootdev", -@@ -237,7 +237,20 @@ static int bootdev_test_order(struct unit_test_state *uts) - ut_assertok(bootflow_scan_first(NULL, "mmc", &iter, 0, &bflow)); - ut_asserteq(2, iter.num_devs); - -- /* Now scan pass mmc1 and make sure that only mmc0 shows up */ -+ /* Now scan past mmc1 and make sure that only mmc0 shows up */ -+ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); -+ ut_asserteq(3, iter.num_devs); -+ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); -+ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); -+ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); -+ bootflow_iter_uninit(&iter); -+ -+ /* Try a single uclass with boot_targets */ -+ ut_assertok(env_set("boot_targets", "mmc")); -+ ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); -+ ut_asserteq(2, iter.num_devs); -+ -+ /* Now scan past mmc1 and make sure that only mmc0 shows up */ - ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); - ut_asserteq(3, iter.num_devs); - ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); -@@ -245,6 +258,21 @@ static int bootdev_test_order(struct unit_test_state *uts) - ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); - bootflow_iter_uninit(&iter); - -+ /* Try a single uclass with boot_targets */ -+ ut_assertok(env_set("boot_targets", "mmc usb")); -+ ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); -+ ut_asserteq(2, iter.num_devs); -+ -+ /* Now scan past mmc1 and make sure that the 3 USB devices show up */ -+ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); -+ ut_asserteq(6, iter.num_devs); -+ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); -+ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); -+ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); -+ ut_asserteq_str("usb_mass_storage.lun0.bootdev", -+ iter.dev_used[3]->name); -+ bootflow_iter_uninit(&iter); -+ - return 0; - } - BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); diff --git a/uboot-tools.spec b/uboot-tools.spec index 798f97d..6635f59 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -23,8 +23,7 @@ Patch3: 0001-smbios-Simplify-reporting-of-unknown-values.patch Patch4: 0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch Patch5: enable-bootmenu-by-default.patch Patch6: uefi-Boot-var-automatic-management-for-removable-medias.patch -#Patch6: Add-video-damage-tracking.patch -#Patch7: bootstd-Test-and-boot_targets-improvements.patch +Patch7: Add-video-damage-tracking.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support From cb6dd9961d7608bf4072257cae7f536897f06808 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 7 Dec 2023 14:49:13 +0000 Subject: [PATCH 019/128] 2024.01 RC4 --- ...Simplify-reporting-of-unknown-values.patch | 115 --- ...to-the-default-DT-if-sysinfo-nodes-a.patch | 242 ------ Provide-a-fallback-to-smbios-tables.patch | 686 ++++++++++++++++++ sources | 2 +- uboot-tools.spec | 11 +- 5 files changed, 694 insertions(+), 362 deletions(-) delete mode 100644 0001-smbios-Simplify-reporting-of-unknown-values.patch delete mode 100644 0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch create mode 100644 Provide-a-fallback-to-smbios-tables.patch diff --git a/0001-smbios-Simplify-reporting-of-unknown-values.patch b/0001-smbios-Simplify-reporting-of-unknown-values.patch deleted file mode 100644 index 6fd5dde..0000000 --- a/0001-smbios-Simplify-reporting-of-unknown-values.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 6eb1fce7ca692b211ca467040cfe25a750ecc0fe Mon Sep 17 00:00:00 2001 -From: Ilias Apalodimas -Date: Tue, 6 Sep 2022 16:44:25 +0300 -Subject: [PATCH 1/2] smbios: Simplify reporting of unknown values - -If a value is not valid during the DT or SYSINFO parsing, we explicitly -set that to "Unknown Product" and "Unknown" for the product and -manufacturer respectively. It's cleaner if we move the checks insisde -smbios_add_string() and always report "Unknown" regardless of the missing -field. - -pre-patch dmidecode - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown Product - Version: Not Specified - Serial Number: Not Specified - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Not Specified - Family: Not Specified - -[...] - -post-patch dmidecode: - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown -[...] - -Signed-off-by: Ilias Apalodimas -Reviewed-by: Peter Robinson -Tested-by: Peter Robinson ---- - lib/smbios.c | 17 +++-------------- - 1 file changed, 3 insertions(+), 14 deletions(-) - -diff --git a/lib/smbios.c b/lib/smbios.c -index d7f4999e8b2a..fcc8686993ef 100644 ---- a/lib/smbios.c -+++ b/lib/smbios.c -@@ -102,7 +102,7 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) - int i = 1; - char *p = ctx->eos; - -- if (!*str) -+ if (!str || !*str) - str = "Unknown"; - - for (;;) { -@@ -151,8 +151,7 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, - const char *str; - - str = ofnode_read_string(ctx->node, prop); -- if (str) -- return smbios_add_string(ctx, str); -+ return smbios_add_string(ctx, str); - } - - return 0; -@@ -231,7 +230,7 @@ static int smbios_write_type0(ulong *current, int handle, - t->vendor = smbios_add_string(ctx, "U-Boot"); - - t->bios_ver = smbios_add_prop(ctx, "version"); -- if (!t->bios_ver) -+ if (!strcmp(ctx->last_str, "Unknown")) - t->bios_ver = smbios_add_string(ctx, PLAIN_VERSION); - if (t->bios_ver) - gd->smbios_version = ctx->last_str; -@@ -281,11 +280,7 @@ static int smbios_write_type1(ulong *current, int handle, - fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle); - smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); - t->product_name = smbios_add_prop(ctx, "product"); -- if (!t->product_name) -- t->product_name = smbios_add_string(ctx, "Unknown Product"); - t->version = smbios_add_prop_si(ctx, "version", - SYSINFO_ID_SMBIOS_SYSTEM_VERSION); - if (serial_str) { -@@ -315,11 +310,7 @@ static int smbios_write_type2(ulong *current, int handle, - fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle); - smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); - t->product_name = smbios_add_prop(ctx, "product"); -- if (!t->product_name) -- t->product_name = smbios_add_string(ctx, "Unknown Product"); - t->version = smbios_add_prop_si(ctx, "version", - SYSINFO_ID_SMBIOS_BASEBOARD_VERSION); - t->asset_tag_number = smbios_add_prop(ctx, "asset-tag"); -@@ -344,8 +335,6 @@ static int smbios_write_type3(ulong *current, int handle, - fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle); - smbios_set_eos(ctx, t->eos); - t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); - t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP; - t->bootup_state = SMBIOS_STATE_SAFE; - t->power_supply_state = SMBIOS_STATE_SAFE; --- -2.40.1 - diff --git a/0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch b/0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch deleted file mode 100644 index a256b9b..0000000 --- a/0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch +++ /dev/null @@ -1,242 +0,0 @@ -From ed67997890981fda4f859cb96e523a0ec5b58042 Mon Sep 17 00:00:00 2001 -From: Ilias Apalodimas -Date: Tue, 6 Sep 2022 16:44:26 +0300 -Subject: [PATCH 2/2] smbios: Fallback to the default DT if sysinfo nodes are - missing - -In order to fill in the SMBIOS tables U-Boot currently relies on a -"u-boot,sysinfo-smbios" compatible node. This is fine for the boards -that already include such nodes. However with some recent EFI changes, -the majority of boards can boot up distros, which usually rely on -things like dmidecode etc for their reporting. For boards that -lack this special node the SMBIOS output looks like: - -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown - -This looks problematic since most of the info are "Unknown". The DT spec -specifies standard properties containing relevant information like -'model' and 'compatible' for which the suggested format is -. So let's add a last resort to our current -smbios parsing. If none of the sysinfo properties are found, we can -scan the root node for 'model' and 'compatible'. - -pre-patch dmidecode: - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown - -Handle 0x0002, DMI type 2, 14 bytes -Base Board Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Not Specified - Asset Tag: Unknown - Features: - Board is a hosting board - Location In Chassis: Not Specified - Chassis Handle: 0x0000 - Type: Motherboard - -Handle 0x0003, DMI type 3, 21 bytes -Chassis Information - Manufacturer: Unknown - Type: Desktop - Lock: Not Present - Version: Not Specified - Serial Number: Not Specified - Asset Tag: Not Specified - Boot-up State: Safe - Power Supply State: Safe - Thermal State: Safe - Security Status: None - OEM Information: 0x00000000 - Height: Unspecified - Number Of Power Cords: Unspecified - Contained Elements: 0 - - -post-pastch dmidecode: - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: socionext,developer-box - Product Name: Socionext Developer Box - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown - -Handle 0x0002, DMI type 2, 14 bytes -Base Board Information - Manufacturer: socionext,developer-box - Product Name: Socionext Developer Box - Version: Unknown - Serial Number: Not Specified - Asset Tag: Unknown - Features: - Board is a hosting board - Location In Chassis: Not Specified - Chassis Handle: 0x0000 - Type: Motherboard - -Handle 0x0003, DMI type 3, 21 bytes -Chassis Information - Manufacturer: socionext,developer-box - Type: Desktop - Lock: Not Present - Version: Not Specified - Serial Number: Not Specified - Asset Tag: Not Specified - Boot-up State: Safe - Power Supply State: Safe - Thermal State: Safe - Security Status: None - OEM Information: 0x00000000 - Height: Unspecified - Number Of Power Cords: Unspecified - Contained Elements: 0 - - -Signed-off-by: Ilias Apalodimas -Reviewed-by: Peter Robinson -Tested-by: Peter Robinson ---- - lib/smbios.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++---- - 1 file changed, 64 insertions(+), 4 deletions(-) - -diff --git a/lib/smbios.c b/lib/smbios.c -index fcc8686993ef..9c8e34625e65 100644 ---- a/lib/smbios.c -+++ b/lib/smbios.c -@@ -9,11 +9,13 @@ - #include - #include - #include -+#include - #include - #include - #include - #include - #include -+#include - #ifdef CONFIG_CPU - #include - #include -@@ -43,6 +45,25 @@ - - DECLARE_GLOBAL_DATA_PTR; - -+/** -+ * struct map_sysinfo - Mapping of sysinfo strings to DT -+ * -+ * @sysinfo_str: sysinfo string -+ * @dt_str: DT string -+ * @max: Max index of the tokenized string to pick. First element is 0 -+ * -+ */ -+struct map_sysinfo { -+ const char *sysinfo_str; -+ const char *dt_str; -+ int max; -+}; -+ -+static const struct map_sysinfo sysinfo_to_dt[] = { -+ { .sysinfo_str = "product", .dt_str = "model", 1 }, -+ { .sysinfo_str = "manufacturer", .dt_str = "compatible", 0 }, -+}; -+ - /** - * struct smbios_ctx - context for writing SMBIOS tables - * -@@ -87,6 +108,18 @@ struct smbios_write_method { - const char *subnode_name; - }; - -+static const struct map_sysinfo *convert_sysinfo_to_dt(const char *sysinfo_str) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(sysinfo_to_dt); i++) { -+ if (!strcmp(sysinfo_str, sysinfo_to_dt[i].sysinfo_str)) -+ return &sysinfo_to_dt[i]; -+ } -+ -+ return NULL; -+} -+ - /** - * smbios_add_string() - add a string to the string area - * -@@ -139,19 +172,46 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) - static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, - int sysinfo_id) - { -+ int ret = 0; -+ - if (sysinfo_id && ctx->dev) { - char val[SMBIOS_STR_MAX]; -- int ret; - - ret = sysinfo_get_str(ctx->dev, sysinfo_id, sizeof(val), val); - if (!ret) - return smbios_add_string(ctx, val); - } -+ - if (IS_ENABLED(CONFIG_OF_CONTROL)) { -- const char *str; -+ const char *str = NULL; -+ char str_tmp[128]; -+ char *token; - -- str = ofnode_read_string(ctx->node, prop); -- return smbios_add_string(ctx, str); -+ /* -+ * If the node is not valid fallback and try the entire DT -+ * so we can at least fill in maufacturer and board type -+ */ -+ if (!ofnode_valid(ctx->node)) { -+ const struct map_sysinfo *nprop; -+ -+ nprop = convert_sysinfo_to_dt(prop); -+ if (nprop) { -+ int cnt = 0; -+ -+ str = ofnode_read_string(ofnode_root(), nprop->dt_str); -+ strncpy(str_tmp, str, sizeof(str_tmp)); -+ token = strtok(str_tmp, ","); -+ while (token != NULL && cnt <= nprop->max) { -+ str = token; -+ token = strtok(NULL, ","); -+ cnt++; -+ } -+ } -+ } else { -+ str = ofnode_read_string(ctx->node, prop); -+ } -+ ret = smbios_add_string(ctx, str); -+ return ret; - } - - return 0; --- -2.40.1 - diff --git a/Provide-a-fallback-to-smbios-tables.patch b/Provide-a-fallback-to-smbios-tables.patch new file mode 100644 index 0000000..4ff8ac5 --- /dev/null +++ b/Provide-a-fallback-to-smbios-tables.patch @@ -0,0 +1,686 @@ +From patchwork Thu Dec 7 09:18:49 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Ilias Apalodimas +X-Patchwork-Id: 1873089 +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=SyQQL6ZG; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sm7xz1DLXz23nD + for ; Thu, 7 Dec 2023 20:19:19 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 83BF287243; + Thu, 7 Dec 2023 10:19:05 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="SyQQL6ZG"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 46C3C87243; Thu, 7 Dec 2023 10:19:04 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com + [IPv6:2a00:1450:4864:20::330]) + (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 21B8586FFE + for ; Thu, 7 Dec 2023 10:19:02 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org +Received: by mail-wm1-x330.google.com with SMTP id + 5b1f17b1804b1-40c2c65e6aaso1041145e9.2 + for ; Thu, 07 Dec 2023 01:19:02 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1701940741; x=1702545541; darn=lists.denx.de; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=vcf8Uy8SIKdN9TXuCeQubka7IJIfrvGMGj1JoUebFs0=; + b=SyQQL6ZGyEFpFFqauSbHRSSNY+KOw9ohESTeXyy7RkWEEIFaK7yPwRRy9NZX+DJLAJ + ECaT3Bchk61s+E1ZsuxrqdlxEYWDULw+4O2hm22gVZjL5L6r4+NwNgCHwzYW/bcro87o + KEGRF7CXG50v6mvrjAOHoy2LbojZLR9d7fjO4gmGtihdnTMOW1cjtrX/3Seiy99QoTK6 + 5Hs119W/hO0/5AE1VVSiIxV1Xx+qYcAHvQqcEEkBCKR2MpHTauUEonUf1LC5LKK2gKG5 + UEzq7XLrPki8hih4EcWsoctpdPp4kBtvpVSSshji9yxDX3EXKzcfA8xyqrB+5qKJU100 + zZ7A== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1701940741; x=1702545541; + 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=vcf8Uy8SIKdN9TXuCeQubka7IJIfrvGMGj1JoUebFs0=; + b=L6Ejctx8u+W0IeEi5FfC1q0ah2NYKTScSheLqomwMY3Q4/BPiEUP7KUarxUKsRwI/3 + yP4rTVAXqlGbT6kFKq3jrxXlRS4HIRZxtFbgHZEKuBnXpkHCQpvQwKUcYY9QkbfdZEir + 5YYfONEv2yTHHfoiBZiVmcPARIQ5+2ra+k493og2Bm0Hk5dVWyaHn/YY6Y+FCWH7ZYn0 + Eq1M9Ng8YB3oMx63KwV9XHBURccH8UdCqwsNDvk2gWLKdSvrjlFD7ExiySd90+i9+6vN + CMLoNESSYj2K9qW/sxbIDgUv1JwYCWgJrDejTzilfagawcPlKY2XtTnOlUsRryYrsPoq + RbZg== +X-Gm-Message-State: AOJu0YxG7g4q8NdX+N/0Mp5YNkHEVHntPyakSqHCtdqDzgaRcQCbtF0q + 2APTVIQc7yNsT16/19bvkV1NRw3x7lZmC4YcT+s= +X-Google-Smtp-Source: + AGHT+IFwnHtGX5IWm5lG5rRTsz6nU13lqUMnEUb8xEq/mngZuRtpzcNdrO7fNaBiIDDQLuKd+Y07Tw== +X-Received: by 2002:a05:600c:2184:b0:40b:dd1f:6dd1 with SMTP id + e4-20020a05600c218400b0040bdd1f6dd1mr1312043wme.240.1701940741617; + Thu, 07 Dec 2023 01:19:01 -0800 (PST) +Received: from localhost.localdomain (ppp046103111243.access.hol.gr. + [46.103.111.243]) by smtp.gmail.com with ESMTPSA id + u21-20020a05600c139500b00405d9a950a2sm1299003wmf.28.2023.12.07.01.19.00 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Thu, 07 Dec 2023 01:19:01 -0800 (PST) +From: Ilias Apalodimas +To: trini@konsulko.com, + sjg@chromium.org +Cc: sean.anderson@seco.com, neil.armstrong@linaro.org, + heinrich.schuchardt@canonical.com, mark.kettenis@xs4all.nl, + Ilias Apalodimas , u-boot@lists.denx.de +Subject: [PATCH 1/2 v3] smbios: Simplify reporting of unknown values +Date: Thu, 7 Dec 2023 11:18:49 +0200 +Message-Id: <20231207091850.17776-2-ilias.apalodimas@linaro.org> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20231207091850.17776-1-ilias.apalodimas@linaro.org> +References: <20231207091850.17776-1-ilias.apalodimas@linaro.org> +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 + +If a value is not valid during the DT or SYSINFO parsing, we explicitly +set that to "Unknown Product" and "Unknown" for the product and +manufacturer respectively. It's cleaner if we move the checks insisde +smbios_add_prop_si() and provide an alternative string in case the +primary is NULL or empty + +pre-patch dmidecode + +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: Unknown + Product Name: Unknown Product + Version: Not Specified + Serial Number: Not Specified + UUID: Not Settable + Wake-up Type: Reserved + SKU Number: Not Specified + Family: Not Specified + +[...] + +post-patch dmidecode: + +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: Unknown + Product Name: Unknown + Version: Unknown + Serial Number: Unknown + UUID: Not Settable + Wake-up Type: Reserved + SKU Number: Unknown + Family: Unknown +[...] + +While at it make smbios_add_prop_si() add a string directly if the prop +node is NULL and replace smbios_add_string() calls with +smbios_add_prop_si(ctx, NULL, ....) + +Signed-off-by: Ilias Apalodimas +--- +Changes since v2: +- refactor even more code and remove the smbios_add_string calls from the + main code. Instead use smbios_add_prop() foir everything and add a + default value, in case the parsed one is NULL or emtpy +Changes since v1: +- None + + lib/smbios.c | 73 +++++++++++++++++++++++++--------------------------- + 1 file changed, 35 insertions(+), 38 deletions(-) + +-- +2.40.1 + +diff --git a/lib/smbios.c b/lib/smbios.c +index d7f4999e8b2a..444aa245a273 100644 +--- a/lib/smbios.c ++++ b/lib/smbios.c +@@ -102,9 +102,6 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) + int i = 1; + char *p = ctx->eos; + +- if (!*str) +- str = "Unknown"; +- + for (;;) { + if (!*p) { + ctx->last_str = p; +@@ -134,11 +131,18 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) + * + * @ctx: context for writing the tables + * @prop: property to write ++ * @dval: Default value to use if the string is not found or is empty + * Return: 0 if not found, else SMBIOS string number (1 or more) + */ + static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, +- int sysinfo_id) ++ int sysinfo_id, const char *dval) + { ++ if (!dval || !*dval) ++ dval = "Unknown"; ++ ++ if (!prop) ++ return smbios_add_string(ctx, dval); ++ + if (sysinfo_id && ctx->dev) { + char val[SMBIOS_STR_MAX]; + int ret; +@@ -151,8 +155,8 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, + const char *str; + + str = ofnode_read_string(ctx->node, prop); +- if (str) +- return smbios_add_string(ctx, str); ++ ++ return smbios_add_string(ctx, str ? str : dval); + } + + return 0; +@@ -161,12 +165,15 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, + /** + * smbios_add_prop() - Add a property from the devicetree + * +- * @prop: property to write ++ * @prop: property to write. The default string will be written if ++ * prop is NULL ++ * @dval: Default value to use if the string is not found or is empty + * Return: 0 if not found, else SMBIOS string number (1 or more) + */ +-static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop) ++static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop, ++ const char *dval) + { +- return smbios_add_prop_si(ctx, prop, SYSINFO_ID_NONE); ++ return smbios_add_prop_si(ctx, prop, SYSINFO_ID_NONE, dval); + } + + static void smbios_set_eos(struct smbios_ctx *ctx, char *eos) +@@ -228,11 +235,9 @@ static int smbios_write_type0(ulong *current, int handle, + memset(t, 0, sizeof(struct smbios_type0)); + fill_smbios_header(t, SMBIOS_BIOS_INFORMATION, len, handle); + smbios_set_eos(ctx, t->eos); +- t->vendor = smbios_add_string(ctx, "U-Boot"); ++ t->vendor = smbios_add_prop(ctx, NULL, "U-Boot"); + +- t->bios_ver = smbios_add_prop(ctx, "version"); +- if (!t->bios_ver) +- t->bios_ver = smbios_add_string(ctx, PLAIN_VERSION); ++ t->bios_ver = smbios_add_prop(ctx, "version", PLAIN_VERSION); + if (t->bios_ver) + gd->smbios_version = ctx->last_str; + log_debug("smbios_version = %p: '%s'\n", gd->smbios_version, +@@ -241,7 +246,7 @@ static int smbios_write_type0(ulong *current, int handle, + print_buffer((ulong)gd->smbios_version, gd->smbios_version, + 1, strlen(gd->smbios_version) + 1, 0); + #endif +- t->bios_release_date = smbios_add_string(ctx, U_BOOT_DMI_DATE); ++ t->bios_release_date = smbios_add_prop(ctx, NULL, U_BOOT_DMI_DATE); + #ifdef CONFIG_ROM_SIZE + t->bios_rom_size = (CONFIG_ROM_SIZE / 65536) - 1; + #endif +@@ -280,22 +285,19 @@ static int smbios_write_type1(ulong *current, int handle, + memset(t, 0, sizeof(struct smbios_type1)); + fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle); + smbios_set_eos(ctx, t->eos); +- t->manufacturer = smbios_add_prop(ctx, "manufacturer"); +- if (!t->manufacturer) +- t->manufacturer = smbios_add_string(ctx, "Unknown"); +- t->product_name = smbios_add_prop(ctx, "product"); +- if (!t->product_name) +- t->product_name = smbios_add_string(ctx, "Unknown Product"); ++ t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); ++ t->product_name = smbios_add_prop(ctx, "product", "Unknown"); + t->version = smbios_add_prop_si(ctx, "version", +- SYSINFO_ID_SMBIOS_SYSTEM_VERSION); ++ SYSINFO_ID_SMBIOS_SYSTEM_VERSION, ++ "Unknown"); + if (serial_str) { +- t->serial_number = smbios_add_string(ctx, serial_str); ++ t->serial_number = smbios_add_prop(ctx, NULL, serial_str); + strncpy((char *)t->uuid, serial_str, sizeof(t->uuid)); + } else { +- t->serial_number = smbios_add_prop(ctx, "serial"); ++ t->serial_number = smbios_add_prop(ctx, "serial", "Unknown"); + } +- t->sku_number = smbios_add_prop(ctx, "sku"); +- t->family = smbios_add_prop(ctx, "family"); ++ t->sku_number = smbios_add_prop(ctx, "sku", "Unknown"); ++ t->family = smbios_add_prop(ctx, "family", "Unknown"); + + len = t->length + smbios_string_table_len(ctx); + *current += len; +@@ -314,15 +316,12 @@ static int smbios_write_type2(ulong *current, int handle, + memset(t, 0, sizeof(struct smbios_type2)); + fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle); + smbios_set_eos(ctx, t->eos); +- t->manufacturer = smbios_add_prop(ctx, "manufacturer"); +- if (!t->manufacturer) +- t->manufacturer = smbios_add_string(ctx, "Unknown"); +- t->product_name = smbios_add_prop(ctx, "product"); +- if (!t->product_name) +- t->product_name = smbios_add_string(ctx, "Unknown Product"); ++ t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); ++ t->product_name = smbios_add_prop(ctx, "product", "Unknown"); + t->version = smbios_add_prop_si(ctx, "version", +- SYSINFO_ID_SMBIOS_BASEBOARD_VERSION); +- t->asset_tag_number = smbios_add_prop(ctx, "asset-tag"); ++ SYSINFO_ID_SMBIOS_BASEBOARD_VERSION, ++ "Unknown"); ++ t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", "Unknown"); + t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING; + t->board_type = SMBIOS_BOARD_MOTHERBOARD; + +@@ -343,9 +342,7 @@ static int smbios_write_type3(ulong *current, int handle, + memset(t, 0, sizeof(struct smbios_type3)); + fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle); + smbios_set_eos(ctx, t->eos); +- t->manufacturer = smbios_add_prop(ctx, "manufacturer"); +- if (!t->manufacturer) +- t->manufacturer = smbios_add_string(ctx, "Unknown"); ++ t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); + t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP; + t->bootup_state = SMBIOS_STATE_SAFE; + t->power_supply_state = SMBIOS_STATE_SAFE; +@@ -388,8 +385,8 @@ static void smbios_write_type4_dm(struct smbios_type4 *t, + #endif + + t->processor_family = processor_family; +- t->processor_manufacturer = smbios_add_string(ctx, vendor); +- t->processor_version = smbios_add_string(ctx, name); ++ t->processor_manufacturer = smbios_add_prop(ctx, NULL, vendor); ++ t->processor_version = smbios_add_prop(ctx, NULL, name); + } + + static int smbios_write_type4(ulong *current, int handle, + +From patchwork Thu Dec 7 09:18:50 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Ilias Apalodimas +X-Patchwork-Id: 1873090 +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=KcFhbOkM; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sm7yF71l9z23nD + for ; Thu, 7 Dec 2023 20:19:33 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 7D6CB87483; + Thu, 7 Dec 2023 10:19:07 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="KcFhbOkM"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id B1E298745E; Thu, 7 Dec 2023 10:19:05 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com + [IPv6:2a00:1450:4864:20::433]) + (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 792A8871BB + for ; Thu, 7 Dec 2023 10:19:03 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org +Received: by mail-wr1-x433.google.com with SMTP id + ffacd0b85a97d-3334a701cbbso717814f8f.0 + for ; Thu, 07 Dec 2023 01:19:03 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1701940743; x=1702545543; darn=lists.denx.de; + h=content-transfer-encoding:mime-version:references:in-reply-to + :message-id:date:subject:cc:to:from:from:to:cc:subject:date + :message-id:reply-to; + bh=JIRbBgzEcdaHWJ7fVa5JIsDJda65F2tSuL1aji2tJ5U=; + b=KcFhbOkMkvXbThdeAeI92+uSdN5LvKdwae+36Z/jz0Hg0yPDs5v8UqeDt2d+NaSlh9 + GERy8kIMCopTcJ13FoUM8Ok4PBSMRSDxbJo4lLaGIbddw7hcit4uxhJfTAL8zKxnboMU + YBZPC/E2NjWklmJx6p4zmLeXS5IzncTaDE9z2XFMRGrJ/KLqpTvwOp/nf57jP/kdIxpe + Q7vWAhVY8gC19ogSD41RB4ixA0HefI6xKq6fAl2GwvRlOvCEGAcVdpbl8aj5R8qEOSVT + BsuqzbDXHlQI6L9Y++Yqe89LcKMRoAWqHrgOuO3eBwnEp2jjjzV8G24mTFD+4wso1ERo + mIkQ== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1701940743; x=1702545543; + 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=JIRbBgzEcdaHWJ7fVa5JIsDJda65F2tSuL1aji2tJ5U=; + b=pee1V3/z6lW4enMw0ueHvBJJXGhNLq7KccXmY4QkXfVRLXGBOedbBwQH1KXDxj/gJs + RZ/KhsEvPN4qeqrqpeOnQoDBQs3QarjlsMHmlhnlBZMpgPKTJyg5MEpZPAlnfqZJkd4A + vMMYc1fZ+alT5gfZjdzpLypC2sOj9yC3ktb8ZYXQGQzN7yCYrQnBHgiYn3vDDaHMaQNH + n73RxiQNWJs9Ekow2hxk4l2FDpvlwuiFr9y+dnuzo5TvpbgaDbj64tcqxalnusBw3jKC + fE6r5cob553rh/ZM/bVJD/PIXP+LOSUHyiqJG+7KpEpSAY984EIHkKFRRbLHSIuwBAK+ + wTIw== +X-Gm-Message-State: AOJu0YwQcpf2rvKZHAPWsPT7fH7x3sa+mhF5kDJ557Oe9zwmQc4v6NzO + ZFEgE8KlljYnqibJKd2JdRCP6A== +X-Google-Smtp-Source: + AGHT+IEfJolrJ5g6Qgn465DsdBpMZMW+cn6kVgLvehQIXNT7VcXYfkBvC8Hf5zXnl7Q5Yto7bS2tOg== +X-Received: by 2002:a05:600c:d5:b0:40b:5e59:99c6 with SMTP id + u21-20020a05600c00d500b0040b5e5999c6mr940484wmm.230.1701940742953; + Thu, 07 Dec 2023 01:19:02 -0800 (PST) +Received: from localhost.localdomain (ppp046103111243.access.hol.gr. + [46.103.111.243]) by smtp.gmail.com with ESMTPSA id + u21-20020a05600c139500b00405d9a950a2sm1299003wmf.28.2023.12.07.01.19.01 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Thu, 07 Dec 2023 01:19:02 -0800 (PST) +From: Ilias Apalodimas +To: trini@konsulko.com, + sjg@chromium.org +Cc: sean.anderson@seco.com, neil.armstrong@linaro.org, + heinrich.schuchardt@canonical.com, mark.kettenis@xs4all.nl, + Ilias Apalodimas , u-boot@lists.denx.de +Subject: [PATCH 2/2 v3] smbios: Fallback to the default DT if sysinfo nodes + are missing +Date: Thu, 7 Dec 2023 11:18:50 +0200 +Message-Id: <20231207091850.17776-3-ilias.apalodimas@linaro.org> +X-Mailer: git-send-email 2.40.1 +In-Reply-To: <20231207091850.17776-1-ilias.apalodimas@linaro.org> +References: <20231207091850.17776-1-ilias.apalodimas@linaro.org> +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 + +In order to fill in the SMBIOS tables U-Boot currently relies on a +"u-boot,sysinfo-smbios" compatible node. This is fine for the boards +that already include such nodes. However with some recent EFI changes, +the majority of boards can boot up distros, which usually rely on +things like dmidecode etc for their reporting. For boards that +lack this special node the SMBIOS output looks like: + +System Information + Manufacturer: Unknown + Product Name: Unknown + Version: Unknown + Serial Number: Unknown + UUID: Not Settable + Wake-up Type: Reserved + SKU Number: Unknown + Family: Unknown + +This looks problematic since most of the info are "Unknown". The DT spec +specifies standard properties containing relevant information like +'model' and 'compatible' for which the suggested format is +. Unfortunately the 'model' string found in DTs is +usually lacking the manufacturer so we can't use it for both +'Manufacturer' and 'Product Name' SMBIOS entries reliably. + +So let's add a last resort to our current smbios parsing. If none of +the sysinfo properties are found, scan for those information in the +root node of the device tree. Use the 'model' to fill the 'Product +Name' and the first value of 'compatible' for the 'Manufacturer', since +that always contains one. + +pre-patch: +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: Unknown + Product Name: Unknown + Version: Unknown + Serial Number: 100000000bb24ceb + UUID: 30303031-3030-3030-3061-613234636435 + Wake-up Type: Reserved + SKU Number: Unknown + Family: Unknown +[...] + +and post patch: +Handle 0x0001, DMI type 1, 27 bytes +System Information + Manufacturer: raspberrypi + Product Name: Raspberry Pi 4 Model B Rev 1.1 + Version: Unknown + Serial Number: 100000000bb24ceb + UUID: 30303031-3030-3030-3061-613234636435 + Wake-up Type: Reserved + SKU Number: Unknown + Family: Unknown +[...] + +Signed-off-by: Ilias Apalodimas +--- +Simon, I'll work with tou on the refactoring you wanted and +remove the EFI requirement of SMBIOS in !x86 platforms. +Since this code has no tests, I'll add some once the refactoring +is done + +Changes since v2: +- Spelling mistakes +- rebase on top of patch #1 changes +Changes since v1: +- Tokenize the DT node entry and use the appropriate value instead of + the entire string +- Removed Peters tested/reviewed-by tags due to the above + lib/smbios.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 89 insertions(+), 5 deletions(-) + +-- +2.40.1 + +diff --git a/lib/smbios.c b/lib/smbios.c +index 444aa245a273..3f0e1d529537 100644 +--- a/lib/smbios.c ++++ b/lib/smbios.c +@@ -9,11 +9,14 @@ + #include + #include + #include ++#include + #include + #include + #include + #include + #include ++#include ++#include + #ifdef CONFIG_CPU + #include + #include +@@ -43,6 +46,25 @@ + + DECLARE_GLOBAL_DATA_PTR; + ++/** ++ * struct map_sysinfo - Mapping of sysinfo strings to DT ++ * ++ * @sysinfo_str: sysinfo string ++ * @dt_str: DT string ++ * @max: Max index of the tokenized string to pick. Counting starts from 0 ++ * ++ */ ++struct map_sysinfo { ++ const char *sysinfo_str; ++ const char *dt_str; ++ int max; ++}; ++ ++static const struct map_sysinfo sysinfo_to_dt[] = { ++ { .sysinfo_str = "product", .dt_str = "model", 2 }, ++ { .sysinfo_str = "manufacturer", .dt_str = "compatible", 1 }, ++}; ++ + /** + * struct smbios_ctx - context for writing SMBIOS tables + * +@@ -87,6 +109,18 @@ struct smbios_write_method { + const char *subnode_name; + }; + ++static const struct map_sysinfo *convert_sysinfo_to_dt(const char *sysinfo_str) ++{ ++ int i; ++ ++ for (i = 0; i < ARRAY_SIZE(sysinfo_to_dt); i++) { ++ if (!strcmp(sysinfo_str, sysinfo_to_dt[i].sysinfo_str)) ++ return &sysinfo_to_dt[i]; ++ } ++ ++ return NULL; ++} ++ + /** + * smbios_add_string() - add a string to the string area + * +@@ -124,6 +158,42 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) + } + } + ++/** ++ * get_str_from_dt - Get a substring from a DT property. ++ * After finding the property in the DT, the function ++ * will parse comma-separated values and return the value. ++ * If nprop->max exceeds the number of comma-separated ++ * elements, the last non NULL value will be returned. ++ * Counting starts from zero. ++ * ++ * @nprop: sysinfo property to use ++ * @str: pointer to fill with data ++ * @size: str buffer length ++ */ ++static ++void get_str_from_dt(const struct map_sysinfo *nprop, char *str, size_t size) ++{ ++ const char *dt_str; ++ int cnt = 0; ++ char *token; ++ ++ memset(str, 0, size); ++ if (!nprop || !nprop->max) ++ return; ++ ++ dt_str = ofnode_read_string(ofnode_root(), nprop->dt_str); ++ if (!dt_str) ++ return; ++ ++ memcpy(str, dt_str, size); ++ token = strtok(str, ","); ++ while (token && cnt < nprop->max) { ++ strlcpy(str, token, strlen(token) + 1); ++ token = strtok(NULL, ","); ++ cnt++; ++ } ++} ++ + /** + * smbios_add_prop_si() - Add a property from the devicetree or sysinfo + * +@@ -137,6 +207,8 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) + static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, + int sysinfo_id, const char *dval) + { ++ int ret; ++ + if (!dval || !*dval) + dval = "Unknown"; + +@@ -145,18 +217,30 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, + + if (sysinfo_id && ctx->dev) { + char val[SMBIOS_STR_MAX]; +- int ret; + + ret = sysinfo_get_str(ctx->dev, sysinfo_id, sizeof(val), val); + if (!ret) + return smbios_add_string(ctx, val); + } + if (IS_ENABLED(CONFIG_OF_CONTROL)) { +- const char *str; +- +- str = ofnode_read_string(ctx->node, prop); ++ const char *str = NULL; ++ char str_dt[128] = { 0 }; ++ /* ++ * If the node is not valid fallback and try the entire DT ++ * so we can at least fill in manufacturer and board type ++ */ ++ if (ofnode_valid(ctx->node)) { ++ str = ofnode_read_string(ctx->node, prop); ++ } else { ++ const struct map_sysinfo *nprop; ++ ++ nprop = convert_sysinfo_to_dt(prop); ++ get_str_from_dt(nprop, str_dt, sizeof(str_dt)); ++ str = (const char *)str_dt; ++ } + +- return smbios_add_string(ctx, str ? str : dval); ++ ret = smbios_add_string(ctx, str && *str ? str : dval); ++ return ret; + } + + return 0; diff --git a/sources b/sources index a04670b..baad200 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.01-rc3.tar.bz2) = 51a45e6a0008ef04570b6357518c85fd22604be0090ad5bf1dc7c821eb34ea33441314c49128dd0bd3084406b7138497044bb47f7e57d38a680768fb9f2f6577 +SHA512 (u-boot-2024.01-rc4.tar.bz2) = 02ad9abe2a0c34fb11e75f75b1d76a4dc2df2886ed00f0fbec090cfe87d586becfee7c1edce8e95d26d1e34ead26faf928d17fdc6f8dee158a73f93c0078ae0a diff --git a/uboot-tools.spec b/uboot-tools.spec index 6635f59..e77092e 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc3 +%global candidate rc4 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.01 -Release: 0.1%{?candidate:.%{candidate}}%{?dist} +Release: 0.2%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -19,8 +19,7 @@ Source1: aarch64-boards Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch Patch2: disable-VBE-by-default.patch -Patch3: 0001-smbios-Simplify-reporting-of-unknown-values.patch -Patch4: 0002-smbios-Fallback-to-the-default-DT-if-sysinfo-nodes-a.patch +Patch3: Provide-a-fallback-to-smbios-tables.patch Patch5: enable-bootmenu-by-default.patch Patch6: uefi-Boot-var-automatic-management-for-removable-medias.patch Patch7: Add-video-damage-tracking.patch @@ -215,6 +214,10 @@ cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand %endif %changelog +* Thu Dec 07 2023 Peter Robinson - 1:2024.01-0.2.rc4 +- Update to 2024.01 RC4 +- Rebase SMBIOS patch to latest rev + * Fri Nov 24 2023 Peter Robinson - 1:2024.01-0.1.rc3 - Update to 2024.01 RC3 From 6bcb24bf3d7addaee76c7d5925b4c2399847c1d8 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 8 Dec 2023 12:22:27 +0000 Subject: [PATCH 020/128] cleanup board specific docs --- uboot-tools.spec | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index e77092e..b7ab293 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -191,17 +191,9 @@ install -p -m 0644 doc/mkimage.1 %{buildroot}%{_mandir}/man1 install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} ( cd %{buildroot}%{_bindir}; ln -sf fw_printenv fw_setenv ) -# Copy some useful docs over -mkdir -p builds/docs -cp -p board/hisilicon/hikey/README builds/docs/README.hikey -cp -p board/rockchip/evb_rk3399/README builds/docs/README.evb_rk3399 -cp -p board/sunxi/README.sunxi64 builds/docs/README.sunxi64 -cp -p board/sunxi/README.nand builds/docs/README.sunxi-nand - %files %doc README doc/develop/distro.rst doc/README.gpt -%doc doc/README.rockchip doc/develop/uefi doc/usage doc/arch/arm64.rst -%doc builds/docs/* doc/board/amlogic/ doc/board/rockchip/ +%doc doc/develop/uefi doc/usage doc/arch/arm64.rst %{_bindir}/* %{_mandir}/man1/mkimage.1* %dir %{_datadir}/uboot/ From eafba21345fc59c167f58ce881c01bb156d9bbcc Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 14 Dec 2023 14:28:34 +0100 Subject: [PATCH 021/128] Enable qemu aarch64 board Useful for testing aarch64 uboot stuff with qemu's aarch64 virt machine. --- aarch64-boards | 1 + 1 file changed, 1 insertion(+) diff --git a/aarch64-boards b/aarch64-boards index ac90276..39a556a 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -66,6 +66,7 @@ pinephone-pro-rk3399 pinetab poplar puma-rk3399 +qemu_arm64 roc-cc-rk3328 rock64-rk3328 rock960-rk3399 From 7b44a7f95beb2772dcf55939d801b05e6ab0a556 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 8 Jan 2024 22:18:37 +0000 Subject: [PATCH 022/128] 2024.01 --- ...-the-DT-provided-by-the-Raspberry-Pi.patch | 141 -- ...tch-to-OF_HAS_PRIOR_STAGE-by-default.patch | 154 ++ rpi5-initial-support.patch | 1910 +++++++++++++++++ sources | 2 +- uboot-tools.spec | 11 +- ...atic-management-for-removable-medias.patch | 154 +- 6 files changed, 2162 insertions(+), 210 deletions(-) delete mode 100644 rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch create mode 100644 rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch create mode 100644 rpi5-initial-support.patch diff --git a/rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch b/rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch deleted file mode 100644 index fd032fe..0000000 --- a/rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 52b75976133683dc9fe66e8ad35127125f938bed Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Tue, 28 Feb 2023 12:04:34 +0000 -Subject: [PATCH 2/2] rpi: Use OF_BOARD rather than OF_EMBED - -The use of OF_EMBED isn't recommended for standard use and the OF_BOARD -is actually a better fit for the Raspberry Pi as the prior firmware -provides a DT that can be used by U-Boot and the subsequent OS too, but -it still allows the loading of a DT from disk as well if users wish -to use the upstream kernel DT. - -Signed-off-by: Peter Robinson ---- - configs/rpi_0_w_defconfig | 2 +- - configs/rpi_2_defconfig | 2 +- - configs/rpi_3_32b_defconfig | 2 +- - configs/rpi_3_b_plus_defconfig | 2 +- - configs/rpi_3_defconfig | 2 +- - configs/rpi_4_32b_defconfig | 1 + - configs/rpi_4_defconfig | 1 + - configs/rpi_arm64_defconfig | 1 + - configs/rpi_defconfig | 2 +- - 9 files changed, 9 insertions(+), 6 deletions(-) - -diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig -index 5249b29d76c..8c217848ca2 100644 ---- a/configs/rpi_0_w_defconfig -+++ b/configs/rpi_0_w_defconfig -@@ -23,7 +23,7 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig -index 154284765f4..bfc5679fb7e 100644 ---- a/configs/rpi_2_defconfig -+++ b/configs/rpi_2_defconfig -@@ -24,7 +24,7 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig -index ef1f25d2ad7..54cdcee980a 100644 ---- a/configs/rpi_3_32b_defconfig -+++ b/configs/rpi_3_32b_defconfig -@@ -23,7 +23,7 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig -index 154615d78a1..3008c7a1c18 100644 ---- a/configs/rpi_3_b_plus_defconfig -+++ b/configs/rpi_3_b_plus_defconfig -@@ -22,7 +22,7 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig -index f0cf7f8e236..f7b9108ba00 100644 ---- a/configs/rpi_3_defconfig -+++ b/configs/rpi_3_defconfig -@@ -22,7 +22,7 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_4_32b_defconfig b/configs/rpi_4_32b_defconfig -index 713b2ee231c..fa20ab767fe 100644 ---- a/configs/rpi_4_32b_defconfig -+++ b/configs/rpi_4_32b_defconfig -@@ -24,6 +24,7 @@ CONFIG_CMD_MMC=y - CONFIG_CMD_PCI=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_4_defconfig b/configs/rpi_4_defconfig -index 24f70b14fe8..741d4dbbbf4 100644 ---- a/configs/rpi_4_defconfig -+++ b/configs/rpi_4_defconfig -@@ -24,6 +24,7 @@ CONFIG_CMD_MMC=y - CONFIG_CMD_PCI=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig -index 1d1ff12a58c..5e1195dd786 100644 ---- a/configs/rpi_arm64_defconfig -+++ b/configs/rpi_arm64_defconfig -@@ -23,6 +23,7 @@ CONFIG_CMD_MMC=y - CONFIG_CMD_PCI=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y - CONFIG_TFTP_TSIZE=y -diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig -index 28b92b14456..1504093eddf 100644 ---- a/configs/rpi_defconfig -+++ b/configs/rpi_defconfig -@@ -23,7 +23,7 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y -+CONFIG_OF_BOARD=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y --- -2.39.2 - diff --git a/rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch b/rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch new file mode 100644 index 0000000..9ac9512 --- /dev/null +++ b/rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch @@ -0,0 +1,154 @@ +From 5aaa4c98be87eef370a0c50bf6d4ab7f9fcde886 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Mon, 8 Jan 2024 22:13:59 +0000 +Subject: [PATCH] rpi: Switch to OF_HAS_PRIOR_STAGE by default +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On all Raspberry Pi platforms, we're loaded by a prior stage firmware +that has assembled and passed on a device tree binary for us to use. +Switch to using this tree by default. + +Signed-off-by: Peter Robinson +Cc: Matthias Brugger +Cc: Simon Glass +Cc: François Ozog +Signed-off-by: Tom Rini +Tested-by: Simon Glass +--- +To be clear, this is on top of current -next where I've applied v8 of +Simon's series that introduces OF_HAS_PRIOR_STAGE. + +I've only been able to test this on my Raspberry Pi 3 boards but this +should work everywhere. What may, or may not, be a problem is that +arch/arm/dts/bcm283x-u-boot.dtsi is never used now. On the other hand, +I believe this should stop the problems we have where changes made to +the device tree via config.txt or similar aren't reflected when booting +U-Boot or Linux since we will be using that tree for certain now. +--- + arch/arm/Kconfig | 1 + + arch/arm/mach-bcm283x/Kconfig | 3 --- + configs/rpi_0_w_defconfig | 1 - + configs/rpi_2_defconfig | 1 - + configs/rpi_3_32b_defconfig | 1 - + configs/rpi_3_b_plus_defconfig | 1 - + configs/rpi_3_defconfig | 1 - + configs/rpi_defconfig | 1 - + 8 files changed, 1 insertion(+), 9 deletions(-) + +diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig +index 1fd7aacc380..33bbe7b4898 100644 +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -645,6 +645,7 @@ config ARCH_BCM283X + select SERIAL_SEARCH_ALL + imply CMD_DM + imply FAT_WRITE ++ imply OF_HAS_PRIOR_STAGE + + config ARCH_BCMSTB + bool "Broadcom BCM7XXX family" +diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig +index 6ce278c6d29..b3287ce8bce 100644 +--- a/arch/arm/mach-bcm283x/Kconfig ++++ b/arch/arm/mach-bcm283x/Kconfig +@@ -163,7 +163,6 @@ config TARGET_RPI_4_32B + + This option creates a build targeting the ARMv7/AArch32 ISA. + select BCM2711_32B +- imply OF_HAS_PRIOR_STAGE + + config TARGET_RPI_4 + bool "Raspberry Pi 4 64-bit build" +@@ -189,7 +188,6 @@ config TARGET_RPI_4 + + This option creates a build targeting the ARMv8/AArch64 ISA. + select BCM2711_64B +- imply OF_HAS_PRIOR_STAGE + + config TARGET_RPI_ARM64 + bool "Raspberry Pi one binary 64-bit build" +@@ -197,7 +195,6 @@ config TARGET_RPI_ARM64 + Support for all armv8 based Raspberry Pi variants, such as + the RPi 4 model B, in AArch64 (64-bit) mode. + select ARM64 +- imply OF_HAS_PRIOR_STAGE + + endchoice + +diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig +index bed143d64d6..98f8904c918 100644 +--- a/configs/rpi_0_w_defconfig ++++ b/configs/rpi_0_w_defconfig +@@ -24,7 +24,6 @@ CONFIG_CMD_GPIO=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y + CONFIG_CMD_FS_UUID=y +-CONFIG_OF_EMBED=y + CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" + CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig +index e4e4843e8cd..1b8676e1d10 100644 +--- a/configs/rpi_2_defconfig ++++ b/configs/rpi_2_defconfig +@@ -25,7 +25,6 @@ CONFIG_CMD_GPIO=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y + CONFIG_CMD_FS_UUID=y +-CONFIG_OF_EMBED=y + CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" + CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig +index 215396599e4..abc10a79ada 100644 +--- a/configs/rpi_3_32b_defconfig ++++ b/configs/rpi_3_32b_defconfig +@@ -24,7 +24,6 @@ CONFIG_CMD_GPIO=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y + CONFIG_CMD_FS_UUID=y +-CONFIG_OF_EMBED=y + CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" + CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig +index d1ec55e558a..3c8f8fc1bb7 100644 +--- a/configs/rpi_3_b_plus_defconfig ++++ b/configs/rpi_3_b_plus_defconfig +@@ -23,7 +23,6 @@ CONFIG_CMD_GPIO=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y + CONFIG_CMD_FS_UUID=y +-CONFIG_OF_EMBED=y + CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" + CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig +index 8e9c35b3cef..9853c448809 100644 +--- a/configs/rpi_3_defconfig ++++ b/configs/rpi_3_defconfig +@@ -23,7 +23,6 @@ CONFIG_CMD_GPIO=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y + CONFIG_CMD_FS_UUID=y +-CONFIG_OF_EMBED=y + CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" + CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig +index 89d6372c1de..060a8809506 100644 +--- a/configs/rpi_defconfig ++++ b/configs/rpi_defconfig +@@ -24,7 +24,6 @@ CONFIG_CMD_GPIO=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y + CONFIG_CMD_FS_UUID=y +-CONFIG_OF_EMBED=y + CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" + CONFIG_SYS_RELOC_GD_ENV_ADDR=y + CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y +-- +2.43.0 + diff --git a/rpi5-initial-support.patch b/rpi5-initial-support.patch new file mode 100644 index 0000000..4a79f31 --- /dev/null +++ b/rpi5-initial-support.patch @@ -0,0 +1,1910 @@ +From patchwork Mon Dec 18 21:03:35 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: "Ivan T. Ivanov" +X-Patchwork-Id: 1877649 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 + header.s=susede2_rsa header.b=frMNX+46; + dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=IseK5QVE; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.a=rsa-sha256 header.s=susede2_rsa header.b=1pz5pvm/; + dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=fIckdee4; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4SvC455lk9z1ydc + for ; Tue, 19 Dec 2023 08:04:05 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 92DDD8753C; + Mon, 18 Dec 2023 22:03:54 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +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=suse.de header.i=@suse.de header.b="frMNX+46"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="IseK5QVE"; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.b="1pz5pvm/"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="fIckdee4"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 95A7F87525; Mon, 18 Dec 2023 22:03:53 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from smtp-out1.suse.de (smtp-out1.suse.de + [IPv6:2a07:de40:b251:101:10:150:64:1]) + (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 0B37B87530 + for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de +Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org + [10.150.64.97]) + (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 smtp-out1.suse.de (Postfix) with ESMTPS id 6EE4F2228D; + Mon, 18 Dec 2023 21:03:49 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933430; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; + b=frMNX+46FgFSdyN24UT7Y4WdFDJKcOxcjH0HyyTrZsMcayuXoLtERkmRllSmLu8aRAoWOI + dzM9aX7eK9EHwuozUVijinsJ6wKpvqwxEx0Kdnj3wKPjAS3KTXGwfYiuZeO5wmbGRytEXd + p252vWhSG5L4UgaWil84yA4iM0KqiPs= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933430; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; + b=IseK5QVEh+KCaimaGVOvt6lv9A9n/uQ/xO6kky5hugt4tubeSnhwGXuCjHTIEZhYi9auSr + Q6h6Mb/o4bd7u1CQ== +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933429; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; + b=1pz5pvm/SI3fxjKAlUcM+pRnK+NKLVbl/0Kj+UUQ/R29Irq4CDjfgTyaU0/DIXgn3x7Ttl + 2U7+per0J38TYiYHjQSDlrdPq4CwSFX2IEFS6sA5jx41ySG3RgO51Hh5GXKFh/WDUjcsn6 + ZPLcQCP31JjxHhULkzjaYLVYE2rQuXE= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933429; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; + b=fIckdee4Yc6Iut7CdcyZnDHxDW58F+dY46W7JLg6y7iXnfDkSc0DETyb97S3ngS7GdF3OQ + HPy/QFdHWA8p8cBw== +Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) + (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D359F13C92; + Mon, 18 Dec 2023 21:03:48 +0000 (UTC) +Received: from dovecot-director2.suse.de ([10.150.64.162]) + by imap1.dmz-prg2.suse.org with ESMTPSA id 4CUUMbSzgGUtZAAAD6G6ig + (envelope-from ); Mon, 18 Dec 2023 21:03:48 +0000 +From: "Ivan T. Ivanov" +To: Matthias Brugger , + Peter Robinson +Cc: Dmitry Malkin , + Thomas Fitzsimmons , Peng Fan , + Jaehoon Chung , Anatolij Gustschin , + wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, + "Ivan T . Ivanov" +Subject: [PATCH v3 1/7] rpi5: add initial memory map for bcm2712 +Date: Mon, 18 Dec 2023 23:03:35 +0200 +Message-ID: <20231218210341.30073-2-iivanov@suse.de> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> +References: <20231218210341.30073-1-iivanov@suse.de> +MIME-Version: 1.0 +Authentication-Results: smtp-out1.suse.de; + none +X-Spamd-Result: default: False [0.70 / 50.00]; ARC_NA(0.00)[]; + RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; + TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; + R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; + TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; + NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; + DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[11]; + MID_CONTAINS_FROM(1.00)[]; + DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,bedrocksystems.com:email]; + FREEMAIL_TO(0.00)[suse.com,gmail.com]; + FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; + MIME_TRACE(0.00)[0:+]; + FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; + RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] +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 + +From: Dmitry Malkin + +includes: +* 1GB of RAM (from 4GB or 8GB total) +* VPU memory interface +* AXI ranges (main peripherals) + +Signed-off-by: Dmitry Malkin +Signed-off-by: Ivan T. Ivanov +--- + arch/arm/mach-bcm283x/init.c | 38 +++++++++++++++++++++++++++++++++++- + 1 file changed, 37 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c +index 7265faf6ce..af23b9711a 100644 +--- a/arch/arm/mach-bcm283x/init.c ++++ b/arch/arm/mach-bcm283x/init.c +@@ -19,7 +19,7 @@ + #ifdef CONFIG_ARM64 + #include + +-#define MEM_MAP_MAX_ENTRIES (4) ++#define MEM_MAP_MAX_ENTRIES (5) + + static struct mm_region bcm283x_mem_map[MEM_MAP_MAX_ENTRIES] = { + { +@@ -68,6 +68,41 @@ static struct mm_region bcm2711_mem_map[MEM_MAP_MAX_ENTRIES] = { + } + }; + ++static struct mm_region bcm2712_mem_map[MEM_MAP_MAX_ENTRIES] = { ++ { ++ .virt = 0x00000000UL, ++ .phys = 0x00000000UL, ++ .size = 0x3f800000UL, ++ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | ++ PTE_BLOCK_INNER_SHARE ++ }, { ++ .virt = 0x3f800000UL, ++ .phys = 0x3f800000UL, ++ .size = 0x00800000UL, ++ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | ++ PTE_BLOCK_NON_SHARE | ++ PTE_BLOCK_PXN | PTE_BLOCK_UXN ++ }, { ++ /* Beginning of AXI bus where uSD controller lives */ ++ .virt = 0x1000000000UL, ++ .phys = 0x1000000000UL, ++ .size = 0x0002000000UL, ++ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | ++ PTE_BLOCK_NON_SHARE | ++ PTE_BLOCK_PXN | PTE_BLOCK_UXN ++ }, { ++ .virt = 0x107c000000UL, ++ .phys = 0x107c000000UL, ++ .size = 0x0004000000UL, ++ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | ++ PTE_BLOCK_NON_SHARE | ++ PTE_BLOCK_PXN | PTE_BLOCK_UXN ++ }, { ++ /* List terminator */ ++ 0, ++ } ++}; ++ + struct mm_region *mem_map = bcm283x_mem_map; + + /* +@@ -78,6 +113,7 @@ static const struct udevice_id board_ids[] = { + { .compatible = "brcm,bcm2837", .data = (ulong)&bcm283x_mem_map}, + { .compatible = "brcm,bcm2838", .data = (ulong)&bcm2711_mem_map}, + { .compatible = "brcm,bcm2711", .data = (ulong)&bcm2711_mem_map}, ++ { .compatible = "brcm,bcm2712", .data = (ulong)&bcm2712_mem_map}, + { }, + }; + + +From patchwork Mon Dec 18 21:03:36 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: "Ivan T. Ivanov" +X-Patchwork-Id: 1877650 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 + header.s=susede2_rsa header.b=v1KGWKJg; + dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=fFiq02vw; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.a=rsa-sha256 header.s=susede2_rsa header.b=v1KGWKJg; + dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=fFiq02vw; + 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 4SvC4H2hzjz1ydc + for ; Tue, 19 Dec 2023 08:04:15 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id C85A08758C; + Mon, 18 Dec 2023 22:03:57 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +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=suse.de header.i=@suse.de header.b="v1KGWKJg"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="fFiq02vw"; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.b="v1KGWKJg"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="fFiq02vw"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 6F50F87530; Mon, 18 Dec 2023 22:03:54 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from smtp-out2.suse.de (smtp-out2.suse.de + [IPv6:2a07:de40:b251:101:10:150:64:2]) + (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 199488753C + for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de +Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org + [10.150.64.97]) + (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 smtp-out2.suse.de (Postfix) with ESMTPS id 1AC1A1F46E; + Mon, 18 Dec 2023 21:03:50 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933430; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; + b=v1KGWKJgJttai7C79qIEMd/XpNIgzFqndAnylh2LCSBCYnAQmHcbTcoqWFl1mbR0bCIJ2B + nnbHB6CW+/Ja2oUD0wavAmzqzhQ+ANsN8FLZ+RC4p4W0fnMs6Yz9lMDf8ozKecEdna61Q6 + 2SnPjyXAogWLFBBDalRvdzUIOIWe3Tc= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933430; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; + b=fFiq02vw2EIwrIbp2ltl5amzeQZi9NS1k/nH07K65OVAZc8eRyKu/vHbdjX58887t//OZ/ + 6LuVBS0afgkEbWCg== +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933430; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; + b=v1KGWKJgJttai7C79qIEMd/XpNIgzFqndAnylh2LCSBCYnAQmHcbTcoqWFl1mbR0bCIJ2B + nnbHB6CW+/Ja2oUD0wavAmzqzhQ+ANsN8FLZ+RC4p4W0fnMs6Yz9lMDf8ozKecEdna61Q6 + 2SnPjyXAogWLFBBDalRvdzUIOIWe3Tc= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933430; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; + b=fFiq02vw2EIwrIbp2ltl5amzeQZi9NS1k/nH07K65OVAZc8eRyKu/vHbdjX58887t//OZ/ + 6LuVBS0afgkEbWCg== +Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) + (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7FCBC133E5; + Mon, 18 Dec 2023 21:03:49 +0000 (UTC) +Received: from dovecot-director2.suse.de ([10.150.64.162]) + by imap1.dmz-prg2.suse.org with ESMTPSA id AH+lHLWzgGUtZAAAD6G6ig + (envelope-from ); Mon, 18 Dec 2023 21:03:49 +0000 +From: "Ivan T. Ivanov" +To: Matthias Brugger , + Peter Robinson +Cc: Dmitry Malkin , + Thomas Fitzsimmons , Peng Fan , + Jaehoon Chung , Anatolij Gustschin , + wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, + "Ivan T . Ivanov" +Subject: [PATCH v3 2/7] rpi5: Use devicetree as alternative way to read IO + base addresses +Date: Mon, 18 Dec 2023 23:03:36 +0200 +Message-ID: <20231218210341.30073-3-iivanov@suse.de> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> +References: <20231218210341.30073-1-iivanov@suse.de> +MIME-Version: 1.0 +X-Spamd-Result: default: False [10.00 / 50.00]; ARC_NA(0.00)[]; + RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_SPAM(5.10)[100.00%]; + FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; + FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; + R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; + TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; + RCVD_COUNT_THREE(0.00)[3]; + DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; + DBL_BLOCKED_OPENRESOLVER(0.00)[bedrocksystems.com:email,suse.de:email]; + FREEMAIL_TO(0.00)[suse.com,gmail.com]; + FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; + MIME_TRACE(0.00)[0:+]; + FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; + RCVD_TLS_ALL(0.00)[] +Authentication-Results: smtp-out2.suse.de; + none +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 + +From: Dmitry Malkin + +MBOX and Watchdog on RPi5/bcm2712 has a different base IO offsets. +Find them via devicetree blob passed by bootloader. + +Signed-off-by: Dmitry Malkin +Signed-off-by: Ivan T. Ivanov +--- + arch/arm/mach-bcm283x/include/mach/base.h | 5 ++- + arch/arm/mach-bcm283x/include/mach/mbox.h | 3 +- + arch/arm/mach-bcm283x/include/mach/sdhci.h | 3 +- + arch/arm/mach-bcm283x/include/mach/timer.h | 3 +- + arch/arm/mach-bcm283x/include/mach/wdog.h | 3 +- + arch/arm/mach-bcm283x/init.c | 43 ++++++++++++++++++---- + 6 files changed, 43 insertions(+), 17 deletions(-) + +diff --git a/arch/arm/mach-bcm283x/include/mach/base.h b/arch/arm/mach-bcm283x/include/mach/base.h +index 4ccaf69693..6de99e7ea1 100644 +--- a/arch/arm/mach-bcm283x/include/mach/base.h ++++ b/arch/arm/mach-bcm283x/include/mach/base.h +@@ -6,7 +6,10 @@ + #ifndef _BCM283x_BASE_H_ + #define _BCM283x_BASE_H_ + +-extern unsigned long rpi_bcm283x_base; ++extern unsigned long rpi_mbox_base; ++extern unsigned long rpi_timer_base; ++extern unsigned long rpi_sdhci_base; ++extern unsigned long rpi_wdog_base; + + #ifdef CONFIG_ARMV7_LPAE + #ifdef CONFIG_TARGET_RPI_4_32B +diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h +index 490664f878..35d4e2f075 100644 +--- a/arch/arm/mach-bcm283x/include/mach/mbox.h ++++ b/arch/arm/mach-bcm283x/include/mach/mbox.h +@@ -38,8 +38,7 @@ + + /* Raw mailbox HW */ + +-#define BCM2835_MBOX_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +- rpi_bcm283x_base + 0x0000b880; }) ++#define BCM2835_MBOX_PHYSADDR rpi_mbox_base + + struct bcm2835_mbox_regs { + u32 read; +diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h +index 7323690687..e837c679c4 100644 +--- a/arch/arm/mach-bcm283x/include/mach/sdhci.h ++++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h +@@ -8,8 +8,7 @@ + + #include + +-#define BCM2835_SDHCI_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +- rpi_bcm283x_base + 0x00300000; }) ++#define BCM2835_SDHCI_PHYSADDR rpi_sdhci_base + + int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq); + +diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h +index 5567dbd7f3..60500a256d 100644 +--- a/arch/arm/mach-bcm283x/include/mach/timer.h ++++ b/arch/arm/mach-bcm283x/include/mach/timer.h +@@ -11,8 +11,7 @@ + #include + #endif + +-#define BCM2835_TIMER_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +- rpi_bcm283x_base + 0x00003000; }) ++#define BCM2835_TIMER_PHYSADDR rpi_timer_base + + #define BCM2835_TIMER_CS_M3 (1 << 3) + #define BCM2835_TIMER_CS_M2 (1 << 2) +diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h +index 9942666720..b950560674 100644 +--- a/arch/arm/mach-bcm283x/include/mach/wdog.h ++++ b/arch/arm/mach-bcm283x/include/mach/wdog.h +@@ -8,8 +8,7 @@ + + #include + +-#define BCM2835_WDOG_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ +- rpi_bcm283x_base + 0x00100000; }) ++#define BCM2835_WDOG_PHYSADDR rpi_wdog_base + + struct bcm2835_wdog_regs { + u32 unknown0[7]; +diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c +index af23b9711a..1c5c748484 100644 +--- a/arch/arm/mach-bcm283x/init.c ++++ b/arch/arm/mach-bcm283x/init.c +@@ -151,7 +151,11 @@ static void rpi_update_mem_map(void) + static void rpi_update_mem_map(void) {} + #endif + +-unsigned long rpi_bcm283x_base = 0x3f000000; ++/* Default bcm283x devices addresses */ ++unsigned long rpi_mbox_base = 0x3f00b880; ++unsigned long rpi_sdhci_base = 0x3f300000; ++unsigned long rpi_wdog_base = 0x3f100000; ++unsigned long rpi_timer_base = 0x3f003000; + + int arch_cpu_init(void) + { +@@ -162,22 +166,45 @@ int arch_cpu_init(void) + + int mach_cpu_init(void) + { +- int ret, soc_offset; ++ int ret, soc, offset; + u64 io_base, size; + + rpi_update_mem_map(); + + /* Get IO base from device tree */ +- soc_offset = fdt_path_offset(gd->fdt_blob, "/soc"); +- if (soc_offset < 0) +- return soc_offset; ++ soc = fdt_path_offset(gd->fdt_blob, "/soc"); ++ if (soc < 0) ++ return soc; + +- ret = fdt_read_range((void *)gd->fdt_blob, soc_offset, 0, NULL, +- &io_base, &size); ++ ret = fdt_read_range((void *)gd->fdt_blob, soc, 0, NULL, ++ &io_base, &size); + if (ret) + return ret; + +- rpi_bcm283x_base = io_base; ++ rpi_mbox_base = io_base + 0x00b880; ++ rpi_sdhci_base = io_base + 0x300000; ++ rpi_wdog_base = io_base + 0x100000; ++ rpi_timer_base = io_base + 0x003000; ++ ++ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, ++ "brcm,bcm2835-mbox"); ++ if (offset > soc) ++ rpi_mbox_base = fdt_get_base_address(gd->fdt_blob, offset); ++ ++ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, ++ "brcm,bcm2835-sdhci"); ++ if (offset > soc) ++ rpi_sdhci_base = fdt_get_base_address(gd->fdt_blob, offset); ++ ++ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, ++ "brcm,bcm2835-system-timer"); ++ if (offset > soc) ++ rpi_timer_base = fdt_get_base_address(gd->fdt_blob, offset); ++ ++ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, ++ "brcm,bcm2712-pm"); ++ if (offset > soc) ++ rpi_wdog_base = fdt_get_base_address(gd->fdt_blob, offset); + + return 0; + } + +From patchwork Mon Dec 18 21:03:37 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: "Ivan T. Ivanov" +X-Patchwork-Id: 1877652 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 + header.s=susede2_rsa header.b=MuifTv9w; + dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=J2WonmZQ; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.a=rsa-sha256 header.s=susede2_rsa header.b=driIaEaW; + dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=ENBj4l6/; + 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 4SvC4h1PpHz1ydc + for ; Tue, 19 Dec 2023 08:04:36 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id BC5CE87656; + Mon, 18 Dec 2023 22:03:58 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +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=suse.de header.i=@suse.de header.b="MuifTv9w"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="J2WonmZQ"; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.b="driIaEaW"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="ENBj4l6/"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 24B3087578; Mon, 18 Dec 2023 22:03:57 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from smtp-out1.suse.de (smtp-out1.suse.de + [IPv6:2a07:de40:b251:101:10:150:64:1]) + (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 34BC9875A0 + for ; Mon, 18 Dec 2023 22:03:52 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de +Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org + [10.150.64.97]) + (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 smtp-out1.suse.de (Postfix) with ESMTPS id B98772226F; + Mon, 18 Dec 2023 21:03:50 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933431; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; + b=MuifTv9wBEOLgWscWoGcXg+RGB8+btC5sRFciLLURyCkDcUQuguKCF0MB5CUHbvIFDKQTs + 3cu6hcIxZ1sJPOhJYAQlW90dBLsORX0sI25Eq4VgPGCsldwfrQ6KFwJmGJHKAf1t3bAtsp + bXmOjkuzkGiYTERqgRtFHlM+jbjtULk= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933431; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; + b=J2WonmZQu47jTWrv+1hYLdw1tZ+mNBDcST4N3FHxlTW7EY6hSg3i0FkVDYqumfQMZdddMp + jagUtFA6k1hguwCQ== +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933430; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; + b=driIaEaWsaR+g9AcK8SGiaVWp2t8QtO7GFM918C1n2Mg0Ag01KOyoFkVXAvjXENou/caP6 + mszp+EvY1mp+ZR5gwQMkbkHBxQ10VWiFHcSdpA6ZicAD8PbXnb4DO5mEFRyVbxDu6b9fHp + mNp6oBcymc5k4gJFdfomnV1ubqgcp38= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933430; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; + b=ENBj4l6/3jkDUxi4yY5WR8ECQN9jENKPjLTTKM7yT4ET1rZJ3jbU297szl97aZN4oQ41A9 + z8StT2qNvcfjYQCA== +Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) + (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2AC2D13C93; + Mon, 18 Dec 2023 21:03:50 +0000 (UTC) +Received: from dovecot-director2.suse.de ([10.150.64.162]) + by imap1.dmz-prg2.suse.org with ESMTPSA id EE/zB7azgGUtZAAAD6G6ig + (envelope-from ); Mon, 18 Dec 2023 21:03:50 +0000 +From: "Ivan T. Ivanov" +To: Matthias Brugger , + Peter Robinson +Cc: Dmitry Malkin , + Thomas Fitzsimmons , Peng Fan , + Jaehoon Chung , Anatolij Gustschin , + wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, + "Ivan T. Ivanov" +Subject: [PATCH v3 3/7] rpi5: Use devicetree to retrieve board revision +Date: Mon, 18 Dec 2023 23:03:37 +0200 +Message-ID: <20231218210341.30073-4-iivanov@suse.de> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> +References: <20231218210341.30073-1-iivanov@suse.de> +MIME-Version: 1.0 +Authentication-Results: smtp-out1.suse.de; + none +X-Spamd-Result: default: False [1.14 / 50.00]; ARC_NA(0.00)[]; + RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; + TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; + R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; + TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; + NEURAL_HAM_LONG(-1.00)[-1.000]; + R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; + RCVD_COUNT_THREE(0.00)[3]; + DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[11]; + MID_CONTAINS_FROM(1.00)[]; + DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; + FREEMAIL_TO(0.00)[suse.com,gmail.com]; + FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; + MIME_TRACE(0.00)[0:+]; + FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; + RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.56)[98.03%] +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 + +Firmware on RPi5 return error on board revision query +through firmware interface, but on the other hand it fills +"linux,revision" in "system" node, so use it to detect board +revision. + + system { + linux,revision = <0xc04170>; + linux,serial = <0x6cf44e80 0x3c533ede>; + }; + +Signed-off-by: Ivan T. Ivanov +--- + board/raspberrypi/rpi/rpi.c | 22 +++++++++++++++++++--- + 1 file changed, 19 insertions(+), 3 deletions(-) + +diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c +index cd823ad746..2851ebc985 100644 +--- a/board/raspberrypi/rpi/rpi.c ++++ b/board/raspberrypi/rpi/rpi.c +@@ -171,6 +171,11 @@ static const struct rpi_model rpi_models_new_scheme[] = { + DTB_DIR "bcm2711-rpi-cm4.dtb", + true, + }, ++ [0x17] = { ++ "5 Model B", ++ DTB_DIR "bcm2712-rpi-5-b.dtb", ++ true, ++ }, + }; + + static const struct rpi_model rpi_models_old_scheme[] = { +@@ -429,15 +434,27 @@ static void get_board_revision(void) + int ret; + const struct rpi_model *models; + uint32_t models_count; ++ ofnode node; + + BCM2835_MBOX_INIT_HDR(msg); + BCM2835_MBOX_INIT_TAG(&msg->get_board_rev, GET_BOARD_REV); + + ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr); + if (ret) { +- printf("bcm2835: Could not query board revision\n"); + /* Ignore error; not critical */ +- return; ++ node = ofnode_path("/system"); ++ if (!ofnode_valid(node)) { ++ printf("bcm2835: Could not find /system node\n"); ++ return; ++ } ++ ++ ret = ofnode_read_u32(node, "linux,revision", &revision); ++ if (ret) { ++ printf("bcm2835: Could not find linux,revision\n"); ++ return; ++ } ++ } else { ++ revision = msg->get_board_rev.body.resp.rev; + } + + /* +@@ -451,7 +468,6 @@ static void get_board_revision(void) + * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250 + * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594 + */ +- revision = msg->get_board_rev.body.resp.rev; + if (revision & 0x800000) { + rev_scheme = 1; + rev_type = (revision >> 4) & 0xff; + +From patchwork Mon Dec 18 21:03:38 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: "Ivan T. Ivanov" +X-Patchwork-Id: 1877651 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 + header.s=susede2_rsa header.b=v2vbP3rz; + dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=DCEhbGvW; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.a=rsa-sha256 header.s=susede2_rsa header.b=v2vbP3rz; + dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=DCEhbGvW; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4SvC4X1dxWz1ydc + for ; Tue, 19 Dec 2023 08:04:28 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 516EE875B6; + Mon, 18 Dec 2023 22:03:58 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +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=suse.de header.i=@suse.de header.b="v2vbP3rz"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="DCEhbGvW"; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.b="v2vbP3rz"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="DCEhbGvW"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id B3A6E87578; Mon, 18 Dec 2023 22:03:55 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) + (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 AF6918758C + for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de +Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org + [10.150.64.97]) + (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 smtp-out1.suse.de (Postfix) with ESMTPS id 601C222298; + Mon, 18 Dec 2023 21:03:51 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933431; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; + b=v2vbP3rzM/o63ofFdDaxhtUv68QFa8UxlaWLBU0PN+7PKXtZUGyrKBSmhVzxTM42FyEF7w + 9fus9/ORTaMw41AMi4qeWNQkin7gz4BF2qAFQuYSksnSgsT4Jul8n1YBBmIDx1keXZtfAW + uJZcfMM7pykF11NRMTvI38ZkyYm3ueQ= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933431; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; + b=DCEhbGvWPmgWKvfaoSUDgZ/cuuHGUnp9FvtlFeMSL2WTlsc5F+jQrl+8kVn2Yr5wDXUi8w + yyGhdRc4ihbp3tAg== +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933431; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; + b=v2vbP3rzM/o63ofFdDaxhtUv68QFa8UxlaWLBU0PN+7PKXtZUGyrKBSmhVzxTM42FyEF7w + 9fus9/ORTaMw41AMi4qeWNQkin7gz4BF2qAFQuYSksnSgsT4Jul8n1YBBmIDx1keXZtfAW + uJZcfMM7pykF11NRMTvI38ZkyYm3ueQ= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933431; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; + b=DCEhbGvWPmgWKvfaoSUDgZ/cuuHGUnp9FvtlFeMSL2WTlsc5F+jQrl+8kVn2Yr5wDXUi8w + yyGhdRc4ihbp3tAg== +Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) + (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C77BF133E5; + Mon, 18 Dec 2023 21:03:50 +0000 (UTC) +Received: from dovecot-director2.suse.de ([10.150.64.162]) + by imap1.dmz-prg2.suse.org with ESMTPSA id cKI3LrazgGUtZAAAD6G6ig + (envelope-from ); Mon, 18 Dec 2023 21:03:50 +0000 +From: "Ivan T. Ivanov" +To: Matthias Brugger , + Peter Robinson +Cc: Dmitry Malkin , + Thomas Fitzsimmons , Peng Fan , + Jaehoon Chung , Anatolij Gustschin , + wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, + "Ivan T. Ivanov" +Subject: [PATCH v3 4/7] bcm2835: brcm, + bcm2708-fb device is using r5g6b5 format +Date: Mon, 18 Dec 2023 23:03:38 +0200 +Message-ID: <20231218210341.30073-5-iivanov@suse.de> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> +References: <20231218210341.30073-1-iivanov@suse.de> +MIME-Version: 1.0 +X-Spamd-Result: default: False [4.90 / 50.00]; ARC_NA(0.00)[]; + RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; + TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; + R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; + TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; + R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; + RCVD_COUNT_THREE(0.00)[3]; + DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; + DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; + FREEMAIL_TO(0.00)[suse.com,gmail.com]; + FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; + MIME_TRACE(0.00)[0:+]; + FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; + RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[34.66%] +Authentication-Results: smtp-out1.suse.de; + none +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 + +brcm,bcm2708-fb device provided by firmware on RPi5 uses +16 bits per pixel. Update driver to properly handle this. + +Signed-off-by: Ivan T. Ivanov +--- + drivers/video/bcm2835.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c +index 14942526f1..245c958b6e 100644 +--- a/drivers/video/bcm2835.c ++++ b/drivers/video/bcm2835.c +@@ -43,7 +43,7 @@ static int bcm2835_video_probe(struct udevice *dev) + + uc_priv->xsize = w; + uc_priv->ysize = h; +- uc_priv->bpix = VIDEO_BPP32; ++ uc_priv->bpix = dev_get_driver_data(dev); + plat->base = fb_base; + plat->size = fb_size; + +@@ -51,11 +51,11 @@ static int bcm2835_video_probe(struct udevice *dev) + } + + static const struct udevice_id bcm2835_video_ids[] = { +- { .compatible = "brcm,bcm2835-hdmi" }, +- { .compatible = "brcm,bcm2711-hdmi0" }, +- { .compatible = "brcm,bcm2708-fb" }, ++ { .compatible = "brcm,bcm2835-hdmi", .data = VIDEO_BPP32}, ++ { .compatible = "brcm,bcm2711-hdmi0", .data = VIDEO_BPP32}, ++ { .compatible = "brcm,bcm2708-fb", .data = VIDEO_BPP16 }, + #if !IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) +- { .compatible = "simple-framebuffer" }, ++ { .compatible = "simple-framebuffer", .data = VIDEO_BPP32}, + #endif + { } + }; + +From patchwork Mon Dec 18 21:03:39 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: "Ivan T. Ivanov" +X-Patchwork-Id: 1877653 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 + header.s=susede2_rsa header.b=NbGv/QjH; + dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=mv0vjv7/; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.a=rsa-sha256 header.s=susede2_rsa header.b=NbGv/QjH; + dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=mv0vjv7/; + 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 4SvC4s5T6Bz1ydc + for ; Tue, 19 Dec 2023 08:04:45 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 3B87487227; + Mon, 18 Dec 2023 22:04:02 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +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=suse.de header.i=@suse.de header.b="NbGv/QjH"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="mv0vjv7/"; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.b="NbGv/QjH"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="mv0vjv7/"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id AC0FC874F3; Mon, 18 Dec 2023 22:03:57 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from smtp-out1.suse.de (smtp-out1.suse.de + [IPv6:2a07:de40:b251:101:10:150:64:1]) + (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 8349D875DB + for ; Mon, 18 Dec 2023 22:03:52 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de +Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org + [10.150.64.97]) + (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 smtp-out1.suse.de (Postfix) with ESMTPS id 07C81222A0; + Mon, 18 Dec 2023 21:03:52 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933432; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; + b=NbGv/QjHBl2RkJvR6nKp9uvf3bewa/Jp5ykWs/ULuKNb1e1kp0q0TCiM3d88QGrhaOkktM + ARQoLZXxNSqS1EXqsPA7VQyuJpg3iM74I+GTJfNdlIDDYeA4JLrY6MexUOxdVl1EgxjaPf + 8qkaGm9uEwoD2sactKTn0rgBg5C7Ej0= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933432; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; + b=mv0vjv7/43Gm9IJuOWZT6NQDNDmZdNrBoTyjx7Yu5AAnyTgKtyFYldUlt18PDNHm701rhG + AxUSg7hqv1qJTiDg== +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933432; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; + b=NbGv/QjHBl2RkJvR6nKp9uvf3bewa/Jp5ykWs/ULuKNb1e1kp0q0TCiM3d88QGrhaOkktM + ARQoLZXxNSqS1EXqsPA7VQyuJpg3iM74I+GTJfNdlIDDYeA4JLrY6MexUOxdVl1EgxjaPf + 8qkaGm9uEwoD2sactKTn0rgBg5C7Ej0= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933432; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; + b=mv0vjv7/43Gm9IJuOWZT6NQDNDmZdNrBoTyjx7Yu5AAnyTgKtyFYldUlt18PDNHm701rhG + AxUSg7hqv1qJTiDg== +Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) + (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6FAB513C92; + Mon, 18 Dec 2023 21:03:51 +0000 (UTC) +Received: from dovecot-director2.suse.de ([10.150.64.162]) + by imap1.dmz-prg2.suse.org with ESMTPSA id YHTRGLezgGUtZAAAD6G6ig + (envelope-from ); Mon, 18 Dec 2023 21:03:51 +0000 +From: "Ivan T. Ivanov" +To: Matthias Brugger , + Peter Robinson +Cc: Dmitry Malkin , + Thomas Fitzsimmons , Peng Fan , + Jaehoon Chung , Anatolij Gustschin , + wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, + "Ivan T. Ivanov" +Subject: [PATCH v3 5/7] mmc: bcmstb: Add support for bcm2712 SD controller +Date: Mon, 18 Dec 2023 23:03:39 +0200 +Message-ID: <20231218210341.30073-6-iivanov@suse.de> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> +References: <20231218210341.30073-1-iivanov@suse.de> +MIME-Version: 1.0 +X-Spamd-Result: default: False [1.90 / 50.00]; ARC_NA(0.00)[]; + RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; + TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; + R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; + TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; + R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; + RCVD_COUNT_THREE(0.00)[3]; + DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; + DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; + FREEMAIL_TO(0.00)[suse.com,gmail.com]; + FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; + MIME_TRACE(0.00)[0:+]; + FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; + RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] +Authentication-Results: smtp-out1.suse.de; + none +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 + +Borrow SD quirks from vendor Linux driver. + +"BCM2712 unfortunately carries with it a perennial bug with the SD +controller register interface present on previous chips (2711/2709/2708). +Accesses must be dword-sized and a read-modify-write cycle to the 32-bit +registers containing the COMMAND, TRANSFER_MODE, BLOCK_SIZE and +BLOCK_COUNT registers tramples the upper/lower 16 bits of data written. +BCM2712 does not seem to need the extreme delay between each write as on +previous chips, just the serialisation of writes to these registers in a +single 32-bit operation." + +Signed-off-by: Ivan T. Ivanov +--- + drivers/mmc/bcmstb_sdhci.c | 173 ++++++++++++++++++++++++++++++++++++- + 1 file changed, 172 insertions(+), 1 deletion(-) + +diff --git a/drivers/mmc/bcmstb_sdhci.c b/drivers/mmc/bcmstb_sdhci.c +index dc96818cff..21489e66c0 100644 +--- a/drivers/mmc/bcmstb_sdhci.c ++++ b/drivers/mmc/bcmstb_sdhci.c +@@ -38,6 +38,16 @@ + */ + #define BCMSTB_SDHCI_MINIMUM_CLOCK_FREQUENCY 400000 + ++#define SDIO_CFG_CTRL 0x0 ++#define SDIO_CFG_CTRL_SDCD_N_TEST_EN BIT(31) ++#define SDIO_CFG_CTRL_SDCD_N_TEST_LEV BIT(30) ++ ++#define SDIO_CFG_SD_PIN_SEL 0x44 ++#define SDIO_CFG_SD_PIN_SEL_MASK 0x3 ++#define SDIO_CFG_SD_PIN_SEL_CARD BIT(1) ++ ++#define REG_OFFSET_IN_BITS(reg) ((reg) << 3 & 0x18) ++ + /* + * This driver has only been tested with eMMC devices; SD devices may + * not work. +@@ -47,6 +57,53 @@ struct sdhci_bcmstb_plat { + struct mmc mmc; + }; + ++struct sdhci_bcmstb_host { ++ struct sdhci_host host; ++ u32 shadow_cmd; ++ u32 shadow_blk; ++ bool is_cmd_shadowed; ++ bool is_blk_shadowed; ++}; ++ ++struct sdhci_brcmstb_dev_priv { ++ int (*init)(struct udevice *dev); ++ struct sdhci_ops *ops; ++}; ++ ++static inline struct sdhci_bcmstb_host *to_bcmstb_host(struct sdhci_host *host) ++{ ++ return container_of(host, struct sdhci_bcmstb_host, host); ++} ++ ++static int sdhci_brcmstb_init_2712(struct udevice *dev) ++{ ++ struct sdhci_host *host = dev_get_priv(dev); ++ void *cfg_regs; ++ u32 reg; ++ ++ /* Map in the non-standard CFG registers */ ++ cfg_regs = dev_remap_addr_name(dev, "cfg"); ++ if (!cfg_regs) ++ return -ENOENT; ++ ++ if ((host->mmc->host_caps & MMC_CAP_NONREMOVABLE) || ++ (host->mmc->host_caps & MMC_CAP_NEEDS_POLL)) { ++ /* Force presence */ ++ reg = readl(cfg_regs + SDIO_CFG_CTRL); ++ reg &= ~SDIO_CFG_CTRL_SDCD_N_TEST_LEV; ++ reg |= SDIO_CFG_CTRL_SDCD_N_TEST_EN; ++ writel(reg, cfg_regs + SDIO_CFG_CTRL); ++ } else { ++ /* Enable card detection line */ ++ reg = readl(cfg_regs + SDIO_CFG_SD_PIN_SEL); ++ reg &= ~SDIO_CFG_SD_PIN_SEL_MASK; ++ reg |= SDIO_CFG_SD_PIN_SEL_CARD; ++ writel(reg, cfg_regs + SDIO_CFG_SD_PIN_SEL); ++ } ++ ++ return 0; ++} ++ + static int sdhci_bcmstb_bind(struct udevice *dev) + { + struct sdhci_bcmstb_plat *plat = dev_get_plat(dev); +@@ -58,10 +115,14 @@ static int sdhci_bcmstb_probe(struct udevice *dev) + { + struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); + struct sdhci_bcmstb_plat *plat = dev_get_plat(dev); +- struct sdhci_host *host = dev_get_priv(dev); ++ struct sdhci_bcmstb_host *bcmstb = dev_get_priv(dev); ++ struct sdhci_host *host = &bcmstb->host; ++ struct sdhci_brcmstb_dev_priv *dev_priv; + fdt_addr_t base; + int ret; + ++ dev_priv = (struct sdhci_brcmstb_dev_priv *)dev_get_driver_data(dev); ++ + base = dev_read_addr(dev); + if (base == FDT_ADDR_T_NONE) + return -EINVAL; +@@ -75,6 +136,10 @@ static int sdhci_bcmstb_probe(struct udevice *dev) + + host->mmc = &plat->mmc; + host->mmc->dev = dev; ++ ++ if (dev_priv && dev_priv->ops) ++ host->ops = dev_priv->ops; ++ + ret = sdhci_setup_cfg(&plat->cfg, host, + BCMSTB_SDHCI_MAXIMUM_CLOCK_FREQUENCY, + BCMSTB_SDHCI_MINIMUM_CLOCK_FREQUENCY); +@@ -84,10 +149,116 @@ static int sdhci_bcmstb_probe(struct udevice *dev) + upriv->mmc = &plat->mmc; + host->mmc->priv = host; + ++ if (dev_priv && dev_priv->init) { ++ ret = dev_priv->init(dev); ++ if (ret) ++ return ret; ++ } ++ + return sdhci_probe(dev); + } + ++static u16 sdhci_brcmstb_32bits_readw(struct sdhci_host *host, int reg) ++{ ++ struct sdhci_bcmstb_host *bcmstb = to_bcmstb_host(host); ++ u16 word; ++ u32 val; ++ ++ if (reg == SDHCI_TRANSFER_MODE && bcmstb->is_cmd_shadowed) { ++ /* Get the saved transfer mode */ ++ val = bcmstb->shadow_cmd; ++ } else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) && ++ bcmstb->is_blk_shadowed) { ++ /* Get the saved block info */ ++ val = bcmstb->shadow_blk; ++ } else { ++ val = readl(host->ioaddr + (reg & ~3)); ++ } ++ ++ word = val >> REG_OFFSET_IN_BITS(reg) & 0xffff; ++ return word; ++} ++ ++static u8 sdhci_brcmstb_32bits_readb(struct sdhci_host *host, int reg) ++{ ++ u32 val = readl(host->ioaddr + (reg & ~3)); ++ u8 byte = val >> REG_OFFSET_IN_BITS(reg) & 0xff; ++ return byte; ++} ++ ++/* ++ * BCM2712 unfortunately carries with it a perennial bug with the SD ++ * controller register interface present on previous chips (2711/2709/2708). ++ * Accesses must be dword-sized and a read-modify-write cycle to the ++ * 32-bit registers containing the COMMAND, TRANSFER_MODE, BLOCK_SIZE and ++ * BLOCK_COUNT registers tramples the upper/lower 16 bits of data written. ++ * BCM2712 does not seem to need the extreme delay between each write as ++ * on previous chips, just the serialisation of writes to these registers ++ * in a single 32-bit operation. ++ */ ++static void sdhci_brcmstb_32bits_writew(struct sdhci_host *host, u16 val, int reg) ++{ ++ struct sdhci_bcmstb_host *bcmstb = to_bcmstb_host(host); ++ u32 word_shift = REG_OFFSET_IN_BITS(reg); ++ u32 mask = 0xffff << word_shift; ++ u32 oldval, newval; ++ ++ if (reg == SDHCI_COMMAND) { ++ /* Write the block now as we are issuing a command */ ++ if (bcmstb->is_blk_shadowed) { ++ writel(bcmstb->shadow_blk, host->ioaddr + SDHCI_BLOCK_SIZE); ++ bcmstb->is_blk_shadowed = false; ++ } ++ oldval = bcmstb->shadow_cmd; ++ bcmstb->is_cmd_shadowed = false; ++ } else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) && ++ bcmstb->is_blk_shadowed) { ++ /* Block size and count are stored in shadow reg */ ++ oldval = bcmstb->shadow_blk; ++ } else { ++ /* Read reg, all other registers are not shadowed */ ++ oldval = readl(host->ioaddr + (reg & ~3)); ++ } ++ newval = (oldval & ~mask) | (val << word_shift); ++ ++ if (reg == SDHCI_TRANSFER_MODE) { ++ /* Save the transfer mode until the command is issued */ ++ bcmstb->shadow_cmd = newval; ++ bcmstb->is_cmd_shadowed = true; ++ } else if (reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) { ++ /* Save the block info until the command is issued */ ++ bcmstb->shadow_blk = newval; ++ bcmstb->is_blk_shadowed = true; ++ } else { ++ /* Command or other regular 32-bit write */ ++ writel(newval, host->ioaddr + (reg & ~3)); ++ } ++} ++ ++static void sdhci_brcmstb_32bits_writeb(struct sdhci_host *host, u8 val, int reg) ++{ ++ u32 oldval = readl(host->ioaddr + (reg & ~3)); ++ u32 byte_shift = REG_OFFSET_IN_BITS(reg); ++ u32 mask = 0xff << byte_shift; ++ u32 newval = (oldval & ~mask) | (val << byte_shift); ++ ++ writel(newval, host->ioaddr + (reg & ~3)); ++} ++ ++static struct sdhci_ops sdhci_brcmstb_ops_2712 = { ++ .read_b = sdhci_brcmstb_32bits_readb, ++ .read_w = sdhci_brcmstb_32bits_readw, ++ .write_w = sdhci_brcmstb_32bits_writew, ++ .write_b = sdhci_brcmstb_32bits_writeb, ++}; ++ ++static const struct sdhci_brcmstb_dev_priv match_priv_2712 = { ++ .init = sdhci_brcmstb_init_2712, ++ .ops = &sdhci_brcmstb_ops_2712, ++}; ++ + static const struct udevice_id sdhci_bcmstb_match[] = { ++ { .compatible = "brcm,bcm2712-sdhci", .data = (ulong)&match_priv_2712 }, + { .compatible = "brcm,bcm7425-sdhci" }, + { .compatible = "brcm,sdhci-brcmstb" }, + { } + +From patchwork Mon Dec 18 21:03:40 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: "Ivan T. Ivanov" +X-Patchwork-Id: 1877654 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 + header.s=susede2_rsa header.b=f/19Tx1x; + dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=e0CvACbS; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.a=rsa-sha256 header.s=susede2_rsa header.b=f/19Tx1x; + dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=e0CvACbS; + 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 4SvC5339Phz1ydc + for ; Tue, 19 Dec 2023 08:04:55 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id AEFAE87561; + Mon, 18 Dec 2023 22:04:02 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +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=suse.de header.i=@suse.de header.b="f/19Tx1x"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="e0CvACbS"; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.b="f/19Tx1x"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="e0CvACbS"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id E31C887661; Mon, 18 Dec 2023 22:03:58 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from smtp-out1.suse.de (smtp-out1.suse.de + [IPv6:2a07:de40:b251:101:10:150:64:1]) + (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 23C28875FE + for ; Mon, 18 Dec 2023 22:03:53 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de +Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org + [IPv6:2a07:de40:b281:104:10:150:64:97]) + (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 smtp-out1.suse.de (Postfix) with ESMTPS id AA225222AF; + Mon, 18 Dec 2023 21:03:52 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933432; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; + b=f/19Tx1x7UFtAUz8rSw0xZAG55X0OP1hiHqEuhAMQ+G/qEfSEkg6v1FGZhP70gpNWDQQgk + sr6WvGWKDP0t+jOsv0jDi9ZDrTiDB2ge+exjUPFNEvQP3H5zrjgKVOaqBaoOeLHXs/ay0l + qSAackxgs89eelJL1qSI3XwtAjq2zlQ= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933432; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; + b=e0CvACbSltQnSYuEyv3yxtn0hfVqkwt0KNf0fBLAfLwxlC3hb9ebDGcHvra3iPCHYB22X9 + ButpL853ceVzwdDA== +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933432; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; + b=f/19Tx1x7UFtAUz8rSw0xZAG55X0OP1hiHqEuhAMQ+G/qEfSEkg6v1FGZhP70gpNWDQQgk + sr6WvGWKDP0t+jOsv0jDi9ZDrTiDB2ge+exjUPFNEvQP3H5zrjgKVOaqBaoOeLHXs/ay0l + qSAackxgs89eelJL1qSI3XwtAjq2zlQ= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933432; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; + b=e0CvACbSltQnSYuEyv3yxtn0hfVqkwt0KNf0fBLAfLwxlC3hb9ebDGcHvra3iPCHYB22X9 + ButpL853ceVzwdDA== +Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) + (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 15B1C133E5; + Mon, 18 Dec 2023 21:03:52 +0000 (UTC) +Received: from dovecot-director2.suse.de ([10.150.64.162]) + by imap1.dmz-prg2.suse.org with ESMTPSA id 8OvVArizgGUtZAAAD6G6ig + (envelope-from ); Mon, 18 Dec 2023 21:03:52 +0000 +From: "Ivan T. Ivanov" +To: Matthias Brugger , + Peter Robinson +Cc: Dmitry Malkin , + Thomas Fitzsimmons , Peng Fan , + Jaehoon Chung , Anatolij Gustschin , + wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, + "Ivan T. Ivanov" +Subject: [PATCH v3 6/7] configs: rpi_arm64: enable SDHCI BCMSTB driver +Date: Mon, 18 Dec 2023 23:03:40 +0200 +Message-ID: <20231218210341.30073-7-iivanov@suse.de> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> +References: <20231218210341.30073-1-iivanov@suse.de> +MIME-Version: 1.0 +Authentication-Results: smtp-out1.suse.de; + dkim=pass header.d=suse.de header.s=susede2_rsa header.b="f/19Tx1x"; + dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=e0CvACbS +X-Rspamd-Server: rspamd2.dmz-prg2.suse.org +X-Spamd-Result: default: False [-1.62 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; + RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; + SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; + TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; + BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; + DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; + RCPT_COUNT_SEVEN(0.00)[11]; NEURAL_HAM_SHORT(-0.20)[-1.000]; + FREEMAIL_TO(0.00)[suse.com,gmail.com]; FROM_EQ_ENVFROM(0.00)[]; + MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.11)[66.45%]; + ARC_NA(0.00)[]; + R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; FROM_HAS_DN(0.00)[]; + FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; + TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; + DWL_DNSWL_HI(-3.50)[suse.de:dkim]; + NEURAL_HAM_LONG(-1.00)[-1.000]; + DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + MID_CONTAINS_FROM(1.00)[]; + DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; + FUZZY_BLOCKED(0.00)[rspamd.com]; + FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; + RCVD_TLS_ALL(0.00)[]; + RCVD_IN_DNSWL_HI(-0.50)[2a07:de40:b281:104:10:150:64:97:from] +X-Rspamd-Queue-Id: AA225222AF +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 + +RPi5 have "brcm,bcm2712-sdhci" controller which is +handled by "sdhci-bcmstb" driver, so enable it. + +Signed-off-by: Ivan T. Ivanov +--- + configs/rpi_arm64_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig +index f9dade18f6..1107fd11de 100644 +--- a/configs/rpi_arm64_defconfig ++++ b/configs/rpi_arm64_defconfig +@@ -33,6 +33,7 @@ CONFIG_BCM2835_GPIO=y + CONFIG_MMC_SDHCI=y + CONFIG_MMC_SDHCI_SDMA=y + CONFIG_MMC_SDHCI_BCM2835=y ++CONFIG_MMC_SDHCI_BCMSTB=y + CONFIG_BCMGENET=y + CONFIG_PCI_BRCMSTB=y + CONFIG_PINCTRL=y + +From patchwork Mon Dec 18 21:03:41 2023 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: "Ivan T. Ivanov" +X-Patchwork-Id: 1877655 +X-Patchwork-Delegate: pbrobinson@gmail.com +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +Authentication-Results: legolas.ozlabs.org; + dkim=pass (1024-bit key; + unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 + header.s=susede2_rsa header.b=1by1WnE8; + dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=e64lBvSE; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.a=rsa-sha256 header.s=susede2_rsa header.b=1by1WnE8; + dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 + header.s=susede2_ed25519 header.b=e64lBvSE; + 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 4SvC5H05zfz1ydc + for ; Tue, 19 Dec 2023 08:05:07 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 2FBDE87650; + Mon, 18 Dec 2023 22:04:03 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +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=suse.de header.i=@suse.de header.b="1by1WnE8"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="e64lBvSE"; + dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de + header.b="1by1WnE8"; + dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de + header.b="e64lBvSE"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 5D01C876A4; Mon, 18 Dec 2023 22:03:59 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from smtp-out2.suse.de (smtp-out2.suse.de + [IPv6:2a07:de40:b251:101:10:150:64:2]) + (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 C279687509 + for ; Mon, 18 Dec 2023 22:03:53 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=suse.de +Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de +Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org + [IPv6:2a07:de40:b281:104:10:150:64:97]) + (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 smtp-out2.suse.de (Postfix) with ESMTPS id 5507C1F6E6; + Mon, 18 Dec 2023 21:03:53 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933433; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; + b=1by1WnE818KeyiiUhS0PLD7P0c+SSwVEcIdSwLVDSj6t8vZK9vpPNROZRCB9WlZtgGyGUU + JlRP9h5PowjYnh5OWRH6KbjZ19MG+Fu3rWcMQ+gET5ljKGaRAtFv2t0gDAtmZGheOkf5pW + KEDUZYxYceI7JKlWcX6QlIjexymId9w= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933433; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; + b=e64lBvSEDRhrUCpOd2eVMasuXC6PFNm5B1yOGeNNS+E2HREmMMam1YM4RObadB2tdux/T3 + Galw853x9Gm0wpDA== +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_rsa; + t=1702933433; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; + b=1by1WnE818KeyiiUhS0PLD7P0c+SSwVEcIdSwLVDSj6t8vZK9vpPNROZRCB9WlZtgGyGUU + JlRP9h5PowjYnh5OWRH6KbjZ19MG+Fu3rWcMQ+gET5ljKGaRAtFv2t0gDAtmZGheOkf5pW + KEDUZYxYceI7JKlWcX6QlIjexymId9w= +DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; + s=susede2_ed25519; t=1702933433; + h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: + mime-version:mime-version: + content-transfer-encoding:content-transfer-encoding: + in-reply-to:in-reply-to:references:references; + bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; + b=e64lBvSEDRhrUCpOd2eVMasuXC6PFNm5B1yOGeNNS+E2HREmMMam1YM4RObadB2tdux/T3 + Galw853x9Gm0wpDA== +Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) + (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BB17413C92; + Mon, 18 Dec 2023 21:03:52 +0000 (UTC) +Received: from dovecot-director2.suse.de ([10.150.64.162]) + by imap1.dmz-prg2.suse.org with ESMTPSA id 0JQfK7izgGUtZAAAD6G6ig + (envelope-from ); Mon, 18 Dec 2023 21:03:52 +0000 +From: "Ivan T. Ivanov" +To: Matthias Brugger , + Peter Robinson +Cc: Dmitry Malkin , + Thomas Fitzsimmons , Peng Fan , + Jaehoon Chung , Anatolij Gustschin , + wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, + "Ivan T. Ivanov" +Subject: [PATCH v3 7/7] pci: pcie-brcmstb: Add bcm2712 PCIe controller support +Date: Mon, 18 Dec 2023 23:03:41 +0200 +Message-ID: <20231218210341.30073-8-iivanov@suse.de> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> +References: <20231218210341.30073-1-iivanov@suse.de> +MIME-Version: 1.0 +X-Rspamd-Server: rspamd1.dmz-prg2.suse.org +X-Spamd-Bar: / +X-Spamd-Result: default: False [-0.31 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; + RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; + TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; + BROKEN_CONTENT_TYPE(1.50)[]; + R_RATELIMIT(0.00)[to_ip_from(RLccgikja4sxqnupiwsfdm9q1r)]; + RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+]; + MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[11]; + FREEMAIL_TO(0.00)[suse.com,gmail.com]; FROM_EQ_ENVFROM(0.00)[]; + MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[27.73%]; + ARC_NA(0.00)[]; + R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; FROM_HAS_DN(0.00)[]; + FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; + TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; + DWL_DNSWL_HI(-3.50)[suse.de:dkim]; + DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; + MID_CONTAINS_FROM(1.00)[]; + DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; + FUZZY_BLOCKED(0.00)[rspamd.com]; + FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; + RCVD_TLS_ALL(0.00)[]; + RCVD_IN_DNSWL_HI(-0.50)[2a07:de40:b281:104:10:150:64:97:from] +Authentication-Results: smtp-out2.suse.de; + dkim=pass header.d=suse.de header.s=susede2_rsa header.b=1by1WnE8; + dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=e64lBvSE +X-Rspamd-Queue-Id: 5507C1F6E6 +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 + +PCIe controller have minor register map difference compared +to bcm2711 variant. Handle this using device specific register +offset. + +Signed-off-by: Ivan T. Ivanov +--- + drivers/pci/pcie_brcmstb.c | 23 +++++++++++++++++++---- + 1 file changed, 19 insertions(+), 4 deletions(-) + +diff --git a/drivers/pci/pcie_brcmstb.c b/drivers/pci/pcie_brcmstb.c +index cd45f0bee9..d63e715b2e 100644 +--- a/drivers/pci/pcie_brcmstb.c ++++ b/drivers/pci/pcie_brcmstb.c +@@ -90,7 +90,6 @@ + #define PCIE_MEM_WIN0_LIMIT_HI(win) \ + PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8) + +-#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 + #define PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000 + + #define PCIE_MSI_INTR2_CLR 0x4508 +@@ -131,6 +130,10 @@ + #define SSC_STATUS_PLL_LOCK_MASK 0x800 + #define SSC_STATUS_PLL_LOCK_SHIFT 11 + ++struct pcie_cfg_data { ++ unsigned long hard_debug_offs; ++}; ++ + /** + * struct brcm_pcie - the PCIe controller state + * @base: Base address of memory mapped IO registers of the controller +@@ -141,6 +144,7 @@ + struct brcm_pcie { + void __iomem *base; + ++ struct pcie_cfg_data *cfg; + int gen; + bool ssc; + }; +@@ -458,7 +462,7 @@ static int brcm_pcie_probe(struct udevice *dev) + /* Take the bridge out of reset */ + clrbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_INIT_MASK); + +- clrbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG, ++ clrbits_le32(base + pcie->cfg->hard_debug_offs, + PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); + + /* Wait for SerDes to be stable */ +@@ -599,7 +603,7 @@ static int brcm_pcie_remove(struct udevice *dev) + setbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_PERST_MASK); + + /* Turn off SerDes */ +- setbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG, ++ setbits_le32(base + pcie->cfg->hard_debug_offs, + PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); + + /* Shutdown bridge */ +@@ -620,6 +624,8 @@ static int brcm_pcie_of_to_plat(struct udevice *dev) + if (!pcie->base) + return -EINVAL; + ++ pcie->cfg = (struct pcie_cfg_data *)dev_get_driver_data(dev); ++ + pcie->ssc = ofnode_read_bool(dn, "brcm,enable-ssc"); + + ret = ofnode_read_u32(dn, "max-link-speed", &max_link_speed); +@@ -636,8 +642,17 @@ static const struct dm_pci_ops brcm_pcie_ops = { + .write_config = brcm_pcie_write_config, + }; + ++static const struct pcie_cfg_data bcm2711_cfg = { ++ .hard_debug_offs = 0x4204 ++}; ++ ++static const struct pcie_cfg_data bcm2712_cfg = { ++ .hard_debug_offs = 0x4304 ++}; ++ + static const struct udevice_id brcm_pcie_ids[] = { +- { .compatible = "brcm,bcm2711-pcie" }, ++ { .compatible = "brcm,bcm2711-pcie", .data = (ulong)&bcm2711_cfg }, ++ { .compatible = "brcm,bcm2712-pcie", .data = (ulong)&bcm2712_cfg }, + { } + }; + diff --git a/sources b/sources index baad200..30e8529 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.01-rc4.tar.bz2) = 02ad9abe2a0c34fb11e75f75b1d76a4dc2df2886ed00f0fbec090cfe87d586becfee7c1edce8e95d26d1e34ead26faf928d17fdc6f8dee158a73f93c0078ae0a +SHA512 (u-boot-2024.01.tar.bz2) = 45bd093ba3bda23e43cdde83d8656c1ee1348ac2886ecff1fee475f101ac4965a5be6565408fa5b990c723f3fdc833edfca60a719f735a43040cd14a1b59a88b diff --git a/uboot-tools.spec b/uboot-tools.spec index b7ab293..8083a3c 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc4 +#global candidate rc0 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.01 -Release: 0.2%{?candidate:.%{candidate}}%{?dist} +Release: 1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -26,9 +26,11 @@ Patch7: Add-video-damage-tracking.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support -Patch10: rpi-Enable-using-the-DT-provided-by-the-Raspberry-Pi.patch +Patch10: rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch # Rockchips improvements Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch +# Lots more to do, mostly untested, definitely unsupported +Patch12: rpi5-initial-support.patch #Patch12: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch BuildRequires: bc @@ -206,6 +208,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Mon Jan 08 2024 Peter Robinson - 1:2024.01-1 +- Update to 2024.01 + * Thu Dec 07 2023 Peter Robinson - 1:2024.01-0.2.rc4 - Update to 2024.01 RC4 - Rebase SMBIOS patch to latest rev diff --git a/uefi-Boot-var-automatic-management-for-removable-medias.patch b/uefi-Boot-var-automatic-management-for-removable-medias.patch index aa8db6c..48ae88e 100644 --- a/uefi-Boot-var-automatic-management-for-removable-medias.patch +++ b/uefi-Boot-var-automatic-management-for-removable-medias.patch @@ -1,17 +1,17 @@ -From patchwork Mon Oct 16 06:45:24 2023 +From patchwork Fri Nov 10 04:25:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Masahisa Kojima -X-Patchwork-Id: 1849182 -X-Patchwork-Delegate: trini@ti.com +X-Patchwork-Id: 1862317 +X-Patchwork-Delegate: apalos@gmail.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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=Ul1XEHOs; + header.s=google header.b=muA1rcXE; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de @@ -20,76 +20,76 @@ Authentication-Results: legolas.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)) + key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4S874K5Xxfz20Pd - for ; Mon, 16 Oct 2023 17:48:49 +1100 (AEDT) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4SRQnL1SNCz1yRF + for ; Fri, 10 Nov 2023 15:28:54 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id CEAE986C65; - Mon, 16 Oct 2023 08:47:35 +0200 (CEST) + by phobos.denx.de (Postfix) with ESMTP id 4C150877A0; + Fri, 10 Nov 2023 05:27:39 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="Ul1XEHOs"; + unprotected) header.d=linaro.org header.i=@linaro.org header.b="muA1rcXE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) - id 8D53786DB3; Mon, 16 Oct 2023 08:47:30 +0200 (CEST) + id 9DA4487796; Fri, 10 Nov 2023 05:27:28 +0100 (CET) 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,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 mail-pf1-x42e.google.com (mail-pf1-x42e.google.com - [IPv6:2607:f8b0:4864:20::42e]) + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com + [IPv6:2607:f8b0:4864:20::f30]) (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 CDE3A86E17 - for ; Mon, 16 Oct 2023 08:47:09 +0200 (CEST) + by phobos.denx.de (Postfix) with ESMTPS id E1AE487795 + for ; Fri, 10 Nov 2023 05:27:22 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org -Received: by mail-pf1-x42e.google.com with SMTP id - d2e1a72fcca58-6b9af7d41d2so1095255b3a.0 - for ; Sun, 15 Oct 2023 23:47:09 -0700 (PDT) +Received: by mail-qv1-xf30.google.com with SMTP id + 6a1803df08f44-66d09b6d007so10800236d6.1 + for ; Thu, 09 Nov 2023 20:27:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1697438827; x=1698043627; darn=lists.denx.de; + d=linaro.org; s=google; t=1699590441; x=1700195241; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; - bh=a4zZ4HlSkK/oY3qfyV9r1nYVhNuROFuLhRstgf1Rv2c=; - b=Ul1XEHOsGM4s5ZXhl8izVuRgdzwBvimAZkXuoqhECUyzZ5Ez0xE4L1Hg3jaebkJtT4 - Obo7iWdiOztGGXAQsCc6aArrMkn5aWaxldZj3Pk7wiMXDQQwkaTGjRCvrTsNYEXGqaYa - lgGsDUHQY9XV9evUyGDM53AoPvEQpMUn6Ise6OpLox6UUZP1F50ibABAcCqCaWEz+1nq - 4lVN8G9iVN+cmBLHgyABIM/ySQviS1kOYG+YTltUb5HvVaMxir4vqsa4+x6vd/tTxXMk - 56wvCrB5HMNqfSgdipSasXwMLCFgHXkBq93i2kbuzMIQ7Ysvv3C8BVI0G+1f6oLwENLk - e/CQ== + bh=TMp02tF2/jn50c0fdB6OUXNmWJ9Af2C5T6zhn2D5BPI=; + b=muA1rcXEW1UV0ytByrk/oz/vuO7kL/M5Szuv8+JLohfHHFY3sZW5v5q4Tn1coMbMKW + 6+JvY0qla9DiPjvWA90QSopUCqBoggSNPTIlTn4YSs0zA/+Aa9ufsx25M+rq4pdYGAZq + ujAG9mRgWMuq7W+eZZWfQo6eFqEo14D6RbQL5NFW/G0Wkle6TwLwu7dp19DOw7hH/jPq + sq9/5/DA4FEI+4sRDsPBAQ48VTq05vuMv2PMU0t4d7SXPVCEk1lW+JFZB4wooN2XotQ+ + ni+S40bdTeGBscZ+sajQQgtDd49nxGSB518samtlg5SGdhDB9WKak39uPeWU4WFYc01J + R7BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1697438827; x=1698043627; + d=1e100.net; s=20230601; t=1699590441; x=1700195241; 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=a4zZ4HlSkK/oY3qfyV9r1nYVhNuROFuLhRstgf1Rv2c=; - b=OcOEUqe358XOG7Zc6Hy+FF1rfaLYWmEF0A8OizdzAhGDLivYKjNd4BoOEHO4KvOACh - FZMZ1CB92hAiYJu1Ndf90dBBML5rNhQNU2W7UeXtS71umYvHozHLjFpF1yhECni/jQQU - 4oOX+5SMFsICbIbh7s4rTv7wQiw9WfipvTiPbJAhIlFiWT90CFt3hyN8/9KlKbl0Sclz - gllfdag+B/kpFHp53cH9u/zyihobAX9mjV7UWzK5LavAIv6z62RlsRMaICfqqhzWdiCQ - HVNQr2zZEmvsRXg8I0bE1n51DSkTLQ3tXeACm5nhLyxgtyqWwailoFeacOUsF7GMlCcD - qEbw== -X-Gm-Message-State: AOJu0YzjJEUEStoUb3N4IXyZxHifoMSiHxGU6B4mx7PQowC7gzvn1TnE - xTthn5FBg1s44Z9M4SsWxKIzkdvcmlpYkXlx7zA= + bh=TMp02tF2/jn50c0fdB6OUXNmWJ9Af2C5T6zhn2D5BPI=; + b=o5TY9c0iL/aKbWJtamq+fAKn5twYwIcXo5Z8lxIo1/WL8jhCu3973LiJ6l2rbP6I26 + wEUpA97eZRYjRnp6Pfb9nJ5+Ip11akGFqY+UNFjwNues+jYvCmrhtbzt3RIwwRMopasI + IvpvSU+Vk0opNS2b96ZRak7X34ZoUNZVcjTBCSqx3UgQcaMOxrP5u7LholG/3rTttkkF + gdIAWrm7wPUrREhnt8opfpTWbusAkgJ1lAa0uqcfb4TRE7fKsiX3du3TwgJNsvACBXxW + W4w5nDy5AXlY05IOsmMvxjIudLF0aDB3y/aUT1K7/NyAO77e5CPoGEIRF4JnpngLM7yx + RcEw== +X-Gm-Message-State: AOJu0YwKFnJ+XRzaRWdr9TK+didg99ZRC2gUKVvYvCLFFGqfG4yFbCXC + IsubnJ6RTNtZqmONUFojqVLmrQYm513MFxxhCLg= X-Google-Smtp-Source: - AGHT+IHbD6oyEamNHq3LhzVqk9GmlOVQEB1PUP0LTuRVh232jV1wx8mVR7sYKvotrVqHEVfJnRLFMA== -X-Received: by 2002:a05:6a00:1511:b0:690:4362:7011 with SMTP id - q17-20020a056a00151100b0069043627011mr35009133pfu.24.1697438827170; - Sun, 15 Oct 2023 23:47:07 -0700 (PDT) + AGHT+IE/39rKwHRMrxLkfDXIlyOXct/rRbXebKb2Lc3eaLeJaCt4Vmnxn7CrXnlXXLzUgocEmJUKcA== +X-Received: by 2002:a05:6214:d44:b0:675:667d:a1b6 with SMTP id + 4-20020a0562140d4400b00675667da1b6mr7212832qvr.0.1699590440388; + Thu, 09 Nov 2023 20:27:20 -0800 (PST) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id - fa13-20020a056a002d0d00b006b1c14a493fsm5242447pfb.71.2023.10.15.23.47.06 + n18-20020a170902e55200b001c0bf60ba5csm4304818plf.272.2023.11.09.20.27.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Sun, 15 Oct 2023 23:47:06 -0700 (PDT) + Thu, 09 Nov 2023 20:27:19 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , @@ -99,14 +99,15 @@ Cc: Heinrich Schuchardt , Michal Simek , Raymond Mao , Masahisa Kojima , Joao Marcos Costa , + Huang Jianan , Thomas Petazzoni , - Miquel Raynal -Subject: [PATCH v7 7/9] Boot var automatic management for removable medias -Date: Mon, 16 Oct 2023 15:45:24 +0900 -Message-Id: <20231016064526.2410856-8-masahisa.kojima@linaro.org> + Miquel Raynal , linux-erofs@lists.ozlabs.org +Subject: [PATCH v12 4/9] efi_loader: Boot var automatic management +Date: Fri, 10 Nov 2023 13:25:37 +0900 +Message-Id: <20231110042542.3797301-5-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 -In-Reply-To: <20231016064526.2410856-1-masahisa.kojima@linaro.org> -References: <20231016064526.2410856-1-masahisa.kojima@linaro.org> +In-Reply-To: <20231110042542.3797301-1-masahisa.kojima@linaro.org> +References: <20231110042542.3797301-1-masahisa.kojima@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 @@ -148,15 +149,14 @@ efi_secboot tests end up with unexpected failure. The efi_secboot tests need to be modified to explicitly set the BootOrder EFI variable. -squashfs ls test is also affected by this modification, need to -clear the previous state before squashfs ls test starts. +squashfs and erofs ls tests are also affected by this modification, +need to clear the previous state before squashfs ls test starts. Co-developed-by: Masahisa Kojima Signed-off-by: Masahisa Kojima Signed-off-by: Raymond Mao Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas -Signed-off-by: Joao Marcos Costa Reviewed-by: Joao Marcos Costa --- lib/efi_loader/efi_disk.c | 18 ++++++++ @@ -164,8 +164,9 @@ Reviewed-by: Joao Marcos Costa test/py/tests/test_efi_secboot/test_signed.py | 42 +++++++++---------- .../test_efi_secboot/test_signed_intca.py | 14 +++---- .../tests/test_efi_secboot/test_unsigned.py | 14 +++---- - .../test_fs/test_squashfs/test_sqfs_ls.py | 6 +++ - 6 files changed, 66 insertions(+), 35 deletions(-) + test/py/tests/test_fs/test_erofs.py | 9 ++++ + .../test_fs/test_squashfs/test_sqfs_ls.py | 9 ++++ + 7 files changed, 78 insertions(+), 35 deletions(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index f0d76113b0..b808a7fe62 100644 @@ -204,7 +205,7 @@ index f0d76113b0..b808a7fe62 100644 /** diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c -index e6de685e87..37359a77bb 100644 +index ad719afd63..c02569cb6d 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -245,6 +245,13 @@ efi_status_t efi_init_obj_list(void) @@ -531,18 +532,41 @@ index df63f0df08..7c078f220d 100644 'efidebug test bootmgr']) assert 'efi_start_image() returned: 26' in ''.join(output) assert 'Hello, world!' not in ''.join(output) -diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py -index 527a556ed8..3b8118104f 100644 ---- a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py -+++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py -@@ -118,6 +118,12 @@ def test_sqfs_ls(u_boot_console): +diff --git a/test/py/tests/test_fs/test_erofs.py b/test/py/tests/test_fs/test_erofs.py +index 458a52ba79..87ad8f2d5f 100644 +--- a/test/py/tests/test_fs/test_erofs.py ++++ b/test/py/tests/test_fs/test_erofs.py +@@ -196,6 +196,15 @@ def test_erofs(u_boot_console): """ build_dir = u_boot_console.config.build_dir -+ # If the EFI subsystem is enabled, default file(e.g. EFI/BOOT/BOOTAA64.EFI) -+ # is scanned when the new disk is detected. This ends up with the unexpected -+ # output at the first 'sqfsls' command. -+ # Clear the previous state. ++ # If the EFI subsystem is enabled and initialized, EFI subsystem tries to ++ # add EFI boot option when the new disk is detected. If there is no EFI ++ # System Partition exists, EFI subsystem outputs error messages and ++ # it ends up with test failure. ++ # Restart U-Boot to clear the previous state. ++ # TODO: Ideally EFI test cases need to be fixed, but it will ++ # increase the number of system reset. ++ u_boot_console.restart_uboot() ++ + try: + # setup test environment + make_erofs_image(build_dir) +diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py +index 527a556ed8..a20a7d1a66 100644 +--- a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py ++++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py +@@ -118,6 +118,15 @@ def test_sqfs_ls(u_boot_console): + """ + build_dir = u_boot_console.config.build_dir + ++ # If the EFI subsystem is enabled and initialized, EFI subsystem tries to ++ # add EFI boot option when the new disk is detected. If there is no EFI ++ # System Partition exists, EFI subsystem outputs error messages and ++ # it ends up with test failure. ++ # Restart U-Boot to clear the previous state. ++ # TODO: Ideally EFI test cases need to be fixed, but it will ++ # increase the number of system reset. + u_boot_console.restart_uboot() + # setup test environment From 2be69fdb803bf340aaf2bde7c8bafbb10c91e70a Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 27 Jan 2024 06:56:21 +0000 Subject: [PATCH 023/128] Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild --- uboot-tools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 8083a3c..dbaa093 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.01 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Release: 2%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -208,6 +208,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Sat Jan 27 2024 Fedora Release Engineering - 1:2024.01-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild + * Mon Jan 08 2024 Peter Robinson - 1:2024.01-1 - Update to 2024.01 From 6d54ac747cd8bf8f25bdc91d5688320b8faf361b Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 14 Feb 2024 15:10:30 +0000 Subject: [PATCH 024/128] 2024.04 RC2 --- Provide-a-fallback-to-smbios-tables.patch | 686 ------------------ sources | 2 +- uboot-tools.spec | 13 +- ...atic-management-for-removable-medias.patch | 574 --------------- 4 files changed, 7 insertions(+), 1268 deletions(-) delete mode 100644 Provide-a-fallback-to-smbios-tables.patch delete mode 100644 uefi-Boot-var-automatic-management-for-removable-medias.patch diff --git a/Provide-a-fallback-to-smbios-tables.patch b/Provide-a-fallback-to-smbios-tables.patch deleted file mode 100644 index 4ff8ac5..0000000 --- a/Provide-a-fallback-to-smbios-tables.patch +++ /dev/null @@ -1,686 +0,0 @@ -From patchwork Thu Dec 7 09:18:49 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Ilias Apalodimas -X-Patchwork-Id: 1873089 -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=SyQQL6ZG; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sm7xz1DLXz23nD - for ; Thu, 7 Dec 2023 20:19:19 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 83BF287243; - Thu, 7 Dec 2023 10:19:05 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="SyQQL6ZG"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 46C3C87243; Thu, 7 Dec 2023 10:19:04 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com - [IPv6:2a00:1450:4864:20::330]) - (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 21B8586FFE - for ; Thu, 7 Dec 2023 10:19:02 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org -Received: by mail-wm1-x330.google.com with SMTP id - 5b1f17b1804b1-40c2c65e6aaso1041145e9.2 - for ; Thu, 07 Dec 2023 01:19:02 -0800 (PST) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1701940741; x=1702545541; darn=lists.denx.de; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=vcf8Uy8SIKdN9TXuCeQubka7IJIfrvGMGj1JoUebFs0=; - b=SyQQL6ZGyEFpFFqauSbHRSSNY+KOw9ohESTeXyy7RkWEEIFaK7yPwRRy9NZX+DJLAJ - ECaT3Bchk61s+E1ZsuxrqdlxEYWDULw+4O2hm22gVZjL5L6r4+NwNgCHwzYW/bcro87o - KEGRF7CXG50v6mvrjAOHoy2LbojZLR9d7fjO4gmGtihdnTMOW1cjtrX/3Seiy99QoTK6 - 5Hs119W/hO0/5AE1VVSiIxV1Xx+qYcAHvQqcEEkBCKR2MpHTauUEonUf1LC5LKK2gKG5 - UEzq7XLrPki8hih4EcWsoctpdPp4kBtvpVSSshji9yxDX3EXKzcfA8xyqrB+5qKJU100 - zZ7A== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1701940741; x=1702545541; - 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=vcf8Uy8SIKdN9TXuCeQubka7IJIfrvGMGj1JoUebFs0=; - b=L6Ejctx8u+W0IeEi5FfC1q0ah2NYKTScSheLqomwMY3Q4/BPiEUP7KUarxUKsRwI/3 - yP4rTVAXqlGbT6kFKq3jrxXlRS4HIRZxtFbgHZEKuBnXpkHCQpvQwKUcYY9QkbfdZEir - 5YYfONEv2yTHHfoiBZiVmcPARIQ5+2ra+k493og2Bm0Hk5dVWyaHn/YY6Y+FCWH7ZYn0 - Eq1M9Ng8YB3oMx63KwV9XHBURccH8UdCqwsNDvk2gWLKdSvrjlFD7ExiySd90+i9+6vN - CMLoNESSYj2K9qW/sxbIDgUv1JwYCWgJrDejTzilfagawcPlKY2XtTnOlUsRryYrsPoq - RbZg== -X-Gm-Message-State: AOJu0YxG7g4q8NdX+N/0Mp5YNkHEVHntPyakSqHCtdqDzgaRcQCbtF0q - 2APTVIQc7yNsT16/19bvkV1NRw3x7lZmC4YcT+s= -X-Google-Smtp-Source: - AGHT+IFwnHtGX5IWm5lG5rRTsz6nU13lqUMnEUb8xEq/mngZuRtpzcNdrO7fNaBiIDDQLuKd+Y07Tw== -X-Received: by 2002:a05:600c:2184:b0:40b:dd1f:6dd1 with SMTP id - e4-20020a05600c218400b0040bdd1f6dd1mr1312043wme.240.1701940741617; - Thu, 07 Dec 2023 01:19:01 -0800 (PST) -Received: from localhost.localdomain (ppp046103111243.access.hol.gr. - [46.103.111.243]) by smtp.gmail.com with ESMTPSA id - u21-20020a05600c139500b00405d9a950a2sm1299003wmf.28.2023.12.07.01.19.00 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Thu, 07 Dec 2023 01:19:01 -0800 (PST) -From: Ilias Apalodimas -To: trini@konsulko.com, - sjg@chromium.org -Cc: sean.anderson@seco.com, neil.armstrong@linaro.org, - heinrich.schuchardt@canonical.com, mark.kettenis@xs4all.nl, - Ilias Apalodimas , u-boot@lists.denx.de -Subject: [PATCH 1/2 v3] smbios: Simplify reporting of unknown values -Date: Thu, 7 Dec 2023 11:18:49 +0200 -Message-Id: <20231207091850.17776-2-ilias.apalodimas@linaro.org> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20231207091850.17776-1-ilias.apalodimas@linaro.org> -References: <20231207091850.17776-1-ilias.apalodimas@linaro.org> -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 - -If a value is not valid during the DT or SYSINFO parsing, we explicitly -set that to "Unknown Product" and "Unknown" for the product and -manufacturer respectively. It's cleaner if we move the checks insisde -smbios_add_prop_si() and provide an alternative string in case the -primary is NULL or empty - -pre-patch dmidecode - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown Product - Version: Not Specified - Serial Number: Not Specified - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Not Specified - Family: Not Specified - -[...] - -post-patch dmidecode: - -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown -[...] - -While at it make smbios_add_prop_si() add a string directly if the prop -node is NULL and replace smbios_add_string() calls with -smbios_add_prop_si(ctx, NULL, ....) - -Signed-off-by: Ilias Apalodimas ---- -Changes since v2: -- refactor even more code and remove the smbios_add_string calls from the - main code. Instead use smbios_add_prop() foir everything and add a - default value, in case the parsed one is NULL or emtpy -Changes since v1: -- None - - lib/smbios.c | 73 +++++++++++++++++++++++++--------------------------- - 1 file changed, 35 insertions(+), 38 deletions(-) - --- -2.40.1 - -diff --git a/lib/smbios.c b/lib/smbios.c -index d7f4999e8b2a..444aa245a273 100644 ---- a/lib/smbios.c -+++ b/lib/smbios.c -@@ -102,9 +102,6 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) - int i = 1; - char *p = ctx->eos; - -- if (!*str) -- str = "Unknown"; -- - for (;;) { - if (!*p) { - ctx->last_str = p; -@@ -134,11 +131,18 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) - * - * @ctx: context for writing the tables - * @prop: property to write -+ * @dval: Default value to use if the string is not found or is empty - * Return: 0 if not found, else SMBIOS string number (1 or more) - */ - static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, -- int sysinfo_id) -+ int sysinfo_id, const char *dval) - { -+ if (!dval || !*dval) -+ dval = "Unknown"; -+ -+ if (!prop) -+ return smbios_add_string(ctx, dval); -+ - if (sysinfo_id && ctx->dev) { - char val[SMBIOS_STR_MAX]; - int ret; -@@ -151,8 +155,8 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, - const char *str; - - str = ofnode_read_string(ctx->node, prop); -- if (str) -- return smbios_add_string(ctx, str); -+ -+ return smbios_add_string(ctx, str ? str : dval); - } - - return 0; -@@ -161,12 +165,15 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, - /** - * smbios_add_prop() - Add a property from the devicetree - * -- * @prop: property to write -+ * @prop: property to write. The default string will be written if -+ * prop is NULL -+ * @dval: Default value to use if the string is not found or is empty - * Return: 0 if not found, else SMBIOS string number (1 or more) - */ --static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop) -+static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop, -+ const char *dval) - { -- return smbios_add_prop_si(ctx, prop, SYSINFO_ID_NONE); -+ return smbios_add_prop_si(ctx, prop, SYSINFO_ID_NONE, dval); - } - - static void smbios_set_eos(struct smbios_ctx *ctx, char *eos) -@@ -228,11 +235,9 @@ static int smbios_write_type0(ulong *current, int handle, - memset(t, 0, sizeof(struct smbios_type0)); - fill_smbios_header(t, SMBIOS_BIOS_INFORMATION, len, handle); - smbios_set_eos(ctx, t->eos); -- t->vendor = smbios_add_string(ctx, "U-Boot"); -+ t->vendor = smbios_add_prop(ctx, NULL, "U-Boot"); - -- t->bios_ver = smbios_add_prop(ctx, "version"); -- if (!t->bios_ver) -- t->bios_ver = smbios_add_string(ctx, PLAIN_VERSION); -+ t->bios_ver = smbios_add_prop(ctx, "version", PLAIN_VERSION); - if (t->bios_ver) - gd->smbios_version = ctx->last_str; - log_debug("smbios_version = %p: '%s'\n", gd->smbios_version, -@@ -241,7 +246,7 @@ static int smbios_write_type0(ulong *current, int handle, - print_buffer((ulong)gd->smbios_version, gd->smbios_version, - 1, strlen(gd->smbios_version) + 1, 0); - #endif -- t->bios_release_date = smbios_add_string(ctx, U_BOOT_DMI_DATE); -+ t->bios_release_date = smbios_add_prop(ctx, NULL, U_BOOT_DMI_DATE); - #ifdef CONFIG_ROM_SIZE - t->bios_rom_size = (CONFIG_ROM_SIZE / 65536) - 1; - #endif -@@ -280,22 +285,19 @@ static int smbios_write_type1(ulong *current, int handle, - memset(t, 0, sizeof(struct smbios_type1)); - fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle); - smbios_set_eos(ctx, t->eos); -- t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); -- t->product_name = smbios_add_prop(ctx, "product"); -- if (!t->product_name) -- t->product_name = smbios_add_string(ctx, "Unknown Product"); -+ t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); -+ t->product_name = smbios_add_prop(ctx, "product", "Unknown"); - t->version = smbios_add_prop_si(ctx, "version", -- SYSINFO_ID_SMBIOS_SYSTEM_VERSION); -+ SYSINFO_ID_SMBIOS_SYSTEM_VERSION, -+ "Unknown"); - if (serial_str) { -- t->serial_number = smbios_add_string(ctx, serial_str); -+ t->serial_number = smbios_add_prop(ctx, NULL, serial_str); - strncpy((char *)t->uuid, serial_str, sizeof(t->uuid)); - } else { -- t->serial_number = smbios_add_prop(ctx, "serial"); -+ t->serial_number = smbios_add_prop(ctx, "serial", "Unknown"); - } -- t->sku_number = smbios_add_prop(ctx, "sku"); -- t->family = smbios_add_prop(ctx, "family"); -+ t->sku_number = smbios_add_prop(ctx, "sku", "Unknown"); -+ t->family = smbios_add_prop(ctx, "family", "Unknown"); - - len = t->length + smbios_string_table_len(ctx); - *current += len; -@@ -314,15 +316,12 @@ static int smbios_write_type2(ulong *current, int handle, - memset(t, 0, sizeof(struct smbios_type2)); - fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle); - smbios_set_eos(ctx, t->eos); -- t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); -- t->product_name = smbios_add_prop(ctx, "product"); -- if (!t->product_name) -- t->product_name = smbios_add_string(ctx, "Unknown Product"); -+ t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); -+ t->product_name = smbios_add_prop(ctx, "product", "Unknown"); - t->version = smbios_add_prop_si(ctx, "version", -- SYSINFO_ID_SMBIOS_BASEBOARD_VERSION); -- t->asset_tag_number = smbios_add_prop(ctx, "asset-tag"); -+ SYSINFO_ID_SMBIOS_BASEBOARD_VERSION, -+ "Unknown"); -+ t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", "Unknown"); - t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING; - t->board_type = SMBIOS_BOARD_MOTHERBOARD; - -@@ -343,9 +342,7 @@ static int smbios_write_type3(ulong *current, int handle, - memset(t, 0, sizeof(struct smbios_type3)); - fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle); - smbios_set_eos(ctx, t->eos); -- t->manufacturer = smbios_add_prop(ctx, "manufacturer"); -- if (!t->manufacturer) -- t->manufacturer = smbios_add_string(ctx, "Unknown"); -+ t->manufacturer = smbios_add_prop(ctx, "manufacturer", "Unknown"); - t->chassis_type = SMBIOS_ENCLOSURE_DESKTOP; - t->bootup_state = SMBIOS_STATE_SAFE; - t->power_supply_state = SMBIOS_STATE_SAFE; -@@ -388,8 +385,8 @@ static void smbios_write_type4_dm(struct smbios_type4 *t, - #endif - - t->processor_family = processor_family; -- t->processor_manufacturer = smbios_add_string(ctx, vendor); -- t->processor_version = smbios_add_string(ctx, name); -+ t->processor_manufacturer = smbios_add_prop(ctx, NULL, vendor); -+ t->processor_version = smbios_add_prop(ctx, NULL, name); - } - - static int smbios_write_type4(ulong *current, int handle, - -From patchwork Thu Dec 7 09:18:50 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Ilias Apalodimas -X-Patchwork-Id: 1873090 -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=KcFhbOkM; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4Sm7yF71l9z23nD - for ; Thu, 7 Dec 2023 20:19:33 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 7D6CB87483; - Thu, 7 Dec 2023 10:19:07 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="KcFhbOkM"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id B1E298745E; Thu, 7 Dec 2023 10:19:05 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com - [IPv6:2a00:1450:4864:20::433]) - (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 792A8871BB - for ; Thu, 7 Dec 2023 10:19:03 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=ilias.apalodimas@linaro.org -Received: by mail-wr1-x433.google.com with SMTP id - ffacd0b85a97d-3334a701cbbso717814f8f.0 - for ; Thu, 07 Dec 2023 01:19:03 -0800 (PST) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1701940743; x=1702545543; darn=lists.denx.de; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=JIRbBgzEcdaHWJ7fVa5JIsDJda65F2tSuL1aji2tJ5U=; - b=KcFhbOkMkvXbThdeAeI92+uSdN5LvKdwae+36Z/jz0Hg0yPDs5v8UqeDt2d+NaSlh9 - GERy8kIMCopTcJ13FoUM8Ok4PBSMRSDxbJo4lLaGIbddw7hcit4uxhJfTAL8zKxnboMU - YBZPC/E2NjWklmJx6p4zmLeXS5IzncTaDE9z2XFMRGrJ/KLqpTvwOp/nf57jP/kdIxpe - Q7vWAhVY8gC19ogSD41RB4ixA0HefI6xKq6fAl2GwvRlOvCEGAcVdpbl8aj5R8qEOSVT - BsuqzbDXHlQI6L9Y++Yqe89LcKMRoAWqHrgOuO3eBwnEp2jjjzV8G24mTFD+4wso1ERo - mIkQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1701940743; x=1702545543; - 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=JIRbBgzEcdaHWJ7fVa5JIsDJda65F2tSuL1aji2tJ5U=; - b=pee1V3/z6lW4enMw0ueHvBJJXGhNLq7KccXmY4QkXfVRLXGBOedbBwQH1KXDxj/gJs - RZ/KhsEvPN4qeqrqpeOnQoDBQs3QarjlsMHmlhnlBZMpgPKTJyg5MEpZPAlnfqZJkd4A - vMMYc1fZ+alT5gfZjdzpLypC2sOj9yC3ktb8ZYXQGQzN7yCYrQnBHgiYn3vDDaHMaQNH - n73RxiQNWJs9Ekow2hxk4l2FDpvlwuiFr9y+dnuzo5TvpbgaDbj64tcqxalnusBw3jKC - fE6r5cob553rh/ZM/bVJD/PIXP+LOSUHyiqJG+7KpEpSAY984EIHkKFRRbLHSIuwBAK+ - wTIw== -X-Gm-Message-State: AOJu0YwQcpf2rvKZHAPWsPT7fH7x3sa+mhF5kDJ557Oe9zwmQc4v6NzO - ZFEgE8KlljYnqibJKd2JdRCP6A== -X-Google-Smtp-Source: - AGHT+IEfJolrJ5g6Qgn465DsdBpMZMW+cn6kVgLvehQIXNT7VcXYfkBvC8Hf5zXnl7Q5Yto7bS2tOg== -X-Received: by 2002:a05:600c:d5:b0:40b:5e59:99c6 with SMTP id - u21-20020a05600c00d500b0040b5e5999c6mr940484wmm.230.1701940742953; - Thu, 07 Dec 2023 01:19:02 -0800 (PST) -Received: from localhost.localdomain (ppp046103111243.access.hol.gr. - [46.103.111.243]) by smtp.gmail.com with ESMTPSA id - u21-20020a05600c139500b00405d9a950a2sm1299003wmf.28.2023.12.07.01.19.01 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Thu, 07 Dec 2023 01:19:02 -0800 (PST) -From: Ilias Apalodimas -To: trini@konsulko.com, - sjg@chromium.org -Cc: sean.anderson@seco.com, neil.armstrong@linaro.org, - heinrich.schuchardt@canonical.com, mark.kettenis@xs4all.nl, - Ilias Apalodimas , u-boot@lists.denx.de -Subject: [PATCH 2/2 v3] smbios: Fallback to the default DT if sysinfo nodes - are missing -Date: Thu, 7 Dec 2023 11:18:50 +0200 -Message-Id: <20231207091850.17776-3-ilias.apalodimas@linaro.org> -X-Mailer: git-send-email 2.40.1 -In-Reply-To: <20231207091850.17776-1-ilias.apalodimas@linaro.org> -References: <20231207091850.17776-1-ilias.apalodimas@linaro.org> -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 - -In order to fill in the SMBIOS tables U-Boot currently relies on a -"u-boot,sysinfo-smbios" compatible node. This is fine for the boards -that already include such nodes. However with some recent EFI changes, -the majority of boards can boot up distros, which usually rely on -things like dmidecode etc for their reporting. For boards that -lack this special node the SMBIOS output looks like: - -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: Unknown - UUID: Not Settable - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown - -This looks problematic since most of the info are "Unknown". The DT spec -specifies standard properties containing relevant information like -'model' and 'compatible' for which the suggested format is -. Unfortunately the 'model' string found in DTs is -usually lacking the manufacturer so we can't use it for both -'Manufacturer' and 'Product Name' SMBIOS entries reliably. - -So let's add a last resort to our current smbios parsing. If none of -the sysinfo properties are found, scan for those information in the -root node of the device tree. Use the 'model' to fill the 'Product -Name' and the first value of 'compatible' for the 'Manufacturer', since -that always contains one. - -pre-patch: -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: Unknown - Product Name: Unknown - Version: Unknown - Serial Number: 100000000bb24ceb - UUID: 30303031-3030-3030-3061-613234636435 - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown -[...] - -and post patch: -Handle 0x0001, DMI type 1, 27 bytes -System Information - Manufacturer: raspberrypi - Product Name: Raspberry Pi 4 Model B Rev 1.1 - Version: Unknown - Serial Number: 100000000bb24ceb - UUID: 30303031-3030-3030-3061-613234636435 - Wake-up Type: Reserved - SKU Number: Unknown - Family: Unknown -[...] - -Signed-off-by: Ilias Apalodimas ---- -Simon, I'll work with tou on the refactoring you wanted and -remove the EFI requirement of SMBIOS in !x86 platforms. -Since this code has no tests, I'll add some once the refactoring -is done - -Changes since v2: -- Spelling mistakes -- rebase on top of patch #1 changes -Changes since v1: -- Tokenize the DT node entry and use the appropriate value instead of - the entire string -- Removed Peters tested/reviewed-by tags due to the above - lib/smbios.c | 94 +++++++++++++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 89 insertions(+), 5 deletions(-) - --- -2.40.1 - -diff --git a/lib/smbios.c b/lib/smbios.c -index 444aa245a273..3f0e1d529537 100644 ---- a/lib/smbios.c -+++ b/lib/smbios.c -@@ -9,11 +9,14 @@ - #include - #include - #include -+#include - #include - #include - #include - #include - #include -+#include -+#include - #ifdef CONFIG_CPU - #include - #include -@@ -43,6 +46,25 @@ - - DECLARE_GLOBAL_DATA_PTR; - -+/** -+ * struct map_sysinfo - Mapping of sysinfo strings to DT -+ * -+ * @sysinfo_str: sysinfo string -+ * @dt_str: DT string -+ * @max: Max index of the tokenized string to pick. Counting starts from 0 -+ * -+ */ -+struct map_sysinfo { -+ const char *sysinfo_str; -+ const char *dt_str; -+ int max; -+}; -+ -+static const struct map_sysinfo sysinfo_to_dt[] = { -+ { .sysinfo_str = "product", .dt_str = "model", 2 }, -+ { .sysinfo_str = "manufacturer", .dt_str = "compatible", 1 }, -+}; -+ - /** - * struct smbios_ctx - context for writing SMBIOS tables - * -@@ -87,6 +109,18 @@ struct smbios_write_method { - const char *subnode_name; - }; - -+static const struct map_sysinfo *convert_sysinfo_to_dt(const char *sysinfo_str) -+{ -+ int i; -+ -+ for (i = 0; i < ARRAY_SIZE(sysinfo_to_dt); i++) { -+ if (!strcmp(sysinfo_str, sysinfo_to_dt[i].sysinfo_str)) -+ return &sysinfo_to_dt[i]; -+ } -+ -+ return NULL; -+} -+ - /** - * smbios_add_string() - add a string to the string area - * -@@ -124,6 +158,42 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) - } - } - -+/** -+ * get_str_from_dt - Get a substring from a DT property. -+ * After finding the property in the DT, the function -+ * will parse comma-separated values and return the value. -+ * If nprop->max exceeds the number of comma-separated -+ * elements, the last non NULL value will be returned. -+ * Counting starts from zero. -+ * -+ * @nprop: sysinfo property to use -+ * @str: pointer to fill with data -+ * @size: str buffer length -+ */ -+static -+void get_str_from_dt(const struct map_sysinfo *nprop, char *str, size_t size) -+{ -+ const char *dt_str; -+ int cnt = 0; -+ char *token; -+ -+ memset(str, 0, size); -+ if (!nprop || !nprop->max) -+ return; -+ -+ dt_str = ofnode_read_string(ofnode_root(), nprop->dt_str); -+ if (!dt_str) -+ return; -+ -+ memcpy(str, dt_str, size); -+ token = strtok(str, ","); -+ while (token && cnt < nprop->max) { -+ strlcpy(str, token, strlen(token) + 1); -+ token = strtok(NULL, ","); -+ cnt++; -+ } -+} -+ - /** - * smbios_add_prop_si() - Add a property from the devicetree or sysinfo - * -@@ -137,6 +207,8 @@ static int smbios_add_string(struct smbios_ctx *ctx, const char *str) - static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, - int sysinfo_id, const char *dval) - { -+ int ret; -+ - if (!dval || !*dval) - dval = "Unknown"; - -@@ -145,18 +217,30 @@ static int smbios_add_prop_si(struct smbios_ctx *ctx, const char *prop, - - if (sysinfo_id && ctx->dev) { - char val[SMBIOS_STR_MAX]; -- int ret; - - ret = sysinfo_get_str(ctx->dev, sysinfo_id, sizeof(val), val); - if (!ret) - return smbios_add_string(ctx, val); - } - if (IS_ENABLED(CONFIG_OF_CONTROL)) { -- const char *str; -- -- str = ofnode_read_string(ctx->node, prop); -+ const char *str = NULL; -+ char str_dt[128] = { 0 }; -+ /* -+ * If the node is not valid fallback and try the entire DT -+ * so we can at least fill in manufacturer and board type -+ */ -+ if (ofnode_valid(ctx->node)) { -+ str = ofnode_read_string(ctx->node, prop); -+ } else { -+ const struct map_sysinfo *nprop; -+ -+ nprop = convert_sysinfo_to_dt(prop); -+ get_str_from_dt(nprop, str_dt, sizeof(str_dt)); -+ str = (const char *)str_dt; -+ } - -- return smbios_add_string(ctx, str ? str : dval); -+ ret = smbios_add_string(ctx, str && *str ? str : dval); -+ return ret; - } - - return 0; diff --git a/sources b/sources index 30e8529..8f50a6d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.01.tar.bz2) = 45bd093ba3bda23e43cdde83d8656c1ee1348ac2886ecff1fee475f101ac4965a5be6565408fa5b990c723f3fdc833edfca60a719f735a43040cd14a1b59a88b +SHA512 (u-boot-2024.04-rc2.tar.bz2) = f5c6d6a37ce6b34bd1ab2cddd5d0cacddfd19b5345934731df3a7ed454a3895ad2d14acbdb2e1b922b9571778e50b54cb7612b1798a04dfb991365d3344cd865 diff --git a/uboot-tools.spec b/uboot-tools.spec index dbaa093..eb2f4a3 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -#global candidate rc0 +%global candidate rc2 %if 0%{?rhel} %bcond_with toolsonly %else @@ -6,8 +6,8 @@ %endif Name: uboot-tools -Version: 2024.01 -Release: 2%{?candidate:.%{candidate}}%{?dist} +Version: 2024.04 +Release: 0.2%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -19,9 +19,7 @@ Source1: aarch64-boards Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch Patch2: disable-VBE-by-default.patch -Patch3: Provide-a-fallback-to-smbios-tables.patch Patch5: enable-bootmenu-by-default.patch -Patch6: uefi-Boot-var-automatic-management-for-removable-medias.patch Patch7: Add-video-damage-tracking.patch # Board fixes and enablement @@ -29,8 +27,6 @@ Patch7: Add-video-damage-tracking.patch Patch10: rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch # Rockchips improvements Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch -# Lots more to do, mostly untested, definitely unsupported -Patch12: rpi5-initial-support.patch #Patch12: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch BuildRequires: bc @@ -208,6 +204,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Wed Feb 14 2024 Peter Robinson - 1:2024.04-0.2.rc2 +- Update to 2024.04 RC2 + * Sat Jan 27 2024 Fedora Release Engineering - 1:2024.01-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/uefi-Boot-var-automatic-management-for-removable-medias.patch b/uefi-Boot-var-automatic-management-for-removable-medias.patch deleted file mode 100644 index 48ae88e..0000000 --- a/uefi-Boot-var-automatic-management-for-removable-medias.patch +++ /dev/null @@ -1,574 +0,0 @@ -From patchwork Fri Nov 10 04:25:37 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 8bit -X-Patchwork-Submitter: Masahisa Kojima -X-Patchwork-Id: 1862317 -X-Patchwork-Delegate: apalos@gmail.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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=muA1rcXE; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4SRQnL1SNCz1yRF - for ; Fri, 10 Nov 2023 15:28:54 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 4C150877A0; - Fri, 10 Nov 2023 05:27:39 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="muA1rcXE"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 9DA4487796; Fri, 10 Nov 2023 05:27:28 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com - [IPv6:2607:f8b0:4864:20::f30]) - (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 E1AE487795 - for ; Fri, 10 Nov 2023 05:27:22 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=masahisa.kojima@linaro.org -Received: by mail-qv1-xf30.google.com with SMTP id - 6a1803df08f44-66d09b6d007so10800236d6.1 - for ; Thu, 09 Nov 2023 20:27:22 -0800 (PST) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1699590441; x=1700195241; darn=lists.denx.de; - h=content-transfer-encoding:mime-version:references:in-reply-to - :message-id:date:subject:cc:to:from:from:to:cc:subject:date - :message-id:reply-to; - bh=TMp02tF2/jn50c0fdB6OUXNmWJ9Af2C5T6zhn2D5BPI=; - b=muA1rcXEW1UV0ytByrk/oz/vuO7kL/M5Szuv8+JLohfHHFY3sZW5v5q4Tn1coMbMKW - 6+JvY0qla9DiPjvWA90QSopUCqBoggSNPTIlTn4YSs0zA/+Aa9ufsx25M+rq4pdYGAZq - ujAG9mRgWMuq7W+eZZWfQo6eFqEo14D6RbQL5NFW/G0Wkle6TwLwu7dp19DOw7hH/jPq - sq9/5/DA4FEI+4sRDsPBAQ48VTq05vuMv2PMU0t4d7SXPVCEk1lW+JFZB4wooN2XotQ+ - ni+S40bdTeGBscZ+sajQQgtDd49nxGSB518samtlg5SGdhDB9WKak39uPeWU4WFYc01J - R7BQ== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1699590441; x=1700195241; - 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=TMp02tF2/jn50c0fdB6OUXNmWJ9Af2C5T6zhn2D5BPI=; - b=o5TY9c0iL/aKbWJtamq+fAKn5twYwIcXo5Z8lxIo1/WL8jhCu3973LiJ6l2rbP6I26 - wEUpA97eZRYjRnp6Pfb9nJ5+Ip11akGFqY+UNFjwNues+jYvCmrhtbzt3RIwwRMopasI - IvpvSU+Vk0opNS2b96ZRak7X34ZoUNZVcjTBCSqx3UgQcaMOxrP5u7LholG/3rTttkkF - gdIAWrm7wPUrREhnt8opfpTWbusAkgJ1lAa0uqcfb4TRE7fKsiX3du3TwgJNsvACBXxW - W4w5nDy5AXlY05IOsmMvxjIudLF0aDB3y/aUT1K7/NyAO77e5CPoGEIRF4JnpngLM7yx - RcEw== -X-Gm-Message-State: AOJu0YwKFnJ+XRzaRWdr9TK+didg99ZRC2gUKVvYvCLFFGqfG4yFbCXC - IsubnJ6RTNtZqmONUFojqVLmrQYm513MFxxhCLg= -X-Google-Smtp-Source: - AGHT+IE/39rKwHRMrxLkfDXIlyOXct/rRbXebKb2Lc3eaLeJaCt4Vmnxn7CrXnlXXLzUgocEmJUKcA== -X-Received: by 2002:a05:6214:d44:b0:675:667d:a1b6 with SMTP id - 4-20020a0562140d4400b00675667da1b6mr7212832qvr.0.1699590440388; - Thu, 09 Nov 2023 20:27:20 -0800 (PST) -Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id - n18-20020a170902e55200b001c0bf60ba5csm4304818plf.272.2023.11.09.20.27.19 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Thu, 09 Nov 2023 20:27:19 -0800 (PST) -From: Masahisa Kojima -To: u-boot@lists.denx.de -Cc: Heinrich Schuchardt , - Ilias Apalodimas , - Simon Glass , - Takahiro Akashi , - Michal Simek , Raymond Mao , - Masahisa Kojima , - Joao Marcos Costa , - Huang Jianan , - Thomas Petazzoni , - Miquel Raynal , linux-erofs@lists.ozlabs.org -Subject: [PATCH v12 4/9] efi_loader: Boot var automatic management -Date: Fri, 10 Nov 2023 13:25:37 +0900 -Message-Id: <20231110042542.3797301-5-masahisa.kojima@linaro.org> -X-Mailer: git-send-email 2.34.1 -In-Reply-To: <20231110042542.3797301-1-masahisa.kojima@linaro.org> -References: <20231110042542.3797301-1-masahisa.kojima@linaro.org> -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 - -From: Raymond Mao - -Changes for complying to EFI spec §3.5.1.1 -'Removable Media Boot Behavior'. -Boot variables can be automatically generated during a removable -media is probed. At the same time, unused boot variables will be -detected and removed. - -Please note that currently the function 'efi_disk_remove' has no -ability to distinguish below two scenarios -a) Unplugging of a removable media under U-Boot -b) U-Boot exiting and booting an OS -Thus currently the boot variables management is not added into -'efi_disk_remove' to avoid boot options being added/erased -repeatedly under scenario b) during power cycles -See TODO comments under function 'efi_disk_remove' for more details - -The original efi_secboot tests expect that BootOrder EFI variable -is not defined. With this commit, the BootOrder EFI variable is -automatically added when the disk is detected. The original -efi_secboot tests end up with unexpected failure. -The efi_secboot tests need to be modified to explicitly set -the BootOrder EFI variable. - -squashfs and erofs ls tests are also affected by this modification, -need to clear the previous state before squashfs ls test starts. - -Co-developed-by: Masahisa Kojima -Signed-off-by: Masahisa Kojima -Signed-off-by: Raymond Mao -Reviewed-by: Heinrich Schuchardt -Reviewed-by: Ilias Apalodimas -Reviewed-by: Joao Marcos Costa ---- - lib/efi_loader/efi_disk.c | 18 ++++++++ - lib/efi_loader/efi_setup.c | 7 ++++ - test/py/tests/test_efi_secboot/test_signed.py | 42 +++++++++---------- - .../test_efi_secboot/test_signed_intca.py | 14 +++---- - .../tests/test_efi_secboot/test_unsigned.py | 14 +++---- - test/py/tests/test_fs/test_erofs.py | 9 ++++ - .../test_fs/test_squashfs/test_sqfs_ls.py | 9 ++++ - 7 files changed, 78 insertions(+), 35 deletions(-) - -diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c -index f0d76113b0..b808a7fe62 100644 ---- a/lib/efi_loader/efi_disk.c -+++ b/lib/efi_loader/efi_disk.c -@@ -690,6 +690,13 @@ int efi_disk_probe(void *ctx, struct event *event) - return -1; - } - -+ /* only do the boot option management when UEFI sub-system is initialized */ -+ if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR) && efi_obj_list_initialized == EFI_SUCCESS) { -+ ret = efi_bootmgr_update_media_device_boot_option(); -+ if (ret != EFI_SUCCESS) -+ return -1; -+ } -+ - return 0; - } - -@@ -742,6 +749,17 @@ int efi_disk_remove(void *ctx, struct event *event) - dev_tag_del(dev, DM_TAG_EFI); - - return 0; -+ -+ /* -+ * TODO A flag to distinguish below 2 different scenarios of this -+ * function call is needed: -+ * a) Unplugging of a removable media under U-Boot -+ * b) U-Boot exiting and booting an OS -+ * In case of scenario a), efi_bootmgr_update_media_device_boot_option() -+ * needs to be invoked here to update the boot options and remove the -+ * unnecessary ones. -+ */ -+ - } - - /** -diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c -index ad719afd63..c02569cb6d 100644 ---- a/lib/efi_loader/efi_setup.c -+++ b/lib/efi_loader/efi_setup.c -@@ -245,6 +245,13 @@ efi_status_t efi_init_obj_list(void) - if (ret != EFI_SUCCESS) - goto out; - -+ if (IS_ENABLED(CONFIG_CMD_BOOTEFI_BOOTMGR)) { -+ /* update boot option after variable service initialized */ -+ ret = efi_bootmgr_update_media_device_boot_option(); -+ if (ret != EFI_SUCCESS) -+ goto out; -+ } -+ - /* Define supported languages */ - ret = efi_init_platform_lang(); - if (ret != EFI_SUCCESS) -diff --git a/test/py/tests/test_efi_secboot/test_signed.py b/test/py/tests/test_efi_secboot/test_signed.py -index ca52e853d8..2f862a259a 100644 ---- a/test/py/tests/test_efi_secboot/test_signed.py -+++ b/test/py/tests/test_efi_secboot/test_signed.py -@@ -29,7 +29,7 @@ class TestEfiSignedImage(object): - output = u_boot_console.run_command_list([ - 'host bind 0 %s' % disk_img, - 'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'bootefi bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -37,7 +37,7 @@ class TestEfiSignedImage(object): - # Test Case 1b, run unsigned image if no PK - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi -s ""', -- 'efidebug boot next 2', -+ 'efidebug boot order 2', - 'bootefi bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -59,13 +59,13 @@ class TestEfiSignedImage(object): - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld.efi.signed -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert('\'HELLO1\' failed' in ''.join(output)) - assert('efi_start_image() returned: 26' in ''.join(output)) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 2 HELLO2 host 0:1 /helloworld.efi -s ""', -- 'efidebug boot next 2', -+ 'efidebug boot order 2', - 'efidebug test bootmgr']) - assert '\'HELLO2\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -77,12 +77,12 @@ class TestEfiSignedImage(object): - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 2', -+ 'efidebug boot order 2', - 'efidebug test bootmgr']) - assert '\'HELLO2\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'bootefi bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -105,7 +105,7 @@ class TestEfiSignedImage(object): - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -117,7 +117,7 @@ class TestEfiSignedImage(object): - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db']) - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -143,7 +143,7 @@ class TestEfiSignedImage(object): - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -170,7 +170,7 @@ class TestEfiSignedImage(object): - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -181,7 +181,7 @@ class TestEfiSignedImage(object): - 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db']) - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -193,7 +193,7 @@ class TestEfiSignedImage(object): - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -205,7 +205,7 @@ class TestEfiSignedImage(object): - 'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize dbx']) - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -230,7 +230,7 @@ class TestEfiSignedImage(object): - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -254,7 +254,7 @@ class TestEfiSignedImage(object): - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'bootefi bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -265,7 +265,7 @@ class TestEfiSignedImage(object): - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -279,7 +279,7 @@ class TestEfiSignedImage(object): - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx']) - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -307,7 +307,7 @@ class TestEfiSignedImage(object): - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -330,7 +330,7 @@ class TestEfiSignedImage(object): - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi.signed_2sigs -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -349,7 +349,7 @@ class TestEfiSignedImage(object): - output = u_boot_console.run_command_list([ - 'host bind 0 %s' % disk_img, - 'efidebug boot add -b 1 HELLO1 host 0:1 /helloworld_forged.efi.signed -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert('hELLO, world!' in ''.join(output)) - -@@ -364,7 +364,7 @@ class TestEfiSignedImage(object): - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize PK']) - assert 'Failed to set EFI variable' not in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert(not 'hELLO, world!' in ''.join(output)) - assert('\'HELLO1\' failed' in ''.join(output)) -diff --git a/test/py/tests/test_efi_secboot/test_signed_intca.py b/test/py/tests/test_efi_secboot/test_signed_intca.py -index d8d599d22f..8d9a5f3e7f 100644 ---- a/test/py/tests/test_efi_secboot/test_signed_intca.py -+++ b/test/py/tests/test_efi_secboot/test_signed_intca.py -@@ -40,7 +40,7 @@ class TestEfiSignedImageIntca(object): - - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO_a host 0:1 /helloworld.efi.signed_a -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO_a\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -49,7 +49,7 @@ class TestEfiSignedImageIntca(object): - # Test Case 1b, signed and authenticated by root CA - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 2 HELLO_ab host 0:1 /helloworld.efi.signed_ab -s ""', -- 'efidebug boot next 2', -+ 'efidebug boot order 2', - 'bootefi bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -71,7 +71,7 @@ class TestEfiSignedImageIntca(object): - - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO_abc\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -81,7 +81,7 @@ class TestEfiSignedImageIntca(object): - output = u_boot_console.run_command_list([ - 'fatload host 0:1 4000000 db_b.auth', - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO_abc\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -@@ -91,7 +91,7 @@ class TestEfiSignedImageIntca(object): - output = u_boot_console.run_command_list([ - 'fatload host 0:1 4000000 db_c.auth', - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize db', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -117,7 +117,7 @@ class TestEfiSignedImageIntca(object): - - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO_abc host 0:1 /helloworld.efi.signed_abc -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert 'Hello, world!' in ''.join(output) - # Or, -@@ -129,7 +129,7 @@ class TestEfiSignedImageIntca(object): - output = u_boot_console.run_command_list([ - 'fatload host 0:1 4000000 dbx_c.auth', - 'setenv -e -nv -bs -rt -at -i 4000000:$filesize dbx', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert '\'HELLO_abc\' failed' in ''.join(output) - assert 'efi_start_image() returned: 26' in ''.join(output) -diff --git a/test/py/tests/test_efi_secboot/test_unsigned.py b/test/py/tests/test_efi_secboot/test_unsigned.py -index df63f0df08..7c078f220d 100644 ---- a/test/py/tests/test_efi_secboot/test_unsigned.py -+++ b/test/py/tests/test_efi_secboot/test_unsigned.py -@@ -36,11 +36,11 @@ class TestEfiUnsignedImage(object): - - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'bootefi bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert 'efi_start_image() returned: 26' in ''.join(output) - assert 'Hello, world!' not in ''.join(output) -@@ -65,7 +65,7 @@ class TestEfiUnsignedImage(object): - - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'bootefi bootmgr']) - assert 'Hello, world!' in ''.join(output) - -@@ -89,11 +89,11 @@ class TestEfiUnsignedImage(object): - - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'bootefi bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert 'efi_start_image() returned: 26' in ''.join(output) - assert 'Hello, world!' not in ''.join(output) -@@ -107,11 +107,11 @@ class TestEfiUnsignedImage(object): - - output = u_boot_console.run_command_list([ - 'efidebug boot add -b 1 HELLO host 0:1 /helloworld.efi -s ""', -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'bootefi bootmgr']) - assert '\'HELLO\' failed' in ''.join(output) - output = u_boot_console.run_command_list([ -- 'efidebug boot next 1', -+ 'efidebug boot order 1', - 'efidebug test bootmgr']) - assert 'efi_start_image() returned: 26' in ''.join(output) - assert 'Hello, world!' not in ''.join(output) -diff --git a/test/py/tests/test_fs/test_erofs.py b/test/py/tests/test_fs/test_erofs.py -index 458a52ba79..87ad8f2d5f 100644 ---- a/test/py/tests/test_fs/test_erofs.py -+++ b/test/py/tests/test_fs/test_erofs.py -@@ -196,6 +196,15 @@ def test_erofs(u_boot_console): - """ - build_dir = u_boot_console.config.build_dir - -+ # If the EFI subsystem is enabled and initialized, EFI subsystem tries to -+ # add EFI boot option when the new disk is detected. If there is no EFI -+ # System Partition exists, EFI subsystem outputs error messages and -+ # it ends up with test failure. -+ # Restart U-Boot to clear the previous state. -+ # TODO: Ideally EFI test cases need to be fixed, but it will -+ # increase the number of system reset. -+ u_boot_console.restart_uboot() -+ - try: - # setup test environment - make_erofs_image(build_dir) -diff --git a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py -index 527a556ed8..a20a7d1a66 100644 ---- a/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py -+++ b/test/py/tests/test_fs/test_squashfs/test_sqfs_ls.py -@@ -118,6 +118,15 @@ def test_sqfs_ls(u_boot_console): - """ - build_dir = u_boot_console.config.build_dir - -+ # If the EFI subsystem is enabled and initialized, EFI subsystem tries to -+ # add EFI boot option when the new disk is detected. If there is no EFI -+ # System Partition exists, EFI subsystem outputs error messages and -+ # it ends up with test failure. -+ # Restart U-Boot to clear the previous state. -+ # TODO: Ideally EFI test cases need to be fixed, but it will -+ # increase the number of system reset. -+ u_boot_console.restart_uboot() -+ - # setup test environment - check_mksquashfs_version() - generate_sqfs_src_dir(build_dir) From 0c3fb4e23d8f0b2036072bcfdf34bf9cbdbc42bd Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 15 Feb 2024 12:57:23 +0000 Subject: [PATCH 025/128] drop old patches --- rockchip-PinePhone-Pro-fixes.patch | 43 - rockchip-general-fixes.patch | 136 -- rpi5-initial-support.patch | 1910 ---------------------------- 3 files changed, 2089 deletions(-) delete mode 100644 rockchip-PinePhone-Pro-fixes.patch delete mode 100644 rockchip-general-fixes.patch delete mode 100644 rpi5-initial-support.patch diff --git a/rockchip-PinePhone-Pro-fixes.patch b/rockchip-PinePhone-Pro-fixes.patch deleted file mode 100644 index 5e07490..0000000 --- a/rockchip-PinePhone-Pro-fixes.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 1af5e42f170d2c4b944beeb875b80ec7f061038a Mon Sep 17 00:00:00 2001 -From: Ondrej Jirman -Date: Thu, 25 May 2023 15:27:08 +0200 -Subject: [PATCH] pinephone-pro: Fix I/O port voltage (GPIO3D4A is 1.8V) - -This fixes access to camera sensor over I2C during probe time in -the kernel. (Kernel will fix I/0 port voltage by itself, but the -timing depends on probe order of the drivers, so the fix can -come after the camera sensor driver already failed to probe.) - -Signed-off-by: Ondrej Jirman -Cc: Kever Yang -Reviewed-by: Kever Yang ---- - board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -index eb639cd0d07..b6ccbb9c1c4 100644 ---- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -+++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -@@ -15,7 +15,8 @@ - #include - #include - --#define GRF_IO_VSEL_BT565_SHIFT 0 -+#define GRF_IO_VSEL_BT565_GPIO2AB 1 -+#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2 - #define PMUGRF_CON0_VSEL_SHIFT 8 - - #ifndef CONFIG_SPL_BUILD -@@ -48,7 +49,8 @@ static void setup_iodomain(void) - syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); - - /* BT565 is in 1.8v domain */ -- rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); -+ rk_setreg(&grf->io_vsel, -+ GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A); - - /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ - rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); --- -2.41.0 diff --git a/rockchip-general-fixes.patch b/rockchip-general-fixes.patch deleted file mode 100644 index 00e78f5..0000000 --- a/rockchip-general-fixes.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 2d9350c50a9659cc2a247cdea07f0eacffa3cb32 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 12 Jun 2022 14:44:44 +0100 -Subject: [PATCH] rockchip: pinebook-pro: minor SPI flash fixes - -Set a default offset for environment so it doesn't write it to -unexpected locations, drop unneeded mtd config option. - -Signed-off-by: Peter Robinson ---- - configs/pinebook-pro-rk3399_defconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig -index 8ca1d0708f9..aaa52c6ea70 100644 ---- a/configs/pinebook-pro-rk3399_defconfig -+++ b/configs/pinebook-pro-rk3399_defconfig -@@ -5,6 +5,7 @@ CONFIG_ARCH_ROCKCHIP=y - CONFIG_SYS_TEXT_BASE=0x00200000 - CONFIG_NR_DRAM_BANKS=1 - CONFIG_ENV_SIZE=0x8000 -+CONFIG_ENV_OFFSET=0x3F8000 - CONFIG_DEFAULT_DEVICE_TREE="rk3399-pinebook-pro" - CONFIG_ROCKCHIP_RK3399=y - CONFIG_TARGET_PINEBOOK_PRO_RK3399=y -@@ -22,7 +23,6 @@ CONFIG_MISC_INIT_R=y - # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set - CONFIG_SPL_STACK_R=y - CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 --CONFIG_SPL_MTD_SUPPORT=y - CONFIG_SPL_SPI_LOAD=y - CONFIG_TPL=y - CONFIG_CMD_BOOTZ=y --- -2.36.1 - -From 27ba8e2f904063aec5196f86dd0332bf58a60259 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 12 Jun 2022 14:50:42 +0100 -Subject: [PATCH] rockchip: rockpro64: enable leds - -The Rockpro64 has some GPIO leds so let's enable them so the -user gets some output in early boot. - -Signed-off-by: Peter Robinson ---- - configs/rockpro64-rk3399_defconfig | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig -index e6f7a8469a3..b0c3527fab0 100644 ---- a/configs/rockpro64-rk3399_defconfig -+++ b/configs/rockpro64-rk3399_defconfig -@@ -42,6 +42,8 @@ CONFIG_AHCI_PCI=y - CONFIG_SATA_SIL=y - CONFIG_ROCKCHIP_GPIO=y - CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_LED=y -+CONFIG_LED_GPIO=y - CONFIG_MISC=y - CONFIG_ROCKCHIP_EFUSE=y - CONFIG_MMC_DW=y --- -2.36.1 - -From 8bca90472e0d71e5344711b6f5fe8dc95e19af5a Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 12 Jun 2022 15:12:47 +0100 -Subject: [PATCH] rockchip: pinebook-pro: sync PBP dtb to 5.18 - -Sync the pinebook pro to upstream 5.18, in particular this brings -brings in a fix so the DP is disabled so Linux will actually boot. - -Signed-off-by: Peter Robinson ---- - arch/arm/dts/rk3399-pinebook-pro.dts | 11 +++-------- - 1 file changed, 3 insertions(+), 8 deletions(-) - -diff --git a/arch/arm/dts/rk3399-pinebook-pro.dts b/arch/arm/dts/rk3399-pinebook-pro.dts -index 2b5f001ff4a..d6b68d77d63 100644 ---- a/arch/arm/dts/rk3399-pinebook-pro.dts -+++ b/arch/arm/dts/rk3399-pinebook-pro.dts -@@ -17,6 +17,7 @@ - / { - model = "Pine64 Pinebook Pro"; - compatible = "pine64,pinebook-pro", "rockchip,rk3399"; -+ chassis-type = "laptop"; - - aliases { - mmc0 = &sdio0; -@@ -242,12 +243,12 @@ - vdd_log: vdd-log { - compatible = "pwm-regulator"; - pwms = <&pwm2 0 25000 1>; -+ pwm-supply = <&vcc_sysin>; - regulator-name = "vdd_log"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <800000>; - regulator-max-microvolt = <1400000>; -- vin-supply = <&vcc_sysin>; - - regulator-state-mem { - regulator-on-in-suspend; -@@ -385,10 +386,6 @@ - }; - }; - --&cdn_dp { -- status = "okay"; --}; -- - &cpu_b0 { - cpu-supply = <&vdd_cpu_b>; - }; -@@ -475,8 +472,6 @@ - vcc10-supply = <&vcc_sysin>; - vcc11-supply = <&vcc_sysin>; - vcc12-supply = <&vcc3v3_sys>; -- vcc13-supply = <&vcc_sysin>; -- vcc14-supply = <&vcc_sysin>; - - regulators { - /* rk3399 center logic supply */ -@@ -711,7 +706,7 @@ - - connector { - compatible = "usb-c-connector"; -- data-role = "host"; -+ data-role = "dual"; - label = "USB-C"; - op-sink-microwatt = <1000000>; - power-role = "dual"; --- -2.36.1 - diff --git a/rpi5-initial-support.patch b/rpi5-initial-support.patch deleted file mode 100644 index 4a79f31..0000000 --- a/rpi5-initial-support.patch +++ /dev/null @@ -1,1910 +0,0 @@ -From patchwork Mon Dec 18 21:03:35 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877649 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=frMNX+46; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=IseK5QVE; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=1pz5pvm/; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=fIckdee4; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4SvC455lk9z1ydc - for ; Tue, 19 Dec 2023 08:04:05 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 92DDD8753C; - Mon, 18 Dec 2023 22:03:54 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="frMNX+46"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="IseK5QVE"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="1pz5pvm/"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="fIckdee4"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 95A7F87525; Mon, 18 Dec 2023 22:03:53 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:1]) - (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 0B37B87530 - for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id 6EE4F2228D; - Mon, 18 Dec 2023 21:03:49 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; - b=frMNX+46FgFSdyN24UT7Y4WdFDJKcOxcjH0HyyTrZsMcayuXoLtERkmRllSmLu8aRAoWOI - dzM9aX7eK9EHwuozUVijinsJ6wKpvqwxEx0Kdnj3wKPjAS3KTXGwfYiuZeO5wmbGRytEXd - p252vWhSG5L4UgaWil84yA4iM0KqiPs= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; - b=IseK5QVEh+KCaimaGVOvt6lv9A9n/uQ/xO6kky5hugt4tubeSnhwGXuCjHTIEZhYi9auSr - Q6h6Mb/o4bd7u1CQ== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933429; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; - b=1pz5pvm/SI3fxjKAlUcM+pRnK+NKLVbl/0Kj+UUQ/R29Irq4CDjfgTyaU0/DIXgn3x7Ttl - 2U7+per0J38TYiYHjQSDlrdPq4CwSFX2IEFS6sA5jx41ySG3RgO51Hh5GXKFh/WDUjcsn6 - ZPLcQCP31JjxHhULkzjaYLVYE2rQuXE= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933429; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; - b=fIckdee4Yc6Iut7CdcyZnDHxDW58F+dY46W7JLg6y7iXnfDkSc0DETyb97S3ngS7GdF3OQ - HPy/QFdHWA8p8cBw== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D359F13C92; - Mon, 18 Dec 2023 21:03:48 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id 4CUUMbSzgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:48 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T . Ivanov" -Subject: [PATCH v3 1/7] rpi5: add initial memory map for bcm2712 -Date: Mon, 18 Dec 2023 23:03:35 +0200 -Message-ID: <20231218210341.30073-2-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -Authentication-Results: smtp-out1.suse.de; - none -X-Spamd-Result: default: False [0.70 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; - TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[11]; - MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,bedrocksystems.com:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] -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 - -From: Dmitry Malkin - -includes: -* 1GB of RAM (from 4GB or 8GB total) -* VPU memory interface -* AXI ranges (main peripherals) - -Signed-off-by: Dmitry Malkin -Signed-off-by: Ivan T. Ivanov ---- - arch/arm/mach-bcm283x/init.c | 38 +++++++++++++++++++++++++++++++++++- - 1 file changed, 37 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c -index 7265faf6ce..af23b9711a 100644 ---- a/arch/arm/mach-bcm283x/init.c -+++ b/arch/arm/mach-bcm283x/init.c -@@ -19,7 +19,7 @@ - #ifdef CONFIG_ARM64 - #include - --#define MEM_MAP_MAX_ENTRIES (4) -+#define MEM_MAP_MAX_ENTRIES (5) - - static struct mm_region bcm283x_mem_map[MEM_MAP_MAX_ENTRIES] = { - { -@@ -68,6 +68,41 @@ static struct mm_region bcm2711_mem_map[MEM_MAP_MAX_ENTRIES] = { - } - }; - -+static struct mm_region bcm2712_mem_map[MEM_MAP_MAX_ENTRIES] = { -+ { -+ .virt = 0x00000000UL, -+ .phys = 0x00000000UL, -+ .size = 0x3f800000UL, -+ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | -+ PTE_BLOCK_INNER_SHARE -+ }, { -+ .virt = 0x3f800000UL, -+ .phys = 0x3f800000UL, -+ .size = 0x00800000UL, -+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -+ PTE_BLOCK_NON_SHARE | -+ PTE_BLOCK_PXN | PTE_BLOCK_UXN -+ }, { -+ /* Beginning of AXI bus where uSD controller lives */ -+ .virt = 0x1000000000UL, -+ .phys = 0x1000000000UL, -+ .size = 0x0002000000UL, -+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -+ PTE_BLOCK_NON_SHARE | -+ PTE_BLOCK_PXN | PTE_BLOCK_UXN -+ }, { -+ .virt = 0x107c000000UL, -+ .phys = 0x107c000000UL, -+ .size = 0x0004000000UL, -+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -+ PTE_BLOCK_NON_SHARE | -+ PTE_BLOCK_PXN | PTE_BLOCK_UXN -+ }, { -+ /* List terminator */ -+ 0, -+ } -+}; -+ - struct mm_region *mem_map = bcm283x_mem_map; - - /* -@@ -78,6 +113,7 @@ static const struct udevice_id board_ids[] = { - { .compatible = "brcm,bcm2837", .data = (ulong)&bcm283x_mem_map}, - { .compatible = "brcm,bcm2838", .data = (ulong)&bcm2711_mem_map}, - { .compatible = "brcm,bcm2711", .data = (ulong)&bcm2711_mem_map}, -+ { .compatible = "brcm,bcm2712", .data = (ulong)&bcm2712_mem_map}, - { }, - }; - - -From patchwork Mon Dec 18 21:03:36 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877650 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=v1KGWKJg; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=fFiq02vw; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=v1KGWKJg; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=fFiq02vw; - 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 4SvC4H2hzjz1ydc - for ; Tue, 19 Dec 2023 08:04:15 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id C85A08758C; - Mon, 18 Dec 2023 22:03:57 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="v1KGWKJg"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="fFiq02vw"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="v1KGWKJg"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="fFiq02vw"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 6F50F87530; Mon, 18 Dec 2023 22:03:54 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out2.suse.de (smtp-out2.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:2]) - (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 199488753C - for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out2.suse.de (Postfix) with ESMTPS id 1AC1A1F46E; - Mon, 18 Dec 2023 21:03:50 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; - b=v1KGWKJgJttai7C79qIEMd/XpNIgzFqndAnylh2LCSBCYnAQmHcbTcoqWFl1mbR0bCIJ2B - nnbHB6CW+/Ja2oUD0wavAmzqzhQ+ANsN8FLZ+RC4p4W0fnMs6Yz9lMDf8ozKecEdna61Q6 - 2SnPjyXAogWLFBBDalRvdzUIOIWe3Tc= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; - b=fFiq02vw2EIwrIbp2ltl5amzeQZi9NS1k/nH07K65OVAZc8eRyKu/vHbdjX58887t//OZ/ - 6LuVBS0afgkEbWCg== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; - b=v1KGWKJgJttai7C79qIEMd/XpNIgzFqndAnylh2LCSBCYnAQmHcbTcoqWFl1mbR0bCIJ2B - nnbHB6CW+/Ja2oUD0wavAmzqzhQ+ANsN8FLZ+RC4p4W0fnMs6Yz9lMDf8ozKecEdna61Q6 - 2SnPjyXAogWLFBBDalRvdzUIOIWe3Tc= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; - b=fFiq02vw2EIwrIbp2ltl5amzeQZi9NS1k/nH07K65OVAZc8eRyKu/vHbdjX58887t//OZ/ - 6LuVBS0afgkEbWCg== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7FCBC133E5; - Mon, 18 Dec 2023 21:03:49 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id AH+lHLWzgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:49 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T . Ivanov" -Subject: [PATCH v3 2/7] rpi5: Use devicetree as alternative way to read IO - base addresses -Date: Mon, 18 Dec 2023 23:03:36 +0200 -Message-ID: <20231218210341.30073-3-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -X-Spamd-Result: default: False [10.00 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_SPAM(5.10)[100.00%]; - FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; - FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[bedrocksystems.com:email,suse.de:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[] -Authentication-Results: smtp-out2.suse.de; - none -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 - -From: Dmitry Malkin - -MBOX and Watchdog on RPi5/bcm2712 has a different base IO offsets. -Find them via devicetree blob passed by bootloader. - -Signed-off-by: Dmitry Malkin -Signed-off-by: Ivan T. Ivanov ---- - arch/arm/mach-bcm283x/include/mach/base.h | 5 ++- - arch/arm/mach-bcm283x/include/mach/mbox.h | 3 +- - arch/arm/mach-bcm283x/include/mach/sdhci.h | 3 +- - arch/arm/mach-bcm283x/include/mach/timer.h | 3 +- - arch/arm/mach-bcm283x/include/mach/wdog.h | 3 +- - arch/arm/mach-bcm283x/init.c | 43 ++++++++++++++++++---- - 6 files changed, 43 insertions(+), 17 deletions(-) - -diff --git a/arch/arm/mach-bcm283x/include/mach/base.h b/arch/arm/mach-bcm283x/include/mach/base.h -index 4ccaf69693..6de99e7ea1 100644 ---- a/arch/arm/mach-bcm283x/include/mach/base.h -+++ b/arch/arm/mach-bcm283x/include/mach/base.h -@@ -6,7 +6,10 @@ - #ifndef _BCM283x_BASE_H_ - #define _BCM283x_BASE_H_ - --extern unsigned long rpi_bcm283x_base; -+extern unsigned long rpi_mbox_base; -+extern unsigned long rpi_timer_base; -+extern unsigned long rpi_sdhci_base; -+extern unsigned long rpi_wdog_base; - - #ifdef CONFIG_ARMV7_LPAE - #ifdef CONFIG_TARGET_RPI_4_32B -diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h -index 490664f878..35d4e2f075 100644 ---- a/arch/arm/mach-bcm283x/include/mach/mbox.h -+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h -@@ -38,8 +38,7 @@ - - /* Raw mailbox HW */ - --#define BCM2835_MBOX_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ -- rpi_bcm283x_base + 0x0000b880; }) -+#define BCM2835_MBOX_PHYSADDR rpi_mbox_base - - struct bcm2835_mbox_regs { - u32 read; -diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h -index 7323690687..e837c679c4 100644 ---- a/arch/arm/mach-bcm283x/include/mach/sdhci.h -+++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h -@@ -8,8 +8,7 @@ - - #include - --#define BCM2835_SDHCI_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ -- rpi_bcm283x_base + 0x00300000; }) -+#define BCM2835_SDHCI_PHYSADDR rpi_sdhci_base - - int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq); - -diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h -index 5567dbd7f3..60500a256d 100644 ---- a/arch/arm/mach-bcm283x/include/mach/timer.h -+++ b/arch/arm/mach-bcm283x/include/mach/timer.h -@@ -11,8 +11,7 @@ - #include - #endif - --#define BCM2835_TIMER_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ -- rpi_bcm283x_base + 0x00003000; }) -+#define BCM2835_TIMER_PHYSADDR rpi_timer_base - - #define BCM2835_TIMER_CS_M3 (1 << 3) - #define BCM2835_TIMER_CS_M2 (1 << 2) -diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h -index 9942666720..b950560674 100644 ---- a/arch/arm/mach-bcm283x/include/mach/wdog.h -+++ b/arch/arm/mach-bcm283x/include/mach/wdog.h -@@ -8,8 +8,7 @@ - - #include - --#define BCM2835_WDOG_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ -- rpi_bcm283x_base + 0x00100000; }) -+#define BCM2835_WDOG_PHYSADDR rpi_wdog_base - - struct bcm2835_wdog_regs { - u32 unknown0[7]; -diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c -index af23b9711a..1c5c748484 100644 ---- a/arch/arm/mach-bcm283x/init.c -+++ b/arch/arm/mach-bcm283x/init.c -@@ -151,7 +151,11 @@ static void rpi_update_mem_map(void) - static void rpi_update_mem_map(void) {} - #endif - --unsigned long rpi_bcm283x_base = 0x3f000000; -+/* Default bcm283x devices addresses */ -+unsigned long rpi_mbox_base = 0x3f00b880; -+unsigned long rpi_sdhci_base = 0x3f300000; -+unsigned long rpi_wdog_base = 0x3f100000; -+unsigned long rpi_timer_base = 0x3f003000; - - int arch_cpu_init(void) - { -@@ -162,22 +166,45 @@ int arch_cpu_init(void) - - int mach_cpu_init(void) - { -- int ret, soc_offset; -+ int ret, soc, offset; - u64 io_base, size; - - rpi_update_mem_map(); - - /* Get IO base from device tree */ -- soc_offset = fdt_path_offset(gd->fdt_blob, "/soc"); -- if (soc_offset < 0) -- return soc_offset; -+ soc = fdt_path_offset(gd->fdt_blob, "/soc"); -+ if (soc < 0) -+ return soc; - -- ret = fdt_read_range((void *)gd->fdt_blob, soc_offset, 0, NULL, -- &io_base, &size); -+ ret = fdt_read_range((void *)gd->fdt_blob, soc, 0, NULL, -+ &io_base, &size); - if (ret) - return ret; - -- rpi_bcm283x_base = io_base; -+ rpi_mbox_base = io_base + 0x00b880; -+ rpi_sdhci_base = io_base + 0x300000; -+ rpi_wdog_base = io_base + 0x100000; -+ rpi_timer_base = io_base + 0x003000; -+ -+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, -+ "brcm,bcm2835-mbox"); -+ if (offset > soc) -+ rpi_mbox_base = fdt_get_base_address(gd->fdt_blob, offset); -+ -+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, -+ "brcm,bcm2835-sdhci"); -+ if (offset > soc) -+ rpi_sdhci_base = fdt_get_base_address(gd->fdt_blob, offset); -+ -+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, -+ "brcm,bcm2835-system-timer"); -+ if (offset > soc) -+ rpi_timer_base = fdt_get_base_address(gd->fdt_blob, offset); -+ -+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, -+ "brcm,bcm2712-pm"); -+ if (offset > soc) -+ rpi_wdog_base = fdt_get_base_address(gd->fdt_blob, offset); - - return 0; - } - -From patchwork Mon Dec 18 21:03:37 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877652 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=MuifTv9w; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=J2WonmZQ; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=driIaEaW; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=ENBj4l6/; - 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 4SvC4h1PpHz1ydc - for ; Tue, 19 Dec 2023 08:04:36 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id BC5CE87656; - Mon, 18 Dec 2023 22:03:58 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="MuifTv9w"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="J2WonmZQ"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="driIaEaW"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="ENBj4l6/"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 24B3087578; Mon, 18 Dec 2023 22:03:57 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:1]) - (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 34BC9875A0 - for ; Mon, 18 Dec 2023 22:03:52 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id B98772226F; - Mon, 18 Dec 2023 21:03:50 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; - b=MuifTv9wBEOLgWscWoGcXg+RGB8+btC5sRFciLLURyCkDcUQuguKCF0MB5CUHbvIFDKQTs - 3cu6hcIxZ1sJPOhJYAQlW90dBLsORX0sI25Eq4VgPGCsldwfrQ6KFwJmGJHKAf1t3bAtsp - bXmOjkuzkGiYTERqgRtFHlM+jbjtULk= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; - b=J2WonmZQu47jTWrv+1hYLdw1tZ+mNBDcST4N3FHxlTW7EY6hSg3i0FkVDYqumfQMZdddMp - jagUtFA6k1hguwCQ== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; - b=driIaEaWsaR+g9AcK8SGiaVWp2t8QtO7GFM918C1n2Mg0Ag01KOyoFkVXAvjXENou/caP6 - mszp+EvY1mp+ZR5gwQMkbkHBxQ10VWiFHcSdpA6ZicAD8PbXnb4DO5mEFRyVbxDu6b9fHp - mNp6oBcymc5k4gJFdfomnV1ubqgcp38= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; - b=ENBj4l6/3jkDUxi4yY5WR8ECQN9jENKPjLTTKM7yT4ET1rZJ3jbU297szl97aZN4oQ41A9 - z8StT2qNvcfjYQCA== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2AC2D13C93; - Mon, 18 Dec 2023 21:03:50 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id EE/zB7azgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:50 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 3/7] rpi5: Use devicetree to retrieve board revision -Date: Mon, 18 Dec 2023 23:03:37 +0200 -Message-ID: <20231218210341.30073-4-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -Authentication-Results: smtp-out1.suse.de; - none -X-Spamd-Result: default: False [1.14 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; - TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - NEURAL_HAM_LONG(-1.00)[-1.000]; - R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; - RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[11]; - MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.56)[98.03%] -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 - -Firmware on RPi5 return error on board revision query -through firmware interface, but on the other hand it fills -"linux,revision" in "system" node, so use it to detect board -revision. - - system { - linux,revision = <0xc04170>; - linux,serial = <0x6cf44e80 0x3c533ede>; - }; - -Signed-off-by: Ivan T. Ivanov ---- - board/raspberrypi/rpi/rpi.c | 22 +++++++++++++++++++--- - 1 file changed, 19 insertions(+), 3 deletions(-) - -diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c -index cd823ad746..2851ebc985 100644 ---- a/board/raspberrypi/rpi/rpi.c -+++ b/board/raspberrypi/rpi/rpi.c -@@ -171,6 +171,11 @@ static const struct rpi_model rpi_models_new_scheme[] = { - DTB_DIR "bcm2711-rpi-cm4.dtb", - true, - }, -+ [0x17] = { -+ "5 Model B", -+ DTB_DIR "bcm2712-rpi-5-b.dtb", -+ true, -+ }, - }; - - static const struct rpi_model rpi_models_old_scheme[] = { -@@ -429,15 +434,27 @@ static void get_board_revision(void) - int ret; - const struct rpi_model *models; - uint32_t models_count; -+ ofnode node; - - BCM2835_MBOX_INIT_HDR(msg); - BCM2835_MBOX_INIT_TAG(&msg->get_board_rev, GET_BOARD_REV); - - ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr); - if (ret) { -- printf("bcm2835: Could not query board revision\n"); - /* Ignore error; not critical */ -- return; -+ node = ofnode_path("/system"); -+ if (!ofnode_valid(node)) { -+ printf("bcm2835: Could not find /system node\n"); -+ return; -+ } -+ -+ ret = ofnode_read_u32(node, "linux,revision", &revision); -+ if (ret) { -+ printf("bcm2835: Could not find linux,revision\n"); -+ return; -+ } -+ } else { -+ revision = msg->get_board_rev.body.resp.rev; - } - - /* -@@ -451,7 +468,6 @@ static void get_board_revision(void) - * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250 - * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594 - */ -- revision = msg->get_board_rev.body.resp.rev; - if (revision & 0x800000) { - rev_scheme = 1; - rev_type = (revision >> 4) & 0xff; - -From patchwork Mon Dec 18 21:03:38 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877651 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=v2vbP3rz; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=DCEhbGvW; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=v2vbP3rz; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=DCEhbGvW; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4SvC4X1dxWz1ydc - for ; Tue, 19 Dec 2023 08:04:28 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 516EE875B6; - Mon, 18 Dec 2023 22:03:58 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="v2vbP3rz"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="DCEhbGvW"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="v2vbP3rz"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="DCEhbGvW"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id B3A6E87578; Mon, 18 Dec 2023 22:03:55 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) - (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 AF6918758C - for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id 601C222298; - Mon, 18 Dec 2023 21:03:51 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; - b=v2vbP3rzM/o63ofFdDaxhtUv68QFa8UxlaWLBU0PN+7PKXtZUGyrKBSmhVzxTM42FyEF7w - 9fus9/ORTaMw41AMi4qeWNQkin7gz4BF2qAFQuYSksnSgsT4Jul8n1YBBmIDx1keXZtfAW - uJZcfMM7pykF11NRMTvI38ZkyYm3ueQ= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; - b=DCEhbGvWPmgWKvfaoSUDgZ/cuuHGUnp9FvtlFeMSL2WTlsc5F+jQrl+8kVn2Yr5wDXUi8w - yyGhdRc4ihbp3tAg== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; - b=v2vbP3rzM/o63ofFdDaxhtUv68QFa8UxlaWLBU0PN+7PKXtZUGyrKBSmhVzxTM42FyEF7w - 9fus9/ORTaMw41AMi4qeWNQkin7gz4BF2qAFQuYSksnSgsT4Jul8n1YBBmIDx1keXZtfAW - uJZcfMM7pykF11NRMTvI38ZkyYm3ueQ= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; - b=DCEhbGvWPmgWKvfaoSUDgZ/cuuHGUnp9FvtlFeMSL2WTlsc5F+jQrl+8kVn2Yr5wDXUi8w - yyGhdRc4ihbp3tAg== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C77BF133E5; - Mon, 18 Dec 2023 21:03:50 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id cKI3LrazgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:50 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 4/7] bcm2835: brcm, - bcm2708-fb device is using r5g6b5 format -Date: Mon, 18 Dec 2023 23:03:38 +0200 -Message-ID: <20231218210341.30073-5-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -X-Spamd-Result: default: False [4.90 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; - TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; - RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[34.66%] -Authentication-Results: smtp-out1.suse.de; - none -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 - -brcm,bcm2708-fb device provided by firmware on RPi5 uses -16 bits per pixel. Update driver to properly handle this. - -Signed-off-by: Ivan T. Ivanov ---- - drivers/video/bcm2835.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c -index 14942526f1..245c958b6e 100644 ---- a/drivers/video/bcm2835.c -+++ b/drivers/video/bcm2835.c -@@ -43,7 +43,7 @@ static int bcm2835_video_probe(struct udevice *dev) - - uc_priv->xsize = w; - uc_priv->ysize = h; -- uc_priv->bpix = VIDEO_BPP32; -+ uc_priv->bpix = dev_get_driver_data(dev); - plat->base = fb_base; - plat->size = fb_size; - -@@ -51,11 +51,11 @@ static int bcm2835_video_probe(struct udevice *dev) - } - - static const struct udevice_id bcm2835_video_ids[] = { -- { .compatible = "brcm,bcm2835-hdmi" }, -- { .compatible = "brcm,bcm2711-hdmi0" }, -- { .compatible = "brcm,bcm2708-fb" }, -+ { .compatible = "brcm,bcm2835-hdmi", .data = VIDEO_BPP32}, -+ { .compatible = "brcm,bcm2711-hdmi0", .data = VIDEO_BPP32}, -+ { .compatible = "brcm,bcm2708-fb", .data = VIDEO_BPP16 }, - #if !IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) -- { .compatible = "simple-framebuffer" }, -+ { .compatible = "simple-framebuffer", .data = VIDEO_BPP32}, - #endif - { } - }; - -From patchwork Mon Dec 18 21:03:39 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877653 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=NbGv/QjH; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=mv0vjv7/; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=NbGv/QjH; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=mv0vjv7/; - 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 4SvC4s5T6Bz1ydc - for ; Tue, 19 Dec 2023 08:04:45 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 3B87487227; - Mon, 18 Dec 2023 22:04:02 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="NbGv/QjH"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="mv0vjv7/"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="NbGv/QjH"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="mv0vjv7/"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id AC0FC874F3; Mon, 18 Dec 2023 22:03:57 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:1]) - (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 8349D875DB - for ; Mon, 18 Dec 2023 22:03:52 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id 07C81222A0; - Mon, 18 Dec 2023 21:03:52 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; - b=NbGv/QjHBl2RkJvR6nKp9uvf3bewa/Jp5ykWs/ULuKNb1e1kp0q0TCiM3d88QGrhaOkktM - ARQoLZXxNSqS1EXqsPA7VQyuJpg3iM74I+GTJfNdlIDDYeA4JLrY6MexUOxdVl1EgxjaPf - 8qkaGm9uEwoD2sactKTn0rgBg5C7Ej0= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; - b=mv0vjv7/43Gm9IJuOWZT6NQDNDmZdNrBoTyjx7Yu5AAnyTgKtyFYldUlt18PDNHm701rhG - AxUSg7hqv1qJTiDg== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; - b=NbGv/QjHBl2RkJvR6nKp9uvf3bewa/Jp5ykWs/ULuKNb1e1kp0q0TCiM3d88QGrhaOkktM - ARQoLZXxNSqS1EXqsPA7VQyuJpg3iM74I+GTJfNdlIDDYeA4JLrY6MexUOxdVl1EgxjaPf - 8qkaGm9uEwoD2sactKTn0rgBg5C7Ej0= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; - b=mv0vjv7/43Gm9IJuOWZT6NQDNDmZdNrBoTyjx7Yu5AAnyTgKtyFYldUlt18PDNHm701rhG - AxUSg7hqv1qJTiDg== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6FAB513C92; - Mon, 18 Dec 2023 21:03:51 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id YHTRGLezgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:51 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 5/7] mmc: bcmstb: Add support for bcm2712 SD controller -Date: Mon, 18 Dec 2023 23:03:39 +0200 -Message-ID: <20231218210341.30073-6-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -X-Spamd-Result: default: False [1.90 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; - TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; - RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] -Authentication-Results: smtp-out1.suse.de; - none -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 - -Borrow SD quirks from vendor Linux driver. - -"BCM2712 unfortunately carries with it a perennial bug with the SD -controller register interface present on previous chips (2711/2709/2708). -Accesses must be dword-sized and a read-modify-write cycle to the 32-bit -registers containing the COMMAND, TRANSFER_MODE, BLOCK_SIZE and -BLOCK_COUNT registers tramples the upper/lower 16 bits of data written. -BCM2712 does not seem to need the extreme delay between each write as on -previous chips, just the serialisation of writes to these registers in a -single 32-bit operation." - -Signed-off-by: Ivan T. Ivanov ---- - drivers/mmc/bcmstb_sdhci.c | 173 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 172 insertions(+), 1 deletion(-) - -diff --git a/drivers/mmc/bcmstb_sdhci.c b/drivers/mmc/bcmstb_sdhci.c -index dc96818cff..21489e66c0 100644 ---- a/drivers/mmc/bcmstb_sdhci.c -+++ b/drivers/mmc/bcmstb_sdhci.c -@@ -38,6 +38,16 @@ - */ - #define BCMSTB_SDHCI_MINIMUM_CLOCK_FREQUENCY 400000 - -+#define SDIO_CFG_CTRL 0x0 -+#define SDIO_CFG_CTRL_SDCD_N_TEST_EN BIT(31) -+#define SDIO_CFG_CTRL_SDCD_N_TEST_LEV BIT(30) -+ -+#define SDIO_CFG_SD_PIN_SEL 0x44 -+#define SDIO_CFG_SD_PIN_SEL_MASK 0x3 -+#define SDIO_CFG_SD_PIN_SEL_CARD BIT(1) -+ -+#define REG_OFFSET_IN_BITS(reg) ((reg) << 3 & 0x18) -+ - /* - * This driver has only been tested with eMMC devices; SD devices may - * not work. -@@ -47,6 +57,53 @@ struct sdhci_bcmstb_plat { - struct mmc mmc; - }; - -+struct sdhci_bcmstb_host { -+ struct sdhci_host host; -+ u32 shadow_cmd; -+ u32 shadow_blk; -+ bool is_cmd_shadowed; -+ bool is_blk_shadowed; -+}; -+ -+struct sdhci_brcmstb_dev_priv { -+ int (*init)(struct udevice *dev); -+ struct sdhci_ops *ops; -+}; -+ -+static inline struct sdhci_bcmstb_host *to_bcmstb_host(struct sdhci_host *host) -+{ -+ return container_of(host, struct sdhci_bcmstb_host, host); -+} -+ -+static int sdhci_brcmstb_init_2712(struct udevice *dev) -+{ -+ struct sdhci_host *host = dev_get_priv(dev); -+ void *cfg_regs; -+ u32 reg; -+ -+ /* Map in the non-standard CFG registers */ -+ cfg_regs = dev_remap_addr_name(dev, "cfg"); -+ if (!cfg_regs) -+ return -ENOENT; -+ -+ if ((host->mmc->host_caps & MMC_CAP_NONREMOVABLE) || -+ (host->mmc->host_caps & MMC_CAP_NEEDS_POLL)) { -+ /* Force presence */ -+ reg = readl(cfg_regs + SDIO_CFG_CTRL); -+ reg &= ~SDIO_CFG_CTRL_SDCD_N_TEST_LEV; -+ reg |= SDIO_CFG_CTRL_SDCD_N_TEST_EN; -+ writel(reg, cfg_regs + SDIO_CFG_CTRL); -+ } else { -+ /* Enable card detection line */ -+ reg = readl(cfg_regs + SDIO_CFG_SD_PIN_SEL); -+ reg &= ~SDIO_CFG_SD_PIN_SEL_MASK; -+ reg |= SDIO_CFG_SD_PIN_SEL_CARD; -+ writel(reg, cfg_regs + SDIO_CFG_SD_PIN_SEL); -+ } -+ -+ return 0; -+} -+ - static int sdhci_bcmstb_bind(struct udevice *dev) - { - struct sdhci_bcmstb_plat *plat = dev_get_plat(dev); -@@ -58,10 +115,14 @@ static int sdhci_bcmstb_probe(struct udevice *dev) - { - struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct sdhci_bcmstb_plat *plat = dev_get_plat(dev); -- struct sdhci_host *host = dev_get_priv(dev); -+ struct sdhci_bcmstb_host *bcmstb = dev_get_priv(dev); -+ struct sdhci_host *host = &bcmstb->host; -+ struct sdhci_brcmstb_dev_priv *dev_priv; - fdt_addr_t base; - int ret; - -+ dev_priv = (struct sdhci_brcmstb_dev_priv *)dev_get_driver_data(dev); -+ - base = dev_read_addr(dev); - if (base == FDT_ADDR_T_NONE) - return -EINVAL; -@@ -75,6 +136,10 @@ static int sdhci_bcmstb_probe(struct udevice *dev) - - host->mmc = &plat->mmc; - host->mmc->dev = dev; -+ -+ if (dev_priv && dev_priv->ops) -+ host->ops = dev_priv->ops; -+ - ret = sdhci_setup_cfg(&plat->cfg, host, - BCMSTB_SDHCI_MAXIMUM_CLOCK_FREQUENCY, - BCMSTB_SDHCI_MINIMUM_CLOCK_FREQUENCY); -@@ -84,10 +149,116 @@ static int sdhci_bcmstb_probe(struct udevice *dev) - upriv->mmc = &plat->mmc; - host->mmc->priv = host; - -+ if (dev_priv && dev_priv->init) { -+ ret = dev_priv->init(dev); -+ if (ret) -+ return ret; -+ } -+ - return sdhci_probe(dev); - } - -+static u16 sdhci_brcmstb_32bits_readw(struct sdhci_host *host, int reg) -+{ -+ struct sdhci_bcmstb_host *bcmstb = to_bcmstb_host(host); -+ u16 word; -+ u32 val; -+ -+ if (reg == SDHCI_TRANSFER_MODE && bcmstb->is_cmd_shadowed) { -+ /* Get the saved transfer mode */ -+ val = bcmstb->shadow_cmd; -+ } else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) && -+ bcmstb->is_blk_shadowed) { -+ /* Get the saved block info */ -+ val = bcmstb->shadow_blk; -+ } else { -+ val = readl(host->ioaddr + (reg & ~3)); -+ } -+ -+ word = val >> REG_OFFSET_IN_BITS(reg) & 0xffff; -+ return word; -+} -+ -+static u8 sdhci_brcmstb_32bits_readb(struct sdhci_host *host, int reg) -+{ -+ u32 val = readl(host->ioaddr + (reg & ~3)); -+ u8 byte = val >> REG_OFFSET_IN_BITS(reg) & 0xff; -+ return byte; -+} -+ -+/* -+ * BCM2712 unfortunately carries with it a perennial bug with the SD -+ * controller register interface present on previous chips (2711/2709/2708). -+ * Accesses must be dword-sized and a read-modify-write cycle to the -+ * 32-bit registers containing the COMMAND, TRANSFER_MODE, BLOCK_SIZE and -+ * BLOCK_COUNT registers tramples the upper/lower 16 bits of data written. -+ * BCM2712 does not seem to need the extreme delay between each write as -+ * on previous chips, just the serialisation of writes to these registers -+ * in a single 32-bit operation. -+ */ -+static void sdhci_brcmstb_32bits_writew(struct sdhci_host *host, u16 val, int reg) -+{ -+ struct sdhci_bcmstb_host *bcmstb = to_bcmstb_host(host); -+ u32 word_shift = REG_OFFSET_IN_BITS(reg); -+ u32 mask = 0xffff << word_shift; -+ u32 oldval, newval; -+ -+ if (reg == SDHCI_COMMAND) { -+ /* Write the block now as we are issuing a command */ -+ if (bcmstb->is_blk_shadowed) { -+ writel(bcmstb->shadow_blk, host->ioaddr + SDHCI_BLOCK_SIZE); -+ bcmstb->is_blk_shadowed = false; -+ } -+ oldval = bcmstb->shadow_cmd; -+ bcmstb->is_cmd_shadowed = false; -+ } else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) && -+ bcmstb->is_blk_shadowed) { -+ /* Block size and count are stored in shadow reg */ -+ oldval = bcmstb->shadow_blk; -+ } else { -+ /* Read reg, all other registers are not shadowed */ -+ oldval = readl(host->ioaddr + (reg & ~3)); -+ } -+ newval = (oldval & ~mask) | (val << word_shift); -+ -+ if (reg == SDHCI_TRANSFER_MODE) { -+ /* Save the transfer mode until the command is issued */ -+ bcmstb->shadow_cmd = newval; -+ bcmstb->is_cmd_shadowed = true; -+ } else if (reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) { -+ /* Save the block info until the command is issued */ -+ bcmstb->shadow_blk = newval; -+ bcmstb->is_blk_shadowed = true; -+ } else { -+ /* Command or other regular 32-bit write */ -+ writel(newval, host->ioaddr + (reg & ~3)); -+ } -+} -+ -+static void sdhci_brcmstb_32bits_writeb(struct sdhci_host *host, u8 val, int reg) -+{ -+ u32 oldval = readl(host->ioaddr + (reg & ~3)); -+ u32 byte_shift = REG_OFFSET_IN_BITS(reg); -+ u32 mask = 0xff << byte_shift; -+ u32 newval = (oldval & ~mask) | (val << byte_shift); -+ -+ writel(newval, host->ioaddr + (reg & ~3)); -+} -+ -+static struct sdhci_ops sdhci_brcmstb_ops_2712 = { -+ .read_b = sdhci_brcmstb_32bits_readb, -+ .read_w = sdhci_brcmstb_32bits_readw, -+ .write_w = sdhci_brcmstb_32bits_writew, -+ .write_b = sdhci_brcmstb_32bits_writeb, -+}; -+ -+static const struct sdhci_brcmstb_dev_priv match_priv_2712 = { -+ .init = sdhci_brcmstb_init_2712, -+ .ops = &sdhci_brcmstb_ops_2712, -+}; -+ - static const struct udevice_id sdhci_bcmstb_match[] = { -+ { .compatible = "brcm,bcm2712-sdhci", .data = (ulong)&match_priv_2712 }, - { .compatible = "brcm,bcm7425-sdhci" }, - { .compatible = "brcm,sdhci-brcmstb" }, - { } - -From patchwork Mon Dec 18 21:03:40 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877654 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=f/19Tx1x; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=e0CvACbS; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=f/19Tx1x; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=e0CvACbS; - 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 4SvC5339Phz1ydc - for ; Tue, 19 Dec 2023 08:04:55 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id AEFAE87561; - Mon, 18 Dec 2023 22:04:02 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="f/19Tx1x"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="e0CvACbS"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="f/19Tx1x"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="e0CvACbS"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id E31C887661; Mon, 18 Dec 2023 22:03:58 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:1]) - (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 23C28875FE - for ; Mon, 18 Dec 2023 22:03:53 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [IPv6:2a07:de40:b281:104:10:150:64:97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id AA225222AF; - Mon, 18 Dec 2023 21:03:52 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; - b=f/19Tx1x7UFtAUz8rSw0xZAG55X0OP1hiHqEuhAMQ+G/qEfSEkg6v1FGZhP70gpNWDQQgk - sr6WvGWKDP0t+jOsv0jDi9ZDrTiDB2ge+exjUPFNEvQP3H5zrjgKVOaqBaoOeLHXs/ay0l - qSAackxgs89eelJL1qSI3XwtAjq2zlQ= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; - b=e0CvACbSltQnSYuEyv3yxtn0hfVqkwt0KNf0fBLAfLwxlC3hb9ebDGcHvra3iPCHYB22X9 - ButpL853ceVzwdDA== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; - b=f/19Tx1x7UFtAUz8rSw0xZAG55X0OP1hiHqEuhAMQ+G/qEfSEkg6v1FGZhP70gpNWDQQgk - sr6WvGWKDP0t+jOsv0jDi9ZDrTiDB2ge+exjUPFNEvQP3H5zrjgKVOaqBaoOeLHXs/ay0l - qSAackxgs89eelJL1qSI3XwtAjq2zlQ= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; - b=e0CvACbSltQnSYuEyv3yxtn0hfVqkwt0KNf0fBLAfLwxlC3hb9ebDGcHvra3iPCHYB22X9 - ButpL853ceVzwdDA== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 15B1C133E5; - Mon, 18 Dec 2023 21:03:52 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id 8OvVArizgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:52 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 6/7] configs: rpi_arm64: enable SDHCI BCMSTB driver -Date: Mon, 18 Dec 2023 23:03:40 +0200 -Message-ID: <20231218210341.30073-7-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -Authentication-Results: smtp-out1.suse.de; - dkim=pass header.d=suse.de header.s=susede2_rsa header.b="f/19Tx1x"; - dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=e0CvACbS -X-Rspamd-Server: rspamd2.dmz-prg2.suse.org -X-Spamd-Result: default: False [-1.62 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; - RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; - SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; - TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; - BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; - DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; - RCPT_COUNT_SEVEN(0.00)[11]; NEURAL_HAM_SHORT(-0.20)[-1.000]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.11)[66.45%]; - ARC_NA(0.00)[]; - R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; FROM_HAS_DN(0.00)[]; - FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; - DWL_DNSWL_HI(-3.50)[suse.de:dkim]; - NEURAL_HAM_LONG(-1.00)[-1.000]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; - FUZZY_BLOCKED(0.00)[rspamd.com]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; - RCVD_IN_DNSWL_HI(-0.50)[2a07:de40:b281:104:10:150:64:97:from] -X-Rspamd-Queue-Id: AA225222AF -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 - -RPi5 have "brcm,bcm2712-sdhci" controller which is -handled by "sdhci-bcmstb" driver, so enable it. - -Signed-off-by: Ivan T. Ivanov ---- - configs/rpi_arm64_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig -index f9dade18f6..1107fd11de 100644 ---- a/configs/rpi_arm64_defconfig -+++ b/configs/rpi_arm64_defconfig -@@ -33,6 +33,7 @@ CONFIG_BCM2835_GPIO=y - CONFIG_MMC_SDHCI=y - CONFIG_MMC_SDHCI_SDMA=y - CONFIG_MMC_SDHCI_BCM2835=y -+CONFIG_MMC_SDHCI_BCMSTB=y - CONFIG_BCMGENET=y - CONFIG_PCI_BRCMSTB=y - CONFIG_PINCTRL=y - -From patchwork Mon Dec 18 21:03:41 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877655 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=1by1WnE8; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=e64lBvSE; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=1by1WnE8; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=e64lBvSE; - 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 4SvC5H05zfz1ydc - for ; Tue, 19 Dec 2023 08:05:07 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 2FBDE87650; - Mon, 18 Dec 2023 22:04:03 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="1by1WnE8"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="e64lBvSE"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="1by1WnE8"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="e64lBvSE"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 5D01C876A4; Mon, 18 Dec 2023 22:03:59 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out2.suse.de (smtp-out2.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:2]) - (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 C279687509 - for ; Mon, 18 Dec 2023 22:03:53 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [IPv6:2a07:de40:b281:104:10:150:64:97]) - (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 smtp-out2.suse.de (Postfix) with ESMTPS id 5507C1F6E6; - Mon, 18 Dec 2023 21:03:53 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933433; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; - b=1by1WnE818KeyiiUhS0PLD7P0c+SSwVEcIdSwLVDSj6t8vZK9vpPNROZRCB9WlZtgGyGUU - JlRP9h5PowjYnh5OWRH6KbjZ19MG+Fu3rWcMQ+gET5ljKGaRAtFv2t0gDAtmZGheOkf5pW - KEDUZYxYceI7JKlWcX6QlIjexymId9w= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933433; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; - b=e64lBvSEDRhrUCpOd2eVMasuXC6PFNm5B1yOGeNNS+E2HREmMMam1YM4RObadB2tdux/T3 - Galw853x9Gm0wpDA== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933433; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; - b=1by1WnE818KeyiiUhS0PLD7P0c+SSwVEcIdSwLVDSj6t8vZK9vpPNROZRCB9WlZtgGyGUU - JlRP9h5PowjYnh5OWRH6KbjZ19MG+Fu3rWcMQ+gET5ljKGaRAtFv2t0gDAtmZGheOkf5pW - KEDUZYxYceI7JKlWcX6QlIjexymId9w= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933433; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; - b=e64lBvSEDRhrUCpOd2eVMasuXC6PFNm5B1yOGeNNS+E2HREmMMam1YM4RObadB2tdux/T3 - Galw853x9Gm0wpDA== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BB17413C92; - Mon, 18 Dec 2023 21:03:52 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id 0JQfK7izgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:52 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 7/7] pci: pcie-brcmstb: Add bcm2712 PCIe controller support -Date: Mon, 18 Dec 2023 23:03:41 +0200 -Message-ID: <20231218210341.30073-8-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -X-Rspamd-Server: rspamd1.dmz-prg2.suse.org -X-Spamd-Bar: / -X-Spamd-Result: default: False [-0.31 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; - RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; - TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; - BROKEN_CONTENT_TYPE(1.50)[]; - R_RATELIMIT(0.00)[to_ip_from(RLccgikja4sxqnupiwsfdm9q1r)]; - RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+]; - MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[11]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[27.73%]; - ARC_NA(0.00)[]; - R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; FROM_HAS_DN(0.00)[]; - FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; - DWL_DNSWL_HI(-3.50)[suse.de:dkim]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; - FUZZY_BLOCKED(0.00)[rspamd.com]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; - RCVD_IN_DNSWL_HI(-0.50)[2a07:de40:b281:104:10:150:64:97:from] -Authentication-Results: smtp-out2.suse.de; - dkim=pass header.d=suse.de header.s=susede2_rsa header.b=1by1WnE8; - dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=e64lBvSE -X-Rspamd-Queue-Id: 5507C1F6E6 -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 - -PCIe controller have minor register map difference compared -to bcm2711 variant. Handle this using device specific register -offset. - -Signed-off-by: Ivan T. Ivanov ---- - drivers/pci/pcie_brcmstb.c | 23 +++++++++++++++++++---- - 1 file changed, 19 insertions(+), 4 deletions(-) - -diff --git a/drivers/pci/pcie_brcmstb.c b/drivers/pci/pcie_brcmstb.c -index cd45f0bee9..d63e715b2e 100644 ---- a/drivers/pci/pcie_brcmstb.c -+++ b/drivers/pci/pcie_brcmstb.c -@@ -90,7 +90,6 @@ - #define PCIE_MEM_WIN0_LIMIT_HI(win) \ - PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8) - --#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 - #define PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000 - - #define PCIE_MSI_INTR2_CLR 0x4508 -@@ -131,6 +130,10 @@ - #define SSC_STATUS_PLL_LOCK_MASK 0x800 - #define SSC_STATUS_PLL_LOCK_SHIFT 11 - -+struct pcie_cfg_data { -+ unsigned long hard_debug_offs; -+}; -+ - /** - * struct brcm_pcie - the PCIe controller state - * @base: Base address of memory mapped IO registers of the controller -@@ -141,6 +144,7 @@ - struct brcm_pcie { - void __iomem *base; - -+ struct pcie_cfg_data *cfg; - int gen; - bool ssc; - }; -@@ -458,7 +462,7 @@ static int brcm_pcie_probe(struct udevice *dev) - /* Take the bridge out of reset */ - clrbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_INIT_MASK); - -- clrbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG, -+ clrbits_le32(base + pcie->cfg->hard_debug_offs, - PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - - /* Wait for SerDes to be stable */ -@@ -599,7 +603,7 @@ static int brcm_pcie_remove(struct udevice *dev) - setbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_PERST_MASK); - - /* Turn off SerDes */ -- setbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG, -+ setbits_le32(base + pcie->cfg->hard_debug_offs, - PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - - /* Shutdown bridge */ -@@ -620,6 +624,8 @@ static int brcm_pcie_of_to_plat(struct udevice *dev) - if (!pcie->base) - return -EINVAL; - -+ pcie->cfg = (struct pcie_cfg_data *)dev_get_driver_data(dev); -+ - pcie->ssc = ofnode_read_bool(dn, "brcm,enable-ssc"); - - ret = ofnode_read_u32(dn, "max-link-speed", &max_link_speed); -@@ -636,8 +642,17 @@ static const struct dm_pci_ops brcm_pcie_ops = { - .write_config = brcm_pcie_write_config, - }; - -+static const struct pcie_cfg_data bcm2711_cfg = { -+ .hard_debug_offs = 0x4204 -+}; -+ -+static const struct pcie_cfg_data bcm2712_cfg = { -+ .hard_debug_offs = 0x4304 -+}; -+ - static const struct udevice_id brcm_pcie_ids[] = { -- { .compatible = "brcm,bcm2711-pcie" }, -+ { .compatible = "brcm,bcm2711-pcie", .data = (ulong)&bcm2711_cfg }, -+ { .compatible = "brcm,bcm2712-pcie", .data = (ulong)&bcm2712_cfg }, - { } - }; - From 69b6819f2e49a15fe7dbdeb2b23616b0a09ba043 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 15 Feb 2024 13:05:33 +0000 Subject: [PATCH 026/128] drop another patch --- ...rockpro64-Build-u-boot-rockchip-spi..patch | 41 ------------------- uboot-tools.spec | 1 - 2 files changed, 42 deletions(-) delete mode 100644 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch diff --git a/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch b/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch deleted file mode 100644 index 30e4ad8..0000000 --- a/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch +++ /dev/null @@ -1,41 +0,0 @@ -From ed5ffb3b53690a47333b931301a3765b9588b5dc Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 11 Jun 2023 21:22:41 +0100 -Subject: [PATCH] Revert "rockchip: rockpro64: Build u-boot-rockchip-spi.bin" - -This reverts commit 5713135ecc75660684ff3eb6cfba7bc11eb6433c. ---- - configs/rockpro64-rk3399_defconfig | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig -index f41c0306790..0ca2cecade2 100644 ---- a/configs/rockpro64-rk3399_defconfig -+++ b/configs/rockpro64-rk3399_defconfig -@@ -11,7 +11,6 @@ - CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64" - CONFIG_DM_RESET=y - CONFIG_ROCKCHIP_RK3399=y --CONFIG_ROCKCHIP_SPI_IMAGE=y - CONFIG_TARGET_ROCKPRO64_RK3399=y - CONFIG_SPL_STACK=0x400000 - CONFIG_DEBUG_UART_BASE=0xFF1A0000 -@@ -21,7 +20,6 @@ - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y --CONFIG_LTO=y - CONFIG_SPL_FIT_SIGNATURE=y - CONFIG_LEGACY_IMAGE_FORMAT=y - CONFIG_BOOTSTAGE=y -@@ -40,7 +38,6 @@ - CONFIG_SPL_STACK_R=y - CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 - CONFIG_SPL_SPI_LOAD=y --CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 - CONFIG_TPL=y - CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y --- -2.41.0 - diff --git a/uboot-tools.spec b/uboot-tools.spec index eb2f4a3..b17640e 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -27,7 +27,6 @@ Patch7: Add-video-damage-tracking.patch Patch10: rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch # Rockchips improvements Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch -#Patch12: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch BuildRequires: bc BuildRequires: bison From 9dc8c9ae3c672f9d57b120e8bfaddb56aa0f0838 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 29 Feb 2024 19:51:50 +0000 Subject: [PATCH 027/128] Update to 2024.04 RC3 Enable a number of new upstream devices Upstream now builds Rockchip SPI artifacts Various cleanups Fix ESP partition detection to enable EFI vars --- ...rockpro64-Build-u-boot-rockchip-spi..patch | 41 - aarch64-boards | 13 + rockchip-PinePhone-Pro-fixes.patch | 43 - rockchip-general-fixes.patch | 136 -- rpi5-initial-support.patch | 1910 ----------------- sources | 2 +- uboot-tools.spec | 78 +- ...ll-options-for-EFI-System-Partitions.patch | 36 + 8 files changed, 85 insertions(+), 2174 deletions(-) delete mode 100644 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch delete mode 100644 rockchip-PinePhone-Pro-fixes.patch delete mode 100644 rockchip-general-fixes.patch delete mode 100644 rpi5-initial-support.patch create mode 100644 uefi-Add-all-options-for-EFI-System-Partitions.patch diff --git a/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch b/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch deleted file mode 100644 index 30e4ad8..0000000 --- a/0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch +++ /dev/null @@ -1,41 +0,0 @@ -From ed5ffb3b53690a47333b931301a3765b9588b5dc Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 11 Jun 2023 21:22:41 +0100 -Subject: [PATCH] Revert "rockchip: rockpro64: Build u-boot-rockchip-spi.bin" - -This reverts commit 5713135ecc75660684ff3eb6cfba7bc11eb6433c. ---- - configs/rockpro64-rk3399_defconfig | 3 --- - 1 file changed, 3 deletions(-) - -diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig -index f41c0306790..0ca2cecade2 100644 ---- a/configs/rockpro64-rk3399_defconfig -+++ b/configs/rockpro64-rk3399_defconfig -@@ -11,7 +11,6 @@ - CONFIG_DEFAULT_DEVICE_TREE="rk3399-rockpro64" - CONFIG_DM_RESET=y - CONFIG_ROCKCHIP_RK3399=y --CONFIG_ROCKCHIP_SPI_IMAGE=y - CONFIG_TARGET_ROCKPRO64_RK3399=y - CONFIG_SPL_STACK=0x400000 - CONFIG_DEBUG_UART_BASE=0xFF1A0000 -@@ -21,7 +20,6 @@ - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y --CONFIG_LTO=y - CONFIG_SPL_FIT_SIGNATURE=y - CONFIG_LEGACY_IMAGE_FORMAT=y - CONFIG_BOOTSTAGE=y -@@ -40,7 +38,6 @@ - CONFIG_SPL_STACK_R=y - CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 - CONFIG_SPL_SPI_LOAD=y --CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000 - CONFIG_TPL=y - CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y --- -2.41.0 - diff --git a/aarch64-boards b/aarch64-boards index 39a556a..07154e5 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -1,4 +1,5 @@ a64-olinuxino +a64-olinuxino-emmc amarula_a64_relic apple_m1 bananapi_m2_plus_h5 @@ -8,6 +9,8 @@ dragonboard410c dragonboard820c dragonboard845c eaidk-610-rk3399 +emlid_neutis_n5_devboard +evb-px5 evb-rk3328 evb-rk3399 ficus-rk3399 @@ -39,17 +42,23 @@ nanopi_neo2 nanopi-neo4-rk3399 nanopi_neo_plus2 nanopi_r1s_h5 +nanopi-r2c-plus-rk3328 +nanopi-r2c-rk3328 nanopi-r2s-rk3328 nanopi-r4s-rk3399 +oceanic_5205_5inmfd odroid-c2 orangepi_3 orangepi_lite2 orangepi_one_plus orangepi_pc2 orangepi_prime +orangepi-r1-plus-lts-rk3328 +orangepi-r1-plus-rk3328 orangepi-rk3399 orangepi_win orangepi_zero2 +orangepi_zero3 orangepi_zero_plus orangepi_zero_plus2 p212 @@ -68,6 +77,8 @@ poplar puma-rk3399 qemu_arm64 roc-cc-rk3328 +rock-4c-plus-rk3399 +rock-4se-rk3399 rock64-rk3328 rock960-rk3399 rock-pi-4c-rk3399 @@ -82,6 +93,8 @@ sopine_baseboard starqltechn tanix_tx6 teres_i +transpeed-8k618-t turris_mox vexpress_aemv8a_juno +x96_mate xilinx_zynqmp_virt diff --git a/rockchip-PinePhone-Pro-fixes.patch b/rockchip-PinePhone-Pro-fixes.patch deleted file mode 100644 index 5e07490..0000000 --- a/rockchip-PinePhone-Pro-fixes.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 1af5e42f170d2c4b944beeb875b80ec7f061038a Mon Sep 17 00:00:00 2001 -From: Ondrej Jirman -Date: Thu, 25 May 2023 15:27:08 +0200 -Subject: [PATCH] pinephone-pro: Fix I/O port voltage (GPIO3D4A is 1.8V) - -This fixes access to camera sensor over I2C during probe time in -the kernel. (Kernel will fix I/0 port voltage by itself, but the -timing depends on probe order of the drivers, so the fix can -come after the camera sensor driver already failed to probe.) - -Signed-off-by: Ondrej Jirman -Cc: Kever Yang -Reviewed-by: Kever Yang ---- - board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -index eb639cd0d07..b6ccbb9c1c4 100644 ---- a/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -+++ b/board/pine64/pinephone-pro-rk3399/pinephone-pro-rk3399.c -@@ -15,7 +15,8 @@ - #include - #include - --#define GRF_IO_VSEL_BT565_SHIFT 0 -+#define GRF_IO_VSEL_BT565_GPIO2AB 1 -+#define GRF_IO_VSEL_AUDIO_GPIO3D4A 2 - #define PMUGRF_CON0_VSEL_SHIFT 8 - - #ifndef CONFIG_SPL_BUILD -@@ -48,7 +49,8 @@ static void setup_iodomain(void) - syscon_get_first_range(ROCKCHIP_SYSCON_PMUGRF); - - /* BT565 is in 1.8v domain */ -- rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_BT565_SHIFT); -+ rk_setreg(&grf->io_vsel, -+ GRF_IO_VSEL_BT565_GPIO2AB | GRF_IO_VSEL_AUDIO_GPIO3D4A); - - /* Set GPIO1 1.8v/3.0v source select to PMU1830_VOL */ - rk_setreg(&pmugrf->soc_con0, 1 << PMUGRF_CON0_VSEL_SHIFT); --- -2.41.0 diff --git a/rockchip-general-fixes.patch b/rockchip-general-fixes.patch deleted file mode 100644 index 00e78f5..0000000 --- a/rockchip-general-fixes.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 2d9350c50a9659cc2a247cdea07f0eacffa3cb32 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 12 Jun 2022 14:44:44 +0100 -Subject: [PATCH] rockchip: pinebook-pro: minor SPI flash fixes - -Set a default offset for environment so it doesn't write it to -unexpected locations, drop unneeded mtd config option. - -Signed-off-by: Peter Robinson ---- - configs/pinebook-pro-rk3399_defconfig | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig -index 8ca1d0708f9..aaa52c6ea70 100644 ---- a/configs/pinebook-pro-rk3399_defconfig -+++ b/configs/pinebook-pro-rk3399_defconfig -@@ -5,6 +5,7 @@ CONFIG_ARCH_ROCKCHIP=y - CONFIG_SYS_TEXT_BASE=0x00200000 - CONFIG_NR_DRAM_BANKS=1 - CONFIG_ENV_SIZE=0x8000 -+CONFIG_ENV_OFFSET=0x3F8000 - CONFIG_DEFAULT_DEVICE_TREE="rk3399-pinebook-pro" - CONFIG_ROCKCHIP_RK3399=y - CONFIG_TARGET_PINEBOOK_PRO_RK3399=y -@@ -22,7 +23,6 @@ CONFIG_MISC_INIT_R=y - # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set - CONFIG_SPL_STACK_R=y - CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000 --CONFIG_SPL_MTD_SUPPORT=y - CONFIG_SPL_SPI_LOAD=y - CONFIG_TPL=y - CONFIG_CMD_BOOTZ=y --- -2.36.1 - -From 27ba8e2f904063aec5196f86dd0332bf58a60259 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 12 Jun 2022 14:50:42 +0100 -Subject: [PATCH] rockchip: rockpro64: enable leds - -The Rockpro64 has some GPIO leds so let's enable them so the -user gets some output in early boot. - -Signed-off-by: Peter Robinson ---- - configs/rockpro64-rk3399_defconfig | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig -index e6f7a8469a3..b0c3527fab0 100644 ---- a/configs/rockpro64-rk3399_defconfig -+++ b/configs/rockpro64-rk3399_defconfig -@@ -42,6 +42,8 @@ CONFIG_AHCI_PCI=y - CONFIG_SATA_SIL=y - CONFIG_ROCKCHIP_GPIO=y - CONFIG_SYS_I2C_ROCKCHIP=y -+CONFIG_LED=y -+CONFIG_LED_GPIO=y - CONFIG_MISC=y - CONFIG_ROCKCHIP_EFUSE=y - CONFIG_MMC_DW=y --- -2.36.1 - -From 8bca90472e0d71e5344711b6f5fe8dc95e19af5a Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Sun, 12 Jun 2022 15:12:47 +0100 -Subject: [PATCH] rockchip: pinebook-pro: sync PBP dtb to 5.18 - -Sync the pinebook pro to upstream 5.18, in particular this brings -brings in a fix so the DP is disabled so Linux will actually boot. - -Signed-off-by: Peter Robinson ---- - arch/arm/dts/rk3399-pinebook-pro.dts | 11 +++-------- - 1 file changed, 3 insertions(+), 8 deletions(-) - -diff --git a/arch/arm/dts/rk3399-pinebook-pro.dts b/arch/arm/dts/rk3399-pinebook-pro.dts -index 2b5f001ff4a..d6b68d77d63 100644 ---- a/arch/arm/dts/rk3399-pinebook-pro.dts -+++ b/arch/arm/dts/rk3399-pinebook-pro.dts -@@ -17,6 +17,7 @@ - / { - model = "Pine64 Pinebook Pro"; - compatible = "pine64,pinebook-pro", "rockchip,rk3399"; -+ chassis-type = "laptop"; - - aliases { - mmc0 = &sdio0; -@@ -242,12 +243,12 @@ - vdd_log: vdd-log { - compatible = "pwm-regulator"; - pwms = <&pwm2 0 25000 1>; -+ pwm-supply = <&vcc_sysin>; - regulator-name = "vdd_log"; - regulator-always-on; - regulator-boot-on; - regulator-min-microvolt = <800000>; - regulator-max-microvolt = <1400000>; -- vin-supply = <&vcc_sysin>; - - regulator-state-mem { - regulator-on-in-suspend; -@@ -385,10 +386,6 @@ - }; - }; - --&cdn_dp { -- status = "okay"; --}; -- - &cpu_b0 { - cpu-supply = <&vdd_cpu_b>; - }; -@@ -475,8 +472,6 @@ - vcc10-supply = <&vcc_sysin>; - vcc11-supply = <&vcc_sysin>; - vcc12-supply = <&vcc3v3_sys>; -- vcc13-supply = <&vcc_sysin>; -- vcc14-supply = <&vcc_sysin>; - - regulators { - /* rk3399 center logic supply */ -@@ -711,7 +706,7 @@ - - connector { - compatible = "usb-c-connector"; -- data-role = "host"; -+ data-role = "dual"; - label = "USB-C"; - op-sink-microwatt = <1000000>; - power-role = "dual"; --- -2.36.1 - diff --git a/rpi5-initial-support.patch b/rpi5-initial-support.patch deleted file mode 100644 index 4a79f31..0000000 --- a/rpi5-initial-support.patch +++ /dev/null @@ -1,1910 +0,0 @@ -From patchwork Mon Dec 18 21:03:35 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877649 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=frMNX+46; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=IseK5QVE; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=1pz5pvm/; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=fIckdee4; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4SvC455lk9z1ydc - for ; Tue, 19 Dec 2023 08:04:05 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 92DDD8753C; - Mon, 18 Dec 2023 22:03:54 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="frMNX+46"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="IseK5QVE"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="1pz5pvm/"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="fIckdee4"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 95A7F87525; Mon, 18 Dec 2023 22:03:53 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:1]) - (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 0B37B87530 - for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id 6EE4F2228D; - Mon, 18 Dec 2023 21:03:49 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; - b=frMNX+46FgFSdyN24UT7Y4WdFDJKcOxcjH0HyyTrZsMcayuXoLtERkmRllSmLu8aRAoWOI - dzM9aX7eK9EHwuozUVijinsJ6wKpvqwxEx0Kdnj3wKPjAS3KTXGwfYiuZeO5wmbGRytEXd - p252vWhSG5L4UgaWil84yA4iM0KqiPs= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; - b=IseK5QVEh+KCaimaGVOvt6lv9A9n/uQ/xO6kky5hugt4tubeSnhwGXuCjHTIEZhYi9auSr - Q6h6Mb/o4bd7u1CQ== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933429; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; - b=1pz5pvm/SI3fxjKAlUcM+pRnK+NKLVbl/0Kj+UUQ/R29Irq4CDjfgTyaU0/DIXgn3x7Ttl - 2U7+per0J38TYiYHjQSDlrdPq4CwSFX2IEFS6sA5jx41ySG3RgO51Hh5GXKFh/WDUjcsn6 - ZPLcQCP31JjxHhULkzjaYLVYE2rQuXE= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933429; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=KH3AWH4E2OZnkKkgKspHqUQ687KHDd+TcmlhsjT4WMY=; - b=fIckdee4Yc6Iut7CdcyZnDHxDW58F+dY46W7JLg6y7iXnfDkSc0DETyb97S3ngS7GdF3OQ - HPy/QFdHWA8p8cBw== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id D359F13C92; - Mon, 18 Dec 2023 21:03:48 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id 4CUUMbSzgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:48 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T . Ivanov" -Subject: [PATCH v3 1/7] rpi5: add initial memory map for bcm2712 -Date: Mon, 18 Dec 2023 23:03:35 +0200 -Message-ID: <20231218210341.30073-2-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -Authentication-Results: smtp-out1.suse.de; - none -X-Spamd-Result: default: False [0.70 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; - TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - NEURAL_HAM_LONG(-1.00)[-1.000]; RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[11]; - MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,bedrocksystems.com:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] -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 - -From: Dmitry Malkin - -includes: -* 1GB of RAM (from 4GB or 8GB total) -* VPU memory interface -* AXI ranges (main peripherals) - -Signed-off-by: Dmitry Malkin -Signed-off-by: Ivan T. Ivanov ---- - arch/arm/mach-bcm283x/init.c | 38 +++++++++++++++++++++++++++++++++++- - 1 file changed, 37 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c -index 7265faf6ce..af23b9711a 100644 ---- a/arch/arm/mach-bcm283x/init.c -+++ b/arch/arm/mach-bcm283x/init.c -@@ -19,7 +19,7 @@ - #ifdef CONFIG_ARM64 - #include - --#define MEM_MAP_MAX_ENTRIES (4) -+#define MEM_MAP_MAX_ENTRIES (5) - - static struct mm_region bcm283x_mem_map[MEM_MAP_MAX_ENTRIES] = { - { -@@ -68,6 +68,41 @@ static struct mm_region bcm2711_mem_map[MEM_MAP_MAX_ENTRIES] = { - } - }; - -+static struct mm_region bcm2712_mem_map[MEM_MAP_MAX_ENTRIES] = { -+ { -+ .virt = 0x00000000UL, -+ .phys = 0x00000000UL, -+ .size = 0x3f800000UL, -+ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) | -+ PTE_BLOCK_INNER_SHARE -+ }, { -+ .virt = 0x3f800000UL, -+ .phys = 0x3f800000UL, -+ .size = 0x00800000UL, -+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -+ PTE_BLOCK_NON_SHARE | -+ PTE_BLOCK_PXN | PTE_BLOCK_UXN -+ }, { -+ /* Beginning of AXI bus where uSD controller lives */ -+ .virt = 0x1000000000UL, -+ .phys = 0x1000000000UL, -+ .size = 0x0002000000UL, -+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -+ PTE_BLOCK_NON_SHARE | -+ PTE_BLOCK_PXN | PTE_BLOCK_UXN -+ }, { -+ .virt = 0x107c000000UL, -+ .phys = 0x107c000000UL, -+ .size = 0x0004000000UL, -+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) | -+ PTE_BLOCK_NON_SHARE | -+ PTE_BLOCK_PXN | PTE_BLOCK_UXN -+ }, { -+ /* List terminator */ -+ 0, -+ } -+}; -+ - struct mm_region *mem_map = bcm283x_mem_map; - - /* -@@ -78,6 +113,7 @@ static const struct udevice_id board_ids[] = { - { .compatible = "brcm,bcm2837", .data = (ulong)&bcm283x_mem_map}, - { .compatible = "brcm,bcm2838", .data = (ulong)&bcm2711_mem_map}, - { .compatible = "brcm,bcm2711", .data = (ulong)&bcm2711_mem_map}, -+ { .compatible = "brcm,bcm2712", .data = (ulong)&bcm2712_mem_map}, - { }, - }; - - -From patchwork Mon Dec 18 21:03:36 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877650 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=v1KGWKJg; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=fFiq02vw; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=v1KGWKJg; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=fFiq02vw; - 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 4SvC4H2hzjz1ydc - for ; Tue, 19 Dec 2023 08:04:15 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id C85A08758C; - Mon, 18 Dec 2023 22:03:57 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="v1KGWKJg"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="fFiq02vw"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="v1KGWKJg"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="fFiq02vw"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 6F50F87530; Mon, 18 Dec 2023 22:03:54 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out2.suse.de (smtp-out2.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:2]) - (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 199488753C - for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out2.suse.de (Postfix) with ESMTPS id 1AC1A1F46E; - Mon, 18 Dec 2023 21:03:50 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; - b=v1KGWKJgJttai7C79qIEMd/XpNIgzFqndAnylh2LCSBCYnAQmHcbTcoqWFl1mbR0bCIJ2B - nnbHB6CW+/Ja2oUD0wavAmzqzhQ+ANsN8FLZ+RC4p4W0fnMs6Yz9lMDf8ozKecEdna61Q6 - 2SnPjyXAogWLFBBDalRvdzUIOIWe3Tc= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; - b=fFiq02vw2EIwrIbp2ltl5amzeQZi9NS1k/nH07K65OVAZc8eRyKu/vHbdjX58887t//OZ/ - 6LuVBS0afgkEbWCg== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; - b=v1KGWKJgJttai7C79qIEMd/XpNIgzFqndAnylh2LCSBCYnAQmHcbTcoqWFl1mbR0bCIJ2B - nnbHB6CW+/Ja2oUD0wavAmzqzhQ+ANsN8FLZ+RC4p4W0fnMs6Yz9lMDf8ozKecEdna61Q6 - 2SnPjyXAogWLFBBDalRvdzUIOIWe3Tc= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=sHJ8RNAoNPDg1bwvhFF8CpHTHHBRfcz53X69wMjqM8s=; - b=fFiq02vw2EIwrIbp2ltl5amzeQZi9NS1k/nH07K65OVAZc8eRyKu/vHbdjX58887t//OZ/ - 6LuVBS0afgkEbWCg== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7FCBC133E5; - Mon, 18 Dec 2023 21:03:49 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id AH+lHLWzgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:49 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T . Ivanov" -Subject: [PATCH v3 2/7] rpi5: Use devicetree as alternative way to read IO - base addresses -Date: Mon, 18 Dec 2023 23:03:36 +0200 -Message-ID: <20231218210341.30073-3-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -X-Spamd-Result: default: False [10.00 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; BAYES_SPAM(5.10)[100.00%]; - FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; - FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[bedrocksystems.com:email,suse.de:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[] -Authentication-Results: smtp-out2.suse.de; - none -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 - -From: Dmitry Malkin - -MBOX and Watchdog on RPi5/bcm2712 has a different base IO offsets. -Find them via devicetree blob passed by bootloader. - -Signed-off-by: Dmitry Malkin -Signed-off-by: Ivan T. Ivanov ---- - arch/arm/mach-bcm283x/include/mach/base.h | 5 ++- - arch/arm/mach-bcm283x/include/mach/mbox.h | 3 +- - arch/arm/mach-bcm283x/include/mach/sdhci.h | 3 +- - arch/arm/mach-bcm283x/include/mach/timer.h | 3 +- - arch/arm/mach-bcm283x/include/mach/wdog.h | 3 +- - arch/arm/mach-bcm283x/init.c | 43 ++++++++++++++++++---- - 6 files changed, 43 insertions(+), 17 deletions(-) - -diff --git a/arch/arm/mach-bcm283x/include/mach/base.h b/arch/arm/mach-bcm283x/include/mach/base.h -index 4ccaf69693..6de99e7ea1 100644 ---- a/arch/arm/mach-bcm283x/include/mach/base.h -+++ b/arch/arm/mach-bcm283x/include/mach/base.h -@@ -6,7 +6,10 @@ - #ifndef _BCM283x_BASE_H_ - #define _BCM283x_BASE_H_ - --extern unsigned long rpi_bcm283x_base; -+extern unsigned long rpi_mbox_base; -+extern unsigned long rpi_timer_base; -+extern unsigned long rpi_sdhci_base; -+extern unsigned long rpi_wdog_base; - - #ifdef CONFIG_ARMV7_LPAE - #ifdef CONFIG_TARGET_RPI_4_32B -diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h -index 490664f878..35d4e2f075 100644 ---- a/arch/arm/mach-bcm283x/include/mach/mbox.h -+++ b/arch/arm/mach-bcm283x/include/mach/mbox.h -@@ -38,8 +38,7 @@ - - /* Raw mailbox HW */ - --#define BCM2835_MBOX_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ -- rpi_bcm283x_base + 0x0000b880; }) -+#define BCM2835_MBOX_PHYSADDR rpi_mbox_base - - struct bcm2835_mbox_regs { - u32 read; -diff --git a/arch/arm/mach-bcm283x/include/mach/sdhci.h b/arch/arm/mach-bcm283x/include/mach/sdhci.h -index 7323690687..e837c679c4 100644 ---- a/arch/arm/mach-bcm283x/include/mach/sdhci.h -+++ b/arch/arm/mach-bcm283x/include/mach/sdhci.h -@@ -8,8 +8,7 @@ - - #include - --#define BCM2835_SDHCI_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ -- rpi_bcm283x_base + 0x00300000; }) -+#define BCM2835_SDHCI_PHYSADDR rpi_sdhci_base - - int bcm2835_sdhci_init(u32 regbase, u32 emmc_freq); - -diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h -index 5567dbd7f3..60500a256d 100644 ---- a/arch/arm/mach-bcm283x/include/mach/timer.h -+++ b/arch/arm/mach-bcm283x/include/mach/timer.h -@@ -11,8 +11,7 @@ - #include - #endif - --#define BCM2835_TIMER_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ -- rpi_bcm283x_base + 0x00003000; }) -+#define BCM2835_TIMER_PHYSADDR rpi_timer_base - - #define BCM2835_TIMER_CS_M3 (1 << 3) - #define BCM2835_TIMER_CS_M2 (1 << 2) -diff --git a/arch/arm/mach-bcm283x/include/mach/wdog.h b/arch/arm/mach-bcm283x/include/mach/wdog.h -index 9942666720..b950560674 100644 ---- a/arch/arm/mach-bcm283x/include/mach/wdog.h -+++ b/arch/arm/mach-bcm283x/include/mach/wdog.h -@@ -8,8 +8,7 @@ - - #include - --#define BCM2835_WDOG_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \ -- rpi_bcm283x_base + 0x00100000; }) -+#define BCM2835_WDOG_PHYSADDR rpi_wdog_base - - struct bcm2835_wdog_regs { - u32 unknown0[7]; -diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c -index af23b9711a..1c5c748484 100644 ---- a/arch/arm/mach-bcm283x/init.c -+++ b/arch/arm/mach-bcm283x/init.c -@@ -151,7 +151,11 @@ static void rpi_update_mem_map(void) - static void rpi_update_mem_map(void) {} - #endif - --unsigned long rpi_bcm283x_base = 0x3f000000; -+/* Default bcm283x devices addresses */ -+unsigned long rpi_mbox_base = 0x3f00b880; -+unsigned long rpi_sdhci_base = 0x3f300000; -+unsigned long rpi_wdog_base = 0x3f100000; -+unsigned long rpi_timer_base = 0x3f003000; - - int arch_cpu_init(void) - { -@@ -162,22 +166,45 @@ int arch_cpu_init(void) - - int mach_cpu_init(void) - { -- int ret, soc_offset; -+ int ret, soc, offset; - u64 io_base, size; - - rpi_update_mem_map(); - - /* Get IO base from device tree */ -- soc_offset = fdt_path_offset(gd->fdt_blob, "/soc"); -- if (soc_offset < 0) -- return soc_offset; -+ soc = fdt_path_offset(gd->fdt_blob, "/soc"); -+ if (soc < 0) -+ return soc; - -- ret = fdt_read_range((void *)gd->fdt_blob, soc_offset, 0, NULL, -- &io_base, &size); -+ ret = fdt_read_range((void *)gd->fdt_blob, soc, 0, NULL, -+ &io_base, &size); - if (ret) - return ret; - -- rpi_bcm283x_base = io_base; -+ rpi_mbox_base = io_base + 0x00b880; -+ rpi_sdhci_base = io_base + 0x300000; -+ rpi_wdog_base = io_base + 0x100000; -+ rpi_timer_base = io_base + 0x003000; -+ -+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, -+ "brcm,bcm2835-mbox"); -+ if (offset > soc) -+ rpi_mbox_base = fdt_get_base_address(gd->fdt_blob, offset); -+ -+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, -+ "brcm,bcm2835-sdhci"); -+ if (offset > soc) -+ rpi_sdhci_base = fdt_get_base_address(gd->fdt_blob, offset); -+ -+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, -+ "brcm,bcm2835-system-timer"); -+ if (offset > soc) -+ rpi_timer_base = fdt_get_base_address(gd->fdt_blob, offset); -+ -+ offset = fdt_node_offset_by_compatible(gd->fdt_blob, soc, -+ "brcm,bcm2712-pm"); -+ if (offset > soc) -+ rpi_wdog_base = fdt_get_base_address(gd->fdt_blob, offset); - - return 0; - } - -From patchwork Mon Dec 18 21:03:37 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877652 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=MuifTv9w; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=J2WonmZQ; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=driIaEaW; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=ENBj4l6/; - 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 4SvC4h1PpHz1ydc - for ; Tue, 19 Dec 2023 08:04:36 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id BC5CE87656; - Mon, 18 Dec 2023 22:03:58 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="MuifTv9w"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="J2WonmZQ"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="driIaEaW"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="ENBj4l6/"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 24B3087578; Mon, 18 Dec 2023 22:03:57 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:1]) - (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 34BC9875A0 - for ; Mon, 18 Dec 2023 22:03:52 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id B98772226F; - Mon, 18 Dec 2023 21:03:50 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; - b=MuifTv9wBEOLgWscWoGcXg+RGB8+btC5sRFciLLURyCkDcUQuguKCF0MB5CUHbvIFDKQTs - 3cu6hcIxZ1sJPOhJYAQlW90dBLsORX0sI25Eq4VgPGCsldwfrQ6KFwJmGJHKAf1t3bAtsp - bXmOjkuzkGiYTERqgRtFHlM+jbjtULk= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; - b=J2WonmZQu47jTWrv+1hYLdw1tZ+mNBDcST4N3FHxlTW7EY6hSg3i0FkVDYqumfQMZdddMp - jagUtFA6k1hguwCQ== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; - b=driIaEaWsaR+g9AcK8SGiaVWp2t8QtO7GFM918C1n2Mg0Ag01KOyoFkVXAvjXENou/caP6 - mszp+EvY1mp+ZR5gwQMkbkHBxQ10VWiFHcSdpA6ZicAD8PbXnb4DO5mEFRyVbxDu6b9fHp - mNp6oBcymc5k4gJFdfomnV1ubqgcp38= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933430; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=fHScQy8dlQ4zBcmmXyg7xTO2N+HoZRyPs/mSsXUaidA=; - b=ENBj4l6/3jkDUxi4yY5WR8ECQN9jENKPjLTTKM7yT4ET1rZJ3jbU297szl97aZN4oQ41A9 - z8StT2qNvcfjYQCA== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2AC2D13C93; - Mon, 18 Dec 2023 21:03:50 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id EE/zB7azgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:50 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 3/7] rpi5: Use devicetree to retrieve board revision -Date: Mon, 18 Dec 2023 23:03:37 +0200 -Message-ID: <20231218210341.30073-4-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -Authentication-Results: smtp-out1.suse.de; - none -X-Spamd-Result: default: False [1.14 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; - TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - NEURAL_HAM_LONG(-1.00)[-1.000]; - R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; - RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - NEURAL_HAM_SHORT(-0.20)[-1.000]; RCPT_COUNT_SEVEN(0.00)[11]; - MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-2.56)[98.03%] -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 - -Firmware on RPi5 return error on board revision query -through firmware interface, but on the other hand it fills -"linux,revision" in "system" node, so use it to detect board -revision. - - system { - linux,revision = <0xc04170>; - linux,serial = <0x6cf44e80 0x3c533ede>; - }; - -Signed-off-by: Ivan T. Ivanov ---- - board/raspberrypi/rpi/rpi.c | 22 +++++++++++++++++++--- - 1 file changed, 19 insertions(+), 3 deletions(-) - -diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c -index cd823ad746..2851ebc985 100644 ---- a/board/raspberrypi/rpi/rpi.c -+++ b/board/raspberrypi/rpi/rpi.c -@@ -171,6 +171,11 @@ static const struct rpi_model rpi_models_new_scheme[] = { - DTB_DIR "bcm2711-rpi-cm4.dtb", - true, - }, -+ [0x17] = { -+ "5 Model B", -+ DTB_DIR "bcm2712-rpi-5-b.dtb", -+ true, -+ }, - }; - - static const struct rpi_model rpi_models_old_scheme[] = { -@@ -429,15 +434,27 @@ static void get_board_revision(void) - int ret; - const struct rpi_model *models; - uint32_t models_count; -+ ofnode node; - - BCM2835_MBOX_INIT_HDR(msg); - BCM2835_MBOX_INIT_TAG(&msg->get_board_rev, GET_BOARD_REV); - - ret = bcm2835_mbox_call_prop(BCM2835_MBOX_PROP_CHAN, &msg->hdr); - if (ret) { -- printf("bcm2835: Could not query board revision\n"); - /* Ignore error; not critical */ -- return; -+ node = ofnode_path("/system"); -+ if (!ofnode_valid(node)) { -+ printf("bcm2835: Could not find /system node\n"); -+ return; -+ } -+ -+ ret = ofnode_read_u32(node, "linux,revision", &revision); -+ if (ret) { -+ printf("bcm2835: Could not find linux,revision\n"); -+ return; -+ } -+ } else { -+ revision = msg->get_board_rev.body.resp.rev; - } - - /* -@@ -451,7 +468,6 @@ static void get_board_revision(void) - * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250 - * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594 - */ -- revision = msg->get_board_rev.body.resp.rev; - if (revision & 0x800000) { - rev_scheme = 1; - rev_type = (revision >> 4) & 0xff; - -From patchwork Mon Dec 18 21:03:38 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877651 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=v2vbP3rz; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=DCEhbGvW; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=v2vbP3rz; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=DCEhbGvW; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4SvC4X1dxWz1ydc - for ; Tue, 19 Dec 2023 08:04:28 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 516EE875B6; - Mon, 18 Dec 2023 22:03:58 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="v2vbP3rz"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="DCEhbGvW"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="v2vbP3rz"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="DCEhbGvW"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id B3A6E87578; Mon, 18 Dec 2023 22:03:55 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) - (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 AF6918758C - for ; Mon, 18 Dec 2023 22:03:51 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id 601C222298; - Mon, 18 Dec 2023 21:03:51 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; - b=v2vbP3rzM/o63ofFdDaxhtUv68QFa8UxlaWLBU0PN+7PKXtZUGyrKBSmhVzxTM42FyEF7w - 9fus9/ORTaMw41AMi4qeWNQkin7gz4BF2qAFQuYSksnSgsT4Jul8n1YBBmIDx1keXZtfAW - uJZcfMM7pykF11NRMTvI38ZkyYm3ueQ= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; - b=DCEhbGvWPmgWKvfaoSUDgZ/cuuHGUnp9FvtlFeMSL2WTlsc5F+jQrl+8kVn2Yr5wDXUi8w - yyGhdRc4ihbp3tAg== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; - b=v2vbP3rzM/o63ofFdDaxhtUv68QFa8UxlaWLBU0PN+7PKXtZUGyrKBSmhVzxTM42FyEF7w - 9fus9/ORTaMw41AMi4qeWNQkin7gz4BF2qAFQuYSksnSgsT4Jul8n1YBBmIDx1keXZtfAW - uJZcfMM7pykF11NRMTvI38ZkyYm3ueQ= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933431; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=g18N3OoUCORUbBwvzPY0/IHAtBrY9++PtXkkmDrbHl4=; - b=DCEhbGvWPmgWKvfaoSUDgZ/cuuHGUnp9FvtlFeMSL2WTlsc5F+jQrl+8kVn2Yr5wDXUi8w - yyGhdRc4ihbp3tAg== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C77BF133E5; - Mon, 18 Dec 2023 21:03:50 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id cKI3LrazgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:50 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 4/7] bcm2835: brcm, - bcm2708-fb device is using r5g6b5 format -Date: Mon, 18 Dec 2023 23:03:38 +0200 -Message-ID: <20231218210341.30073-5-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -X-Spamd-Result: default: False [4.90 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; - TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; - RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-0.00)[34.66%] -Authentication-Results: smtp-out1.suse.de; - none -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 - -brcm,bcm2708-fb device provided by firmware on RPi5 uses -16 bits per pixel. Update driver to properly handle this. - -Signed-off-by: Ivan T. Ivanov ---- - drivers/video/bcm2835.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c -index 14942526f1..245c958b6e 100644 ---- a/drivers/video/bcm2835.c -+++ b/drivers/video/bcm2835.c -@@ -43,7 +43,7 @@ static int bcm2835_video_probe(struct udevice *dev) - - uc_priv->xsize = w; - uc_priv->ysize = h; -- uc_priv->bpix = VIDEO_BPP32; -+ uc_priv->bpix = dev_get_driver_data(dev); - plat->base = fb_base; - plat->size = fb_size; - -@@ -51,11 +51,11 @@ static int bcm2835_video_probe(struct udevice *dev) - } - - static const struct udevice_id bcm2835_video_ids[] = { -- { .compatible = "brcm,bcm2835-hdmi" }, -- { .compatible = "brcm,bcm2711-hdmi0" }, -- { .compatible = "brcm,bcm2708-fb" }, -+ { .compatible = "brcm,bcm2835-hdmi", .data = VIDEO_BPP32}, -+ { .compatible = "brcm,bcm2711-hdmi0", .data = VIDEO_BPP32}, -+ { .compatible = "brcm,bcm2708-fb", .data = VIDEO_BPP16 }, - #if !IS_ENABLED(CONFIG_VIDEO_DT_SIMPLEFB) -- { .compatible = "simple-framebuffer" }, -+ { .compatible = "simple-framebuffer", .data = VIDEO_BPP32}, - #endif - { } - }; - -From patchwork Mon Dec 18 21:03:39 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877653 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=NbGv/QjH; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=mv0vjv7/; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=NbGv/QjH; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=mv0vjv7/; - 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 4SvC4s5T6Bz1ydc - for ; Tue, 19 Dec 2023 08:04:45 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 3B87487227; - Mon, 18 Dec 2023 22:04:02 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="NbGv/QjH"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="mv0vjv7/"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="NbGv/QjH"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="mv0vjv7/"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id AC0FC874F3; Mon, 18 Dec 2023 22:03:57 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:1]) - (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 8349D875DB - for ; Mon, 18 Dec 2023 22:03:52 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [10.150.64.97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id 07C81222A0; - Mon, 18 Dec 2023 21:03:52 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; - b=NbGv/QjHBl2RkJvR6nKp9uvf3bewa/Jp5ykWs/ULuKNb1e1kp0q0TCiM3d88QGrhaOkktM - ARQoLZXxNSqS1EXqsPA7VQyuJpg3iM74I+GTJfNdlIDDYeA4JLrY6MexUOxdVl1EgxjaPf - 8qkaGm9uEwoD2sactKTn0rgBg5C7Ej0= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; - b=mv0vjv7/43Gm9IJuOWZT6NQDNDmZdNrBoTyjx7Yu5AAnyTgKtyFYldUlt18PDNHm701rhG - AxUSg7hqv1qJTiDg== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; - b=NbGv/QjHBl2RkJvR6nKp9uvf3bewa/Jp5ykWs/ULuKNb1e1kp0q0TCiM3d88QGrhaOkktM - ARQoLZXxNSqS1EXqsPA7VQyuJpg3iM74I+GTJfNdlIDDYeA4JLrY6MexUOxdVl1EgxjaPf - 8qkaGm9uEwoD2sactKTn0rgBg5C7Ej0= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=uP1ZnUgZbbfrrj9GCsaBsy/nQj7H8r6do86LEnTV99Y=; - b=mv0vjv7/43Gm9IJuOWZT6NQDNDmZdNrBoTyjx7Yu5AAnyTgKtyFYldUlt18PDNHm701rhG - AxUSg7hqv1qJTiDg== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 6FAB513C92; - Mon, 18 Dec 2023 21:03:51 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id YHTRGLezgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:51 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 5/7] mmc: bcmstb: Add support for bcm2712 SD controller -Date: Mon, 18 Dec 2023 23:03:39 +0200 -Message-ID: <20231218210341.30073-6-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -X-Spamd-Result: default: False [1.90 / 50.00]; ARC_NA(0.00)[]; - RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; - TO_DN_SOME(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - R_MISSING_CHARSET(2.50)[]; MIME_GOOD(-0.10)[text/plain]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; BROKEN_CONTENT_TYPE(1.50)[]; - R_RATELIMIT(0.00)[to_ip_from(RL9dd9h8xg9qpm5f14t9e5w4zz)]; - RCVD_COUNT_THREE(0.00)[3]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCPT_COUNT_SEVEN(0.00)[11]; MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; - FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; BAYES_HAM(-3.00)[100.00%] -Authentication-Results: smtp-out1.suse.de; - none -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 - -Borrow SD quirks from vendor Linux driver. - -"BCM2712 unfortunately carries with it a perennial bug with the SD -controller register interface present on previous chips (2711/2709/2708). -Accesses must be dword-sized and a read-modify-write cycle to the 32-bit -registers containing the COMMAND, TRANSFER_MODE, BLOCK_SIZE and -BLOCK_COUNT registers tramples the upper/lower 16 bits of data written. -BCM2712 does not seem to need the extreme delay between each write as on -previous chips, just the serialisation of writes to these registers in a -single 32-bit operation." - -Signed-off-by: Ivan T. Ivanov ---- - drivers/mmc/bcmstb_sdhci.c | 173 ++++++++++++++++++++++++++++++++++++- - 1 file changed, 172 insertions(+), 1 deletion(-) - -diff --git a/drivers/mmc/bcmstb_sdhci.c b/drivers/mmc/bcmstb_sdhci.c -index dc96818cff..21489e66c0 100644 ---- a/drivers/mmc/bcmstb_sdhci.c -+++ b/drivers/mmc/bcmstb_sdhci.c -@@ -38,6 +38,16 @@ - */ - #define BCMSTB_SDHCI_MINIMUM_CLOCK_FREQUENCY 400000 - -+#define SDIO_CFG_CTRL 0x0 -+#define SDIO_CFG_CTRL_SDCD_N_TEST_EN BIT(31) -+#define SDIO_CFG_CTRL_SDCD_N_TEST_LEV BIT(30) -+ -+#define SDIO_CFG_SD_PIN_SEL 0x44 -+#define SDIO_CFG_SD_PIN_SEL_MASK 0x3 -+#define SDIO_CFG_SD_PIN_SEL_CARD BIT(1) -+ -+#define REG_OFFSET_IN_BITS(reg) ((reg) << 3 & 0x18) -+ - /* - * This driver has only been tested with eMMC devices; SD devices may - * not work. -@@ -47,6 +57,53 @@ struct sdhci_bcmstb_plat { - struct mmc mmc; - }; - -+struct sdhci_bcmstb_host { -+ struct sdhci_host host; -+ u32 shadow_cmd; -+ u32 shadow_blk; -+ bool is_cmd_shadowed; -+ bool is_blk_shadowed; -+}; -+ -+struct sdhci_brcmstb_dev_priv { -+ int (*init)(struct udevice *dev); -+ struct sdhci_ops *ops; -+}; -+ -+static inline struct sdhci_bcmstb_host *to_bcmstb_host(struct sdhci_host *host) -+{ -+ return container_of(host, struct sdhci_bcmstb_host, host); -+} -+ -+static int sdhci_brcmstb_init_2712(struct udevice *dev) -+{ -+ struct sdhci_host *host = dev_get_priv(dev); -+ void *cfg_regs; -+ u32 reg; -+ -+ /* Map in the non-standard CFG registers */ -+ cfg_regs = dev_remap_addr_name(dev, "cfg"); -+ if (!cfg_regs) -+ return -ENOENT; -+ -+ if ((host->mmc->host_caps & MMC_CAP_NONREMOVABLE) || -+ (host->mmc->host_caps & MMC_CAP_NEEDS_POLL)) { -+ /* Force presence */ -+ reg = readl(cfg_regs + SDIO_CFG_CTRL); -+ reg &= ~SDIO_CFG_CTRL_SDCD_N_TEST_LEV; -+ reg |= SDIO_CFG_CTRL_SDCD_N_TEST_EN; -+ writel(reg, cfg_regs + SDIO_CFG_CTRL); -+ } else { -+ /* Enable card detection line */ -+ reg = readl(cfg_regs + SDIO_CFG_SD_PIN_SEL); -+ reg &= ~SDIO_CFG_SD_PIN_SEL_MASK; -+ reg |= SDIO_CFG_SD_PIN_SEL_CARD; -+ writel(reg, cfg_regs + SDIO_CFG_SD_PIN_SEL); -+ } -+ -+ return 0; -+} -+ - static int sdhci_bcmstb_bind(struct udevice *dev) - { - struct sdhci_bcmstb_plat *plat = dev_get_plat(dev); -@@ -58,10 +115,14 @@ static int sdhci_bcmstb_probe(struct udevice *dev) - { - struct mmc_uclass_priv *upriv = dev_get_uclass_priv(dev); - struct sdhci_bcmstb_plat *plat = dev_get_plat(dev); -- struct sdhci_host *host = dev_get_priv(dev); -+ struct sdhci_bcmstb_host *bcmstb = dev_get_priv(dev); -+ struct sdhci_host *host = &bcmstb->host; -+ struct sdhci_brcmstb_dev_priv *dev_priv; - fdt_addr_t base; - int ret; - -+ dev_priv = (struct sdhci_brcmstb_dev_priv *)dev_get_driver_data(dev); -+ - base = dev_read_addr(dev); - if (base == FDT_ADDR_T_NONE) - return -EINVAL; -@@ -75,6 +136,10 @@ static int sdhci_bcmstb_probe(struct udevice *dev) - - host->mmc = &plat->mmc; - host->mmc->dev = dev; -+ -+ if (dev_priv && dev_priv->ops) -+ host->ops = dev_priv->ops; -+ - ret = sdhci_setup_cfg(&plat->cfg, host, - BCMSTB_SDHCI_MAXIMUM_CLOCK_FREQUENCY, - BCMSTB_SDHCI_MINIMUM_CLOCK_FREQUENCY); -@@ -84,10 +149,116 @@ static int sdhci_bcmstb_probe(struct udevice *dev) - upriv->mmc = &plat->mmc; - host->mmc->priv = host; - -+ if (dev_priv && dev_priv->init) { -+ ret = dev_priv->init(dev); -+ if (ret) -+ return ret; -+ } -+ - return sdhci_probe(dev); - } - -+static u16 sdhci_brcmstb_32bits_readw(struct sdhci_host *host, int reg) -+{ -+ struct sdhci_bcmstb_host *bcmstb = to_bcmstb_host(host); -+ u16 word; -+ u32 val; -+ -+ if (reg == SDHCI_TRANSFER_MODE && bcmstb->is_cmd_shadowed) { -+ /* Get the saved transfer mode */ -+ val = bcmstb->shadow_cmd; -+ } else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) && -+ bcmstb->is_blk_shadowed) { -+ /* Get the saved block info */ -+ val = bcmstb->shadow_blk; -+ } else { -+ val = readl(host->ioaddr + (reg & ~3)); -+ } -+ -+ word = val >> REG_OFFSET_IN_BITS(reg) & 0xffff; -+ return word; -+} -+ -+static u8 sdhci_brcmstb_32bits_readb(struct sdhci_host *host, int reg) -+{ -+ u32 val = readl(host->ioaddr + (reg & ~3)); -+ u8 byte = val >> REG_OFFSET_IN_BITS(reg) & 0xff; -+ return byte; -+} -+ -+/* -+ * BCM2712 unfortunately carries with it a perennial bug with the SD -+ * controller register interface present on previous chips (2711/2709/2708). -+ * Accesses must be dword-sized and a read-modify-write cycle to the -+ * 32-bit registers containing the COMMAND, TRANSFER_MODE, BLOCK_SIZE and -+ * BLOCK_COUNT registers tramples the upper/lower 16 bits of data written. -+ * BCM2712 does not seem to need the extreme delay between each write as -+ * on previous chips, just the serialisation of writes to these registers -+ * in a single 32-bit operation. -+ */ -+static void sdhci_brcmstb_32bits_writew(struct sdhci_host *host, u16 val, int reg) -+{ -+ struct sdhci_bcmstb_host *bcmstb = to_bcmstb_host(host); -+ u32 word_shift = REG_OFFSET_IN_BITS(reg); -+ u32 mask = 0xffff << word_shift; -+ u32 oldval, newval; -+ -+ if (reg == SDHCI_COMMAND) { -+ /* Write the block now as we are issuing a command */ -+ if (bcmstb->is_blk_shadowed) { -+ writel(bcmstb->shadow_blk, host->ioaddr + SDHCI_BLOCK_SIZE); -+ bcmstb->is_blk_shadowed = false; -+ } -+ oldval = bcmstb->shadow_cmd; -+ bcmstb->is_cmd_shadowed = false; -+ } else if ((reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) && -+ bcmstb->is_blk_shadowed) { -+ /* Block size and count are stored in shadow reg */ -+ oldval = bcmstb->shadow_blk; -+ } else { -+ /* Read reg, all other registers are not shadowed */ -+ oldval = readl(host->ioaddr + (reg & ~3)); -+ } -+ newval = (oldval & ~mask) | (val << word_shift); -+ -+ if (reg == SDHCI_TRANSFER_MODE) { -+ /* Save the transfer mode until the command is issued */ -+ bcmstb->shadow_cmd = newval; -+ bcmstb->is_cmd_shadowed = true; -+ } else if (reg == SDHCI_BLOCK_SIZE || reg == SDHCI_BLOCK_COUNT) { -+ /* Save the block info until the command is issued */ -+ bcmstb->shadow_blk = newval; -+ bcmstb->is_blk_shadowed = true; -+ } else { -+ /* Command or other regular 32-bit write */ -+ writel(newval, host->ioaddr + (reg & ~3)); -+ } -+} -+ -+static void sdhci_brcmstb_32bits_writeb(struct sdhci_host *host, u8 val, int reg) -+{ -+ u32 oldval = readl(host->ioaddr + (reg & ~3)); -+ u32 byte_shift = REG_OFFSET_IN_BITS(reg); -+ u32 mask = 0xff << byte_shift; -+ u32 newval = (oldval & ~mask) | (val << byte_shift); -+ -+ writel(newval, host->ioaddr + (reg & ~3)); -+} -+ -+static struct sdhci_ops sdhci_brcmstb_ops_2712 = { -+ .read_b = sdhci_brcmstb_32bits_readb, -+ .read_w = sdhci_brcmstb_32bits_readw, -+ .write_w = sdhci_brcmstb_32bits_writew, -+ .write_b = sdhci_brcmstb_32bits_writeb, -+}; -+ -+static const struct sdhci_brcmstb_dev_priv match_priv_2712 = { -+ .init = sdhci_brcmstb_init_2712, -+ .ops = &sdhci_brcmstb_ops_2712, -+}; -+ - static const struct udevice_id sdhci_bcmstb_match[] = { -+ { .compatible = "brcm,bcm2712-sdhci", .data = (ulong)&match_priv_2712 }, - { .compatible = "brcm,bcm7425-sdhci" }, - { .compatible = "brcm,sdhci-brcmstb" }, - { } - -From patchwork Mon Dec 18 21:03:40 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877654 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=f/19Tx1x; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=e0CvACbS; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=f/19Tx1x; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=e0CvACbS; - 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 4SvC5339Phz1ydc - for ; Tue, 19 Dec 2023 08:04:55 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id AEFAE87561; - Mon, 18 Dec 2023 22:04:02 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="f/19Tx1x"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="e0CvACbS"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="f/19Tx1x"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="e0CvACbS"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id E31C887661; Mon, 18 Dec 2023 22:03:58 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out1.suse.de (smtp-out1.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:1]) - (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 23C28875FE - for ; Mon, 18 Dec 2023 22:03:53 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [IPv6:2a07:de40:b281:104:10:150:64:97]) - (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 smtp-out1.suse.de (Postfix) with ESMTPS id AA225222AF; - Mon, 18 Dec 2023 21:03:52 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; - b=f/19Tx1x7UFtAUz8rSw0xZAG55X0OP1hiHqEuhAMQ+G/qEfSEkg6v1FGZhP70gpNWDQQgk - sr6WvGWKDP0t+jOsv0jDi9ZDrTiDB2ge+exjUPFNEvQP3H5zrjgKVOaqBaoOeLHXs/ay0l - qSAackxgs89eelJL1qSI3XwtAjq2zlQ= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; - b=e0CvACbSltQnSYuEyv3yxtn0hfVqkwt0KNf0fBLAfLwxlC3hb9ebDGcHvra3iPCHYB22X9 - ButpL853ceVzwdDA== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; - b=f/19Tx1x7UFtAUz8rSw0xZAG55X0OP1hiHqEuhAMQ+G/qEfSEkg6v1FGZhP70gpNWDQQgk - sr6WvGWKDP0t+jOsv0jDi9ZDrTiDB2ge+exjUPFNEvQP3H5zrjgKVOaqBaoOeLHXs/ay0l - qSAackxgs89eelJL1qSI3XwtAjq2zlQ= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933432; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=cxWdlBZFlaQd53WSplsOaVVsDevGF2K3qZjhk+1T33g=; - b=e0CvACbSltQnSYuEyv3yxtn0hfVqkwt0KNf0fBLAfLwxlC3hb9ebDGcHvra3iPCHYB22X9 - ButpL853ceVzwdDA== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 15B1C133E5; - Mon, 18 Dec 2023 21:03:52 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id 8OvVArizgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:52 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 6/7] configs: rpi_arm64: enable SDHCI BCMSTB driver -Date: Mon, 18 Dec 2023 23:03:40 +0200 -Message-ID: <20231218210341.30073-7-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -Authentication-Results: smtp-out1.suse.de; - dkim=pass header.d=suse.de header.s=susede2_rsa header.b="f/19Tx1x"; - dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=e0CvACbS -X-Rspamd-Server: rspamd2.dmz-prg2.suse.org -X-Spamd-Result: default: False [-1.62 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; - RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; - SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; - TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; - BROKEN_CONTENT_TYPE(1.50)[]; RCVD_COUNT_THREE(0.00)[3]; - DKIM_TRACE(0.00)[suse.de:+]; MX_GOOD(-0.01)[]; - RCPT_COUNT_SEVEN(0.00)[11]; NEURAL_HAM_SHORT(-0.20)[-1.000]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.11)[66.45%]; - ARC_NA(0.00)[]; - R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; FROM_HAS_DN(0.00)[]; - FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; - DWL_DNSWL_HI(-3.50)[suse.de:dkim]; - NEURAL_HAM_LONG(-1.00)[-1.000]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; - FUZZY_BLOCKED(0.00)[rspamd.com]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; - RCVD_IN_DNSWL_HI(-0.50)[2a07:de40:b281:104:10:150:64:97:from] -X-Rspamd-Queue-Id: AA225222AF -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 - -RPi5 have "brcm,bcm2712-sdhci" controller which is -handled by "sdhci-bcmstb" driver, so enable it. - -Signed-off-by: Ivan T. Ivanov ---- - configs/rpi_arm64_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configs/rpi_arm64_defconfig b/configs/rpi_arm64_defconfig -index f9dade18f6..1107fd11de 100644 ---- a/configs/rpi_arm64_defconfig -+++ b/configs/rpi_arm64_defconfig -@@ -33,6 +33,7 @@ CONFIG_BCM2835_GPIO=y - CONFIG_MMC_SDHCI=y - CONFIG_MMC_SDHCI_SDMA=y - CONFIG_MMC_SDHCI_BCM2835=y -+CONFIG_MMC_SDHCI_BCMSTB=y - CONFIG_BCMGENET=y - CONFIG_PCI_BRCMSTB=y - CONFIG_PINCTRL=y - -From patchwork Mon Dec 18 21:03:41 2023 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: "Ivan T. Ivanov" -X-Patchwork-Id: 1877655 -X-Patchwork-Delegate: pbrobinson@gmail.com -Return-Path: -X-Original-To: incoming@patchwork.ozlabs.org -Delivered-To: patchwork-incoming@legolas.ozlabs.org -Authentication-Results: legolas.ozlabs.org; - dkim=pass (1024-bit key; - unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 - header.s=susede2_rsa header.b=1by1WnE8; - dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=e64lBvSE; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.a=rsa-sha256 header.s=susede2_rsa header.b=1by1WnE8; - dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 - header.s=susede2_ed25519 header.b=e64lBvSE; - 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 4SvC5H05zfz1ydc - for ; Tue, 19 Dec 2023 08:05:07 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 2FBDE87650; - Mon, 18 Dec 2023 22:04:03 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -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=suse.de header.i=@suse.de header.b="1by1WnE8"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="e64lBvSE"; - dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de - header.b="1by1WnE8"; - dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de - header.b="e64lBvSE"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 5D01C876A4; Mon, 18 Dec 2023 22:03:59 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from smtp-out2.suse.de (smtp-out2.suse.de - [IPv6:2a07:de40:b251:101:10:150:64:2]) - (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 C279687509 - for ; Mon, 18 Dec 2023 22:03:53 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=suse.de -Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=iivanov@suse.de -Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org - [IPv6:2a07:de40:b281:104:10:150:64:97]) - (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 smtp-out2.suse.de (Postfix) with ESMTPS id 5507C1F6E6; - Mon, 18 Dec 2023 21:03:53 +0000 (UTC) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933433; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; - b=1by1WnE818KeyiiUhS0PLD7P0c+SSwVEcIdSwLVDSj6t8vZK9vpPNROZRCB9WlZtgGyGUU - JlRP9h5PowjYnh5OWRH6KbjZ19MG+Fu3rWcMQ+gET5ljKGaRAtFv2t0gDAtmZGheOkf5pW - KEDUZYxYceI7JKlWcX6QlIjexymId9w= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933433; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; - b=e64lBvSEDRhrUCpOd2eVMasuXC6PFNm5B1yOGeNNS+E2HREmMMam1YM4RObadB2tdux/T3 - Galw853x9Gm0wpDA== -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_rsa; - t=1702933433; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; - b=1by1WnE818KeyiiUhS0PLD7P0c+SSwVEcIdSwLVDSj6t8vZK9vpPNROZRCB9WlZtgGyGUU - JlRP9h5PowjYnh5OWRH6KbjZ19MG+Fu3rWcMQ+gET5ljKGaRAtFv2t0gDAtmZGheOkf5pW - KEDUZYxYceI7JKlWcX6QlIjexymId9w= -DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; - s=susede2_ed25519; t=1702933433; - h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: - mime-version:mime-version: - content-transfer-encoding:content-transfer-encoding: - in-reply-to:in-reply-to:references:references; - bh=HvUCimMaJ6xrQSSzUxalPI2wxDMnSXJwzMxo+y9/IFo=; - b=e64lBvSEDRhrUCpOd2eVMasuXC6PFNm5B1yOGeNNS+E2HREmMMam1YM4RObadB2tdux/T3 - Galw853x9Gm0wpDA== -Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) - (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BB17413C92; - Mon, 18 Dec 2023 21:03:52 +0000 (UTC) -Received: from dovecot-director2.suse.de ([10.150.64.162]) - by imap1.dmz-prg2.suse.org with ESMTPSA id 0JQfK7izgGUtZAAAD6G6ig - (envelope-from ); Mon, 18 Dec 2023 21:03:52 +0000 -From: "Ivan T. Ivanov" -To: Matthias Brugger , - Peter Robinson -Cc: Dmitry Malkin , - Thomas Fitzsimmons , Peng Fan , - Jaehoon Chung , Anatolij Gustschin , - wahrenst@gmx.net, florian.fainelli@broadcom.com, u-boot@lists.denx.de, - "Ivan T. Ivanov" -Subject: [PATCH v3 7/7] pci: pcie-brcmstb: Add bcm2712 PCIe controller support -Date: Mon, 18 Dec 2023 23:03:41 +0200 -Message-ID: <20231218210341.30073-8-iivanov@suse.de> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20231218210341.30073-1-iivanov@suse.de> -References: <20231218210341.30073-1-iivanov@suse.de> -MIME-Version: 1.0 -X-Rspamd-Server: rspamd1.dmz-prg2.suse.org -X-Spamd-Bar: / -X-Spamd-Result: default: False [-0.31 / 50.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; - RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; - TO_DN_SOME(0.00)[]; R_MISSING_CHARSET(2.50)[]; - BROKEN_CONTENT_TYPE(1.50)[]; - R_RATELIMIT(0.00)[to_ip_from(RLccgikja4sxqnupiwsfdm9q1r)]; - RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[suse.de:+]; - MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[11]; - FREEMAIL_TO(0.00)[suse.com,gmail.com]; FROM_EQ_ENVFROM(0.00)[]; - MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[27.73%]; - ARC_NA(0.00)[]; - R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - RCVD_DKIM_ARC_DNSWL_HI(-1.00)[]; FROM_HAS_DN(0.00)[]; - FREEMAIL_ENVRCPT(0.00)[gmail.com,gmx.net]; - TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; - DWL_DNSWL_HI(-3.50)[suse.de:dkim]; - DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; - MID_CONTAINS_FROM(1.00)[]; - DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email]; - FUZZY_BLOCKED(0.00)[rspamd.com]; - FREEMAIL_CC(0.00)[bedrocksystems.com,fitzsim.org,nxp.com,samsung.com,denx.de,gmx.net,broadcom.com,lists.denx.de,suse.de]; - RCVD_TLS_ALL(0.00)[]; - RCVD_IN_DNSWL_HI(-0.50)[2a07:de40:b281:104:10:150:64:97:from] -Authentication-Results: smtp-out2.suse.de; - dkim=pass header.d=suse.de header.s=susede2_rsa header.b=1by1WnE8; - dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=e64lBvSE -X-Rspamd-Queue-Id: 5507C1F6E6 -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 - -PCIe controller have minor register map difference compared -to bcm2711 variant. Handle this using device specific register -offset. - -Signed-off-by: Ivan T. Ivanov ---- - drivers/pci/pcie_brcmstb.c | 23 +++++++++++++++++++---- - 1 file changed, 19 insertions(+), 4 deletions(-) - -diff --git a/drivers/pci/pcie_brcmstb.c b/drivers/pci/pcie_brcmstb.c -index cd45f0bee9..d63e715b2e 100644 ---- a/drivers/pci/pcie_brcmstb.c -+++ b/drivers/pci/pcie_brcmstb.c -@@ -90,7 +90,6 @@ - #define PCIE_MEM_WIN0_LIMIT_HI(win) \ - PCIE_MISC_CPU_2_PCIE_MEM_WIN0_LIMIT_HI + ((win) * 8) - --#define PCIE_MISC_HARD_PCIE_HARD_DEBUG 0x4204 - #define PCIE_HARD_DEBUG_SERDES_IDDQ_MASK 0x08000000 - - #define PCIE_MSI_INTR2_CLR 0x4508 -@@ -131,6 +130,10 @@ - #define SSC_STATUS_PLL_LOCK_MASK 0x800 - #define SSC_STATUS_PLL_LOCK_SHIFT 11 - -+struct pcie_cfg_data { -+ unsigned long hard_debug_offs; -+}; -+ - /** - * struct brcm_pcie - the PCIe controller state - * @base: Base address of memory mapped IO registers of the controller -@@ -141,6 +144,7 @@ - struct brcm_pcie { - void __iomem *base; - -+ struct pcie_cfg_data *cfg; - int gen; - bool ssc; - }; -@@ -458,7 +462,7 @@ static int brcm_pcie_probe(struct udevice *dev) - /* Take the bridge out of reset */ - clrbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_INIT_MASK); - -- clrbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG, -+ clrbits_le32(base + pcie->cfg->hard_debug_offs, - PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - - /* Wait for SerDes to be stable */ -@@ -599,7 +603,7 @@ static int brcm_pcie_remove(struct udevice *dev) - setbits_le32(base + PCIE_RGR1_SW_INIT_1, RGR1_SW_INIT_1_PERST_MASK); - - /* Turn off SerDes */ -- setbits_le32(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG, -+ setbits_le32(base + pcie->cfg->hard_debug_offs, - PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); - - /* Shutdown bridge */ -@@ -620,6 +624,8 @@ static int brcm_pcie_of_to_plat(struct udevice *dev) - if (!pcie->base) - return -EINVAL; - -+ pcie->cfg = (struct pcie_cfg_data *)dev_get_driver_data(dev); -+ - pcie->ssc = ofnode_read_bool(dn, "brcm,enable-ssc"); - - ret = ofnode_read_u32(dn, "max-link-speed", &max_link_speed); -@@ -636,8 +642,17 @@ static const struct dm_pci_ops brcm_pcie_ops = { - .write_config = brcm_pcie_write_config, - }; - -+static const struct pcie_cfg_data bcm2711_cfg = { -+ .hard_debug_offs = 0x4204 -+}; -+ -+static const struct pcie_cfg_data bcm2712_cfg = { -+ .hard_debug_offs = 0x4304 -+}; -+ - static const struct udevice_id brcm_pcie_ids[] = { -- { .compatible = "brcm,bcm2711-pcie" }, -+ { .compatible = "brcm,bcm2711-pcie", .data = (ulong)&bcm2711_cfg }, -+ { .compatible = "brcm,bcm2712-pcie", .data = (ulong)&bcm2712_cfg }, - { } - }; - diff --git a/sources b/sources index 8f50a6d..be81335 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.04-rc2.tar.bz2) = f5c6d6a37ce6b34bd1ab2cddd5d0cacddfd19b5345934731df3a7ed454a3895ad2d14acbdb2e1b922b9571778e50b54cb7612b1798a04dfb991365d3344cd865 +SHA512 (u-boot-2024.04-rc3.tar.bz2) = 75f36d57330e771dd3757c49d576b3a7f1c933dad9a102f22d2438286a763f0ec7deae863a97559cac48be8fc736b68a5292b4383d45178b111bd08134352e38 diff --git a/uboot-tools.spec b/uboot-tools.spec index eb2f4a3..4d006c4 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc2 +%global candidate rc3 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.04 -Release: 0.2%{?candidate:.%{candidate}}%{?dist} +Release: 0.3%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -17,17 +17,23 @@ ExcludeArch: s390x Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}%{?candidate:-%{candidate}}.tar.bz2 Source1: aarch64-boards +# This is now legacy, most devices use bootflow, we keep this for the laggards Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch -Patch2: disable-VBE-by-default.patch +# Identify VFAT partitions as ESP, allows EFI setvar on our images +Patch2: uefi-Add-all-options-for-EFI-System-Partitions.patch +# New function to find fdt for loading from disk +#Patch3: +# Fedora patches to enable/disable features +Patch4: disable-VBE-by-default.patch Patch5: enable-bootmenu-by-default.patch -Patch7: Add-video-damage-tracking.patch +# Should be upstream but it's taking time +Patch6: Add-video-damage-tracking.patch # Board fixes and enablement # RPi - uses RPI firmware device tree for HAT support Patch10: rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch # Rockchips improvements Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch -#Patch12: 0001-Revert-rockchip-rockpro64-Build-u-boot-rockchip-spi..patch BuildRequires: bc BuildRequires: bison @@ -87,22 +93,27 @@ do mkdir builds/$(echo $board)/ # ATF selection, needs improving, suggestions of ATF SoC to Board matrix welcome - sun50i=(a64-olinuxino amarula_a64_relic bananapi_m2_plus_h5 bananapi_m64 libretech_all_h3_cc_h5 nanopi_a64 nanopi_neo2 nanopi_neo_plus2 orangepi_pc2 orangepi_prime orangepi_win orangepi_zero_plus orangepi_zero_plus2 pine64-lts pine64_plus pinebook pinephone pinetab sopine_baseboard teres_i) + sun50i=(a64-olinuxino a64-olinuxino-emmc amarula_a64_relic bananapi_m2_plus_h5 bananapi_m64 libretech_all_h3_cc_h5 nanopi_a64 nanopi_neo2 nanopi_neo_plus2 oceanic_5205_5inmfd orangepi_pc2 orangepi_prime orangepi_win orangepi_zero_plus orangepi_zero_plus2 pine64-lts pine64_plus pinebook pinephone pinetab sopine_baseboard teres_i) if [[ " ${sun50i[*]} " == *" $board "* ]]; then echo "Board: $board using sun50i_a64" - cp /usr/share/arm-trusted-firmware/sun50i_a64/* builds/$(echo $board)/ + cp /usr/share/arm-trusted-firmware/sun50i_a64/bl31.bin builds/$(echo $board)/atf-bl31 fi - sun50h6=(beelink_gs1 orangepi_3 orangepi_lite2 orangepi_one_plus orangepi_zero2 pine_h64 tanix_tx6) + sun50h6=(beelink_gs1 emlid_neutis_n5_devboard orangepi_3 orangepi_lite2 orangepi_one_plus pine_h64 tanix_tx6) if [[ " ${sun50h6[*]} " == *" $board "* ]]; then echo "Board: $board using sun50i_h6" - cp /usr/share/arm-trusted-firmware/sun50i_h6/* builds/$(echo $board)/ + cp /usr/share/arm-trusted-firmware/sun50i_h6/bl31.bin builds/$(echo $board)/atf-bl31 fi - rk3328=(evb-rk3328 nanopi-r2s-rk3328 rock64-rk3328 rock-pi-e-rk3328 roc-cc-rk3328) + sun50i_h616=(orangepi_zero2 orangepi_zero3 transpeed-8k618-t x96_mate) + if [[ " ${sun50i_h616[*]} " == *" $board "* ]]; then + echo "Board: $board using sun50i_h616" + cp /usr/share/arm-trusted-firmware/sun50i_h616/bl31.bin builds/$(echo $board)/atf-bl31 + fi + rk3328=(evb-rk3328 nanopi-r2c-plus-rk3328 nanopi-r2c-rk3328 nanopi-r2s-rk3328 orangepi-r1-plus-lts-rk3328 orangepi-r1-plus-rk3328 roc-cc-rk3328 rock64-rk3328 rock-pi-e-rk3328) if [[ " ${rk3328[*]} " == *" $board "* ]]; then echo "Board: $board using rk3328" cp /usr/share/arm-trusted-firmware/rk3328/bl31.elf builds/$(echo $board)/atf-bl31 fi - rk3399=(evb-rk3399 ficus-rk3399 firefly-rk3399 khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 leez-rk3399 nanopc-t4-rk3399 nanopi-m4-2gb-rk3399 nanopi-m4b-rk3399 nanopi-m4-rk3399 nanopi-neo4-rk3399 nanopi-r4s-rk3399 orangepi-rk3399 pinebook-pro-rk3399 pinephone-pro-rk3399 puma-rk3399 rock960-rk3399 rock-pi-4c-rk3399 rock-pi-4-rk3399 rock-pi-n10-rk3399pro rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399 eaidk-610-rk3399) + rk3399=(eaidk-610-rk3399 evb-rk3399 ficus-rk3399 firefly-rk3399 khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 leez-rk3399 nanopc-t4-rk3399 nanopi-m4-2gb-rk3399 nanopi-m4b-rk3399 nanopi-m4-rk3399 nanopi-neo4-rk3399 nanopi-r4s-rk3399 orangepi-rk3399 pinebook-pro-rk3399 pinephone-pro-rk3399 puma-rk3399 rock960-rk3399 rock-pi-4c-rk3399 rock-pi-4-rk3399 rock-pi-n10-rk3399pro rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399) if [[ " ${rk3399[*]} " == *" $board "* ]]; then echo "Board: $board using rk3399" cp /usr/share/arm-trusted-firmware/rk3399/* builds/$(echo $board)/ @@ -113,17 +124,6 @@ do BINMAN_ALLOW_MISSING=1 make $(echo $board)_defconfig O=builds/$(echo $board)/ BINMAN_ALLOW_MISSING=1 %make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" O=builds/$(echo $board)/ - # build spi images for rockchip boards with SPI flash - rkspi=(rock64-rk3328) - if [[ " ${rkspi[*]} " == *" $board "* ]]; then - echo "Board: $board with SPI flash" - builds/$(echo $board)/tools/mkimage -n rk3328 -T rkspi -d builds/$(echo $board)/tpl/u-boot-tpl.bin:builds/$(echo $board)/spl/u-boot-spl.bin builds/$(echo $board)/idbloader.spi - fi - rkspi=(evb-rk3399 khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 nanopc-t4-rk3399 pinebook-pro-rk3399 pinephone-pro-rk3399 rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399) - if [[ " ${rkspi[*]} " == *" $board "* ]]; then - echo "Board: $board with SPI flash" - builds/$(echo $board)/tools/mkimage -n rk3399 -T rkspi -d builds/$(echo $board)/tpl/u-boot-tpl.bin:builds/$(echo $board)/spl/u-boot-spl.bin builds/$(echo $board)/idbloader.spi - fi done %endif @@ -138,39 +138,24 @@ mkdir -p %{buildroot}%{_datadir}/uboot/ %ifarch aarch64 for board in $(ls builds) do - mkdir -p %{buildroot}%{_datadir}/uboot/$(echo $board)/ - for file in u-boot.bin u-boot.dtb u-boot.img u-boot-dtb.img u-boot.itb u-boot-sunxi-with-spl.bin u-boot-rockchip.bin idbloader.img idbloader.spi spl/boot.bin spl/sunxi-spl.bin + for file in u-boot.bin u-boot.img u-boot-dtb.img u-boot.itb u-boot-sunxi-with-spl.bin u-boot-rockchip.bin idbloader.img idbloader-spi.img spl/boot.bin do if [ -f builds/$(echo $board)/$(echo $file) ]; then - install -p -m 0644 builds/$(echo $board)/$(echo $file) %{buildroot}%{_datadir}/uboot/$(echo $board)/ + install -pD -m 0644 builds/$(echo $board)/$(echo $file) %{buildroot}%{_datadir}/uboot/$(echo $board)/$(echo $file) fi done done -# For Apple M1 we also need the nodtb variant -install -p -m 0644 builds/apple_m1/u-boot-nodtb.bin %{buildroot}%{_datadir}/uboot/apple_m1/u-boot-nodtb.bin -%endif +# For Apple M-series we also need the nodtb variant +install -pD -m 0644 builds/apple_m1/u-boot-nodtb.bin %{buildroot}%{_datadir}/uboot/apple_m1/u-boot-nodtb.bin # Bit of a hack to remove binaries we don't use as they're large -%ifarch aarch64 for board in $(ls builds) do rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.dtb if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot-sunxi-with-spl.bin ]; then rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot{,-dtb}.* - fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/MLO ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin - fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/SPL ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin - fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.imx ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin - fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot-spl.kwb ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.* - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot-spl.bin + rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/sunxi-spl.bin fi if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/idbloader.img ]; then rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin @@ -194,16 +179,23 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %doc doc/develop/uefi doc/usage doc/arch/arm64.rst %{_bindir}/* %{_mandir}/man1/mkimage.1* -%dir %{_datadir}/uboot/ %if %{with toolsonly} %ifarch aarch64 %files -n uboot-images-armv8 +%dir %{_datadir}/uboot/ %{_datadir}/uboot/* %endif %endif %changelog +* Thu Feb 29 2024 Peter Robinson - 1:2024.04-0.3.rc3 +- Update to 2024.04 RC3 +- Enable a number of new upstream devices +- Upstream now builds Rockchip SPI artifacts +- Various cleanups +- Fix ESP partition detection to enable EFI vars + * Wed Feb 14 2024 Peter Robinson - 1:2024.04-0.2.rc2 - Update to 2024.04 RC2 diff --git a/uefi-Add-all-options-for-EFI-System-Partitions.patch b/uefi-Add-all-options-for-EFI-System-Partitions.patch new file mode 100644 index 0000000..22c5bcc --- /dev/null +++ b/uefi-Add-all-options-for-EFI-System-Partitions.patch @@ -0,0 +1,36 @@ +From 7ce45304053f31afaea6b80305aaee164c2e260a Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Wed, 21 Feb 2024 14:43:16 +0000 +Subject: [PATCH] disk: dos: Add all options for EFI System Partitions + +The EFI spec states that the ESP can be any of FAT12/16/32 but for +compatibility doesn't necssarily require the partition to be the +EFI partition table ID of 0xef. A number of arm devices will not +find their firmware on a FAT partition with an ID of 0xef so also +allow the original FAT12/16/32 partition IDs as they are also +permissable for an ESP. + +Signed-off-by: Peter Robinson +--- + disk/part_dos.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/disk/part_dos.c b/disk/part_dos.c +index 567ead7511d..303eb1d13ee 100644 +--- a/disk/part_dos.c ++++ b/disk/part_dos.c +@@ -40,6 +40,12 @@ static int get_bootable(dos_partition_t *p) + { + int ret = 0; + ++ if (p->sys_ind == 0x1) ++ ret |= PART_EFI_SYSTEM_PARTITION; ++ if (p->sys_ind == 0x6) ++ ret |= PART_EFI_SYSTEM_PARTITION; ++ if (p->sys_ind == 0x0b) ++ ret |= PART_EFI_SYSTEM_PARTITION; + if (p->sys_ind == 0xef) + ret |= PART_EFI_SYSTEM_PARTITION; + if (p->boot_ind == 0x80) +-- +2.43.1 From 7f2aed2f989431930d981e2498685661e611eb99 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 12 Mar 2024 00:18:30 +0000 Subject: [PATCH 028/128] 2024.04 RC4, upstream fixes --- sources | 2 +- uboot-tools.spec | 10 +- ...ll-options-for-EFI-System-Partitions.patch | 51 +++-- ..._location-for-finding-the-DT-on-disk.patch | 180 ++++++++++++++++++ 4 files changed, 224 insertions(+), 19 deletions(-) create mode 100644 uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch diff --git a/sources b/sources index be81335..0b96c52 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.04-rc3.tar.bz2) = 75f36d57330e771dd3757c49d576b3a7f1c933dad9a102f22d2438286a763f0ec7deae863a97559cac48be8fc736b68a5292b4383d45178b111bd08134352e38 +SHA512 (u-boot-2024.04-rc4.tar.bz2) = 4a546eb790d54c9aadd423888baa5c909249afeedfd71f85c8b424421c08463b0e65f3addfc2d00f4a38fb56d8051ed70c8368d49a89bd33ec69773474d4d62d diff --git a/uboot-tools.spec b/uboot-tools.spec index 4d006c4..de80725 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc3 +%global candidate rc4 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.04 -Release: 0.3%{?candidate:.%{candidate}}%{?dist} +Release: 0.4%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -22,7 +22,7 @@ Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch # Identify VFAT partitions as ESP, allows EFI setvar on our images Patch2: uefi-Add-all-options-for-EFI-System-Partitions.patch # New function to find fdt for loading from disk -#Patch3: +Patch3: uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch # Fedora patches to enable/disable features Patch4: disable-VBE-by-default.patch Patch5: enable-bootmenu-by-default.patch @@ -189,6 +189,10 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Mar 12 2024 Peter Robinson - 1:2024.04-0.4.rc4 +- Update to 2024.04 RC4 +- Initial fix for loading DT off /boot (rhbz 2247873) + * Thu Feb 29 2024 Peter Robinson - 1:2024.04-0.3.rc3 - Update to 2024.04 RC3 - Enable a number of new upstream devices diff --git a/uefi-Add-all-options-for-EFI-System-Partitions.patch b/uefi-Add-all-options-for-EFI-System-Partitions.patch index 22c5bcc..3bf1ec8 100644 --- a/uefi-Add-all-options-for-EFI-System-Partitions.patch +++ b/uefi-Add-all-options-for-EFI-System-Partitions.patch @@ -1,7 +1,7 @@ -From 7ce45304053f31afaea6b80305aaee164c2e260a Mon Sep 17 00:00:00 2001 +From 86782e882e9542f5f402e00cd87efb36ad0552d3 Mon Sep 17 00:00:00 2001 From: Peter Robinson -Date: Wed, 21 Feb 2024 14:43:16 +0000 -Subject: [PATCH] disk: dos: Add all options for EFI System Partitions +Date: Sat, 2 Mar 2024 11:17:42 +0000 +Subject: [PATCH v4] disk: dos: Add all options for EFI System Partitions The EFI spec states that the ESP can be any of FAT12/16/32 but for compatibility doesn't necssarily require the partition to be the @@ -12,25 +12,46 @@ permissable for an ESP. Signed-off-by: Peter Robinson --- - disk/part_dos.c | 6 ++++++ - 1 file changed, 6 insertions(+) + +v2: +- Add 0x0c option +- Make hex constants consistent +- Move from if to switch statement +v3: +- Fix switch brain fart +v4: +- Drop boot_ind out of switch + + disk/part_dos.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/disk/part_dos.c b/disk/part_dos.c -index 567ead7511d..303eb1d13ee 100644 +index 567ead7511d..a35181dff4f 100644 --- a/disk/part_dos.c +++ b/disk/part_dos.c -@@ -40,6 +40,12 @@ static int get_bootable(dos_partition_t *p) +@@ -40,10 +40,21 @@ static int get_bootable(dos_partition_t *p) { int ret = 0; -+ if (p->sys_ind == 0x1) -+ ret |= PART_EFI_SYSTEM_PARTITION; -+ if (p->sys_ind == 0x6) -+ ret |= PART_EFI_SYSTEM_PARTITION; -+ if (p->sys_ind == 0x0b) -+ ret |= PART_EFI_SYSTEM_PARTITION; - if (p->sys_ind == 0xef) +- if (p->sys_ind == 0xef) ++ switch (p->sys_ind) { ++ case 0x01: ++ case 0x06: ++ case 0x0b: ++ case 0x0c: ++ case 0xef: ret |= PART_EFI_SYSTEM_PARTITION; ++ break; ++ default: ++ break; ++ } ++ if (p->boot_ind == 0x80) + ret |= PART_BOOTABLE; ++ + return ret; + } + -- -2.43.1 +2.44.0 + diff --git a/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch b/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch new file mode 100644 index 0000000..e1937f8 --- /dev/null +++ b/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch @@ -0,0 +1,180 @@ +From 47bf70fe95dd3883c08af3478f29564476f0950e Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Tue, 12 Mar 2024 00:05:23 +0000 +Subject: [PATCH] initial find_fdt_location for finding the DT on disk + +The old distro boot looked for a DT on the first boot partition +in the /dtb or /dtb/current directories, and Fedora extended this +to look not just on the boot partition but all the partitions on +that disk. + +The new ways of booting, both bootstd and bootefi bootmgr processes +don't properly look for those options. This provides a function +to search for the DTB on disk so that if the other DT mechanisms +don't work this will look for one on disk to provide a working DT +so that devices will continue to work as they did previously. + +Signed-off-by: Peter Robinson +--- + + cmd/bootefi.c | 1 + + cmd/bootmenu.c | 5 +++ + include/efi_loader.h | 2 + + lib/efi_loader/efi_helper.c | 82 ++++++++++++++++++++++++++++++++++++- + 4 files changed, 89 insertions(+), 1 deletion(-) + +diff --git a/cmd/bootefi.c b/cmd/bootefi.c +index 9cf9027bf40..8b6194a8702 100644 +--- a/cmd/bootefi.c ++++ b/cmd/bootefi.c +@@ -144,6 +144,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, + if (argc > 2) { + uintptr_t fdt_addr; + ++ /* Do we need to run find_fdt_location here?*/ + fdt_addr = hextoul(argv[2], NULL); + fdt = map_sysmem(fdt_addr, 0); + } else { +diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c +index 78184fccab2..48368c8d42e 100644 +--- a/cmd/bootmenu.c ++++ b/cmd/bootmenu.c +@@ -448,6 +448,11 @@ static void handle_uefi_bootnext(void) + u16 bootnext; + efi_status_t ret; + efi_uintn_t size; ++ const char *fdt_opt; ++ ++ /* Find the DTB on disk */ ++ log_debug("We will load the DTB\n"); ++ fdt_opt = find_fdt_location(); + + /* Initialize EFI drivers */ + ret = efi_init_obj_list(); +diff --git a/include/efi_loader.h b/include/efi_loader.h +index 7daca0afba2..a969378ff2f 100644 +--- a/include/efi_loader.h ++++ b/include/efi_loader.h +@@ -524,6 +524,8 @@ struct efi_register_notify_event { + struct list_head handles; + }; + ++/* Find the FDT on any partition */ ++char *find_fdt_location(void); + /* called at pre-initialization */ + int efi_init_early(void); + /* Initialize efi execution environment */ +diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c +index 5dd9cc876e4..59bdb2d030c 100644 +--- a/lib/efi_loader/efi_helper.c ++++ b/lib/efi_loader/efi_helper.c +@@ -12,6 +12,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -24,6 +25,76 @@ + const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID; + #endif + ++/* We need to pass a blk device in and return a location, or a loaded DT */ ++char *find_fdt_location(void) ++{ ++ const char *fdt_filename; ++ /* FIXME: dynamic size */ ++ char fdt_fullpath[60]; ++ const char *prefix; ++ struct udevice *blk; ++ /* FIXME: Fedora really only cares about first 2*/ ++ int MAX_PART = 8; ++ int part; ++ struct disk_partition info; ++ int ret; ++ int retfdt; ++ int retload; ++ loff_t fdtsize; ++ ulong pbraddr; ++ loff_t len_read; ++ ++ /* step one logic: we have the DT name we're hunting for */ ++ fdt_filename = env_get("fdtfile"); ++ if (fdt_filename) { ++ log_debug("FFL: We're looking for the DTB now!: %s\n", fdt_filename); ++ ++ /* probe all block disks to search for fdt */ ++ uclass_foreach_dev_probe(UCLASS_BLK, blk) { ++ log_debug("FFL: dev name: %s\n", blk->name); ++ struct blk_desc *desc; ++ desc = dev_get_uclass_plat(blk); ++ /* we should get a partition count here for looping */ ++ /* For loop for each partition */ ++ /* Need to also deal with zero part whole disk - part_get_info_whole_disk */ ++ for (part = 1; part <= MAX_PART; part++) { ++ log_debug("FFL: part num: %d\n", part); ++ ret = part_get_info(desc, part, &info); ++ /* if we have partition check it for DT */ ++ if (ret) { ++ log_debug("FFL: we have a partition\n"); ++ /* we should have a case/for prefix in =/ /dtb/ /dtb/current/ */ ++ /* but for now we hard code if for Fedora */ ++ prefix = "/dtb"; ++ snprintf(fdt_fullpath, sizeof(fdt_fullpath), "%s/%s", prefix, fdt_filename); ++ log_debug("FFL: full name: %s\n", fdt_fullpath); ++ /* search for DT on partition and either find and exit or continue */ ++ retfdt = fs_size(fdt_fullpath, &fdtsize); ++ if (retfdt) { ++ /* we have a fdt!*/ ++ log_debug("FFL: we have found a DT on disk\n"); ++ retload = fs_read(fdt_fullpath, pbraddr, 0, 0, &len_read); ++ if (retload) { ++ log_debug("FFL: we have a loaded DT, size %ld we can return\n", sizeof(len_read)); ++ log_info("Found DTB: %s\n", fdt_filename); ++ const char *fdt_opt; ++ fdt_opt = env_get("fdt_addr"); ++ return fdt_opt; ++ } ++ } ++ } else { ++ log_debug("FFL: no partition\n"); ++ } ++ } ++ } ++ } else { ++ log_debug("FFL: fdt_filename not defined!!\n"); ++ } ++ ++ /* We didn't find a FDT */ ++ return NULL; ++} ++ + /** + * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by + * the value of BootCurrent +@@ -432,11 +503,20 @@ efi_status_t efi_install_fdt(void *fdt) + /* Look for device tree that is already installed */ + if (efi_get_configuration_table(&efi_guid_fdt)) + return EFI_SUCCESS; ++ /* Check if there is device tree loaded from disk */ ++ fdt_opt = find_fdt_location(); ++ if (fdt_opt) ++ log_debug("Found DTB: insert file name here\n"); + /* Check if there is a hardware device tree */ +- fdt_opt = env_get("fdt_addr"); ++ if (!fdt_opt) { ++ fdt_opt = env_get("fdt_addr"); ++ if (fdt_opt) ++ log_info("Found DTB: Prior firmware\n"); ++ } + /* Use our own device tree as fallback */ + if (!fdt_opt) { + fdt_opt = env_get("fdtcontroladdr"); ++ log_debug("Using DT from U-Boot\n"); + if (!fdt_opt) { + log_err("ERROR: need device tree\n"); + return EFI_NOT_FOUND; +-- +2.44.0 + From 59b16b49885d6fb573d55f741df8ad7330b36361 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 13 Mar 2024 19:18:40 +0000 Subject: [PATCH 029/128] Fixes for Rockchip rk3399 autoboot --- ...hip-Enable-preboot-start-for-pci-usb.patch | 166 ++++++++++++++++++ uboot-tools.spec | 8 +- 2 files changed, 172 insertions(+), 2 deletions(-) create mode 100644 rockchip-Enable-preboot-start-for-pci-usb.patch diff --git a/rockchip-Enable-preboot-start-for-pci-usb.patch b/rockchip-Enable-preboot-start-for-pci-usb.patch new file mode 100644 index 0000000..408609e --- /dev/null +++ b/rockchip-Enable-preboot-start-for-pci-usb.patch @@ -0,0 +1,166 @@ +From 367b3afc360e6fc92bd4cdca643ed2e4d928472d Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Wed, 13 Mar 2024 19:14:50 +0000 +Subject: [PATCH] rockchip: Enable preboot start for pci/usb + +Enable the preboot so nvme works OOTB + +Signed-off-by: Peter Robinson +--- + configs/firefly-rk3399_defconfig | 2 ++ + configs/nanopc-t4-rk3399_defconfig | 2 ++ + configs/pinebook-pro-rk3399_defconfig | 1 + + configs/roc-pc-mezzanine-rk3399_defconfig | 2 ++ + configs/rock-4c-plus-rk3399_defconfig | 2 ++ + configs/rock-4se-rk3399_defconfig | 2 ++ + configs/rock-pi-4-rk3399_defconfig | 2 ++ + configs/rock-pi-4c-rk3399_defconfig | 2 ++ + configs/rock-pi-n10-rk3399pro_defconfig | 2 ++ + configs/rock960-rk3399_defconfig | 1 + + configs/rockpro64-rk3399_defconfig | 2 ++ + 11 files changed, 20 insertions(+) + +diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig +index b7c8e95b7b8..1e33083c138 100644 +--- a/configs/firefly-rk3399_defconfig ++++ b/configs/firefly-rk3399_defconfig +@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-firefly.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y + CONFIG_MISC_INIT_R=y +diff --git a/configs/nanopc-t4-rk3399_defconfig b/configs/nanopc-t4-rk3399_defconfig +index c18e7b1bd16..e9a18eb3e9f 100644 +--- a/configs/nanopc-t4-rk3399_defconfig ++++ b/configs/nanopc-t4-rk3399_defconfig +@@ -17,6 +17,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopc-t4.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y + CONFIG_SPL_MAX_SIZE=0x2e000 +diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig +index de357415fbe..4168adb1935 100644 +--- a/configs/pinebook-pro-rk3399_defconfig ++++ b/configs/pinebook-pro-rk3399_defconfig +@@ -24,6 +24,7 @@ CONFIG_PCI=y + CONFIG_DEBUG_UART=y + CONFIG_BOOTDELAY=3 + CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinebook-pro.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y + CONFIG_MISC_INIT_R=y +diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig +index de6539bedf4..61c6182d27e 100644 +--- a/configs/roc-pc-mezzanine-rk3399_defconfig ++++ b/configs/roc-pc-mezzanine-rk3399_defconfig +@@ -23,6 +23,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y +diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig +index 18525c8bf50..89e9f69eb63 100644 +--- a/configs/rock-4c-plus-rk3399_defconfig ++++ b/configs/rock-4c-plus-rk3399_defconfig +@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-4c-plus.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y +diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se-rk3399_defconfig +index 171de23ec8f..d2769a2f516 100644 +--- a/configs/rock-4se-rk3399_defconfig ++++ b/configs/rock-4se-rk3399_defconfig +@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_SPL_FIT_SIGNATURE=y + CONFIG_LEGACY_IMAGE_FORMAT=y +diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig +index 83fc4ad7dab..24ca614fe5a 100644 +--- a/configs/rock-pi-4-rk3399_defconfig ++++ b/configs/rock-pi-4-rk3399_defconfig +@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_SPL_FIT_SIGNATURE=y + CONFIG_LEGACY_IMAGE_FORMAT=y +diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig +index 089344097e0..83c2cfba157 100644 +--- a/configs/rock-pi-4c-rk3399_defconfig ++++ b/configs/rock-pi-4c-rk3399_defconfig +@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4c.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y +diff --git a/configs/rock-pi-n10-rk3399pro_defconfig b/configs/rock-pi-n10-rk3399pro_defconfig +index dc4b3b40380..db34bc70a22 100644 +--- a/configs/rock-pi-n10-rk3399pro_defconfig ++++ b/configs/rock-pi-n10-rk3399pro_defconfig +@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399pro-rock-pi-n10.dtb" + # CONFIG_CONSOLE_MUX is not set +diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig +index b93dda56593..6d1b352a855 100644 +--- a/configs/rock960-rk3399_defconfig ++++ b/configs/rock960-rk3399_defconfig +@@ -17,6 +17,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y + CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock960.dtb" + CONFIG_SYS_PBSIZE=1052 + CONFIG_DISPLAY_BOARDINFO_LATE=y +diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig +index 711541f8462..8c1ea1a0b63 100644 +--- a/configs/rockpro64-rk3399_defconfig ++++ b/configs/rockpro64-rk3399_defconfig +@@ -21,6 +21,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_SPL_FIT_SIGNATURE=y + CONFIG_LEGACY_IMAGE_FORMAT=y + CONFIG_BOOTSTAGE=y +-- +2.44.0 + diff --git a/uboot-tools.spec b/uboot-tools.spec index de80725..adff3dd 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.04 -Release: 0.4%{?candidate:.%{candidate}}%{?dist} +Release: 0.5%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -34,6 +34,7 @@ Patch6: Add-video-damage-tracking.patch Patch10: rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch # Rockchips improvements Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch +Patch12: rockchip-Enable-preboot-start-for-pci-usb.patch BuildRequires: bc BuildRequires: bison @@ -138,7 +139,7 @@ mkdir -p %{buildroot}%{_datadir}/uboot/ %ifarch aarch64 for board in $(ls builds) do - for file in u-boot.bin u-boot.img u-boot-dtb.img u-boot.itb u-boot-sunxi-with-spl.bin u-boot-rockchip.bin idbloader.img idbloader-spi.img spl/boot.bin + for file in u-boot.bin u-boot.img u-boot-dtb.img u-boot.itb u-boot-sunxi-with-spl.bin u-boot-rockchip-spi.bin u-boot-rockchip.bin idbloader.img idbloader-spi.img spl/boot.bin do if [ -f builds/$(echo $board)/$(echo $file) ]; then install -pD -m 0644 builds/$(echo $board)/$(echo $file) %{buildroot}%{_datadir}/uboot/$(echo $board)/$(echo $file) @@ -189,6 +190,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Wed Mar 13 2024 Peter Robinson - 1:2024.04-0.5.rc4 +- Fixes for Rockchip rk3399 autoboot + * Tue Mar 12 2024 Peter Robinson - 1:2024.04-0.4.rc4 - Update to 2024.04 RC4 - Initial fix for loading DT off /boot (rhbz 2247873) From bda7eb94be4cdeb796a997f2ba3b3c071480485a Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 15 Mar 2024 16:43:39 +0000 Subject: [PATCH 030/128] Updated fix for FDT load --- uboot-tools.spec | 5 ++++- ...fdt_location-for-finding-the-DT-on-disk.patch | 16 ++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index adff3dd..fa7c75d 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.04 -Release: 0.5%{?candidate:.%{candidate}}%{?dist} +Release: 0.6%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -190,6 +190,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Fri Mar 15 2024 Peter Robinson - 1:2024.04-0.6.rc4 +- Updated fix for FDT load + * Wed Mar 13 2024 Peter Robinson - 1:2024.04-0.5.rc4 - Fixes for Rockchip rk3399 autoboot diff --git a/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch b/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch index e1937f8..2b425f1 100644 --- a/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch +++ b/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch @@ -1,6 +1,6 @@ -From 47bf70fe95dd3883c08af3478f29564476f0950e Mon Sep 17 00:00:00 2001 +From 751b1c4ec581f3546c49e4d59485306601fe6e2d Mon Sep 17 00:00:00 2001 From: Peter Robinson -Date: Tue, 12 Mar 2024 00:05:23 +0000 +Date: Fri, 15 Mar 2024 16:42:23 +0000 Subject: [PATCH] initial find_fdt_location for finding the DT on disk The old distro boot looked for a DT on the first boot partition @@ -16,12 +16,11 @@ so that devices will continue to work as they did previously. Signed-off-by: Peter Robinson --- - cmd/bootefi.c | 1 + cmd/bootmenu.c | 5 +++ include/efi_loader.h | 2 + - lib/efi_loader/efi_helper.c | 82 ++++++++++++++++++++++++++++++++++++- - 4 files changed, 89 insertions(+), 1 deletion(-) + lib/efi_loader/efi_helper.c | 83 ++++++++++++++++++++++++++++++++++++- + 4 files changed, 90 insertions(+), 1 deletion(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 9cf9027bf40..8b6194a8702 100644 @@ -65,7 +64,7 @@ index 7daca0afba2..a969378ff2f 100644 int efi_init_early(void); /* Initialize efi execution environment */ diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c -index 5dd9cc876e4..59bdb2d030c 100644 +index 5dd9cc876e4..8d51c9570b7 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -12,6 +12,7 @@ @@ -76,7 +75,7 @@ index 5dd9cc876e4..59bdb2d030c 100644 #include #include #include -@@ -24,6 +25,76 @@ +@@ -24,6 +25,77 @@ const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID; #endif @@ -128,6 +127,7 @@ index 5dd9cc876e4..59bdb2d030c 100644 + if (retfdt) { + /* we have a fdt!*/ + log_debug("FFL: we have found a DT on disk\n"); ++ pbraddr = (ulong)(env_get("fdt_addr")); + retload = fs_read(fdt_fullpath, pbraddr, 0, 0, &len_read); + if (retload) { + log_debug("FFL: we have a loaded DT, size %ld we can return\n", sizeof(len_read)); @@ -153,7 +153,7 @@ index 5dd9cc876e4..59bdb2d030c 100644 /** * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by * the value of BootCurrent -@@ -432,11 +503,20 @@ efi_status_t efi_install_fdt(void *fdt) +@@ -432,11 +504,20 @@ efi_status_t efi_install_fdt(void *fdt) /* Look for device tree that is already installed */ if (efi_get_configuration_table(&efi_guid_fdt)) return EFI_SUCCESS; From d91245dd1ce4d8e65efd11c44cafdae90c9e70a5 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 21 Mar 2024 13:56:05 +0000 Subject: [PATCH 031/128] Updated patch for DTB loading --- uboot-tools.spec | 5 +- ..._location-for-finding-the-DT-on-disk.patch | 74 ++++++++++++------- 2 files changed, 52 insertions(+), 27 deletions(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index fa7c75d..d726634 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.04 -Release: 0.6%{?candidate:.%{candidate}}%{?dist} +Release: 0.7%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -190,6 +190,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Thu Mar 21 2024 Peter Robinson - 1:2024.04-0.7.rc4 +- Updated patch for DTB loading + * Fri Mar 15 2024 Peter Robinson - 1:2024.04-0.6.rc4 - Updated fix for FDT load diff --git a/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch b/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch index 2b425f1..232e121 100644 --- a/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch +++ b/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch @@ -1,6 +1,6 @@ -From 751b1c4ec581f3546c49e4d59485306601fe6e2d Mon Sep 17 00:00:00 2001 +From 8abb44f89aefd25cda27c54c08b68b3a60bea7c3 Mon Sep 17 00:00:00 2001 From: Peter Robinson -Date: Fri, 15 Mar 2024 16:42:23 +0000 +Date: Thu, 21 Mar 2024 13:43:24 +0000 Subject: [PATCH] initial find_fdt_location for finding the DT on disk The old distro boot looked for a DT on the first boot partition @@ -16,11 +16,11 @@ so that devices will continue to work as they did previously. Signed-off-by: Peter Robinson --- - cmd/bootefi.c | 1 + - cmd/bootmenu.c | 5 +++ - include/efi_loader.h | 2 + - lib/efi_loader/efi_helper.c | 83 ++++++++++++++++++++++++++++++++++++- - 4 files changed, 90 insertions(+), 1 deletion(-) + cmd/bootefi.c | 1 + + cmd/bootmenu.c | 5 ++ + include/efi_loader.h | 2 + + lib/efi_loader/efi_helper.c | 105 +++++++++++++++++++++++++++++++++++- + 4 files changed, 112 insertions(+), 1 deletion(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 9cf9027bf40..8b6194a8702 100644 @@ -64,7 +64,7 @@ index 7daca0afba2..a969378ff2f 100644 int efi_init_early(void); /* Initialize efi execution environment */ diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c -index 5dd9cc876e4..8d51c9570b7 100644 +index 5dd9cc876e4..a33ec39ff74 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -12,6 +12,7 @@ @@ -75,7 +75,7 @@ index 5dd9cc876e4..8d51c9570b7 100644 #include #include #include -@@ -24,6 +25,77 @@ +@@ -24,6 +25,99 @@ const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID; #endif @@ -91,6 +91,7 @@ index 5dd9cc876e4..8d51c9570b7 100644 + int MAX_PART = 8; + int part; + struct disk_partition info; ++ int fdtext; + int ret; + int retfdt; + int retload; @@ -115,7 +116,9 @@ index 5dd9cc876e4..8d51c9570b7 100644 + log_debug("FFL: part num: %d\n", part); + ret = part_get_info(desc, part, &info); + /* if we have partition check it for DT */ -+ if (ret) { ++ if (ret < 0) { ++ log_debug("FFL: no partition\n"); ++ } else { + log_debug("FFL: we have a partition\n"); + /* we should have a case/for prefix in =/ /dtb/ /dtb/current/ */ + /* but for now we hard code if for Fedora */ @@ -123,22 +126,41 @@ index 5dd9cc876e4..8d51c9570b7 100644 + snprintf(fdt_fullpath, sizeof(fdt_fullpath), "%s/%s", prefix, fdt_filename); + log_debug("FFL: full name: %s\n", fdt_fullpath); + /* search for DT on partition and either find and exit or continue */ -+ retfdt = fs_size(fdt_fullpath, &fdtsize); -+ if (retfdt) { -+ /* we have a fdt!*/ -+ log_debug("FFL: we have found a DT on disk\n"); -+ pbraddr = (ulong)(env_get("fdt_addr")); -+ retload = fs_read(fdt_fullpath, pbraddr, 0, 0, &len_read); -+ if (retload) { -+ log_debug("FFL: we have a loaded DT, size %ld we can return\n", sizeof(len_read)); -+ log_info("Found DTB: %s\n", fdt_filename); -+ const char *fdt_opt; -+ fdt_opt = env_get("fdt_addr"); -+ return fdt_opt; ++ if (fs_set_blk_dev_with_part(desc, part) == 0){ ++ log_debug("FFL: set block part pass\n"); ++ fdtext = fs_exists(fdt_fullpath); ++ if (fdtext) { ++ /* we have a fdt!*/ ++ if (fs_set_blk_dev_with_part(desc, part) == 0){ ++ retfdt = fs_size(fdt_fullpath, &fdtsize); ++ if (retfdt == 0) { ++ log_debug("FFL: we have found a DT on disk, size %lld\n", fdtsize); ++ /* Get the main fdt and map it */ ++ const char *fdt_pbr; ++ fdt_pbr = env_get("fdt_addr_r"); ++ pbraddr = hextoul(fdt_pbr, NULL); ++ log_debug("FFL: fdr addr: %s\n", fdt_pbr); ++ if (fs_set_blk_dev_with_part(desc, part) == 0){ ++ retload = fs_read(fdt_fullpath, pbraddr, 0, fdtsize, &len_read); ++ if (retload == 0) { ++ log_debug("FFL: we have a loaded DT, size %lld we can return\n", fdtsize); ++ log_info("Found DTB: %s\n", fdt_filename); ++ return fdt_pbr; ++ } else { ++ log_debug("FFL: DT load failed\n"); ++ } ++ } ++ } else { ++ log_debug("FFL: we DON'T have a DT with size\n"); ++ } ++ } ++ } else { ++ /* we don't have a fdt!*/ ++ log_debug("FFL: we DON'T have a DT\n"); + } ++ } else { ++ log_debug("FFL: set block part FAIL\n"); + } -+ } else { -+ log_debug("FFL: no partition\n"); + } + } + } @@ -153,14 +175,14 @@ index 5dd9cc876e4..8d51c9570b7 100644 /** * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by * the value of BootCurrent -@@ -432,11 +504,20 @@ efi_status_t efi_install_fdt(void *fdt) +@@ -432,11 +526,20 @@ efi_status_t efi_install_fdt(void *fdt) /* Look for device tree that is already installed */ if (efi_get_configuration_table(&efi_guid_fdt)) return EFI_SUCCESS; + /* Check if there is device tree loaded from disk */ + fdt_opt = find_fdt_location(); + if (fdt_opt) -+ log_debug("Found DTB: insert file name here\n"); ++ log_debug("Found DTB on disk\n"); /* Check if there is a hardware device tree */ - fdt_opt = env_get("fdt_addr"); + if (!fdt_opt) { From 2a31c9025b794a3101093aaa4a6911a834783bad Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 27 Mar 2024 04:44:15 +0000 Subject: [PATCH 032/128] 2024.04 RC5 --- sources | 2 +- uboot-tools.spec | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sources b/sources index 0b96c52..c146dd5 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.04-rc4.tar.bz2) = 4a546eb790d54c9aadd423888baa5c909249afeedfd71f85c8b424421c08463b0e65f3addfc2d00f4a38fb56d8051ed70c8368d49a89bd33ec69773474d4d62d +SHA512 (u-boot-2024.04-rc5.tar.bz2) = 1e985d9b9840b8ea9ed8f10f6e22d503ad87373b12c1a081c3d270f630d16a7881fd4ce072cbf08c20a2a038d458d6e161fa21494967d771d2494c378c7c2d6f diff --git a/uboot-tools.spec b/uboot-tools.spec index d726634..cd5dff5 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc4 +%global candidate rc5 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.04 -Release: 0.7%{?candidate:.%{candidate}}%{?dist} +Release: 0.8%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -190,6 +190,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Wed Mar 27 2024 Peter Robinson - 1:2024.04-0.8.rc5 +- Update to 2024.04 RC5 + * Thu Mar 21 2024 Peter Robinson - 1:2024.04-0.7.rc4 - Updated patch for DTB loading From dcafedfd49902c2105accbf779ff7690fbcc19da Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 3 Apr 2024 05:55:01 +0100 Subject: [PATCH 033/128] 2024.04 GA, rk3328 USB fixes --- ...kchip-inno-usb2-Write-to-correct-GRF.patch | 572 +++++++++++++++ ...grate-to-use-DM_USB_GADGET-on-RK3328.patch | 691 ++++++++++++++++++ sources | 2 +- uboot-tools.spec | 10 +- 4 files changed, 1272 insertions(+), 3 deletions(-) create mode 100644 phy-rockchip-inno-usb2-Write-to-correct-GRF.patch create mode 100644 rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch diff --git a/phy-rockchip-inno-usb2-Write-to-correct-GRF.patch b/phy-rockchip-inno-usb2-Write-to-correct-GRF.patch new file mode 100644 index 0000000..b240ad6 --- /dev/null +++ b/phy-rockchip-inno-usb2-Write-to-correct-GRF.patch @@ -0,0 +1,572 @@ +From patchwork Sun Feb 25 22:10:19 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Jonas Karlman +X-Patchwork-Id: 1903989 +X-Patchwork-Delegate: ykai007@gmail.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; + secure) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 + header.s=fe-e1b5cab7be header.b=yOZt1tiR; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4TjdHl4wttz23cw + for ; Mon, 26 Feb 2024 09:11:15 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 91BCF87E23; + Sun, 25 Feb 2024 23:10:57 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=kwiboo.se +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; + secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="yOZt1tiR"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id BFA6B87DA4; Sun, 25 Feb 2024 23:10:53 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) + (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 217BA87DFA + for ; Sun, 25 Feb 2024 23:10:49 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=kwiboo.se +Authentication-Results: phobos.denx.de; spf=pass + smtp.mailfrom=SRS0=31c0=KD=kwiboo.se=jonas@fe-bounces.kwiboo.se +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; + h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: + Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; + t=1708899036; bh=AzFTi2bcYYAtXfClfRKD6v/Yh+iTeLs39b0UoXgmBwI=; + b=yOZt1tiRwOXYRO3mwXmOiJo897JN79a+B1jEzPSXrDGT/XlOaEYuhCBCO4IIUTSOg1irZCZD0 + XierFKG1DECIT3JlIXV16mU6P9Dsg/amgtgJp8QQmuACEJ6JERBNINdt0i7+i0oUF0bmiYupJ+U + VY5LPHhscKquVc3LCEo/DcIMMX+gh3zOF15G4QPE6ldeQbs/Ys4bqYQ/cMe+X4ijANkou6hqNSw + VY/TylYiKqrMyUW8SKJ6oXRxluNhrYpWWde3hoCc0zjTEWW9dGzSbxX8NLmmhqTT0uGKH6/RrB0 + nNeuIgaMGTk7jCCUtbi4Vp99P9HYFnlfmTRXoVLEofxw== +From: Jonas Karlman +To: Kever Yang , Simon Glass , + Philipp Tomsich , Tom Rini , + Ren Jianing , Manoj Sai + , Jagan Teki + , Eugen Hristev , + Frank Wang , Xavier Drudis Ferran + +Cc: u-boot@lists.denx.de, Jonas Karlman +Subject: [PATCH 1/2] phy: rockchip-inno-usb2: Write to correct GRF +Date: Sun, 25 Feb 2024 22:10:19 +0000 +Message-ID: <20240225221024.1974853-2-jonas@kwiboo.se> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20240225221024.1974853-1-jonas@kwiboo.se> +References: <20240225221024.1974853-1-jonas@kwiboo.se> +MIME-Version: 1.0 +X-Report-Abuse-To: abuse@forwardemail.net +X-Report-Abuse: abuse@forwardemail.net +X-Complaints-To: abuse@forwardemail.net +X-ForwardEmail-Version: 0.4.40 +X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, + 149.28.215.223 +X-ForwardEmail-ID: 65dbbada46c899733a83b3ec +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 + +On RK3399 the USB2PHY regs are located in the common GRF, remaining SoCs +that is supported by this driver have the USB2PHY regs in a different +GRF. + +When support for RK356x, RK3588 and RK3328 was added this driver was +never updated to use correct GRF and have instead incorrectly written +to wrong GRF for these SoCs. + +The default reset values for the USB2PHY have made USB mostly working +even when wrong GRF was used, however, following have been observed: + + scanning bus usb@fd840000 for devices... + ERROR: USB-error: DEVICENOTRESPONDING: Device did not respond to token (IN) or did + not provide a handshake (OUT) (5) + ERROR: USB-error: DEVICENOTRESPONDING: Device did not respond to token (IN) or did + not provide a handshake (OUT) (5) + unable to get device descriptor (error=-1) + +Fix this by using a regmap from rockchip,usbgrf prop and fall back to +getting a regmap for parent udevice instead of always getting the +common GRF. + +Also protect against accidental clear of bit 0 in a reg with offset 0, +only bind driver to enabled otg/host-ports and remove unused headers. + +Fixes: 3da15f0b49a2 ("phy: rockchip-inno-usb2: Add USB2 PHY for rk3568") +Fixes: cdf9010f6e17 ("phy: rockchip-inno-usb2: add initial support for rk3588 PHY") +Fixes: 9aa93d84038b ("phy: rockchip-inno-usb2: Add USB2 PHY for RK3328") +Signed-off-by: Jonas Karlman +Reviewed-by: Kever Yang +--- + drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 41 ++++++++++--------- + 1 file changed, 22 insertions(+), 19 deletions(-) + +diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +index 70e61eccb79a..7317128d135e 100644 +--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c ++++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +@@ -6,23 +6,16 @@ + * Copyright (C) 2020 Amarula Solutions(India) + */ + +-#include + #include + #include +-#include + #include + #include + #include + #include +-#include ++#include + #include +-#include +-#include +-#include + #include + +-DECLARE_GLOBAL_DATA_PTR; +- + #define usleep_range(a, b) udelay((b)) + #define BIT_WRITEABLE_SHIFT 16 + +@@ -61,30 +54,39 @@ struct rockchip_usb2phy_cfg { + }; + + struct rockchip_usb2phy { +- void *reg_base; ++ struct regmap *reg_base; + struct clk phyclk; + const struct rockchip_usb2phy_cfg *phy_cfg; + }; + +-static inline int property_enable(void *reg_base, ++static inline int property_enable(struct regmap *base, + const struct usb2phy_reg *reg, bool en) + { + unsigned int val, mask, tmp; + ++ if (!reg->offset && !reg->enable && !reg->disable) ++ return 0; ++ + tmp = en ? reg->enable : reg->disable; + mask = GENMASK(reg->bitend, reg->bitstart); + val = (tmp << reg->bitstart) | (mask << BIT_WRITEABLE_SHIFT); + +- return writel(val, reg_base + reg->offset); ++ return regmap_write(base, reg->offset, val); + } + +-static inline bool property_enabled(void *reg_base, ++static inline bool property_enabled(struct regmap *base, + const struct usb2phy_reg *reg) + { ++ int ret; + unsigned int tmp, orig; + unsigned int mask = GENMASK(reg->bitend, reg->bitstart); + +- orig = readl(reg_base + reg->offset); ++ if (!reg->offset && !reg->enable && !reg->disable) ++ return false; ++ ++ ret = regmap_read(base, reg->offset, &orig); ++ if (ret) ++ return false; + + tmp = (orig & mask) >> reg->bitstart; + return tmp != reg->disable; +@@ -248,7 +250,11 @@ static int rockchip_usb2phy_probe(struct udevice *dev) + unsigned int reg; + int index, ret; + +- priv->reg_base = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); ++ if (dev_read_bool(dev, "rockchip,usbgrf")) ++ priv->reg_base = ++ syscon_regmap_lookup_by_phandle(dev, "rockchip,usbgrf"); ++ else ++ priv->reg_base = syscon_get_regmap(dev_get_parent(dev)); + if (IS_ERR(priv->reg_base)) + return PTR_ERR(priv->reg_base); + +@@ -305,11 +311,8 @@ static int rockchip_usb2phy_bind(struct udevice *dev) + int ret = 0; + + dev_for_each_subnode(node, dev) { +- if (!ofnode_valid(node)) { +- dev_info(dev, "subnode %s not found\n", dev->name); +- ret = -ENXIO; +- goto bind_fail; +- } ++ if (!ofnode_is_enabled(node)) ++ continue; + + name = ofnode_get_name(node); + dev_dbg(dev, "subnode %s\n", name); + +From patchwork Sun Feb 25 22:10:20 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Jonas Karlman +X-Patchwork-Id: 1903988 +X-Patchwork-Delegate: ykai007@gmail.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; + secure) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 + header.s=fe-e1b5cab7be header.b=Bv1sBawV; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4TjdHW2kk5z23cw + for ; Mon, 26 Feb 2024 09:11:03 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id EC90A87DF4; + Sun, 25 Feb 2024 23:10:54 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=kwiboo.se +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; + secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="Bv1sBawV"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 445F387E21; Sun, 25 Feb 2024 23:10:51 +0100 (CET) +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) + (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 9C54487DF4 + for ; Sun, 25 Feb 2024 23:10:48 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=kwiboo.se +Authentication-Results: phobos.denx.de; spf=pass + smtp.mailfrom=SRS0=31c0=KD=kwiboo.se=jonas@fe-bounces.kwiboo.se +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; + h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: + Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; + t=1708899040; bh=DyusC9ORAR+XZuJiPJ/3cQGjPsGAIRRpa763lcRm9QI=; + b=Bv1sBawVhXXIyoD7RTT7PpAz6+xCx17DjVExzdjGWsgUube7Xho69mue9hWqeTSU0bCFYYtv7 + HD7t7qbOmnYD+L0UVg+SHdibpC38eSbz+ucYsZrMhZL1IiRJNWWlFyb0IZacRz+AeagLdc75goJ + qTiFcN9xKXoHBJKpyqXiwsuJJMOXWwg9aOhGc9HZ91jwYEXSai2WfZYxtzx23bl5U4pDvpDuJd9 + ijrjK7DdsrJyRm4ALrkvjlr2/gZguEXEzOiHrFbbIZn+QIZjKhbbSdTQOScvPdvnFFKG8F3wZsX + rdxXOykD/CZU8ni3ZAYh20CBo6kwKIBdthaDsbYR18nw== +From: Jonas Karlman +To: Kever Yang , Simon Glass , + Philipp Tomsich , Tom Rini +Cc: u-boot@lists.denx.de, Jonas Karlman +Subject: [PATCH 2/2] phy: rockchip-inno-usb2: Limit changes made to regs +Date: Sun, 25 Feb 2024 22:10:20 +0000 +Message-ID: <20240225221024.1974853-3-jonas@kwiboo.se> +X-Mailer: git-send-email 2.43.0 +In-Reply-To: <20240225221024.1974853-1-jonas@kwiboo.se> +References: <20240225221024.1974853-1-jonas@kwiboo.se> +MIME-Version: 1.0 +X-Report-Abuse-To: abuse@forwardemail.net +X-Report-Abuse: abuse@forwardemail.net +X-Complaints-To: abuse@forwardemail.net +X-ForwardEmail-Version: 0.4.40 +X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, + 149.28.215.223 +X-ForwardEmail-ID: 65dbbade46c899733a83b3fe +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 USB2PHY regs already contain working default reset values for RK3328 +and RK35xx as evidenced by the fact that this driver never has changed a +single value for these SoCs. + +Reduce to only configure utmi_suspend_n and utmi_sel bits similar to +what is currently done on RK3399. Also add missing clkout_ctl for RK3588. + +When enabled utmi_suspend_n is changed to normal mode and utmi_sel to +use otg/host controller utmi interface to phy. When disabled +utmi_suspend_n is changed to suspend mode and utmi_sel to use GRF utmi +interface to phy. + +Signed-off-by: Jonas Karlman +Reviewed-by: Kever Yang +--- + drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 117 +++--------------- + 1 file changed, 14 insertions(+), 103 deletions(-) + +diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +index 7317128d135e..d392aed2d4de 100644 +--- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c ++++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +@@ -35,16 +35,6 @@ struct usb2phy_reg { + + struct rockchip_usb2phy_port_cfg { + struct usb2phy_reg phy_sus; +- struct usb2phy_reg bvalid_det_en; +- struct usb2phy_reg bvalid_det_st; +- struct usb2phy_reg bvalid_det_clr; +- struct usb2phy_reg ls_det_en; +- struct usb2phy_reg ls_det_st; +- struct usb2phy_reg ls_det_clr; +- struct usb2phy_reg utmi_avalid; +- struct usb2phy_reg utmi_bvalid; +- struct usb2phy_reg utmi_ls; +- struct usb2phy_reg utmi_hstdet; + }; + + struct rockchip_usb2phy_cfg { +@@ -131,7 +121,6 @@ static int rockchip_usb2phy_init(struct phy *phy) + { + struct udevice *parent = dev_get_parent(phy->dev); + struct rockchip_usb2phy *priv = dev_get_priv(parent); +- const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy); + int ret; + + ret = clk_enable(&priv->phyclk); +@@ -140,14 +129,6 @@ static int rockchip_usb2phy_init(struct phy *phy) + return ret; + } + +- if (phy->id == USB2PHY_PORT_OTG) { +- property_enable(priv->reg_base, &port_cfg->bvalid_det_clr, true); +- property_enable(priv->reg_base, &port_cfg->bvalid_det_en, true); +- } else if (phy->id == USB2PHY_PORT_HOST) { +- property_enable(priv->reg_base, &port_cfg->bvalid_det_clr, true); +- property_enable(priv->reg_base, &port_cfg->bvalid_det_en, true); +- } +- + return 0; + } + +@@ -351,27 +332,13 @@ bind_fail: + static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = { + { + .reg = 0x100, +- .clkout_ctl = { 0x108, 4, 4, 1, 0 }, ++ .clkout_ctl = { 0x0108, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { +- .phy_sus = { 0x0100, 15, 0, 0, 0x1d1 }, +- .bvalid_det_en = { 0x0110, 3, 2, 0, 3 }, +- .bvalid_det_st = { 0x0114, 3, 2, 0, 3 }, +- .bvalid_det_clr = { 0x0118, 3, 2, 0, 3 }, +- .ls_det_en = { 0x0110, 0, 0, 0, 1 }, +- .ls_det_st = { 0x0114, 0, 0, 0, 1 }, +- .ls_det_clr = { 0x0118, 0, 0, 0, 1 }, +- .utmi_avalid = { 0x0120, 10, 10, 0, 1 }, +- .utmi_bvalid = { 0x0120, 9, 9, 0, 1 }, +- .utmi_ls = { 0x0120, 5, 4, 0, 1 }, ++ .phy_sus = { 0x0100, 1, 0, 2, 1 }, + }, + [USB2PHY_PORT_HOST] = { +- .phy_sus = { 0x104, 15, 0, 0, 0x1d1 }, +- .ls_det_en = { 0x110, 1, 1, 0, 1 }, +- .ls_det_st = { 0x114, 1, 1, 0, 1 }, +- .ls_det_clr = { 0x118, 1, 1, 0, 1 }, +- .utmi_ls = { 0x120, 17, 16, 0, 1 }, +- .utmi_hstdet = { 0x120, 19, 19, 0, 1 } ++ .phy_sus = { 0x0104, 1, 0, 2, 1 }, + } + }, + }, +@@ -385,19 +352,9 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0xe454, 1, 0, 2, 1 }, +- .bvalid_det_en = { 0xe3c0, 3, 3, 0, 1 }, +- .bvalid_det_st = { 0xe3e0, 3, 3, 0, 1 }, +- .bvalid_det_clr = { 0xe3d0, 3, 3, 0, 1 }, +- .utmi_avalid = { 0xe2ac, 7, 7, 0, 1 }, +- .utmi_bvalid = { 0xe2ac, 12, 12, 0, 1 }, + }, + [USB2PHY_PORT_HOST] = { +- .phy_sus = { 0xe458, 1, 0, 0x2, 0x1 }, +- .ls_det_en = { 0xe3c0, 6, 6, 0, 1 }, +- .ls_det_st = { 0xe3e0, 6, 6, 0, 1 }, +- .ls_det_clr = { 0xe3d0, 6, 6, 0, 1 }, +- .utmi_ls = { 0xe2ac, 22, 21, 0, 1 }, +- .utmi_hstdet = { 0xe2ac, 23, 23, 0, 1 } ++ .phy_sus = { 0xe458, 1, 0, 2, 1 }, + } + }, + }, +@@ -407,19 +364,9 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0xe464, 1, 0, 2, 1 }, +- .bvalid_det_en = { 0xe3c0, 8, 8, 0, 1 }, +- .bvalid_det_st = { 0xe3e0, 8, 8, 0, 1 }, +- .bvalid_det_clr = { 0xe3d0, 8, 8, 0, 1 }, +- .utmi_avalid = { 0xe2ac, 10, 10, 0, 1 }, +- .utmi_bvalid = { 0xe2ac, 16, 16, 0, 1 }, + }, + [USB2PHY_PORT_HOST] = { +- .phy_sus = { 0xe468, 1, 0, 0x2, 0x1 }, +- .ls_det_en = { 0xe3c0, 11, 11, 0, 1 }, +- .ls_det_st = { 0xe3e0, 11, 11, 0, 1 }, +- .ls_det_clr = { 0xe3d0, 11, 11, 0, 1 }, +- .utmi_ls = { 0xe2ac, 26, 25, 0, 1 }, +- .utmi_hstdet = { 0xe2ac, 27, 27, 0, 1 } ++ .phy_sus = { 0xe468, 1, 0, 2, 1 }, + } + }, + }, +@@ -432,24 +379,10 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { + .clkout_ctl = { 0x0008, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { +- .phy_sus = { 0x0000, 8, 0, 0x052, 0x1d1 }, +- .bvalid_det_en = { 0x0080, 2, 2, 0, 1 }, +- .bvalid_det_st = { 0x0084, 2, 2, 0, 1 }, +- .bvalid_det_clr = { 0x0088, 2, 2, 0, 1 }, +- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, +- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, +- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, +- .utmi_avalid = { 0x00c0, 10, 10, 0, 1 }, +- .utmi_bvalid = { 0x00c0, 9, 9, 0, 1 }, +- .utmi_ls = { 0x00c0, 5, 4, 0, 1 }, ++ .phy_sus = { 0x0000, 1, 0, 2, 1 }, + }, + [USB2PHY_PORT_HOST] = { +- .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d1 }, +- .ls_det_en = { 0x0080, 1, 1, 0, 1 }, +- .ls_det_st = { 0x0084, 1, 1, 0, 1 }, +- .ls_det_clr = { 0x0088, 1, 1, 0, 1 }, +- .utmi_ls = { 0x00c0, 17, 16, 0, 1 }, +- .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 } ++ .phy_sus = { 0x0004, 1, 0, 2, 1 }, + } + }, + }, +@@ -458,20 +391,10 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { + .clkout_ctl = { 0x0008, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { +- .phy_sus = { 0x0000, 8, 0, 0x1d2, 0x1d1 }, +- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, +- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, +- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, +- .utmi_ls = { 0x00c0, 5, 4, 0, 1 }, +- .utmi_hstdet = { 0x00c0, 7, 7, 0, 1 } ++ .phy_sus = { 0x0000, 1, 0, 2, 1 }, + }, + [USB2PHY_PORT_HOST] = { +- .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d1 }, +- .ls_det_en = { 0x0080, 1, 1, 0, 1 }, +- .ls_det_st = { 0x0084, 1, 1, 0, 1 }, +- .ls_det_clr = { 0x0088, 1, 1, 0, 1 }, +- .utmi_ls = { 0x00c0, 17, 16, 0, 1 }, +- .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 } ++ .phy_sus = { 0x0004, 1, 0, 2, 1 }, + } + }, + }, +@@ -481,49 +404,37 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { + static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { + { + .reg = 0x0000, ++ .clkout_ctl = { 0x0000, 0, 0, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0x000c, 11, 11, 0, 1 }, +- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, +- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, +- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, +- .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, + } + }, + }, + { + .reg = 0x4000, ++ .clkout_ctl = { 0x0000, 0, 0, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { +- .phy_sus = { 0x000c, 11, 11, 0, 0 }, +- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, +- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, +- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, +- .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, ++ .phy_sus = { 0x000c, 11, 11, 0, 1 }, + } + }, + }, + { + .reg = 0x8000, ++ .clkout_ctl = { 0x0000, 0, 0, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_HOST] = { + .phy_sus = { 0x0008, 2, 2, 0, 1 }, +- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, +- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, +- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, +- .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, + } + }, + }, + { + .reg = 0xc000, ++ .clkout_ctl = { 0x0000, 0, 0, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_HOST] = { + .phy_sus = { 0x0008, 2, 2, 0, 1 }, +- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, +- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, +- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, +- .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, + } + }, + }, diff --git a/rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch b/rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch new file mode 100644 index 0000000..e2b54b4 --- /dev/null +++ b/rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch @@ -0,0 +1,691 @@ +From 0149cf303734fad55f1d733628f76a6994d1436d Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 10 Mar 2024 18:50:57 +0000 +Subject: [PATCH 1/4] rockchip: Update the default USB Product ID value + +RK3036 is using the USB product id normally used by RK3066B, and RK3328 +is using the product id normally used by RK3368. + +Fix this and update the default USB_GADGET_PRODUCT_NUM Kconfig option +for remaining supported Rockchip SoCs to match the product id used in +Maskrom mode. + +Also remove a reference to an undefined ROCKCHIP_RK3229 Kconfig symbol. + +Signed-off-by: Jonas Karlman +Reviewed-by: Kever Yang +--- + drivers/usb/gadget/Kconfig | 15 ++++++++++++--- + 1 file changed, 12 insertions(+), 3 deletions(-) + +diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig +index c72a8047635..4621a6fd5e6 100644 +--- a/drivers/usb/gadget/Kconfig ++++ b/drivers/usb/gadget/Kconfig +@@ -70,12 +70,21 @@ config USB_GADGET_PRODUCT_NUM + hex "Product ID of the USB device" + default 0x701a if ARCH_TEGRA + default 0x1010 if ARCH_SUNXI +- default 0x310a if ROCKCHIP_RK3036 ++ default 0x110a if ROCKCHIP_RV1108 ++ default 0x110b if ROCKCHIP_RV1126 + default 0x300a if ROCKCHIP_RK3066 ++ default 0x301a if ROCKCHIP_RK3036 ++ default 0x310b if ROCKCHIP_RK3188 + default 0x310c if ROCKCHIP_RK3128 +- default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288 +- default 0x330a if ROCKCHIP_RK3328 ++ default 0x320a if ROCKCHIP_RK3288 ++ default 0x320b if ROCKCHIP_RK322X ++ default 0x320c if ROCKCHIP_RK3328 ++ default 0x330a if ROCKCHIP_RK3368 + default 0x330c if ROCKCHIP_RK3399 ++ default 0x330d if ROCKCHIP_PX30 ++ default 0x330e if ROCKCHIP_RK3308 ++ default 0x350a if ROCKCHIP_RK3568 ++ default 0x350b if ROCKCHIP_RK3588 + default 0x0 + help + Product ID of the USB device emulated, reported to the host device. +-- +2.44.0 + +From 3b4d52ef627bb3899c331ff24fe31cec5f445069 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 10 Mar 2024 18:50:58 +0000 +Subject: [PATCH 2/4] rockchip: board: Prepare for use of DM_USB_GADGET with + DWC2_OTG + +The board_usb_init() and board_usb_cleanup() functions is always +included when USB_GADGET and USB_GADGET_DWC2_OTG is enabled. + +Prepare for a change to use DM_USB_GADGET with DWC2_OTG by adding an +extra ifdef condition. The extra separate ifdef for USB_GADGET prepare +for next patch that adds a g_dnl_bind_fixup() function. + +Signed-off-by: Jonas Karlman +Reviewed-by: Kever Yang +--- + arch/arm/mach-rockchip/board.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c +index 2620530e03f..2ec670dde69 100644 +--- a/arch/arm/mach-rockchip/board.c ++++ b/arch/arm/mach-rockchip/board.c +@@ -205,7 +205,8 @@ void enable_caches(void) + } + #endif + +-#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) ++#if IS_ENABLED(CONFIG_USB_GADGET) ++#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET) + #include + #include + #include +@@ -281,6 +282,7 @@ int board_usb_cleanup(int index, enum usb_init_type init) + return 0; + } + #endif /* CONFIG_USB_GADGET_DWC2_OTG */ ++#endif /* CONFIG_USB_GADGET */ + + #if IS_ENABLED(CONFIG_FASTBOOT) + int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) +-- +2.44.0 + +From 201da409a8c879482a00867010b772327aba6a51 Mon Sep 17 00:00:00 2001 +From: Jonas Karlman +Date: Sun, 10 Mar 2024 18:50:59 +0000 +Subject: [PATCH 3/4] rockchip: board: Use a common USB Product ID for UMS + +Change to use the common Product ID 0x0010 when the ums command is used. + +This matches downstream vendor U-Boot and is a Product ID that tools +such as rkdeveloptool and RKDevTool will identify as MSC mode. + +Signed-off-by: Jonas Karlman +Reviewed-by: Kever Yang +--- + arch/arm/mach-rockchip/board.c | 17 ++++++++++++++++- + 1 file changed, 16 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c +index 2ec670dde69..2db746b27fb 100644 +--- a/arch/arm/mach-rockchip/board.c ++++ b/arch/arm/mach-rockchip/board.c +@@ -206,8 +206,23 @@ void enable_caches(void) + #endif + + #if IS_ENABLED(CONFIG_USB_GADGET) +-#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET) + #include ++ ++#if IS_ENABLED(CONFIG_USB_GADGET_DOWNLOAD) ++#define ROCKCHIP_G_DNL_UMS_PRODUCT_NUM 0x0010 ++ ++int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) ++{ ++ if (!strcmp(name, "usb_dnl_ums")) ++ put_unaligned(ROCKCHIP_G_DNL_UMS_PRODUCT_NUM, &dev->idProduct); ++ else ++ put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct); ++ ++ return 0; ++} ++#endif /* CONFIG_USB_GADGET_DOWNLOAD */ ++ ++#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET) + #include + #include + +-- +2.44.0 + +From 2cb2428ae571956dfafb2eeed8b54857b12e17d0 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Wed, 3 Apr 2024 05:29:20 +0100 +Subject: [PATCH 4/4] rockchip: Migrate to use DM_USB_GADGET on RK3328 + +USB gadget is not working fully as expected on RK3328, it uses a +board_usb_init() function to initialize the DWC2 OTG port. + +The board_usb_init() function does not intgrate with the generic phy +framework and as a result the USB phy is not properly configured before +or after USB gadget use. + +Having both USB_DWC2 and DWC2_OTG enabled for the same board is also +causing some issues. + +Trying to use rockusb or ums command after usb stop result in a freeze +due to usb stop is putting the phy in a suspended state. + + => usb start + => usb stop + => ums 0 mmc 0 + --> freeze due to usb phy is suspended <-- + +Fix this by only using one of USB_DWC2 (host) or DWC2_OTG (peripheral) +depending on the most likely usage of the otg port and by migrating to +use DM_USB_GADGET instead of a board_usb_init() function. + +The nanopi-r2 and orangepi-r1-plus variants share OTG and power using a +Type-C connector, mark these boards dr_mode as peripheral, the most +likely usage is for recovery and image download. + +The rock64 and roc-cc currently use dr_mode as host, remove the DWC2_OTG +driver from these boards to ensure that the USB_DWC2 driver is used. + +The rock-pi-e board does not enable the usb20_otg node so both USB_DWC2 +and DWC2_OTG is removed from this board. + +Enable RockUSB and UMS on all boards with a otg port in peripheral mode. + +Also with the migration to DM_USB_GADGET completed the U-Boot specific +change to reorder usb nodes in the soc device tree can be reverted. + +Signed-off-by: Jonas Karlman +Reviewed-by: Kever Yang +Signed-off-by: Peter Robinson +--- + arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi | 4 ++ + .../rk3328-orangepi-r1-plus-lts-u-boot.dtsi | 4 ++ + .../dts/rk3328-orangepi-r1-plus-u-boot.dtsi | 4 ++ + arch/arm/dts/rk3328-roc-cc-u-boot.dtsi | 4 ++ + arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi | 9 ++++ + arch/arm/dts/rk3328-rock64-u-boot.dtsi | 4 ++ + arch/arm/dts/rk3328-u-boot.dtsi | 4 -- + arch/arm/dts/rk3328.dtsi | 41 ++++++++----------- + configs/evb-rk3328_defconfig | 7 +++- + configs/nanopi-r2c-plus-rk3328_defconfig | 7 +++- + configs/nanopi-r2c-rk3328_defconfig | 7 +++- + configs/nanopi-r2s-rk3328_defconfig | 7 +++- + configs/orangepi-r1-plus-lts-rk3328_defconfig | 7 +++- + configs/orangepi-r1-plus-rk3328_defconfig | 7 +++- + configs/roc-cc-rk3328_defconfig | 7 ---- + configs/rock-pi-e-rk3328_defconfig | 7 ---- + configs/rock64-rk3328_defconfig | 6 --- + 17 files changed, 75 insertions(+), 61 deletions(-) + +diff --git a/arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi b/arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi +index 78d37ab4755..3a16f86c18a 100644 +--- a/arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi +@@ -28,6 +28,10 @@ + bootph-pre-ram; + }; + ++&usb20_otg { ++ dr_mode = "peripheral"; ++}; ++ + /* Need this and all the pinctrl/gpio stuff above to set pinmux */ + &vcc_sd { + bootph-pre-ram; +diff --git a/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi b/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi +index ebe33e48cb9..2247daebc13 100644 +--- a/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi +@@ -28,6 +28,10 @@ + bootph-pre-ram; + }; + ++&usb20_otg { ++ dr_mode = "peripheral"; ++}; ++ + /* Need this and all the pinctrl/gpio stuff above to set pinmux */ + &vcc_sd { + bootph-pre-ram; +diff --git a/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi b/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi +index 637c70adf19..79942a49a29 100644 +--- a/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi +@@ -28,6 +28,10 @@ + bootph-pre-ram; + }; + ++&usb20_otg { ++ dr_mode = "peripheral"; ++}; ++ + /* Need this and all the pinctrl/gpio stuff above to set pinmux */ + &vcc_sd { + bootph-pre-ram; +diff --git a/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi b/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi +index 2062f34bf82..1aeb0083631 100644 +--- a/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi +@@ -48,6 +48,10 @@ + bootph-pre-ram; + }; + ++&usb20_otg { ++ hnp-srp-disable; ++}; ++ + /* Need this and all the pinctrl/gpio stuff above to set pinmux */ + &vcc_sd { + bootph-pre-ram; +diff --git a/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi b/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi +index 1f220c6dcd0..c2371fb1688 100644 +--- a/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi +@@ -45,6 +45,15 @@ + bootph-pre-ram; + }; + ++&u2phy_host { ++ phy-supply = <&vcc_host_5v>; ++}; ++ ++&vcc_host_5v { ++ /delete-property/ regulator-always-on; ++ /delete-property/ regulator-boot-on; ++}; ++ + /* Need this and all the pinctrl/gpio stuff above to set pinmux */ + &vcc_sd { + bootph-pre-ram; +diff --git a/arch/arm/dts/rk3328-rock64-u-boot.dtsi b/arch/arm/dts/rk3328-rock64-u-boot.dtsi +index 6904515b969..1e4649ae120 100644 +--- a/arch/arm/dts/rk3328-rock64-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-rock64-u-boot.dtsi +@@ -48,6 +48,10 @@ + bootph-pre-ram; + }; + ++&usb20_otg { ++ hnp-srp-disable; ++}; ++ + /* Need this and all the pinctrl/gpio stuff above to set pinmux */ + &vcc_sd { + bootph-pre-ram; +diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi +index a9f2536de2a..b5da4518ec9 100644 +--- a/arch/arm/dts/rk3328-u-boot.dtsi ++++ b/arch/arm/dts/rk3328-u-boot.dtsi +@@ -61,10 +61,6 @@ + u-boot,spl-fifo-mode; + }; + +-&usb20_otg { +- hnp-srp-disable; +-}; +- + &spi0 { + bootph-all; + }; +diff --git a/arch/arm/dts/rk3328.dtsi b/arch/arm/dts/rk3328.dtsi +index e8d8f00be8a..8c821acb21f 100644 +--- a/arch/arm/dts/rk3328.dtsi ++++ b/arch/arm/dts/rk3328.dtsi +@@ -944,6 +944,22 @@ + }; + }; + ++ usb20_otg: usb@ff580000 { ++ compatible = "rockchip,rk3328-usb", "rockchip,rk3066-usb", ++ "snps,dwc2"; ++ reg = <0x0 0xff580000 0x0 0x40000>; ++ interrupts = ; ++ clocks = <&cru HCLK_OTG>; ++ clock-names = "otg"; ++ dr_mode = "otg"; ++ g-np-tx-fifo-size = <16>; ++ g-rx-fifo-size = <280>; ++ g-tx-fifo-size = <256 128 128 64 32 16>; ++ phys = <&u2phy_otg>; ++ phy-names = "usb2-phy"; ++ status = "disabled"; ++ }; ++ + usb_host0_ehci: usb@ff5c0000 { + compatible = "generic-ehci"; + reg = <0x0 0xff5c0000 0x0 0x10000>; +@@ -983,31 +999,6 @@ + status = "disabled"; + }; + +- /* +- * U-Boot Specific Change +- * +- * The OTG controller must come after the USB host pair for it +- * to work. This is likely due to lack of support for the USB +- * PHYs. This must be manually changed after each device tree +- * sync. There is no clean way to handle this in -u-boot.dtsi +- * files. +- */ +- usb20_otg: usb@ff580000 { +- compatible = "rockchip,rk3328-usb", "rockchip,rk3066-usb", +- "snps,dwc2"; +- reg = <0x0 0xff580000 0x0 0x40000>; +- interrupts = ; +- clocks = <&cru HCLK_OTG>; +- clock-names = "otg"; +- dr_mode = "otg"; +- g-np-tx-fifo-size = <16>; +- g-rx-fifo-size = <280>; +- g-tx-fifo-size = <256 128 128 64 32 16>; +- phys = <&u2phy_otg>; +- phy-names = "usb2-phy"; +- status = "disabled"; +- }; +- + gic: interrupt-controller@ff811000 { + compatible = "arm,gic-400"; + #interrupt-cells = <3>; +diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig +index b9c541a92a1..ed2e2b7aa6f 100644 +--- a/configs/evb-rk3328_defconfig ++++ b/configs/evb-rk3328_defconfig +@@ -46,6 +46,8 @@ CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y ++CONFIG_CMD_ROCKUSB=y ++CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y +@@ -93,17 +95,18 @@ CONFIG_SYS_NS16550_MEM32=y + CONFIG_SYSRESET=y + # CONFIG_TPL_SYSRESET is not set + CONFIG_USB=y ++CONFIG_DM_USB_GADGET=y + CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_EHCI_GENERIC=y + CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y +-CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y + # CONFIG_USB_DWC3_GADGET is not set +-CONFIG_USB_DWC3_GENERIC=y + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_USB_FUNCTION_ROCKUSB=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +diff --git a/configs/nanopi-r2c-plus-rk3328_defconfig b/configs/nanopi-r2c-plus-rk3328_defconfig +index 320ed8b434a..015bcfef369 100644 +--- a/configs/nanopi-r2c-plus-rk3328_defconfig ++++ b/configs/nanopi-r2c-plus-rk3328_defconfig +@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y ++CONFIG_CMD_ROCKUSB=y ++CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y +@@ -98,17 +100,18 @@ CONFIG_SYSINFO=y + CONFIG_SYSRESET=y + # CONFIG_TPL_SYSRESET is not set + CONFIG_USB=y ++CONFIG_DM_USB_GADGET=y + CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_EHCI_GENERIC=y + CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y +-CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y + # CONFIG_USB_DWC3_GADGET is not set +-CONFIG_USB_DWC3_GENERIC=y + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_USB_FUNCTION_ROCKUSB=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +diff --git a/configs/nanopi-r2c-rk3328_defconfig b/configs/nanopi-r2c-rk3328_defconfig +index 583179d7c54..5742567a3d4 100644 +--- a/configs/nanopi-r2c-rk3328_defconfig ++++ b/configs/nanopi-r2c-rk3328_defconfig +@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y ++CONFIG_CMD_ROCKUSB=y ++CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y +@@ -98,17 +100,18 @@ CONFIG_SYSINFO=y + CONFIG_SYSRESET=y + # CONFIG_TPL_SYSRESET is not set + CONFIG_USB=y ++CONFIG_DM_USB_GADGET=y + CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_EHCI_GENERIC=y + CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y +-CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y + # CONFIG_USB_DWC3_GADGET is not set +-CONFIG_USB_DWC3_GENERIC=y + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_USB_FUNCTION_ROCKUSB=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +diff --git a/configs/nanopi-r2s-rk3328_defconfig b/configs/nanopi-r2s-rk3328_defconfig +index f7ed71e4122..180a76e0eeb 100644 +--- a/configs/nanopi-r2s-rk3328_defconfig ++++ b/configs/nanopi-r2s-rk3328_defconfig +@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y ++CONFIG_CMD_ROCKUSB=y ++CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y +@@ -98,17 +100,18 @@ CONFIG_SYSINFO=y + CONFIG_SYSRESET=y + # CONFIG_TPL_SYSRESET is not set + CONFIG_USB=y ++CONFIG_DM_USB_GADGET=y + CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_EHCI_GENERIC=y + CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y +-CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y + # CONFIG_USB_DWC3_GADGET is not set +-CONFIG_USB_DWC3_GENERIC=y + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_USB_FUNCTION_ROCKUSB=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +diff --git a/configs/orangepi-r1-plus-lts-rk3328_defconfig b/configs/orangepi-r1-plus-lts-rk3328_defconfig +index d3d9417509e..a1a96bf2f28 100644 +--- a/configs/orangepi-r1-plus-lts-rk3328_defconfig ++++ b/configs/orangepi-r1-plus-lts-rk3328_defconfig +@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y ++CONFIG_CMD_ROCKUSB=y ++CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y +@@ -99,17 +101,18 @@ CONFIG_SYSINFO=y + CONFIG_SYSRESET=y + # CONFIG_TPL_SYSRESET is not set + CONFIG_USB=y ++CONFIG_DM_USB_GADGET=y + CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_EHCI_GENERIC=y + CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y +-CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y + # CONFIG_USB_DWC3_GADGET is not set +-CONFIG_USB_DWC3_GENERIC=y + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_USB_FUNCTION_ROCKUSB=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +diff --git a/configs/orangepi-r1-plus-rk3328_defconfig b/configs/orangepi-r1-plus-rk3328_defconfig +index 9356e87132e..04273a0491c 100644 +--- a/configs/orangepi-r1-plus-rk3328_defconfig ++++ b/configs/orangepi-r1-plus-rk3328_defconfig +@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y ++CONFIG_CMD_ROCKUSB=y ++CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y +@@ -99,17 +101,18 @@ CONFIG_SYSINFO=y + CONFIG_SYSRESET=y + # CONFIG_TPL_SYSRESET is not set + CONFIG_USB=y ++CONFIG_DM_USB_GADGET=y + CONFIG_USB_XHCI_HCD=y ++CONFIG_USB_XHCI_DWC3=y + CONFIG_USB_EHCI_HCD=y + CONFIG_USB_EHCI_GENERIC=y + CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y +-CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y + # CONFIG_USB_DWC3_GADGET is not set +-CONFIG_USB_DWC3_GENERIC=y + CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_USB_FUNCTION_ROCKUSB=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +diff --git a/configs/roc-cc-rk3328_defconfig b/configs/roc-cc-rk3328_defconfig +index 4ac3c9403b0..0e4edcc999d 100644 +--- a/configs/roc-cc-rk3328_defconfig ++++ b/configs/roc-cc-rk3328_defconfig +@@ -23,7 +23,6 @@ CONFIG_DEBUG_UART_BASE=0xFF130000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_DEBUG_UART=y +-# CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_LOAD_FIT=y +@@ -48,7 +47,6 @@ CONFIG_CMD_BOOTZ=y + CONFIG_CMD_GPT=y + CONFIG_CMD_MMC=y + CONFIG_CMD_USB=y +-CONFIG_CMD_USB_MASS_STORAGE=y + # CONFIG_CMD_SETEXPR is not set + CONFIG_CMD_TIME=y + CONFIG_SPL_OF_CONTROL=y +@@ -68,8 +66,6 @@ CONFIG_SPL_SYSCON=y + CONFIG_TPL_SYSCON=y + CONFIG_CLK=y + CONFIG_SPL_CLK=y +-CONFIG_FASTBOOT_BUF_ADDR=0x800800 +-CONFIG_FASTBOOT_CMD_OEM_FORMAT=y + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y + CONFIG_MISC=y +@@ -110,10 +106,7 @@ CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y + CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y +-# CONFIG_USB_DWC3_GADGET is not set + CONFIG_USB_DWC3_GENERIC=y +-CONFIG_USB_GADGET=y +-CONFIG_USB_GADGET_DWC2_OTG=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +diff --git a/configs/rock-pi-e-rk3328_defconfig b/configs/rock-pi-e-rk3328_defconfig +index 6dda900a9b4..6a4284120d2 100644 +--- a/configs/rock-pi-e-rk3328_defconfig ++++ b/configs/rock-pi-e-rk3328_defconfig +@@ -24,7 +24,6 @@ CONFIG_DEBUG_UART_BASE=0xFF130000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_DEBUG_UART=y +-# CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_LOAD_FIT=y +@@ -69,8 +68,6 @@ CONFIG_SPL_SYSCON=y + CONFIG_TPL_SYSCON=y + CONFIG_CLK=y + CONFIG_SPL_CLK=y +-CONFIG_FASTBOOT_BUF_ADDR=0x800800 +-CONFIG_FASTBOOT_CMD_OEM_FORMAT=y + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y + CONFIG_MISC=y +@@ -109,12 +106,8 @@ CONFIG_USB_EHCI_HCD=y + CONFIG_USB_EHCI_GENERIC=y + CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y +-CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y +-# CONFIG_USB_DWC3_GADGET is not set + CONFIG_USB_DWC3_GENERIC=y +-CONFIG_USB_GADGET=y +-CONFIG_USB_GADGET_DWC2_OTG=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig +index 0297d098761..fd42059565a 100644 +--- a/configs/rock64-rk3328_defconfig ++++ b/configs/rock64-rk3328_defconfig +@@ -23,7 +23,6 @@ CONFIG_DEBUG_UART_BASE=0xFF130000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_DEBUG_UART=y +-# CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_LOAD_FIT=y +@@ -67,8 +66,6 @@ CONFIG_SPL_SYSCON=y + CONFIG_TPL_SYSCON=y + CONFIG_CLK=y + CONFIG_SPL_CLK=y +-CONFIG_FASTBOOT_BUF_ADDR=0x800800 +-CONFIG_FASTBOOT_CMD_OEM_FORMAT=y + CONFIG_ROCKCHIP_GPIO=y + CONFIG_SYS_I2C_ROCKCHIP=y + CONFIG_MISC=y +@@ -111,10 +108,7 @@ CONFIG_USB_OHCI_HCD=y + CONFIG_USB_OHCI_GENERIC=y + CONFIG_USB_DWC2=y + CONFIG_USB_DWC3=y +-# CONFIG_USB_DWC3_GADGET is not set + CONFIG_USB_DWC3_GENERIC=y +-CONFIG_USB_GADGET=y +-CONFIG_USB_GADGET_DWC2_OTG=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_TPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y +-- +2.44.0 + diff --git a/sources b/sources index c146dd5..6013800 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.04-rc5.tar.bz2) = 1e985d9b9840b8ea9ed8f10f6e22d503ad87373b12c1a081c3d270f630d16a7881fd4ce072cbf08c20a2a038d458d6e161fa21494967d771d2494c378c7c2d6f +SHA512 (u-boot-2024.04.tar.bz2) = a71270302b38e9e68a83b3acdf8f7635f72d9fa75169e3c2241cdfa21eab834b8f25dfd35c281191bccb2fcec1e86d6b64afcf1d2ed5cd4fdc02258cd75fc236 diff --git a/uboot-tools.spec b/uboot-tools.spec index cd5dff5..aefeb8b 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc5 +#global candidate rc5 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.04 -Release: 0.8%{?candidate:.%{candidate}}%{?dist} +Release: 1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -35,6 +35,8 @@ Patch10: rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch # Rockchips improvements Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch Patch12: rockchip-Enable-preboot-start-for-pci-usb.patch +Patch13: phy-rockchip-inno-usb2-Write-to-correct-GRF.patch +Patch14: rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch BuildRequires: bc BuildRequires: bison @@ -190,6 +192,10 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Wed Apr 03 2024 Peter Robinson - 1:2024.04-1 +- Update to 2024.04 GA +- Rockchip rk3328 USB fixes + * Wed Mar 27 2024 Peter Robinson - 1:2024.04-0.8.rc5 - Update to 2024.04 RC5 From 69c93ea5d0cd3de940cd335514d81eb4f0717cf0 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 25 May 2024 12:30:42 +0100 Subject: [PATCH 034/128] Update to 2024.07-rc3 --- Add-video-damage-tracking.patch | 248 +++---- aarch64-boards | 2 +- ...kchip-inno-usb2-Write-to-correct-GRF.patch | 572 --------------- ...nitial-support-for-the-PinePhone-Pro.patch | 236 ------ ...hip-Enable-preboot-start-for-pci-usb.patch | 79 +- ...grate-to-use-DM_USB_GADGET-on-RK3328.patch | 691 ------------------ ...tch-to-OF_HAS_PRIOR_STAGE-by-default.patch | 154 ---- sources | 2 +- uboot-tools.spec | 17 +- 9 files changed, 175 insertions(+), 1826 deletions(-) delete mode 100644 phy-rockchip-inno-usb2-Write-to-correct-GRF.patch delete mode 100644 rockchip-Add-initial-support-for-the-PinePhone-Pro.patch delete mode 100644 rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch delete mode 100644 rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch diff --git a/Add-video-damage-tracking.patch b/Add-video-damage-tracking.patch index 7ba10f6..1aea71e 100644 --- a/Add-video-damage-tracking.patch +++ b/Add-video-damage-tracking.patch @@ -1,4 +1,4 @@ -From 79c2ed100ee9b901d676567e73ea4ebde84f15bc Mon Sep 17 00:00:00 2001 +From 26fad18312fe9cb0ed97ed8550b1c704d0985ebe Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Mon, 21 Aug 2023 16:50:58 +0300 Subject: [PATCH 01/13] video: test: Split copy frame buffer check into a @@ -300,9 +300,9 @@ index d907f681600..641a6250100 100644 return 0; } -- -2.43.0 +2.45.1 -From eb6a5cd225f0818e5dec2253e0c676142c3835a1 Mon Sep 17 00:00:00 2001 +From 6c7cff43f374242ed4d585f7359fa5c334332a0a Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Mon, 21 Aug 2023 16:50:59 +0300 Subject: [PATCH 02/13] video: test: Support checking copy frame buffer @@ -611,9 +611,9 @@ index 641a6250100..b9ff3da10c1 100644 return 0; -- -2.43.0 +2.45.1 -From 4c80b655e5c82acd1573e80668747d8ef25deb83 Mon Sep 17 00:00:00 2001 +From 1020e92b30457fa042a78395dabce0f50d07de8e Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Mon, 21 Aug 2023 16:51:00 +0300 Subject: [PATCH 03/13] video: test: Test partial updates of hardware frame @@ -694,9 +694,9 @@ index b9ff3da10c1..e4bd27a6b76 100644 +} +DM_TEST(dm_test_video_copy, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); -- -2.43.0 +2.45.1 -From 40f4addde7e05ce94fb74cd7d6795265ad282de6 Mon Sep 17 00:00:00 2001 +From 57b3429b596c7ed89c1858663c87865e11d965e2 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:01 +0300 Subject: [PATCH 04/13] dm: video: Add damage tracking API @@ -721,7 +721,7 @@ Reviewed-by: Simon Glass 3 files changed, 81 insertions(+), 5 deletions(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index ab927641bb7..ac3edbfdb54 100644 +index 7808ae7919e..7815b590481 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -92,6 +92,19 @@ config VIDEO_COPY @@ -745,10 +745,10 @@ index ab927641bb7..ac3edbfdb54 100644 bool "Generic PWM based Backlight Driver" depends on BACKLIGHT && DM_PWM diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index f743ed74c81..9888a580bfd 100644 +index 7b5d1dfbb3b..99a8458199a 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -351,9 +351,39 @@ void video_set_default_colors(struct udevice *dev, bool invert) +@@ -347,9 +347,39 @@ void video_set_default_colors(struct udevice *dev, bool invert) priv->colour_bg = video_index_to_colour(priv, back); } @@ -788,7 +788,7 @@ index f743ed74c81..9888a580bfd 100644 struct video_ops *ops = video_get_ops(vid); int ret; -@@ -369,15 +399,12 @@ int video_sync(struct udevice *vid, bool force) +@@ -365,15 +395,12 @@ int video_sync(struct udevice *vid, bool force) * out whether it exists? For now, ARM is safe. */ #if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) @@ -804,7 +804,7 @@ index f743ed74c81..9888a580bfd 100644 static ulong last_sync; if (force || get_timer(last_sync) > 100) { -@@ -385,6 +412,14 @@ int video_sync(struct udevice *vid, bool force) +@@ -381,6 +408,14 @@ int video_sync(struct udevice *vid, bool force) last_sync = get_timer(0); } #endif @@ -884,9 +884,9 @@ index 4d8df9baaad..1310195f307 100644 * video_is_active() - Test if one video device it active * -- -2.43.0 +2.45.1 -From 38f85c1620b99691bc0bd06a18c7173386a0a846 Mon Sep 17 00:00:00 2001 +From 6677746b0fc8b653af608513bdef54b379b4ee7d Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:02 +0300 Subject: [PATCH 05/13] dm: video: Add damage notification on display fills @@ -904,10 +904,10 @@ Reviewed-by: Simon Glass 1 file changed, 4 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 9888a580bfd..09172f1f7f4 100644 +index 99a8458199a..96b8962b8de 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -203,6 +203,8 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -196,6 +196,8 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, if (ret) return ret; @@ -916,7 +916,7 @@ index 9888a580bfd..09172f1f7f4 100644 return 0; } -@@ -249,6 +251,8 @@ int video_fill(struct udevice *dev, u32 colour) +@@ -245,6 +247,8 @@ int video_fill(struct udevice *dev, u32 colour) if (ret) return ret; @@ -926,9 +926,9 @@ index 9888a580bfd..09172f1f7f4 100644 } -- -2.43.0 +2.45.1 -From 77425d7aca92bf734e51cf36fad658adc53cb57d Mon Sep 17 00:00:00 2001 +From 96ee787a7966c0357e5f028317b85a8593757883 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:03 +0300 Subject: [PATCH 06/13] vidconsole: Add damage notifications to all vidconsole @@ -953,10 +953,10 @@ Reviewed-by: Simon Glass 4 files changed, 94 insertions(+) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c -index a0231293f31..ad7ce860e9d 100644 +index 34ef5a52294..6634d3f27da 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c -@@ -39,6 +39,12 @@ static int console_set_row(struct udevice *dev, uint row, int clr) +@@ -40,6 +40,12 @@ static int console_set_row(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -969,7 +969,7 @@ index a0231293f31..ad7ce860e9d 100644 return 0; } -@@ -60,6 +66,12 @@ static int console_move_rows(struct udevice *dev, uint rowdst, +@@ -61,6 +67,12 @@ static int console_move_rows(struct udevice *dev, uint rowdst, if (ret) return ret; @@ -982,7 +982,7 @@ index a0231293f31..ad7ce860e9d 100644 return 0; } -@@ -90,6 +102,12 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch) +@@ -92,6 +104,12 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -996,10 +996,10 @@ index a0231293f31..ad7ce860e9d 100644 if (ret) return ret; diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c -index 65358a1c6e7..6c3e7c1bb8d 100644 +index e4303dfb364..8129c7b2aa7 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c -@@ -36,6 +36,12 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) +@@ -37,6 +37,12 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1012,7 +1012,7 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 return 0; } -@@ -64,6 +70,12 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -65,6 +71,12 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, dst += vid_priv->line_length; } @@ -1025,7 +1025,7 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 return 0; } -@@ -96,6 +108,12 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) +@@ -98,6 +110,12 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -1038,7 +1038,7 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 return VID_TO_POS(fontdata->width); } -@@ -121,6 +139,12 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) +@@ -123,6 +141,12 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1051,7 +1051,7 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 return 0; } -@@ -142,6 +166,12 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -144,6 +168,12 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, vidconsole_memmove(dev, dst, src, fontdata->height * vid_priv->line_length * count); @@ -1064,7 +1064,7 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 return 0; } -@@ -174,6 +204,12 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) +@@ -177,6 +207,12 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -1077,7 +1077,7 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 return VID_TO_POS(fontdata->width); } -@@ -198,6 +234,12 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) +@@ -201,6 +237,12 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1090,7 +1090,7 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 return 0; } -@@ -224,6 +266,12 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -227,6 +269,12 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, dst += vid_priv->line_length; } @@ -1103,7 +1103,7 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 return 0; } -@@ -255,6 +303,12 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch) +@@ -259,6 +307,12 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -1117,10 +1117,10 @@ index 65358a1c6e7..6c3e7c1bb8d 100644 } diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c -index 14fb81e9563..c0a5ad1a51e 100644 +index 28665a32757..ed6c9cbb4f4 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c -@@ -190,6 +190,7 @@ struct console_tt_store { +@@ -191,6 +191,7 @@ struct console_tt_store { static int console_truetype_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -1128,7 +1128,7 @@ index 14fb81e9563..c0a5ad1a51e 100644 struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *end, *line; -@@ -233,6 +234,12 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -234,6 +235,12 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1141,7 +1141,7 @@ index 14fb81e9563..c0a5ad1a51e 100644 return 0; } -@@ -240,6 +247,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -241,6 +248,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, uint rowsrc, uint count) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -1149,7 +1149,7 @@ index 14fb81e9563..c0a5ad1a51e 100644 struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *dst; -@@ -258,6 +266,12 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -259,6 +267,12 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, for (i = 0; i < priv->pos_ptr; i++) priv->pos[i].ypos -= diff; @@ -1162,7 +1162,7 @@ index 14fb81e9563..c0a5ad1a51e 100644 return 0; } -@@ -415,6 +429,13 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, +@@ -419,6 +433,13 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, line += vid_priv->line_length; } @@ -1177,10 +1177,10 @@ index 14fb81e9563..c0a5ad1a51e 100644 if (ret) return ret; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 09172f1f7f4..06e344f415c 100644 +index 96b8962b8de..cbdda274f2d 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -199,6 +199,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -192,6 +192,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, } line += priv->line_length; } @@ -1189,9 +1189,9 @@ index 09172f1f7f4..06e344f415c 100644 if (ret) return ret; -- -2.43.0 +2.45.1 -From b44368015bdea3e71cb1c392afa124e6d26ab798 Mon Sep 17 00:00:00 2001 +From 077a499a8fc2ccad28114264c8792d342bf8536c Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Mon, 21 Aug 2023 16:51:04 +0300 Subject: [PATCH 07/13] video: test: Test video damage tracking via vidconsole @@ -1209,10 +1209,10 @@ Reviewed-by: Simon Glass 2 files changed, 57 insertions(+) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index bc5bcb2a623..fa6b23f365c 100644 +index 93b52f2de5c..2051f0a3d7a 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig -@@ -311,6 +311,7 @@ CONFIG_USB_ETH_CDC=y +@@ -319,6 +319,7 @@ CONFIG_USB_ETH_CDC=y CONFIG_VIDEO=y CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_VIDEO_COPY=y @@ -1285,9 +1285,9 @@ index e4bd27a6b76..8c7d9800a42 100644 +} +DM_TEST(dm_test_video_damage, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); -- -2.43.0 +2.45.1 -From 9278f6c9492b0a7960a6ee2294a524ef150bf1cb Mon Sep 17 00:00:00 2001 +From e5b927255d0375408a5ff14403a978aca09fa68f Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:05 +0300 Subject: [PATCH 08/13] video: Add damage notification on bmp display @@ -1317,9 +1317,9 @@ index 45f003c8251..10943b9ca19 100644 fb = (uchar *)(priv->fb + y * priv->line_length + x * bpix / 8); ret = video_sync_copy(dev, start, fb); -- -2.43.0 +2.45.1 -From b56b97ef176a2753a9827d761760a829eece00d0 Mon Sep 17 00:00:00 2001 +From d31ef2b17c98d0b7b1040e5abda99bb1720eb8c0 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:06 +0300 Subject: [PATCH 09/13] efi_loader: GOP: Add damage notification on BLT @@ -1338,10 +1338,10 @@ Reviewed-by: Simon Glass 1 file changed, 7 insertions(+) diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c -index a09db31eb46..ede77af1fe4 100644 +index 41e12fa7246..1694e23dcc6 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c -@@ -25,6 +25,7 @@ static const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; +@@ -24,6 +24,7 @@ static const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; * @ops: graphical output protocol interface * @info: graphical output mode information * @mode: graphical output mode @@ -1349,7 +1349,7 @@ index a09db31eb46..ede77af1fe4 100644 * @bpix: bits per pixel * @fb: frame buffer */ -@@ -33,6 +34,7 @@ struct efi_gop_obj { +@@ -32,6 +33,7 @@ struct efi_gop_obj { struct efi_gop ops; struct efi_gop_mode_info info; struct efi_gop_mode mode; @@ -1357,7 +1357,7 @@ index a09db31eb46..ede77af1fe4 100644 /* Fields we only have access to during init */ u32 bpix; void *fb; -@@ -121,6 +123,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, +@@ -120,6 +122,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, u32 *fb32 = gopobj->fb; u16 *fb16 = gopobj->fb; struct efi_gop_pixel *buffer = __builtin_assume_aligned(bufferp, 4); @@ -1365,7 +1365,7 @@ index a09db31eb46..ede77af1fe4 100644 if (delta) { /* Check for 4 byte alignment */ -@@ -244,6 +247,9 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, +@@ -243,6 +246,9 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, dlineoff += dwidth; } @@ -1375,7 +1375,7 @@ index a09db31eb46..ede77af1fe4 100644 return EFI_SUCCESS; } -@@ -550,6 +556,7 @@ efi_status_t efi_gop_register(void) +@@ -549,6 +555,7 @@ efi_status_t efi_gop_register(void) gopobj->info.pixels_per_scanline = col; gopobj->bpix = bpix; gopobj->fb = map_sysmem(fb_base, fb_size); @@ -1384,9 +1384,9 @@ index a09db31eb46..ede77af1fe4 100644 return EFI_SUCCESS; } -- -2.43.0 +2.45.1 -From e77793c6320f827b4f8efc06bd55d38037b6373e Mon Sep 17 00:00:00 2001 +From 63e4c90e38c476d89148f4328778af0adcbe7adf Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:07 +0300 Subject: [PATCH 10/13] video: Only dcache flush damaged lines @@ -1406,10 +1406,10 @@ Signed-off-by: Alper Nebi Yasak 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 06e344f415c..ac2141892bf 100644 +index cbdda274f2d..e009be4f55d 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -385,6 +385,41 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) +@@ -381,6 +381,41 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) priv->damage.yend = max(yend, priv->damage.yend); } @@ -1451,7 +1451,7 @@ index 06e344f415c..ac2141892bf 100644 /* Flush video activity to the caches */ int video_sync(struct udevice *vid, bool force) { -@@ -404,11 +439,7 @@ int video_sync(struct udevice *vid, bool force) +@@ -400,11 +435,7 @@ int video_sync(struct udevice *vid, bool force) * out whether it exists? For now, ARM is safe. */ #if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) @@ -1465,12 +1465,15 @@ index 06e344f415c..ac2141892bf 100644 static ulong last_sync; -- -2.43.0 +2.45.1 -From e9d51b4dcbfa43aa0e4d2b4f285bf94c295603e4 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Mon, 21 Aug 2023 16:51:08 +0300 -Subject: [PATCH 11/13] video: Use VIDEO_DAMAGE for VIDEO_COPY +From 09e504af253b3f3062891d59ad17c4fb8193dcc7 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Sat, 25 May 2024 12:18:41 +0100 +Subject: [PATCH 11/13] From e9d51b4dcbfa43aa0e4d2b4f285bf94c295603e4 Mon Sep + 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug + 2023 16:51:08 +0300 Subject: [PATCH 11/13] video: Use VIDEO_DAMAGE for + VIDEO_COPY CONFIG_VIDEO_COPY implemented a range-based copying mechanism: If we print a single character, it will always copy the full range of bytes @@ -1494,6 +1497,7 @@ Signed-off-by: Alexander Graf call video_sync() before copy_fb check, update video_copy test] Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak +Signed-off-by: Peter Robinson --- configs/sandbox_defconfig | 1 - drivers/video/Kconfig | 5 ++ @@ -1509,10 +1513,10 @@ Signed-off-by: Alper Nebi Yasak 11 files changed, 43 insertions(+), 248 deletions(-) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index fa6b23f365c..bc5bcb2a623 100644 +index 2051f0a3d7a..93b52f2de5c 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig -@@ -311,7 +311,6 @@ CONFIG_USB_ETH_CDC=y +@@ -319,7 +319,6 @@ CONFIG_USB_ETH_CDC=y CONFIG_VIDEO=y CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_VIDEO_COPY=y @@ -1521,7 +1525,7 @@ index fa6b23f365c..bc5bcb2a623 100644 CONFIG_CONSOLE_TRUETYPE=y CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index ac3edbfdb54..438cf3d4899 100644 +index 7815b590481..88c6f8e6897 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -83,11 +83,14 @@ config VIDEO_PCI_DEFAULT_FB_SIZE @@ -1549,10 +1553,10 @@ index ac3edbfdb54..438cf3d4899 100644 bool "Generic PWM based Backlight Driver" depends on BACKLIGHT && DM_PWM diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c -index ad7ce860e9d..5625dbb8d08 100644 +index 6634d3f27da..fbfd2caabc6 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c -@@ -35,10 +35,6 @@ static int console_set_row(struct udevice *dev, uint row, int clr) +@@ -36,10 +36,6 @@ static int console_set_row(struct udevice *dev, uint row, int clr) fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); end = dst; @@ -1563,7 +1567,7 @@ index ad7ce860e9d..5625dbb8d08 100644 video_damage(dev->parent, 0, fontdata->height * row, -@@ -57,14 +53,11 @@ static int console_move_rows(struct udevice *dev, uint rowdst, +@@ -58,14 +54,11 @@ static int console_move_rows(struct udevice *dev, uint rowdst, void *dst; void *src; int size; @@ -1579,7 +1583,7 @@ index ad7ce860e9d..5625dbb8d08 100644 video_damage(dev->parent, 0, -@@ -108,10 +101,6 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, char ch) +@@ -110,10 +103,6 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) fontdata->width, fontdata->height); @@ -1591,10 +1595,10 @@ index ad7ce860e9d..5625dbb8d08 100644 } diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c -index 6c3e7c1bb8d..6e9067d1c7f 100644 +index 8129c7b2aa7..fa0b4faf63b 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c -@@ -21,7 +21,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) +@@ -22,7 +22,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) int pbytes = VNBYTES(vid_priv->bpix); void *start, *dst, *line; int i, j; @@ -1602,7 +1606,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 start = vid_priv->fb + vid_priv->line_length - (row + 1) * fontdata->height * pbytes; -@@ -32,9 +31,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) +@@ -33,9 +32,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); line += vid_priv->line_length; } @@ -1612,7 +1616,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 video_damage(dev->parent, vid_priv->xsize - ((row + 1) * fontdata->height), -@@ -54,7 +50,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -55,7 +51,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, int pbytes = VNBYTES(vid_priv->bpix); void *dst; void *src; @@ -1621,7 +1625,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 dst = vid_priv->fb + vid_priv->line_length - (rowdst + count) * fontdata->height * pbytes; -@@ -62,10 +58,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -63,10 +59,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, (rowsrc + count) * fontdata->height * pbytes; for (j = 0; j < vid_priv->ysize; j++) { @@ -1633,7 +1637,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 src += vid_priv->line_length; dst += vid_priv->line_length; } -@@ -104,10 +97,6 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, char ch) +@@ -106,10 +99,6 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, int cp) return ret; /* We draw backwards from 'start, so account for the first line */ @@ -1644,7 +1648,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 video_damage(dev->parent, vid_priv->xsize - y - fontdata->height, linenum - 1, -@@ -125,7 +114,7 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) +@@ -127,7 +116,7 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) struct video_fontdata *fontdata = priv->fontdata; void *start, *line, *dst, *end; int pixels = fontdata->height * vid_priv->xsize; @@ -1653,7 +1657,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 int pbytes = VNBYTES(vid_priv->bpix); start = vid_priv->fb + vid_priv->ysize * vid_priv->line_length - -@@ -135,9 +124,6 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) +@@ -137,9 +126,6 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); end = dst; @@ -1663,7 +1667,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 video_damage(dev->parent, 0, -@@ -163,8 +149,7 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -165,8 +151,7 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, vid_priv->line_length; src = end - (rowsrc + count) * fontdata->height * vid_priv->line_length; @@ -1673,7 +1677,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 video_damage(dev->parent, 0, -@@ -199,11 +184,6 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, char ch) +@@ -202,11 +187,6 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -1685,7 +1689,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 video_damage(dev->parent, x - fontdata->width + 1, linenum - fontdata->height + 1, -@@ -220,7 +200,7 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) +@@ -223,7 +203,7 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) struct video_fontdata *fontdata = priv->fontdata; int pbytes = VNBYTES(vid_priv->bpix); void *start, *dst, *line; @@ -1694,7 +1698,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 start = vid_priv->fb + row * fontdata->height * pbytes; line = start; -@@ -230,9 +210,6 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) +@@ -233,9 +213,6 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); line += vid_priv->line_length; } @@ -1704,7 +1708,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 video_damage(dev->parent, row * fontdata->height, -@@ -252,16 +229,13 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -255,16 +232,13 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, int pbytes = VNBYTES(vid_priv->bpix); void *dst; void *src; @@ -1723,7 +1727,7 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 src += vid_priv->line_length; dst += vid_priv->line_length; } -@@ -296,10 +270,6 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, char ch) +@@ -300,10 +274,6 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, int cp) line = start; ret = fill_char_horizontally(pfont, &line, vid_priv, fontdata, NORMAL_DIRECTION); @@ -1735,10 +1739,10 @@ index 6c3e7c1bb8d..6e9067d1c7f 100644 return ret; diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c -index c0a5ad1a51e..7aa1cdaef88 100644 +index ed6c9cbb4f4..4cf9b013293 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c -@@ -194,7 +194,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -195,7 +195,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *end, *line; @@ -1746,7 +1750,7 @@ index c0a5ad1a51e..7aa1cdaef88 100644 line = vid_priv->fb + row * met->font_size * vid_priv->line_length; end = line + met->font_size * vid_priv->line_length; -@@ -230,9 +229,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -231,9 +230,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) default: return -ENOSYS; } @@ -1756,7 +1760,7 @@ index c0a5ad1a51e..7aa1cdaef88 100644 video_damage(dev->parent, 0, -@@ -252,14 +248,11 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -253,14 +249,11 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, struct console_tt_metrics *met = priv->cur_met; void *dst; void *src; @@ -1773,7 +1777,7 @@ index c0a5ad1a51e..7aa1cdaef88 100644 /* Scroll up our position history */ diff = (rowsrc - rowdst) * met->font_size; -@@ -292,7 +285,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, +@@ -293,7 +286,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, u8 *bits, *data; int advance; void *start, *end, *line; @@ -1781,8 +1785,8 @@ index c0a5ad1a51e..7aa1cdaef88 100644 + int row; /* First get some basic metrics about this character */ - stbtt_GetCodepointHMetrics(font, ch, &advance, &lsb); -@@ -436,9 +429,6 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, + stbtt_GetCodepointHMetrics(font, cp, &advance, &lsb); +@@ -440,9 +433,6 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, width, height); @@ -1793,10 +1797,10 @@ index c0a5ad1a51e..7aa1cdaef88 100644 return width_frac; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c -index 22d55df71f6..16b38a27d39 100644 +index 5d06e51ff23..5f1dd0aaa41 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c -@@ -751,22 +751,6 @@ UCLASS_DRIVER(vidconsole) = { +@@ -760,22 +760,6 @@ UCLASS_DRIVER(vidconsole) = { .per_device_auto = sizeof(struct vidconsole_priv), }; @@ -1820,10 +1824,10 @@ index 22d55df71f6..16b38a27d39 100644 { int ret; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index ac2141892bf..afbd4670240 100644 +index e009be4f55d..b3eeccb996d 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -160,7 +160,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -153,7 +153,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, struct video_priv *priv = dev_get_uclass_priv(dev); void *start, *line; int pixels = xend - xstart; @@ -1832,7 +1836,7 @@ index ac2141892bf..afbd4670240 100644 start = priv->fb + ystart * priv->line_length; start += xstart * VNBYTES(priv->bpix); -@@ -200,10 +200,6 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -193,10 +193,6 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, line += priv->line_length; } @@ -1843,7 +1847,7 @@ index ac2141892bf..afbd4670240 100644 video_damage(dev, xstart, ystart, xend - xstart, yend - ystart); return 0; -@@ -223,7 +219,6 @@ int video_reserve_from_bloblist(struct video_handoff *ho) +@@ -219,7 +215,6 @@ int video_reserve_from_bloblist(struct video_handoff *ho) int video_fill(struct udevice *dev, u32 colour) { struct video_priv *priv = dev_get_uclass_priv(dev); @@ -1851,7 +1855,7 @@ index ac2141892bf..afbd4670240 100644 switch (priv->bpix) { case VIDEO_BPP16: -@@ -248,9 +243,6 @@ int video_fill(struct udevice *dev, u32 colour) +@@ -244,9 +239,6 @@ int video_fill(struct udevice *dev, u32 colour) memset(priv->fb, colour, priv->fb_size); break; } @@ -1861,7 +1865,7 @@ index ac2141892bf..afbd4670240 100644 video_damage(dev, 0, 0, priv->xsize, priv->ysize); -@@ -420,6 +412,27 @@ static void video_flush_dcache(struct udevice *vid) +@@ -416,6 +408,27 @@ static void video_flush_dcache(struct udevice *vid) } #endif @@ -1889,7 +1893,7 @@ index ac2141892bf..afbd4670240 100644 /* Flush video activity to the caches */ int video_sync(struct udevice *vid, bool force) { -@@ -427,6 +440,9 @@ int video_sync(struct udevice *vid, bool force) +@@ -423,6 +436,9 @@ int video_sync(struct udevice *vid, bool force) struct video_ops *ops = video_get_ops(vid); int ret; @@ -2042,10 +2046,10 @@ index 1310195f307..29eff3c0900 100644 * video_damage() - Notify the video subsystem about screen updates. * diff --git a/include/video_console.h b/include/video_console.h -index bde67fa9a5a..43bc7db489a 100644 +index 8b5928dc5eb..8806d10f946 100644 --- a/include/video_console.h +++ b/include/video_console.h -@@ -527,56 +527,4 @@ void vidconsole_list_fonts(struct udevice *dev); +@@ -529,56 +529,4 @@ void vidconsole_list_fonts(struct udevice *dev); */ int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep); @@ -2124,9 +2128,9 @@ index 8c7d9800a42..4c3bcd26e94 100644 return 0; } -- -2.43.0 +2.45.1 -From 8831933fcc6cf60308e6ede438409717ab1a94a6 Mon Sep 17 00:00:00 2001 +From 6b90fed4745a705c1ca660a346a3563f0da8def5 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:09 +0300 Subject: [PATCH 12/13] video: Always compile cache flushing code @@ -2151,10 +2155,10 @@ Signed-off-by: Alper Nebi Yasak 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index afbd4670240..2c7777261ad 100644 +index b3eeccb996d..33ad9ff3fab 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -377,11 +377,13 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) +@@ -373,11 +373,13 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) priv->damage.yend = max(yend, priv->damage.yend); } @@ -2169,7 +2173,7 @@ index afbd4670240..2c7777261ad 100644 if (!priv->flush_dcache) return; -@@ -410,7 +412,6 @@ static void video_flush_dcache(struct udevice *vid) +@@ -406,7 +408,6 @@ static void video_flush_dcache(struct udevice *vid) } } } @@ -2177,7 +2181,7 @@ index afbd4670240..2c7777261ad 100644 static void video_flush_copy(struct udevice *vid) { -@@ -449,14 +450,9 @@ int video_sync(struct udevice *vid, bool force) +@@ -445,14 +446,9 @@ int video_sync(struct udevice *vid, bool force) return ret; } @@ -2195,9 +2199,9 @@ index afbd4670240..2c7777261ad 100644 if (force || get_timer(last_sync) > 100) { -- -2.43.0 +2.45.1 -From 676104d8420152c97321c4fa22bb925fb139dd66 Mon Sep 17 00:00:00 2001 +From 7cfa667a11f245596e4b31842b0d646929be24e9 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:10 +0300 Subject: [PATCH 13/13] video: Enable VIDEO_DAMAGE for drivers that need it @@ -2228,10 +2232,10 @@ Reviewed-by: Simon Glass 9 files changed, 16 insertions(+) diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig -index a4a8d8e9445..1d32a3140bf 100644 +index ddf9414b08e..3c9745065ba 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -846,6 +846,7 @@ config VIDEO_SUNXI +@@ -863,6 +863,7 @@ config VIDEO_SUNXI depends on !SUNXI_GEN_NCAT2 select VIDEO select DISPLAY @@ -2240,7 +2244,7 @@ index a4a8d8e9445..1d32a3140bf 100644 default y ---help--- diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index 438cf3d4899..a736ee6724c 100644 +index 88c6f8e6897..06d3ed8a736 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -499,6 +499,7 @@ config VIDEO_LCD_ANX9804 @@ -2259,7 +2263,7 @@ index 438cf3d4899..a736ee6724c 100644 help The graphics processor already sets up the display so this driver simply checks the resolution and then sets up the frame buffer with -@@ -654,6 +656,7 @@ source "drivers/video/meson/Kconfig" +@@ -671,6 +673,7 @@ source "drivers/video/meson/Kconfig" config VIDEO_MVEBU bool "Armada XP LCD controller" @@ -2267,7 +2271,7 @@ index 438cf3d4899..a736ee6724c 100644 ---help--- Support for the LCD controller integrated in the Marvell Armada XP SoC. -@@ -688,6 +691,7 @@ config NXP_TDA19988 +@@ -705,6 +708,7 @@ config NXP_TDA19988 config ATMEL_HLCD bool "Enable ATMEL video support using HLCDC" @@ -2275,7 +2279,7 @@ index 438cf3d4899..a736ee6724c 100644 help HLCDC supports video output to an attached LCD panel. -@@ -764,6 +768,7 @@ source "drivers/video/tidss/Kconfig" +@@ -781,6 +785,7 @@ source "drivers/video/tidss/Kconfig" config VIDEO_TEGRA124 bool "Enable video support on Tegra124" @@ -2283,7 +2287,7 @@ index 438cf3d4899..a736ee6724c 100644 help Tegra124 supports many video output options including eDP and HDMI. At present only eDP is supported by U-Boot. This option -@@ -778,6 +783,7 @@ source "drivers/video/imx/Kconfig" +@@ -795,6 +800,7 @@ source "drivers/video/imx/Kconfig" config VIDEO_MXS bool "Enable video support on i.MX28/i.MX6UL/i.MX7 SoCs" @@ -2291,7 +2295,7 @@ index 438cf3d4899..a736ee6724c 100644 help Enable framebuffer driver for i.MX28/i.MX6UL/i.MX7 processors -@@ -840,6 +846,7 @@ config VIDEO_DW_MIPI_DSI +@@ -857,6 +863,7 @@ config VIDEO_DW_MIPI_DSI config VIDEO_SIMPLE bool "Simple display driver for preconfigured display" @@ -2299,7 +2303,7 @@ index 438cf3d4899..a736ee6724c 100644 help Enables a simple generic display driver which utilizes the simple-framebuffer devicetree bindings. -@@ -858,6 +865,7 @@ config VIDEO_DT_SIMPLEFB +@@ -875,6 +882,7 @@ config VIDEO_DT_SIMPLEFB config VIDEO_MCDE_SIMPLE bool "Simple driver for ST-Ericsson MCDE with preconfigured display" @@ -2391,5 +2395,5 @@ index 95086f3a5d6..3291b3ceb8d 100644 TIDSS supports video output options LVDS and DPI . This option enables these supports which can be used on -- -2.43.0 +2.45.1 diff --git a/aarch64-boards b/aarch64-boards index 07154e5..f88eb85 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -7,7 +7,6 @@ bananapi_m64 beelink_gs1 dragonboard410c dragonboard820c -dragonboard845c eaidk-610-rk3399 emlid_neutis_n5_devboard evb-px5 @@ -75,6 +74,7 @@ pinephone-pro-rk3399 pinetab poplar puma-rk3399 +qcom_defconfig qemu_arm64 roc-cc-rk3328 rock-4c-plus-rk3399 diff --git a/phy-rockchip-inno-usb2-Write-to-correct-GRF.patch b/phy-rockchip-inno-usb2-Write-to-correct-GRF.patch deleted file mode 100644 index b240ad6..0000000 --- a/phy-rockchip-inno-usb2-Write-to-correct-GRF.patch +++ /dev/null @@ -1,572 +0,0 @@ -From patchwork Sun Feb 25 22:10:19 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Jonas Karlman -X-Patchwork-Id: 1903989 -X-Patchwork-Delegate: ykai007@gmail.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; - secure) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 - header.s=fe-e1b5cab7be header.b=yOZt1tiR; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4TjdHl4wttz23cw - for ; Mon, 26 Feb 2024 09:11:15 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 91BCF87E23; - Sun, 25 Feb 2024 23:10:57 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=kwiboo.se -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; - secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="yOZt1tiR"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id BFA6B87DA4; Sun, 25 Feb 2024 23:10:53 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) - (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 217BA87DFA - for ; Sun, 25 Feb 2024 23:10:49 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=kwiboo.se -Authentication-Results: phobos.denx.de; spf=pass - smtp.mailfrom=SRS0=31c0=KD=kwiboo.se=jonas@fe-bounces.kwiboo.se -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; - h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: - Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; - t=1708899036; bh=AzFTi2bcYYAtXfClfRKD6v/Yh+iTeLs39b0UoXgmBwI=; - b=yOZt1tiRwOXYRO3mwXmOiJo897JN79a+B1jEzPSXrDGT/XlOaEYuhCBCO4IIUTSOg1irZCZD0 - XierFKG1DECIT3JlIXV16mU6P9Dsg/amgtgJp8QQmuACEJ6JERBNINdt0i7+i0oUF0bmiYupJ+U - VY5LPHhscKquVc3LCEo/DcIMMX+gh3zOF15G4QPE6ldeQbs/Ys4bqYQ/cMe+X4ijANkou6hqNSw - VY/TylYiKqrMyUW8SKJ6oXRxluNhrYpWWde3hoCc0zjTEWW9dGzSbxX8NLmmhqTT0uGKH6/RrB0 - nNeuIgaMGTk7jCCUtbi4Vp99P9HYFnlfmTRXoVLEofxw== -From: Jonas Karlman -To: Kever Yang , Simon Glass , - Philipp Tomsich , Tom Rini , - Ren Jianing , Manoj Sai - , Jagan Teki - , Eugen Hristev , - Frank Wang , Xavier Drudis Ferran - -Cc: u-boot@lists.denx.de, Jonas Karlman -Subject: [PATCH 1/2] phy: rockchip-inno-usb2: Write to correct GRF -Date: Sun, 25 Feb 2024 22:10:19 +0000 -Message-ID: <20240225221024.1974853-2-jonas@kwiboo.se> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20240225221024.1974853-1-jonas@kwiboo.se> -References: <20240225221024.1974853-1-jonas@kwiboo.se> -MIME-Version: 1.0 -X-Report-Abuse-To: abuse@forwardemail.net -X-Report-Abuse: abuse@forwardemail.net -X-Complaints-To: abuse@forwardemail.net -X-ForwardEmail-Version: 0.4.40 -X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, - 149.28.215.223 -X-ForwardEmail-ID: 65dbbada46c899733a83b3ec -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 - -On RK3399 the USB2PHY regs are located in the common GRF, remaining SoCs -that is supported by this driver have the USB2PHY regs in a different -GRF. - -When support for RK356x, RK3588 and RK3328 was added this driver was -never updated to use correct GRF and have instead incorrectly written -to wrong GRF for these SoCs. - -The default reset values for the USB2PHY have made USB mostly working -even when wrong GRF was used, however, following have been observed: - - scanning bus usb@fd840000 for devices... - ERROR: USB-error: DEVICENOTRESPONDING: Device did not respond to token (IN) or did - not provide a handshake (OUT) (5) - ERROR: USB-error: DEVICENOTRESPONDING: Device did not respond to token (IN) or did - not provide a handshake (OUT) (5) - unable to get device descriptor (error=-1) - -Fix this by using a regmap from rockchip,usbgrf prop and fall back to -getting a regmap for parent udevice instead of always getting the -common GRF. - -Also protect against accidental clear of bit 0 in a reg with offset 0, -only bind driver to enabled otg/host-ports and remove unused headers. - -Fixes: 3da15f0b49a2 ("phy: rockchip-inno-usb2: Add USB2 PHY for rk3568") -Fixes: cdf9010f6e17 ("phy: rockchip-inno-usb2: add initial support for rk3588 PHY") -Fixes: 9aa93d84038b ("phy: rockchip-inno-usb2: Add USB2 PHY for RK3328") -Signed-off-by: Jonas Karlman -Reviewed-by: Kever Yang ---- - drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 41 ++++++++++--------- - 1 file changed, 22 insertions(+), 19 deletions(-) - -diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -index 70e61eccb79a..7317128d135e 100644 ---- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -@@ -6,23 +6,16 @@ - * Copyright (C) 2020 Amarula Solutions(India) - */ - --#include - #include - #include --#include - #include - #include - #include - #include --#include -+#include - #include --#include --#include --#include - #include - --DECLARE_GLOBAL_DATA_PTR; -- - #define usleep_range(a, b) udelay((b)) - #define BIT_WRITEABLE_SHIFT 16 - -@@ -61,30 +54,39 @@ struct rockchip_usb2phy_cfg { - }; - - struct rockchip_usb2phy { -- void *reg_base; -+ struct regmap *reg_base; - struct clk phyclk; - const struct rockchip_usb2phy_cfg *phy_cfg; - }; - --static inline int property_enable(void *reg_base, -+static inline int property_enable(struct regmap *base, - const struct usb2phy_reg *reg, bool en) - { - unsigned int val, mask, tmp; - -+ if (!reg->offset && !reg->enable && !reg->disable) -+ return 0; -+ - tmp = en ? reg->enable : reg->disable; - mask = GENMASK(reg->bitend, reg->bitstart); - val = (tmp << reg->bitstart) | (mask << BIT_WRITEABLE_SHIFT); - -- return writel(val, reg_base + reg->offset); -+ return regmap_write(base, reg->offset, val); - } - --static inline bool property_enabled(void *reg_base, -+static inline bool property_enabled(struct regmap *base, - const struct usb2phy_reg *reg) - { -+ int ret; - unsigned int tmp, orig; - unsigned int mask = GENMASK(reg->bitend, reg->bitstart); - -- orig = readl(reg_base + reg->offset); -+ if (!reg->offset && !reg->enable && !reg->disable) -+ return false; -+ -+ ret = regmap_read(base, reg->offset, &orig); -+ if (ret) -+ return false; - - tmp = (orig & mask) >> reg->bitstart; - return tmp != reg->disable; -@@ -248,7 +250,11 @@ static int rockchip_usb2phy_probe(struct udevice *dev) - unsigned int reg; - int index, ret; - -- priv->reg_base = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); -+ if (dev_read_bool(dev, "rockchip,usbgrf")) -+ priv->reg_base = -+ syscon_regmap_lookup_by_phandle(dev, "rockchip,usbgrf"); -+ else -+ priv->reg_base = syscon_get_regmap(dev_get_parent(dev)); - if (IS_ERR(priv->reg_base)) - return PTR_ERR(priv->reg_base); - -@@ -305,11 +311,8 @@ static int rockchip_usb2phy_bind(struct udevice *dev) - int ret = 0; - - dev_for_each_subnode(node, dev) { -- if (!ofnode_valid(node)) { -- dev_info(dev, "subnode %s not found\n", dev->name); -- ret = -ENXIO; -- goto bind_fail; -- } -+ if (!ofnode_is_enabled(node)) -+ continue; - - name = ofnode_get_name(node); - dev_dbg(dev, "subnode %s\n", name); - -From patchwork Sun Feb 25 22:10:20 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Jonas Karlman -X-Patchwork-Id: 1903988 -X-Patchwork-Delegate: ykai007@gmail.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; - secure) header.d=kwiboo.se header.i=@kwiboo.se header.a=rsa-sha256 - header.s=fe-e1b5cab7be header.b=Bv1sBawV; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4TjdHW2kk5z23cw - for ; Mon, 26 Feb 2024 09:11:03 +1100 (AEDT) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id EC90A87DF4; - Sun, 25 Feb 2024 23:10:54 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=kwiboo.se -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; - secure) header.d=kwiboo.se header.i=@kwiboo.se header.b="Bv1sBawV"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 445F387E21; Sun, 25 Feb 2024 23:10:51 +0100 (CET) -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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from smtp.forwardemail.net (smtp.forwardemail.net [149.28.215.223]) - (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 9C54487DF4 - for ; Sun, 25 Feb 2024 23:10:48 +0100 (CET) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=kwiboo.se -Authentication-Results: phobos.denx.de; spf=pass - smtp.mailfrom=SRS0=31c0=KD=kwiboo.se=jonas@fe-bounces.kwiboo.se -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; - h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: - Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; - t=1708899040; bh=DyusC9ORAR+XZuJiPJ/3cQGjPsGAIRRpa763lcRm9QI=; - b=Bv1sBawVhXXIyoD7RTT7PpAz6+xCx17DjVExzdjGWsgUube7Xho69mue9hWqeTSU0bCFYYtv7 - HD7t7qbOmnYD+L0UVg+SHdibpC38eSbz+ucYsZrMhZL1IiRJNWWlFyb0IZacRz+AeagLdc75goJ - qTiFcN9xKXoHBJKpyqXiwsuJJMOXWwg9aOhGc9HZ91jwYEXSai2WfZYxtzx23bl5U4pDvpDuJd9 - ijrjK7DdsrJyRm4ALrkvjlr2/gZguEXEzOiHrFbbIZn+QIZjKhbbSdTQOScvPdvnFFKG8F3wZsX - rdxXOykD/CZU8ni3ZAYh20CBo6kwKIBdthaDsbYR18nw== -From: Jonas Karlman -To: Kever Yang , Simon Glass , - Philipp Tomsich , Tom Rini -Cc: u-boot@lists.denx.de, Jonas Karlman -Subject: [PATCH 2/2] phy: rockchip-inno-usb2: Limit changes made to regs -Date: Sun, 25 Feb 2024 22:10:20 +0000 -Message-ID: <20240225221024.1974853-3-jonas@kwiboo.se> -X-Mailer: git-send-email 2.43.0 -In-Reply-To: <20240225221024.1974853-1-jonas@kwiboo.se> -References: <20240225221024.1974853-1-jonas@kwiboo.se> -MIME-Version: 1.0 -X-Report-Abuse-To: abuse@forwardemail.net -X-Report-Abuse: abuse@forwardemail.net -X-Complaints-To: abuse@forwardemail.net -X-ForwardEmail-Version: 0.4.40 -X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, - 149.28.215.223 -X-ForwardEmail-ID: 65dbbade46c899733a83b3fe -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 USB2PHY regs already contain working default reset values for RK3328 -and RK35xx as evidenced by the fact that this driver never has changed a -single value for these SoCs. - -Reduce to only configure utmi_suspend_n and utmi_sel bits similar to -what is currently done on RK3399. Also add missing clkout_ctl for RK3588. - -When enabled utmi_suspend_n is changed to normal mode and utmi_sel to -use otg/host controller utmi interface to phy. When disabled -utmi_suspend_n is changed to suspend mode and utmi_sel to use GRF utmi -interface to phy. - -Signed-off-by: Jonas Karlman -Reviewed-by: Kever Yang ---- - drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 117 +++--------------- - 1 file changed, 14 insertions(+), 103 deletions(-) - -diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -index 7317128d135e..d392aed2d4de 100644 ---- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -+++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c -@@ -35,16 +35,6 @@ struct usb2phy_reg { - - struct rockchip_usb2phy_port_cfg { - struct usb2phy_reg phy_sus; -- struct usb2phy_reg bvalid_det_en; -- struct usb2phy_reg bvalid_det_st; -- struct usb2phy_reg bvalid_det_clr; -- struct usb2phy_reg ls_det_en; -- struct usb2phy_reg ls_det_st; -- struct usb2phy_reg ls_det_clr; -- struct usb2phy_reg utmi_avalid; -- struct usb2phy_reg utmi_bvalid; -- struct usb2phy_reg utmi_ls; -- struct usb2phy_reg utmi_hstdet; - }; - - struct rockchip_usb2phy_cfg { -@@ -131,7 +121,6 @@ static int rockchip_usb2phy_init(struct phy *phy) - { - struct udevice *parent = dev_get_parent(phy->dev); - struct rockchip_usb2phy *priv = dev_get_priv(parent); -- const struct rockchip_usb2phy_port_cfg *port_cfg = us2phy_get_port(phy); - int ret; - - ret = clk_enable(&priv->phyclk); -@@ -140,14 +129,6 @@ static int rockchip_usb2phy_init(struct phy *phy) - return ret; - } - -- if (phy->id == USB2PHY_PORT_OTG) { -- property_enable(priv->reg_base, &port_cfg->bvalid_det_clr, true); -- property_enable(priv->reg_base, &port_cfg->bvalid_det_en, true); -- } else if (phy->id == USB2PHY_PORT_HOST) { -- property_enable(priv->reg_base, &port_cfg->bvalid_det_clr, true); -- property_enable(priv->reg_base, &port_cfg->bvalid_det_en, true); -- } -- - return 0; - } - -@@ -351,27 +332,13 @@ bind_fail: - static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = { - { - .reg = 0x100, -- .clkout_ctl = { 0x108, 4, 4, 1, 0 }, -+ .clkout_ctl = { 0x0108, 4, 4, 1, 0 }, - .port_cfgs = { - [USB2PHY_PORT_OTG] = { -- .phy_sus = { 0x0100, 15, 0, 0, 0x1d1 }, -- .bvalid_det_en = { 0x0110, 3, 2, 0, 3 }, -- .bvalid_det_st = { 0x0114, 3, 2, 0, 3 }, -- .bvalid_det_clr = { 0x0118, 3, 2, 0, 3 }, -- .ls_det_en = { 0x0110, 0, 0, 0, 1 }, -- .ls_det_st = { 0x0114, 0, 0, 0, 1 }, -- .ls_det_clr = { 0x0118, 0, 0, 0, 1 }, -- .utmi_avalid = { 0x0120, 10, 10, 0, 1 }, -- .utmi_bvalid = { 0x0120, 9, 9, 0, 1 }, -- .utmi_ls = { 0x0120, 5, 4, 0, 1 }, -+ .phy_sus = { 0x0100, 1, 0, 2, 1 }, - }, - [USB2PHY_PORT_HOST] = { -- .phy_sus = { 0x104, 15, 0, 0, 0x1d1 }, -- .ls_det_en = { 0x110, 1, 1, 0, 1 }, -- .ls_det_st = { 0x114, 1, 1, 0, 1 }, -- .ls_det_clr = { 0x118, 1, 1, 0, 1 }, -- .utmi_ls = { 0x120, 17, 16, 0, 1 }, -- .utmi_hstdet = { 0x120, 19, 19, 0, 1 } -+ .phy_sus = { 0x0104, 1, 0, 2, 1 }, - } - }, - }, -@@ -385,19 +352,9 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { - .port_cfgs = { - [USB2PHY_PORT_OTG] = { - .phy_sus = { 0xe454, 1, 0, 2, 1 }, -- .bvalid_det_en = { 0xe3c0, 3, 3, 0, 1 }, -- .bvalid_det_st = { 0xe3e0, 3, 3, 0, 1 }, -- .bvalid_det_clr = { 0xe3d0, 3, 3, 0, 1 }, -- .utmi_avalid = { 0xe2ac, 7, 7, 0, 1 }, -- .utmi_bvalid = { 0xe2ac, 12, 12, 0, 1 }, - }, - [USB2PHY_PORT_HOST] = { -- .phy_sus = { 0xe458, 1, 0, 0x2, 0x1 }, -- .ls_det_en = { 0xe3c0, 6, 6, 0, 1 }, -- .ls_det_st = { 0xe3e0, 6, 6, 0, 1 }, -- .ls_det_clr = { 0xe3d0, 6, 6, 0, 1 }, -- .utmi_ls = { 0xe2ac, 22, 21, 0, 1 }, -- .utmi_hstdet = { 0xe2ac, 23, 23, 0, 1 } -+ .phy_sus = { 0xe458, 1, 0, 2, 1 }, - } - }, - }, -@@ -407,19 +364,9 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { - .port_cfgs = { - [USB2PHY_PORT_OTG] = { - .phy_sus = { 0xe464, 1, 0, 2, 1 }, -- .bvalid_det_en = { 0xe3c0, 8, 8, 0, 1 }, -- .bvalid_det_st = { 0xe3e0, 8, 8, 0, 1 }, -- .bvalid_det_clr = { 0xe3d0, 8, 8, 0, 1 }, -- .utmi_avalid = { 0xe2ac, 10, 10, 0, 1 }, -- .utmi_bvalid = { 0xe2ac, 16, 16, 0, 1 }, - }, - [USB2PHY_PORT_HOST] = { -- .phy_sus = { 0xe468, 1, 0, 0x2, 0x1 }, -- .ls_det_en = { 0xe3c0, 11, 11, 0, 1 }, -- .ls_det_st = { 0xe3e0, 11, 11, 0, 1 }, -- .ls_det_clr = { 0xe3d0, 11, 11, 0, 1 }, -- .utmi_ls = { 0xe2ac, 26, 25, 0, 1 }, -- .utmi_hstdet = { 0xe2ac, 27, 27, 0, 1 } -+ .phy_sus = { 0xe468, 1, 0, 2, 1 }, - } - }, - }, -@@ -432,24 +379,10 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { - .clkout_ctl = { 0x0008, 4, 4, 1, 0 }, - .port_cfgs = { - [USB2PHY_PORT_OTG] = { -- .phy_sus = { 0x0000, 8, 0, 0x052, 0x1d1 }, -- .bvalid_det_en = { 0x0080, 2, 2, 0, 1 }, -- .bvalid_det_st = { 0x0084, 2, 2, 0, 1 }, -- .bvalid_det_clr = { 0x0088, 2, 2, 0, 1 }, -- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, -- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, -- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, -- .utmi_avalid = { 0x00c0, 10, 10, 0, 1 }, -- .utmi_bvalid = { 0x00c0, 9, 9, 0, 1 }, -- .utmi_ls = { 0x00c0, 5, 4, 0, 1 }, -+ .phy_sus = { 0x0000, 1, 0, 2, 1 }, - }, - [USB2PHY_PORT_HOST] = { -- .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d1 }, -- .ls_det_en = { 0x0080, 1, 1, 0, 1 }, -- .ls_det_st = { 0x0084, 1, 1, 0, 1 }, -- .ls_det_clr = { 0x0088, 1, 1, 0, 1 }, -- .utmi_ls = { 0x00c0, 17, 16, 0, 1 }, -- .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 } -+ .phy_sus = { 0x0004, 1, 0, 2, 1 }, - } - }, - }, -@@ -458,20 +391,10 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { - .clkout_ctl = { 0x0008, 4, 4, 1, 0 }, - .port_cfgs = { - [USB2PHY_PORT_OTG] = { -- .phy_sus = { 0x0000, 8, 0, 0x1d2, 0x1d1 }, -- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, -- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, -- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, -- .utmi_ls = { 0x00c0, 5, 4, 0, 1 }, -- .utmi_hstdet = { 0x00c0, 7, 7, 0, 1 } -+ .phy_sus = { 0x0000, 1, 0, 2, 1 }, - }, - [USB2PHY_PORT_HOST] = { -- .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d1 }, -- .ls_det_en = { 0x0080, 1, 1, 0, 1 }, -- .ls_det_st = { 0x0084, 1, 1, 0, 1 }, -- .ls_det_clr = { 0x0088, 1, 1, 0, 1 }, -- .utmi_ls = { 0x00c0, 17, 16, 0, 1 }, -- .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 } -+ .phy_sus = { 0x0004, 1, 0, 2, 1 }, - } - }, - }, -@@ -481,49 +404,37 @@ static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { - static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { - { - .reg = 0x0000, -+ .clkout_ctl = { 0x0000, 0, 0, 1, 0 }, - .port_cfgs = { - [USB2PHY_PORT_OTG] = { - .phy_sus = { 0x000c, 11, 11, 0, 1 }, -- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, -- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, -- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, -- .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, - } - }, - }, - { - .reg = 0x4000, -+ .clkout_ctl = { 0x0000, 0, 0, 1, 0 }, - .port_cfgs = { - [USB2PHY_PORT_OTG] = { -- .phy_sus = { 0x000c, 11, 11, 0, 0 }, -- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, -- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, -- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, -- .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, -+ .phy_sus = { 0x000c, 11, 11, 0, 1 }, - } - }, - }, - { - .reg = 0x8000, -+ .clkout_ctl = { 0x0000, 0, 0, 1, 0 }, - .port_cfgs = { - [USB2PHY_PORT_HOST] = { - .phy_sus = { 0x0008, 2, 2, 0, 1 }, -- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, -- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, -- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, -- .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, - } - }, - }, - { - .reg = 0xc000, -+ .clkout_ctl = { 0x0000, 0, 0, 1, 0 }, - .port_cfgs = { - [USB2PHY_PORT_HOST] = { - .phy_sus = { 0x0008, 2, 2, 0, 1 }, -- .ls_det_en = { 0x0080, 0, 0, 0, 1 }, -- .ls_det_st = { 0x0084, 0, 0, 0, 1 }, -- .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, -- .utmi_ls = { 0x00c0, 10, 9, 0, 1 }, - } - }, - }, diff --git a/rockchip-Add-initial-support-for-the-PinePhone-Pro.patch b/rockchip-Add-initial-support-for-the-PinePhone-Pro.patch deleted file mode 100644 index 337ea8c..0000000 --- a/rockchip-Add-initial-support-for-the-PinePhone-Pro.patch +++ /dev/null @@ -1,236 +0,0 @@ -From 72400858605c085cf94a6cf5599269c8c39e3e72 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Tue, 14 Mar 2023 12:30:36 +0000 -Subject: [PATCH] rockchip: pinephone pro: add initial display support - -Add proposed upstream DT patches for display, disable edp, -enable mipi and backlight, add required clocks. - -Clocks may not be required based on upstream review. Still -need to add panel pieces, the rk3288-evb has an example for -panel DT for u-boot, or may need to do a mipi addition to -simple-panel, or something else. - -Signed-off-by: Peter Robinson ---- - arch/arm/dts/rk3399-pinephone-pro.dts | 123 +++++++++++++++++++++++++ - configs/pinephone-pro-rk3399_defconfig | 3 +- - include/dt-bindings/clock/rk3399-cru.h | 2 + - 3 files changed, 127 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/dts/rk3399-pinephone-pro.dts b/arch/arm/dts/rk3399-pinephone-pro.dts -index 04403a76238..d0609d1b534 100644 ---- a/arch/arm/dts/rk3399-pinephone-pro.dts -+++ b/arch/arm/dts/rk3399-pinephone-pro.dts -@@ -29,6 +29,12 @@ - stdout-path = "serial2:115200n8"; - }; - -+ backlight: backlight { -+ compatible = "pwm-backlight"; -+ pwms = <&pwm0 0 1000000 0>; -+ pwm-delay-us = <10000>; -+ }; -+ - gpio-keys { - compatible = "gpio-keys"; - pinctrl-names = "default"; -@@ -102,6 +108,32 @@ - /* WL_REG_ON on module */ - reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>; - }; -+ -+ /* MIPI DSI panel 1.8v supply */ -+ vcc1v8_lcd: vcc1v8-lcd-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ regulator-name = "vcc1v8_lcd"; -+ regulator-min-microvolt = <1800000>; -+ regulator-max-microvolt = <1800000>; -+ vin-supply = <&vcc3v3_sys>; -+ gpio = <&gpio3 RK_PA5 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&display_pwren1>; -+ }; -+ -+ /* MIPI DSI panel 2.8v supply */ -+ vcc2v8_lcd: vcc2v8-lcd-regulator { -+ compatible = "regulator-fixed"; -+ enable-active-high; -+ regulator-name = "vcc2v8_lcd"; -+ regulator-min-microvolt = <2800000>; -+ regulator-max-microvolt = <2800000>; -+ vin-supply = <&vcc3v3_sys>; -+ gpio = <&gpio3 RK_PA1 GPIO_ACTIVE_HIGH>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&display_pwren>; -+ }; - }; - - &cpu_l0 { -@@ -132,6 +164,11 @@ - status = "okay"; - }; - -+&gpu { -+ mali-supply = <&vdd_gpu>; -+ status = "okay"; -+}; -+ - &i2c0 { - clock-frequency = <400000>; - i2c-scl-rising-time-ns = <168>; -@@ -214,6 +251,9 @@ - regulator-name = "vcc3v0_touch"; - regulator-min-microvolt = <3000000>; - regulator-max-microvolt = <3000000>; -+ regulator-state-mem { -+ regulator-off-in-suspend; -+ }; - }; - - vcca1v8_codec: LDO_REG3 { -@@ -347,6 +387,25 @@ - }; - }; - -+&i2c3 { -+ i2c-scl-rising-time-ns = <450>; -+ i2c-scl-falling-time-ns = <15>; -+ status = "okay"; -+ -+ touchscreen@14 { -+ compatible = "goodix,gt917s"; -+ reg = <0x14>; -+ interrupt-parent = <&gpio3>; -+ interrupts = ; -+ irq-gpios = <&gpio3 RK_PB5 GPIO_ACTIVE_HIGH>; -+ reset-gpios = <&gpio3 RK_PB4 GPIO_ACTIVE_HIGH>; -+ AVDD28-supply = <&vcc3v0_touch>; -+ VDDIO-supply = <&vcc3v0_touch>; -+ touchscreen-size-x = <720>; -+ touchscreen-size-y = <1440>; -+ }; -+}; -+ - &io_domains { - bt656-supply = <&vcc1v8_dvp>; - audio-supply = <&vcca1v8_codec>; -@@ -355,6 +414,40 @@ - status = "okay"; - }; - -+&mipi_dsi { -+ status = "okay"; -+ clock-master; -+ -+ ports { -+ mipi_out: port@1 { -+ #address-cells = <0>; -+ #size-cells = <0>; -+ reg = <1>; -+ -+ mipi_out_panel: endpoint { -+ remote-endpoint = <&mipi_in_panel>; -+ }; -+ }; -+ }; -+ -+ panel@0 { -+ compatible = "hannstar,hsd060bhw4"; -+ reg = <0>; -+ backlight = <&backlight>; -+ reset-gpios = <&gpio4 RK_PD1 GPIO_ACTIVE_LOW>; -+ vcc-supply = <&vcc2v8_lcd>; -+ iovcc-supply = <&vcc1v8_lcd>; -+ pinctrl-names = "default"; -+ pinctrl-0 = <&display_rst_l>; -+ -+ port { -+ mipi_in_panel: endpoint { -+ remote-endpoint = <&mipi_out_panel>; -+ }; -+ }; -+ }; -+}; -+ - &pmu_io_domains { - pmu1830-supply = <&vcc_1v8>; - status = "okay"; -@@ -387,6 +480,20 @@ - }; - }; - -+ dsi { -+ display_rst_l: display-rst-l { -+ rockchip,pins = <4 RK_PD1 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ -+ display_pwren: display-pwren { -+ rockchip,pins = <3 RK_PA1 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ -+ display_pwren1: display-pwren1 { -+ rockchip,pins = <3 RK_PA5 RK_FUNC_GPIO &pcfg_pull_down>; -+ }; -+ }; -+ - sound { - vcc1v8_codec_en: vcc1v8-codec-en { - rockchip,pins = <3 RK_PA4 RK_FUNC_GPIO &pcfg_pull_down>; -@@ -422,6 +529,10 @@ - status = "okay"; - }; - -+&pwm0 { -+ status = "okay"; -+}; -+ - &sdmmc { - bus-width = <4>; - cap-sd-highspeed; -@@ -472,3 +583,15 @@ - &uart2 { - status = "okay"; - }; -+ -+&vopb { -+ status = "okay"; -+ assigned-clocks = <&cru DCLK_VOP0_DIV>, <&cru DCLK_VOP0>, -+ <&cru ACLK_VOP0>, <&cru HCLK_VOP0>; -+ assigned-clock-rates = <0>, <0>, <400000000>, <100000000>; -+ assigned-clock-parents = <&cru PLL_CPLL>, <&cru DCLK_VOP0_FRAC>; -+}; -+ -+&vopb_mmu { -+ status = "okay"; -+}; -diff --git a/configs/pinephone-pro-rk3399_defconfig b/configs/pinephone-pro-rk3399_defconfig -index 54f9b90536c..1982131c805 100644 ---- a/configs/pinephone-pro-rk3399_defconfig -+++ b/configs/pinephone-pro-rk3399_defconfig -@@ -96,6 +96,7 @@ CONFIG_USB_ETHER_RTL8152=y - CONFIG_VIDEO=y - CONFIG_DISPLAY=y - CONFIG_VIDEO_ROCKCHIP=y --CONFIG_DISPLAY_ROCKCHIP_EDP=y -+CONFIG_DISPLAY_ROCKCHIP_MIPI=y -+CONFIG_BACKLIGHT_PWM=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/include/dt-bindings/clock/rk3399-cru.h b/include/dt-bindings/clock/rk3399-cru.h -index 211faf8fa89..7866e5266d2 100644 ---- a/include/dt-bindings/clock/rk3399-cru.h -+++ b/include/dt-bindings/clock/rk3399-cru.h -@@ -131,6 +131,8 @@ - #define DCLK_VOP0_DIV 182 - #define DCLK_VOP1_DIV 183 - #define DCLK_M0_PERILP 184 -+#define DCLK_VOP0_FRAC 185 -+#define DCLK_VOP1_FRAC 186 - - #define FCLK_CM0S 190 - --- -2.39.2 - diff --git a/rockchip-Enable-preboot-start-for-pci-usb.patch b/rockchip-Enable-preboot-start-for-pci-usb.patch index 408609e..56756bc 100644 --- a/rockchip-Enable-preboot-start-for-pci-usb.patch +++ b/rockchip-Enable-preboot-start-for-pci-usb.patch @@ -1,6 +1,6 @@ -From 367b3afc360e6fc92bd4cdca643ed2e4d928472d Mon Sep 17 00:00:00 2001 +From 3665ff79304fcb47427651125ccc2cfac01cb9f1 Mon Sep 17 00:00:00 2001 From: Peter Robinson -Date: Wed, 13 Mar 2024 19:14:50 +0000 +Date: Sat, 25 May 2024 12:23:42 +0100 Subject: [PATCH] rockchip: Enable preboot start for pci/usb Enable the preboot so nvme works OOTB @@ -16,15 +16,15 @@ Signed-off-by: Peter Robinson configs/rock-pi-4-rk3399_defconfig | 2 ++ configs/rock-pi-4c-rk3399_defconfig | 2 ++ configs/rock-pi-n10-rk3399pro_defconfig | 2 ++ - configs/rock960-rk3399_defconfig | 1 + + configs/rock960-rk3399_defconfig | 2 ++ configs/rockpro64-rk3399_defconfig | 2 ++ - 11 files changed, 20 insertions(+) + 11 files changed, 21 insertions(+) diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig -index b7c8e95b7b8..1e33083c138 100644 +index edacef29edf..71db7b7834e 100644 --- a/configs/firefly-rk3399_defconfig +++ b/configs/firefly-rk3399_defconfig -@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 +@@ -14,6 +14,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y @@ -32,12 +32,12 @@ index b7c8e95b7b8..1e33083c138 100644 +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-firefly.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y - CONFIG_MISC_INIT_R=y + CONFIG_SPL_MAX_SIZE=0x40000 diff --git a/configs/nanopc-t4-rk3399_defconfig b/configs/nanopc-t4-rk3399_defconfig -index c18e7b1bd16..e9a18eb3e9f 100644 +index c63f4c076d5..7174b82cfa4 100644 --- a/configs/nanopc-t4-rk3399_defconfig +++ b/configs/nanopc-t4-rk3399_defconfig -@@ -17,6 +17,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 +@@ -14,6 +14,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y @@ -45,24 +45,24 @@ index c18e7b1bd16..e9a18eb3e9f 100644 +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopc-t4.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y - CONFIG_SPL_MAX_SIZE=0x2e000 + CONFIG_SPL_MAX_SIZE=0x40000 diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig -index de357415fbe..4168adb1935 100644 +index 5d3e32f9108..c9b3615f2ff 100644 --- a/configs/pinebook-pro-rk3399_defconfig +++ b/configs/pinebook-pro-rk3399_defconfig -@@ -24,6 +24,7 @@ CONFIG_PCI=y +@@ -21,6 +21,7 @@ CONFIG_PCI=y CONFIG_DEBUG_UART=y CONFIG_BOOTDELAY=3 CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinebook-pro.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y - CONFIG_MISC_INIT_R=y + CONFIG_SPL_MAX_SIZE=0x40000 diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig -index de6539bedf4..61c6182d27e 100644 +index a57899bfdfa..bd7030b237c 100644 --- a/configs/roc-pc-mezzanine-rk3399_defconfig +++ b/configs/roc-pc-mezzanine-rk3399_defconfig -@@ -23,6 +23,8 @@ CONFIG_SPL_SPI=y +@@ -20,6 +20,8 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y @@ -72,12 +72,12 @@ index de6539bedf4..61c6182d27e 100644 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig -index 18525c8bf50..89e9f69eb63 100644 +index 80dc44986e7..0ff8afe8e1e 100644 --- a/configs/rock-4c-plus-rk3399_defconfig +++ b/configs/rock-4c-plus-rk3399_defconfig -@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -85,49 +85,49 @@ index 18525c8bf50..89e9f69eb63 100644 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-4c-plus.dtb" CONFIG_DISPLAY_BOARDINFO_LATE=y diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se-rk3399_defconfig -index 171de23ec8f..d2769a2f516 100644 +index f52d4bf9913..72ff304cff7 100644 --- a/configs/rock-4se-rk3399_defconfig +++ b/configs/rock-4se-rk3399_defconfig -@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y # CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_SPL_FIT_SIGNATURE=y - CONFIG_LEGACY_IMAGE_FORMAT=y + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-4se.dtb" diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig -index 83fc4ad7dab..24ca614fe5a 100644 +index e71c4588b94..387dbf83be3 100644 --- a/configs/rock-pi-4-rk3399_defconfig +++ b/configs/rock-pi-4-rk3399_defconfig -@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y # CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_SPL_FIT_SIGNATURE=y - CONFIG_LEGACY_IMAGE_FORMAT=y + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4a.dtb" diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig -index 089344097e0..83c2cfba157 100644 +index 14373933a34..34e09eeccd2 100644 --- a/configs/rock-pi-4c-rk3399_defconfig +++ b/configs/rock-pi-4c-rk3399_defconfig -@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y # CONFIG_ANDROID_BOOT_IMAGE is not set CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4c.dtb" - CONFIG_DISPLAY_BOARDINFO_LATE=y diff --git a/configs/rock-pi-n10-rk3399pro_defconfig b/configs/rock-pi-n10-rk3399pro_defconfig -index dc4b3b40380..db34bc70a22 100644 +index ec995a54a0e..1a973ea2c97 100644 --- a/configs/rock-pi-n10-rk3399pro_defconfig +++ b/configs/rock-pi-n10-rk3399pro_defconfig -@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 +@@ -13,6 +13,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y @@ -137,30 +137,31 @@ index dc4b3b40380..db34bc70a22 100644 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399pro-rock-pi-n10.dtb" # CONFIG_CONSOLE_MUX is not set diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig -index b93dda56593..6d1b352a855 100644 +index 8fff3ed17c2..ea6d6d4a319 100644 --- a/configs/rock960-rk3399_defconfig +++ b/configs/rock960-rk3399_defconfig -@@ -17,6 +17,7 @@ CONFIG_SYS_LOAD_ADDR=0x800800 +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y - CONFIG_USE_PREBOOT=y ++CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock960.dtb" CONFIG_SYS_PBSIZE=1052 CONFIG_DISPLAY_BOARDINFO_LATE=y diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig -index 711541f8462..8c1ea1a0b63 100644 +index fc0804a0b80..9a94d96b148 100644 --- a/configs/rockpro64-rk3399_defconfig +++ b/configs/rockpro64-rk3399_defconfig -@@ -21,6 +21,8 @@ CONFIG_SPL_SPI=y +@@ -19,6 +19,8 @@ CONFIG_SPL_SPI=y CONFIG_SYS_LOAD_ADDR=0x800800 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_SPL_FIT_SIGNATURE=y - CONFIG_LEGACY_IMAGE_FORMAT=y CONFIG_BOOTSTAGE=y + CONFIG_BOOTSTAGE_REPORT=y + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb" -- -2.44.0 +2.45.1 diff --git a/rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch b/rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch deleted file mode 100644 index e2b54b4..0000000 --- a/rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch +++ /dev/null @@ -1,691 +0,0 @@ -From 0149cf303734fad55f1d733628f76a6994d1436d Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sun, 10 Mar 2024 18:50:57 +0000 -Subject: [PATCH 1/4] rockchip: Update the default USB Product ID value - -RK3036 is using the USB product id normally used by RK3066B, and RK3328 -is using the product id normally used by RK3368. - -Fix this and update the default USB_GADGET_PRODUCT_NUM Kconfig option -for remaining supported Rockchip SoCs to match the product id used in -Maskrom mode. - -Also remove a reference to an undefined ROCKCHIP_RK3229 Kconfig symbol. - -Signed-off-by: Jonas Karlman -Reviewed-by: Kever Yang ---- - drivers/usb/gadget/Kconfig | 15 ++++++++++++--- - 1 file changed, 12 insertions(+), 3 deletions(-) - -diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig -index c72a8047635..4621a6fd5e6 100644 ---- a/drivers/usb/gadget/Kconfig -+++ b/drivers/usb/gadget/Kconfig -@@ -70,12 +70,21 @@ config USB_GADGET_PRODUCT_NUM - hex "Product ID of the USB device" - default 0x701a if ARCH_TEGRA - default 0x1010 if ARCH_SUNXI -- default 0x310a if ROCKCHIP_RK3036 -+ default 0x110a if ROCKCHIP_RV1108 -+ default 0x110b if ROCKCHIP_RV1126 - default 0x300a if ROCKCHIP_RK3066 -+ default 0x301a if ROCKCHIP_RK3036 -+ default 0x310b if ROCKCHIP_RK3188 - default 0x310c if ROCKCHIP_RK3128 -- default 0x320a if ROCKCHIP_RK3229 || ROCKCHIP_RK3288 -- default 0x330a if ROCKCHIP_RK3328 -+ default 0x320a if ROCKCHIP_RK3288 -+ default 0x320b if ROCKCHIP_RK322X -+ default 0x320c if ROCKCHIP_RK3328 -+ default 0x330a if ROCKCHIP_RK3368 - default 0x330c if ROCKCHIP_RK3399 -+ default 0x330d if ROCKCHIP_PX30 -+ default 0x330e if ROCKCHIP_RK3308 -+ default 0x350a if ROCKCHIP_RK3568 -+ default 0x350b if ROCKCHIP_RK3588 - default 0x0 - help - Product ID of the USB device emulated, reported to the host device. --- -2.44.0 - -From 3b4d52ef627bb3899c331ff24fe31cec5f445069 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sun, 10 Mar 2024 18:50:58 +0000 -Subject: [PATCH 2/4] rockchip: board: Prepare for use of DM_USB_GADGET with - DWC2_OTG - -The board_usb_init() and board_usb_cleanup() functions is always -included when USB_GADGET and USB_GADGET_DWC2_OTG is enabled. - -Prepare for a change to use DM_USB_GADGET with DWC2_OTG by adding an -extra ifdef condition. The extra separate ifdef for USB_GADGET prepare -for next patch that adds a g_dnl_bind_fixup() function. - -Signed-off-by: Jonas Karlman -Reviewed-by: Kever Yang ---- - arch/arm/mach-rockchip/board.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c -index 2620530e03f..2ec670dde69 100644 ---- a/arch/arm/mach-rockchip/board.c -+++ b/arch/arm/mach-rockchip/board.c -@@ -205,7 +205,8 @@ void enable_caches(void) - } - #endif - --#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) -+#if IS_ENABLED(CONFIG_USB_GADGET) -+#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET) - #include - #include - #include -@@ -281,6 +282,7 @@ int board_usb_cleanup(int index, enum usb_init_type init) - return 0; - } - #endif /* CONFIG_USB_GADGET_DWC2_OTG */ -+#endif /* CONFIG_USB_GADGET */ - - #if IS_ENABLED(CONFIG_FASTBOOT) - int fastboot_set_reboot_flag(enum fastboot_reboot_reason reason) --- -2.44.0 - -From 201da409a8c879482a00867010b772327aba6a51 Mon Sep 17 00:00:00 2001 -From: Jonas Karlman -Date: Sun, 10 Mar 2024 18:50:59 +0000 -Subject: [PATCH 3/4] rockchip: board: Use a common USB Product ID for UMS - -Change to use the common Product ID 0x0010 when the ums command is used. - -This matches downstream vendor U-Boot and is a Product ID that tools -such as rkdeveloptool and RKDevTool will identify as MSC mode. - -Signed-off-by: Jonas Karlman -Reviewed-by: Kever Yang ---- - arch/arm/mach-rockchip/board.c | 17 ++++++++++++++++- - 1 file changed, 16 insertions(+), 1 deletion(-) - -diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c -index 2ec670dde69..2db746b27fb 100644 ---- a/arch/arm/mach-rockchip/board.c -+++ b/arch/arm/mach-rockchip/board.c -@@ -206,8 +206,23 @@ void enable_caches(void) - #endif - - #if IS_ENABLED(CONFIG_USB_GADGET) --#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET) - #include -+ -+#if IS_ENABLED(CONFIG_USB_GADGET_DOWNLOAD) -+#define ROCKCHIP_G_DNL_UMS_PRODUCT_NUM 0x0010 -+ -+int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name) -+{ -+ if (!strcmp(name, "usb_dnl_ums")) -+ put_unaligned(ROCKCHIP_G_DNL_UMS_PRODUCT_NUM, &dev->idProduct); -+ else -+ put_unaligned(CONFIG_USB_GADGET_PRODUCT_NUM, &dev->idProduct); -+ -+ return 0; -+} -+#endif /* CONFIG_USB_GADGET_DOWNLOAD */ -+ -+#if IS_ENABLED(CONFIG_USB_GADGET_DWC2_OTG) && !IS_ENABLED(CONFIG_DM_USB_GADGET) - #include - #include - --- -2.44.0 - -From 2cb2428ae571956dfafb2eeed8b54857b12e17d0 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Wed, 3 Apr 2024 05:29:20 +0100 -Subject: [PATCH 4/4] rockchip: Migrate to use DM_USB_GADGET on RK3328 - -USB gadget is not working fully as expected on RK3328, it uses a -board_usb_init() function to initialize the DWC2 OTG port. - -The board_usb_init() function does not intgrate with the generic phy -framework and as a result the USB phy is not properly configured before -or after USB gadget use. - -Having both USB_DWC2 and DWC2_OTG enabled for the same board is also -causing some issues. - -Trying to use rockusb or ums command after usb stop result in a freeze -due to usb stop is putting the phy in a suspended state. - - => usb start - => usb stop - => ums 0 mmc 0 - --> freeze due to usb phy is suspended <-- - -Fix this by only using one of USB_DWC2 (host) or DWC2_OTG (peripheral) -depending on the most likely usage of the otg port and by migrating to -use DM_USB_GADGET instead of a board_usb_init() function. - -The nanopi-r2 and orangepi-r1-plus variants share OTG and power using a -Type-C connector, mark these boards dr_mode as peripheral, the most -likely usage is for recovery and image download. - -The rock64 and roc-cc currently use dr_mode as host, remove the DWC2_OTG -driver from these boards to ensure that the USB_DWC2 driver is used. - -The rock-pi-e board does not enable the usb20_otg node so both USB_DWC2 -and DWC2_OTG is removed from this board. - -Enable RockUSB and UMS on all boards with a otg port in peripheral mode. - -Also with the migration to DM_USB_GADGET completed the U-Boot specific -change to reorder usb nodes in the soc device tree can be reverted. - -Signed-off-by: Jonas Karlman -Reviewed-by: Kever Yang -Signed-off-by: Peter Robinson ---- - arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi | 4 ++ - .../rk3328-orangepi-r1-plus-lts-u-boot.dtsi | 4 ++ - .../dts/rk3328-orangepi-r1-plus-u-boot.dtsi | 4 ++ - arch/arm/dts/rk3328-roc-cc-u-boot.dtsi | 4 ++ - arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi | 9 ++++ - arch/arm/dts/rk3328-rock64-u-boot.dtsi | 4 ++ - arch/arm/dts/rk3328-u-boot.dtsi | 4 -- - arch/arm/dts/rk3328.dtsi | 41 ++++++++----------- - configs/evb-rk3328_defconfig | 7 +++- - configs/nanopi-r2c-plus-rk3328_defconfig | 7 +++- - configs/nanopi-r2c-rk3328_defconfig | 7 +++- - configs/nanopi-r2s-rk3328_defconfig | 7 +++- - configs/orangepi-r1-plus-lts-rk3328_defconfig | 7 +++- - configs/orangepi-r1-plus-rk3328_defconfig | 7 +++- - configs/roc-cc-rk3328_defconfig | 7 ---- - configs/rock-pi-e-rk3328_defconfig | 7 ---- - configs/rock64-rk3328_defconfig | 6 --- - 17 files changed, 75 insertions(+), 61 deletions(-) - -diff --git a/arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi b/arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi -index 78d37ab4755..3a16f86c18a 100644 ---- a/arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-nanopi-r2s-u-boot.dtsi -@@ -28,6 +28,10 @@ - bootph-pre-ram; - }; - -+&usb20_otg { -+ dr_mode = "peripheral"; -+}; -+ - /* Need this and all the pinctrl/gpio stuff above to set pinmux */ - &vcc_sd { - bootph-pre-ram; -diff --git a/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi b/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi -index ebe33e48cb9..2247daebc13 100644 ---- a/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-orangepi-r1-plus-lts-u-boot.dtsi -@@ -28,6 +28,10 @@ - bootph-pre-ram; - }; - -+&usb20_otg { -+ dr_mode = "peripheral"; -+}; -+ - /* Need this and all the pinctrl/gpio stuff above to set pinmux */ - &vcc_sd { - bootph-pre-ram; -diff --git a/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi b/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi -index 637c70adf19..79942a49a29 100644 ---- a/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-orangepi-r1-plus-u-boot.dtsi -@@ -28,6 +28,10 @@ - bootph-pre-ram; - }; - -+&usb20_otg { -+ dr_mode = "peripheral"; -+}; -+ - /* Need this and all the pinctrl/gpio stuff above to set pinmux */ - &vcc_sd { - bootph-pre-ram; -diff --git a/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi b/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi -index 2062f34bf82..1aeb0083631 100644 ---- a/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-roc-cc-u-boot.dtsi -@@ -48,6 +48,10 @@ - bootph-pre-ram; - }; - -+&usb20_otg { -+ hnp-srp-disable; -+}; -+ - /* Need this and all the pinctrl/gpio stuff above to set pinmux */ - &vcc_sd { - bootph-pre-ram; -diff --git a/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi b/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi -index 1f220c6dcd0..c2371fb1688 100644 ---- a/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-rock-pi-e-u-boot.dtsi -@@ -45,6 +45,15 @@ - bootph-pre-ram; - }; - -+&u2phy_host { -+ phy-supply = <&vcc_host_5v>; -+}; -+ -+&vcc_host_5v { -+ /delete-property/ regulator-always-on; -+ /delete-property/ regulator-boot-on; -+}; -+ - /* Need this and all the pinctrl/gpio stuff above to set pinmux */ - &vcc_sd { - bootph-pre-ram; -diff --git a/arch/arm/dts/rk3328-rock64-u-boot.dtsi b/arch/arm/dts/rk3328-rock64-u-boot.dtsi -index 6904515b969..1e4649ae120 100644 ---- a/arch/arm/dts/rk3328-rock64-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-rock64-u-boot.dtsi -@@ -48,6 +48,10 @@ - bootph-pre-ram; - }; - -+&usb20_otg { -+ hnp-srp-disable; -+}; -+ - /* Need this and all the pinctrl/gpio stuff above to set pinmux */ - &vcc_sd { - bootph-pre-ram; -diff --git a/arch/arm/dts/rk3328-u-boot.dtsi b/arch/arm/dts/rk3328-u-boot.dtsi -index a9f2536de2a..b5da4518ec9 100644 ---- a/arch/arm/dts/rk3328-u-boot.dtsi -+++ b/arch/arm/dts/rk3328-u-boot.dtsi -@@ -61,10 +61,6 @@ - u-boot,spl-fifo-mode; - }; - --&usb20_otg { -- hnp-srp-disable; --}; -- - &spi0 { - bootph-all; - }; -diff --git a/arch/arm/dts/rk3328.dtsi b/arch/arm/dts/rk3328.dtsi -index e8d8f00be8a..8c821acb21f 100644 ---- a/arch/arm/dts/rk3328.dtsi -+++ b/arch/arm/dts/rk3328.dtsi -@@ -944,6 +944,22 @@ - }; - }; - -+ usb20_otg: usb@ff580000 { -+ compatible = "rockchip,rk3328-usb", "rockchip,rk3066-usb", -+ "snps,dwc2"; -+ reg = <0x0 0xff580000 0x0 0x40000>; -+ interrupts = ; -+ clocks = <&cru HCLK_OTG>; -+ clock-names = "otg"; -+ dr_mode = "otg"; -+ g-np-tx-fifo-size = <16>; -+ g-rx-fifo-size = <280>; -+ g-tx-fifo-size = <256 128 128 64 32 16>; -+ phys = <&u2phy_otg>; -+ phy-names = "usb2-phy"; -+ status = "disabled"; -+ }; -+ - usb_host0_ehci: usb@ff5c0000 { - compatible = "generic-ehci"; - reg = <0x0 0xff5c0000 0x0 0x10000>; -@@ -983,31 +999,6 @@ - status = "disabled"; - }; - -- /* -- * U-Boot Specific Change -- * -- * The OTG controller must come after the USB host pair for it -- * to work. This is likely due to lack of support for the USB -- * PHYs. This must be manually changed after each device tree -- * sync. There is no clean way to handle this in -u-boot.dtsi -- * files. -- */ -- usb20_otg: usb@ff580000 { -- compatible = "rockchip,rk3328-usb", "rockchip,rk3066-usb", -- "snps,dwc2"; -- reg = <0x0 0xff580000 0x0 0x40000>; -- interrupts = ; -- clocks = <&cru HCLK_OTG>; -- clock-names = "otg"; -- dr_mode = "otg"; -- g-np-tx-fifo-size = <16>; -- g-rx-fifo-size = <280>; -- g-tx-fifo-size = <256 128 128 64 32 16>; -- phys = <&u2phy_otg>; -- phy-names = "usb2-phy"; -- status = "disabled"; -- }; -- - gic: interrupt-controller@ff811000 { - compatible = "arm,gic-400"; - #interrupt-cells = <3>; -diff --git a/configs/evb-rk3328_defconfig b/configs/evb-rk3328_defconfig -index b9c541a92a1..ed2e2b7aa6f 100644 ---- a/configs/evb-rk3328_defconfig -+++ b/configs/evb-rk3328_defconfig -@@ -46,6 +46,8 @@ CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+CONFIG_CMD_USB_MASS_STORAGE=y - # CONFIG_CMD_SETEXPR is not set - CONFIG_CMD_TIME=y - CONFIG_SPL_OF_CONTROL=y -@@ -93,17 +95,18 @@ CONFIG_SYS_NS16550_MEM32=y - CONFIG_SYSRESET=y - # CONFIG_TPL_SYSRESET is not set - CONFIG_USB=y -+CONFIG_DM_USB_GADGET=y - CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_XHCI_DWC3=y - CONFIG_USB_EHCI_HCD=y - CONFIG_USB_EHCI_GENERIC=y - CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y --CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y - # CONFIG_USB_DWC3_GADGET is not set --CONFIG_USB_DWC3_GENERIC=y - CONFIG_USB_GADGET=y - CONFIG_USB_GADGET_DWC2_OTG=y -+CONFIG_USB_FUNCTION_ROCKUSB=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/configs/nanopi-r2c-plus-rk3328_defconfig b/configs/nanopi-r2c-plus-rk3328_defconfig -index 320ed8b434a..015bcfef369 100644 ---- a/configs/nanopi-r2c-plus-rk3328_defconfig -+++ b/configs/nanopi-r2c-plus-rk3328_defconfig -@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+CONFIG_CMD_USB_MASS_STORAGE=y - # CONFIG_CMD_SETEXPR is not set - CONFIG_CMD_TIME=y - CONFIG_SPL_OF_CONTROL=y -@@ -98,17 +100,18 @@ CONFIG_SYSINFO=y - CONFIG_SYSRESET=y - # CONFIG_TPL_SYSRESET is not set - CONFIG_USB=y -+CONFIG_DM_USB_GADGET=y - CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_XHCI_DWC3=y - CONFIG_USB_EHCI_HCD=y - CONFIG_USB_EHCI_GENERIC=y - CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y --CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y - # CONFIG_USB_DWC3_GADGET is not set --CONFIG_USB_DWC3_GENERIC=y - CONFIG_USB_GADGET=y - CONFIG_USB_GADGET_DWC2_OTG=y -+CONFIG_USB_FUNCTION_ROCKUSB=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/configs/nanopi-r2c-rk3328_defconfig b/configs/nanopi-r2c-rk3328_defconfig -index 583179d7c54..5742567a3d4 100644 ---- a/configs/nanopi-r2c-rk3328_defconfig -+++ b/configs/nanopi-r2c-rk3328_defconfig -@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+CONFIG_CMD_USB_MASS_STORAGE=y - # CONFIG_CMD_SETEXPR is not set - CONFIG_CMD_TIME=y - CONFIG_SPL_OF_CONTROL=y -@@ -98,17 +100,18 @@ CONFIG_SYSINFO=y - CONFIG_SYSRESET=y - # CONFIG_TPL_SYSRESET is not set - CONFIG_USB=y -+CONFIG_DM_USB_GADGET=y - CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_XHCI_DWC3=y - CONFIG_USB_EHCI_HCD=y - CONFIG_USB_EHCI_GENERIC=y - CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y --CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y - # CONFIG_USB_DWC3_GADGET is not set --CONFIG_USB_DWC3_GENERIC=y - CONFIG_USB_GADGET=y - CONFIG_USB_GADGET_DWC2_OTG=y -+CONFIG_USB_FUNCTION_ROCKUSB=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/configs/nanopi-r2s-rk3328_defconfig b/configs/nanopi-r2s-rk3328_defconfig -index f7ed71e4122..180a76e0eeb 100644 ---- a/configs/nanopi-r2s-rk3328_defconfig -+++ b/configs/nanopi-r2s-rk3328_defconfig -@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+CONFIG_CMD_USB_MASS_STORAGE=y - # CONFIG_CMD_SETEXPR is not set - CONFIG_CMD_TIME=y - CONFIG_SPL_OF_CONTROL=y -@@ -98,17 +100,18 @@ CONFIG_SYSINFO=y - CONFIG_SYSRESET=y - # CONFIG_TPL_SYSRESET is not set - CONFIG_USB=y -+CONFIG_DM_USB_GADGET=y - CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_XHCI_DWC3=y - CONFIG_USB_EHCI_HCD=y - CONFIG_USB_EHCI_GENERIC=y - CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y --CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y - # CONFIG_USB_DWC3_GADGET is not set --CONFIG_USB_DWC3_GENERIC=y - CONFIG_USB_GADGET=y - CONFIG_USB_GADGET_DWC2_OTG=y -+CONFIG_USB_FUNCTION_ROCKUSB=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/configs/orangepi-r1-plus-lts-rk3328_defconfig b/configs/orangepi-r1-plus-lts-rk3328_defconfig -index d3d9417509e..a1a96bf2f28 100644 ---- a/configs/orangepi-r1-plus-lts-rk3328_defconfig -+++ b/configs/orangepi-r1-plus-lts-rk3328_defconfig -@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+CONFIG_CMD_USB_MASS_STORAGE=y - # CONFIG_CMD_SETEXPR is not set - CONFIG_CMD_TIME=y - CONFIG_SPL_OF_CONTROL=y -@@ -99,17 +101,18 @@ CONFIG_SYSINFO=y - CONFIG_SYSRESET=y - # CONFIG_TPL_SYSRESET is not set - CONFIG_USB=y -+CONFIG_DM_USB_GADGET=y - CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_XHCI_DWC3=y - CONFIG_USB_EHCI_HCD=y - CONFIG_USB_EHCI_GENERIC=y - CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y --CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y - # CONFIG_USB_DWC3_GADGET is not set --CONFIG_USB_DWC3_GENERIC=y - CONFIG_USB_GADGET=y - CONFIG_USB_GADGET_DWC2_OTG=y -+CONFIG_USB_FUNCTION_ROCKUSB=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/configs/orangepi-r1-plus-rk3328_defconfig b/configs/orangepi-r1-plus-rk3328_defconfig -index 9356e87132e..04273a0491c 100644 ---- a/configs/orangepi-r1-plus-rk3328_defconfig -+++ b/configs/orangepi-r1-plus-rk3328_defconfig -@@ -48,6 +48,8 @@ CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y -+CONFIG_CMD_ROCKUSB=y -+CONFIG_CMD_USB_MASS_STORAGE=y - # CONFIG_CMD_SETEXPR is not set - CONFIG_CMD_TIME=y - CONFIG_SPL_OF_CONTROL=y -@@ -99,17 +101,18 @@ CONFIG_SYSINFO=y - CONFIG_SYSRESET=y - # CONFIG_TPL_SYSRESET is not set - CONFIG_USB=y -+CONFIG_DM_USB_GADGET=y - CONFIG_USB_XHCI_HCD=y -+CONFIG_USB_XHCI_DWC3=y - CONFIG_USB_EHCI_HCD=y - CONFIG_USB_EHCI_GENERIC=y - CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y --CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y - # CONFIG_USB_DWC3_GADGET is not set --CONFIG_USB_DWC3_GENERIC=y - CONFIG_USB_GADGET=y - CONFIG_USB_GADGET_DWC2_OTG=y -+CONFIG_USB_FUNCTION_ROCKUSB=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/configs/roc-cc-rk3328_defconfig b/configs/roc-cc-rk3328_defconfig -index 4ac3c9403b0..0e4edcc999d 100644 ---- a/configs/roc-cc-rk3328_defconfig -+++ b/configs/roc-cc-rk3328_defconfig -@@ -23,7 +23,6 @@ CONFIG_DEBUG_UART_BASE=0xFF130000 - CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_DEBUG_UART=y --# CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_FIT=y - CONFIG_FIT_VERBOSE=y - CONFIG_SPL_LOAD_FIT=y -@@ -48,7 +47,6 @@ CONFIG_CMD_BOOTZ=y - CONFIG_CMD_GPT=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y --CONFIG_CMD_USB_MASS_STORAGE=y - # CONFIG_CMD_SETEXPR is not set - CONFIG_CMD_TIME=y - CONFIG_SPL_OF_CONTROL=y -@@ -68,8 +66,6 @@ CONFIG_SPL_SYSCON=y - CONFIG_TPL_SYSCON=y - CONFIG_CLK=y - CONFIG_SPL_CLK=y --CONFIG_FASTBOOT_BUF_ADDR=0x800800 --CONFIG_FASTBOOT_CMD_OEM_FORMAT=y - CONFIG_ROCKCHIP_GPIO=y - CONFIG_SYS_I2C_ROCKCHIP=y - CONFIG_MISC=y -@@ -110,10 +106,7 @@ CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y - CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y --# CONFIG_USB_DWC3_GADGET is not set - CONFIG_USB_DWC3_GENERIC=y --CONFIG_USB_GADGET=y --CONFIG_USB_GADGET_DWC2_OTG=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/configs/rock-pi-e-rk3328_defconfig b/configs/rock-pi-e-rk3328_defconfig -index 6dda900a9b4..6a4284120d2 100644 ---- a/configs/rock-pi-e-rk3328_defconfig -+++ b/configs/rock-pi-e-rk3328_defconfig -@@ -24,7 +24,6 @@ CONFIG_DEBUG_UART_BASE=0xFF130000 - CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_DEBUG_UART=y --# CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_FIT=y - CONFIG_FIT_VERBOSE=y - CONFIG_SPL_LOAD_FIT=y -@@ -69,8 +68,6 @@ CONFIG_SPL_SYSCON=y - CONFIG_TPL_SYSCON=y - CONFIG_CLK=y - CONFIG_SPL_CLK=y --CONFIG_FASTBOOT_BUF_ADDR=0x800800 --CONFIG_FASTBOOT_CMD_OEM_FORMAT=y - CONFIG_ROCKCHIP_GPIO=y - CONFIG_SYS_I2C_ROCKCHIP=y - CONFIG_MISC=y -@@ -109,12 +106,8 @@ CONFIG_USB_EHCI_HCD=y - CONFIG_USB_EHCI_GENERIC=y - CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y --CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y --# CONFIG_USB_DWC3_GADGET is not set - CONFIG_USB_DWC3_GENERIC=y --CONFIG_USB_GADGET=y --CONFIG_USB_GADGET_DWC2_OTG=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y -diff --git a/configs/rock64-rk3328_defconfig b/configs/rock64-rk3328_defconfig -index 0297d098761..fd42059565a 100644 ---- a/configs/rock64-rk3328_defconfig -+++ b/configs/rock64-rk3328_defconfig -@@ -23,7 +23,6 @@ CONFIG_DEBUG_UART_BASE=0xFF130000 - CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_DEBUG_UART=y --# CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_FIT=y - CONFIG_FIT_VERBOSE=y - CONFIG_SPL_LOAD_FIT=y -@@ -67,8 +66,6 @@ CONFIG_SPL_SYSCON=y - CONFIG_TPL_SYSCON=y - CONFIG_CLK=y - CONFIG_SPL_CLK=y --CONFIG_FASTBOOT_BUF_ADDR=0x800800 --CONFIG_FASTBOOT_CMD_OEM_FORMAT=y - CONFIG_ROCKCHIP_GPIO=y - CONFIG_SYS_I2C_ROCKCHIP=y - CONFIG_MISC=y -@@ -111,10 +108,7 @@ CONFIG_USB_OHCI_HCD=y - CONFIG_USB_OHCI_GENERIC=y - CONFIG_USB_DWC2=y - CONFIG_USB_DWC3=y --# CONFIG_USB_DWC3_GADGET is not set - CONFIG_USB_DWC3_GENERIC=y --CONFIG_USB_GADGET=y --CONFIG_USB_GADGET_DWC2_OTG=y - CONFIG_SPL_TINY_MEMSET=y - CONFIG_TPL_TINY_MEMSET=y - CONFIG_ERRNO_STR=y --- -2.44.0 - diff --git a/rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch b/rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch deleted file mode 100644 index 9ac9512..0000000 --- a/rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch +++ /dev/null @@ -1,154 +0,0 @@ -From 5aaa4c98be87eef370a0c50bf6d4ab7f9fcde886 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Mon, 8 Jan 2024 22:13:59 +0000 -Subject: [PATCH] rpi: Switch to OF_HAS_PRIOR_STAGE by default -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -On all Raspberry Pi platforms, we're loaded by a prior stage firmware -that has assembled and passed on a device tree binary for us to use. -Switch to using this tree by default. - -Signed-off-by: Peter Robinson -Cc: Matthias Brugger -Cc: Simon Glass -Cc: François Ozog -Signed-off-by: Tom Rini -Tested-by: Simon Glass ---- -To be clear, this is on top of current -next where I've applied v8 of -Simon's series that introduces OF_HAS_PRIOR_STAGE. - -I've only been able to test this on my Raspberry Pi 3 boards but this -should work everywhere. What may, or may not, be a problem is that -arch/arm/dts/bcm283x-u-boot.dtsi is never used now. On the other hand, -I believe this should stop the problems we have where changes made to -the device tree via config.txt or similar aren't reflected when booting -U-Boot or Linux since we will be using that tree for certain now. ---- - arch/arm/Kconfig | 1 + - arch/arm/mach-bcm283x/Kconfig | 3 --- - configs/rpi_0_w_defconfig | 1 - - configs/rpi_2_defconfig | 1 - - configs/rpi_3_32b_defconfig | 1 - - configs/rpi_3_b_plus_defconfig | 1 - - configs/rpi_3_defconfig | 1 - - configs/rpi_defconfig | 1 - - 8 files changed, 1 insertion(+), 9 deletions(-) - -diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig -index 1fd7aacc380..33bbe7b4898 100644 ---- a/arch/arm/Kconfig -+++ b/arch/arm/Kconfig -@@ -645,6 +645,7 @@ config ARCH_BCM283X - select SERIAL_SEARCH_ALL - imply CMD_DM - imply FAT_WRITE -+ imply OF_HAS_PRIOR_STAGE - - config ARCH_BCMSTB - bool "Broadcom BCM7XXX family" -diff --git a/arch/arm/mach-bcm283x/Kconfig b/arch/arm/mach-bcm283x/Kconfig -index 6ce278c6d29..b3287ce8bce 100644 ---- a/arch/arm/mach-bcm283x/Kconfig -+++ b/arch/arm/mach-bcm283x/Kconfig -@@ -163,7 +163,6 @@ config TARGET_RPI_4_32B - - This option creates a build targeting the ARMv7/AArch32 ISA. - select BCM2711_32B -- imply OF_HAS_PRIOR_STAGE - - config TARGET_RPI_4 - bool "Raspberry Pi 4 64-bit build" -@@ -189,7 +188,6 @@ config TARGET_RPI_4 - - This option creates a build targeting the ARMv8/AArch64 ISA. - select BCM2711_64B -- imply OF_HAS_PRIOR_STAGE - - config TARGET_RPI_ARM64 - bool "Raspberry Pi one binary 64-bit build" -@@ -197,7 +195,6 @@ config TARGET_RPI_ARM64 - Support for all armv8 based Raspberry Pi variants, such as - the RPi 4 model B, in AArch64 (64-bit) mode. - select ARM64 -- imply OF_HAS_PRIOR_STAGE - - endchoice - -diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig -index bed143d64d6..98f8904c918 100644 ---- a/configs/rpi_0_w_defconfig -+++ b/configs/rpi_0_w_defconfig -@@ -24,7 +24,6 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig -index e4e4843e8cd..1b8676e1d10 100644 ---- a/configs/rpi_2_defconfig -+++ b/configs/rpi_2_defconfig -@@ -25,7 +25,6 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig -index 215396599e4..abc10a79ada 100644 ---- a/configs/rpi_3_32b_defconfig -+++ b/configs/rpi_3_32b_defconfig -@@ -24,7 +24,6 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_3_b_plus_defconfig b/configs/rpi_3_b_plus_defconfig -index d1ec55e558a..3c8f8fc1bb7 100644 ---- a/configs/rpi_3_b_plus_defconfig -+++ b/configs/rpi_3_b_plus_defconfig -@@ -23,7 +23,6 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig -index 8e9c35b3cef..9853c448809 100644 ---- a/configs/rpi_3_defconfig -+++ b/configs/rpi_3_defconfig -@@ -23,7 +23,6 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y -diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig -index 89d6372c1de..060a8809506 100644 ---- a/configs/rpi_defconfig -+++ b/configs/rpi_defconfig -@@ -24,7 +24,6 @@ CONFIG_CMD_GPIO=y - CONFIG_CMD_MMC=y - CONFIG_CMD_USB=y - CONFIG_CMD_FS_UUID=y --CONFIG_OF_EMBED=y - CONFIG_ENV_FAT_DEVICE_AND_PART="0:1" - CONFIG_SYS_RELOC_GD_ENV_ADDR=y - CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y --- -2.43.0 - diff --git a/sources b/sources index 6013800..555d633 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.04.tar.bz2) = a71270302b38e9e68a83b3acdf8f7635f72d9fa75169e3c2241cdfa21eab834b8f25dfd35c281191bccb2fcec1e86d6b64afcf1d2ed5cd4fdc02258cd75fc236 +SHA512 (u-boot-2024.07-rc3.tar.bz2) = 6b86ef1739fce647f5d44b7f6e659500d922c1bd4b591d8d31d2007d15e305e5b3b09bef72cb8b466ca611269102dead0e9b9aac1e0f67f711201c342828514c diff --git a/uboot-tools.spec b/uboot-tools.spec index aefeb8b..2e1743b 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -#global candidate rc5 +%global candidate rc3 %if 0%{?rhel} %bcond_with toolsonly %else @@ -6,8 +6,8 @@ %endif Name: uboot-tools -Version: 2024.04 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Version: 2024.07 +Release: 0.1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -29,14 +29,8 @@ Patch5: enable-bootmenu-by-default.patch # Should be upstream but it's taking time Patch6: Add-video-damage-tracking.patch -# Board fixes and enablement -# RPi - uses RPI firmware device tree for HAT support -Patch10: rpi-Switch-to-OF_HAS_PRIOR_STAGE-by-default.patch # Rockchips improvements -Patch11: rockchip-Add-initial-support-for-the-PinePhone-Pro.patch -Patch12: rockchip-Enable-preboot-start-for-pci-usb.patch -Patch13: phy-rockchip-inno-usb2-Write-to-correct-GRF.patch -Patch14: rockchip-Migrate-to-use-DM_USB_GADGET-on-RK3328.patch +Patch10: rockchip-Enable-preboot-start-for-pci-usb.patch BuildRequires: bc BuildRequires: bison @@ -192,6 +186,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Sat May 25 2024 Peter Robinson - 1:2024.07-0.1.rc3 +- Update to 2024.07 RC3 + * Wed Apr 03 2024 Peter Robinson - 1:2024.04-1 - Update to 2024.04 GA - Rockchip rk3328 USB fixes From 3711935a69028d14fe557cd8fa5d9e7b9b8d4da7 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 25 May 2024 16:03:03 +0100 Subject: [PATCH 035/128] Fix qcom config name --- aarch64-boards | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aarch64-boards b/aarch64-boards index f88eb85..d831619 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -74,7 +74,7 @@ pinephone-pro-rk3399 pinetab poplar puma-rk3399 -qcom_defconfig +qcom qemu_arm64 roc-cc-rk3328 rock-4c-plus-rk3399 From f00b318695c8aa0e4ed61cd8c13853bf752b7a54 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 25 May 2024 17:32:32 +0100 Subject: [PATCH 036/128] drop starqltechn --- aarch64-boards | 1 - 1 file changed, 1 deletion(-) diff --git a/aarch64-boards b/aarch64-boards index d831619..2087102 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -90,7 +90,6 @@ roc-pc-mezzanine-rk3399 roc-pc-rk3399 rpi_arm64 sopine_baseboard -starqltechn tanix_tx6 teres_i transpeed-8k618-t From 1c674170ad51371d94bf187592fb64f174c35510 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 18 Jun 2024 11:57:00 +0100 Subject: [PATCH 037/128] 2024.07 RC4 --- sources | 2 +- uboot-tools.spec | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sources b/sources index 555d633..92b8e44 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.07-rc3.tar.bz2) = 6b86ef1739fce647f5d44b7f6e659500d922c1bd4b591d8d31d2007d15e305e5b3b09bef72cb8b466ca611269102dead0e9b9aac1e0f67f711201c342828514c +SHA512 (u-boot-2024.07-rc4.tar.bz2) = 2fa73c48ab4f6e60cee11ebac79a35e1b15d95eba5d8bb3612bd354e6b6153bfc17fcf1783b6b410a8b78505535152eab9f2cfbb35a6f19af7f7af7b2741e2a6 diff --git a/uboot-tools.spec b/uboot-tools.spec index 2e1743b..6afa5c4 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc3 +%global candidate rc4 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.07 -Release: 0.1%{?candidate:.%{candidate}}%{?dist} +Release: 0.2%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -186,6 +186,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Jun 18 2024 Peter Robinson - 1:2024.07-0.2.rc4 +- Update to 2024.07 RC4 + * Sat May 25 2024 Peter Robinson - 1:2024.07-0.1.rc3 - Update to 2024.07 RC3 From 5dceaa60eb0c412b35f3df43473d4460503ea193 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sat, 20 Jul 2024 08:05:43 +0000 Subject: [PATCH 038/128] Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild --- uboot-tools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 6afa5c4..e573122 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.07 -Release: 0.2%{?candidate:.%{candidate}}%{?dist} +Release: 0.3%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -186,6 +186,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Sat Jul 20 2024 Fedora Release Engineering - 1:2024.07-0.3.rc4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild + * Tue Jun 18 2024 Peter Robinson - 1:2024.07-0.2.rc4 - Update to 2024.07 RC4 From 90b2ec4c3ddfc85d05dc272c724b97c36250f883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Tue, 23 Jul 2024 13:48:55 +0200 Subject: [PATCH 039/128] explicitly enable OpenSSL engine support --- uboot-tools.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/uboot-tools.spec b/uboot-tools.spec index e573122..1c94acd 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -42,6 +42,7 @@ BuildRequires: libuuid-devel BuildRequires: make BuildRequires: ncurses-devel BuildRequires: openssl-devel +BuildRequires: openssl-devel-engine BuildRequires: perl-interpreter BuildRequires: python3-devel BuildRequires: python3-setuptools From d68e991d5c06c853a8984046887b070253594cb4 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 23 Jul 2024 14:15:09 +0100 Subject: [PATCH 040/128] 2024.07 --- sources | 2 +- uboot-tools.spec | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sources b/sources index 92b8e44..09f870f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.07-rc4.tar.bz2) = 2fa73c48ab4f6e60cee11ebac79a35e1b15d95eba5d8bb3612bd354e6b6153bfc17fcf1783b6b410a8b78505535152eab9f2cfbb35a6f19af7f7af7b2741e2a6 +SHA512 (u-boot-2024.07.tar.bz2) = 678f44e2b9132140f0bf05c637e57e638c73c278611037a41824b3ebff2131af4dec0163da4664bb2e5c4fd8034ba8c95b93b57f7aa9f4c045da322d87c3b5e9 diff --git a/uboot-tools.spec b/uboot-tools.spec index 1c94acd..ee24ef7 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc4 +#global candidate rc0 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.07 -Release: 0.3%{?candidate:.%{candidate}}%{?dist} +Release: 1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -187,6 +187,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Jul 23 2024 Peter Robinson - 1:2024.07-1 +- Update to 2024.07 + * Sat Jul 20 2024 Fedora Release Engineering - 1:2024.07-0.3.rc4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild From 480feaf12cf59a7a03d83c86aa8e4a1e908088ca Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 15 Aug 2024 13:26:54 +0100 Subject: [PATCH 041/128] 2024.10 RC2 --- uboot-tools.spec | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index ee24ef7..47f8333 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -#global candidate rc0 +%global candidate rc2 %if 0%{?rhel} %bcond_with toolsonly %else @@ -6,8 +6,8 @@ %endif Name: uboot-tools -Version: 2024.07 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Version: 2024.10 +Release: 0.1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -27,7 +27,7 @@ Patch3: uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch Patch4: disable-VBE-by-default.patch Patch5: enable-bootmenu-by-default.patch # Should be upstream but it's taking time -Patch6: Add-video-damage-tracking.patch +#Patch6: Add-video-damage-tracking.patch # Rockchips improvements Patch10: rockchip-Enable-preboot-start-for-pci-usb.patch @@ -187,6 +187,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Thu Aug 15 2024 Peter Robinson - 1:2024.10-0.1.rc2 +- Update to 2024.10 RC2 + * Tue Jul 23 2024 Peter Robinson - 1:2024.07-1 - Update to 2024.07 From e4c7f912206cacc62b5c8b77275f107a857e8452 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 15 Aug 2024 18:55:21 +0100 Subject: [PATCH 042/128] upload source --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 09f870f..4d7803b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.07.tar.bz2) = 678f44e2b9132140f0bf05c637e57e638c73c278611037a41824b3ebff2131af4dec0163da4664bb2e5c4fd8034ba8c95b93b57f7aa9f4c045da322d87c3b5e9 +SHA512 (u-boot-2024.10-rc2.tar.bz2) = 606b48ef1fbd67fcd686b68540eb6db9453f9a02af16fc244add9fd5b75743bd776e2a3806192345b8d6eaa0f6ba3a1322623e3254c1d511d8ee524f7515e8b3 From d4601d22550dffe75d725465661a7c7cd73e11b9 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 15 Aug 2024 20:12:14 +0100 Subject: [PATCH 043/128] add xxd --- uboot-tools.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/uboot-tools.spec b/uboot-tools.spec index 47f8333..5f2aaa7 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -53,6 +53,7 @@ BuildRequires: swig %ifarch aarch64 BuildRequires: arm-trusted-firmware-armv8 BuildRequires: python3-pyelftools +BuildRequires: xxd %endif %endif Requires: dtc From ddf286405650610596a91c2ebec620ba1fb17cb2 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 27 Aug 2024 15:57:40 +0100 Subject: [PATCH 044/128] 2024.10 RC3, initial QCM6490 support --- ...support-for-SC7280-and-the-RB3-Gen-2.patch | 1414 +++++++++++++++++ aarch64-boards | 1 + sources | 2 +- uboot-tools.spec | 10 +- 4 files changed, 1424 insertions(+), 3 deletions(-) create mode 100644 Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch diff --git a/Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch b/Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch new file mode 100644 index 0000000..0dec1ea --- /dev/null +++ b/Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch @@ -0,0 +1,1414 @@ +From patchwork Wed Aug 21 13:41:46 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Caleb Connolly +X-Patchwork-Id: 1974970 +X-Patchwork-Delegate: caleb.connolly@linaro.org +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=BpF9pRLA; + 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 4WpnZD73RJz1yXf + for ; Wed, 21 Aug 2024 23:42:12 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 99F6188D9B; + Wed, 21 Aug 2024 15:42:00 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="BpF9pRLA"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 86A7E88D9B; Wed, 21 Aug 2024 15:41:58 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com + [IPv6:2a00:1450:4864:20::133]) + (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 896B7887D4 + for ; Wed, 21 Aug 2024 15:41:55 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=caleb.connolly@linaro.org +Received: by mail-lf1-x133.google.com with SMTP id + 2adb3069b0e04-5333b2fbedaso4381657e87.0 + for ; Wed, 21 Aug 2024 06:41:55 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1724247715; x=1724852515; darn=lists.denx.de; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; bh=vYpvXZhAM0wjWc6QeTnHyYsF2xjKAb2Bg/9VNGJ7oC4=; + b=BpF9pRLArbhamTTSvF+LPOjqIaruq3137+Td+Y4qA32sBPKjZN2zyabjh/Rafnr5O1 + 9d/0nOcXmbKi3CTtdUN3qV19169r8d2lAuPiUwXoxGf4v9wPlXv1TnQilC0/IpdephxJ + oRj9+5DwMh1C/THNGdn6N9M7PrZ33uVwOawlqlGPGaBUlZzEtdpeQt8mGBT72vsWTwEc + g9XIuP7GYNy3Ztzy8JMYfvFT0MCUQmkDb9anAIfRkARVMxMTI3X0lz9nXqhgNHGXF/vc + tw9UbbFQc5bsonufEXl0cg3x4yHX3dzV2NcPvnGJWBUgHbNoQ1dUvmUD8ivz8xpCGh95 + /uLg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1724247715; x=1724852515; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=vYpvXZhAM0wjWc6QeTnHyYsF2xjKAb2Bg/9VNGJ7oC4=; + b=F/jmt2BY3txUp2Xo6ouNkmlNd7uQWuOBEkIGKUIwLL3jKl7uBJ/Ptt5k5n2REXJ3RX + qQv2x7FQlJXgvIfdnyr82QJx4EA7lV3SciLcJsTQMrrE0URCNMdIzUgMi0Su+QUw2rkH + 3F6BNFc2AUknW7ohrfLBnJWKHecIEJy7NbLcVve5RxNTga9md5WoIqlyL0PMo+pbTH/P + t4upinI57g3mt/aAFxlETKF7TY9fUiDnKfmp6NNkTAYVemvziHPE4LO78hHLLRggdYJE + li/V+pZa6jdmhd9c2wPO7Qlhlw3i48ti0LmA6PBMgebLO+YTAXf2pUpLQl4gdayX4WJr + 21qA== +X-Gm-Message-State: AOJu0YzCxBg0ApyZrMj/flKnSEzT/WdNXsTISMZEYTB2A2c9+9pYoTt8 + Y4o4D/Wn7JKEhGJS9pejsVJGp3BVDAbME2fz2uL63aeV9h8aeA7aQIfST443wEE= +X-Google-Smtp-Source: + AGHT+IHwtmpvp1KyCpCFrQ9m8b9mZocGdoGZKOOBbCOdWXgPOOaJpvIzD+wO9cPMXI0xJJ299Vb3aw== +X-Received: by 2002:a05:6512:2526:b0:533:4b07:a8dc with SMTP id + 2adb3069b0e04-5334b07a924mr853860e87.35.1724247714485; + Wed, 21 Aug 2024 06:41:54 -0700 (PDT) +Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) + by smtp.gmail.com with ESMTPSA id + a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.53 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 21 Aug 2024 06:41:53 -0700 (PDT) +From: Caleb Connolly +Date: Wed, 21 Aug 2024 15:41:46 +0200 +Subject: [PATCH v2 1/7] clk/qcom: add initial clock driver for sc7280 +MIME-Version: 1.0 +Message-Id: <20240821-b4-rb3gen2-v2-1-49b07633f3a8@linaro.org> +References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +To: Tom Rini , Lukasz Majewski , + Sean Anderson , + Caleb Connolly , + Neil Armstrong , + Sumit Garg +Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io +X-Mailer: b4 0.14-dev +X-Developer-Signature: v=1; a=openpgp-sha256; l=6610; + i=caleb.connolly@linaro.org; h=from:subject:message-id; + bh=Ml3U758Os52kpw+GNgmPmB5Bs0weI+7Cu8LeGmVUjJs=; + b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6dj9dkbc0E3zPhQL/6lm1ahALcexDRPoBcO + ng26jm+QUiJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k + ttaKD/9DtqMqfY7Do5CxJU3qRYk5ZmdeMIF9JTXN0APLu1fGGMznfgoUn93safNuzgw/exm5CNI + rSoCXHGtBpKM+SWjYe9ir4C7PQqdJt0J5vgdUOHVqfy87jgC4RQkE6HUDCtd9s1HitZNCtiZGrs + BeJ7SVOrAakL3QgXCssgvhDmNmQoMDd5l1lTXL9p5RQTVAZuQuihQJ1fcVtXVH9DlYidlvNdwKZ + wLXps20Hc7uStWohI/+MtDq5OzwxfEXVLBOktJ8cR26UZ1N5pFItdarRZpmJCJFtWU4ORyamCKW + EcPSjaDo7r2GT7CbiILoXpsQLGX5SNrEWFAFQJKUjAyHe0x2H0394aVGd4Yt9kFBG8KSvhzwsVq + tVzpKmy0oe/2CCcVsRHhT4b1j7H+MiudmxYpUByqcljtWKm/0Nd6C42oqHSs4NP+DRHHPzDGpxm + Bzaex1Y5tkwivXqgISlHEX99R605X8KWM3LJnKMPBU5qdHN7x1/8tdcpsnCHd/+AobL+Ty7gaH4 + CXqmB2zZY/1VAhboMRJnDaOooBlBlGfaiMu9/sOpQJo0xWPYtANjyli/9TIsBSBkctEAa4rv0WN + ruiueb3HXdDqzPGpcaVMnApPjkNEUGiMlhaJKTJPcBuIDaC0uNwquaRv7fmLRE5oqWlX1uQ7Seu + fUzYzzESEzLWSGg== +X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; + fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 +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 + +We don't actually need any clocks to get UFS up and running, resets are +useful though. + +Reviewed-by: Neil Armstrong +Signed-off-by: Caleb Connolly +--- + drivers/clk/qcom/Kconfig | 8 +++ + drivers/clk/qcom/Makefile | 1 + + drivers/clk/qcom/clock-qcom.h | 1 + + drivers/clk/qcom/clock-sc7280.c | 132 ++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 142 insertions(+) + +diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig +index 45d63c6d6dbf..0d2c0ac225c5 100644 +--- a/drivers/clk/qcom/Kconfig ++++ b/drivers/clk/qcom/Kconfig +@@ -85,7 +85,15 @@ config CLK_QCOM_SM8650 + Say Y here to enable support for the Global Clock Controller + on the Snapdragon SM8650 SoC. This driver supports the clocks + and resets exposed by the GCC hardware block. + ++config CLK_QCOM_SC7280 ++ bool "Qualcomm SC7280 GCC" ++ select CLK_QCOM ++ help ++ Say Y here to enable support for the Global Clock Controller ++ on the Snapdragon SC7280 SoC. This driver supports the clocks ++ and resets exposed by the GCC hardware block. ++ + endmenu + + endif +diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile +index dec20e4b5943..e223c131ee4d 100644 +--- a/drivers/clk/qcom/Makefile ++++ b/drivers/clk/qcom/Makefile +@@ -8,8 +8,9 @@ obj-$(CONFIG_CLK_QCOM_APQ8016) += clock-apq8016.o + obj-$(CONFIG_CLK_QCOM_APQ8096) += clock-apq8096.o + obj-$(CONFIG_CLK_QCOM_IPQ4019) += clock-ipq4019.o + obj-$(CONFIG_CLK_QCOM_QCM2290) += clock-qcm2290.o + obj-$(CONFIG_CLK_QCOM_QCS404) += clock-qcs404.o ++obj-$(CONFIG_CLK_QCOM_SC7280) += clock-sc7280.o + obj-$(CONFIG_CLK_QCOM_SM6115) += clock-sm6115.o + obj-$(CONFIG_CLK_QCOM_SM8250) += clock-sm8250.o + obj-$(CONFIG_CLK_QCOM_SM8550) += clock-sm8550.o + obj-$(CONFIG_CLK_QCOM_SM8650) += clock-sm8650.o +diff --git a/drivers/clk/qcom/clock-qcom.h b/drivers/clk/qcom/clock-qcom.h +index f6445c8f566f..7aa6ca59aad5 100644 +--- a/drivers/clk/qcom/clock-qcom.h ++++ b/drivers/clk/qcom/clock-qcom.h +@@ -10,8 +10,9 @@ + #define CFG_CLK_SRC_CXO (0 << 8) + #define CFG_CLK_SRC_GPLL0 (1 << 8) + #define CFG_CLK_SRC_GPLL0_AUX2 (2 << 8) + #define CFG_CLK_SRC_GPLL9 (2 << 8) ++#define CFG_CLK_SRC_GPLL0_ODD (3 << 8) + #define CFG_CLK_SRC_GPLL6 (4 << 8) + #define CFG_CLK_SRC_GPLL7 (3 << 8) + #define CFG_CLK_SRC_GPLL4 (5 << 8) + #define CFG_CLK_SRC_GPLL0_EVEN (6 << 8) +diff --git a/drivers/clk/qcom/clock-sc7280.c b/drivers/clk/qcom/clock-sc7280.c +new file mode 100644 +index 000000000000..5d343f120519 +--- /dev/null ++++ b/drivers/clk/qcom/clock-sc7280.c +@@ -0,0 +1,132 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Clock drivers for Qualcomm sc7280 ++ * ++ * (C) Copyright 2024 Linaro Ltd. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include "clock-qcom.h" ++ ++#define USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR 0xf038 ++#define USB30_PRIM_MASTER_CLK_CMD_RCGR 0xf020 ++ ++static ulong sc7280_set_rate(struct clk *clk, ulong rate) ++{ ++ struct msm_clk_priv *priv = dev_get_priv(clk->dev); ++ ++ if (clk->id < priv->data->num_clks) ++ debug("%s: %s, requested rate=%ld\n", __func__, priv->data->clks[clk->id].name, rate); ++ ++ switch (clk->id) { ++ case GCC_USB30_PRIM_MOCK_UTMI_CLK: ++ WARN(rate != 19200000, "Unexpected rate for USB30_PRIM_MOCK_UTMI_CLK: %lu\n", rate); ++ clk_rcg_set_rate(priv->base, USB30_PRIM_MASTER_CLK_CMD_RCGR, 0, CFG_CLK_SRC_CXO); ++ return rate; ++ case GCC_USB30_PRIM_MASTER_CLK: ++ WARN(rate != 200000000, "Unexpected rate for USB30_PRIM_MASTER_CLK: %lu\n", rate); ++ clk_rcg_set_rate_mnd(priv->base, USB30_PRIM_MASTER_CLK_CMD_RCGR, ++ 1, 0, 0, CFG_CLK_SRC_GPLL0_ODD, 8); ++ clk_rcg_set_rate(priv->base, 0xf064, 0, 0); ++ return rate; ++ default: ++ return 0; ++ } ++} ++ ++static const struct gate_clk sc7280_clks[] = { ++ GATE_CLK(GCC_CFG_NOC_USB3_PRIM_AXI_CLK, 0xf07c, 1), ++ GATE_CLK(GCC_USB30_PRIM_MASTER_CLK, 0xf010, 1), ++ GATE_CLK(GCC_AGGRE_USB3_PRIM_AXI_CLK, 0xf080, 1), ++ GATE_CLK(GCC_USB30_PRIM_SLEEP_CLK, 0xf018, 1), ++ GATE_CLK(GCC_USB30_PRIM_MOCK_UTMI_CLK, 0xf01c, 1), ++ GATE_CLK(GCC_USB3_PRIM_PHY_AUX_CLK, 0xf054, 1), ++ GATE_CLK(GCC_USB3_PRIM_PHY_COM_AUX_CLK, 0xf058, 1), ++}; ++ ++static int sc7280_enable(struct clk *clk) ++{ ++ struct msm_clk_priv *priv = dev_get_priv(clk->dev); ++ ++ if (priv->data->num_clks < clk->id) { ++ debug("%s: unknown clk id %lu\n", __func__, clk->id); ++ return 0; ++ } ++ ++ debug("%s: clk %ld: %s\n", __func__, clk->id, sc7280_clks[clk->id].name); ++ ++ switch (clk->id) { ++ case GCC_AGGRE_USB3_PRIM_AXI_CLK: ++ qcom_gate_clk_en(priv, GCC_USB30_PRIM_MASTER_CLK); ++ fallthrough; ++ case GCC_USB30_PRIM_MASTER_CLK: ++ qcom_gate_clk_en(priv, GCC_USB3_PRIM_PHY_AUX_CLK); ++ qcom_gate_clk_en(priv, GCC_USB3_PRIM_PHY_COM_AUX_CLK); ++ break; ++ } ++ ++ qcom_gate_clk_en(priv, clk->id); ++ ++ return 0; ++} ++ ++static const struct qcom_reset_map sc7280_gcc_resets[] = { ++ [GCC_PCIE_0_BCR] = { 0x6b000 }, ++ [GCC_PCIE_0_PHY_BCR] = { 0x6c01c }, ++ [GCC_PCIE_1_BCR] = { 0x8d000 }, ++ [GCC_PCIE_1_PHY_BCR] = { 0x8e01c }, ++ [GCC_QUSB2PHY_PRIM_BCR] = { 0x12000 }, ++ [GCC_QUSB2PHY_SEC_BCR] = { 0x12004 }, ++ [GCC_SDCC1_BCR] = { 0x75000 }, ++ [GCC_SDCC2_BCR] = { 0x14000 }, ++ [GCC_SDCC4_BCR] = { 0x16000 }, ++ [GCC_UFS_PHY_BCR] = { 0x77000 }, ++ [GCC_USB30_PRIM_BCR] = { 0xf000 }, ++ [GCC_USB30_SEC_BCR] = { 0x9e000 }, ++ [GCC_USB3_DP_PHY_PRIM_BCR] = { 0x50008 }, ++ [GCC_USB3_PHY_PRIM_BCR] = { 0x50000 }, ++ [GCC_USB3PHY_PHY_PRIM_BCR] = { 0x50004 }, ++ [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0x6a000 }, ++}; ++ ++static const struct qcom_power_map sc7280_gdscs[] = { ++ [GCC_UFS_PHY_GDSC] = { 0x77004 }, ++ [GCC_USB30_PRIM_GDSC] = { 0xf004 }, ++}; ++ ++static struct msm_clk_data qcs404_gcc_data = { ++ .resets = sc7280_gcc_resets, ++ .num_resets = ARRAY_SIZE(sc7280_gcc_resets), ++ .clks = sc7280_clks, ++ .num_clks = ARRAY_SIZE(sc7280_clks), ++ ++ .power_domains = sc7280_gdscs, ++ .num_power_domains = ARRAY_SIZE(sc7280_gdscs), ++ ++ .enable = sc7280_enable, ++ .set_rate = sc7280_set_rate, ++}; ++ ++static const struct udevice_id gcc_sc7280_of_match[] = { ++ { ++ .compatible = "qcom,gcc-sc7280", ++ .data = (ulong)&qcs404_gcc_data, ++ }, ++ { } ++}; ++ ++U_BOOT_DRIVER(gcc_sc7280) = { ++ .name = "gcc_sc7280", ++ .id = UCLASS_NOP, ++ .of_match = gcc_sc7280_of_match, ++ .bind = qcom_cc_bind, ++ .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, ++}; + +From patchwork Wed Aug 21 13:41:47 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Caleb Connolly +X-Patchwork-Id: 1974971 +X-Patchwork-Delegate: caleb.connolly@linaro.org +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=D8cipZN8; + 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 4WpnZS1lFqz1yXf + for ; Wed, 21 Aug 2024 23:42:24 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 2404B88DB7; + Wed, 21 Aug 2024 15:42:01 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="D8cipZN8"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id CF84288B3C; Wed, 21 Aug 2024 15:41:58 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com + [IPv6:2a00:1450:4864:20::22f]) + (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 BC82A88AC0 + for ; Wed, 21 Aug 2024 15:41:56 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=caleb.connolly@linaro.org +Received: by mail-lj1-x22f.google.com with SMTP id + 38308e7fff4ca-2f136e23229so67636651fa.1 + for ; Wed, 21 Aug 2024 06:41:56 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1724247716; x=1724852516; darn=lists.denx.de; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; bh=BtQqdiFk/5BGUCz4O21vl/84vcKElfs3QSU/TjahAhA=; + b=D8cipZN8vnM60gNnxvkm4MeJi0YUs2ejIG0MSF/WWYvpmyESE3mh38i9CQho0bxU6i + iX63Dsb/6xtE1YF26oNdy6430/ePndpn9VXSnZ4+c+0j1Er/qSEXlX7/BzwYSxhKFXP2 + /F6RsyF3R5s2HPndcU3OSppiLYNDSZZFa5XBwBVgNsjEoAOmVBZspDGJXberoFWSw1Xd + jvCW7H8KY4DgeuHAJAF1udHYqYfpDTGmijGk1cl6yddFZ4BX5AHEetjJMm6/Sfs0rYEE + D0REEYmHiwa1dm8mN6J+XMp2tgzg/8RPlQ5p4k9lcZlrCuZ7TnFF+HgnR7TLnMaOY5WI + DeWw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1724247716; x=1724852516; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=BtQqdiFk/5BGUCz4O21vl/84vcKElfs3QSU/TjahAhA=; + b=P16tCzEGlwXh2HUe2zkd2EwD+lVsUJ2nv3xZT1gSdJfgv9uFCy5uHQOHx+GfyeFiFB + ZTZeGSznoCm+BqR4Rw1gx+Pw4M5rk38MOzZj6eb1PVfM7DKBk1C0g3ddxLBWvXwGky/P + /PMojneROHfJG+HpIjemGUIP4Cnbl+J0M1VqM1cJazIQocK+IpbqphhjI7IDKfPwZz0O + Cxn70edXPpLuZvBwbSJEk5zEyh+2b0oiyPP8VwzVfimOrP0nSJ/TkZiKVgEAVBmiRq1c + hpW2xFrDixDe+Ioa2hCXcbsIoDf8EyCdmxWVIiA8h4xsXfXpSbgDCAgBz0wi9Uw3Jy/h + LRZg== +X-Gm-Message-State: AOJu0Yz5oP45hJMUwyK8DU9sBL6vYfuGjHAeVLt3bxXXNCuBLvCzIx7F + gF97feq0wgpXLIEQ7uqwcBXQ46wbHQs8IEvoNGTarDCXSFeggfCqEC7oDzM4U48= +X-Google-Smtp-Source: + AGHT+IFRfsXmk97RBDrPRNGuRiWGpZ4udOpM/gdavhIAP7Vw5jIX1oJ1BZ6+tqyctFDutWKn/+6X5g== +X-Received: by 2002:ac2:4e09:0:b0:52f:2ea:499f with SMTP id + 2adb3069b0e04-5334855d512mr1561479e87.24.1724247715821; + Wed, 21 Aug 2024 06:41:55 -0700 (PDT) +Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) + by smtp.gmail.com with ESMTPSA id + a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.54 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 21 Aug 2024 06:41:55 -0700 (PDT) +From: Caleb Connolly +Date: Wed, 21 Aug 2024 15:41:47 +0200 +Subject: [PATCH v2 2/7] dts: qcs6490-rb3gen2-u-boot: add override dtsi +MIME-Version: 1.0 +Message-Id: <20240821-b4-rb3gen2-v2-2-49b07633f3a8@linaro.org> +References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +To: Tom Rini , Lukasz Majewski , + Sean Anderson , + Caleb Connolly , + Neil Armstrong , + Sumit Garg +Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io +X-Mailer: b4 0.14-dev +X-Developer-Signature: v=1; a=openpgp-sha256; l=1273; + i=caleb.connolly@linaro.org; h=from:subject:message-id; + bh=WycUvGIX1Vb2Dt9TSRhlFTIc8lgmewYYBQWg2kxs6NI=; + b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6djNLXRIVPQZZW1FVYvOn/tPtr3vGLbnTcN + EIiqQUfY2uJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k + tnN7D/0d90bQBLWvZQ8d0lHinZ/3zwe3FEdaLK31OGRD7VJd7Q8ckuOxOF/eO8TLmksQovgvrTY + 68llyxkNZe/nnmY9UX+DJ+i5pzqINuLlGRqANukMePwwJxJZilb6dRXB9sR+hSBHC+YTyfY67xk + 78ILyZhMmZqmi/ya6lBqxLieP+CnHq1V9n07s3jljhE1oSp4NucQzFXpv48MGEpOt/sIyjtzQ5w + aw7r1Wsay9w+xmNly+kBT+05q5dp/CTnqMp1koKGG/fWWkSZUgo5yODYeRAiieb7ZQ5JaVmxJkf + G3K0BPkFJ+kaPyU6Mbe0d573tY+oZsWDWEBFP/diduz8lw27tIDOmpTIyT8lMsu1vL7dcj38NsS + 50a7smXimMWcKwJsEQV32Tw0QYv4kfJyqjxXVj6kJ+DWL1bm15LZ6fZpXy3tbTHzJvWRr2Lx/AZ + mWXbylc+uUx4tQkb+7+OhSN376NPfWUNlGHMdHSfQHgzcFuGbMmf9v58sPXa7ZKb3UFkKk2MAzA + 8kiDEMgp/6k55lHxdc4ndxK/vXTKxiU59H2k+okeAQ2iMnA39r/M7yOe6a8vyXDyeuCmJHncNAX + /Uy4yr757EQpUKygo3DjdfRcZQ/h5hQ2TFiWm3BlU87k8MlQl5JEGwxqpkM+9JXFjRwiGcR2ZSO + fOkmL+X6FXNHw3A== +X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; + fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 +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 + +For running U-Boot as primary bootloader we must define the memory +layout statically. + +Signed-off-by: Caleb Connolly +--- + arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi | 23 +++++++++++++++++++++++ + 1 file changed, 23 insertions(+) + +diff --git a/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi b/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi +new file mode 100644 +index 000000000000..c3ec4a317f7c +--- /dev/null ++++ b/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi +@@ -0,0 +1,23 @@ ++// SPDX-License-Identifier: BSD-3-Clause ++/* ++ * Copyright (c) 2024 Linaro Ltd. ++ */ ++/ { ++ /* When running as the primary bootloader there is no prior ++ * stage to populate the memory layout for us. We *should* ++ * have two nodes here, but ABL does NOT like that. ++ * sooo we're stuck with this. ++ */ ++ memory@80000000 { ++ device_type = "memory"; ++ reg = <0 0x80000000 0 0x3A800000>, ++ <0 0xC0000000 0 0x01800000>, ++ <0 0xC3400000 0 0x3CC00000>, ++ <1 0x00000000 1 0x00000000>; ++ }; ++}; ++ ++// RAM Entry 0 : Base 0x0080000000 Size 0x003A800000 ++// RAM Entry 1 : Base 0x00C0000000 Size 0x0001800000 ++// RAM Entry 2 : Base 0x00C3400000 Size 0x003CC00000 ++// RAM Entry 3 : Base 0x0100000000 Size 0x0100000000 + +From patchwork Wed Aug 21 13:41:48 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Caleb Connolly +X-Patchwork-Id: 1974972 +X-Patchwork-Delegate: caleb.connolly@linaro.org +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=W/enKPtj; + 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 4WpnZg6XLXz1yXf + for ; Wed, 21 Aug 2024 23:42:35 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 8FCF188DD8; + Wed, 21 Aug 2024 15:42:03 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="W/enKPtj"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 7430788BF6; Wed, 21 Aug 2024 15:42:00 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com + [IPv6:2a00:1450:4864:20::436]) + (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 BB78388C7E + for ; Wed, 21 Aug 2024 15:41:57 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=caleb.connolly@linaro.org +Received: by mail-wr1-x436.google.com with SMTP id + ffacd0b85a97d-3718706cf8aso4087426f8f.3 + for ; Wed, 21 Aug 2024 06:41:57 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1724247717; x=1724852517; darn=lists.denx.de; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; bh=zLolcdfhpnv2Sr4+jU2o0ZvxpFWa2r7z1o+vmKY3kNM=; + b=W/enKPtjbLPpOfXBJ95XWpBN74SHMzSf7YfqzclhQ8DglD54/Ubm8hmtMAJr3dU4oc + 7QSmg2IojIWCgmF7ZVpPpPipkl0d0NJdhrbZgltHWn6DI5oa5z8H/oPL2qgfxOvi1mol + GkNDzmOd9DogYJbDxazFLX/yuyObHE0Frbk1+5S+dUC9Mk6TEn/kAnphDP0/pIcoFqNS + MHhPWfxQj8qNWFF683e2CNpiiQmhvIyxMnx2XDqHqr0sARkmDhEdmDt6/J2uDEpAXIqS + gfb2ryOgrf0ymsrNXXmgtPBlJ1Nk+WvqQNZ+fFud6rDTMI7k3T6vg9LtuKRk5l0ZeW9z + 9ukA== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1724247717; x=1724852517; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=zLolcdfhpnv2Sr4+jU2o0ZvxpFWa2r7z1o+vmKY3kNM=; + b=Bk58APruZpAfRV6OKvJFR/r6nSOZTRk1lGotJZ/7Ps1APRn4QEUIEES/nAymFAlsZK + IuAn5ixOz3aQip+GhlTd5ZX/4G2D90T9SLGu+jKI2zHbc9HfYsLUaLImDouZanKiy3DN + rSF/DzczN7mNahfl++0WXyuhXE1l5coIb99U116QJ4etTFEC+YvBD2zWg7RpfxE6F2MA + tu2L+KZX2xor/7JzMfyV/FeFyAo5X53e7JPAVpvXa6vGTXfyZa8kzv4oIa1vTbwsuxLK + D4AcwfMHj4eyGTilDPHRn292bg79eS+R3MX3EpFEW6J/Zr5fKhsyDSDcjBuR2TYJ7Gcv + BDrw== +X-Gm-Message-State: AOJu0YxuxBBsFKKWph/SGz+J1lDRx2i4hMnvb9KUEI3p7sCb122LZSOU + lTiuOgJUeGU0ryXFmDTRlVFUVDC+WlMh98BjXmGjDc74hcUPn0EuM1QELuQYSNk= +X-Google-Smtp-Source: + AGHT+IFF8AJ5Hu9iRBb/BV7cCxp9j5UJEcpMy4SVnJcq2ijih+8KFAvBMsil1LfJlPGBheg9LAatHw== +X-Received: by 2002:adf:cc82:0:b0:368:6633:c550 with SMTP id + ffacd0b85a97d-372fd82f325mr1509038f8f.52.1724247717163; + Wed, 21 Aug 2024 06:41:57 -0700 (PDT) +Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) + by smtp.gmail.com with ESMTPSA id + a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.56 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 21 Aug 2024 06:41:56 -0700 (PDT) +From: Caleb Connolly +Date: Wed, 21 Aug 2024 15:41:48 +0200 +Subject: [PATCH v2 3/7] dts: qcs6490-rb3gen2-u-boot: USB host mode +MIME-Version: 1.0 +Message-Id: <20240821-b4-rb3gen2-v2-3-49b07633f3a8@linaro.org> +References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +To: Tom Rini , Lukasz Majewski , + Sean Anderson , + Caleb Connolly , + Neil Armstrong , + Sumit Garg +Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io +X-Mailer: b4 0.14-dev +X-Developer-Signature: v=1; a=openpgp-sha256; l=955; + i=caleb.connolly@linaro.org; h=from:subject:message-id; + bh=HTbXxsrMd17GClJdrUxqmv1t42K8cKHfbuWdCzpCB0M=; + b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6djkazDSIeIn+UGkfv2WCzgyN2+Nv9IFp8u + /7f/kVTNzKJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k + tt0qEACLN54DQLVEpmwhpZIBzCPjtaeMTHKNrVejy201O3Ts9I8BmKyuCQmcJReF8E1oTvhVE2p + RRdEnopYd86hGyIc6pZZ1tNwmwCxeADAERIygNKEAGK6f6v29CJZt0OMSVRx7emdUn6wDP0/6FQ + W7zfmxJKZMNp1gEMS80FJSa+PkI148T6WzfmKEfNbENYTwwIwC/e8yqlKXp+joiPv269f/nYbtY + ZR6mW3re0fvIoCbUjHcIRmu5ZWB92qqfwAiSCLLlajpzIF8iDrDyOYOdb7/TxM5eWZloPwDYHaK + 0eJde2EIysMA1TJFP8ynVnUe1c4sZxDLB+ZnVUpbvGTvHjguamxfazEZlUmd1kV6m+ilTqAIlUP + 2v5eY2KUjx+MD8qm5FLgpj6JHDE9jszg3LSETAPwJDk0MICXQoY9HMu03kO8KE62j2HrRwVn7/G + i1agSOBRJyNDHqTiUh2vYQnwwBPANZPjipnQgPkZ6Ebd98KbzzHr9Dh+kR7eC/caSf0V82YK4G8 + mPCaznXAPS+VNfT+JZQxQz7Axm1O7bWfIuSdLGqVGBRj4+4W3k1PzFWI7S46Vj4qWbpJXuWKl6I + UlE67yw71FwYzQt6B7xLMSCr2O8bFmlv42AVl6bNjG53CZ8HmBo5AuKrhbdhpLv5HfjWK1j58tW + Ci+WPJUvj2lPPfg== +X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; + fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 +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 + +Adjust DTS so USB runs in host mode. The type-c port is the only +supported port (since the others need PCIe). Booting from USB is +possible with a powered type-c dock. + +Signed-off-by: Caleb Connolly +--- + arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi b/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi +index c3ec4a317f7c..fbe72595f5ac 100644 +--- a/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi ++++ b/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi +@@ -16,8 +16,13 @@ + <1 0x00000000 1 0x00000000>; + }; + }; + ++&usb_1_dwc3 { ++ dr_mode = "host"; ++ /delete-property/ usb-role-switch; ++}; ++ + // RAM Entry 0 : Base 0x0080000000 Size 0x003A800000 + // RAM Entry 1 : Base 0x00C0000000 Size 0x0001800000 + // RAM Entry 2 : Base 0x00C3400000 Size 0x003CC00000 + // RAM Entry 3 : Base 0x0100000000 Size 0x0100000000 + +From patchwork Wed Aug 21 13:41:49 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Caleb Connolly +X-Patchwork-Id: 1974973 +X-Patchwork-Delegate: caleb.connolly@linaro.org +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=fxhzRRWP; + 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 4WpnZv2VSTz1yXf + for ; Wed, 21 Aug 2024 23:42:47 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id F1A1E88DBB; + Wed, 21 Aug 2024 15:42:03 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="fxhzRRWP"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 5F28288DBF; Wed, 21 Aug 2024 15:42:01 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com + [IPv6:2a00:1450:4864:20::12c]) + (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 5838488AC0 + for ; Wed, 21 Aug 2024 15:41:59 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=caleb.connolly@linaro.org +Received: by mail-lf1-x12c.google.com with SMTP id + 2adb3069b0e04-52efc60a6e6so9447535e87.1 + for ; Wed, 21 Aug 2024 06:41:59 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1724247718; x=1724852518; darn=lists.denx.de; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; bh=cqF2st4G7Whhok3VZo6aDGC//+kV3J+exZKhkiiSLFQ=; + b=fxhzRRWPt+qpJciGSAITWCo8l8X60UfTDq85wh8FY7dCx3uklUdpEcoF9mZQvZEARc + JdrCoNahI2M7n7uxXFkWNU8HAYP8adAfEIdzL9A74GE5HVYfUWU28+jLirmyAHbts2I/ + SdPX01laMMuUBZNO1+eQTpYWK/pAO7J5BnazS9JOOedrSlBLeiX74zICTx9l/ogHIvar + oyR9/w28as1z3kdFFAACkxGoDrWsz0kGqhEBXGOOnKRQeXi16Wyq/ZOkZwrDs+ZaOCj0 + Np0K2VryzXH+5acK/T8VFyaO/kiwyVE+oBQ9+t4QRslHCVoK+vniJFjWJmyiLbcrR+VF + Ug3g== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1724247718; x=1724852518; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=cqF2st4G7Whhok3VZo6aDGC//+kV3J+exZKhkiiSLFQ=; + b=luGrCmqihUFezhJWv4e5vJ9xNHo14vlaEyeUAxelx59D64ZJJ1t0Wp71nzKQ4MjeF1 + +a5ZoV7GeqYCdriLcYtSAm+mGfHYq6wqLK7MUxTJJXQiQ+8YNOE8O5jZPRQOnykhrHyv + SGgBu95T4t2+iops0PoEG1WJgUFfQdguMeIxCF/3egeF2vbuiLdkag3f/P1oZ+WId9d8 + CdjoDP22VLYkI737XGw5dPYXjw8n5aElyW4w8a8+s/+LSHr2DqhP6jBRBHoEr96u9caD + MD/ZJMxHUIF5HVF49slrJCvxOVaE1BLLfvGg6DsgTGbiJ1R04nnqmP4eIiihjxGfokAz + ayDA== +X-Gm-Message-State: AOJu0YyYd+xZ/CF0vx8K/xUigIplSGcNj9+ZYg92++5jyNrmeP/Dw2mb + YdY8603ttFOxzF77F9uZemMCCMk9Yqe06DIg4zk9AmmXVSdjOM16xI4mPU3kNko= +X-Google-Smtp-Source: + AGHT+IEiWiQ2+rnq9ygkkGwKWRO1l7vPXtE6nv9tq+GTkhXNeXOlV9Q+YJri22fWRmcjXR32eVPTAg== +X-Received: by 2002:a05:6512:696:b0:52e:f77b:bb58 with SMTP id + 2adb3069b0e04-5334858e2dbmr1246801e87.36.1724247718271; + Wed, 21 Aug 2024 06:41:58 -0700 (PDT) +Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) + by smtp.gmail.com with ESMTPSA id + a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.57 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 21 Aug 2024 06:41:57 -0700 (PDT) +From: Caleb Connolly +Date: Wed, 21 Aug 2024 15:41:49 +0200 +Subject: [PATCH v2 4/7] iommu: qcom-smmu: add sc7280-smmu-500 compatible +MIME-Version: 1.0 +Message-Id: <20240821-b4-rb3gen2-v2-4-49b07633f3a8@linaro.org> +References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +To: Tom Rini , Lukasz Majewski , + Sean Anderson , + Caleb Connolly , + Neil Armstrong , + Sumit Garg +Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io +X-Mailer: b4 0.14-dev +X-Developer-Signature: v=1; a=openpgp-sha256; l=735; + i=caleb.connolly@linaro.org; h=from:subject:message-id; + bh=kxKBScKaYeuETfEZtkdyvgk1CIJk9dkzDtE1GYwaPOI=; + b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6dVYUKBuKYzxniyjNVxYEoPmLImzpJJVKSN + fZ8OGllgq+JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k + thhHD/sEX0G2aVw1Y8dD02U8Fg111EK/PNvDyUlifhchP/sTDJHxyzWJc0zxsb1FtSosTWlnv1i + tgFSLVCLklzMwrcUCZb5Fe/9bWGRL6Uz0dEbDXZohGWagR4SC9MoM/shyb6R7Xm2ywwaR1dBkHM + alh2af0YAoJi0TljeQz70GlUCBAyLiLhLD9/V7JDfkdAgUj1R7tGibGbz7plVk1ySD/JUbXLyRD + Oj3l66FUGleJAA+KrvbPR5sVcA8Zt+Mak0xp5xyjQ0T8TUNfwJF0VUgWEpiVHWZGPgOgw2OnE5U + Iv4mBGteHGHC0WjCdjt/thyn2+QCx/LjPwrBDrsyw6FFyg43yWEmDkEgfCiTDSHMtTMSPLvYbXM + b00Egv5OZrrhIGahpHxdd2Ui/6zicLanexZopGSaMu4DnMnhfm7GGdRxNphtP9VMWwgy+vePa+a + ghVuG+oIgtIOoEwE/SN2zBpMIxLNuzTi3c80xsxh6uA+5VH9X937eNFlB0fouXJjG27Jo4NSbKL + oeSE2rLXYtJ2bCV0ee7E5InyvUsdzHynjewLM0usEvnFHn433yCibXdQ1VjAZJVOJlFwxt85evc + Y/3ckT+iau+N7Z8un7Vhsp2FKf/IR5/QGd1NrfOyZuZ4V3ojqtD71Hymz1874HoW492BdpUytut + 5WHbOvM4jWAm5dQ== +X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; + fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 +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 + +This soc doesn't have the generic compatible. + +Reviewed-by: Neil Armstrong +Signed-off-by: Caleb Connolly +Reviewed-by: Simon Glass +--- + drivers/iommu/qcom-hyp-smmu.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/iommu/qcom-hyp-smmu.c b/drivers/iommu/qcom-hyp-smmu.c +index 7b646d840dd4..1b5a09bb7b39 100644 +--- a/drivers/iommu/qcom-hyp-smmu.c ++++ b/drivers/iommu/qcom-hyp-smmu.c +@@ -380,8 +380,9 @@ static struct iommu_ops qcom_smmu_ops = { + }; + + static const struct udevice_id qcom_smmu500_ids[] = { + { .compatible = "qcom,sdm845-smmu-500" }, ++ { .compatible = "qcom,sc7280-smmu-500" }, + { .compatible = "qcom,smmu-500", }, + { /* sentinel */ } + }; + + +From patchwork Wed Aug 21 13:41:50 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Caleb Connolly +X-Patchwork-Id: 1974974 +X-Patchwork-Delegate: caleb.connolly@linaro.org +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=yOMaz64l; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wpnb85tThz1yXf + for ; Wed, 21 Aug 2024 23:43:00 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 6572A88DE5; + Wed, 21 Aug 2024 15:42:04 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="yOMaz64l"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 47E5388AFF; Wed, 21 Aug 2024 15:42: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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com + [IPv6:2a00:1450:4864:20::62b]) + (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 2E9D188C36 + for ; Wed, 21 Aug 2024 15:42:00 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=caleb.connolly@linaro.org +Received: by mail-ej1-x62b.google.com with SMTP id + a640c23a62f3a-a7a81bd549eso556008566b.3 + for ; Wed, 21 Aug 2024 06:42:00 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1724247719; x=1724852519; darn=lists.denx.de; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; bh=VGpHi3k7vxgehhynkHpyKJwxi4oKfB4A2A00OXKPkFQ=; + b=yOMaz64lma1hQ0+Gt5CgMdElox51jZtnVyBitVGl6NvVmTuRWyklxImOrmwqsD3xYC + LGVcaLqh6/Q1W84/a/VQjQXnjBnf7rwjs1wqMs2mxBSvIXqX84EaEYJsYQK255NuFmeY + NXA0Iw/mLc/lgHAufmAUkAE02OVXH7AAyOjuEUceM/a6s9P5xPF82ucP7uH1adqOkAZQ + MTmKJK30kZjuhrZasD0UafyDCfMinXHhHFqlIcrhxmitRK4qDTzbktP/Atn3wfIJpVyh + Zbfra3N7AwxLidGI4lgrZSdfJWx7xo7f78GLzrxxtf9EQNN97axpLHFCTql16lK6z8qx + 3Psg== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1724247719; x=1724852519; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=VGpHi3k7vxgehhynkHpyKJwxi4oKfB4A2A00OXKPkFQ=; + b=wjTgODezMYlCn5sKcCnnp1Vd0OLBd5uCD0eBpdaJdRReSR2EsRO7RyUqvKoOvz7NPc + O7v24bEyP8vKrldHxpNvN9R6RqnobFMDUq1urWi4ObeXiFLrgH/iVa6h8fQXs239YyyD + x2v2ZGzHy5LuWMQItcPDAfgV1NMl9e9Whd1LOS9mJBgHAuX64ve4uf3jQhpIAG52PGNG + PqZklpeuYNZrK/gG7RZSuSUlrHkd3f3UF6b7jqC16TpwDc+4RuW5vF35uLCqnjMjHRPK + jxAj6zbq1QxznhNSLn6wMt4SHd44YvPRET9SWyLNJ69jL8f3LA+/2vyrgQdg3UYIUTaf + WunQ== +X-Gm-Message-State: AOJu0YyYxzvh/Kq2TnmE45KUz4jNc/HfUkc2DCE5IqW05whgtX84/Uou + QvsSOrpkiSoyoRX00nQTJ6PEghMnyz/il1CvQOq6oIHOYo7ZMLMN86AVf2+SA9g= +X-Google-Smtp-Source: + AGHT+IF2/DupIr7S3Tf/n9l6fXvTAbuD5E3nSTqZnLUH17vrwUpiB2tHgdlyQp8XysNBhZpXN+tPXA== +X-Received: by 2002:a17:907:d864:b0:a86:6cb1:4d49 with SMTP id + a640c23a62f3a-a866f0fd56emr197816466b.13.1724247719583; + Wed, 21 Aug 2024 06:41:59 -0700 (PDT) +Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) + by smtp.gmail.com with ESMTPSA id + a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.58 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 21 Aug 2024 06:41:58 -0700 (PDT) +From: Caleb Connolly +Date: Wed, 21 Aug 2024 15:41:50 +0200 +Subject: [PATCH v2 5/7] qcom_defconfig: enable SC7280 clocks +MIME-Version: 1.0 +Message-Id: <20240821-b4-rb3gen2-v2-5-49b07633f3a8@linaro.org> +References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +To: Tom Rini , Lukasz Majewski , + Sean Anderson , + Caleb Connolly , + Neil Armstrong , + Sumit Garg +Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io +X-Mailer: b4 0.14-dev +X-Developer-Signature: v=1; a=openpgp-sha256; l=670; + i=caleb.connolly@linaro.org; h=from:subject:message-id; + bh=yS4s6QOgfiWQfzfc4REiZuaFQ3cRc+UaGAPzZhg/0tY=; + b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6dlBkL0sqAHkV82+rSk3ED8IQyQvi4gHZz1 + YfE45yCF8SJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k + trAoD/9/6KH2Cobld2UEMHFj+Lh80HJIGWdNHdhodfzYtlvCFU8pC/pmYwgBd9Opd24rU+Xh7dU + 8f+9HBKcRKgLmbuUy1fAn84B+kgl/IJtVeHpaP6LRp12NuJudZYl+woPx3mAgz9Wqv/+74nKYok + lVr1q9hbq4ZuMItcuzU5fWoyh7iC3th7KYUhh6939F1PQ8FFeF/5+9jJpRBMpuNZPFETxhlBTwY + YDXZL75cWg6ImurwaM4Hj1zQpHnR8V8HDa5GTTDNMxHOBFYCL+cJ3Bfd0FjqXFsL2/zjefqsewa + 0rWWQPMC8az8WvyczZAvB5JTq+M3VbP7kEWemCdedXmHiJ33dO6+jabm0ikvLooz1z7G6rlwZxZ + P7Rgc3ewW+RHOYbVYFLRKCdFVOFtiwOcEke50gPqQr/sbz0p39olzaE+D8WdNvgjW2uBRzLJDnR + EqyAYWncrWyAANXM3RSiICge87zZ/l4iUb8t8qm/8dYAs8KgPk6YNYVgLxtQqfVFNqnkHlmyy43 + 82JCgSSVggB9phNSVn/poUjlMlaImqGWB+zHDgf968J0a7mz/uFRgVgb8cjuG/Y5oX0xhNMkfqW + 2VymGoOrNlNvBNHyYEoEWgOMRiPvB/lL7PwbM9FFXmNyMMkx6FkzFgyopVkSWvCzKZQfgwBaUev + z00CkhnUndrSe5w== +X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; + fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 +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 + +Enable clocks on SC7280 + +Reviewed-by: Neil Armstrong +Signed-off-by: Caleb Connolly +Reviewed-by: Simon Glass +--- + configs/qcom_defconfig | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/configs/qcom_defconfig b/configs/qcom_defconfig +index 24b71ba7be29..1a079264a554 100644 +--- a/configs/qcom_defconfig ++++ b/configs/qcom_defconfig +@@ -44,8 +44,9 @@ CONFIG_CLK=y + CONFIG_CLK_QCOM_APQ8016=y + CONFIG_CLK_QCOM_APQ8096=y + CONFIG_CLK_QCOM_QCM2290=y + CONFIG_CLK_QCOM_QCS404=y ++CONFIG_CLK_QCOM_SC7280=y + CONFIG_CLK_QCOM_SDM845=y + CONFIG_CLK_QCOM_SM6115=y + CONFIG_CLK_QCOM_SM8250=y + CONFIG_CLK_QCOM_SM8550=y + +From patchwork Wed Aug 21 13:41:51 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Caleb Connolly +X-Patchwork-Id: 1974975 +X-Patchwork-Delegate: caleb.connolly@linaro.org +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=K30ji2S3; + 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 4WpnbM59VXz1yXf + for ; Wed, 21 Aug 2024 23:43:11 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id D2D6288C25; + Wed, 21 Aug 2024 15:42:06 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="K30ji2S3"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 9300088DD4; Wed, 21 Aug 2024 15:42:03 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com + [IPv6:2a00:1450:4864:20::62f]) + (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 3E8D188DBE + for ; Wed, 21 Aug 2024 15:42:01 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=caleb.connolly@linaro.org +Received: by mail-ej1-x62f.google.com with SMTP id + a640c23a62f3a-a7a94478a4eso147841366b.1 + for ; Wed, 21 Aug 2024 06:42:01 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1724247721; x=1724852521; darn=lists.denx.de; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; bh=yPrDPgQU7/bvZow9laSNg4WMEx5CRzVugf/oAUblCT4=; + b=K30ji2S3yioeE5/M0vSF0qrx1STvg5+c45nG5Kg+dcjyT1GMIsiX0GbpHc8+aTeWpp + Bd16xS5DE9TAuA1s2WmMq1TNdKHCyyx3MSSHMP9S9SctgsZSxIypHfGf7m6duOmEf5I8 + HBAumCuGiHTW3NkqIl8H2yZjkAbajsM1Q98+NyYJskO8owlNVyczk44QEbJ16Jtmntq6 + u+v7SADVhB3LrWu30OOWnwu/Z/9TVapcDx+ZAGflSfCy5P54TgqYIRYrBtjn9huobmaJ + XJED4Ak8A7iJHUQ5Savv+T4lTPHHfD+J+1NZDr1ciKMujXdnFUuZYcUZLoAn0PHLVsDD + +S6A== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1724247721; x=1724852521; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=yPrDPgQU7/bvZow9laSNg4WMEx5CRzVugf/oAUblCT4=; + b=RTxkaBLhQgRZeSdTWakNQdltrcGw4Cw+6Jge9dwNM3Q/YJMSuM1z7N2JGOntXjHxD2 + NZzz61S7FHFOOjYJoubSodORxK53ddoKFuwUvxurdOy+9Y67fPtAweqdd8NJnDdvBrEh + 35wnkzs6ItOpaYe1StAVW06cFPwhqK7ajV3yVdoyKwzCfp8oTYHC5QFJUhi0EM4KnF97 + HepCXvJdv+Qm1/hOVJu19Y6L2RKwXEWztyS53XVwtLOeyKO5x4Qk4PuhnZEAcGkT5lBB + 0kaoF4zSuIX8CVYMJ4oa/4TJg/epJPEtpdDjPDJ2KEWVWbay4/E7PLlgi/tDNndUgOGI + 5vvw== +X-Gm-Message-State: AOJu0Ywpr+aZcIll1/M3ZGdzXawgIEMgRfu4GacRerzZeNne6pIDfvz0 + FBjk4XnDaPXHLxU60pO20RaUjuXG+96oqxwOdmGkP/6Hf3yiMbOJc/ikC/obqxQ= +X-Google-Smtp-Source: + AGHT+IFBBHXs1fwWXLXlqsclsjPN/CITy3andQbbeClu6l28M7g0bUERMexbKgeMqQwwLkcBMwvMRA== +X-Received: by 2002:a17:907:1b2a:b0:a86:668a:8b28 with SMTP id + a640c23a62f3a-a8670182bd0mr296134266b.30.1724247720548; + Wed, 21 Aug 2024 06:42:00 -0700 (PDT) +Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) + by smtp.gmail.com with ESMTPSA id + a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.59 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 21 Aug 2024 06:42:00 -0700 (PDT) +From: Caleb Connolly +Date: Wed, 21 Aug 2024 15:41:51 +0200 +Subject: [PATCH v2 6/7] configs: add qcm6490_defconfig +MIME-Version: 1.0 +Message-Id: <20240821-b4-rb3gen2-v2-6-49b07633f3a8@linaro.org> +References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +To: Tom Rini , Lukasz Majewski , + Sean Anderson , + Caleb Connolly , + Neil Armstrong , + Sumit Garg +Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io +X-Mailer: b4 0.14-dev +X-Developer-Signature: v=1; a=openpgp-sha256; l=1579; + i=caleb.connolly@linaro.org; h=from:subject:message-id; + bh=ACfbGsu6Qfhpulh7cWGr4R2PHD6f1xBOaMcu/oMTV/k=; + b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6eltJAuAi418HOLC6BvAwvNrE6K+OD4tmaU + 8Agtuwf3TuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXungAKCRAFgzErGV9k + tp2fD/4izqkO8vl46KJDMg5exEAzqayxPJyZcBnhIQyekkEfHowP0Hnr0xDZqbYbl6BAapt+ZBA + 237lBMrvuWc45PJO228GrtQw+7AcU8UqYXvy0mhiS+xUJHhirFotdPZX8jly9sRdw54SUINx7vl + HThC3BXeYgmzugZXoSGA3Dw/d8NZXgf5aCjqXW/pIMBWK4RB/4r84gPQG3dgNT12yTVuNtN81ng + 7UMKgDHnK5kaXNh630td4ZmmJQ2jhUU/DShNLmKJnpe67xiK6DjHJiQqgqqj2ZZ38qvlRRpNYgx + 0iwUSyvlnNrB6dHAyzgUjMFaqxReb+rJKvr7+k9YB1dbmysbh9MM3WlWKmf9P39qLjJp1zBwd5z + 9lolc/k+9FT0hziFLDd1sMPQ0oBSZQQNFxZCEtncn387cDFCvJb/nUZnyt6XVzimfnSfssBGQ/g + A04MCaVXei5UeDZHc2kuv4yi7bWWnN3hZVdkoSHMe5esd0cYlVmz2tBkPzTDWIckquNRo/2dWyE + k5yQoqRVqg/V1GTE0f3B9aL/diPmJdYp+Z2FAAihFEUEOAKSPr+BfGIm2bNoMHUUQRGecjNoitg + qLmRTfs21gQs6x1ZivJ1tm3WGl2u+FUm9uuyYwB0bGnXasAzIBB+F4K2AL3dcULGf3Au2Q4w7Y1 + ULXtGjABlmE9Z5w== +X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; + fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 +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 + +Introduce a defconfig for the RB3 Gen 2 and other QCM6490 boards with a +dedicated uefi partition. These can replace EDK2 entirely with U-Boot. + +Signed-off-by: Caleb Connolly +Reviewed-by: Simon Glass +--- + MAINTAINERS | 1 + + configs/qcm6490_defconfig | 18 ++++++++++++++++++ + 2 files changed, 19 insertions(+) + +diff --git a/MAINTAINERS b/MAINTAINERS +index daaf0345d0e8..7ab39d91a553 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -616,8 +616,9 @@ M: Neil Armstrong + R: Sumit Garg + L: u-boot-qcom@groups.io + S: Maintained + T: git https://source.denx.de/u-boot/custodians/u-boot-snapdragon.git ++F: configs/qcm6490_defconfig + F: drivers/*/*/pm8???-* + F: drivers/gpio/msm_gpio.c + F: drivers/mmc/msm_sdhci.c + F: drivers/phy/msm8916-usbh-phy.c +diff --git a/configs/qcm6490_defconfig b/configs/qcm6490_defconfig +new file mode 100644 +index 000000000000..25413ac9ed5a +--- /dev/null ++++ b/configs/qcm6490_defconfig +@@ -0,0 +1,18 @@ ++# Configuration for building U-Boot to be flashed ++# to the uefi partition of QCM6490 dev boards with ++# the "Linux Embedded" partition layout (which have ++# a dedicated "uefi" partition for edk2/U-Boot) ++ ++#include "qcom_defconfig" ++ ++CONFIG_DEBUG_UART=y ++CONFIG_DEBUG_UART_ANNOUNCE=y ++CONFIG_DEBUG_UART_BASE=0x994000 ++CONFIG_DEBUG_UART_MSM_GENI=y ++CONFIG_DEBUG_UART_CLOCK=14745600 ++ ++# Address where U-Boot will be loaded ++CONFIG_TEXT_BASE=0x9fc00000 ++CONFIG_REMAKE_ELF=y ++ ++CONFIG_DEFAULT_DEVICE_TREE="qcom/qcs6490-rb3gen2" + +From patchwork Wed Aug 21 13:41:52 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Caleb Connolly +X-Patchwork-Id: 1974976 +X-Patchwork-Delegate: caleb.connolly@linaro.org +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=linaro.org header.i=@linaro.org header.a=rsa-sha256 + header.s=google header.b=N7ncWeh3; + 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 4Wpnbc6Cbtz1yXf + for ; Wed, 21 Aug 2024 23:43:24 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 3D6FC88C7E; + Wed, 21 Aug 2024 15:42:07 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +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=linaro.org header.i=@linaro.org header.b="N7ncWeh3"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 78A2D88BF6; Wed, 21 Aug 2024 15:42:05 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com + [IPv6:2a00:1450:4864:20::22a]) + (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 0804988BBC + for ; Wed, 21 Aug 2024 15:42:02 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=caleb.connolly@linaro.org +Received: by mail-lj1-x22a.google.com with SMTP id + 38308e7fff4ca-2f3bfcc2727so47717401fa.0 + for ; Wed, 21 Aug 2024 06:42:02 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=linaro.org; s=google; t=1724247722; x=1724852522; darn=lists.denx.de; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:from:to:cc:subject:date:message-id + :reply-to; bh=IvOluZPLzD78/HF1gfteCSftNGDnvO7+RNQKT4a8rSE=; + b=N7ncWeh3cbNIFm16gC0ycocqUu7FjIH/X5KUs3ng3VOMDiDB9bx6yqvhqYvjQxyBc0 + NtX/AEn+6kLdyYda7FlKDaCMV9zQy5kNC993I5rZ4A9iW9QyJTuwBSzH7qa4sO6gQ1ol + 8Lo1+ZJhhBum9Ni+61giewvGR09iEusCmwVImeU5GAZaibju4E3OPBByXLzP8iW1CXee + Td0YEp/5GqF/suNSfz0LIe3u7qAf4ym1XGfXSuoSZTlAKYusX8Hr8p7r6eeQe98FId8k + K8EtjvWCpjafWWcaMyS2hMQJ9qVg2oN+O0BWIVzab1rmcZfKqTsdCdRmT5zJ8/UuskiJ + ovww== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20230601; t=1724247722; x=1724852522; + h=cc:to:in-reply-to:references:message-id:content-transfer-encoding + :mime-version:subject:date:from:x-gm-message-state:from:to:cc + :subject:date:message-id:reply-to; + bh=IvOluZPLzD78/HF1gfteCSftNGDnvO7+RNQKT4a8rSE=; + b=irJmZUIlQ9YqUetM6kgCgWcp0L2t2cRcBdc7BANQ6GSkyblKM0IhcjmShs/YQLTvfD + kcy+qKFJUBLqwl/GS2t28MNGXs5+jyhkJJtmlWXg0jksArLnCgxQNWggqkJHxHr4QXWm + yQUR1tfzoSdEPgisANBnh6pIR2x4I+INopwPke0bJOnMgq6gauZ6e7Sb5DK8+XfB+ub7 + 4BwZrBRNSgdQL4GZy7yJ7/tDy+Rb77CKeC82GlbeYSYWjhnyNHiApHXii7b3P9K1dIpH + TuIXX+CoDUWK9SpsTDPZQ9TKah8sMs4lll+6bxADx28pav2gXGoDzIq8+8njC4mnAW8D + QRKA== +X-Gm-Message-State: AOJu0YxQDsjOdfe21vx3pm9NQzQM6F9uuV8kmavTQJuc2Dc6UIFEBXIw + Yp6RPVVelZ9sExmiTtDcpYm6jM3fkV9MKKhMmd5jCa8HvsIjbjln6JXyuICIMFA= +X-Google-Smtp-Source: + AGHT+IFOXObF674O6U9t5YWoWgiOsh1cr3c2B3a47ilhjVWpLEAWrw7hptc9n6o8T5A7NFea+26OwA== +X-Received: by 2002:a05:6512:118f:b0:52f:d17e:46b with SMTP id + 2adb3069b0e04-533485eff58mr1798728e87.54.1724247721704; + Wed, 21 Aug 2024 06:42:01 -0700 (PDT) +Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) + by smtp.gmail.com with ESMTPSA id + a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.42.00 + (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); + Wed, 21 Aug 2024 06:42:01 -0700 (PDT) +From: Caleb Connolly +Date: Wed, 21 Aug 2024 15:41:52 +0200 +Subject: [PATCH v2 7/7] doc: board/qualcomm: document rb3gen2 + building/flashing +MIME-Version: 1.0 +Message-Id: <20240821-b4-rb3gen2-v2-7-49b07633f3a8@linaro.org> +References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> +To: Tom Rini , Lukasz Majewski , + Sean Anderson , + Caleb Connolly , + Neil Armstrong , + Sumit Garg +Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io +X-Mailer: b4 0.14-dev +X-Developer-Signature: v=1; a=openpgp-sha256; l=3002; + i=caleb.connolly@linaro.org; h=from:subject:message-id; + bh=Zfbm5IKZooOMQaYWVdjsboSGnZBH9tpLor1DsgqeCLA=; + b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6eOpavbRRq/Mmd1u2iOzwt3wx46uoOvpDbB + SjdW6jqdcuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXungAKCRAFgzErGV9k + th2IEACXQhOGwtEPSr0Jpv9CdMJZvP6O7/us/hUgF9Bir4ETF1KQoReZ18goCIPH2bfLWQIT4eN + CS7gQ46J/jZfFKYl2ORIB7BUUfe58/nB4VvbfGfmskbHi4sdVSemgHxu04xNtj1ttCaiVKX58D5 + GLThMjr4w80H1RLlEnlJmDf8RC/bp6PPHv1a9f0mDH3y00HDTJInV1+p8Bp5T/foomvjYfdcB86 + okdAJzhvNDYeA+xQxp5zTAzDoGI1K/5NYiLyqYoNzpb2sVBTjEBl6fiQqZ6q9b6TWoP5H64s3VC + OsD4ZgATKSXgEYuNYGx5XwDd66lN31jnu4BRhav643sBpOwpN/UN3cLVeqHbD5K3QiI6j+afC7w + o1QNNxNE9pBp3ZBWWWWFbbOv+rwy5npvZHZKWUSNC21l2/4hI6XwAFLDlu5nm+yQ+fYdb4HnMc0 + 1kGJhpGz0/guwKXxpSVxijQT5lFbr81ADvFLzoRD33x8EnbG4aFGa6PhIU+H/9TNpDOaDWHQdIb + 18rqauYLxwejAvFKDC8EIWM9n+6Qkn8caR37H11EnKkNX15ZRKn3Oiv7n8Wy6CukVoFquvjL4IU + t/2E8nV32ksuehndbsDXnpRpSAefggkQ9TjkuGaV29j0nvSrlJiCud0Dzj0lTdjxBvJKpaXG7XN + YCCZ/x5nTtnxdyg== +X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; + fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 +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 process here is almost identical to the Dragonboard 410c, we've come +full circle! + +Signed-off-by: Caleb Connolly +Reviewed-by: Simon Glass +--- + doc/board/qualcomm/index.rst | 1 + + doc/board/qualcomm/rb3gen2.rst | 53 ++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 54 insertions(+) + +diff --git a/doc/board/qualcomm/index.rst b/doc/board/qualcomm/index.rst +index 4955274a39bc..8c7969987a97 100644 +--- a/doc/board/qualcomm/index.rst ++++ b/doc/board/qualcomm/index.rst +@@ -6,6 +6,7 @@ Qualcomm + .. toctree:: + :maxdepth: 2 + + dragonboard410c ++ rb3gen2 + board + debugging +diff --git a/doc/board/qualcomm/rb3gen2.rst b/doc/board/qualcomm/rb3gen2.rst +new file mode 100644 +index 000000000000..4240606224f5 +--- /dev/null ++++ b/doc/board/qualcomm/rb3gen2.rst +@@ -0,0 +1,53 @@ ++.. SPDX-License-Identifier: GPL-2.0+ ++.. sectionauthor:: Caleb Connolly ++ ++Qualcomm Robotics RB3 Gen 2 ++=========================== ++ ++The RB3 Gen 2 is a development board based on the Qualcomm QCM6490 SoC (a derivative ++of SC7280). More information can be found on `Qualcomm's product page`_. ++ ++U-Boot can be used as a replacement for Qualcomm's original EDK2 bootloader by ++flashing it directly to the uefi_a (or _b) partition. ++ ++.. _Qualcomm's product page: https://www.qualcomm.com/developer/hardware/rb3-gen-2-development-kit ++ ++Installation ++------------ ++First, setup ``CROSS_COMPILE`` for aarch64. Then, build U-Boot for ``qcm6490``:: ++ ++ $ export CROSS_COMPILE= ++ $ make qcm6490_defconfig ++ $ make -j8 ++ ++This will build ``u-boot.elf`` in the configured output directory. ++ ++Although the RB3 Gen 2 does not have secure boot set up by default, ++the firmware still expects firmware ELF images to be "signed". The signature ++does not provide any security in this case, but it provides the firmware with ++some required metadata. ++ ++To "sign" ``u-boot.elf`` you can use e.g. `qtestsign`_:: ++ ++ $ qtestsign -v6 aboot -o u-boot.mbn u-boot.elf ++ ++Then install the resulting ``u-boot.mbn`` to the ``uefi_a`` partition ++on your device with ``fastboot flash uefi_a u-boot.mbn``. ++ ++U-Boot should be running after a reboot (``fastboot reboot``). ++ ++Note that fastboot is not yet supported in U-Boot on this board, as a result, ++to flash back the original firmware, or new versoins of the U-Boot, EDL mode ++must be used. This can be accessed by pressing the EDL mode button as described ++in the Qualcomm Linux documentation. A tool like bkerler's `edl`_ can be used ++for flashing with the firehose loader binary appropriate for the board. ++ ++.. _qtestsign: https://github.com/msm8916-mainline/qtestsign ++.. _edl: https://github.com/bkerler/edl ++ ++Usage ++----- ++ ++The USB Type-A ports are connected via a PCIe USB hub, which is not supported yet. ++However, the Type-C port can be used with a powered USB dock to connect peripherals ++like a USB stick. diff --git a/aarch64-boards b/aarch64-boards index 2087102..9cdccef 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -75,6 +75,7 @@ pinetab poplar puma-rk3399 qcom +qcm6490 qemu_arm64 roc-cc-rk3328 rock-4c-plus-rk3399 diff --git a/sources b/sources index 4d7803b..a81cb70 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.10-rc2.tar.bz2) = 606b48ef1fbd67fcd686b68540eb6db9453f9a02af16fc244add9fd5b75743bd776e2a3806192345b8d6eaa0f6ba3a1322623e3254c1d511d8ee524f7515e8b3 +SHA512 (u-boot-2024.10-rc3.tar.bz2) = 3787a2b7333881c66fe1d1e5de2a83914bef9b00a584a9cbbdb791ca2f4ae0398f24acb2e8c4df8aa8a396f2c4a9005b590c928890a3bdf996ed0ed3f9a16330 diff --git a/uboot-tools.spec b/uboot-tools.spec index 5f2aaa7..9682fbd 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc2 +%global candidate rc3 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.10 -Release: 0.1%{?candidate:.%{candidate}}%{?dist} +Release: 0.2%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -31,6 +31,8 @@ Patch5: enable-bootmenu-by-default.patch # Rockchips improvements Patch10: rockchip-Enable-preboot-start-for-pci-usb.patch +# QCom +Patch11: Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch BuildRequires: bc BuildRequires: bison @@ -188,6 +190,10 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Aug 27 2024 Peter Robinson - 1:2024.10-0.2.rc3 +- Update to 2024.10 RC3 +- Enable initial QCM6490 SoC support + * Thu Aug 15 2024 Peter Robinson - 1:2024.10-0.1.rc2 - Update to 2024.10 RC2 From 9767fcde4a18cd56a753dbf20b4dc167443fd2f0 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 2 Sep 2024 16:38:20 +0100 Subject: [PATCH 045/128] A number of fixes - Fix Allwinner firmware chainloading (rhbz#2309138) - Fix ATF firmware selection on a number of devices - Support Allwinner SCP firmware (fixes suspend/resume) --- aarch64-boards | 5 ++++- uboot-tools.spec | 33 ++++++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/aarch64-boards b/aarch64-boards index 9cdccef..0530e42 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -16,6 +16,7 @@ ficus-rk3399 firefly-rk3399 geekbox hikey +hmibsc khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 @@ -57,6 +58,7 @@ orangepi-r1-plus-rk3328 orangepi-rk3399 orangepi_win orangepi_zero2 +orangepi_zero2w orangepi_zero3 orangepi_zero_plus orangepi_zero_plus2 @@ -74,8 +76,8 @@ pinephone-pro-rk3399 pinetab poplar puma-rk3399 -qcom qcm6490 +qcom qemu_arm64 roc-cc-rk3328 rock-4c-plus-rk3399 @@ -85,6 +87,7 @@ rock960-rk3399 rock-pi-4c-rk3399 rock-pi-4-rk3399 rock-pi-e-rk3328 +rock-pi-e-v3-rk3328 rock-pi-n10-rk3399pro rockpro64-rk3399 roc-pc-mezzanine-rk3399 diff --git a/uboot-tools.spec b/uboot-tools.spec index 9682fbd..4c8fb22 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.10 -Release: 0.2%{?candidate:.%{candidate}}%{?dist} +Release: 0.3%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -54,6 +54,7 @@ BuildRequires: swig %if %{with toolsonly} %ifarch aarch64 BuildRequires: arm-trusted-firmware-armv8 +BuildRequires: crust-firmware BuildRequires: python3-pyelftools BuildRequires: xxd %endif @@ -94,27 +95,40 @@ do mkdir builds/$(echo $board)/ # ATF selection, needs improving, suggestions of ATF SoC to Board matrix welcome - sun50i=(a64-olinuxino a64-olinuxino-emmc amarula_a64_relic bananapi_m2_plus_h5 bananapi_m64 libretech_all_h3_cc_h5 nanopi_a64 nanopi_neo2 nanopi_neo_plus2 oceanic_5205_5inmfd orangepi_pc2 orangepi_prime orangepi_win orangepi_zero_plus orangepi_zero_plus2 pine64-lts pine64_plus pinebook pinephone pinetab sopine_baseboard teres_i) + sun50i=(a64-olinuxino a64-olinuxino-emmc amarula_a64_relic bananapi_m64 nanopi_a64 oceanic_5205_5inmfd orangepi_win pine64-lts pine64_plus pine64_plus pinebook pinephone pinephone pinetab sopine_baseboard teres_i) if [[ " ${sun50i[*]} " == *" $board "* ]]; then echo "Board: $board using sun50i_a64" cp /usr/share/arm-trusted-firmware/sun50i_a64/bl31.bin builds/$(echo $board)/atf-bl31 + cp /usr/share/crust-firmware/a64/scp.bin builds/$(echo $board)/ + fi + sun50h5=(bananapi_m2_plus_h5 emlid_neutis_n5_devboard libretech_all_h3_cc_h5 libretech_all_h3_it_h5 libretech_all_h5_cc_h5 nanopi_neo2 nanopi_neo_plus2 nanopi_r1s_h5 orangepi_pc2 orangepi_prime orangepi_zero_plus2 orangepi_zero_plus) + if [[ " ${sun50h5[*]} " == *" $board "* ]]; then + echo "Board: $board using sun50i_h6" + cp /usr/share/arm-trusted-firmware/sun50i_a64/bl31.bin builds/$(echo $board)/atf-bl31 + cp /usr/share/crust-firmware/h5/scp.bin builds/$(echo $board)/ fi sun50h6=(beelink_gs1 emlid_neutis_n5_devboard orangepi_3 orangepi_lite2 orangepi_one_plus pine_h64 tanix_tx6) if [[ " ${sun50h6[*]} " == *" $board "* ]]; then echo "Board: $board using sun50i_h6" cp /usr/share/arm-trusted-firmware/sun50i_h6/bl31.bin builds/$(echo $board)/atf-bl31 + cp /usr/share/crust-firmware/h6/scp.bin builds/$(echo $board)/ fi - sun50i_h616=(orangepi_zero2 orangepi_zero3 transpeed-8k618-t x96_mate) + sun50i_h616=(orangepi_zero2 orangepi_zero2w orangepi_zero3 transpeed-8k618-t x96_mate) if [[ " ${sun50i_h616[*]} " == *" $board "* ]]; then echo "Board: $board using sun50i_h616" cp /usr/share/arm-trusted-firmware/sun50i_h616/bl31.bin builds/$(echo $board)/atf-bl31 fi - rk3328=(evb-rk3328 nanopi-r2c-plus-rk3328 nanopi-r2c-rk3328 nanopi-r2s-rk3328 orangepi-r1-plus-lts-rk3328 orangepi-r1-plus-rk3328 roc-cc-rk3328 rock64-rk3328 rock-pi-e-rk3328) + rk3328=(evb-rk3328 nanopi-r2c-plus-rk3328 nanopi-r2c-rk3328 nanopi-r2s-rk3328 orangepi-r1-plus-lts-rk3328 orangepi-r1-plus-rk3328 roc-cc-rk3328 rock64-rk3328 rock-pi-e-rk3328 rock-pi-e-v3-rk3328) if [[ " ${rk3328[*]} " == *" $board "* ]]; then echo "Board: $board using rk3328" cp /usr/share/arm-trusted-firmware/rk3328/bl31.elf builds/$(echo $board)/atf-bl31 fi - rk3399=(eaidk-610-rk3399 evb-rk3399 ficus-rk3399 firefly-rk3399 khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 leez-rk3399 nanopc-t4-rk3399 nanopi-m4-2gb-rk3399 nanopi-m4b-rk3399 nanopi-m4-rk3399 nanopi-neo4-rk3399 nanopi-r4s-rk3399 orangepi-rk3399 pinebook-pro-rk3399 pinephone-pro-rk3399 puma-rk3399 rock960-rk3399 rock-pi-4c-rk3399 rock-pi-4-rk3399 rock-pi-n10-rk3399pro rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399) + rk3368=(evb-px5 geekbox) + if [[ " ${rk3368[*]} " == *" $board "* ]]; then + echo "Board: $board using rk3368" + cp /usr/share/arm-trusted-firmware/rk3368/bl31.elf builds/$(echo $board)/atf-bl31 + fi + rk3399=(eaidk-610-rk3399 evb-rk3399 ficus-rk3399 firefly-rk3399 khadas-edge-captain-rk3399 khadas-edge-rk3399 khadas-edge-v-rk3399 leez-rk3399 nanopc-t4-rk3399 nanopi-m4-2gb-rk3399 nanopi-m4b-rk3399 nanopi-m4-rk3399 nanopi-neo4-rk3399 nanopi-r4s-rk3399 orangepi-rk3399 pinebook-pro-rk3399 pinephone-pro-rk3399 puma-rk3399 rock-4c-plus-rk3399 rock-4se-rk3399 rock960-rk3399 rock-pi-4c-rk3399 rock-pi-4-rk3399 rock-pi-n10-rk3399pro rockpro64-rk3399 roc-pc-mezzanine-rk3399 roc-pc-rk3399) if [[ " ${rk3399[*]} " == *" $board "* ]]; then echo "Board: $board using rk3399" cp /usr/share/arm-trusted-firmware/rk3399/* builds/$(echo $board)/ @@ -122,8 +136,8 @@ do fi # End ATF - BINMAN_ALLOW_MISSING=1 make $(echo $board)_defconfig O=builds/$(echo $board)/ - BINMAN_ALLOW_MISSING=1 %make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" O=builds/$(echo $board)/ + make $(echo $board)_defconfig O=builds/$(echo $board)/ + BL31=builds/$(echo $board)/atf-bl31 %make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" O=builds/$(echo $board)/ done @@ -190,6 +204,11 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Mon Sep 02 2024 Peter Robinson - 1:2024.10-0.3.rc3 +- Fix Allwinner firmware chainloading (rhbz#2309138) +- Fix ATF firmware selection on a number of devices +- Support Allwinner SCP firmware (fixes suspend/resume) + * Tue Aug 27 2024 Peter Robinson - 1:2024.10-0.2.rc3 - Update to 2024.10 RC3 - Enable initial QCM6490 SoC support From 53b4b4d5397ad2c1f8b34cc53321c10cb565cc1e Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 5 Sep 2024 20:18:57 +0100 Subject: [PATCH 046/128] 2024.10 RC4 --- sources | 2 +- uboot-tools.spec | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sources b/sources index a81cb70..3c6cf70 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.10-rc3.tar.bz2) = 3787a2b7333881c66fe1d1e5de2a83914bef9b00a584a9cbbdb791ca2f4ae0398f24acb2e8c4df8aa8a396f2c4a9005b590c928890a3bdf996ed0ed3f9a16330 +SHA512 (u-boot-2024.10-rc4.tar.bz2) = 31869a7a6c6592ffe73b2f71c4985ace8beee33b232f4e8cbb8d2ebcee9b08d7bedeb57ca7e36cbadf42df44283b0ba79e87b55b1b2f94f2cc4a01cbce747cf7 diff --git a/uboot-tools.spec b/uboot-tools.spec index 4c8fb22..195029d 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc3 +%global candidate rc4 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.10 -Release: 0.3%{?candidate:.%{candidate}}%{?dist} +Release: 0.4%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -204,6 +204,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Sep 03 2024 Peter Robinson - 1:2024.10-0.4.rc4 +- Update to 2024.10 RC4 + * Mon Sep 02 2024 Peter Robinson - 1:2024.10-0.3.rc3 - Fix Allwinner firmware chainloading (rhbz#2309138) - Fix ATF firmware selection on a number of devices From 92653178449939bea35dab846ab09ee61e8f6728 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 20 Sep 2024 09:44:17 +0100 Subject: [PATCH 047/128] Add missing licenses directory --- uboot-tools.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 195029d..02850f0 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.10 -Release: 0.4%{?candidate:.%{candidate}}%{?dist} +Release: 0.5%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -190,6 +190,7 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} ( cd %{buildroot}%{_bindir}; ln -sf fw_printenv fw_setenv ) %files +%license Licenses/* %doc README doc/develop/distro.rst doc/README.gpt %doc doc/develop/uefi doc/usage doc/arch/arm64.rst %{_bindir}/* @@ -198,12 +199,16 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %if %{with toolsonly} %ifarch aarch64 %files -n uboot-images-armv8 +%license Licenses/* %dir %{_datadir}/uboot/ %{_datadir}/uboot/* %endif %endif %changelog +* Fri Sep 20 2024 Peter Robinson - 1:2024.10-0.5.rc4 +- Add missing licenses directory + * Tue Sep 03 2024 Peter Robinson - 1:2024.10-0.4.rc4 - Update to 2024.10 RC4 From 3cce66678269ec8a7f4b7404fd8cc3a032d812c3 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 9 Sep 2024 05:42:54 +0100 Subject: [PATCH 048/128] trim changelog --- uboot-tools.spec | 386 ----------------------------------------------- 1 file changed, 386 deletions(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 02850f0..09f67c6 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -271,389 +271,3 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} * Mon Jan 08 2024 Peter Robinson - 1:2024.01-1 - Update to 2024.01 - -* Thu Dec 07 2023 Peter Robinson - 1:2024.01-0.2.rc4 -- Update to 2024.01 RC4 -- Rebase SMBIOS patch to latest rev - -* Fri Nov 24 2023 Peter Robinson - 1:2024.01-0.1.rc3 -- Update to 2024.01 RC3 - -* Tue Oct 31 2023 Peter Robinson - 1:2023.10-0.9 -- Rebuild - -* Mon Oct 23 2023 Peter Robinson - 2023.10-0.8 -- Further potential upstream fixes - -* Mon Oct 02 2023 Peter Robinson - 2023.10-0.7 -- Update to 2023.10 GA -- Some upstream fixes - -* Mon Aug 21 2023 Peter Robinson - 2023.10-0.4.rc3 -- Update to 2023.10 RC3 - -* Mon Aug 21 2023 Peter Robinson - 2023.10-0.3.rc2 -- Add patch to speed up firmware UEFI video output - -* Sat Aug 19 2023 Peter Robinson - 2023.10-0.2.rc2 -- Add patch for Raspberry Pi boot - -* Fri Aug 18 2023 Peter Robinson - 2023.10-0.1.rc2 -- Update to 2023.10 RC2 - -* Sat Jul 22 2023 Fedora Release Engineering - 2023.07-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Tue Jul 11 2023 Peter Robinson - 2023.07-1 -- Update to 2023.07 GA - -* Fri Jun 16 2023 Peter Robinson - 2023.07-0.4.rc4 -- Disable NFS by default - -* Mon Jun 12 2023 Peter Robinson - 2023.07-0.3.rc4 -- Update to 2023.07 RC4 - -* Sun Jun 11 2023 Peter Robinson - 2023.07-0.2.rc3 -- Update to 2023.07 RC3 -- Fixes for the Pinephone Pro, RockPro64 - -* Wed May 17 2023 Peter Robinson - 2023.07-0.1.rc2 -- Update to 2023.07 RC2 - -* Tue Apr 04 2023 Peter Robinson - 2023.04-1 -- Update to 2023.04 GA - -* Tue Mar 28 2023 Peter Robinson - 2023.04-0.4.rc5 -- Update to 2023.04 RC5 -- Drop upstreamed patches -- Rockchip boot fixes - -* Tue Mar 14 2023 Peter Robinson - 2023.04-0.3.rc4 -- Update to 2023.04 RC4 - -* Fri Feb 17 2023 Peter Robinson - 2023.04-0.2.rc2 -- Update to 2023.04 RC2 - -* Tue Jan 31 2023 Peter Robinson - 2023.04-0.1.rc1 -- Update to 2023.04 RC1 -- Drop bmp_logo tool - -* Sat Jan 21 2023 Fedora Release Engineering - 2023.01-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Wed Jan 18 2023 Peter Robinson - 2023.01-1 -- Update to 2023.01 GA - -* Sat Dec 31 2022 Peter Robinson - 2023.01-0.4.rc4 -- Update PinePhone Pro to latest rev - -* Tue Dec 20 2022 Peter Robinson - 2023.01-0.3.rc4 -- Update to 2023.01 RC4 - -* Mon Dec 05 2022 Peter Robinson - 2023.01-0.2.rc3 -- Update to 2023.01 RC3 - -* Thu Nov 24 2022 Peter Robinson - 2023.01-0.1.rc2 -- Update to U-Boot 2023.01 RC2 -- Update Pinephone Pro patches - -* Mon Oct 10 2022 Peter Robinson - 2022.10-1 -- Update to 2022.10 GA - -* Tue Sep 06 2022 Peter Robinson - 2022.10-0.6.rc4 -- Update SMBIOS patch - -* Tue Sep 06 2022 Peter Robinson - 2022.10-0.5.rc4 -- Update to 2022.10 RC4 -- Fix for booting Rockchip devices from NVME - -* Tue Aug 23 2022 Peter Robinson - 2022.10-0.4.rc3 -- Update to 2022.10 RC3 - -* Mon Aug 22 2022 Davide Cavalca - 2022.10-0.3.rc1 -- Install nodtb variant for Apple M1 (rhbz#2068958) - -* Tue Aug 16 2022 Peter Robinson - 2022.10-0.2.rc1 -- Fix for DT property propogation via firmware - -* Thu Jul 28 2022 Peter Robinson - 2022.10-0.1.rc1 -- Update to 2022.10 RC1 -- Enable LTO for firmware builds - -* Sat Jul 23 2022 Fedora Release Engineering - 2022.07-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Sun Jul 17 2022 Peter Robinson - 2022.07-1 -- Update to 2022.07 GA - -* Mon Jul 04 2022 Peter Robinson - 2022.07-0.6.rc6 -- Update to 2022.07 RC6 - -* Mon Jun 20 2022 Peter Robinson - 2022.07-0.5.rc5 -- Update to 2022.07 RC5 - -* Sun Jun 12 2022 Peter Robinson - 2022.07-0.4.rc4 -- Update to 2022.07 RC4 -- Some minor Rockchips device fixes - -* Wed May 25 2022 Peter Robinson - 2022.07-0.3.rc3 -- Update to 2022.07 RC3 - -* Sat May 14 2022 Peter Robinson - 2022.07-0.2.rc2 -- Update to 2022.07 RC2 - -* Tue Apr 26 2022 Peter Robinson - 2022.07-0.1.rc1 -- Update to 2022.07 RC1 - -* Mon Apr 04 2022 Peter Robinson - 2022.04-1 -- Update to 2022.04 GA - -* Mon Mar 28 2022 Peter Robinson - 2022.04-0.4.rc5 -- Update to 2022.04 RC5 - -* Tue Mar 08 2022 Peter Robinson - 2022.04-0.3.rc3 -- Update to 2022.04 RC3 -- Enable new Rockchip devices - -* Tue Feb 15 2022 Peter Robinson - 2022.04-0.2.rc2 -- Update to 2022.04 RC2 - -* Wed Feb 02 2022 Peter Robinson - 2022.04-0.1.rc1 -- Update to 2022.04 RC1 - -* Sat Jan 22 2022 Fedora Release Engineering - 2022.01-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Mon Jan 10 2022 Peter Robinson - 2022.01-1 -- Update to 2022.01 - -* Wed Jan 05 2022 Peter Robinson - 2022.01-0.3.rc4 -- Upstream fixes for PHY and UEFI - -* Mon Dec 20 2021 Peter Robinson - 2022.01-0.2.rc4 -- Update to 2022.01 RC4 - -* Mon Nov 15 2021 Peter Robinson - 2022.01-0.1.rc2 -- Update to 2022.01 RC2 - -* Mon Nov 15 2021 Peter Robinson - 2021.10-3 -- Fixes for rk3399 devices - -* Thu Oct 14 2021 Peter Robinson - 2021.10-2 -- Fix booting from MMC for Rockchip 3399 (rhbz #2014182) -- Enable new rk3399 devices (Leez, NanoPi-M4B, NanoPi-4S, NanoPi-T4) (rhbz #2009126) - -* Mon Oct 04 2021 Peter Robinson - 2021.10-1 -- Update to 2021.10 - -* Mon Sep 27 2021 Peter Robinson - 2021.10-0.7.rc5 -- Update to 2021.10 RC5 - -* Wed Sep 15 2021 Peter Robinson - 2021.10-0.6.rc4 -- Update to 2021.10 RC4 -- Proposed fix for RPi MMC clock issue - -* Tue Sep 14 2021 Sahana Prasad - 2021.10-0.6.rc3 -- Rebuilt with OpenSSL 3.0.0 - -* Mon Aug 30 2021 Peter Robinson - 2021.10-0.5.rc3 -- Update to 2021.10 RC3 - -* Tue Aug 24 2021 Peter Robinson - 2021.10-0.4.rc2 -- Fix for Raspberry Pi firmware properties - -* Mon Aug 23 2021 Peter Robinson - 2021.10-0.3.rc2 -- Fix for rockchip SPI - -* Mon Aug 16 2021 Peter Robinson - 2021.10-0.2.rc2 -- Update to 2021.10 RC2 - -* Sun Aug 08 2021 Peter Robinson - 2021.10-0.1.rc1 -- Update to 2021.10 RC1 - -* Thu Jul 22 2021 Peter Robinson - 2021.07-2 -- Fix regression for Rockchip devices running firmware from SPI flash - -* Mon Jul 05 2021 Peter Robinson - 2021.07-1 -- Update to 2021.07 GA - -* Mon Jun 28 2021 Peter Robinson - 2021.07-0.6.rc5 -- Update to 2021.07 RC5 -- Build SPI fash images for ROC-PC-RK3399 - -* Mon Jun 07 2021 Peter Robinson - 2021.07-0.5.rc4 -- Update to 2021.07 RC4 - -* Sat Jun 05 2021 Peter Robinson - 2021.07-0.4.rc3 -- Fix AllWinner devices booting from mSD/MMC - -* Tue May 25 2021 Peter Robinson - 2021.07-0.3.rc3 -- Update to 2021.07 RC3 -- Build against ATF 2.5 GA - -* Thu May 13 2021 Peter Robinson - 2021.07-0.2.rc2 -- Build against new ATF 2.5-rc1 - -* Mon May 10 2021 Peter Robinson - 2021.07-0.1.rc2 -- Update to 2021.07 RC2 - -* Wed Apr 28 2021 Peter Robinson - 2021.04-3 -- Upstream fix for console regression (rhbz 1946278) -- Fix for fallback.efi crash (rhbz 1733817) - -* Wed Apr 21 2021 Peter Robinson - 2021.04-2 -- Revert keyboard console regression change (rhbz 1946278) - -* Sun Apr 18 2021 Peter Robinson - 2021.04-1 -- Update to 2021.04 GA -- Fix DTB load check (rhbz 1946278) -- Build Rockchip SPI support as idbloader.spi -- Fixes for Rockchip devices -- Build Turris Omnia for MMC/SPI/UART - -* Wed Mar 17 2021 Peter Robinson - 2021.04-0.6.rc4 -- Update to 2021.04 RC4 -- Move to upstream fix for SMP on RPi3B and RPi3B+ - -* Sat Mar 13 2021 Peter Robinson - 2021.04-0.5.rc3 -- Fix for SMP on RPi3B and RPi3B+ -- Initial support for Pinephone 3Gb edition - -* Mon Mar 08 2021 Peter Robinson - 2021.04-0.4.rc3 -- Update to 2021.04 RC3 - -* Tue Feb 16 2021 Peter Robinson - 2021.04-0.3.rc2 -- Update to 2021.04 RC2 - -* Mon Feb 15 2021 Dennis Gilmore -- build spi and uart images in addition to mmc for helios4 and clearfog - -* Wed Feb 10 2021 Peter Robinson - 2021.04-0.2.rc1 -- Fixes for network issues on some Allwinner devices - -* Mon Feb 01 2021 Peter Robinson - 2021.04-0.1.rc1 -- Update to 2021.04 RC1 -- Add new upstream devices - -* Wed Jan 27 2021 Fedora Release Engineering - 2021.01-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Mon Jan 11 2021 Peter Robinson - 2021.01-1 -- Update to 2021.01 GA -- Updates for Raspberry Pi 4 Series of devices - -* Tue Jan 5 2021 Peter Robinson - 2021.01-0.5.rc5 -- Update to 2021.01 RC5 - -* Sun Dec 27 2020 Peter Robinson - 2021.01-0.4.rc4 -- Update to 2021.01 RC4 -- Latest RPi-400/CM4 support patch - -* Tue Dec 15 2020 Peter Robinson - 2021.01-0.3.rc3 -- Update to 2021.01 RC3 -- Latest RPi-400/CM4 support patch -- Re-enable previously disabled device support - -* Mon Dec 14 2020 Javier Martinez Canillas - 2021.01-0.2.rc2 -- Fix a "scan_dev_for_efi" not defined error - -* Sun Nov 22 2020 Peter Robinson - 2021.01-0.1.rc2 -- Update to 2021.01 RC2 -- Latest Pinebook Pro display patches -- Initial RPi-400 support patch -- Update Fedora specific patches - -* Sun Nov 8 2020 Peter Robinson - 2020.10-3 -- Fix SPI on Rockchip devices -- Latest Pinebook Pro display patches -- Fix Keyboard and USB-A ports on Pinebook Pro - -* Wed Oct 28 2020 Peter Robinson - 2020.10-2 -- Fix kernel installs for non EBBR systems -- Fix for wired networks on some Allwinner devices - -* Tue Oct 06 2020 Peter Robinson - 2020.10-1 -- Update to 2020.10 - -* Sun Sep 27 2020 Peter Robinson - 2020.10-0.6.rc5 -- Initial support for display output on Pinebook Pro - -* Tue Sep 22 2020 Peter Robinson - 2020.10-0.5.rc5 -- Update to 2020.10 RC5 - -* Wed Sep 09 2020 Peter Robinson - 2020.10-0.4.rc4 -- Update to 2020.10 RC4 - -* Wed Aug 19 2020 Peter Robinson - 2020.10-0.3.rc2 -- Enable a number of new Rockchip devices - -* Mon Aug 10 2020 Peter Robinson - 2020.10-0.2.rc2 -- Update to 2020.10 RC2 - -* Tue Jul 28 2020 Peter Robinson - 2020.10-0.1.rc1 -- 2020.10 RC1 - -* Tue Jul 14 2020 Tom Stellard - 2020.07-2 -- Use make macros -- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro - -* Mon Jul 06 2020 Peter Robinson - 2020.07-1 -- 2020.07 GA - -* Tue Jun 23 2020 Peter Robinson - 2020.07-0.5.rc5 -- 2020.07 RC5 - -* Thu Jun 18 2020 Peter Robinson - 2020.07-0.4.rc4 -- Update various patches to latest upstream - -* Wed Jun 10 2020 Peter Robinson - 2020.07-0.3.rc4 -- 2020.07 RC4 -- Minor updates and other fixes - -* Tue May 12 2020 Peter Robinson - 2020.07-0.2.rc2 -- 2020.07 RC2 -- Minor device updates - -* Wed Apr 29 2020 Peter Robinson - 2020.07-0.1.rc1 -- 2020.07 RC1 - -* Tue Apr 21 2020 Peter Robinson - 2020.04-4 -- Initial support for USB on Rasperry Pi 4 - -* Tue Apr 21 2020 Peter Robinson - 2020.04-3 -- Ship u-boot-rockchip.bin for SPI flash - -* Mon Apr 20 2020 Peter Robinson - 2020.04-2 -- Fix ATF for new aarch64 devices -- Fix Wandboard board detection (rhbz 1825247) -- Fix mSD card on RockPro64 -- Enable (inital) Pinebook Pro - -* Tue Apr 14 2020 Peter Robinson - 2020.04-1 -- 2020.04 - -* Tue Apr 7 2020 Peter Robinson 2020.04-0.7-rc5 -- 2020.04 RC5 - -* Tue Mar 31 2020 Peter Robinson 2020.04-0.6-rc4 -- 2020.04 RC4 -- Updates for NVIDIA Jetson platforms -- Support RNG for random seed for KASLR on some Rockchip devices - -* Thu Mar 26 2020 Peter Robinson 2020.04-0.5-rc3 -- Fix ext4 alignment issue seen on some NXP i.MX devices - -* Wed Feb 26 2020 Peter Robinson 2020.04-0.4-rc3 -- 2020.04 RC3 - -* Thu Feb 13 2020 Peter Robinson 2020.04-0.3-rc2 -- 2020.04 RC2 - -* Sun Feb 2 2020 Peter Robinson 2020.04-0.2-rc1 -- Update genet NIC driver - -* Wed Jan 29 2020 Peter Robinson 2020.04-0.1-rc1 -- 2020.04 RC1 - -* Tue Jan 7 2020 Peter Robinson 2020.01-1 -- 2020.01 From 09ab1870db8190fa69b72e789165433cc9571a7a Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 16 Sep 2024 22:18:24 +0100 Subject: [PATCH 049/128] 2024.10 RC5 --- FUSB302-USB-C-controller-support.patch | 6018 ++++++++++++++++++++++++ sources | 2 +- uboot-tools.spec | 10 +- 3 files changed, 6026 insertions(+), 4 deletions(-) create mode 100644 FUSB302-USB-C-controller-support.patch diff --git a/FUSB302-USB-C-controller-support.patch b/FUSB302-USB-C-controller-support.patch new file mode 100644 index 0000000..a25f8dd --- /dev/null +++ b/FUSB302-USB-C-controller-support.patch @@ -0,0 +1,6018 @@ +From patchwork Thu Sep 5 15:08:37 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sebastian Reichel +X-Patchwork-Id: 1981315 +X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com + header.a=rsa-sha256 header.s=mail header.b=VOvjn+x1; + 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 4X02zx1gZpz1yXY + for ; Fri, 6 Sep 2024 01:18:05 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id E002A88CD2; + Thu, 5 Sep 2024 17:17:16 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com + header.b="VOvjn+x1"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 9ED9788CD2; Thu, 5 Sep 2024 17:17:16 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from bali.collaboradmins.com (bali.collaboradmins.com + [IPv6:2a01:4f8:201:9162::2]) + (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 8F95B88CC0 + for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sebastian.reichel@collabora.com +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; + s=mail; t=1725549428; + bh=GUi0ELUr54qxRL+zUYIh2cpnf8aAbxP3km5z9ihBLiA=; + h=From:To:Cc:Subject:Date:In-Reply-To:References:From; + b=VOvjn+x1YAGL8uuX8oe/eA1AShGOQ+65YCdPN4UIul65K52PZGC4Rh30foWYR3GYv + ksyxZc+jsHQcN72mVdV3njT/SIGekJFu683r6aomMjm3Mrc+uUUF7QcQdx2QgObWXW + 3RmaT4So9PLApr20wdqN8mqL3PND0cpUJiGoZG18Nu+sX+XJYGTtQ3qo+p00ZjT6TY + TXhYMaIJeqISS7ocTqHwKpWZQ/5uXBBLOuLnlKRVhjHEVg6Ds0DFB8/XFwU24CB0VM + Xutwxqot6qKBLUt/yDrX8upercY5M0tia9Ymno4ezs/mVrRI6ztNPgNmjPUzaBq/T2 + 9q+TUcwqV3v1A== +Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de + [91.248.189.231]) + (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) (Authenticated sender: sre) + by bali.collaboradmins.com (Postfix) with ESMTPSA id EC7AC17E1167; + Thu, 5 Sep 2024 17:17:07 +0200 (CEST) +Received: by jupiter.universe (Postfix, from userid 1000) + id 9F52C4800EB; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) +From: Sebastian Reichel +To: Marek Vasut , u-boot@lists.denx.de, + Jonas Karlman , Soeren Moch +Cc: Eugen Hristev , + Tim Harvey , Kever Yang , + Philipp Tomsich , Simon Glass , + Sebastian Reichel +Subject: [PATCH v6 1/6] usb: tcpm: add core framework +Date: Thu, 5 Sep 2024 17:08:37 +0200 +Message-ID: <20240905151707.59101-2-sebastian.reichel@collabora.com> +X-Mailer: git-send-email 2.45.2 +In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> +References: <20240905151707.59101-1-sebastian.reichel@collabora.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 + +This adds TCPM framework in preparation for fusb302 support, which can +handle USB power delivery messages. This is needed to solve issues with +devices, that are running from a USB-C port supporting USB-PD, but not +having a battery. + +Such a device currently boots to the kernel without interacting with +the power-supply at all. If there are no USB-PD message replies within +5 seconds, the power-supply assumes the peripheral is not capable of +USB-PD. It usually takes more than 5 seconds for the system to reach +the kernel and probe the I2C based fusb302 chip driver. Thus the +system always runs into this state. The power-supply's solution to +fix this error state is a hard reset, which involves removing the +power from VBUS. Boards without a battery (or huge capacitors) will +reset at this point resulting in a boot loop. + +This imports the TCPM framework from the kernel. The porting has +originally been done by Rockchip using hardware timers and the Linux +kernel's TCPM code from some years ago. + +I had a look at upgrading to the latest TCPM kernel code, but that +beast became a lot more complex due to adding more USB-C features. +I believe these features are not needed in U-Boot and with multiple +kthreads and hrtimers being involved it is non-trivial to port them. +Instead I worked on stripping down features from the Rockchip port +to an even more basic level. Also the TCPM code has been reworked +to avoid complete use of any timers (Rockchip used SoC specific +hardware timers + IRQ to implement delayed work mechanism). Instead +the delayed state changes are handled directly from the poll loop. + +Note, that (in contrast to the original Rockchip port) the state +machine has the same hard reset quirk, that the kernel has - i.e. +it avoids disabling the CC pin resistors for devices that are not +self-powered. Without that quirk, the Radxa Rock 5B will not just +end up doing a machine reset when a hard reset is triggered, but will +not even recover, because the CPU will loose power and the FUSB302 +will keep this state because of leak voltage arriving through the RX +serial pin (assuming a serial adapter is connected). + +This also includes a 'tcpm' command, which can be used to get +information about the current state and the negotiated voltage +and current. + +Co-developed-by: Wang Jie +Signed-off-by: Wang Jie +Tested-by: Soeren Moch +Signed-off-by: Sebastian Reichel +--- + Makefile | 1 + + cmd/Kconfig | 7 + + cmd/Makefile | 1 + + cmd/tcpm.c | 136 ++ + doc/usage/cmd/tcpm.rst | 66 + + doc/usage/index.rst | 1 + + drivers/usb/Kconfig | 2 + + drivers/usb/tcpm/Kconfig | 8 + + drivers/usb/tcpm/Makefile | 3 + + drivers/usb/tcpm/tcpm-internal.h | 173 +++ + drivers/usb/tcpm/tcpm-uclass.c | 149 ++ + drivers/usb/tcpm/tcpm.c | 2288 ++++++++++++++++++++++++++++++ + include/dm/uclass-id.h | 1 + + include/usb/pd.h | 516 +++++++ + include/usb/tcpm.h | 99 ++ + 15 files changed, 3451 insertions(+) + create mode 100644 cmd/tcpm.c + create mode 100644 doc/usage/cmd/tcpm.rst + create mode 100644 drivers/usb/tcpm/Kconfig + create mode 100644 drivers/usb/tcpm/Makefile + create mode 100644 drivers/usb/tcpm/tcpm-internal.h + create mode 100644 drivers/usb/tcpm/tcpm-uclass.c + create mode 100644 drivers/usb/tcpm/tcpm.c + create mode 100644 include/usb/pd.h + create mode 100644 include/usb/tcpm.h + +diff --git a/Makefile b/Makefile +index 74df5d177c1f..5a581199c170 100644 +--- a/Makefile ++++ b/Makefile +@@ -879,6 +879,7 @@ libs-y += drivers/usb/musb/ + libs-y += drivers/usb/musb-new/ + libs-y += drivers/usb/isp1760/ + libs-y += drivers/usb/phy/ ++libs-y += drivers/usb/tcpm/ + libs-y += drivers/usb/ulpi/ + ifdef CONFIG_POST + libs-y += post/ +diff --git a/cmd/Kconfig b/cmd/Kconfig +index 978f44eda426..7710bee22ace 100644 +--- a/cmd/Kconfig ++++ b/cmd/Kconfig +@@ -221,6 +221,13 @@ config CMD_REGINFO + help + Register dump + ++config CMD_TCPM ++ bool "tcpm" ++ depends on TYPEC_TCPM ++ help ++ Show voltage and current negotiated via USB PD as well as the ++ current state of the Type C Port Manager (TCPM) state machine. ++ + config CMD_TLV_EEPROM + bool "tlv_eeprom" + depends on I2C_EEPROM +diff --git a/cmd/Makefile b/cmd/Makefile +index 87133cc27a8a..bd0b23ef1013 100644 +--- a/cmd/Makefile ++++ b/cmd/Makefile +@@ -172,6 +172,7 @@ obj-$(CONFIG_CMD_SMBIOS) += smbios.o + obj-$(CONFIG_CMD_SMC) += smccc.o + obj-$(CONFIG_CMD_SYSBOOT) += sysboot.o + obj-$(CONFIG_CMD_STACKPROTECTOR_TEST) += stackprot_test.o ++obj-$(CONFIG_CMD_TCPM) += tcpm.o + obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o + obj-$(CONFIG_CMD_TERMINAL) += terminal.o + obj-$(CONFIG_CMD_TIME) += time.o +diff --git a/cmd/tcpm.c b/cmd/tcpm.c +new file mode 100644 +index 000000000000..962cd234a869 +--- /dev/null ++++ b/cmd/tcpm.c +@@ -0,0 +1,136 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * (C) Copyright 2024 Collabora ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++ ++#define LIMIT_DEV 32 ++#define LIMIT_PARENT 20 ++ ++static struct udevice *currdev; ++ ++static int do_dev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) ++{ ++ char *name; ++ int ret = -ENODEV; ++ ++ switch (argc) { ++ case 2: ++ name = argv[1]; ++ ret = tcpm_get(name, &currdev); ++ if (ret) { ++ log_err("Can't get TCPM %s: %d (%s)!\n", name, ret, errno_str(ret)); ++ return CMD_RET_FAILURE; ++ } ++ case 1: ++ if (!currdev) { ++ log_err("TCPM device is not set!\n\n"); ++ return CMD_RET_USAGE; ++ } ++ ++ printf("dev: %d @ %s\n", dev_seq(currdev), currdev->name); ++ } ++ ++ return CMD_RET_SUCCESS; ++} ++ ++static int do_list(struct cmd_tbl *cmdtp, int flag, int argc, ++ char *const argv[]) ++{ ++ struct udevice *dev; ++ int ret, err = 0; ++ ++ printf("| %-*.*s| %-*.*s| %s @ %s\n", ++ LIMIT_DEV, LIMIT_DEV, "Name", ++ LIMIT_PARENT, LIMIT_PARENT, "Parent name", ++ "Parent uclass", "seq"); ++ ++ for (ret = uclass_first_device_check(UCLASS_TCPM, &dev); dev; ++ ret = uclass_next_device_check(&dev)) { ++ if (ret) ++ err = ret; ++ ++ printf("| %-*.*s| %-*.*s| %s @ %d | status: %i\n", ++ LIMIT_DEV, LIMIT_DEV, dev->name, ++ LIMIT_PARENT, LIMIT_PARENT, dev->parent->name, ++ dev_get_uclass_name(dev->parent), dev_seq(dev->parent), ++ ret); ++ } ++ ++ if (err) ++ return CMD_RET_FAILURE; ++ ++ return CMD_RET_SUCCESS; ++} ++ ++int do_print_info(struct udevice *dev) ++{ ++ enum typec_orientation orientation = tcpm_get_orientation(dev); ++ const char *state = tcpm_get_state(dev); ++ int pd_rev = tcpm_get_pd_rev(dev); ++ int mv = tcpm_get_voltage(dev); ++ int ma = tcpm_get_current(dev); ++ enum typec_role pwr_role = tcpm_get_pwr_role(dev); ++ enum typec_data_role data_role = tcpm_get_data_role(dev); ++ bool connected = tcpm_is_connected(dev); ++ ++ if (!connected) { ++ printf("TCPM State: %s\n", state); ++ return 0; ++ } ++ ++ printf("Orientation: %s\n", typec_orientation_name[orientation]); ++ printf("PD Revision: %s\n", typec_pd_rev_name[pd_rev]); ++ printf("Power Role: %s\n", typec_role_name[pwr_role]); ++ printf("Data Role: %s\n", typec_data_role_name[data_role]); ++ printf("Voltage: %2d.%03d V\n", mv / 1000, mv % 1000); ++ printf("Current: %2d.%03d A\n", ma / 1000, ma % 1000); ++ ++ return 0; ++} ++ ++static int do_info(struct cmd_tbl *cmdtp, int flag, int argc, ++ char *const argv[]) ++{ ++ if (!currdev) { ++ printf("First, set the TCPM device!\n"); ++ return CMD_RET_USAGE; ++ } ++ ++ return do_print_info(currdev); ++} ++ ++static struct cmd_tbl subcmd[] = { ++ U_BOOT_CMD_MKENT(dev, 2, 1, do_dev, "", ""), ++ U_BOOT_CMD_MKENT(list, 1, 1, do_list, "", ""), ++ U_BOOT_CMD_MKENT(info, 1, 1, do_info, "", ""), ++}; ++ ++static int do_tcpm(struct cmd_tbl *cmdtp, int flag, int argc, ++ char *const argv[]) ++{ ++ struct cmd_tbl *cmd; ++ ++ argc--; ++ argv++; ++ ++ cmd = find_cmd_tbl(argv[0], subcmd, ARRAY_SIZE(subcmd)); ++ if (!cmd || argc > cmd->maxargs) ++ return CMD_RET_USAGE; ++ ++ return cmd->cmd(cmdtp, flag, argc, argv); ++} ++ ++ /**************************************************/ ++ ++U_BOOT_CMD(tcpm, CONFIG_SYS_MAXARGS, 1, do_tcpm, ++ "TCPM sub-system", ++ "list - list TCPM devices\n" ++ "tcpm dev [name] - show or [set] operating TCPM device\n" ++ "tcpm info - dump information\n" ++); +diff --git a/doc/usage/cmd/tcpm.rst b/doc/usage/cmd/tcpm.rst +new file mode 100644 +index 000000000000..1e8199c0f89c +--- /dev/null ++++ b/doc/usage/cmd/tcpm.rst +@@ -0,0 +1,66 @@ ++.. SPDX-License-Identifier: GPL-2.0+: ++ ++.. index:: ++ single: tcpm (command) ++ ++tcpm command ++============ ++ ++Synopsis ++-------- ++ ++:: ++ ++ tcpm dev [devname] ++ tcpm info ++ tcpm list ++ ++Description ++----------- ++ ++The tcpm command is used to control USB-PD controllers, also known as TypeC Port Manager (TCPM). ++ ++The 'tcpm dev' command shows or set current TCPM device. ++ ++ devname ++ device name to change ++ ++The 'tcpm info' command displays the current state of the device ++ ++The 'tcpm list' command displays the list available devices. ++ ++Examples ++-------- ++ ++The 'tcpm info' command displays device's status: ++:: ++ ++ => tcpm info ++ Orientation: normal ++ PD Revision: rev3 ++ Power Role: sink ++ Data Role: device ++ Voltage: 20.000 V ++ Current: 2.250 A ++ ++The current device can be shown or set via 'tcpm dev' command: ++:: ++ ++ => tcpm dev ++ TCPM device is not set! ++ => tcpm dev usb-typec@22 ++ dev: 0 @ usb-typec@22 ++ => tcpm dev ++ dev: 0 @ usb-typec@22 ++ ++The list of available devices can be shown via 'tcpm list' command: ++:: ++ ++ => tcpm list ++ | Name | Parent name | Parent uclass @ seq ++ | usb-typec@22 | i2c@feac0000 | i2c @ 4 | status: 0 ++ ++Configuration ++------------- ++ ++The tcpm command is only available if CONFIG_CMD_TCPM=y. +diff --git a/doc/usage/index.rst b/doc/usage/index.rst +index 6a218c46b4e4..b4be42f59119 100644 +--- a/doc/usage/index.rst ++++ b/doc/usage/index.rst +@@ -111,6 +111,7 @@ Shell commands + cmd/smbios + cmd/sound + cmd/source ++ cmd/tcpm + cmd/temperature + cmd/tftpput + cmd/trace +diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig +index a972d87c7ad4..985d3a9ef7e6 100644 +--- a/drivers/usb/Kconfig ++++ b/drivers/usb/Kconfig +@@ -85,6 +85,8 @@ source "drivers/usb/emul/Kconfig" + + source "drivers/usb/phy/Kconfig" + ++source "drivers/usb/tcpm/Kconfig" ++ + source "drivers/usb/ulpi/Kconfig" + + if USB_HOST +diff --git a/drivers/usb/tcpm/Kconfig b/drivers/usb/tcpm/Kconfig +new file mode 100644 +index 000000000000..55bf8e202b90 +--- /dev/null ++++ b/drivers/usb/tcpm/Kconfig +@@ -0,0 +1,8 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++config TYPEC_TCPM ++ tristate "USB Type-C Port Controller Manager" ++ depends on DM ++ help ++ The Type-C Port Controller Manager provides a USB PD and USB Type-C ++ state machine for use with Type-C Port Controllers. +diff --git a/drivers/usb/tcpm/Makefile b/drivers/usb/tcpm/Makefile +new file mode 100644 +index 000000000000..a0f76436f3fd +--- /dev/null ++++ b/drivers/usb/tcpm/Makefile +@@ -0,0 +1,3 @@ ++# SPDX-License-Identifier: GPL-2.0 ++ ++obj-$(CONFIG_TYPEC_TCPM) += tcpm.o tcpm-uclass.o +diff --git a/drivers/usb/tcpm/tcpm-internal.h b/drivers/usb/tcpm/tcpm-internal.h +new file mode 100644 +index 000000000000..561442090027 +--- /dev/null ++++ b/drivers/usb/tcpm/tcpm-internal.h +@@ -0,0 +1,173 @@ ++/* SPDX-License-Identifier: GPL-2.0-or-later */ ++/* ++ * Copyright 2015-2017 Google, Inc ++ * Copyright 2024 Collabora ++ */ ++ ++#ifndef __LINUX_USB_TCPM_INTERNAL_H ++#define __LINUX_USB_TCPM_INTERNAL_H ++ ++#define FOREACH_TCPM_STATE(S) \ ++ S(INVALID_STATE), \ ++ S(TOGGLING), \ ++ S(SRC_UNATTACHED), \ ++ S(SRC_ATTACH_WAIT), \ ++ S(SRC_ATTACHED), \ ++ S(SRC_STARTUP), \ ++ S(SRC_SEND_CAPABILITIES), \ ++ S(SRC_SEND_CAPABILITIES_TIMEOUT), \ ++ S(SRC_NEGOTIATE_CAPABILITIES), \ ++ S(SRC_TRANSITION_SUPPLY), \ ++ S(SRC_READY), \ ++ S(SRC_WAIT_NEW_CAPABILITIES), \ ++ \ ++ S(SNK_UNATTACHED), \ ++ S(SNK_ATTACH_WAIT), \ ++ S(SNK_DEBOUNCED), \ ++ S(SNK_ATTACHED), \ ++ S(SNK_STARTUP), \ ++ S(SNK_DISCOVERY), \ ++ S(SNK_DISCOVERY_DEBOUNCE), \ ++ S(SNK_DISCOVERY_DEBOUNCE_DONE), \ ++ S(SNK_WAIT_CAPABILITIES), \ ++ S(SNK_NEGOTIATE_CAPABILITIES), \ ++ S(SNK_TRANSITION_SINK), \ ++ S(SNK_TRANSITION_SINK_VBUS), \ ++ S(SNK_READY), \ ++ \ ++ S(HARD_RESET_SEND), \ ++ S(HARD_RESET_START), \ ++ S(SRC_HARD_RESET_VBUS_OFF), \ ++ S(SRC_HARD_RESET_VBUS_ON), \ ++ S(SNK_HARD_RESET_SINK_OFF), \ ++ S(SNK_HARD_RESET_WAIT_VBUS), \ ++ S(SNK_HARD_RESET_SINK_ON), \ ++ \ ++ S(SOFT_RESET), \ ++ S(SOFT_RESET_SEND), \ ++ \ ++ S(DR_SWAP_ACCEPT), \ ++ S(DR_SWAP_CHANGE_DR), \ ++ \ ++ S(ERROR_RECOVERY), \ ++ S(PORT_RESET), \ ++ S(PORT_RESET_WAIT_OFF) ++ ++#define GENERATE_TCPM_ENUM(e) e ++#define GENERATE_TCPM_STRING(s) #s ++#define TCPM_POLL_EVENT_TIME_OUT 2000 ++ ++enum tcpm_state { ++ FOREACH_TCPM_STATE(GENERATE_TCPM_ENUM) ++}; ++ ++enum pd_msg_request { ++ PD_MSG_NONE = 0, ++ PD_MSG_CTRL_REJECT, ++ PD_MSG_CTRL_WAIT, ++ PD_MSG_CTRL_NOT_SUPP, ++ PD_MSG_DATA_SINK_CAP, ++ PD_MSG_DATA_SOURCE_CAP, ++}; ++ ++struct tcpm_port { ++ enum typec_port_type typec_type; ++ int typec_prefer_role; ++ ++ enum typec_role vconn_role; ++ enum typec_role pwr_role; ++ enum typec_data_role data_role; ++ ++ struct typec_partner *partner; ++ ++ enum typec_cc_status cc_req; ++ enum typec_cc_status cc1; ++ enum typec_cc_status cc2; ++ enum typec_cc_polarity polarity; ++ ++ bool attached; ++ bool connected; ++ int poll_event_cnt; ++ enum typec_port_type port_type; ++ ++ /* ++ * Set to true when vbus is greater than VSAFE5V min. ++ * Set to false when vbus falls below vSinkDisconnect max threshold. ++ */ ++ bool vbus_present; ++ ++ /* ++ * Set to true when vbus is less than VSAFE0V max. ++ * Set to false when vbus is greater than VSAFE0V max. ++ */ ++ bool vbus_vsafe0v; ++ ++ bool vbus_never_low; ++ bool vbus_source; ++ bool vbus_charge; ++ ++ int try_role; ++ ++ enum pd_msg_request queued_message; ++ ++ enum tcpm_state enter_state; ++ enum tcpm_state prev_state; ++ enum tcpm_state state; ++ enum tcpm_state delayed_state; ++ unsigned long delay_ms; ++ ++ bool state_machine_running; ++ ++ bool tx_complete; ++ enum tcpm_transmit_status tx_status; ++ ++ unsigned int negotiated_rev; ++ unsigned int message_id; ++ unsigned int caps_count; ++ unsigned int hard_reset_count; ++ bool pd_capable; ++ bool explicit_contract; ++ unsigned int rx_msgid; ++ ++ /* Partner capabilities/requests */ ++ u32 sink_request; ++ u32 source_caps[PDO_MAX_OBJECTS]; ++ unsigned int nr_source_caps; ++ u32 sink_caps[PDO_MAX_OBJECTS]; ++ unsigned int nr_sink_caps; ++ ++ /* ++ * whether to wait for the Type-C device to send the DR_SWAP Message flag ++ * For Type-C device with Dual-Role Power and Dual-Role Data, the port side ++ * is used as sink + ufp, then the tcpm framework needs to wait for Type-C ++ * device to initiate DR_swap Message. ++ */ ++ bool wait_dr_swap_message; ++ ++ /* Local capabilities */ ++ u32 src_pdo[PDO_MAX_OBJECTS]; ++ unsigned int nr_src_pdo; ++ u32 snk_pdo[PDO_MAX_OBJECTS]; ++ unsigned int nr_snk_pdo; ++ ++ unsigned int operating_snk_mw; ++ bool update_sink_caps; ++ ++ /* Requested current / voltage to the port partner */ ++ u32 req_current_limit; ++ u32 req_supply_voltage; ++ /* Actual current / voltage limit of the local port */ ++ u32 current_limit; ++ u32 supply_voltage; ++ ++ /* port belongs to a self powered device */ ++ bool self_powered; ++ ++ unsigned long delay_target; ++}; ++ ++extern const char * const tcpm_states[]; ++ ++int tcpm_post_probe(struct udevice *dev); ++ ++#endif +diff --git a/drivers/usb/tcpm/tcpm-uclass.c b/drivers/usb/tcpm/tcpm-uclass.c +new file mode 100644 +index 000000000000..92f9eff1ada6 +--- /dev/null ++++ b/drivers/usb/tcpm/tcpm-uclass.c +@@ -0,0 +1,149 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright 2024 Collabora Ltd. ++ * ++ * USB Power Delivery protocol stack. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include "tcpm-internal.h" ++ ++int tcpm_get_voltage(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ return port->supply_voltage; ++} ++ ++int tcpm_get_current(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ return port->current_limit; ++} ++ ++enum typec_orientation tcpm_get_orientation(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ switch (port->polarity) { ++ case TYPEC_POLARITY_CC1: ++ return TYPEC_ORIENTATION_NORMAL; ++ case TYPEC_POLARITY_CC2: ++ return TYPEC_ORIENTATION_REVERSE; ++ default: ++ return TYPEC_ORIENTATION_NONE; ++ } ++} ++ ++const char *tcpm_get_state(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ return tcpm_states[port->state]; ++} ++ ++int tcpm_get_pd_rev(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ return port->negotiated_rev; ++} ++ ++enum typec_role tcpm_get_pwr_role(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ return port->pwr_role; ++} ++ ++enum typec_data_role tcpm_get_data_role(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ return port->data_role; ++} ++ ++bool tcpm_is_connected(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ return port->connected; ++} ++ ++int tcpm_get(const char *name, struct udevice **devp) ++{ ++ return uclass_get_device_by_name(UCLASS_TCPM, name, devp); ++} ++ ++static int tcpm_post_bind(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ const char *cap_str; ++ ofnode node; ++ int ret; ++ ++ /* ++ * USB Power Delivery (USB PD) specification requires, that communication ++ * with a sink happens within roughly 5 seconds. Otherwise the source ++ * might assume that the sink does not support USB PD. Starting to do ++ * USB PD communication after that results in a hard reset, which briefly ++ * removes any power from the USB-C port. ++ * ++ * On systems with alternative power supplies this is not an issue, but ++ * systems, which get soleley powered through their USB-C port will end ++ * up losing their power supply and doing a board level reset. The hard ++ * reset will also restart the 5 second timeout. That means a operating ++ * system initializing USB PD will put the system into a boot loop when ++ * it takes more than 5 seconds from cold boot to the operating system ++ * starting to transmit USB PD messages. ++ * ++ * The issue can be avoided by doing the initial USB PD communication ++ * in U-Boot. The operating system can then re-negotiate by doing a ++ * soft reset, which does not trigger removal of the supply voltage. ++ * ++ * Since the TCPM state machine is quite complex and depending on the ++ * remote side can take quite some time to finish, this tries to limit ++ * the automatic probing to systems probably relying on power being ++ * provided by the USB-C port(s): ++ * ++ * 1. self-powered devices won't reset when the USB-C port looses power ++ * 2. if the power is allowed to go into anything else than sink mode ++ * it is not the only power source ++ */ ++ ret = drvops->get_connector_node(dev, &node); ++ if (ret) ++ return ret; ++ ++ if (ofnode_read_bool(node, "self-powered")) ++ return 0; ++ ++ cap_str = ofnode_read_string(node, "power-role"); ++ if (!cap_str) ++ return -EINVAL; ++ ++ if (strcmp("sink", cap_str)) ++ return 0; ++ ++ /* Do not auto-probe PD controller when PD is disabled */ ++ if (ofnode_read_bool(node, "pd-disable")) ++ return 0; ++ ++ dev_info(dev, "probing Type-C port manager..."); ++ ++ dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND); ++ ++ return 0; ++} ++ ++UCLASS_DRIVER(tcpm) = { ++ .id = UCLASS_TCPM, ++ .name = "tcpm", ++ .per_device_plat_auto = sizeof(struct tcpm_port), ++ .post_bind = tcpm_post_bind, ++ .post_probe = tcpm_post_probe, ++}; +diff --git a/drivers/usb/tcpm/tcpm.c b/drivers/usb/tcpm/tcpm.c +new file mode 100644 +index 000000000000..0aee57cb2f4a +--- /dev/null ++++ b/drivers/usb/tcpm/tcpm.c +@@ -0,0 +1,2288 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright 2015-2017 Google, Inc ++ * ++ * USB Power Delivery protocol stack. ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "tcpm-internal.h" ++ ++DECLARE_GLOBAL_DATA_PTR; ++ ++const char * const tcpm_states[] = { ++ FOREACH_TCPM_STATE(GENERATE_TCPM_STRING) ++}; ++ ++const char * const typec_pd_rev_name[] = { ++ [PD_REV10] = "rev1", ++ [PD_REV20] = "rev2", ++ [PD_REV30] = "rev3", ++}; ++ ++const char * const typec_role_name[] = { ++ [TYPEC_SINK] = "sink", ++ [TYPEC_SOURCE] = "source", ++}; ++ ++const char * const typec_data_role_name[] = { ++ [TYPEC_DEVICE] = "device", ++ [TYPEC_HOST] = "host", ++}; ++ ++const char * const typec_orientation_name[] = { ++ [TYPEC_ORIENTATION_NONE] = "none", ++ [TYPEC_ORIENTATION_NORMAL] = "normal", ++ [TYPEC_ORIENTATION_REVERSE] = "reverse", ++}; ++ ++const char * const typec_cc_status_name[] = { ++ [TYPEC_CC_OPEN] = "open", ++ [TYPEC_CC_RA] = "ra", ++ [TYPEC_CC_RD] = "rd", ++ [TYPEC_CC_RP_DEF] = "rp-def", ++ [TYPEC_CC_RP_1_5] = "rp-1.5", ++ [TYPEC_CC_RP_3_0] = "rp-3.0", ++}; ++ ++static inline bool tcpm_cc_is_sink(enum typec_cc_status cc) ++{ ++ return cc == TYPEC_CC_RP_DEF || ++ cc == TYPEC_CC_RP_1_5 || ++ cc == TYPEC_CC_RP_3_0; ++} ++ ++static inline bool tcpm_port_is_sink(struct tcpm_port *port) ++{ ++ bool cc1_is_snk = tcpm_cc_is_sink(port->cc1); ++ bool cc2_is_snk = tcpm_cc_is_sink(port->cc2); ++ ++ return (cc1_is_snk && !cc2_is_snk) || ++ (cc2_is_snk && !cc1_is_snk); ++} ++ ++static inline bool tcpm_cc_is_source(enum typec_cc_status cc) ++{ ++ return cc == TYPEC_CC_RD; ++} ++ ++static inline bool tcpm_port_is_source(struct tcpm_port *port) ++{ ++ bool cc1_is_src = tcpm_cc_is_source(port->cc1); ++ bool cc2_is_src = tcpm_cc_is_source(port->cc2); ++ ++ return (cc1_is_src && !cc2_is_src) || ++ (cc2_is_src && !cc1_is_src); ++} ++ ++static inline bool tcpm_try_src(struct tcpm_port *port) ++{ ++ return port->try_role == TYPEC_SOURCE && ++ port->port_type == TYPEC_PORT_DRP; ++} ++ ++static inline void tcpm_reset_event_cnt(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ port->poll_event_cnt = 0; ++} ++ ++static enum tcpm_state tcpm_default_state(struct tcpm_port *port) ++{ ++ if (port->port_type == TYPEC_PORT_DRP) { ++ if (port->try_role == TYPEC_SINK) ++ return SNK_UNATTACHED; ++ else if (port->try_role == TYPEC_SOURCE) ++ return SRC_UNATTACHED; ++ } else if (port->port_type == TYPEC_PORT_SNK) { ++ return SNK_UNATTACHED; ++ } ++ return SRC_UNATTACHED; ++} ++ ++static bool tcpm_port_is_disconnected(struct tcpm_port *port) ++{ ++ return (!port->attached && port->cc1 == TYPEC_CC_OPEN && ++ port->cc2 == TYPEC_CC_OPEN) || ++ (port->attached && ((port->polarity == TYPEC_POLARITY_CC1 && ++ port->cc1 == TYPEC_CC_OPEN) || ++ (port->polarity == TYPEC_POLARITY_CC2 && ++ port->cc2 == TYPEC_CC_OPEN))); ++} ++ ++static void tcpm_set_cc(struct udevice *dev, enum typec_cc_status cc) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ dev_dbg(dev, "TCPM: set cc = %d\n", cc); ++ port->cc_req = cc; ++ drvops->set_cc(dev, cc); ++} ++ ++/* ++ * Determine RP value to set based on maximum current supported ++ * by a port if configured as source. ++ * Returns CC value to report to link partner. ++ */ ++static enum typec_cc_status tcpm_rp_cc(struct tcpm_port *port) ++{ ++ const u32 *src_pdo = port->src_pdo; ++ int nr_pdo = port->nr_src_pdo; ++ int i; ++ ++ /* ++ * Search for first entry with matching voltage. ++ * It should report the maximum supported current. ++ */ ++ for (i = 0; i < nr_pdo; i++) { ++ const u32 pdo = src_pdo[i]; ++ ++ if (pdo_type(pdo) == PDO_TYPE_FIXED && ++ pdo_fixed_voltage(pdo) == 5000) { ++ unsigned int curr = pdo_max_current(pdo); ++ ++ if (curr >= 3000) ++ return TYPEC_CC_RP_3_0; ++ else if (curr >= 1500) ++ return TYPEC_CC_RP_1_5; ++ return TYPEC_CC_RP_DEF; ++ } ++ } ++ ++ return TYPEC_CC_RP_DEF; ++} ++ ++static void tcpm_check_and_run_delayed_work(struct udevice *dev); ++ ++static bool tcpm_transmit_helper(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ drvops->poll_event(dev); ++ udelay(500); ++ tcpm_check_and_run_delayed_work(dev); ++ return port->tx_complete; ++} ++ ++static int tcpm_pd_transmit(struct udevice *dev, ++ enum tcpm_transmit_type type, ++ const struct pd_message *msg) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ u32 timeout_us = PD_T_TCPC_TX_TIMEOUT * 1000; ++ bool tx_complete; ++ int ret; ++ ++ if (msg) ++ dev_dbg(dev, "TCPM: PD TX, header: %#x\n", ++ le16_to_cpu(msg->header)); ++ else ++ dev_dbg(dev, "TCPM: PD TX, type: %#x\n", type); ++ ++ port->tx_complete = false; ++ ret = drvops->pd_transmit(dev, type, msg, port->negotiated_rev); ++ if (ret < 0) ++ return ret; ++ ++ /* ++ * At this point we basically need to block until the TCPM controller ++ * returns successful transmission. Since this is usually done using ++ * the generic interrupt status bits, we poll for any events. That ++ * will clear the interrupt status, so we also need to process any ++ * of the incoming events. This means we will do more processing and ++ * thus let's give everything a bit more time. ++ */ ++ timeout_us *= 5; ++ ret = read_poll_timeout(tcpm_transmit_helper, tx_complete, ++ !tx_complete, false, timeout_us, dev); ++ if (ret < 0) { ++ dev_err(dev, "TCPM: PD transmit data failed: %d\n", ret); ++ return ret; ++ } ++ ++ switch (port->tx_status) { ++ case TCPC_TX_SUCCESS: ++ port->message_id = (port->message_id + 1) & PD_HEADER_ID_MASK; ++ break; ++ case TCPC_TX_DISCARDED: ++ ret = -EAGAIN; ++ break; ++ case TCPC_TX_FAILED: ++ default: ++ ret = -EIO; ++ break; ++ } ++ ++ return ret; ++} ++ ++void tcpm_pd_transmit_complete(struct udevice *dev, ++ enum tcpm_transmit_status status) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ dev_dbg(dev, "TCPM: PD TX complete, status: %u\n", status); ++ tcpm_reset_event_cnt(dev); ++ port->tx_status = status; ++ port->tx_complete = true; ++} ++ ++static int tcpm_set_polarity(struct udevice *dev, ++ enum typec_cc_polarity polarity) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ int ret; ++ ++ dev_dbg(dev, "TCPM: set polarity = %d\n", polarity); ++ ++ if (drvops->set_polarity) { ++ ret = drvops->set_polarity(dev, polarity); ++ if (ret < 0) ++ return ret; ++ } ++ ++ port->polarity = polarity; ++ ++ return 0; ++} ++ ++static int tcpm_set_vconn(struct udevice *dev, bool enable) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret; ++ ++ dev_dbg(dev, "TCPM: set vconn = %d\n", enable); ++ ++ ret = drvops->set_vconn(dev, enable); ++ if (!ret) ++ port->vconn_role = enable ? TYPEC_SOURCE : TYPEC_SINK; ++ ++ return ret; ++} ++ ++static inline u32 tcpm_get_current_limit(struct tcpm_port *port) ++{ ++ switch (port->polarity ? port->cc2 : port->cc1) { ++ case TYPEC_CC_RP_1_5: ++ return 1500; ++ case TYPEC_CC_RP_3_0: ++ return 3000; ++ case TYPEC_CC_RP_DEF: ++ default: ++ return 0; ++ } ++} ++ ++static int tcpm_set_current_limit(struct udevice *dev, u32 max_ma, u32 mv) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret = -EOPNOTSUPP; ++ ++ dev_info(dev, "TCPM: set voltage limit = %u mV\n", mv); ++ dev_info(dev, "TCPM: set current limit = %u mA\n", max_ma); ++ ++ port->supply_voltage = mv; ++ port->current_limit = max_ma; ++ ++ return ret; ++} ++ ++static int tcpm_set_attached_state(struct udevice *dev, bool attached) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ return drvops->set_roles(dev, attached, port->pwr_role, ++ port->data_role); ++} ++ ++static int tcpm_set_roles(struct udevice *dev, bool attached, ++ enum typec_role role, enum typec_data_role data) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret; ++ ++ ret = drvops->set_roles(dev, attached, role, data); ++ if (ret < 0) ++ return ret; ++ ++ port->pwr_role = role; ++ port->data_role = data; ++ ++ return 0; ++} ++ ++static int tcpm_pd_send_source_caps(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ struct pd_message msg; ++ int i; ++ ++ memset(&msg, 0, sizeof(msg)); ++ ++ if (!port->nr_src_pdo) { ++ /* No source capabilities defined, sink only */ ++ msg.header = PD_HEADER_LE(PD_CTRL_REJECT, ++ port->pwr_role, ++ port->data_role, ++ port->negotiated_rev, ++ port->message_id, 0); ++ } else { ++ msg.header = PD_HEADER_LE(PD_DATA_SOURCE_CAP, ++ port->pwr_role, ++ port->data_role, ++ port->negotiated_rev, ++ port->message_id, ++ port->nr_src_pdo); ++ } ++ ++ for (i = 0; i < port->nr_src_pdo; i++) ++ msg.payload[i] = cpu_to_le32(port->src_pdo[i]); ++ ++ return tcpm_pd_transmit(dev, TCPC_TX_SOP, &msg); ++} ++ ++static int tcpm_pd_send_sink_caps(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ struct pd_message msg; ++ unsigned int i; ++ ++ memset(&msg, 0, sizeof(msg)); ++ ++ if (!port->nr_snk_pdo) { ++ /* No sink capabilities defined, source only */ ++ msg.header = PD_HEADER_LE(PD_CTRL_REJECT, ++ port->pwr_role, ++ port->data_role, ++ port->negotiated_rev, ++ port->message_id, 0); ++ } else { ++ msg.header = PD_HEADER_LE(PD_DATA_SINK_CAP, ++ port->pwr_role, ++ port->data_role, ++ port->negotiated_rev, ++ port->message_id, ++ port->nr_snk_pdo); ++ } ++ ++ for (i = 0; i < port->nr_snk_pdo; i++) ++ msg.payload[i] = cpu_to_le32(port->snk_pdo[i]); ++ ++ return tcpm_pd_transmit(dev, TCPC_TX_SOP, &msg); ++} ++ ++static void tcpm_state_machine(struct udevice *dev); ++ ++static inline void tcpm_timer_uninit(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ port->delay_target = 0; ++} ++ ++static void tcpm_timer_init(struct udevice *dev, uint32_t ms) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ unsigned long time_us = ms * 1000; ++ ++ port->delay_target = timer_get_us() + time_us; ++} ++ ++static void tcpm_check_and_run_delayed_work(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ /* no delayed state changes scheduled */ ++ if (port->delay_target == 0) ++ return; ++ ++ /* it's not yet time */ ++ if (timer_get_us() < port->delay_target) ++ return; ++ ++ tcpm_timer_uninit(dev); ++ tcpm_state_machine(dev); ++} ++ ++static void mod_tcpm_delayed_work(struct udevice *dev, unsigned int delay_ms) ++{ ++ if (delay_ms) { ++ tcpm_timer_init(dev, delay_ms); ++ } else { ++ tcpm_timer_uninit(dev); ++ tcpm_state_machine(dev); ++ } ++} ++ ++static void tcpm_set_state(struct udevice *dev, enum tcpm_state state, ++ unsigned int delay_ms) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ if (delay_ms) { ++ dev_dbg(dev, "TCPM: pending state change %s -> %s @ %u ms [%s]\n", ++ tcpm_states[port->state], tcpm_states[state], delay_ms, ++ typec_pd_rev_name[port->negotiated_rev]); ++ port->delayed_state = state; ++ mod_tcpm_delayed_work(dev, delay_ms); ++ port->delay_ms = delay_ms; ++ } else { ++ dev_dbg(dev, "TCPM: state change %s -> %s\n", ++ tcpm_states[port->state], tcpm_states[state]); ++ port->delayed_state = INVALID_STATE; ++ port->prev_state = port->state; ++ port->state = state; ++ /* ++ * Don't re-queue the state machine work item if we're currently ++ * in the state machine and we're immediately changing states. ++ * tcpm_state_machine_work() will continue running the state ++ * machine. ++ */ ++ if (!port->state_machine_running) ++ mod_tcpm_delayed_work(dev, 0); ++ } ++} ++ ++static void tcpm_set_state_cond(struct udevice *dev, enum tcpm_state state, ++ unsigned int delay_ms) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ if (port->enter_state == port->state) ++ tcpm_set_state(dev, state, delay_ms); ++ else ++ dev_dbg(dev, "TCPM: skipped %sstate change %s -> %s [%u ms], context state %s [%s]\n", ++ delay_ms ? "delayed " : "", ++ tcpm_states[port->state], tcpm_states[state], ++ delay_ms, tcpm_states[port->enter_state], ++ typec_pd_rev_name[port->negotiated_rev]); ++} ++ ++static void tcpm_queue_message(struct udevice *dev, ++ enum pd_msg_request message) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ port->queued_message = message; ++ mod_tcpm_delayed_work(dev, 0); ++} ++ ++enum pdo_err { ++ PDO_NO_ERR, ++ PDO_ERR_NO_VSAFE5V, ++ PDO_ERR_VSAFE5V_NOT_FIRST, ++ PDO_ERR_PDO_TYPE_NOT_IN_ORDER, ++ PDO_ERR_FIXED_NOT_SORTED, ++ PDO_ERR_VARIABLE_BATT_NOT_SORTED, ++ PDO_ERR_DUPE_PDO, ++ PDO_ERR_PPS_APDO_NOT_SORTED, ++ PDO_ERR_DUPE_PPS_APDO, ++}; ++ ++static const char * const pdo_err_msg[] = { ++ [PDO_ERR_NO_VSAFE5V] = ++ " err: source/sink caps should at least have vSafe5V", ++ [PDO_ERR_VSAFE5V_NOT_FIRST] = ++ " err: vSafe5V Fixed Supply Object Shall always be the first object", ++ [PDO_ERR_PDO_TYPE_NOT_IN_ORDER] = ++ " err: PDOs should be in the following order: Fixed; Battery; Variable", ++ [PDO_ERR_FIXED_NOT_SORTED] = ++ " err: Fixed supply pdos should be in increasing order of their fixed voltage", ++ [PDO_ERR_VARIABLE_BATT_NOT_SORTED] = ++ " err: Variable/Battery supply pdos should be in increasing order of their minimum voltage", ++ [PDO_ERR_DUPE_PDO] = ++ " err: Variable/Batt supply pdos cannot have same min/max voltage", ++ [PDO_ERR_PPS_APDO_NOT_SORTED] = ++ " err: Programmable power supply apdos should be in increasing order of their maximum voltage", ++ [PDO_ERR_DUPE_PPS_APDO] = ++ " err: Programmable power supply apdos cannot have same min/max voltage and max current", ++}; ++ ++static enum pdo_err tcpm_caps_err(struct udevice *dev, const u32 *pdo, ++ unsigned int nr_pdo) ++{ ++ unsigned int i; ++ ++ /* Should at least contain vSafe5v */ ++ if (nr_pdo < 1) ++ return PDO_ERR_NO_VSAFE5V; ++ ++ /* The vSafe5V Fixed Supply Object Shall always be the first object */ ++ if (pdo_type(pdo[0]) != PDO_TYPE_FIXED || ++ pdo_fixed_voltage(pdo[0]) != VSAFE5V) ++ return PDO_ERR_VSAFE5V_NOT_FIRST; ++ ++ for (i = 1; i < nr_pdo; i++) { ++ if (pdo_type(pdo[i]) < pdo_type(pdo[i - 1])) { ++ return PDO_ERR_PDO_TYPE_NOT_IN_ORDER; ++ } else if (pdo_type(pdo[i]) == pdo_type(pdo[i - 1])) { ++ enum pd_pdo_type type = pdo_type(pdo[i]); ++ ++ switch (type) { ++ /* ++ * The remaining Fixed Supply Objects, if ++ * present, shall be sent in voltage order; ++ * lowest to highest. ++ */ ++ case PDO_TYPE_FIXED: ++ if (pdo_fixed_voltage(pdo[i]) <= ++ pdo_fixed_voltage(pdo[i - 1])) ++ return PDO_ERR_FIXED_NOT_SORTED; ++ break; ++ /* ++ * The Battery Supply Objects and Variable ++ * supply, if present shall be sent in Minimum ++ * Voltage order; lowest to highest. ++ */ ++ case PDO_TYPE_VAR: ++ case PDO_TYPE_BATT: ++ if (pdo_min_voltage(pdo[i]) < ++ pdo_min_voltage(pdo[i - 1])) ++ return PDO_ERR_VARIABLE_BATT_NOT_SORTED; ++ else if ((pdo_min_voltage(pdo[i]) == ++ pdo_min_voltage(pdo[i - 1])) && ++ (pdo_max_voltage(pdo[i]) == ++ pdo_max_voltage(pdo[i - 1]))) ++ return PDO_ERR_DUPE_PDO; ++ break; ++ /* ++ * The Programmable Power Supply APDOs, if present, ++ * shall be sent in Maximum Voltage order; ++ * lowest to highest. ++ */ ++ case PDO_TYPE_APDO: ++ if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS) ++ break; ++ ++ if (pdo_pps_apdo_max_voltage(pdo[i]) < ++ pdo_pps_apdo_max_voltage(pdo[i - 1])) ++ return PDO_ERR_PPS_APDO_NOT_SORTED; ++ else if (pdo_pps_apdo_min_voltage(pdo[i]) == ++ pdo_pps_apdo_min_voltage(pdo[i - 1]) && ++ pdo_pps_apdo_max_voltage(pdo[i]) == ++ pdo_pps_apdo_max_voltage(pdo[i - 1]) && ++ pdo_pps_apdo_max_current(pdo[i]) == ++ pdo_pps_apdo_max_current(pdo[i - 1])) ++ return PDO_ERR_DUPE_PPS_APDO; ++ break; ++ default: ++ dev_err(dev, "TCPM: Unknown pdo type\n"); ++ } ++ } ++ } ++ ++ return PDO_NO_ERR; ++} ++ ++static int tcpm_validate_caps(struct udevice *dev, const u32 *pdo, ++ unsigned int nr_pdo) ++{ ++ enum pdo_err err_index = tcpm_caps_err(dev, pdo, nr_pdo); ++ ++ if (err_index != PDO_NO_ERR) { ++ dev_err(dev, "TCPM:%s\n", pdo_err_msg[err_index]); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++/* ++ * PD (data, control) command handling functions ++ */ ++static inline enum tcpm_state ready_state(struct tcpm_port *port) ++{ ++ if (port->pwr_role == TYPEC_SOURCE) ++ return SRC_READY; ++ else ++ return SNK_READY; ++} ++ ++static void tcpm_pd_data_request(struct udevice *dev, ++ const struct pd_message *msg) ++{ ++ enum pd_data_msg_type type = pd_header_type_le(msg->header); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ unsigned int cnt = pd_header_cnt_le(msg->header); ++ unsigned int rev = pd_header_rev_le(msg->header); ++ unsigned int i; ++ ++ switch (type) { ++ case PD_DATA_SOURCE_CAP: ++ for (i = 0; i < cnt; i++) ++ port->source_caps[i] = le32_to_cpu(msg->payload[i]); ++ ++ port->nr_source_caps = cnt; ++ ++ tcpm_validate_caps(dev, port->source_caps, ++ port->nr_source_caps); ++ ++ /* ++ * Adjust revision in subsequent message headers, as required, ++ * to comply with 6.2.1.1.5 of the USB PD 3.0 spec. We don't ++ * support Rev 1.0 so just do nothing in that scenario. ++ */ ++ if (rev == PD_REV10) ++ break; ++ ++ if (rev < PD_MAX_REV) ++ port->negotiated_rev = rev; ++ ++ if ((pdo_type(port->source_caps[0]) == PDO_TYPE_FIXED) && ++ (port->source_caps[0] & PDO_FIXED_DUAL_ROLE) && ++ (port->source_caps[0] & PDO_FIXED_DATA_SWAP)) { ++ /* Dual role power and data, eg: self-powered Type-C */ ++ port->wait_dr_swap_message = true; ++ } else { ++ /* Non-Dual role power, eg: adapter */ ++ port->wait_dr_swap_message = false; ++ } ++ ++ /* ++ * This message may be received even if VBUS is not ++ * present. This is quite unexpected; see USB PD ++ * specification, sections 8.3.3.6.3.1 and 8.3.3.6.3.2. ++ * However, at the same time, we must be ready to ++ * receive this message and respond to it 15ms after ++ * receiving PS_RDY during power swap operations, no matter ++ * if VBUS is available or not (USB PD specification, ++ * section 6.5.9.2). ++ * So we need to accept the message either way, ++ * but be prepared to keep waiting for VBUS after it was ++ * handled. ++ */ ++ tcpm_set_state(dev, SNK_NEGOTIATE_CAPABILITIES, 0); ++ break; ++ case PD_DATA_REQUEST: ++ /* ++ * Adjust revision in subsequent message headers, as required, ++ * to comply with 6.2.1.1.5 of the USB PD 3.0 spec. We don't ++ * support Rev 1.0 so just reject in that scenario. ++ */ ++ if (rev == PD_REV10) { ++ tcpm_queue_message(dev, PD_MSG_CTRL_REJECT); ++ break; ++ } ++ ++ if (rev < PD_MAX_REV) ++ port->negotiated_rev = rev; ++ ++ port->sink_request = le32_to_cpu(msg->payload[0]); ++ ++ tcpm_set_state(dev, SRC_NEGOTIATE_CAPABILITIES, 0); ++ break; ++ case PD_DATA_SINK_CAP: ++ /* We don't do anything with this at the moment... */ ++ for (i = 0; i < cnt; i++) ++ port->sink_caps[i] = le32_to_cpu(msg->payload[i]); ++ ++ port->nr_sink_caps = cnt; ++ break; ++ default: ++ break; ++ } ++} ++ ++static void tcpm_pd_ctrl_request(struct udevice *dev, ++ const struct pd_message *msg) ++{ ++ enum pd_ctrl_msg_type type = pd_header_type_le(msg->header); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ enum tcpm_state next_state; ++ ++ switch (type) { ++ case PD_CTRL_GOOD_CRC: ++ case PD_CTRL_PING: ++ break; ++ case PD_CTRL_GET_SOURCE_CAP: ++ switch (port->state) { ++ case SRC_READY: ++ case SNK_READY: ++ tcpm_queue_message(dev, PD_MSG_DATA_SOURCE_CAP); ++ break; ++ default: ++ tcpm_queue_message(dev, PD_MSG_CTRL_REJECT); ++ break; ++ } ++ break; ++ case PD_CTRL_GET_SINK_CAP: ++ switch (port->state) { ++ case SRC_READY: ++ case SNK_READY: ++ tcpm_queue_message(dev, PD_MSG_DATA_SINK_CAP); ++ break; ++ default: ++ tcpm_queue_message(dev, PD_MSG_CTRL_REJECT); ++ break; ++ } ++ break; ++ case PD_CTRL_GOTO_MIN: ++ break; ++ case PD_CTRL_PS_RDY: ++ switch (port->state) { ++ case SNK_TRANSITION_SINK: ++ if (port->vbus_present) { ++ tcpm_set_current_limit(dev, ++ port->req_current_limit, ++ port->req_supply_voltage); ++ port->explicit_contract = true; ++ tcpm_set_state(dev, SNK_READY, 0); ++ } else { ++ /* ++ * Seen after power swap. Keep waiting for VBUS ++ * in a transitional state. ++ */ ++ tcpm_set_state(dev, ++ SNK_TRANSITION_SINK_VBUS, 0); ++ } ++ break; ++ default: ++ break; ++ } ++ break; ++ case PD_CTRL_REJECT: ++ case PD_CTRL_WAIT: ++ case PD_CTRL_NOT_SUPP: ++ switch (port->state) { ++ case SNK_NEGOTIATE_CAPABILITIES: ++ /* USB PD specification, Figure 8-43 */ ++ if (port->explicit_contract) ++ next_state = SNK_READY; ++ else ++ next_state = SNK_WAIT_CAPABILITIES; ++ ++ tcpm_set_state(dev, next_state, 0); ++ break; ++ default: ++ break; ++ } ++ break; ++ case PD_CTRL_ACCEPT: ++ switch (port->state) { ++ case SNK_NEGOTIATE_CAPABILITIES: ++ tcpm_set_state(dev, SNK_TRANSITION_SINK, 0); ++ break; ++ case SOFT_RESET_SEND: ++ port->message_id = 0; ++ port->rx_msgid = -1; ++ if (port->pwr_role == TYPEC_SOURCE) ++ next_state = SRC_SEND_CAPABILITIES; ++ else ++ next_state = SNK_WAIT_CAPABILITIES; ++ tcpm_set_state(dev, next_state, 0); ++ break; ++ default: ++ break; ++ } ++ break; ++ case PD_CTRL_SOFT_RESET: ++ tcpm_set_state(dev, SOFT_RESET, 0); ++ break; ++ case PD_CTRL_DR_SWAP: ++ if (port->port_type != TYPEC_PORT_DRP) { ++ tcpm_queue_message(dev, PD_MSG_CTRL_REJECT); ++ break; ++ } ++ /* ++ * 6.3.9: If an alternate mode is active, a request to swap ++ * alternate modes shall trigger a port reset. ++ */ ++ switch (port->state) { ++ case SRC_READY: ++ case SNK_READY: ++ tcpm_set_state(dev, DR_SWAP_ACCEPT, 0); ++ break; ++ default: ++ tcpm_queue_message(dev, PD_MSG_CTRL_WAIT); ++ break; ++ } ++ break; ++ case PD_CTRL_PR_SWAP: ++ case PD_CTRL_VCONN_SWAP: ++ case PD_CTRL_GET_SOURCE_CAP_EXT: ++ case PD_CTRL_GET_STATUS: ++ case PD_CTRL_FR_SWAP: ++ case PD_CTRL_GET_PPS_STATUS: ++ case PD_CTRL_GET_COUNTRY_CODES: ++ /* Currently not supported */ ++ dev_err(dev, "TCPM: Currently not supported type %#x\n", type); ++ tcpm_queue_message(dev, PD_MSG_CTRL_NOT_SUPP); ++ break; ++ default: ++ dev_err(dev, "TCPM: Unrecognized ctrl message type %#x\n", type); ++ break; ++ } ++} ++ ++static void tcpm_pd_rx_handler(struct udevice *dev, ++ const struct pd_message *msg) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ unsigned int cnt = pd_header_cnt_le(msg->header); ++ bool remote_is_host, local_is_host; ++ ++ dev_dbg(dev, "TCPM: PD RX, header: %#x [%d]\n", ++ le16_to_cpu(msg->header), port->attached); ++ ++ if (port->attached) { ++ enum pd_ctrl_msg_type type = pd_header_type_le(msg->header); ++ unsigned int msgid = pd_header_msgid_le(msg->header); ++ ++ /* ++ * USB PD standard, 6.6.1.2: ++ * "... if MessageID value in a received Message is the ++ * same as the stored value, the receiver shall return a ++ * GoodCRC Message with that MessageID value and drop ++ * the Message (this is a retry of an already received ++ * Message). Note: this shall not apply to the Soft_Reset ++ * Message which always has a MessageID value of zero." ++ */ ++ if (msgid == port->rx_msgid && type != PD_CTRL_SOFT_RESET) ++ return; ++ port->rx_msgid = msgid; ++ ++ /* ++ * If both ends believe to be DFP/host, we have a data role ++ * mismatch. ++ */ ++ remote_is_host = !!(le16_to_cpu(msg->header) & PD_HEADER_DATA_ROLE); ++ local_is_host = port->data_role == TYPEC_HOST; ++ if (remote_is_host == local_is_host) { ++ dev_err(dev, "TCPM: data role mismatch, initiating error recovery\n"); ++ tcpm_set_state(dev, ERROR_RECOVERY, 0); ++ } else { ++ if (cnt) ++ tcpm_pd_data_request(dev, msg); ++ else ++ tcpm_pd_ctrl_request(dev, msg); ++ } ++ } ++} ++ ++void tcpm_pd_receive(struct udevice *dev, const struct pd_message *msg) ++{ ++ tcpm_reset_event_cnt(dev); ++ tcpm_pd_rx_handler(dev, msg); ++} ++ ++static int tcpm_pd_send_control(struct udevice *dev, ++ enum pd_ctrl_msg_type type) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ struct pd_message msg; ++ ++ memset(&msg, 0, sizeof(msg)); ++ msg.header = PD_HEADER_LE(type, port->pwr_role, ++ port->data_role, ++ port->negotiated_rev, ++ port->message_id, 0); ++ ++ return tcpm_pd_transmit(dev, TCPC_TX_SOP, &msg); ++} ++ ++/* ++ * Send queued message without affecting state. ++ * Return true if state machine should go back to sleep, ++ * false otherwise. ++ */ ++static bool tcpm_send_queued_message(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ enum pd_msg_request queued_message; ++ int max_messages = 100; ++ ++ do { ++ queued_message = port->queued_message; ++ port->queued_message = PD_MSG_NONE; ++ max_messages--; ++ ++ switch (queued_message) { ++ case PD_MSG_CTRL_WAIT: ++ tcpm_pd_send_control(dev, PD_CTRL_WAIT); ++ break; ++ case PD_MSG_CTRL_REJECT: ++ tcpm_pd_send_control(dev, PD_CTRL_REJECT); ++ break; ++ case PD_MSG_CTRL_NOT_SUPP: ++ tcpm_pd_send_control(dev, PD_CTRL_NOT_SUPP); ++ break; ++ case PD_MSG_DATA_SINK_CAP: ++ tcpm_pd_send_sink_caps(dev); ++ break; ++ case PD_MSG_DATA_SOURCE_CAP: ++ tcpm_pd_send_source_caps(dev); ++ break; ++ default: ++ break; ++ } ++ } while (max_messages > 0 && port->queued_message != PD_MSG_NONE); ++ ++ if (!max_messages) ++ dev_err(dev, "Aborted sending of too many queued messages\n"); ++ ++ return false; ++} ++ ++static int tcpm_pd_check_request(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ u32 pdo, rdo = port->sink_request; ++ unsigned int max, op, pdo_max, index; ++ enum pd_pdo_type type; ++ ++ index = rdo_index(rdo); ++ if (!index || index > port->nr_src_pdo) ++ return -EINVAL; ++ ++ pdo = port->src_pdo[index - 1]; ++ type = pdo_type(pdo); ++ switch (type) { ++ case PDO_TYPE_FIXED: ++ case PDO_TYPE_VAR: ++ max = rdo_max_current(rdo); ++ op = rdo_op_current(rdo); ++ pdo_max = pdo_max_current(pdo); ++ ++ if (op > pdo_max) ++ return -EINVAL; ++ if (max > pdo_max && !(rdo & RDO_CAP_MISMATCH)) ++ return -EINVAL; ++ ++ if (type == PDO_TYPE_FIXED) ++ dev_dbg(dev, "TCPM: Requested %u mV, %u mA for %u / %u mA\n", ++ pdo_fixed_voltage(pdo), pdo_max, op, max); ++ else ++ dev_dbg(dev, "TCPM: Requested %u -> %u mV, %u mA for %u / %u mA\n", ++ pdo_min_voltage(pdo), pdo_max_voltage(pdo), ++ pdo_max, op, max); ++ break; ++ case PDO_TYPE_BATT: ++ max = rdo_max_power(rdo); ++ op = rdo_op_power(rdo); ++ pdo_max = pdo_max_power(pdo); ++ ++ if (op > pdo_max) ++ return -EINVAL; ++ if (max > pdo_max && !(rdo & RDO_CAP_MISMATCH)) ++ return -EINVAL; ++ dev_info(dev, "TCPM: Requested %u -> %u mV, %u mW for %u / %u mW\n", ++ pdo_min_voltage(pdo), pdo_max_voltage(pdo), ++ pdo_max, op, max); ++ break; ++ default: ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++#define min_power(x, y) min(pdo_max_power(x), pdo_max_power(y)) ++#define min_current(x, y) min(pdo_max_current(x), pdo_max_current(y)) ++ ++static int tcpm_pd_select_pdo(struct udevice *dev, int *sink_pdo, ++ int *src_pdo) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ unsigned int i, j, max_src_mv = 0, min_src_mv = 0, max_mw = 0, ++ max_mv = 0, src_mw = 0, src_ma = 0, max_snk_mv = 0, ++ min_snk_mv = 0; ++ int ret = -EINVAL; ++ ++ /* ++ * Select the source PDO providing the most power which has a ++ * matchig sink cap. ++ */ ++ for (i = 0; i < port->nr_source_caps; i++) { ++ u32 pdo = port->source_caps[i]; ++ enum pd_pdo_type type = pdo_type(pdo); ++ ++ switch (type) { ++ case PDO_TYPE_FIXED: ++ max_src_mv = pdo_fixed_voltage(pdo); ++ min_src_mv = max_src_mv; ++ break; ++ case PDO_TYPE_BATT: ++ case PDO_TYPE_VAR: ++ max_src_mv = pdo_max_voltage(pdo); ++ min_src_mv = pdo_min_voltage(pdo); ++ break; ++ case PDO_TYPE_APDO: ++ continue; ++ default: ++ dev_err(dev, "TCPM: Invalid source PDO type, ignoring\n"); ++ continue; ++ } ++ ++ switch (type) { ++ case PDO_TYPE_FIXED: ++ case PDO_TYPE_VAR: ++ src_ma = pdo_max_current(pdo); ++ src_mw = src_ma * min_src_mv / 1000; ++ break; ++ case PDO_TYPE_BATT: ++ src_mw = pdo_max_power(pdo); ++ break; ++ case PDO_TYPE_APDO: ++ continue; ++ default: ++ dev_err(dev, "TCPM: Invalid source PDO type, ignoring\n"); ++ continue; ++ } ++ ++ for (j = 0; j < port->nr_snk_pdo; j++) { ++ pdo = port->snk_pdo[j]; ++ ++ switch (pdo_type(pdo)) { ++ case PDO_TYPE_FIXED: ++ max_snk_mv = pdo_fixed_voltage(pdo); ++ min_snk_mv = max_snk_mv; ++ break; ++ case PDO_TYPE_BATT: ++ case PDO_TYPE_VAR: ++ max_snk_mv = pdo_max_voltage(pdo); ++ min_snk_mv = pdo_min_voltage(pdo); ++ break; ++ case PDO_TYPE_APDO: ++ continue; ++ default: ++ dev_err(dev, "TCPM: Invalid sink PDO type, ignoring\n"); ++ continue; ++ } ++ ++ if (max_src_mv <= max_snk_mv && min_src_mv >= min_snk_mv) { ++ /* Prefer higher voltages if available */ ++ if ((src_mw == max_mw && min_src_mv > max_mv) || ++ src_mw > max_mw) { ++ *src_pdo = i; ++ *sink_pdo = j; ++ max_mw = src_mw; ++ max_mv = min_src_mv; ++ ret = 0; ++ } ++ } ++ } ++ } ++ ++ return ret; ++} ++ ++static int tcpm_pd_build_request(struct udevice *dev, u32 *rdo) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ unsigned int mv, ma, mw, flags; ++ unsigned int max_ma, max_mw; ++ enum pd_pdo_type type; ++ u32 pdo, matching_snk_pdo; ++ int src_pdo_index = 0; ++ int snk_pdo_index = 0; ++ int ret; ++ ++ ret = tcpm_pd_select_pdo(dev, &snk_pdo_index, &src_pdo_index); ++ if (ret < 0) ++ return ret; ++ ++ pdo = port->source_caps[src_pdo_index]; ++ matching_snk_pdo = port->snk_pdo[snk_pdo_index]; ++ type = pdo_type(pdo); ++ ++ switch (type) { ++ case PDO_TYPE_FIXED: ++ mv = pdo_fixed_voltage(pdo); ++ break; ++ case PDO_TYPE_BATT: ++ case PDO_TYPE_VAR: ++ mv = pdo_min_voltage(pdo); ++ break; ++ default: ++ dev_err(dev, "TCPM: Invalid PDO selected!\n"); ++ return -EINVAL; ++ } ++ ++ /* Select maximum available current within the sink pdo's limit */ ++ if (type == PDO_TYPE_BATT) { ++ mw = min_power(pdo, matching_snk_pdo); ++ ma = 1000 * mw / mv; ++ } else { ++ ma = min_current(pdo, matching_snk_pdo); ++ mw = ma * mv / 1000; ++ } ++ ++ flags = RDO_USB_COMM | RDO_NO_SUSPEND; ++ ++ /* Set mismatch bit if offered power is less than operating power */ ++ max_ma = ma; ++ max_mw = mw; ++ if (mw < port->operating_snk_mw) { ++ flags |= RDO_CAP_MISMATCH; ++ if (type == PDO_TYPE_BATT && ++ (pdo_max_power(matching_snk_pdo) > pdo_max_power(pdo))) ++ max_mw = pdo_max_power(matching_snk_pdo); ++ else if (pdo_max_current(matching_snk_pdo) > ++ pdo_max_current(pdo)) ++ max_ma = pdo_max_current(matching_snk_pdo); ++ } ++ ++ dev_dbg(dev, "TCPM: cc=%d cc1=%d cc2=%d vbus=%d vconn=%s polarity=%d\n", ++ port->cc_req, port->cc1, port->cc2, port->vbus_source, ++ port->vconn_role == TYPEC_SOURCE ? "source" : "sink", ++ port->polarity); ++ ++ if (type == PDO_TYPE_BATT) { ++ *rdo = RDO_BATT(src_pdo_index + 1, mw, max_mw, flags); ++ ++ dev_info(dev, "TCPM: requesting PDO %d: %u mV, %u mW%s\n", ++ src_pdo_index, mv, mw, ++ flags & RDO_CAP_MISMATCH ? " [mismatch]" : ""); ++ } else { ++ *rdo = RDO_FIXED(src_pdo_index + 1, ma, max_ma, flags); ++ ++ dev_info(dev, "TCPM: requesting PDO %d: %u mV, %u mA%s\n", ++ src_pdo_index, mv, ma, ++ flags & RDO_CAP_MISMATCH ? " [mismatch]" : ""); ++ } ++ ++ port->req_current_limit = ma; ++ port->req_supply_voltage = mv; ++ ++ return 0; ++} ++ ++static int tcpm_pd_send_request(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ struct pd_message msg; ++ int ret; ++ u32 rdo; ++ ++ ret = tcpm_pd_build_request(dev, &rdo); ++ if (ret < 0) ++ return ret; ++ ++ memset(&msg, 0, sizeof(msg)); ++ msg.header = PD_HEADER_LE(PD_DATA_REQUEST, ++ port->pwr_role, ++ port->data_role, ++ port->negotiated_rev, ++ port->message_id, 1); ++ msg.payload[0] = cpu_to_le32(rdo); ++ ++ return tcpm_pd_transmit(dev, TCPC_TX_SOP, &msg); ++} ++ ++static int tcpm_set_vbus(struct udevice *dev, bool enable) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ int ret; ++ ++ if (enable && port->vbus_charge) ++ return -EINVAL; ++ ++ dev_dbg(dev, "TCPM: set vbus = %d charge = %d\n", ++ enable, port->vbus_charge); ++ ++ ret = drvops->set_vbus(dev, enable, port->vbus_charge); ++ if (ret < 0) ++ return ret; ++ ++ port->vbus_source = enable; ++ return 0; ++} ++ ++static int tcpm_set_charge(struct udevice *dev, bool charge) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret; ++ ++ if (charge && port->vbus_source) ++ return -EINVAL; ++ ++ if (charge != port->vbus_charge) { ++ dev_dbg(dev, "TCPM: set vbus = %d charge = %d\n", ++ port->vbus_source, charge); ++ ret = drvops->set_vbus(dev, port->vbus_source, ++ charge); ++ if (ret < 0) ++ return ret; ++ } ++ port->vbus_charge = charge; ++ return 0; ++} ++ ++static bool tcpm_start_toggling(struct udevice *dev, enum typec_cc_status cc) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret; ++ ++ if (!drvops->start_toggling) ++ return false; ++ ++ dev_dbg(dev, "TCPM: Start toggling\n"); ++ ret = drvops->start_toggling(dev, port->port_type, cc); ++ return ret == 0; ++} ++ ++static int tcpm_init_vbus(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret; ++ ++ ret = drvops->set_vbus(dev, false, false); ++ port->vbus_source = false; ++ port->vbus_charge = false; ++ return ret; ++} ++ ++static int tcpm_init_vconn(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret; ++ ++ ret = drvops->set_vconn(dev, false); ++ port->vconn_role = TYPEC_SINK; ++ return ret; ++} ++ ++static inline void tcpm_typec_connect(struct tcpm_port *port) ++{ ++ if (!port->connected) ++ port->connected = true; ++} ++ ++static int tcpm_src_attach(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ enum typec_cc_polarity polarity = ++ port->cc2 == TYPEC_CC_RD ? TYPEC_POLARITY_CC2 ++ : TYPEC_POLARITY_CC1; ++ int ret; ++ ++ if (port->attached) ++ return 0; ++ ++ ret = tcpm_set_polarity(dev, polarity); ++ if (ret < 0) ++ return ret; ++ ++ ret = tcpm_set_roles(dev, true, TYPEC_SOURCE, TYPEC_HOST); ++ if (ret < 0) ++ return ret; ++ ++ ret = drvops->set_pd_rx(dev, true); ++ if (ret < 0) ++ goto out_disable_mux; ++ ++ /* ++ * USB Type-C specification, version 1.2, ++ * chapter 4.5.2.2.8.1 (Attached.SRC Requirements) ++ * Enable VCONN only if the non-RD port is set to RA. ++ */ ++ if ((polarity == TYPEC_POLARITY_CC1 && port->cc2 == TYPEC_CC_RA) || ++ (polarity == TYPEC_POLARITY_CC2 && port->cc1 == TYPEC_CC_RA)) { ++ ret = tcpm_set_vconn(dev, true); ++ if (ret < 0) ++ goto out_disable_pd; ++ } ++ ++ ret = tcpm_set_vbus(dev, true); ++ if (ret < 0) ++ goto out_disable_vconn; ++ ++ port->pd_capable = false; ++ ++ port->partner = NULL; ++ ++ port->attached = true; ++ ++ return 0; ++ ++out_disable_vconn: ++ tcpm_set_vconn(dev, false); ++out_disable_pd: ++ drvops->set_pd_rx(dev, false); ++out_disable_mux: ++ dev_err(dev, "TCPM: CC connected in %s as DFP\n", ++ polarity ? "CC2" : "CC1"); ++ return 0; ++} ++ ++static inline void tcpm_typec_disconnect(struct tcpm_port *port) ++{ ++ if (port->connected) { ++ port->partner = NULL; ++ port->connected = false; ++ } ++} ++ ++static void tcpm_reset_port(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ tcpm_timer_uninit(dev); ++ tcpm_typec_disconnect(port); ++ tcpm_reset_event_cnt(dev); ++ port->wait_dr_swap_message = false; ++ port->attached = false; ++ port->pd_capable = false; ++ ++ /* ++ * First Rx ID should be 0; set this to a sentinel of -1 so that ++ * we can check tcpm_pd_rx_handler() if we had seen it before. ++ */ ++ port->rx_msgid = -1; ++ ++ drvops->set_pd_rx(dev, false); ++ tcpm_init_vbus(dev); /* also disables charging */ ++ tcpm_init_vconn(dev); ++ tcpm_set_current_limit(dev, 0, 0); ++ tcpm_set_polarity(dev, TYPEC_POLARITY_CC1); ++ tcpm_set_attached_state(dev, false); ++ port->nr_sink_caps = 0; ++} ++ ++static void tcpm_detach(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ if (tcpm_port_is_disconnected(port)) ++ port->hard_reset_count = 0; ++ ++ if (!port->attached) ++ return; ++ ++ tcpm_reset_port(dev); ++} ++ ++static void tcpm_src_detach(struct udevice *dev) ++{ ++ tcpm_detach(dev); ++} ++ ++static int tcpm_snk_attach(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret; ++ ++ if (port->attached) ++ return 0; ++ ++ ret = tcpm_set_polarity(dev, port->cc2 != TYPEC_CC_OPEN ? ++ TYPEC_POLARITY_CC2 : TYPEC_POLARITY_CC1); ++ if (ret < 0) ++ return ret; ++ ++ ret = tcpm_set_roles(dev, true, TYPEC_SINK, TYPEC_DEVICE); ++ if (ret < 0) ++ return ret; ++ ++ port->pd_capable = false; ++ ++ port->partner = NULL; ++ ++ port->attached = true; ++ dev_info(dev, "TCPM: CC connected in %s as UFP\n", ++ port->cc1 != TYPEC_CC_OPEN ? "CC1" : "CC2"); ++ ++ return 0; ++} ++ ++static void tcpm_snk_detach(struct udevice *dev) ++{ ++ tcpm_detach(dev); ++} ++ ++static inline enum tcpm_state hard_reset_state(struct tcpm_port *port) ++{ ++ if (port->hard_reset_count < PD_N_HARD_RESET_COUNT) ++ return HARD_RESET_SEND; ++ if (port->pd_capable) ++ return ERROR_RECOVERY; ++ if (port->pwr_role == TYPEC_SOURCE) ++ return SRC_UNATTACHED; ++ if (port->state == SNK_WAIT_CAPABILITIES) ++ return SNK_READY; ++ return SNK_UNATTACHED; ++} ++ ++static inline enum tcpm_state unattached_state(struct tcpm_port *port) ++{ ++ if (port->port_type == TYPEC_PORT_DRP) { ++ if (port->pwr_role == TYPEC_SOURCE) ++ return SRC_UNATTACHED; ++ else ++ return SNK_UNATTACHED; ++ } else if (port->port_type == TYPEC_PORT_SRC) { ++ return SRC_UNATTACHED; ++ } ++ ++ return SNK_UNATTACHED; ++} ++ ++static void run_state_machine(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int ret; ++ ++ port->enter_state = port->state; ++ switch (port->state) { ++ case TOGGLING: ++ break; ++ /* SRC states */ ++ case SRC_UNATTACHED: ++ tcpm_src_detach(dev); ++ if (tcpm_start_toggling(dev, tcpm_rp_cc(port))) { ++ tcpm_set_state(dev, TOGGLING, 0); ++ break; ++ } ++ tcpm_set_cc(dev, tcpm_rp_cc(port)); ++ if (port->port_type == TYPEC_PORT_DRP) ++ tcpm_set_state(dev, SNK_UNATTACHED, PD_T_DRP_SNK); ++ break; ++ case SRC_ATTACH_WAIT: ++ if (tcpm_port_is_source(port)) ++ tcpm_set_state(dev, SRC_ATTACHED, PD_T_CC_DEBOUNCE); ++ break; ++ ++ case SRC_ATTACHED: ++ ret = tcpm_src_attach(dev); ++ /* ++ * Currently, vbus control is not implemented, ++ * and the SRC detection process cannot be fully implemented. ++ */ ++ tcpm_set_state(dev, SRC_READY, 0); ++ break; ++ case SRC_STARTUP: ++ port->caps_count = 0; ++ port->negotiated_rev = PD_MAX_REV; ++ port->message_id = 0; ++ port->rx_msgid = -1; ++ port->explicit_contract = false; ++ tcpm_set_state(dev, SRC_SEND_CAPABILITIES, 0); ++ break; ++ case SRC_SEND_CAPABILITIES: ++ port->caps_count++; ++ if (port->caps_count > PD_N_CAPS_COUNT) { ++ tcpm_set_state(dev, SRC_READY, 0); ++ break; ++ } ++ ret = tcpm_pd_send_source_caps(dev); ++ if (ret < 0) { ++ tcpm_set_state(dev, SRC_SEND_CAPABILITIES, ++ PD_T_SEND_SOURCE_CAP); ++ } else { ++ /* ++ * Per standard, we should clear the reset counter here. ++ * However, that can result in state machine hang-ups. ++ * Reset it only in READY state to improve stability. ++ */ ++ /* port->hard_reset_count = 0; */ ++ port->caps_count = 0; ++ port->pd_capable = true; ++ tcpm_set_state_cond(dev, SRC_SEND_CAPABILITIES_TIMEOUT, ++ PD_T_SEND_SOURCE_CAP); ++ } ++ break; ++ case SRC_SEND_CAPABILITIES_TIMEOUT: ++ /* ++ * Error recovery for a PD_DATA_SOURCE_CAP reply timeout. ++ * ++ * PD 2.0 sinks are supposed to accept src-capabilities with a ++ * 3.0 header and simply ignore any src PDOs which the sink does ++ * not understand such as PPS but some 2.0 sinks instead ignore ++ * the entire PD_DATA_SOURCE_CAP message, causing contract ++ * negotiation to fail. ++ * ++ * After PD_N_HARD_RESET_COUNT hard-reset attempts, we try ++ * sending src-capabilities with a lower PD revision to ++ * make these broken sinks work. ++ */ ++ if (port->hard_reset_count < PD_N_HARD_RESET_COUNT) { ++ tcpm_set_state(dev, HARD_RESET_SEND, 0); ++ } else if (port->negotiated_rev > PD_REV20) { ++ port->negotiated_rev--; ++ port->hard_reset_count = 0; ++ tcpm_set_state(dev, SRC_SEND_CAPABILITIES, 0); ++ } else { ++ tcpm_set_state(dev, hard_reset_state(port), 0); ++ } ++ break; ++ case SRC_NEGOTIATE_CAPABILITIES: ++ ret = tcpm_pd_check_request(dev); ++ if (ret < 0) { ++ tcpm_pd_send_control(dev, PD_CTRL_REJECT); ++ if (!port->explicit_contract) { ++ tcpm_set_state(dev, ++ SRC_WAIT_NEW_CAPABILITIES, 0); ++ } else { ++ tcpm_set_state(dev, SRC_READY, 0); ++ } ++ } else { ++ tcpm_pd_send_control(dev, PD_CTRL_ACCEPT); ++ tcpm_set_state(dev, SRC_TRANSITION_SUPPLY, ++ PD_T_SRC_TRANSITION); ++ } ++ break; ++ case SRC_TRANSITION_SUPPLY: ++ /* XXX: regulator_set_voltage(vbus, ...) */ ++ tcpm_pd_send_control(dev, PD_CTRL_PS_RDY); ++ port->explicit_contract = true; ++ tcpm_set_state_cond(dev, SRC_READY, 0); ++ break; ++ case SRC_READY: ++ port->hard_reset_count = 0; ++ ++ tcpm_typec_connect(port); ++ break; ++ case SRC_WAIT_NEW_CAPABILITIES: ++ /* Nothing to do... */ ++ break; ++ ++ /* SNK states */ ++ case SNK_UNATTACHED: ++ tcpm_snk_detach(dev); ++ if (tcpm_start_toggling(dev, TYPEC_CC_RD)) { ++ tcpm_set_state(dev, TOGGLING, 0); ++ break; ++ } ++ tcpm_set_cc(dev, TYPEC_CC_RD); ++ if (port->port_type == TYPEC_PORT_DRP) ++ tcpm_set_state(dev, SRC_UNATTACHED, PD_T_DRP_SRC); ++ break; ++ case SNK_ATTACH_WAIT: ++ if ((port->cc1 == TYPEC_CC_OPEN && ++ port->cc2 != TYPEC_CC_OPEN) || ++ (port->cc1 != TYPEC_CC_OPEN && ++ port->cc2 == TYPEC_CC_OPEN)) ++ tcpm_set_state(dev, SNK_DEBOUNCED, ++ PD_T_CC_DEBOUNCE); ++ else if (tcpm_port_is_disconnected(port)) ++ tcpm_set_state(dev, SNK_UNATTACHED, ++ PD_T_CC_DEBOUNCE); ++ break; ++ case SNK_DEBOUNCED: ++ if (tcpm_port_is_disconnected(port)) ++ tcpm_set_state(dev, SNK_UNATTACHED, PD_T_PD_DEBOUNCE); ++ else if (port->vbus_present) ++ tcpm_set_state(dev, SNK_ATTACHED, 0); ++ else ++ /* Wait for VBUS, but not forever */ ++ tcpm_set_state(dev, PORT_RESET, PD_T_PS_SOURCE_ON); ++ break; ++ case SNK_ATTACHED: ++ ret = tcpm_snk_attach(dev); ++ if (ret < 0) ++ tcpm_set_state(dev, SNK_UNATTACHED, 0); ++ else ++ tcpm_set_state(dev, SNK_STARTUP, 0); ++ break; ++ case SNK_STARTUP: ++ port->negotiated_rev = PD_MAX_REV; ++ port->message_id = 0; ++ port->rx_msgid = -1; ++ port->explicit_contract = false; ++ tcpm_set_state(dev, SNK_DISCOVERY, 0); ++ break; ++ case SNK_DISCOVERY: ++ if (port->vbus_present) { ++ tcpm_set_current_limit(dev, ++ tcpm_get_current_limit(port), ++ 5000); ++ tcpm_set_charge(dev, true); ++ tcpm_set_state(dev, SNK_WAIT_CAPABILITIES, 0); ++ break; ++ } ++ /* ++ * For DRP, timeouts differ. Also, handling is supposed to be ++ * different and much more complex (dead battery detection; ++ * see USB power delivery specification, section 8.3.3.6.1.5.1). ++ */ ++ tcpm_set_state(dev, hard_reset_state(port), ++ port->port_type == TYPEC_PORT_DRP ? ++ PD_T_DB_DETECT : PD_T_NO_RESPONSE); ++ break; ++ case SNK_DISCOVERY_DEBOUNCE: ++ tcpm_set_state(dev, SNK_DISCOVERY_DEBOUNCE_DONE, ++ PD_T_CC_DEBOUNCE); ++ break; ++ case SNK_DISCOVERY_DEBOUNCE_DONE: ++ tcpm_set_state(dev, unattached_state(port), 0); ++ break; ++ case SNK_WAIT_CAPABILITIES: ++ ret = drvops->set_pd_rx(dev, true); ++ if (ret < 0) { ++ tcpm_set_state(dev, SNK_READY, 0); ++ break; ++ } ++ /* ++ * If VBUS has never been low, and we time out waiting ++ * for source cap, try a soft reset first, in case we ++ * were already in a stable contract before this boot. ++ * Do this only once. ++ */ ++ if (port->vbus_never_low) { ++ port->vbus_never_low = false; ++ tcpm_set_state(dev, SOFT_RESET_SEND, ++ PD_T_SINK_WAIT_CAP); ++ } else { ++ tcpm_set_state(dev, hard_reset_state(port), ++ PD_T_SINK_WAIT_CAP); ++ } ++ break; ++ case SNK_NEGOTIATE_CAPABILITIES: ++ port->pd_capable = true; ++ port->hard_reset_count = 0; ++ ret = tcpm_pd_send_request(dev); ++ if (ret < 0) { ++ /* Let the Source send capabilities again. */ ++ tcpm_set_state(dev, SNK_WAIT_CAPABILITIES, 0); ++ } else { ++ tcpm_set_state_cond(dev, hard_reset_state(port), ++ PD_T_SENDER_RESPONSE); ++ } ++ break; ++ case SNK_TRANSITION_SINK: ++ case SNK_TRANSITION_SINK_VBUS: ++ tcpm_set_state(dev, hard_reset_state(port), ++ PD_T_PS_TRANSITION); ++ break; ++ case SNK_READY: ++ port->update_sink_caps = false; ++ tcpm_typec_connect(port); ++ /* ++ * Here poll_event_cnt is cleared, waiting for self-powered Type-C devices ++ * to send DR_swap Messge until 1s (TCPM_POLL_EVENT_TIME_OUT * 500us)timeout ++ */ ++ if (port->wait_dr_swap_message) ++ tcpm_reset_event_cnt(dev); ++ ++ break; ++ ++ /* Hard_Reset states */ ++ case HARD_RESET_SEND: ++ tcpm_pd_transmit(dev, TCPC_TX_HARD_RESET, NULL); ++ tcpm_set_state(dev, HARD_RESET_START, 0); ++ port->wait_dr_swap_message = false; ++ break; ++ case HARD_RESET_START: ++ port->hard_reset_count++; ++ drvops->set_pd_rx(dev, false); ++ port->nr_sink_caps = 0; ++ if (port->pwr_role == TYPEC_SOURCE) ++ tcpm_set_state(dev, SRC_HARD_RESET_VBUS_OFF, ++ PD_T_PS_HARD_RESET); ++ else ++ tcpm_set_state(dev, SNK_HARD_RESET_SINK_OFF, 0); ++ break; ++ case SRC_HARD_RESET_VBUS_OFF: ++ tcpm_set_vconn(dev, true); ++ tcpm_set_vbus(dev, false); ++ tcpm_set_roles(dev, port->self_powered, TYPEC_SOURCE, ++ TYPEC_HOST); ++ tcpm_set_state(dev, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); ++ break; ++ case SRC_HARD_RESET_VBUS_ON: ++ tcpm_set_vconn(dev, true); ++ tcpm_set_vbus(dev, true); ++ drvops->set_pd_rx(dev, true); ++ tcpm_set_attached_state(dev, true); ++ tcpm_set_state(dev, SRC_UNATTACHED, PD_T_PS_SOURCE_ON); ++ break; ++ case SNK_HARD_RESET_SINK_OFF: ++ tcpm_set_vconn(dev, false); ++ if (port->pd_capable) ++ tcpm_set_charge(dev, false); ++ tcpm_set_roles(dev, port->self_powered, TYPEC_SINK, ++ TYPEC_DEVICE); ++ /* ++ * VBUS may or may not toggle, depending on the adapter. ++ * If it doesn't toggle, transition to SNK_HARD_RESET_SINK_ON ++ * directly after timeout. ++ */ ++ tcpm_set_state(dev, SNK_HARD_RESET_SINK_ON, PD_T_SAFE_0V); ++ break; ++ case SNK_HARD_RESET_WAIT_VBUS: ++ /* Assume we're disconnected if VBUS doesn't come back. */ ++ tcpm_set_state(dev, SNK_UNATTACHED, ++ PD_T_SRC_RECOVER_MAX + PD_T_SRC_TURN_ON); ++ break; ++ case SNK_HARD_RESET_SINK_ON: ++ /* Note: There is no guarantee that VBUS is on in this state */ ++ /* ++ * XXX: ++ * The specification suggests that dual mode ports in sink ++ * mode should transition to state PE_SRC_Transition_to_default. ++ * See USB power delivery specification chapter 8.3.3.6.1.3. ++ * This would mean to ++ * - turn off VCONN, reset power supply ++ * - request hardware reset ++ * - turn on VCONN ++ * - Transition to state PE_Src_Startup ++ * SNK only ports shall transition to state Snk_Startup ++ * (see chapter 8.3.3.3.8). ++ * Similar, dual-mode ports in source mode should transition ++ * to PE_SNK_Transition_to_default. ++ */ ++ if (port->pd_capable) { ++ tcpm_set_current_limit(dev, ++ tcpm_get_current_limit(port), ++ 5000); ++ tcpm_set_charge(dev, true); ++ } ++ tcpm_set_attached_state(dev, true); ++ tcpm_set_state(dev, SNK_STARTUP, 0); ++ break; ++ ++ /* Soft_Reset states */ ++ case SOFT_RESET: ++ port->message_id = 0; ++ port->rx_msgid = -1; ++ tcpm_pd_send_control(dev, PD_CTRL_ACCEPT); ++ if (port->pwr_role == TYPEC_SOURCE) ++ tcpm_set_state(dev, SRC_SEND_CAPABILITIES, 0); ++ else ++ tcpm_set_state(dev, SNK_WAIT_CAPABILITIES, 0); ++ break; ++ case SOFT_RESET_SEND: ++ port->message_id = 0; ++ port->rx_msgid = -1; ++ if (tcpm_pd_send_control(dev, PD_CTRL_SOFT_RESET)) ++ tcpm_set_state_cond(dev, hard_reset_state(port), 0); ++ else ++ tcpm_set_state_cond(dev, hard_reset_state(port), ++ PD_T_SENDER_RESPONSE); ++ break; ++ ++ /* DR_Swap states */ ++ case DR_SWAP_ACCEPT: ++ tcpm_pd_send_control(dev, PD_CTRL_ACCEPT); ++ tcpm_set_state_cond(dev, DR_SWAP_CHANGE_DR, 0); ++ break; ++ case DR_SWAP_CHANGE_DR: ++ if (port->data_role == TYPEC_HOST) { ++ tcpm_set_roles(dev, true, port->pwr_role, ++ TYPEC_DEVICE); ++ } else { ++ tcpm_set_roles(dev, true, port->pwr_role, ++ TYPEC_HOST); ++ } ++ /* DR_swap process complete, wait_dr_swap_message is cleared */ ++ port->wait_dr_swap_message = false; ++ tcpm_set_state(dev, ready_state(port), 0); ++ break; ++ case ERROR_RECOVERY: ++ tcpm_set_state(dev, PORT_RESET, 0); ++ break; ++ case PORT_RESET: ++ tcpm_reset_port(dev); ++ if (port->self_powered) ++ tcpm_set_cc(dev, TYPEC_CC_OPEN); ++ else ++ tcpm_set_cc(dev, tcpm_default_state(port) == SNK_UNATTACHED ? ++ TYPEC_CC_RD : tcpm_rp_cc(port)); ++ tcpm_set_state(dev, PORT_RESET_WAIT_OFF, ++ PD_T_ERROR_RECOVERY); ++ break; ++ case PORT_RESET_WAIT_OFF: ++ tcpm_set_state(dev, ++ tcpm_default_state(port), ++ port->vbus_present ? PD_T_PS_SOURCE_OFF : 0); ++ break; ++ default: ++ dev_err(dev, "TCPM: Unexpected port state %d\n", port->state); ++ break; ++ } ++} ++ ++static void tcpm_state_machine(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ enum tcpm_state prev_state; ++ ++ mutex_lock(&port->lock); ++ port->state_machine_running = true; ++ ++ if (port->queued_message && tcpm_send_queued_message(dev)) ++ goto done; ++ ++ /* If we were queued due to a delayed state change, update it now */ ++ if (port->delayed_state) { ++ dev_dbg(dev, "TCPM: state change %s -> %s [delayed %ld ms]\n", ++ tcpm_states[port->state], ++ tcpm_states[port->delayed_state], port->delay_ms); ++ port->prev_state = port->state; ++ port->state = port->delayed_state; ++ port->delayed_state = INVALID_STATE; ++ } ++ ++ /* ++ * Continue running as long as we have (non-delayed) state changes ++ * to make. ++ */ ++ do { ++ prev_state = port->state; ++ run_state_machine(dev); ++ if (port->queued_message) ++ tcpm_send_queued_message(dev); ++ } while (port->state != prev_state && !port->delayed_state); ++ ++done: ++ port->state_machine_running = false; ++ mutex_unlock(&port->lock); ++} ++ ++static void _tcpm_cc_change(struct udevice *dev, enum typec_cc_status cc1, ++ enum typec_cc_status cc2) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ enum typec_cc_status old_cc1, old_cc2; ++ enum tcpm_state new_state; ++ ++ old_cc1 = port->cc1; ++ old_cc2 = port->cc2; ++ port->cc1 = cc1; ++ port->cc2 = cc2; ++ ++ dev_dbg(dev, "TCPM: CC1: %u -> %u, CC2: %u -> %u [state %s, polarity %d, %s]\n", ++ old_cc1, cc1, old_cc2, cc2, tcpm_states[port->state], ++ port->polarity, ++ tcpm_port_is_disconnected(port) ? "disconnected" : "connected"); ++ ++ switch (port->state) { ++ case TOGGLING: ++ if (tcpm_port_is_source(port)) ++ tcpm_set_state(dev, SRC_ATTACH_WAIT, 0); ++ else if (tcpm_port_is_sink(port)) ++ tcpm_set_state(dev, SNK_ATTACH_WAIT, 0); ++ break; ++ case SRC_UNATTACHED: ++ case SRC_ATTACH_WAIT: ++ if (tcpm_port_is_disconnected(port)) ++ tcpm_set_state(dev, SRC_UNATTACHED, 0); ++ else if (cc1 != old_cc1 || cc2 != old_cc2) ++ tcpm_set_state(dev, SRC_ATTACH_WAIT, 0); ++ break; ++ case SRC_ATTACHED: ++ case SRC_SEND_CAPABILITIES: ++ case SRC_READY: ++ if (tcpm_port_is_disconnected(port) || ++ !tcpm_port_is_source(port)) ++ tcpm_set_state(dev, SRC_UNATTACHED, 0); ++ break; ++ case SNK_UNATTACHED: ++ if (tcpm_port_is_sink(port)) ++ tcpm_set_state(dev, SNK_ATTACH_WAIT, 0); ++ break; ++ case SNK_ATTACH_WAIT: ++ if ((port->cc1 == TYPEC_CC_OPEN && ++ port->cc2 != TYPEC_CC_OPEN) || ++ (port->cc1 != TYPEC_CC_OPEN && ++ port->cc2 == TYPEC_CC_OPEN)) ++ new_state = SNK_DEBOUNCED; ++ else if (tcpm_port_is_disconnected(port)) ++ new_state = SNK_UNATTACHED; ++ else ++ break; ++ if (new_state != port->delayed_state) ++ tcpm_set_state(dev, SNK_ATTACH_WAIT, 0); ++ break; ++ case SNK_DEBOUNCED: ++ if (tcpm_port_is_disconnected(port)) ++ new_state = SNK_UNATTACHED; ++ else if (port->vbus_present) ++ new_state = tcpm_try_src(port) ? INVALID_STATE : SNK_ATTACHED; ++ else ++ new_state = SNK_UNATTACHED; ++ if (new_state != port->delayed_state) ++ tcpm_set_state(dev, SNK_DEBOUNCED, 0); ++ break; ++ case SNK_READY: ++ if (tcpm_port_is_disconnected(port)) ++ tcpm_set_state(dev, unattached_state(port), 0); ++ else if (!port->pd_capable && ++ (cc1 != old_cc1 || cc2 != old_cc2)) ++ tcpm_set_current_limit(dev, ++ tcpm_get_current_limit(port), ++ 5000); ++ break; ++ ++ case SNK_DISCOVERY: ++ /* CC line is unstable, wait for debounce */ ++ if (tcpm_port_is_disconnected(port)) ++ tcpm_set_state(dev, SNK_DISCOVERY_DEBOUNCE, 0); ++ break; ++ case SNK_DISCOVERY_DEBOUNCE: ++ break; ++ ++ case PORT_RESET: ++ case PORT_RESET_WAIT_OFF: ++ /* ++ * State set back to default mode once the timer completes. ++ * Ignore CC changes here. ++ */ ++ break; ++ default: ++ /* ++ * While acting as sink and auto vbus discharge is enabled, Allow disconnect ++ * to be driven by vbus disconnect. ++ */ ++ if (tcpm_port_is_disconnected(port)) ++ tcpm_set_state(dev, unattached_state(port), 0); ++ break; ++ } ++} ++ ++static void _tcpm_pd_vbus_on(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ dev_dbg(dev, "TCPM: VBUS on event\n"); ++ port->vbus_present = true; ++ /* ++ * When vbus_present is true i.e. Voltage at VBUS is greater than VSAFE5V implicitly ++ * states that vbus is not at VSAFE0V, hence clear the vbus_vsafe0v flag here. ++ */ ++ port->vbus_vsafe0v = false; ++ ++ switch (port->state) { ++ case SNK_TRANSITION_SINK_VBUS: ++ port->explicit_contract = true; ++ tcpm_set_state(dev, SNK_READY, 0); ++ break; ++ case SNK_DISCOVERY: ++ tcpm_set_state(dev, SNK_DISCOVERY, 0); ++ break; ++ case SNK_DEBOUNCED: ++ tcpm_set_state(dev, SNK_ATTACHED, 0); ++ break; ++ case SNK_HARD_RESET_WAIT_VBUS: ++ tcpm_set_state(dev, SNK_HARD_RESET_SINK_ON, 0); ++ break; ++ case SRC_ATTACHED: ++ tcpm_set_state(dev, SRC_STARTUP, 0); ++ break; ++ case SRC_HARD_RESET_VBUS_ON: ++ tcpm_set_state(dev, SRC_STARTUP, 0); ++ break; ++ ++ case PORT_RESET: ++ case PORT_RESET_WAIT_OFF: ++ /* ++ * State set back to default mode once the timer completes. ++ * Ignore vbus changes here. ++ */ ++ break; ++ ++ default: ++ break; ++ } ++} ++ ++static void _tcpm_pd_vbus_off(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ dev_dbg(dev, "TCPM: VBUS off event\n"); ++ port->vbus_present = false; ++ port->vbus_never_low = false; ++ switch (port->state) { ++ case SNK_HARD_RESET_SINK_OFF: ++ tcpm_set_state(dev, SNK_HARD_RESET_WAIT_VBUS, 0); ++ break; ++ case HARD_RESET_SEND: ++ break; ++ case SNK_ATTACH_WAIT: ++ tcpm_set_state(dev, SNK_UNATTACHED, 0); ++ break; ++ ++ case SNK_NEGOTIATE_CAPABILITIES: ++ break; ++ ++ case PORT_RESET_WAIT_OFF: ++ tcpm_set_state(dev, tcpm_default_state(port), 0); ++ break; ++ ++ case PORT_RESET: ++ /* ++ * State set back to default mode once the timer completes. ++ * Ignore vbus changes here. ++ */ ++ break; ++ ++ default: ++ if (port->pwr_role == TYPEC_SINK && port->attached) ++ tcpm_set_state(dev, SNK_UNATTACHED, 0); ++ break; ++ } ++} ++ ++void tcpm_cc_change(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ enum typec_cc_status cc1, cc2; ++ ++ tcpm_reset_event_cnt(dev); ++ if (drvops->get_cc(dev, &cc1, &cc2) == 0) ++ _tcpm_cc_change(dev, cc1, cc2); ++} ++ ++void tcpm_vbus_change(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ bool vbus; ++ ++ tcpm_reset_event_cnt(dev); ++ vbus = drvops->get_vbus(dev); ++ if (vbus) ++ _tcpm_pd_vbus_on(dev); ++ else ++ _tcpm_pd_vbus_off(dev); ++} ++ ++void tcpm_pd_hard_reset(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ tcpm_reset_event_cnt(dev); ++ dev_dbg(dev, "TCPM: Received hard reset\n"); ++ ++ /* If a hard reset message is received during the port reset process, ++ * we should ignore it, that is, do not set port->state to HARD_RESET_START. ++ */ ++ if (port->state == PORT_RESET || port->state == PORT_RESET_WAIT_OFF) ++ return; ++ ++ /* ++ * If we keep receiving hard reset requests, executing the hard reset ++ * must have failed. Revert to error recovery if that happens. ++ */ ++ tcpm_set_state(dev, ++ port->hard_reset_count < PD_N_HARD_RESET_COUNT ? ++ HARD_RESET_START : ERROR_RECOVERY, ++ 0); ++} ++ ++static void tcpm_init(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ enum typec_cc_status cc1, cc2; ++ ++ drvops->init(dev); ++ ++ tcpm_reset_port(dev); ++ ++ /* ++ * XXX ++ * Should possibly wait for VBUS to settle if it was enabled locally ++ * since tcpm_reset_port() will disable VBUS. ++ */ ++ port->vbus_present = drvops->get_vbus(dev); ++ if (port->vbus_present) ++ port->vbus_never_low = true; ++ ++ /* ++ * 1. When vbus_present is true, voltage on VBUS is already at VSAFE5V. ++ * So implicitly vbus_vsafe0v = false. ++ * ++ * 2. When vbus_present is false and TCPC does NOT support querying ++ * vsafe0v status, then, it's best to assume vbus is at VSAFE0V i.e. ++ * vbus_vsafe0v is true. ++ * ++ * 3. When vbus_present is false and TCPC does support querying vsafe0v, ++ * then, query tcpc for vsafe0v status. ++ */ ++ if (port->vbus_present) ++ port->vbus_vsafe0v = false; ++ else ++ port->vbus_vsafe0v = true; ++ ++ tcpm_set_state(dev, tcpm_default_state(port), 0); ++ ++ if (drvops->get_cc(dev, &cc1, &cc2) == 0) ++ _tcpm_cc_change(dev, cc1, cc2); ++} ++ ++static int tcpm_fw_get_caps(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ofnode node; ++ const char *cap_str; ++ int ret; ++ u32 mw; ++ ++ ret = drvops->get_connector_node(dev, &node); ++ if (ret) ++ return ret; ++ ++ cap_str = ofnode_read_string(node, "power-role"); ++ if (!cap_str) ++ return -EINVAL; ++ ++ if (!strcmp("dual", cap_str)) ++ port->typec_type = TYPEC_PORT_DRP; ++ else if (!strcmp("source", cap_str)) ++ port->typec_type = TYPEC_PORT_SRC; ++ else if (!strcmp("sink", cap_str)) ++ port->typec_type = TYPEC_PORT_SNK; ++ else ++ return -EINVAL; ++ ++ port->port_type = port->typec_type; ++ ++ if (port->port_type == TYPEC_PORT_SNK) ++ goto sink; ++ ++ /* Get source pdos */ ++ ret = ofnode_read_size(node, "source-pdos") / sizeof(u32); ++ if (ret <= 0) ++ return -EINVAL; ++ ++ port->nr_src_pdo = min(ret, PDO_MAX_OBJECTS); ++ ret = ofnode_read_u32_array(node, "source-pdos", ++ port->src_pdo, port->nr_src_pdo); ++ if (ret || tcpm_validate_caps(dev, port->src_pdo, port->nr_src_pdo)) ++ return -EINVAL; ++ ++ if (port->port_type == TYPEC_PORT_SRC) ++ return 0; ++ ++ /* Get the preferred power role for DRP */ ++ cap_str = ofnode_read_string(node, "try-power-role"); ++ if (!cap_str) ++ return -EINVAL; ++ ++ if (!strcmp("sink", cap_str)) ++ port->typec_prefer_role = TYPEC_SINK; ++ else if (!strcmp("source", cap_str)) ++ port->typec_prefer_role = TYPEC_SOURCE; ++ else ++ return -EINVAL; ++ ++ if (port->typec_prefer_role < 0) ++ return -EINVAL; ++sink: ++ /* Get sink pdos */ ++ ret = ofnode_read_size(node, "sink-pdos") / sizeof(u32); ++ if (ret <= 0) ++ return -EINVAL; ++ ++ port->nr_snk_pdo = min(ret, PDO_MAX_OBJECTS); ++ ret = ofnode_read_u32_array(node, "sink-pdos", ++ port->snk_pdo, port->nr_snk_pdo); ++ if (ret || tcpm_validate_caps(dev, port->snk_pdo, port->nr_snk_pdo)) ++ return -EINVAL; ++ ++ if (ofnode_read_u32_array(node, "op-sink-microwatt", &mw, 1)) ++ return -EINVAL; ++ port->operating_snk_mw = mw / 1000; ++ ++ port->self_powered = ofnode_read_bool(node, "self-powered"); ++ ++ return 0; ++} ++ ++static int tcpm_port_init(struct udevice *dev) ++{ ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ int err; ++ ++ err = tcpm_fw_get_caps(dev); ++ if (err < 0) { ++ dev_err(dev, "TCPM: please check the dts config: %d\n", err); ++ return err; ++ } ++ ++ port->try_role = port->typec_prefer_role; ++ port->port_type = port->typec_type; ++ ++ tcpm_init(dev); ++ ++ dev_info(dev, "TCPM: init finished\n"); ++ ++ return 0; ++} ++ ++static void tcpm_poll_event(struct udevice *dev) ++{ ++ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); ++ struct tcpm_port *port = dev_get_uclass_plat(dev); ++ ++ if (!drvops->get_vbus(dev)) ++ return; ++ ++ while (port->poll_event_cnt < TCPM_POLL_EVENT_TIME_OUT) { ++ if (!port->wait_dr_swap_message && ++ (port->state == SNK_READY || port->state == SRC_READY)) ++ break; ++ ++ drvops->poll_event(dev); ++ port->poll_event_cnt++; ++ udelay(500); ++ tcpm_check_and_run_delayed_work(dev); ++ } ++ ++ if (port->state != SNK_READY && port->state != SRC_READY) ++ dev_warn(dev, "TCPM: exit in state %s\n", ++ tcpm_states[port->state]); ++ ++ /* ++ * At this time, call the callback function of the respective pd chip ++ * to enter the low-power mode. In order to reduce the time spent on ++ * the PD chip driver as much as possible, the tcpm framework does not ++ * fully process the communication initiated by the device,so it should ++ * be noted that we can disable the internal oscillator, etc., but do ++ * not turn off the power of the transceiver module, otherwise the ++ * self-powered Type-C device will initiate a Message(eg: self-powered ++ * Type-C hub initiates a SINK capability request(PD_CTRL_GET_SINK_CAP)) ++ * and the pd chip cannot reply to GoodCRC, causing the self-powered Type-C ++ * device to switch vbus to vSafe5v, or even turn off vbus. ++ */ ++ if (!drvops->enter_low_power_mode) ++ return; ++ ++ if (drvops->enter_low_power_mode(dev, port->attached, port->pd_capable)) ++ dev_err(dev, "TCPM: failed to enter low power\n"); ++ else ++ dev_info(dev, "TCPM: PD chip enter low power mode\n"); ++} ++ ++int tcpm_post_probe(struct udevice *dev) ++{ ++ int ret = tcpm_port_init(dev); ++ ++ if (ret < 0) { ++ dev_err(dev, "failed to tcpm port init\n"); ++ return ret; ++ } ++ ++ tcpm_poll_event(dev); ++ ++ return 0; ++} +diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h +index 5271e646bb16..270088ad94f7 100644 +--- a/include/dm/uclass-id.h ++++ b/include/dm/uclass-id.h +@@ -139,6 +139,7 @@ enum uclass_id { + UCLASS_SYSCON, /* System configuration device */ + UCLASS_SYSINFO, /* Device information from hardware */ + UCLASS_SYSRESET, /* System reset device */ ++ UCLASS_TCPM, /* TypeC port manager */ + UCLASS_TEE, /* Trusted Execution Environment device */ + UCLASS_THERMAL, /* Thermal sensor */ + UCLASS_TIMER, /* Timer device */ +diff --git a/include/usb/pd.h b/include/usb/pd.h +new file mode 100644 +index 000000000000..cacda322d7c6 +--- /dev/null ++++ b/include/usb/pd.h +@@ -0,0 +1,516 @@ ++/* SPDX-License-Identifier: GPL-2.0-or-later */ ++/* ++ * Copyright 2015-2017 Google, Inc ++ */ ++ ++#ifndef __LINUX_USB_PD_H ++#define __LINUX_USB_PD_H ++ ++#include ++#include ++ ++enum typec_port_type { ++ TYPEC_PORT_SRC, ++ TYPEC_PORT_SNK, ++ TYPEC_PORT_DRP, ++}; ++ ++enum typec_data_role { ++ TYPEC_DEVICE, ++ TYPEC_HOST, ++}; ++ ++enum typec_role { ++ TYPEC_SINK, ++ TYPEC_SOURCE, ++}; ++ ++/* USB PD Messages */ ++enum pd_ctrl_msg_type { ++ /* 0 Reserved */ ++ PD_CTRL_GOOD_CRC = 1, ++ PD_CTRL_GOTO_MIN = 2, ++ PD_CTRL_ACCEPT = 3, ++ PD_CTRL_REJECT = 4, ++ PD_CTRL_PING = 5, ++ PD_CTRL_PS_RDY = 6, ++ PD_CTRL_GET_SOURCE_CAP = 7, ++ PD_CTRL_GET_SINK_CAP = 8, ++ PD_CTRL_DR_SWAP = 9, ++ PD_CTRL_PR_SWAP = 10, ++ PD_CTRL_VCONN_SWAP = 11, ++ PD_CTRL_WAIT = 12, ++ PD_CTRL_SOFT_RESET = 13, ++ /* 14-15 Reserved */ ++ PD_CTRL_NOT_SUPP = 16, ++ PD_CTRL_GET_SOURCE_CAP_EXT = 17, ++ PD_CTRL_GET_STATUS = 18, ++ PD_CTRL_FR_SWAP = 19, ++ PD_CTRL_GET_PPS_STATUS = 20, ++ PD_CTRL_GET_COUNTRY_CODES = 21, ++ /* 22-31 Reserved */ ++}; ++ ++enum pd_data_msg_type { ++ /* 0 Reserved */ ++ PD_DATA_SOURCE_CAP = 1, ++ PD_DATA_REQUEST = 2, ++ PD_DATA_BIST = 3, ++ PD_DATA_SINK_CAP = 4, ++ PD_DATA_BATT_STATUS = 5, ++ PD_DATA_ALERT = 6, ++ PD_DATA_GET_COUNTRY_INFO = 7, ++ PD_DATA_ENTER_USB = 8, ++ /* 9-14 Reserved */ ++ PD_DATA_VENDOR_DEF = 15, ++ /* 16-31 Reserved */ ++}; ++ ++enum pd_ext_msg_type { ++ /* 0 Reserved */ ++ PD_EXT_SOURCE_CAP_EXT = 1, ++ PD_EXT_STATUS = 2, ++ PD_EXT_GET_BATT_CAP = 3, ++ PD_EXT_GET_BATT_STATUS = 4, ++ PD_EXT_BATT_CAP = 5, ++ PD_EXT_GET_MANUFACTURER_INFO = 6, ++ PD_EXT_MANUFACTURER_INFO = 7, ++ PD_EXT_SECURITY_REQUEST = 8, ++ PD_EXT_SECURITY_RESPONSE = 9, ++ PD_EXT_FW_UPDATE_REQUEST = 10, ++ PD_EXT_FW_UPDATE_RESPONSE = 11, ++ PD_EXT_PPS_STATUS = 12, ++ PD_EXT_COUNTRY_INFO = 13, ++ PD_EXT_COUNTRY_CODES = 14, ++ /* 15-31 Reserved */ ++}; ++ ++#define PD_REV10 0x0 ++#define PD_REV20 0x1 ++#define PD_REV30 0x2 ++#define PD_MAX_REV PD_REV30 ++ ++#define PD_HEADER_EXT_HDR BIT(15) ++#define PD_HEADER_CNT_SHIFT 12 ++#define PD_HEADER_CNT_MASK 0x7 ++#define PD_HEADER_ID_SHIFT 9 ++#define PD_HEADER_ID_MASK 0x7 ++#define PD_HEADER_PWR_ROLE BIT(8) ++#define PD_HEADER_REV_SHIFT 6 ++#define PD_HEADER_REV_MASK 0x3 ++#define PD_HEADER_DATA_ROLE BIT(5) ++#define PD_HEADER_TYPE_SHIFT 0 ++#define PD_HEADER_TYPE_MASK 0x1f ++ ++#define PD_HEADER(type, pwr, data, rev, id, cnt, ext_hdr) \ ++ ((((type) & PD_HEADER_TYPE_MASK) << PD_HEADER_TYPE_SHIFT) | \ ++ ((pwr) == TYPEC_SOURCE ? PD_HEADER_PWR_ROLE : 0) | \ ++ ((data) == TYPEC_HOST ? PD_HEADER_DATA_ROLE : 0) | \ ++ ((rev) << PD_HEADER_REV_SHIFT) | \ ++ (((id) & PD_HEADER_ID_MASK) << PD_HEADER_ID_SHIFT) | \ ++ (((cnt) & PD_HEADER_CNT_MASK) << PD_HEADER_CNT_SHIFT) | \ ++ ((ext_hdr) ? PD_HEADER_EXT_HDR : 0)) ++ ++#define PD_HEADER_LE(type, pwr, data, rev, id, cnt) \ ++ cpu_to_le16(PD_HEADER((type), (pwr), (data), (rev), (id), (cnt), (0))) ++ ++static inline unsigned int pd_header_cnt(u16 header) ++{ ++ return (header >> PD_HEADER_CNT_SHIFT) & PD_HEADER_CNT_MASK; ++} ++ ++static inline unsigned int pd_header_cnt_le(__le16 header) ++{ ++ return pd_header_cnt(le16_to_cpu(header)); ++} ++ ++static inline unsigned int pd_header_type(u16 header) ++{ ++ return (header >> PD_HEADER_TYPE_SHIFT) & PD_HEADER_TYPE_MASK; ++} ++ ++static inline unsigned int pd_header_type_le(__le16 header) ++{ ++ return pd_header_type(le16_to_cpu(header)); ++} ++ ++static inline unsigned int pd_header_msgid(u16 header) ++{ ++ return (header >> PD_HEADER_ID_SHIFT) & PD_HEADER_ID_MASK; ++} ++ ++static inline unsigned int pd_header_msgid_le(__le16 header) ++{ ++ return pd_header_msgid(le16_to_cpu(header)); ++} ++ ++static inline unsigned int pd_header_rev(u16 header) ++{ ++ return (header >> PD_HEADER_REV_SHIFT) & PD_HEADER_REV_MASK; ++} ++ ++static inline unsigned int pd_header_rev_le(__le16 header) ++{ ++ return pd_header_rev(le16_to_cpu(header)); ++} ++ ++#define PD_EXT_HDR_CHUNKED BIT(15) ++#define PD_EXT_HDR_CHUNK_NUM_SHIFT 11 ++#define PD_EXT_HDR_CHUNK_NUM_MASK 0xf ++#define PD_EXT_HDR_REQ_CHUNK BIT(10) ++#define PD_EXT_HDR_DATA_SIZE_SHIFT 0 ++#define PD_EXT_HDR_DATA_SIZE_MASK 0x1ff ++ ++#define PD_EXT_HDR(data_size, req_chunk, chunk_num, chunked) \ ++ ((((data_size) & PD_EXT_HDR_DATA_SIZE_MASK) << PD_EXT_HDR_DATA_SIZE_SHIFT) | \ ++ ((req_chunk) ? PD_EXT_HDR_REQ_CHUNK : 0) | \ ++ (((chunk_num) & PD_EXT_HDR_CHUNK_NUM_MASK) << PD_EXT_HDR_CHUNK_NUM_SHIFT) | \ ++ ((chunked) ? PD_EXT_HDR_CHUNKED : 0)) ++ ++#define PD_EXT_HDR_LE(data_size, req_chunk, chunk_num, chunked) \ ++ cpu_to_le16(PD_EXT_HDR((data_size), (req_chunk), (chunk_num), (chunked))) ++ ++static inline unsigned int pd_ext_header_chunk_num(u16 ext_header) ++{ ++ return (ext_header >> PD_EXT_HDR_CHUNK_NUM_SHIFT) & ++ PD_EXT_HDR_CHUNK_NUM_MASK; ++} ++ ++static inline unsigned int pd_ext_header_data_size(u16 ext_header) ++{ ++ return (ext_header >> PD_EXT_HDR_DATA_SIZE_SHIFT) & ++ PD_EXT_HDR_DATA_SIZE_MASK; ++} ++ ++static inline unsigned int pd_ext_header_data_size_le(__le16 ext_header) ++{ ++ return pd_ext_header_data_size(le16_to_cpu(ext_header)); ++} ++ ++#define PD_MAX_PAYLOAD 7 ++#define PD_EXT_MAX_CHUNK_DATA 26 ++ ++/* ++ * struct pd_chunked_ext_message_data - PD chunked extended message data as ++ * seen on wire ++ * @header: PD extended message header ++ * @data: PD extended message data ++ */ ++struct pd_chunked_ext_message_data { ++ __le16 header; ++ u8 data[PD_EXT_MAX_CHUNK_DATA]; ++} __packed; ++ ++/* ++ * struct pd_message - PD message as seen on wire ++ * @header: PD message header ++ * @payload: PD message payload ++ * @ext_msg: PD message chunked extended message data ++ */ ++struct pd_message { ++ __le16 header; ++ union { ++ __le32 payload[PD_MAX_PAYLOAD]; ++ struct pd_chunked_ext_message_data ext_msg; ++ }; ++} __packed; ++ ++/* PDO: Power Data Object */ ++#define PDO_MAX_OBJECTS 7 ++ ++enum pd_pdo_type { ++ PDO_TYPE_FIXED = 0, ++ PDO_TYPE_BATT = 1, ++ PDO_TYPE_VAR = 2, ++ PDO_TYPE_APDO = 3, ++}; ++ ++#define PDO_TYPE_SHIFT 30 ++#define PDO_TYPE_MASK 0x3 ++ ++#define PDO_TYPE(t) ((t) << PDO_TYPE_SHIFT) ++ ++#define PDO_VOLT_MASK 0x3ff ++#define PDO_CURR_MASK 0x3ff ++#define PDO_PWR_MASK 0x3ff ++ ++#define PDO_FIXED_DUAL_ROLE BIT(29) /* Power role swap supported */ ++#define PDO_FIXED_SUSPEND BIT(28) /* USB Suspend supported (Source) */ ++#define PDO_FIXED_HIGHER_CAP BIT(28) /* Requires more than vSafe5V (Sink) */ ++#define PDO_FIXED_EXTPOWER BIT(27) /* Externally powered */ ++#define PDO_FIXED_USB_COMM BIT(26) /* USB communications capable */ ++#define PDO_FIXED_DATA_SWAP BIT(25) /* Data role swap supported */ ++#define PDO_FIXED_UNCHUNK_EXT BIT(24) /* Unchunked Extended Message supported (Source) */ ++#define PDO_FIXED_FRS_CURR_MASK (BIT(24) | BIT(23)) /* FR_Swap Current (Sink) */ ++#define PDO_FIXED_FRS_CURR_SHIFT 23 ++#define PDO_FIXED_VOLT_SHIFT 10 /* 50mV units */ ++#define PDO_FIXED_CURR_SHIFT 0 /* 10mA units */ ++ ++#define PDO_FIXED_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_FIXED_VOLT_SHIFT) ++#define PDO_FIXED_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_FIXED_CURR_SHIFT) ++ ++#define PDO_FIXED(mv, ma, flags) \ ++ (PDO_TYPE(PDO_TYPE_FIXED) | (flags) | \ ++ PDO_FIXED_VOLT(mv) | PDO_FIXED_CURR(ma)) ++ ++#define VSAFE5V 5000 /* mv units */ ++ ++#define PDO_BATT_MAX_VOLT_SHIFT 20 /* 50mV units */ ++#define PDO_BATT_MIN_VOLT_SHIFT 10 /* 50mV units */ ++#define PDO_BATT_MAX_PWR_SHIFT 0 /* 250mW units */ ++ ++#define PDO_BATT_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MIN_VOLT_SHIFT) ++#define PDO_BATT_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MAX_VOLT_SHIFT) ++#define PDO_BATT_MAX_POWER(mw) ((((mw) / 250) & PDO_PWR_MASK) << PDO_BATT_MAX_PWR_SHIFT) ++ ++#define PDO_BATT(min_mv, max_mv, max_mw) \ ++ (PDO_TYPE(PDO_TYPE_BATT) | PDO_BATT_MIN_VOLT(min_mv) | \ ++ PDO_BATT_MAX_VOLT(max_mv) | PDO_BATT_MAX_POWER(max_mw)) ++ ++#define PDO_VAR_MAX_VOLT_SHIFT 20 /* 50mV units */ ++#define PDO_VAR_MIN_VOLT_SHIFT 10 /* 50mV units */ ++#define PDO_VAR_MAX_CURR_SHIFT 0 /* 10mA units */ ++ ++#define PDO_VAR_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT) ++#define PDO_VAR_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MAX_VOLT_SHIFT) ++#define PDO_VAR_MAX_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_VAR_MAX_CURR_SHIFT) ++ ++#define PDO_VAR(min_mv, max_mv, max_ma) \ ++ (PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) | \ ++ PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma)) ++ ++enum pd_apdo_type { ++ APDO_TYPE_PPS = 0, ++}; ++ ++#define PDO_APDO_TYPE_SHIFT 28 /* Only valid value currently is 0x0 - PPS */ ++#define PDO_APDO_TYPE_MASK 0x3 ++ ++#define PDO_APDO_TYPE(t) ((t) << PDO_APDO_TYPE_SHIFT) ++ ++#define PDO_PPS_APDO_MAX_VOLT_SHIFT 17 /* 100mV units */ ++#define PDO_PPS_APDO_MIN_VOLT_SHIFT 8 /* 100mV units */ ++#define PDO_PPS_APDO_MAX_CURR_SHIFT 0 /* 50mA units */ ++ ++#define PDO_PPS_APDO_VOLT_MASK 0xff ++#define PDO_PPS_APDO_CURR_MASK 0x7f ++ ++#define PDO_PPS_APDO_MIN_VOLT(mv) \ ++ ((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MIN_VOLT_SHIFT) ++#define PDO_PPS_APDO_MAX_VOLT(mv) \ ++ ((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MAX_VOLT_SHIFT) ++#define PDO_PPS_APDO_MAX_CURR(ma) \ ++ ((((ma) / 50) & PDO_PPS_APDO_CURR_MASK) << PDO_PPS_APDO_MAX_CURR_SHIFT) ++ ++#define PDO_PPS_APDO(min_mv, max_mv, max_ma) \ ++ (PDO_TYPE(PDO_TYPE_APDO) | PDO_APDO_TYPE(APDO_TYPE_PPS) | \ ++ PDO_PPS_APDO_MIN_VOLT(min_mv) | PDO_PPS_APDO_MAX_VOLT(max_mv) | \ ++ PDO_PPS_APDO_MAX_CURR(max_ma)) ++ ++static inline enum pd_pdo_type pdo_type(u32 pdo) ++{ ++ return (pdo >> PDO_TYPE_SHIFT) & PDO_TYPE_MASK; ++} ++ ++static inline unsigned int pdo_fixed_voltage(u32 pdo) ++{ ++ return ((pdo >> PDO_FIXED_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; ++} ++ ++static inline unsigned int pdo_min_voltage(u32 pdo) ++{ ++ return ((pdo >> PDO_VAR_MIN_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; ++} ++ ++static inline unsigned int pdo_max_voltage(u32 pdo) ++{ ++ return ((pdo >> PDO_VAR_MAX_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; ++} ++ ++static inline unsigned int pdo_max_current(u32 pdo) ++{ ++ return ((pdo >> PDO_VAR_MAX_CURR_SHIFT) & PDO_CURR_MASK) * 10; ++} ++ ++static inline unsigned int pdo_max_power(u32 pdo) ++{ ++ return ((pdo >> PDO_BATT_MAX_PWR_SHIFT) & PDO_PWR_MASK) * 250; ++} ++ ++static inline enum pd_apdo_type pdo_apdo_type(u32 pdo) ++{ ++ return (pdo >> PDO_APDO_TYPE_SHIFT) & PDO_APDO_TYPE_MASK; ++} ++ ++static inline unsigned int pdo_pps_apdo_min_voltage(u32 pdo) ++{ ++ return ((pdo >> PDO_PPS_APDO_MIN_VOLT_SHIFT) & ++ PDO_PPS_APDO_VOLT_MASK) * 100; ++} ++ ++static inline unsigned int pdo_pps_apdo_max_voltage(u32 pdo) ++{ ++ return ((pdo >> PDO_PPS_APDO_MAX_VOLT_SHIFT) & ++ PDO_PPS_APDO_VOLT_MASK) * 100; ++} ++ ++static inline unsigned int pdo_pps_apdo_max_current(u32 pdo) ++{ ++ return ((pdo >> PDO_PPS_APDO_MAX_CURR_SHIFT) & ++ PDO_PPS_APDO_CURR_MASK) * 50; ++} ++ ++/* RDO: Request Data Object */ ++#define RDO_OBJ_POS_SHIFT 28 ++#define RDO_OBJ_POS_MASK 0x7 ++#define RDO_GIVE_BACK BIT(27) /* Supports reduced operating current */ ++#define RDO_CAP_MISMATCH BIT(26) /* Not satisfied by source caps */ ++#define RDO_USB_COMM BIT(25) /* USB communications capable */ ++#define RDO_NO_SUSPEND BIT(24) /* USB Suspend not supported */ ++ ++#define RDO_PWR_MASK 0x3ff ++#define RDO_CURR_MASK 0x3ff ++ ++#define RDO_FIXED_OP_CURR_SHIFT 10 ++#define RDO_FIXED_MAX_CURR_SHIFT 0 ++ ++#define RDO_OBJ(idx) (((idx) & RDO_OBJ_POS_MASK) << RDO_OBJ_POS_SHIFT) ++ ++#define PDO_FIXED_OP_CURR(ma) ((((ma) / 10) & RDO_CURR_MASK) << RDO_FIXED_OP_CURR_SHIFT) ++#define PDO_FIXED_MAX_CURR(ma) ((((ma) / 10) & RDO_CURR_MASK) << RDO_FIXED_MAX_CURR_SHIFT) ++ ++#define RDO_FIXED(idx, op_ma, max_ma, flags) \ ++ (RDO_OBJ(idx) | (flags) | \ ++ PDO_FIXED_OP_CURR(op_ma) | PDO_FIXED_MAX_CURR(max_ma)) ++ ++#define RDO_BATT_OP_PWR_SHIFT 10 /* 250mW units */ ++#define RDO_BATT_MAX_PWR_SHIFT 0 /* 250mW units */ ++ ++#define RDO_BATT_OP_PWR(mw) ((((mw) / 250) & RDO_PWR_MASK) << RDO_BATT_OP_PWR_SHIFT) ++#define RDO_BATT_MAX_PWR(mw) ((((mw) / 250) & RDO_PWR_MASK) << RDO_BATT_MAX_PWR_SHIFT) ++ ++#define RDO_BATT(idx, op_mw, max_mw, flags) \ ++ (RDO_OBJ(idx) | (flags) | \ ++ RDO_BATT_OP_PWR(op_mw) | RDO_BATT_MAX_PWR(max_mw)) ++ ++#define RDO_PROG_VOLT_MASK 0x7ff ++#define RDO_PROG_CURR_MASK 0x7f ++ ++#define RDO_PROG_VOLT_SHIFT 9 ++#define RDO_PROG_CURR_SHIFT 0 ++ ++#define RDO_PROG_VOLT_MV_STEP 20 ++#define RDO_PROG_CURR_MA_STEP 50 ++ ++#define PDO_PROG_OUT_VOLT(mv) \ ++ ((((mv) / RDO_PROG_VOLT_MV_STEP) & RDO_PROG_VOLT_MASK) << RDO_PROG_VOLT_SHIFT) ++#define PDO_PROG_OP_CURR(ma) \ ++ ((((ma) / RDO_PROG_CURR_MA_STEP) & RDO_PROG_CURR_MASK) << RDO_PROG_CURR_SHIFT) ++ ++#define RDO_PROG(idx, out_mv, op_ma, flags) \ ++ (RDO_OBJ(idx) | (flags) | \ ++ PDO_PROG_OUT_VOLT(out_mv) | PDO_PROG_OP_CURR(op_ma)) ++ ++static inline unsigned int rdo_index(u32 rdo) ++{ ++ return (rdo >> RDO_OBJ_POS_SHIFT) & RDO_OBJ_POS_MASK; ++} ++ ++static inline unsigned int rdo_op_current(u32 rdo) ++{ ++ return ((rdo >> RDO_FIXED_OP_CURR_SHIFT) & RDO_CURR_MASK) * 10; ++} ++ ++static inline unsigned int rdo_max_current(u32 rdo) ++{ ++ return ((rdo >> RDO_FIXED_MAX_CURR_SHIFT) & ++ RDO_CURR_MASK) * 10; ++} ++ ++static inline unsigned int rdo_op_power(u32 rdo) ++{ ++ return ((rdo >> RDO_BATT_OP_PWR_SHIFT) & RDO_PWR_MASK) * 250; ++} ++ ++static inline unsigned int rdo_max_power(u32 rdo) ++{ ++ return ((rdo >> RDO_BATT_MAX_PWR_SHIFT) & RDO_PWR_MASK) * 250; ++} ++ ++/* Enter_USB Data Object */ ++#define EUDO_USB_MODE_MASK GENMASK(30, 28) ++#define EUDO_USB_MODE_SHIFT 28 ++#define EUDO_USB_MODE_USB2 0 ++#define EUDO_USB_MODE_USB3 1 ++#define EUDO_USB_MODE_USB4 2 ++#define EUDO_USB4_DRD BIT(26) ++#define EUDO_USB3_DRD BIT(25) ++#define EUDO_CABLE_SPEED_MASK GENMASK(23, 21) ++#define EUDO_CABLE_SPEED_SHIFT 21 ++#define EUDO_CABLE_SPEED_USB2 0 ++#define EUDO_CABLE_SPEED_USB3_GEN1 1 ++#define EUDO_CABLE_SPEED_USB4_GEN2 2 ++#define EUDO_CABLE_SPEED_USB4_GEN3 3 ++#define EUDO_CABLE_TYPE_MASK GENMASK(20, 19) ++#define EUDO_CABLE_TYPE_SHIFT 19 ++#define EUDO_CABLE_TYPE_PASSIVE 0 ++#define EUDO_CABLE_TYPE_RE_TIMER 1 ++#define EUDO_CABLE_TYPE_RE_DRIVER 2 ++#define EUDO_CABLE_TYPE_OPTICAL 3 ++#define EUDO_CABLE_CURRENT_MASK GENMASK(18, 17) ++#define EUDO_CABLE_CURRENT_SHIFT 17 ++#define EUDO_CABLE_CURRENT_NOTSUPP 0 ++#define EUDO_CABLE_CURRENT_3A 2 ++#define EUDO_CABLE_CURRENT_5A 3 ++#define EUDO_PCIE_SUPPORT BIT(16) ++#define EUDO_DP_SUPPORT BIT(15) ++#define EUDO_TBT_SUPPORT BIT(14) ++#define EUDO_HOST_PRESENT BIT(13) ++ ++/* USB PD timers and counters */ ++#define PD_T_NO_RESPONSE 5000 /* 4.5 - 5.5 seconds */ ++#define PD_T_DB_DETECT 10000 /* 10 - 15 seconds */ ++#define PD_T_SEND_SOURCE_CAP 150 /* 100 - 200 ms */ ++#define PD_T_SENDER_RESPONSE 60 /* 24 - 30 ms, relaxed */ ++#define PD_T_RECEIVER_RESPONSE 15 /* 15ms max */ ++#define PD_T_SOURCE_ACTIVITY 45 ++#define PD_T_SINK_ACTIVITY 135 ++#define PD_T_SINK_WAIT_CAP 310 /* 310 - 620 ms */ ++#define PD_T_PS_TRANSITION 500 ++#define PD_T_SRC_TRANSITION 35 ++#define PD_T_DRP_SNK 40 ++#define PD_T_DRP_SRC 30 ++#define PD_T_PS_SOURCE_OFF 920 ++#define PD_T_PS_SOURCE_ON 480 ++#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */ ++#define PD_T_PS_HARD_RESET 30 ++#define PD_T_SRC_RECOVER 760 ++#define PD_T_SRC_RECOVER_MAX 1000 ++#define PD_T_SRC_TURN_ON 275 ++#define PD_T_SAFE_0V 650 ++#define PD_T_VCONN_SOURCE_ON 100 ++#define PD_T_SINK_REQUEST 100 /* 100 ms minimum */ ++#define PD_T_ERROR_RECOVERY 100 /* minimum 25 is insufficient */ ++#define PD_T_SRCSWAPSTDBY 625 /* Maximum of 650ms */ ++#define PD_T_NEWSRC 250 /* Maximum of 275ms */ ++#define PD_T_SWAP_SRC_START 20 /* Minimum of 20ms */ ++#define PD_T_BIST_CONT_MODE 50 /* 30 - 60 ms */ ++#define PD_T_SINK_TX 16 /* 16 - 20 ms */ ++#define PD_T_CHUNK_NOT_SUPP 42 /* 40 - 50 ms */ ++ ++#define PD_T_DRP_TRY 100 /* 75 - 150 ms */ ++#define PD_T_DRP_TRYWAIT 600 /* 400 - 800 ms */ ++ ++#define PD_T_CC_DEBOUNCE 200 /* 100 - 200 ms */ ++#define PD_T_PD_DEBOUNCE 20 /* 10 - 20 ms */ ++#define PD_T_TRY_CC_DEBOUNCE 15 /* 10 - 20 ms */ ++ ++#define PD_N_CAPS_COUNT (PD_T_NO_RESPONSE / PD_T_SEND_SOURCE_CAP) ++#define PD_N_HARD_RESET_COUNT 1 ++ ++#define PD_P_SNK_STDBY_MW 2500 /* 2500 mW */ ++ ++/* Time to wait for TCPC to complete transmit */ ++#define PD_T_TCPC_TX_TIMEOUT 100 /* in ms */ ++ ++#endif /* __LINUX_USB_PD_H */ +diff --git a/include/usb/tcpm.h b/include/usb/tcpm.h +new file mode 100644 +index 000000000000..4574a5175ddb +--- /dev/null ++++ b/include/usb/tcpm.h +@@ -0,0 +1,99 @@ ++/* SPDX-License-Identifier: GPL-2.0-or-later */ ++/* ++ * Copyright 2015-2017 Google, Inc ++ * Copyright 2024 Collabora ++ */ ++ ++#ifndef __LINUX_USB_TCPM_H ++#define __LINUX_USB_TCPM_H ++ ++#include ++#include ++#include "pd.h" ++ ++enum typec_orientation { ++ TYPEC_ORIENTATION_NONE, ++ TYPEC_ORIENTATION_NORMAL, ++ TYPEC_ORIENTATION_REVERSE, ++}; ++ ++enum typec_cc_status { ++ TYPEC_CC_OPEN, ++ TYPEC_CC_RA, ++ TYPEC_CC_RD, ++ TYPEC_CC_RP_DEF, ++ TYPEC_CC_RP_1_5, ++ TYPEC_CC_RP_3_0, ++}; ++ ++enum typec_cc_polarity { ++ TYPEC_POLARITY_CC1, ++ TYPEC_POLARITY_CC2, ++}; ++ ++enum tcpm_transmit_status { ++ TCPC_TX_SUCCESS = 0, ++ TCPC_TX_DISCARDED = 1, ++ TCPC_TX_FAILED = 2, ++}; ++ ++enum tcpm_transmit_type { ++ TCPC_TX_SOP = 0, ++ TCPC_TX_SOP_PRIME = 1, ++ TCPC_TX_SOP_PRIME_PRIME = 2, ++ TCPC_TX_SOP_DEBUG_PRIME = 3, ++ TCPC_TX_SOP_DEBUG_PRIME_PRIME = 4, ++ TCPC_TX_HARD_RESET = 5, ++ TCPC_TX_CABLE_RESET = 6, ++ TCPC_TX_BIST_MODE_2 = 7 ++}; ++ ++struct dm_tcpm_ops { ++ int (*get_connector_node)(struct udevice *dev, ofnode *connector_node); ++ int (*init)(struct udevice *dev); ++ int (*get_vbus)(struct udevice *dev); ++ int (*set_cc)(struct udevice *dev, enum typec_cc_status cc); ++ int (*get_cc)(struct udevice *dev, enum typec_cc_status *cc1, ++ enum typec_cc_status *cc2); ++ int (*set_polarity)(struct udevice *dev, ++ enum typec_cc_polarity polarity); ++ int (*set_vconn)(struct udevice *dev, bool on); ++ int (*set_vbus)(struct udevice *dev, bool on, bool charge); ++ int (*set_pd_rx)(struct udevice *dev, bool on); ++ int (*set_roles)(struct udevice *dev, bool attached, ++ enum typec_role role, enum typec_data_role data); ++ int (*start_toggling)(struct udevice *dev, ++ enum typec_port_type port_type, ++ enum typec_cc_status cc); ++ int (*pd_transmit)(struct udevice *dev, enum tcpm_transmit_type type, ++ const struct pd_message *msg, unsigned int negotiated_rev); ++ void (*poll_event)(struct udevice *dev); ++ int (*enter_low_power_mode)(struct udevice *dev, bool attached, bool pd_capable); ++}; ++ ++/* API for drivers */ ++void tcpm_vbus_change(struct udevice *dev); ++void tcpm_cc_change(struct udevice *dev); ++void tcpm_pd_receive(struct udevice *dev, const struct pd_message *msg); ++void tcpm_pd_transmit_complete(struct udevice *dev, ++ enum tcpm_transmit_status status); ++void tcpm_pd_hard_reset(struct udevice *dev); ++ ++/* API for boards */ ++extern const char * const typec_pd_rev_name[]; ++extern const char * const typec_orientation_name[]; ++extern const char * const typec_role_name[]; ++extern const char * const typec_data_role_name[]; ++extern const char * const typec_cc_status_name[]; ++ ++int tcpm_get(const char *name, struct udevice **devp); ++int tcpm_get_pd_rev(struct udevice *dev); ++int tcpm_get_current(struct udevice *dev); ++int tcpm_get_voltage(struct udevice *dev); ++enum typec_orientation tcpm_get_orientation(struct udevice *dev); ++enum typec_role tcpm_get_pwr_role(struct udevice *dev); ++enum typec_data_role tcpm_get_data_role(struct udevice *dev); ++bool tcpm_is_connected(struct udevice *dev); ++const char *tcpm_get_state(struct udevice *dev); ++ ++#endif /* __LINUX_USB_TCPM_H */ + +From patchwork Thu Sep 5 15:08:38 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sebastian Reichel +X-Patchwork-Id: 1981316 +X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com + header.a=rsa-sha256 header.s=mail header.b=d3aozlfW; + 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 4X030913Sdz1yXY + for ; Fri, 6 Sep 2024 01:18:17 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 4C12888CC2; + Thu, 5 Sep 2024 17:17:19 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com + header.b="d3aozlfW"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id F400788CC2; Thu, 5 Sep 2024 17:17:17 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from bali.collaboradmins.com (bali.collaboradmins.com + [IPv6:2a01:4f8:201:9162::2]) + (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 4C6CB88CB8 + for ; Thu, 5 Sep 2024 17:17:13 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sebastian.reichel@collabora.com +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; + s=mail; t=1725549433; + bh=fuHT4MalSjyQfKUjWdVq0nVnduu/AbWGeUChYJaCIeY=; + h=From:To:Cc:Subject:Date:In-Reply-To:References:From; + b=d3aozlfWwAG+KQBk/EM6vpvcIoIEEksahdSc+LhMi76PX8NNsu3zOQomQcug5dlmD + kqV/SDj3yszJBox46C1h2pfHNNLn7CD/u95G6BwH0A4cv33ZsWN3fEhJQKbkS9sUOB + hFzSWoKr7kCx/KDvBcjoS9Q5063JFZ6CJ1MF7XGgxT3H7WOMEybvC26Mp+j1/c1HNn + vWSjbh5lkW/dpx1unm3PUgMYNy2yrfANnaSFG7vKNtHyq0xHhs2qgOb4fATE80nKVY + RAY1F8b1JTYImazFA3NryRuA50InmvmHjpu9pyx8OQjy05tbnuScyau9SuyjO7usip + Q4lcqzzIB8AlQ== +Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de + [91.248.189.231]) + (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) (Authenticated sender: sre) + by bali.collaboradmins.com (Postfix) with ESMTPSA id ED3E617E0FD9; + Thu, 5 Sep 2024 17:17:12 +0200 (CEST) +Received: by jupiter.universe (Postfix, from userid 1000) + id A19EE4800F4; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) +From: Sebastian Reichel +To: Marek Vasut , u-boot@lists.denx.de, + Jonas Karlman , Soeren Moch +Cc: Eugen Hristev , + Tim Harvey , Kever Yang , + Philipp Tomsich , Simon Glass , + Sebastian Reichel +Subject: [PATCH v6 2/6] usb: tcpm: fusb302: add driver +Date: Thu, 5 Sep 2024 17:08:38 +0200 +Message-ID: <20240905151707.59101-3-sebastian.reichel@collabora.com> +X-Mailer: git-send-email 2.45.2 +In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> +References: <20240905151707.59101-1-sebastian.reichel@collabora.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 + +Now that the TCPM framework exists we can introduce fusb302 +driver using it. This chip is a very common USB-C controller +chip with PD support, which can be found in the Radxa Rock 5B +among many other boards. Apart from Power Delivery, it also +handles detection of the cable orientation. That can be used +to control a mux for connecting the right USB3 lane pair to +the USB3 controller. + +The driver is originally from the Linux kernel, but has been +adapted to the requirements of U-Boot and its TCPM framework. + +Co-developed-by: Wang Jie +Signed-off-by: Wang Jie +Tested-by: Soeren Moch +Signed-off-by: Sebastian Reichel +--- + drivers/usb/tcpm/Kconfig | 8 + + drivers/usb/tcpm/Makefile | 1 + + drivers/usb/tcpm/fusb302.c | 1323 ++++++++++++++++++++++++++++++++ + drivers/usb/tcpm/fusb302_reg.h | 177 +++++ + 4 files changed, 1509 insertions(+) + create mode 100644 drivers/usb/tcpm/fusb302.c + create mode 100644 drivers/usb/tcpm/fusb302_reg.h + +diff --git a/drivers/usb/tcpm/Kconfig b/drivers/usb/tcpm/Kconfig +index 55bf8e202b90..9be4b496e82f 100644 +--- a/drivers/usb/tcpm/Kconfig ++++ b/drivers/usb/tcpm/Kconfig +@@ -6,3 +6,11 @@ config TYPEC_TCPM + help + The Type-C Port Controller Manager provides a USB PD and USB Type-C + state machine for use with Type-C Port Controllers. ++ ++config TYPEC_FUSB302 ++ tristate "Fairchild FUSB302 Type-C chip driver" ++ depends on DM && DM_I2C && TYPEC_TCPM ++ help ++ The Fairchild FUSB302 Type-C chip driver that works with ++ Type-C Port Controller Manager to provide USB PD and USB ++ Type-C functionalities. +diff --git a/drivers/usb/tcpm/Makefile b/drivers/usb/tcpm/Makefile +index a0f76436f3fd..668d33155bf1 100644 +--- a/drivers/usb/tcpm/Makefile ++++ b/drivers/usb/tcpm/Makefile +@@ -1,3 +1,4 @@ + # SPDX-License-Identifier: GPL-2.0 + + obj-$(CONFIG_TYPEC_TCPM) += tcpm.o tcpm-uclass.o ++obj-$(CONFIG_TYPEC_FUSB302) += fusb302.o +diff --git a/drivers/usb/tcpm/fusb302.c b/drivers/usb/tcpm/fusb302.c +new file mode 100644 +index 000000000000..fe93ff3d3397 +--- /dev/null ++++ b/drivers/usb/tcpm/fusb302.c +@@ -0,0 +1,1323 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright 2016-2017 Google, Inc ++ * ++ * Fairchild FUSB302 Type-C Chip Driver ++ */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "fusb302_reg.h" ++ ++#define FUSB302_MAX_MSG_LEN 0x1F ++ ++enum toggling_mode { ++ TOGGLING_MODE_OFF, ++ TOGGLING_MODE_DRP, ++ TOGGLING_MODE_SNK, ++ TOGGLING_MODE_SRC, ++}; ++ ++enum src_current_status { ++ SRC_CURRENT_DEFAULT, ++ SRC_CURRENT_MEDIUM, ++ SRC_CURRENT_HIGH, ++}; ++ ++static const u8 ra_mda_value[] = { ++ [SRC_CURRENT_DEFAULT] = 4, /* 210mV */ ++ [SRC_CURRENT_MEDIUM] = 9, /* 420mV */ ++ [SRC_CURRENT_HIGH] = 18, /* 798mV */ ++}; ++ ++static const u8 rd_mda_value[] = { ++ [SRC_CURRENT_DEFAULT] = 38, /* 1638mV */ ++ [SRC_CURRENT_MEDIUM] = 38, /* 1638mV */ ++ [SRC_CURRENT_HIGH] = 61, /* 2604mV */ ++}; ++ ++struct fusb302_chip { ++ enum toggling_mode toggling_mode; ++ enum src_current_status src_current_status; ++ bool intr_togdone; ++ bool intr_bc_lvl; ++ bool intr_comp_chng; ++ ++ /* port status */ ++ bool vconn_on; ++ bool vbus_present; ++ enum typec_cc_polarity cc_polarity; ++ enum typec_cc_status cc1; ++ enum typec_cc_status cc2; ++}; ++ ++static int fusb302_i2c_write(struct udevice *dev, u8 address, u8 data) ++{ ++ int ret; ++ ++ ret = dm_i2c_write(dev, address, &data, 1); ++ if (ret) ++ dev_err(dev, "cannot write 0x%02x to 0x%02x, ret=%d\n", ++ data, address, ret); ++ ++ return ret; ++} ++ ++static int fusb302_i2c_block_write(struct udevice *dev, u8 address, ++ u8 length, const u8 *data) ++{ ++ int ret; ++ ++ if (!length) ++ return 0; ++ ++ ret = dm_i2c_write(dev, address, data, length); ++ if (ret) ++ dev_err(dev, "cannot block write 0x%02x, len=%d, ret=%d\n", ++ address, length, ret); ++ ++ return ret; ++} ++ ++static int fusb302_i2c_read(struct udevice *dev, u8 address, u8 *data) ++{ ++ int ret, retries; ++ ++ for (retries = 0; retries < 3; retries++) { ++ ret = dm_i2c_read(dev, address, data, 1); ++ if (ret == 0) ++ return ret; ++ dev_err(dev, "cannot read %02x, ret=%d\n", address, ret); ++ } ++ ++ return ret; ++} ++ ++static int fusb302_i2c_block_read(struct udevice *dev, u8 address, ++ u8 length, u8 *data) ++{ ++ int ret; ++ ++ if (!length) ++ return 0; ++ ++ ret = dm_i2c_read(dev, address, data, length); ++ if (ret) ++ dev_err(dev, "cannot block read 0x%02x, len=%d, ret=%d\n", ++ address, length, ret); ++ return ret; ++} ++ ++static int fusb302_i2c_mask_write(struct udevice *dev, u8 address, ++ u8 mask, u8 value) ++{ ++ int ret; ++ u8 data; ++ ++ ret = fusb302_i2c_read(dev, address, &data); ++ if (ret) ++ return ret; ++ data &= ~mask; ++ data |= value; ++ ret = fusb302_i2c_write(dev, address, data); ++ if (ret) ++ return ret; ++ ++ return ret; ++} ++ ++static int fusb302_i2c_set_bits(struct udevice *dev, u8 address, u8 set_bits) ++{ ++ return fusb302_i2c_mask_write(dev, address, 0x00, set_bits); ++} ++ ++static int fusb302_i2c_clear_bits(struct udevice *dev, u8 address, u8 clear_bits) ++{ ++ return fusb302_i2c_mask_write(dev, address, clear_bits, 0x00); ++} ++ ++static int fusb302_sw_reset(struct udevice *dev) ++{ ++ int ret = fusb302_i2c_write(dev, FUSB_REG_RESET, FUSB_REG_RESET_SW_RESET); ++ ++ if (ret) ++ dev_err(dev, "cannot sw reset the fusb302: %d\n", ret); ++ ++ return ret; ++} ++ ++static int fusb302_enable_tx_auto_retries(struct udevice *dev, u8 retry_count) ++{ ++ int ret; ++ ++ ret = fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL3, retry_count | ++ FUSB_REG_CONTROL3_AUTO_RETRY); ++ ++ return ret; ++} ++ ++/* ++ * mask all interrupt on the chip ++ */ ++static int fusb302_mask_interrupt(struct udevice *dev) ++{ ++ int ret; ++ ++ ret = fusb302_i2c_write(dev, FUSB_REG_MASK, 0xFF); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_write(dev, FUSB_REG_MASKA, 0xFF); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_write(dev, FUSB_REG_MASKB, 0xFF); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL0, ++ FUSB_REG_CONTROL0_INT_MASK); ++ return ret; ++} ++ ++/* ++ * initialize interrupt on the chip ++ * - unmasked interrupt: VBUS_OK ++ */ ++static int fusb302_init_interrupt(struct udevice *dev) ++{ ++ int ret; ++ ++ ret = fusb302_i2c_write(dev, FUSB_REG_MASK, ++ 0xFF & ~FUSB_REG_MASK_VBUSOK); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_write(dev, FUSB_REG_MASKA, 0xFF); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_write(dev, FUSB_REG_MASKB, 0xFF); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_CONTROL0, ++ FUSB_REG_CONTROL0_INT_MASK); ++ return ret; ++} ++ ++static int fusb302_set_power_mode(struct udevice *dev, u8 power_mode) ++{ ++ int ret; ++ ++ ret = fusb302_i2c_write(dev, FUSB_REG_POWER, power_mode); ++ ++ return ret; ++} ++ ++static int fusb302_init(struct udevice *dev) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ int ret; ++ u8 data; ++ ++ ret = fusb302_sw_reset(dev); ++ if (ret) ++ return ret; ++ ret = fusb302_enable_tx_auto_retries(dev, FUSB_REG_CONTROL3_N_RETRIES_3); ++ if (ret) ++ return ret; ++ ret = fusb302_init_interrupt(dev); ++ if (ret) ++ return ret; ++ ret = fusb302_set_power_mode(dev, FUSB_REG_POWER_PWR_ALL); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &data); ++ if (ret) ++ return ret; ++ chip->vbus_present = !!(data & FUSB_REG_STATUS0_VBUSOK); ++ ret = fusb302_i2c_read(dev, FUSB_REG_DEVICE_ID, &data); ++ if (ret) ++ return ret; ++ dev_info(dev, "fusb302 device ID: 0x%02x\n", data); ++ ++ return ret; ++} ++ ++static int fusb302_get_vbus(struct udevice *dev) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ ++ return chip->vbus_present ? 1 : 0; ++} ++ ++static int fusb302_set_src_current(struct udevice *dev, ++ enum src_current_status status) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ int ret; ++ ++ chip->src_current_status = status; ++ switch (status) { ++ case SRC_CURRENT_DEFAULT: ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL0, ++ FUSB_REG_CONTROL0_HOST_CUR_MASK, ++ FUSB_REG_CONTROL0_HOST_CUR_DEF); ++ break; ++ case SRC_CURRENT_MEDIUM: ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL0, ++ FUSB_REG_CONTROL0_HOST_CUR_MASK, ++ FUSB_REG_CONTROL0_HOST_CUR_MED); ++ break; ++ case SRC_CURRENT_HIGH: ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL0, ++ FUSB_REG_CONTROL0_HOST_CUR_MASK, ++ FUSB_REG_CONTROL0_HOST_CUR_HIGH); ++ break; ++ default: ++ ret = -EINVAL; ++ break; ++ } ++ ++ return ret; ++} ++ ++static int fusb302_set_toggling(struct udevice *dev, ++ enum toggling_mode mode) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ int ret; ++ ++ /* first disable toggling */ ++ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_CONTROL2, ++ FUSB_REG_CONTROL2_TOGGLE); ++ if (ret) ++ return ret; ++ /* mask interrupts for SRC or SNK */ ++ ret = fusb302_i2c_set_bits(dev, FUSB_REG_MASK, ++ FUSB_REG_MASK_BC_LVL | ++ FUSB_REG_MASK_COMP_CHNG); ++ if (ret) ++ return ret; ++ chip->intr_bc_lvl = false; ++ chip->intr_comp_chng = false; ++ /* configure toggling mode: none/snk/src/drp */ ++ switch (mode) { ++ case TOGGLING_MODE_OFF: ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL2, ++ FUSB_REG_CONTROL2_MODE_MASK, ++ FUSB_REG_CONTROL2_MODE_NONE); ++ break; ++ case TOGGLING_MODE_SNK: ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL2, ++ FUSB_REG_CONTROL2_MODE_MASK, ++ FUSB_REG_CONTROL2_MODE_UFP); ++ break; ++ case TOGGLING_MODE_SRC: ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL2, ++ FUSB_REG_CONTROL2_MODE_MASK, ++ FUSB_REG_CONTROL2_MODE_DFP); ++ break; ++ case TOGGLING_MODE_DRP: ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL2, ++ FUSB_REG_CONTROL2_MODE_MASK, ++ FUSB_REG_CONTROL2_MODE_DRP); ++ break; ++ default: ++ break; ++ } ++ ++ if (ret) ++ return ret; ++ ++ if (mode == TOGGLING_MODE_OFF) { ++ /* mask TOGDONE interrupt */ ++ ret = fusb302_i2c_set_bits(dev, FUSB_REG_MASKA, ++ FUSB_REG_MASKA_TOGDONE); ++ if (ret) ++ return ret; ++ chip->intr_togdone = false; ++ } else { ++ /* Datasheet says vconn MUST be off when toggling */ ++ if (chip->vconn_on) ++ dev_warn(dev, "Vconn is on during toggle start\n"); ++ /* unmask TOGDONE interrupt */ ++ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_MASKA, ++ FUSB_REG_MASKA_TOGDONE); ++ if (ret) ++ return ret; ++ chip->intr_togdone = true; ++ /* start toggling */ ++ ret = fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL2, ++ FUSB_REG_CONTROL2_TOGGLE); ++ if (ret) ++ return ret; ++ /* during toggling, consider cc as Open */ ++ chip->cc1 = TYPEC_CC_OPEN; ++ chip->cc2 = TYPEC_CC_OPEN; ++ } ++ chip->toggling_mode = mode; ++ ++ return ret; ++} ++ ++static const enum src_current_status cc_src_current[] = { ++ [TYPEC_CC_OPEN] = SRC_CURRENT_DEFAULT, ++ [TYPEC_CC_RA] = SRC_CURRENT_DEFAULT, ++ [TYPEC_CC_RD] = SRC_CURRENT_DEFAULT, ++ [TYPEC_CC_RP_DEF] = SRC_CURRENT_DEFAULT, ++ [TYPEC_CC_RP_1_5] = SRC_CURRENT_MEDIUM, ++ [TYPEC_CC_RP_3_0] = SRC_CURRENT_HIGH, ++}; ++ ++static int fusb302_set_cc(struct udevice *dev, enum typec_cc_status cc) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ const u8 switches0_mask = FUSB_REG_SWITCHES0_CC1_PU_EN | ++ FUSB_REG_SWITCHES0_CC2_PU_EN | ++ FUSB_REG_SWITCHES0_CC1_PD_EN | ++ FUSB_REG_SWITCHES0_CC2_PD_EN; ++ u8 rd_mda, switches0_data = 0x00; ++ int ret; ++ ++ switch (cc) { ++ case TYPEC_CC_OPEN: ++ break; ++ case TYPEC_CC_RD: ++ switches0_data |= FUSB_REG_SWITCHES0_CC1_PD_EN | ++ FUSB_REG_SWITCHES0_CC2_PD_EN; ++ break; ++ case TYPEC_CC_RP_DEF: ++ case TYPEC_CC_RP_1_5: ++ case TYPEC_CC_RP_3_0: ++ switches0_data |= (chip->cc_polarity == TYPEC_POLARITY_CC1) ? ++ FUSB_REG_SWITCHES0_CC1_PU_EN : ++ FUSB_REG_SWITCHES0_CC2_PU_EN; ++ break; ++ default: ++ dev_err(dev, "unsupported CC value: %s\n", ++ typec_cc_status_name[cc]); ++ ret = -EINVAL; ++ goto done; ++ } ++ ++ ret = fusb302_set_toggling(dev, TOGGLING_MODE_OFF); ++ if (ret) { ++ dev_err(dev, "cannot set toggling mode: %d\n", ret); ++ goto done; ++ } ++ ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_SWITCHES0, ++ switches0_mask, switches0_data); ++ if (ret) { ++ dev_err(dev, "cannot set pull-up/-down: %d\n", ret); ++ goto done; ++ } ++ /* reset the cc status */ ++ chip->cc1 = TYPEC_CC_OPEN; ++ chip->cc2 = TYPEC_CC_OPEN; ++ ++ /* adjust current for SRC */ ++ ret = fusb302_set_src_current(dev, cc_src_current[cc]); ++ if (ret) { ++ dev_err(dev, "cannot set src current %s: %d\n", ++ typec_cc_status_name[cc], ret); ++ goto done; ++ } ++ ++ /* enable/disable interrupts, BC_LVL for SNK and COMP_CHNG for SRC */ ++ switch (cc) { ++ case TYPEC_CC_RP_DEF: ++ case TYPEC_CC_RP_1_5: ++ case TYPEC_CC_RP_3_0: ++ rd_mda = rd_mda_value[cc_src_current[cc]]; ++ ret = fusb302_i2c_write(dev, FUSB_REG_MEASURE, rd_mda); ++ if (ret) { ++ dev_err(dev, "cannot set SRC measure value: %d\n", ret); ++ goto done; ++ } ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_MASK, ++ FUSB_REG_MASK_BC_LVL | ++ FUSB_REG_MASK_COMP_CHNG, ++ FUSB_REG_MASK_BC_LVL); ++ if (ret) { ++ dev_err(dev, "cannot set SRC irq: %d\n", ret); ++ goto done; ++ } ++ chip->intr_comp_chng = true; ++ break; ++ case TYPEC_CC_RD: ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_MASK, ++ FUSB_REG_MASK_BC_LVL | ++ FUSB_REG_MASK_COMP_CHNG, ++ FUSB_REG_MASK_COMP_CHNG); ++ if (ret) { ++ dev_err(dev, "cannot set SRC irq: %d\n", ret); ++ goto done; ++ } ++ chip->intr_bc_lvl = true; ++ break; ++ default: ++ break; ++ } ++done: ++ return ret; ++} ++ ++static int fusb302_get_cc(struct udevice *dev, enum typec_cc_status *cc1, ++ enum typec_cc_status *cc2) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ ++ *cc1 = chip->cc1; ++ *cc2 = chip->cc2; ++ dev_dbg(dev, "get cc1 = %s, cc2 = %s\n", typec_cc_status_name[*cc1], ++ typec_cc_status_name[*cc2]); ++ ++ return 0; ++} ++ ++static int fusb302_set_vconn(struct udevice *dev, bool on) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ int ret; ++ u8 switches0_data = 0x00; ++ u8 switches0_mask = FUSB_REG_SWITCHES0_VCONN_CC1 | ++ FUSB_REG_SWITCHES0_VCONN_CC2; ++ ++ if (chip->vconn_on == on) { ++ ret = 0; ++ dev_dbg(dev, "vconn is already %s\n", on ? "on" : "off"); ++ goto done; ++ } ++ if (on) { ++ switches0_data = (chip->cc_polarity == TYPEC_POLARITY_CC1) ? ++ FUSB_REG_SWITCHES0_VCONN_CC2 : ++ FUSB_REG_SWITCHES0_VCONN_CC1; ++ } ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_SWITCHES0, ++ switches0_mask, switches0_data); ++ if (ret) ++ goto done; ++ dev_dbg(dev, "set vconn = %s\n", on ? "on" : "off"); ++done: ++ return ret; ++} ++ ++static int fusb302_set_vbus(struct udevice *dev, bool on, bool charge) ++{ ++ return 0; ++} ++ ++static int fusb302_pd_tx_flush(struct udevice *dev) ++{ ++ return fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL0, ++ FUSB_REG_CONTROL0_TX_FLUSH); ++} ++ ++static int fusb302_pd_rx_flush(struct udevice *dev) ++{ ++ return fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL1, ++ FUSB_REG_CONTROL1_RX_FLUSH); ++} ++ ++static int fusb302_pd_set_auto_goodcrc(struct udevice *dev, bool on) ++{ ++ if (on) ++ return fusb302_i2c_set_bits(dev, FUSB_REG_SWITCHES1, ++ FUSB_REG_SWITCHES1_AUTO_GCRC); ++ return fusb302_i2c_clear_bits(dev, FUSB_REG_SWITCHES1, ++ FUSB_REG_SWITCHES1_AUTO_GCRC); ++} ++ ++static int fusb302_pd_set_interrupts(struct udevice *dev, bool on) ++{ ++ int ret; ++ u8 mask_interrupts = FUSB_REG_MASK_COLLISION; ++ u8 maska_interrupts = FUSB_REG_MASKA_RETRYFAIL | ++ FUSB_REG_MASKA_HARDSENT | ++ FUSB_REG_MASKA_TX_SUCCESS | ++ FUSB_REG_MASKA_HARDRESET; ++ u8 maskb_interrupts = FUSB_REG_MASKB_GCRCSENT; ++ ++ ret = on ? ++ fusb302_i2c_clear_bits(dev, FUSB_REG_MASK, mask_interrupts) : ++ fusb302_i2c_set_bits(dev, FUSB_REG_MASK, mask_interrupts); ++ if (ret) ++ return ret; ++ ret = on ? ++ fusb302_i2c_clear_bits(dev, FUSB_REG_MASKA, maska_interrupts) : ++ fusb302_i2c_set_bits(dev, FUSB_REG_MASKA, maska_interrupts); ++ if (ret) ++ return ret; ++ ret = on ? ++ fusb302_i2c_clear_bits(dev, FUSB_REG_MASKB, maskb_interrupts) : ++ fusb302_i2c_set_bits(dev, FUSB_REG_MASKB, maskb_interrupts); ++ return ret; ++} ++ ++static int fusb302_set_pd_rx(struct udevice *dev, bool on) ++{ ++ int ret; ++ ++ ret = fusb302_pd_rx_flush(dev); ++ if (ret) { ++ dev_err(dev, "cannot flush pd rx buffer: %d\n", ret); ++ goto done; ++ } ++ ret = fusb302_pd_tx_flush(dev); ++ if (ret) { ++ dev_err(dev, "cannot flush pd tx buffer: %d\n", ret); ++ goto done; ++ } ++ ret = fusb302_pd_set_auto_goodcrc(dev, on); ++ if (ret) { ++ dev_err(dev, "cannot turn %s auto GoodCRC: %d\n", ++ on ? "on" : "off", ret); ++ goto done; ++ } ++ ret = fusb302_pd_set_interrupts(dev, on); ++ if (ret) { ++ dev_err(dev, "cannot turn %s pd interrupts: %d\n", ++ on ? "on" : "off", ret); ++ goto done; ++ } ++ dev_dbg(dev, "set pd RX %s\n", on ? "on" : "off"); ++done: ++ return ret; ++} ++ ++static int fusb302_set_roles(struct udevice *dev, bool attached, ++ enum typec_role pwr, enum typec_data_role data) ++{ ++ int ret; ++ u8 switches1_mask = FUSB_REG_SWITCHES1_POWERROLE | ++ FUSB_REG_SWITCHES1_DATAROLE; ++ u8 switches1_data = 0x00; ++ ++ if (pwr == TYPEC_SOURCE) ++ switches1_data |= FUSB_REG_SWITCHES1_POWERROLE; ++ if (data == TYPEC_HOST) ++ switches1_data |= FUSB_REG_SWITCHES1_DATAROLE; ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_SWITCHES1, ++ switches1_mask, switches1_data); ++ if (ret) { ++ dev_err(dev, "unable to set pd header %s, %s, ret=%d\n", ++ typec_role_name[pwr], typec_data_role_name[data], ret); ++ goto done; ++ } ++ dev_dbg(dev, "pd header : %s, %s\n", typec_role_name[pwr], ++ typec_data_role_name[data]); ++done: ++ ++ return ret; ++} ++ ++static int fusb302_start_toggling(struct udevice *dev, ++ enum typec_port_type port_type, ++ enum typec_cc_status cc) ++{ ++ enum toggling_mode mode = TOGGLING_MODE_OFF; ++ int ret; ++ ++ switch (port_type) { ++ case TYPEC_PORT_SRC: ++ mode = TOGGLING_MODE_SRC; ++ break; ++ case TYPEC_PORT_SNK: ++ mode = TOGGLING_MODE_SNK; ++ break; ++ case TYPEC_PORT_DRP: ++ mode = TOGGLING_MODE_DRP; ++ break; ++ } ++ ++ ret = fusb302_set_src_current(dev, cc_src_current[cc]); ++ if (ret) { ++ dev_err(dev, "unable to set src current %s, ret=%d", ++ typec_cc_status_name[cc], ret); ++ goto done; ++ } ++ ret = fusb302_set_toggling(dev, mode); ++ if (ret) { ++ dev_err(dev, "unable to start drp toggling: %d\n", ret); ++ goto done; ++ } ++ dev_info(dev, "fusb302 start drp toggling\n"); ++done: ++ ++ return ret; ++} ++ ++static int fusb302_pd_send_message(struct udevice *dev, ++ const struct pd_message *msg) ++{ ++ int ret; ++ /* SOP tokens */ ++ u8 buf[40] = {FUSB302_TKN_SYNC1, FUSB302_TKN_SYNC1, FUSB302_TKN_SYNC1, ++ FUSB302_TKN_SYNC2}; ++ u8 pos = 4; ++ int len; ++ ++ len = pd_header_cnt_le(msg->header) * 4; ++ /* plug 2 for header */ ++ len += 2; ++ if (len > FUSB302_MAX_MSG_LEN) { ++ dev_err(dev, "PD message too long %d (incl. header)", len); ++ return -EINVAL; ++ } ++ /* packsym tells the FUSB302 chip that the next X bytes are payload */ ++ buf[pos++] = FUSB302_TKN_PACKSYM | (len & FUSB302_MAX_MSG_LEN); ++ memcpy(&buf[pos], &msg->header, sizeof(msg->header)); ++ pos += sizeof(msg->header); ++ ++ len -= 2; ++ memcpy(&buf[pos], msg->payload, len); ++ pos += len; ++ ++ /* CRC */ ++ buf[pos++] = FUSB302_TKN_JAMCRC; ++ /* EOP */ ++ buf[pos++] = FUSB302_TKN_EOP; ++ /* turn tx off after sending message */ ++ buf[pos++] = FUSB302_TKN_TXOFF; ++ /* start transmission */ ++ buf[pos++] = FUSB302_TKN_TXON; ++ ++ ret = fusb302_i2c_block_write(dev, FUSB_REG_FIFOS, pos, buf); ++ if (ret) ++ return ret; ++ dev_dbg(dev, "Send PD message (header=0x%x len=%d)\n", msg->header, len); ++ ++ return ret; ++} ++ ++static int fusb302_pd_send_hardreset(struct udevice *dev) ++{ ++ return fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL3, ++ FUSB_REG_CONTROL3_SEND_HARDRESET); ++} ++ ++static const char * const transmit_type_name[] = { ++ [TCPC_TX_SOP] = "SOP", ++ [TCPC_TX_SOP_PRIME] = "SOP'", ++ [TCPC_TX_SOP_PRIME_PRIME] = "SOP''", ++ [TCPC_TX_SOP_DEBUG_PRIME] = "DEBUG'", ++ [TCPC_TX_SOP_DEBUG_PRIME_PRIME] = "DEBUG''", ++ [TCPC_TX_HARD_RESET] = "HARD_RESET", ++ [TCPC_TX_CABLE_RESET] = "CABLE_RESET", ++ [TCPC_TX_BIST_MODE_2] = "BIST_MODE_2", ++}; ++ ++static int fusb302_pd_transmit(struct udevice *dev, enum tcpm_transmit_type type, ++ const struct pd_message *msg, unsigned int negotiated_rev) ++{ ++ int ret; ++ ++ switch (type) { ++ case TCPC_TX_SOP: ++ /* nRetryCount 3 in P2.0 spec, whereas 2 in PD3.0 spec */ ++ ret = fusb302_enable_tx_auto_retries(dev, negotiated_rev > PD_REV20 ? ++ FUSB_REG_CONTROL3_N_RETRIES_2 : ++ FUSB_REG_CONTROL3_N_RETRIES_3); ++ if (ret) ++ dev_err(dev, "cannot update retry count: %d\n", ret); ++ ++ ret = fusb302_pd_send_message(dev, msg); ++ if (ret) ++ dev_err(dev, "cannot send PD message: %d\n", ret); ++ break; ++ case TCPC_TX_HARD_RESET: ++ ret = fusb302_pd_send_hardreset(dev); ++ if (ret) ++ dev_err(dev, "cannot send hardreset: %d\n", ret); ++ break; ++ default: ++ dev_err(dev, "type %s not supported", transmit_type_name[type]); ++ ret = -EINVAL; ++ } ++ ++ return ret; ++} ++ ++static enum typec_cc_status fusb302_bc_lvl_to_cc(u8 bc_lvl) ++{ ++ if (bc_lvl == FUSB_REG_STATUS0_BC_LVL_1230_MAX) ++ return TYPEC_CC_RP_3_0; ++ if (bc_lvl == FUSB_REG_STATUS0_BC_LVL_600_1230) ++ return TYPEC_CC_RP_1_5; ++ if (bc_lvl == FUSB_REG_STATUS0_BC_LVL_200_600) ++ return TYPEC_CC_RP_DEF; ++ return TYPEC_CC_OPEN; ++} ++ ++static void fusb302_bc_lvl_handler(struct udevice *dev) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ enum typec_cc_status cc_status; ++ u8 status0, bc_lvl; ++ int ret; ++ ++ if (!chip->intr_bc_lvl) { ++ dev_err(dev, "BC_LVL interrupt is turned off, abort\n"); ++ goto done; ++ } ++ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); ++ if (ret) ++ goto done; ++ ++ dev_dbg(dev, "BC_LVL handler, status0 = 0x%02x\n", status0); ++ if (status0 & FUSB_REG_STATUS0_ACTIVITY) ++ dev_info(dev, "CC activities detected, delay handling\n"); ++ bc_lvl = status0 & FUSB_REG_STATUS0_BC_LVL_MASK; ++ cc_status = fusb302_bc_lvl_to_cc(bc_lvl); ++ if (chip->cc_polarity == TYPEC_POLARITY_CC1) { ++ if (chip->cc1 != cc_status) { ++ dev_dbg(dev, "cc1: %s -> %s\n", ++ typec_cc_status_name[chip->cc1], ++ typec_cc_status_name[cc_status]); ++ chip->cc1 = cc_status; ++ tcpm_cc_change(dev); ++ } ++ } else { ++ if (chip->cc2 != cc_status) { ++ dev_dbg(dev, "cc2: %s -> %s\n", ++ typec_cc_status_name[chip->cc2], ++ typec_cc_status_name[cc_status]); ++ chip->cc2 = cc_status; ++ tcpm_cc_change(dev); ++ } ++ } ++ ++done: ++ return; ++} ++ ++static int fusb302_enter_low_power_mode(struct udevice *dev, ++ bool attached, bool pd_capable) ++{ ++ unsigned int reg; ++ int ret; ++ ++ ret = fusb302_mask_interrupt(dev); ++ if (ret) ++ return ret; ++ if (attached && pd_capable) ++ reg = FUSB_REG_POWER_PWR_MEDIUM; ++ else if (attached) ++ reg = FUSB_REG_POWER_PWR_LOW; ++ else ++ reg = 0; ++ ++ return fusb302_set_power_mode(dev, reg); ++} ++ ++static const char * const cc_polarity_name[] = { ++ [TYPEC_POLARITY_CC1] = "Polarity_CC1", ++ [TYPEC_POLARITY_CC2] = "Polarity_CC2", ++}; ++ ++static int fusb302_set_cc_polarity_and_pull(struct udevice *dev, ++ enum typec_cc_polarity cc_polarity, ++ bool pull_up, bool pull_down) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ int ret; ++ u8 switches0_data = 0x00; ++ u8 switches1_mask = FUSB_REG_SWITCHES1_TXCC1_EN | ++ FUSB_REG_SWITCHES1_TXCC2_EN; ++ u8 switches1_data = 0x00; ++ ++ if (pull_down) ++ switches0_data |= FUSB_REG_SWITCHES0_CC1_PD_EN | ++ FUSB_REG_SWITCHES0_CC2_PD_EN; ++ ++ if (cc_polarity == TYPEC_POLARITY_CC1) { ++ switches0_data |= FUSB_REG_SWITCHES0_MEAS_CC1; ++ if (chip->vconn_on) ++ switches0_data |= FUSB_REG_SWITCHES0_VCONN_CC2; ++ if (pull_up) ++ switches0_data |= FUSB_REG_SWITCHES0_CC1_PU_EN; ++ switches1_data = FUSB_REG_SWITCHES1_TXCC1_EN; ++ } else { ++ switches0_data |= FUSB_REG_SWITCHES0_MEAS_CC2; ++ if (chip->vconn_on) ++ switches0_data |= FUSB_REG_SWITCHES0_VCONN_CC1; ++ if (pull_up) ++ switches0_data |= FUSB_REG_SWITCHES0_CC2_PU_EN; ++ switches1_data = FUSB_REG_SWITCHES1_TXCC2_EN; ++ } ++ ret = fusb302_i2c_write(dev, FUSB_REG_SWITCHES0, switches0_data); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_mask_write(dev, FUSB_REG_SWITCHES1, ++ switches1_mask, switches1_data); ++ if (ret) ++ return ret; ++ chip->cc_polarity = cc_polarity; ++ ++ return ret; ++} ++ ++static int fusb302_handle_togdone_snk(struct udevice *dev, ++ u8 togdone_result) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ int ret; ++ u8 status0; ++ u8 bc_lvl; ++ enum typec_cc_polarity cc_polarity; ++ enum typec_cc_status cc_status_active, cc1, cc2; ++ ++ /* set polarity and pull_up, pull_down */ ++ cc_polarity = (togdone_result == FUSB_REG_STATUS1A_TOGSS_SNK1) ? ++ TYPEC_POLARITY_CC1 : TYPEC_POLARITY_CC2; ++ ret = fusb302_set_cc_polarity_and_pull(dev, cc_polarity, false, true); ++ if (ret) { ++ dev_err(dev, "cannot set cc polarity %s, ret = %d\n", ++ cc_polarity_name[cc_polarity], ret); ++ return ret; ++ } ++ /* fusb302_set_cc_polarity() has set the correct measure block */ ++ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); ++ if (ret < 0) ++ return ret; ++ bc_lvl = status0 & FUSB_REG_STATUS0_BC_LVL_MASK; ++ cc_status_active = fusb302_bc_lvl_to_cc(bc_lvl); ++ /* restart toggling if the cc status on the active line is OPEN */ ++ if (cc_status_active == TYPEC_CC_OPEN) { ++ dev_info(dev, "restart toggling as CC_OPEN detected\n"); ++ ret = fusb302_set_toggling(dev, chip->toggling_mode); ++ return ret; ++ } ++ /* update tcpm with the new cc value */ ++ cc1 = (cc_polarity == TYPEC_POLARITY_CC1) ? ++ cc_status_active : TYPEC_CC_OPEN; ++ cc2 = (cc_polarity == TYPEC_POLARITY_CC2) ? ++ cc_status_active : TYPEC_CC_OPEN; ++ if (chip->cc1 != cc1 || chip->cc2 != cc2) { ++ chip->cc1 = cc1; ++ chip->cc2 = cc2; ++ tcpm_cc_change(dev); ++ } ++ /* turn off toggling */ ++ ret = fusb302_set_toggling(dev, TOGGLING_MODE_OFF); ++ if (ret) { ++ dev_err(dev, "cannot set toggling mode off, ret=%d\n", ret); ++ return ret; ++ } ++ /* unmask bc_lvl interrupt */ ++ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_MASK, FUSB_REG_MASK_BC_LVL); ++ if (ret) { ++ dev_err(dev, "cannot unmask bc_lcl irq, ret=%d\n", ret); ++ return ret; ++ } ++ chip->intr_bc_lvl = true; ++ dev_dbg(dev, "detected cc1=%s, cc2=%s\n", ++ typec_cc_status_name[cc1], ++ typec_cc_status_name[cc2]); ++ ++ return ret; ++} ++ ++/* On error returns < 0, otherwise a typec_cc_status value */ ++static int fusb302_get_src_cc_status(struct udevice *dev, ++ enum typec_cc_polarity cc_polarity, ++ enum typec_cc_status *cc) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ u8 ra_mda = ra_mda_value[chip->src_current_status]; ++ u8 rd_mda = rd_mda_value[chip->src_current_status]; ++ u8 switches0_data, status0; ++ int ret; ++ ++ /* Step 1: Set switches so that we measure the right CC pin */ ++ switches0_data = (cc_polarity == TYPEC_POLARITY_CC1) ? ++ FUSB_REG_SWITCHES0_CC1_PU_EN | FUSB_REG_SWITCHES0_MEAS_CC1 : ++ FUSB_REG_SWITCHES0_CC2_PU_EN | FUSB_REG_SWITCHES0_MEAS_CC2; ++ ret = fusb302_i2c_write(dev, FUSB_REG_SWITCHES0, switches0_data); ++ if (ret < 0) ++ return ret; ++ ++ fusb302_i2c_read(dev, FUSB_REG_SWITCHES0, &status0); ++ dev_dbg(dev, "get_src_cc_status switches: 0x%0x", status0); ++ ++ /* Step 2: Set compararator volt to differentiate between Open and Rd */ ++ ret = fusb302_i2c_write(dev, FUSB_REG_MEASURE, rd_mda); ++ if (ret) ++ return ret; ++ ++ udelay(100); ++ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); ++ if (ret) ++ return ret; ++ ++ dev_dbg(dev, "get_src_cc_status rd_mda status0: 0x%0x", status0); ++ if (status0 & FUSB_REG_STATUS0_COMP) { ++ *cc = TYPEC_CC_OPEN; ++ return 0; ++ } ++ ++ /* Step 3: Set compararator input to differentiate between Rd and Ra. */ ++ ret = fusb302_i2c_write(dev, FUSB_REG_MEASURE, ra_mda); ++ if (ret) ++ return ret; ++ ++ udelay(100); ++ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); ++ if (ret) ++ return ret; ++ ++ dev_dbg(dev, "get_src_cc_status ra_mda status0: 0x%0x", status0); ++ if (status0 & FUSB_REG_STATUS0_COMP) ++ *cc = TYPEC_CC_RD; ++ else ++ *cc = TYPEC_CC_RA; ++ ++ return 0; ++} ++ ++static int fusb302_handle_togdone_src(struct udevice *dev, ++ u8 togdone_result) ++{ ++ /* ++ * - set polarity (measure cc, vconn, tx) ++ * - set pull_up, pull_down ++ * - set cc1, cc2, and update to tcpm state machine ++ * - set I_COMP interrupt on ++ */ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ u8 rd_mda = rd_mda_value[chip->src_current_status]; ++ enum toggling_mode toggling_mode = chip->toggling_mode; ++ enum typec_cc_polarity cc_polarity; ++ enum typec_cc_status cc1, cc2; ++ int ret; ++ ++ /* ++ * The toggle-engine will stop in a src state if it sees either Ra or ++ * Rd. Determine the status for both CC pins, starting with the one ++ * where toggling stopped, as that is where the switches point now. ++ */ ++ if (togdone_result == FUSB_REG_STATUS1A_TOGSS_SRC1) ++ ret = fusb302_get_src_cc_status(dev, TYPEC_POLARITY_CC1, &cc1); ++ else ++ ret = fusb302_get_src_cc_status(dev, TYPEC_POLARITY_CC2, &cc2); ++ if (ret) ++ return ret; ++ /* we must turn off toggling before we can measure the other pin */ ++ ret = fusb302_set_toggling(dev, TOGGLING_MODE_OFF); ++ if (ret) { ++ dev_err(dev, "cannot set toggling mode off, ret=%d\n", ret); ++ return ret; ++ } ++ /* get the status of the other pin */ ++ if (togdone_result == FUSB_REG_STATUS1A_TOGSS_SRC1) ++ ret = fusb302_get_src_cc_status(dev, TYPEC_POLARITY_CC2, &cc2); ++ else ++ ret = fusb302_get_src_cc_status(dev, TYPEC_POLARITY_CC1, &cc1); ++ if (ret) ++ return ret; ++ ++ /* determine polarity based on the status of both pins */ ++ if (cc1 == TYPEC_CC_RD && (cc2 == TYPEC_CC_OPEN || cc2 == TYPEC_CC_RA)) { ++ cc_polarity = TYPEC_POLARITY_CC1; ++ } else if (cc2 == TYPEC_CC_RD && ++ (cc1 == TYPEC_CC_OPEN || cc1 == TYPEC_CC_RA)) { ++ cc_polarity = TYPEC_POLARITY_CC2; ++ } else { ++ dev_err(dev, "unexpected CC status cc1=%s, cc2=%s, restarting toggling\n", ++ typec_cc_status_name[cc1], ++ typec_cc_status_name[cc2]); ++ return fusb302_set_toggling(dev, toggling_mode); ++ } ++ /* set polarity and pull_up, pull_down */ ++ ret = fusb302_set_cc_polarity_and_pull(dev, cc_polarity, true, false); ++ if (ret < 0) { ++ dev_err(dev, "cannot set cc polarity %s, ret=%d\n", ++ cc_polarity_name[cc_polarity], ret); ++ return ret; ++ } ++ /* update tcpm with the new cc value */ ++ if (chip->cc1 != cc1 || chip->cc2 != cc2) { ++ chip->cc1 = cc1; ++ chip->cc2 = cc2; ++ tcpm_cc_change(dev); ++ } ++ /* set MDAC to Rd threshold, and unmask I_COMP for unplug detection */ ++ ret = fusb302_i2c_write(dev, FUSB_REG_MEASURE, rd_mda); ++ if (ret) ++ return ret; ++ /* unmask comp_chng interrupt */ ++ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_MASK, ++ FUSB_REG_MASK_COMP_CHNG); ++ if (ret) { ++ dev_err(dev, "cannot unmask comp_chng irq, ret=%d\n", ret); ++ return ret; ++ } ++ chip->intr_comp_chng = true; ++ dev_dbg(dev, "detected cc1=%s, cc2=%s\n", ++ typec_cc_status_name[cc1], ++ typec_cc_status_name[cc2]); ++ ++ return ret; ++} ++ ++static int fusb302_handle_togdone(struct udevice *dev) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ u8 togdone_result, status1a; ++ int ret; ++ ++ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS1A, &status1a); ++ if (ret < 0) ++ return ret; ++ togdone_result = (status1a >> FUSB_REG_STATUS1A_TOGSS_POS) & ++ FUSB_REG_STATUS1A_TOGSS_MASK; ++ switch (togdone_result) { ++ case FUSB_REG_STATUS1A_TOGSS_SNK1: ++ case FUSB_REG_STATUS1A_TOGSS_SNK2: ++ return fusb302_handle_togdone_snk(dev, togdone_result); ++ case FUSB_REG_STATUS1A_TOGSS_SRC1: ++ case FUSB_REG_STATUS1A_TOGSS_SRC2: ++ return fusb302_handle_togdone_src(dev, togdone_result); ++ case FUSB_REG_STATUS1A_TOGSS_AA: ++ /* doesn't support */ ++ dev_err(dev, "AudioAccessory not supported\n"); ++ fusb302_set_toggling(dev, chip->toggling_mode); ++ break; ++ default: ++ dev_err(dev, "TOGDONE with an invalid state: %d\n", ++ togdone_result); ++ fusb302_set_toggling(dev, chip->toggling_mode); ++ break; ++ } ++ return ret; ++} ++ ++static int fusb302_pd_reset(struct udevice *dev) ++{ ++ return fusb302_i2c_set_bits(dev, FUSB_REG_RESET, ++ FUSB_REG_RESET_PD_RESET); ++} ++ ++static int fusb302_pd_read_message(struct udevice *dev, ++ struct pd_message *msg) ++{ ++ int len, ret; ++ u8 crc[4]; ++ u8 token; ++ ++ /* first SOP token */ ++ ret = fusb302_i2c_read(dev, FUSB_REG_FIFOS, &token); ++ if (ret) ++ return ret; ++ ret = fusb302_i2c_block_read(dev, FUSB_REG_FIFOS, 2, ++ (u8 *)&msg->header); ++ if (ret) ++ return ret; ++ len = pd_header_cnt_le(msg->header) * 4; ++ /* add 4 to length to include the CRC */ ++ if (len > PD_MAX_PAYLOAD * 4) { ++ dev_err(dev, "PD message too long %d\n", len); ++ return -EINVAL; ++ } ++ if (len > 0) { ++ ret = fusb302_i2c_block_read(dev, FUSB_REG_FIFOS, len, ++ (u8 *)msg->payload); ++ if (ret) ++ return ret; ++ } ++ /* another 4 bytes to read CRC out */ ++ ret = fusb302_i2c_block_read(dev, FUSB_REG_FIFOS, 4, crc); ++ if (ret) ++ return ret; ++ dev_dbg(dev, "Received PD message (header=0x%x len=%d)\n", msg->header, len); ++ ++ /* ++ * Check if we've read off a GoodCRC message. If so then indicate to ++ * TCPM that the previous transmission has completed. Otherwise we pass ++ * the received message over to TCPM for processing. ++ * ++ * We make this check here instead of basing the reporting decision on ++ * the IRQ event type, as it's possible for the chip to report the ++ * TX_SUCCESS and GCRCSENT events out of order on occasion, so we need ++ * to check the message type to ensure correct reporting to TCPM. ++ */ ++ if (!len && (pd_header_type_le(msg->header) == PD_CTRL_GOOD_CRC)) ++ tcpm_pd_transmit_complete(dev, TCPC_TX_SUCCESS); ++ else ++ tcpm_pd_receive(dev, msg); ++ ++ return ret; ++} ++ ++static void fusb302_interrupt_handle(struct udevice *dev) ++{ ++ struct fusb302_chip *chip = dev_get_priv(dev); ++ u8 interrupt; ++ u8 interrupta; ++ u8 interruptb; ++ u8 status0; ++ bool vbus_present; ++ bool comp_result; ++ bool intr_togdone; ++ bool intr_bc_lvl; ++ bool intr_comp_chng; ++ struct pd_message pd_msg; ++ int ret; ++ ++ /* grab a snapshot of intr flags */ ++ intr_togdone = chip->intr_togdone; ++ intr_bc_lvl = chip->intr_bc_lvl; ++ intr_comp_chng = chip->intr_comp_chng; ++ ++ ret = fusb302_i2c_read(dev, FUSB_REG_INTERRUPT, &interrupt); ++ if (ret) ++ return; ++ ret = fusb302_i2c_read(dev, FUSB_REG_INTERRUPTA, &interrupta); ++ if (ret) ++ return; ++ ret = fusb302_i2c_read(dev, FUSB_REG_INTERRUPTB, &interruptb); ++ if (ret) ++ return; ++ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); ++ if (ret) ++ return; ++ ++ /* ++ * Since we are polling the IRQs, avoid printing messages when there ++ * no interrupts at all to avoid spamming the log. ++ */ ++ if (interrupt != 0 || interrupta != 0 || interruptb != 0) ++ dev_dbg(dev, "IRQ: 0x%02x, a: 0x%02x, b: 0x%02x, status0: 0x%02x\n", ++ interrupt, interrupta, interruptb, status0); ++ ++ if (interrupt & FUSB_REG_INTERRUPT_VBUSOK) { ++ vbus_present = !!(status0 & FUSB_REG_STATUS0_VBUSOK); ++ dev_dbg(dev, "IRQ: VBUS_OK, vbus=%s\n", ++ vbus_present ? "On" : "Off"); ++ if (vbus_present != chip->vbus_present) { ++ chip->vbus_present = vbus_present; ++ tcpm_vbus_change(dev); ++ } ++ } ++ ++ if ((interrupta & FUSB_REG_INTERRUPTA_TOGDONE) && intr_togdone) { ++ dev_dbg(dev, "IRQ: TOGDONE\n"); ++ ret = fusb302_handle_togdone(dev); ++ if (ret) { ++ dev_err(dev, "handle togdone error: %d\n", ret); ++ return; ++ } ++ } ++ ++ if ((interrupt & FUSB_REG_INTERRUPT_BC_LVL) && intr_bc_lvl) { ++ dev_dbg(dev, "IRQ: BC_LVL, handler pending\n"); ++ fusb302_bc_lvl_handler(dev); ++ } ++ ++ if ((interrupt & FUSB_REG_INTERRUPT_COMP_CHNG) && intr_comp_chng) { ++ comp_result = !!(status0 & FUSB_REG_STATUS0_COMP); ++ dev_dbg(dev, "IRQ: COMP_CHNG, comp=%s\n", ++ comp_result ? "true" : "false"); ++ if (comp_result) { ++ /* cc level > Rd_threshold, detach */ ++ chip->cc1 = TYPEC_CC_OPEN; ++ chip->cc2 = TYPEC_CC_OPEN; ++ tcpm_cc_change(dev); ++ } ++ } ++ ++ if (interrupt & FUSB_REG_INTERRUPT_COLLISION) { ++ dev_dbg(dev, "IRQ: PD collision\n"); ++ tcpm_pd_transmit_complete(dev, TCPC_TX_FAILED); ++ } ++ ++ if (interrupta & FUSB_REG_INTERRUPTA_RETRYFAIL) { ++ dev_dbg(dev, "IRQ: PD retry failed\n"); ++ tcpm_pd_transmit_complete(dev, TCPC_TX_FAILED); ++ } ++ ++ if (interrupta & FUSB_REG_INTERRUPTA_HARDSENT) { ++ dev_dbg(dev, "IRQ: PD hardreset sent\n"); ++ ret = fusb302_pd_reset(dev); ++ if (ret) { ++ dev_err(dev, "cannot PD reset, ret=%d\n", ret); ++ return; ++ } ++ tcpm_pd_transmit_complete(dev, TCPC_TX_SUCCESS); ++ } ++ ++ if (interrupta & FUSB_REG_INTERRUPTA_TX_SUCCESS) { ++ dev_dbg(dev, "IRQ: PD tx success\n"); ++ ret = fusb302_pd_read_message(dev, &pd_msg); ++ if (ret) { ++ dev_err(dev, "cannot read in PD message, ret=%d\n", ret); ++ return; ++ } ++ } ++ ++ if (interrupta & FUSB_REG_INTERRUPTA_HARDRESET) { ++ dev_dbg(dev, "IRQ: PD received hardreset\n"); ++ ret = fusb302_pd_reset(dev); ++ if (ret) { ++ dev_err(dev, "cannot PD reset, ret=%d\n", ret); ++ return; ++ } ++ tcpm_pd_hard_reset(dev); ++ } ++ ++ if (interruptb & FUSB_REG_INTERRUPTB_GCRCSENT) { ++ dev_dbg(dev, "IRQ: PD sent good CRC\n"); ++ ret = fusb302_pd_read_message(dev, &pd_msg); ++ if (ret) { ++ dev_err(dev, "cannot read in PD message, ret=%d\n", ret); ++ return; ++ } ++ } ++} ++ ++static void fusb302_poll_event(struct udevice *dev) ++{ ++ fusb302_interrupt_handle(dev); ++} ++ ++static int fusb302_get_connector_node(struct udevice *dev, ofnode *connector_node) ++{ ++ *connector_node = dev_read_subnode(dev, "connector"); ++ if (!ofnode_valid(*connector_node)) { ++ dev_err(dev, "'connector' node is not found\n"); ++ return -ENODEV; ++ } ++ ++ return 0; ++} ++ ++static struct dm_tcpm_ops fusb302_ops = { ++ .get_connector_node = fusb302_get_connector_node, ++ .init = fusb302_init, ++ .get_vbus = fusb302_get_vbus, ++ .set_cc = fusb302_set_cc, ++ .get_cc = fusb302_get_cc, ++ .set_vconn = fusb302_set_vconn, ++ .set_vbus = fusb302_set_vbus, ++ .set_pd_rx = fusb302_set_pd_rx, ++ .set_roles = fusb302_set_roles, ++ .start_toggling = fusb302_start_toggling, ++ .pd_transmit = fusb302_pd_transmit, ++ .poll_event = fusb302_poll_event, ++ .enter_low_power_mode = fusb302_enter_low_power_mode, ++}; ++ ++static const struct udevice_id fusb302_ids[] = { ++ { .compatible = "fcs,fusb302" }, ++ { } ++}; ++ ++U_BOOT_DRIVER(fusb302) = { ++ .name = "fusb302", ++ .id = UCLASS_TCPM, ++ .of_match = fusb302_ids, ++ .ops = &fusb302_ops, ++ .priv_auto = sizeof(struct fusb302_chip), ++}; +diff --git a/drivers/usb/tcpm/fusb302_reg.h b/drivers/usb/tcpm/fusb302_reg.h +new file mode 100644 +index 000000000000..edc0e4b0f1e6 +--- /dev/null ++++ b/drivers/usb/tcpm/fusb302_reg.h +@@ -0,0 +1,177 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright 2016-2017 Google, Inc ++ * ++ * Fairchild FUSB302 Type-C Chip Driver ++ */ ++ ++#ifndef FUSB302_REG_H ++#define FUSB302_REG_H ++ ++#define FUSB_REG_DEVICE_ID 0x01 ++#define FUSB_REG_SWITCHES0 0x02 ++#define FUSB_REG_SWITCHES0_CC2_PU_EN BIT(7) ++#define FUSB_REG_SWITCHES0_CC1_PU_EN BIT(6) ++#define FUSB_REG_SWITCHES0_VCONN_CC2 BIT(5) ++#define FUSB_REG_SWITCHES0_VCONN_CC1 BIT(4) ++#define FUSB_REG_SWITCHES0_MEAS_CC2 BIT(3) ++#define FUSB_REG_SWITCHES0_MEAS_CC1 BIT(2) ++#define FUSB_REG_SWITCHES0_CC2_PD_EN BIT(1) ++#define FUSB_REG_SWITCHES0_CC1_PD_EN BIT(0) ++#define FUSB_REG_SWITCHES1 0x03 ++#define FUSB_REG_SWITCHES1_POWERROLE BIT(7) ++#define FUSB_REG_SWITCHES1_SPECREV1 BIT(6) ++#define FUSB_REG_SWITCHES1_SPECREV0 BIT(5) ++#define FUSB_REG_SWITCHES1_DATAROLE BIT(4) ++#define FUSB_REG_SWITCHES1_AUTO_GCRC BIT(2) ++#define FUSB_REG_SWITCHES1_TXCC2_EN BIT(1) ++#define FUSB_REG_SWITCHES1_TXCC1_EN BIT(0) ++#define FUSB_REG_MEASURE 0x04 ++#define FUSB_REG_MEASURE_MDAC5 BIT(7) ++#define FUSB_REG_MEASURE_MDAC4 BIT(6) ++#define FUSB_REG_MEASURE_MDAC3 BIT(5) ++#define FUSB_REG_MEASURE_MDAC2 BIT(4) ++#define FUSB_REG_MEASURE_MDAC1 BIT(3) ++#define FUSB_REG_MEASURE_MDAC0 BIT(2) ++#define FUSB_REG_MEASURE_VBUS BIT(1) ++#define FUSB_REG_MEASURE_XXXX5 BIT(0) ++#define FUSB_REG_CONTROL0 0x06 ++#define FUSB_REG_CONTROL0_TX_FLUSH BIT(6) ++#define FUSB_REG_CONTROL0_INT_MASK BIT(5) ++#define FUSB_REG_CONTROL0_HOST_CUR_MASK (0xC) ++#define FUSB_REG_CONTROL0_HOST_CUR_HIGH (0xC) ++#define FUSB_REG_CONTROL0_HOST_CUR_MED (0x8) ++#define FUSB_REG_CONTROL0_HOST_CUR_DEF (0x4) ++#define FUSB_REG_CONTROL0_TX_START BIT(0) ++#define FUSB_REG_CONTROL1 0x07 ++#define FUSB_REG_CONTROL1_ENSOP2DB BIT(6) ++#define FUSB_REG_CONTROL1_ENSOP1DB BIT(5) ++#define FUSB_REG_CONTROL1_BIST_MODE2 BIT(4) ++#define FUSB_REG_CONTROL1_RX_FLUSH BIT(2) ++#define FUSB_REG_CONTROL1_ENSOP2 BIT(1) ++#define FUSB_REG_CONTROL1_ENSOP1 BIT(0) ++#define FUSB_REG_CONTROL2 0x08 ++#define FUSB_REG_CONTROL2_MODE BIT(1) ++#define FUSB_REG_CONTROL2_MODE_MASK (0x6) ++#define FUSB_REG_CONTROL2_MODE_DFP (0x6) ++#define FUSB_REG_CONTROL2_MODE_UFP (0x4) ++#define FUSB_REG_CONTROL2_MODE_DRP (0x2) ++#define FUSB_REG_CONTROL2_MODE_NONE (0x0) ++#define FUSB_REG_CONTROL2_TOGGLE BIT(0) ++#define FUSB_REG_CONTROL3 0x09 ++#define FUSB_REG_CONTROL3_SEND_HARDRESET BIT(6) ++#define FUSB_REG_CONTROL3_BIST_TMODE BIT(5) /* 302B Only */ ++#define FUSB_REG_CONTROL3_AUTO_HARDRESET BIT(4) ++#define FUSB_REG_CONTROL3_AUTO_SOFTRESET BIT(3) ++#define FUSB_REG_CONTROL3_N_RETRIES BIT(1) ++#define FUSB_REG_CONTROL3_N_RETRIES_MASK (0x6) ++#define FUSB_REG_CONTROL3_N_RETRIES_3 (0x6) ++#define FUSB_REG_CONTROL3_N_RETRIES_2 (0x4) ++#define FUSB_REG_CONTROL3_N_RETRIES_1 (0x2) ++#define FUSB_REG_CONTROL3_AUTO_RETRY BIT(0) ++#define FUSB_REG_MASK 0x0A ++#define FUSB_REG_MASK_VBUSOK BIT(7) ++#define FUSB_REG_MASK_ACTIVITY BIT(6) ++#define FUSB_REG_MASK_COMP_CHNG BIT(5) ++#define FUSB_REG_MASK_CRC_CHK BIT(4) ++#define FUSB_REG_MASK_ALERT BIT(3) ++#define FUSB_REG_MASK_WAKE BIT(2) ++#define FUSB_REG_MASK_COLLISION BIT(1) ++#define FUSB_REG_MASK_BC_LVL BIT(0) ++#define FUSB_REG_POWER 0x0B ++#define FUSB_REG_POWER_PWR BIT(0) ++#define FUSB_REG_POWER_PWR_LOW 0x1 ++#define FUSB_REG_POWER_PWR_MEDIUM 0x3 ++#define FUSB_REG_POWER_PWR_HIGH 0x7 ++#define FUSB_REG_POWER_PWR_ALL 0xF ++#define FUSB_REG_RESET 0x0C ++#define FUSB_REG_RESET_PD_RESET BIT(1) ++#define FUSB_REG_RESET_SW_RESET BIT(0) ++#define FUSB_REG_MASKA 0x0E ++#define FUSB_REG_MASKA_OCP_TEMP BIT(7) ++#define FUSB_REG_MASKA_TOGDONE BIT(6) ++#define FUSB_REG_MASKA_SOFTFAIL BIT(5) ++#define FUSB_REG_MASKA_RETRYFAIL BIT(4) ++#define FUSB_REG_MASKA_HARDSENT BIT(3) ++#define FUSB_REG_MASKA_TX_SUCCESS BIT(2) ++#define FUSB_REG_MASKA_SOFTRESET BIT(1) ++#define FUSB_REG_MASKA_HARDRESET BIT(0) ++#define FUSB_REG_MASKB 0x0F ++#define FUSB_REG_MASKB_GCRCSENT BIT(0) ++#define FUSB_REG_STATUS0A 0x3C ++#define FUSB_REG_STATUS0A_SOFTFAIL BIT(5) ++#define FUSB_REG_STATUS0A_RETRYFAIL BIT(4) ++#define FUSB_REG_STATUS0A_POWER BIT(2) ++#define FUSB_REG_STATUS0A_RX_SOFT_RESET BIT(1) ++#define FUSB_REG_STATUS0A_RX_HARD_RESET BIT(0) ++#define FUSB_REG_STATUS1A 0x3D ++#define FUSB_REG_STATUS1A_TOGSS BIT(3) ++#define FUSB_REG_STATUS1A_TOGSS_RUNNING 0x0 ++#define FUSB_REG_STATUS1A_TOGSS_SRC1 0x1 ++#define FUSB_REG_STATUS1A_TOGSS_SRC2 0x2 ++#define FUSB_REG_STATUS1A_TOGSS_SNK1 0x5 ++#define FUSB_REG_STATUS1A_TOGSS_SNK2 0x6 ++#define FUSB_REG_STATUS1A_TOGSS_AA 0x7 ++#define FUSB_REG_STATUS1A_TOGSS_POS (3) ++#define FUSB_REG_STATUS1A_TOGSS_MASK (0x7) ++#define FUSB_REG_STATUS1A_RXSOP2DB BIT(2) ++#define FUSB_REG_STATUS1A_RXSOP1DB BIT(1) ++#define FUSB_REG_STATUS1A_RXSOP BIT(0) ++#define FUSB_REG_INTERRUPTA 0x3E ++#define FUSB_REG_INTERRUPTA_OCP_TEMP BIT(7) ++#define FUSB_REG_INTERRUPTA_TOGDONE BIT(6) ++#define FUSB_REG_INTERRUPTA_SOFTFAIL BIT(5) ++#define FUSB_REG_INTERRUPTA_RETRYFAIL BIT(4) ++#define FUSB_REG_INTERRUPTA_HARDSENT BIT(3) ++#define FUSB_REG_INTERRUPTA_TX_SUCCESS BIT(2) ++#define FUSB_REG_INTERRUPTA_SOFTRESET BIT(1) ++#define FUSB_REG_INTERRUPTA_HARDRESET BIT(0) ++#define FUSB_REG_INTERRUPTB 0x3F ++#define FUSB_REG_INTERRUPTB_GCRCSENT BIT(0) ++#define FUSB_REG_STATUS0 0x40 ++#define FUSB_REG_STATUS0_VBUSOK BIT(7) ++#define FUSB_REG_STATUS0_ACTIVITY BIT(6) ++#define FUSB_REG_STATUS0_COMP BIT(5) ++#define FUSB_REG_STATUS0_CRC_CHK BIT(4) ++#define FUSB_REG_STATUS0_ALERT BIT(3) ++#define FUSB_REG_STATUS0_WAKE BIT(2) ++#define FUSB_REG_STATUS0_BC_LVL_MASK 0x03 ++#define FUSB_REG_STATUS0_BC_LVL_0_200 0x0 ++#define FUSB_REG_STATUS0_BC_LVL_200_600 0x1 ++#define FUSB_REG_STATUS0_BC_LVL_600_1230 0x2 ++#define FUSB_REG_STATUS0_BC_LVL_1230_MAX 0x3 ++#define FUSB_REG_STATUS0_BC_LVL1 BIT(1) ++#define FUSB_REG_STATUS0_BC_LVL0 BIT(0) ++#define FUSB_REG_STATUS1 0x41 ++#define FUSB_REG_STATUS1_RXSOP2 BIT(7) ++#define FUSB_REG_STATUS1_RXSOP1 BIT(6) ++#define FUSB_REG_STATUS1_RX_EMPTY BIT(5) ++#define FUSB_REG_STATUS1_RX_FULL BIT(4) ++#define FUSB_REG_STATUS1_TX_EMPTY BIT(3) ++#define FUSB_REG_STATUS1_TX_FULL BIT(2) ++#define FUSB_REG_INTERRUPT 0x42 ++#define FUSB_REG_INTERRUPT_VBUSOK BIT(7) ++#define FUSB_REG_INTERRUPT_ACTIVITY BIT(6) ++#define FUSB_REG_INTERRUPT_COMP_CHNG BIT(5) ++#define FUSB_REG_INTERRUPT_CRC_CHK BIT(4) ++#define FUSB_REG_INTERRUPT_ALERT BIT(3) ++#define FUSB_REG_INTERRUPT_WAKE BIT(2) ++#define FUSB_REG_INTERRUPT_COLLISION BIT(1) ++#define FUSB_REG_INTERRUPT_BC_LVL BIT(0) ++#define FUSB_REG_FIFOS 0x43 ++ ++/* Tokens defined for the FUSB302 TX FIFO */ ++enum fusb302_txfifo_tokens { ++ FUSB302_TKN_TXON = 0xA1, ++ FUSB302_TKN_SYNC1 = 0x12, ++ FUSB302_TKN_SYNC2 = 0x13, ++ FUSB302_TKN_SYNC3 = 0x1B, ++ FUSB302_TKN_RST1 = 0x15, ++ FUSB302_TKN_RST2 = 0x16, ++ FUSB302_TKN_PACKSYM = 0x80, ++ FUSB302_TKN_JAMCRC = 0xFF, ++ FUSB302_TKN_EOP = 0x14, ++ FUSB302_TKN_TXOFF = 0xFE, ++}; ++ ++#endif + +From patchwork Thu Sep 5 15:08:39 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sebastian Reichel +X-Patchwork-Id: 1981310 +X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com + header.a=rsa-sha256 header.s=mail header.b=OlVGM1CY; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4X02yx4Yhtz1yXY + for ; Fri, 6 Sep 2024 01:17:13 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id DA19F88CC4; + Thu, 5 Sep 2024 17:17:10 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com + header.b="OlVGM1CY"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 818FF88CD1; Thu, 5 Sep 2024 17:17:10 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_VALIDITY_RPBL_BLOCKED, + RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from bali.collaboradmins.com (bali.collaboradmins.com + [148.251.105.195]) + (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 6EA7A88C91 + for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sebastian.reichel@collabora.com +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; + s=mail; t=1725549428; + bh=MaX9knvNNlkcoU7y63UAKlXcI2FWJjBx6Z541dTO9i4=; + h=From:To:Cc:Subject:Date:In-Reply-To:References:From; + b=OlVGM1CYARH8jR7hX1JCyzjLoOvYonq4dVpddV7tqHKv1GFwV9kFs0BQ4idvjHy/T + 8dmf8Dp7LkEStFeQOeVF3FgD3kjcRIYq3a5QWQFKwba/sLcp1VQ7mycHrCP+uN1RoX + /uKEccUu41G7R4ERpXHJ6QrLVyWLcW1x86YZPE/mq17AETdmUfj2OUO/vCeoZ4lpvg + zTniAnbJTy/4BLPaDtK760efy5eYghMStjR8BfjQNKUWA1h2UAW5anloE/cgSsgWjT + m9wxvIxG3UqPf1YKEMUUgxOAyu/gjKrdK4rCKEY/ox+UAyg1Q2EQaHWm50UFUlNLjj + q0jLt7uyLlMvg== +Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de + [91.248.189.231]) + (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) (Authenticated sender: sre) + by bali.collaboradmins.com (Postfix) with ESMTPSA id EDB4F17E145D; + Thu, 5 Sep 2024 17:17:07 +0200 (CEST) +Received: by jupiter.universe (Postfix, from userid 1000) + id A34D14800F6; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) +From: Sebastian Reichel +To: Marek Vasut , u-boot@lists.denx.de, + Jonas Karlman , Soeren Moch +Cc: Eugen Hristev , + Tim Harvey , Kever Yang , + Philipp Tomsich , Simon Glass , + Sebastian Reichel +Subject: [PATCH v6 3/6] board: rock5b-rk3588: enable USB-C in operating system +Date: Thu, 5 Sep 2024 17:08:39 +0200 +Message-ID: <20240905151707.59101-4-sebastian.reichel@collabora.com> +X-Mailer: git-send-email 2.45.2 +In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> +References: <20240905151707.59101-1-sebastian.reichel@collabora.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 + +Since older U-Boot releases do not negotiate USB PD, the kernel +DT may not enable the USB-C controller by default to avoid a +regression. The plan is to upstream it with 'status = "fail";' +instead. U-Boot should then mark it as 'status = "okay";' if +it negotiated USB PD. Currently existing upstream kernel DTs do +not yet have the USB-C controller at all, so we ignore any +failures. + +Reviewed-by: Kever Yang +Tested-by: Soeren Moch +Signed-off-by: Sebastian Reichel +--- + board/radxa/rock5b-rk3588/Makefile | 6 ++++++ + board/radxa/rock5b-rk3588/rock5b-rk3588.c | 16 ++++++++++++++++ + 2 files changed, 22 insertions(+) + create mode 100644 board/radxa/rock5b-rk3588/Makefile + create mode 100644 board/radxa/rock5b-rk3588/rock5b-rk3588.c + +diff --git a/board/radxa/rock5b-rk3588/Makefile b/board/radxa/rock5b-rk3588/Makefile +new file mode 100644 +index 000000000000..95d813596da4 +--- /dev/null ++++ b/board/radxa/rock5b-rk3588/Makefile +@@ -0,0 +1,6 @@ ++# SPDX-License-Identifier: GPL-2.0+ ++# ++# Copyright (c) 2022 Collabora Ltd. ++# ++ ++obj-y += rock5b-rk3588.o +diff --git a/board/radxa/rock5b-rk3588/rock5b-rk3588.c b/board/radxa/rock5b-rk3588/rock5b-rk3588.c +new file mode 100644 +index 000000000000..fc2f69db2241 +--- /dev/null ++++ b/board/radxa/rock5b-rk3588/rock5b-rk3588.c +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (c) 2023-2024 Collabora Ltd. ++ */ ++ ++#include ++#include ++ ++#ifdef CONFIG_OF_BOARD_SETUP ++int ft_board_setup(void *blob, struct bd_info *bd) ++{ ++ if (IS_ENABLED(CONFIG_TYPEC_FUSB302)) ++ fdt_status_okay_by_compatible(blob, "fcs,fusb302"); ++ return 0; ++} ++#endif + +From patchwork Thu Sep 5 15:08:40 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sebastian Reichel +X-Patchwork-Id: 1981311 +X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com + header.a=rsa-sha256 header.s=mail header.b=Hn8Z4MVu; + 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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4X02z82c6zz1yXY + for ; Fri, 6 Sep 2024 01:17:24 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 3EDBD88CA2; + Thu, 5 Sep 2024 17:17:13 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com + header.b="Hn8Z4MVu"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 710CF88CA2; Thu, 5 Sep 2024 17:17:12 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from bali.collaboradmins.com (bali.collaboradmins.com + [IPv6:2a01:4f8:201:9162::2]) + (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 7D4DC88CAC + for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sebastian.reichel@collabora.com +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; + s=mail; t=1725549428; + bh=kRtQV3aUzqRixo2bcjF9nXzgL+cYAS6B3o857NdybTM=; + h=From:To:Cc:Subject:Date:In-Reply-To:References:From; + b=Hn8Z4MVuPomOScWvWRuPJHT3m84jMoUdUdcI4V6fC8w0zfN0PSB22YMSaMxRDqiQR + D1gyzQpG0bCWuGp89DNtLngEOXCfXPqQh98ArUJFVvn5FVbYDlml9cXwVW02zXglIb + KP92KXxaQTgjWDb6QntmbJHNZVhAMNOCCqIknf4YFMc4/7yGTUsOxI5VD/oY5bbwVJ + aTVCT3SuwJvmXu7Dj150fFYeT0furN5MZT1P/MPFXd1/bnC9Dj+YTT6lm3kw6waCZN + OcRx6P7sRha82dm44zV4xjWnpHPDGGYqTyWNSD72Xj7/CASin5aosS6NbZFpndvcfx + 30yLrCrJPsm3g== +Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de + [91.248.189.231]) + (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) (Authenticated sender: sre) + by bali.collaboradmins.com (Postfix) with ESMTPSA id EF4D117E14D6; + Thu, 5 Sep 2024 17:17:07 +0200 (CEST) +Received: by jupiter.universe (Postfix, from userid 1000) + id A518D4800F8; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) +From: Sebastian Reichel +To: Marek Vasut , u-boot@lists.denx.de, + Jonas Karlman , Soeren Moch +Cc: Eugen Hristev , + Tim Harvey , Kever Yang , + Philipp Tomsich , Simon Glass , + Sebastian Reichel +Subject: [PATCH v6 4/6] rockchip: rk3588-rock-5b: Add USB-C controller to + u-boot.dtsi +Date: Thu, 5 Sep 2024 17:08:40 +0200 +Message-ID: <20240905151707.59101-5-sebastian.reichel@collabora.com> +X-Mailer: git-send-email 2.45.2 +In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> +References: <20240905151707.59101-1-sebastian.reichel@collabora.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 USB-C controller (fusb302), which will be used by U-Boot to +initialize USB-PD. This is needed, because USB-PD communication +must happen within 5 seconds after the USB-C connector got plugged. +On my Rock 5B it often takes 5 seconds to jump to the Linux binary, +so it must happen before Linux is initialized. + +This adds the DT node to the U-Boot specific file, since the Linux +kernel DT currently does not describe it to avoid a system reset. +The plan is to add it to the Linux DT with status = 'fail' and then +let U-Boot mark it as status = 'okay' if it properly dealt with +early USB-PD initialization. Until the Kernel DT has the node, let's +add it in U-Boot to get things going. + +Reviewed-by: Kever Yang +Tested-by: Soeren Moch +Signed-off-by: Sebastian Reichel +--- + arch/arm/dts/rk3588-rock-5b-u-boot.dtsi | 28 +++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi b/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +index 4dd17ff408cb..b0ad1158854c 100644 +--- a/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi ++++ b/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi +@@ -3,6 +3,7 @@ + * Copyright (c) 2023 Collabora Ltd. + */ + ++#include + #include "rk3588-u-boot.dtsi" + + &fspim2_pins { +@@ -10,6 +11,33 @@ + bootph-some-ram; + }; + ++&i2c4 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c4m1_xfer>; ++ status = "okay"; ++ ++ usbc0: usb-typec@22 { ++ compatible = "fcs,fusb302"; ++ reg = <0x22>; ++ interrupt-parent = <&gpio3>; ++ interrupts = ; ++ pinctrl-names = "default"; ++ status = "okay"; ++ ++ usb_con: connector { ++ compatible = "usb-c-connector"; ++ label = "USB-C"; ++ data-role = "dual"; ++ power-role = "sink"; ++ try-power-role = "sink"; ++ op-sink-microwatt = <1000000>; ++ sink-pdos = ++ , ++ ; ++ }; ++ }; ++}; ++ + &sdhci { + cap-mmc-highspeed; + mmc-hs200-1_8v; + +From patchwork Thu Sep 5 15:08:41 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sebastian Reichel +X-Patchwork-Id: 1981313 +X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com + header.a=rsa-sha256 header.s=mail header.b=q3YksfJp; + 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 4X02zX1GHQz1yXY + for ; Fri, 6 Sep 2024 01:17:44 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 23B9E88C91; + Thu, 5 Sep 2024 17:17:15 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com + header.b="q3YksfJp"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 4A27388CC2; Thu, 5 Sep 2024 17:17:14 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no + version=3.4.2 +Received: from bali.collaboradmins.com (bali.collaboradmins.com + [IPv6:2a01:4f8:201:9162::2]) + (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 AA9CC88CCA + for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sebastian.reichel@collabora.com +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; + s=mail; t=1725549428; + bh=2Lc5Z/YfVP+p0ckRM3rvfdY5jCUdmYScP+mrStWhXgc=; + h=From:To:Cc:Subject:Date:In-Reply-To:References:From; + b=q3YksfJpB4KE3b6jOT8upI79aMX8TsaVAMMBCfHQfd81c94VAOjQE0sKeQG7MZhks + 8MtawvxDPZLokcfL/SI5h7MM+BY3PUAHRF0055L3SENSD8jyNOgSjkmmOOLY27PFGF + LNYyTuhYLE7uZyVOevaq9skCiKVRhV7HtSQcv1ac6YuIyinwrpCN42yaHFG/m6SpO+ + lTxi9/43YenBpHkbZHxt8llNxRKcPbDdXMQcwZE6f0ksz92jfSioU5dJEMwJnFYvLm + XSuzTPYuERV+/O82eUGYarkAczW2F0SfMOKWdb6C85FiS1hNj2Wqo6bM4G+GNyDUWz + ORIxUtmwVAgwg== +Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de + [91.248.189.231]) + (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) (Authenticated sender: sre) + by bali.collaboradmins.com (Postfix) with ESMTPSA id 3C7D917E14D7; + Thu, 5 Sep 2024 17:17:08 +0200 (CEST) +Received: by jupiter.universe (Postfix, from userid 1000) + id A72CD4800FF; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) +From: Sebastian Reichel +To: Marek Vasut , u-boot@lists.denx.de, + Jonas Karlman , Soeren Moch +Cc: Eugen Hristev , + Tim Harvey , Kever Yang , + Philipp Tomsich , Simon Glass , + Sebastian Reichel +Subject: [PATCH v6 5/6] rockchip: rock5b-rk3588: Enable USB-C PD support +Date: Thu, 5 Sep 2024 17:08:41 +0200 +Message-ID: <20240905151707.59101-6-sebastian.reichel@collabora.com> +X-Mailer: git-send-email 2.45.2 +In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> +References: <20240905151707.59101-1-sebastian.reichel@collabora.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 + +Now that all code has been prepared update the default configuration to +make use of it. + +Reviewed-by: Kever Yang +Tested-by: Soeren Moch +Signed-off-by: Sebastian Reichel +--- + configs/rock5b-rk3588_defconfig | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig +index 80a2f2fed586..82c942a52d62 100644 +--- a/configs/rock5b-rk3588_defconfig ++++ b/configs/rock5b-rk3588_defconfig +@@ -23,6 +23,7 @@ CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y + CONFIG_SPL_LOAD_FIT=y + CONFIG_LEGACY_IMAGE_FORMAT=y ++CONFIG_OF_BOARD_SETUP=y + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-rock-5b.dtb" + # CONFIG_DISPLAY_CPUINFO is not set + CONFIG_DISPLAY_BOARDINFO_LATE=y +@@ -103,3 +104,6 @@ CONFIG_USB_GADGET=y + CONFIG_USB_GADGET_DOWNLOAD=y + CONFIG_USB_FUNCTION_ROCKUSB=y + CONFIG_ERRNO_STR=y ++CONFIG_TYPEC_TCPM=y ++CONFIG_TYPEC_FUSB302=y ++CONFIG_CMD_TCPM=y + +From patchwork Thu Sep 5 15:08:42 2024 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sebastian Reichel +X-Patchwork-Id: 1981314 +X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com + header.a=rsa-sha256 header.s=mail header.b=Ci2PO1GU; + 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 4X02zk6YyNz1yXY + for ; Fri, 6 Sep 2024 01:17:54 +1000 (AEST) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 7F41A88CE5; + Thu, 5 Sep 2024 17:17:15 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com + header.b="Ci2PO1GU"; + dkim-atps=neutral +Received: by phobos.denx.de (Postfix, from userid 109) + id 6ED1888CC2; Thu, 5 Sep 2024 17:17:14 +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,DKIM_SIGNED, + DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, + T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 +Received: from bali.collaboradmins.com (bali.collaboradmins.com + [IPv6:2a01:4f8:201:9162::2]) + (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 CD5F888CD0 + for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) +Authentication-Results: phobos.denx.de; + dmarc=pass (p=none dis=none) header.from=collabora.com +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=sebastian.reichel@collabora.com +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; + s=mail; t=1725549428; + bh=l4Xv+BpciSynhuTx8UEne0BTouVROBqh6qBZSM+vxDg=; + h=From:To:Cc:Subject:Date:In-Reply-To:References:From; + b=Ci2PO1GUFnjJQSAIA8bOSaKduXeFJwF8D+1yGRBAT9+M+oNdtaLQKmdPE/XuBAMBF + hEDngnCgvcZdH4Q3uiLUEDi1jZqjU3+VPGTR6fECGe8zriHIja8R6NQR3NCHsfcQMr + E74ZH8bkjhX6S3MYLjZMLTrFBjTAGvshUtI7gKh7Xyet03KYD1xZlvJV71d196Ygty + pr1imuqccIOh7cUE8V2YsSoaibrkiiA9uEpvNr0u9JxE2dvd5HrVR+Uftjzh21ATyo + RERAB90Lf6rr4hdtA1KaFrpuFgWMWKwVL2OKtE8wxPHaUo23Cq36LXmMeeho8nL73T + 5XslHm2u6aESA== +Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de + [91.248.189.231]) + (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) (Authenticated sender: sre) + by bali.collaboradmins.com (Postfix) with ESMTPSA id 3F1DD17E14D8; + Thu, 5 Sep 2024 17:17:08 +0200 (CEST) +Received: by jupiter.universe (Postfix, from userid 1000) + id A909F480100; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) +From: Sebastian Reichel +To: Marek Vasut , u-boot@lists.denx.de, + Jonas Karlman , Soeren Moch +Cc: Eugen Hristev , + Tim Harvey , Kever Yang , + Philipp Tomsich , Simon Glass , + Sebastian Reichel +Subject: [PATCH v6 6/6] MAINTAINERS: add TCPM section +Date: Thu, 5 Sep 2024 17:08:42 +0200 +Message-ID: <20240905151707.59101-7-sebastian.reichel@collabora.com> +X-Mailer: git-send-email 2.45.2 +In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> +References: <20240905151707.59101-1-sebastian.reichel@collabora.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 new section for USB TypeC Port Manager (TCPM) support, which +is needed to figure out cable orientation of USB-C plus and to do +USB PD communication. + +Signed-off-by: Sebastian Reichel +--- + MAINTAINERS | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/MAINTAINERS b/MAINTAINERS +index 2050ae24df82..f3cf84d20dbd 100644 +--- a/MAINTAINERS ++++ b/MAINTAINERS +@@ -1721,6 +1721,15 @@ F: common/usb_kbd.c + F: common/usb_storage.c + F: include/usb.h + ++USB TCPM ++M: Sebastian Reichel ++S: Maintained ++F: cmd/tcpm.c ++F: doc/usage/cmd/tcpm.rst ++F: drivers/usb/tcpm/ ++F: include/usb/pd.h ++F: include/usb/tcpm.h ++ + USB xHCI + M: Bin Meng + S: Maintained diff --git a/sources b/sources index 3c6cf70..f50fe43 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.10-rc4.tar.bz2) = 31869a7a6c6592ffe73b2f71c4985ace8beee33b232f4e8cbb8d2ebcee9b08d7bedeb57ca7e36cbadf42df44283b0ba79e87b55b1b2f94f2cc4a01cbce747cf7 +SHA512 (u-boot-2024.10-rc5.tar.bz2) = bd86b6cc780ac79fef2abca1e6b27a97312105e6a8d809d8a7f93e3665342f90352124786ec075b5a64cf6705a91ae507dff127d2062c64ecdb325e395a7b0d9 diff --git a/uboot-tools.spec b/uboot-tools.spec index 09f67c6..2098d1e 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc4 +%global candidate rc5 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.10 -Release: 0.5%{?candidate:.%{candidate}}%{?dist} +Release: 0.6%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ @@ -31,8 +31,9 @@ Patch5: enable-bootmenu-by-default.patch # Rockchips improvements Patch10: rockchip-Enable-preboot-start-for-pci-usb.patch +Patch11: FUSB302-USB-C-controller-support.patch # QCom -Patch11: Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch +Patch15: Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch BuildRequires: bc BuildRequires: bison @@ -206,6 +207,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Mon Sep 16 2024 Peter Robinson - 1:2024.10-0.6.rc5 +- Update to 2024.10 RC5 + * Fri Sep 20 2024 Peter Robinson - 1:2024.10-0.5.rc4 - Add missing licenses directory From ebdce54175b30a10f2777cb358a7a5386ba46061 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 17 Sep 2024 07:53:12 +0100 Subject: [PATCH 050/128] fix changelog date --- uboot-tools.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 2098d1e..a7cc4bf 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -210,7 +210,7 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} * Mon Sep 16 2024 Peter Robinson - 1:2024.10-0.6.rc5 - Update to 2024.10 RC5 -* Fri Sep 20 2024 Peter Robinson - 1:2024.10-0.5.rc4 +* Fri Sep 6 2024 Peter Robinson - 1:2024.10-0.5.rc4 - Add missing licenses directory * Tue Sep 03 2024 Peter Robinson - 1:2024.10-0.4.rc4 From 511682db4a42872dc47378a5863a87fdbbaebbd6 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 23 Sep 2024 19:52:54 +0100 Subject: [PATCH 051/128] Add rk35xx for pci/usb enum --- ...hip-Enable-preboot-start-for-pci-usb.patch | 630 ++++++++++++++++++ 1 file changed, 630 insertions(+) diff --git a/rockchip-Enable-preboot-start-for-pci-usb.patch b/rockchip-Enable-preboot-start-for-pci-usb.patch index 56756bc..0542ab0 100644 --- a/rockchip-Enable-preboot-start-for-pci-usb.patch +++ b/rockchip-Enable-preboot-start-for-pci-usb.patch @@ -165,3 +165,633 @@ index fc0804a0b80..9a94d96b148 100644 -- 2.45.1 +From 5116720be74a92417c69229fc45a97502869ff9b Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Mon, 23 Sep 2024 19:51:00 +0100 +Subject: [PATCH] rockchip: rk35xx: Enable preboot start for pci/usb + +Enable the preboot so nvme works OOTB + +Signed-off-by: Peter Robinson +--- + configs/anbernic-rgxx3-rk3566_defconfig | 2 ++ + configs/bpi-r2-pro-rk3568_defconfig | 2 ++ + configs/cm3588-nas-rk3588_defconfig | 2 ++ + configs/coolpi-4b-rk3588s_defconfig | 2 ++ + configs/coolpi-cm5-evb-rk3588_defconfig | 2 ++ + configs/evb-rk3568_defconfig | 2 ++ + configs/evb-rk3588_defconfig | 2 ++ + configs/generic-rk3568_defconfig | 2 ++ + configs/generic-rk3588_defconfig | 2 ++ + configs/jaguar-rk3588_defconfig | 2 ++ + configs/lubancat-2-rk3568_defconfig | 2 ++ + configs/nanopc-t6-rk3588_defconfig | 2 ++ + configs/nanopi-r5c-rk3568_defconfig | 2 ++ + configs/nanopi-r5s-rk3568_defconfig | 2 ++ + configs/nanopi-r6c-rk3588s_defconfig | 2 ++ + configs/nanopi-r6s-rk3588s_defconfig | 2 ++ + configs/neu6a-io-rk3588_defconfig | 2 ++ + configs/neu6b-io-rk3588_defconfig | 2 ++ + configs/nova-rk3588s_defconfig | 2 ++ + configs/odroid-m1-rk3568_defconfig | 2 ++ + configs/orangepi-3b-rk3566_defconfig | 2 ++ + configs/orangepi-5-plus-rk3588_defconfig | 2 ++ + configs/orangepi-5-rk3588s_defconfig | 2 ++ + configs/pinetab2-rk3566_defconfig | 2 ++ + configs/powkiddy-x55-rk3566_defconfig | 2 ++ + configs/quartz64-a-rk3566_defconfig | 2 ++ + configs/quartz64-b-rk3566_defconfig | 2 ++ + configs/quartzpro64-rk3588_defconfig | 2 ++ + configs/radxa-cm3-io-rk3566_defconfig | 2 ++ + configs/radxa-e25-rk3568_defconfig | 2 ++ + configs/radxa-zero-3-rk3566_defconfig | 2 ++ + configs/rock-3a-rk3568_defconfig | 2 ++ + configs/rock-3b-rk3568_defconfig | 2 ++ + configs/rock-3c-rk3566_defconfig | 2 ++ + configs/rock-5-itx-rk3588_defconfig | 2 ++ + configs/rock5a-rk3588s_defconfig | 2 ++ + configs/rock5b-rk3588_defconfig | 2 ++ + configs/sige7-rk3588_defconfig | 2 ++ + configs/soquartz-blade-rk3566_defconfig | 2 ++ + configs/soquartz-cm4-rk3566_defconfig | 2 ++ + configs/soquartz-model-a-rk3566_defconfig | 2 ++ + configs/tiger-rk3588_defconfig | 2 ++ + configs/toybrick-rk3588_defconfig | 2 ++ + configs/turing-rk1-rk3588_defconfig | 2 ++ + 44 files changed, 88 insertions(+) + +diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig +index a03509bf467..45cfaf5deb7 100644 +--- a/configs/anbernic-rgxx3-rk3566_defconfig ++++ b/configs/anbernic-rgxx3-rk3566_defconfig +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/bpi-r2-pro-rk3568_defconfig b/configs/bpi-r2-pro-rk3568_defconfig +index eccc15a0ae5..57d4fafbef4 100644 +--- a/configs/bpi-r2-pro-rk3568_defconfig ++++ b/configs/bpi-r2-pro-rk3568_defconfig +@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/cm3588-nas-rk3588_defconfig b/configs/cm3588-nas-rk3588_defconfig +index d6d82757a2d..7ef75dfedeb 100644 +--- a/configs/cm3588-nas-rk3588_defconfig ++++ b/configs/cm3588-nas-rk3588_defconfig +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/coolpi-4b-rk3588s_defconfig b/configs/coolpi-4b-rk3588s_defconfig +index 3d45d939abb..6005d0b556b 100644 +--- a/configs/coolpi-4b-rk3588s_defconfig ++++ b/configs/coolpi-4b-rk3588s_defconfig +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/coolpi-cm5-evb-rk3588_defconfig b/configs/coolpi-cm5-evb-rk3588_defconfig +index 5190d69c1c5..30f1690fe4d 100644 +--- a/configs/coolpi-cm5-evb-rk3588_defconfig ++++ b/configs/coolpi-cm5-evb-rk3588_defconfig +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig +index 2076f55122b..543c1a7d6ba 100644 +--- a/configs/evb-rk3568_defconfig ++++ b/configs/evb-rk3568_defconfig +@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/evb-rk3588_defconfig b/configs/evb-rk3588_defconfig +index 1d5585677a4..44ef0fd0f54 100644 +--- a/configs/evb-rk3588_defconfig ++++ b/configs/evb-rk3588_defconfig +@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/generic-rk3568_defconfig b/configs/generic-rk3568_defconfig +index 66a33afbbaf..b1bfb831aa5 100644 +--- a/configs/generic-rk3568_defconfig ++++ b/configs/generic-rk3568_defconfig +@@ -13,6 +13,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/generic-rk3588_defconfig b/configs/generic-rk3588_defconfig +index 42bc2c9a765..6c713094bf0 100644 +--- a/configs/generic-rk3588_defconfig ++++ b/configs/generic-rk3588_defconfig +@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/jaguar-rk3588_defconfig b/configs/jaguar-rk3588_defconfig +index 18006467dde..a5d7612d9a5 100644 +--- a/configs/jaguar-rk3588_defconfig ++++ b/configs/jaguar-rk3588_defconfig +@@ -15,6 +15,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/lubancat-2-rk3568_defconfig b/configs/lubancat-2-rk3568_defconfig +index 88593bfa705..870d8f72317 100644 +--- a/configs/lubancat-2-rk3568_defconfig ++++ b/configs/lubancat-2-rk3568_defconfig +@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/nanopc-t6-rk3588_defconfig b/configs/nanopc-t6-rk3588_defconfig +index 926267f93ad..7b0ac43d8c1 100644 +--- a/configs/nanopc-t6-rk3588_defconfig ++++ b/configs/nanopc-t6-rk3588_defconfig +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/nanopi-r5c-rk3568_defconfig b/configs/nanopi-r5c-rk3568_defconfig +index 8e30093ed9d..2c1d7b7435b 100644 +--- a/configs/nanopi-r5c-rk3568_defconfig ++++ b/configs/nanopi-r5c-rk3568_defconfig +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/nanopi-r5s-rk3568_defconfig b/configs/nanopi-r5s-rk3568_defconfig +index e1865b2e171..1afce812b22 100644 +--- a/configs/nanopi-r5s-rk3568_defconfig ++++ b/configs/nanopi-r5s-rk3568_defconfig +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/nanopi-r6c-rk3588s_defconfig b/configs/nanopi-r6c-rk3588s_defconfig +index f8d2d67bd35..e6e9cf1101a 100644 +--- a/configs/nanopi-r6c-rk3588s_defconfig ++++ b/configs/nanopi-r6c-rk3588s_defconfig +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/nanopi-r6s-rk3588s_defconfig b/configs/nanopi-r6s-rk3588s_defconfig +index f7b364655ff..fd28485db93 100644 +--- a/configs/nanopi-r6s-rk3588s_defconfig ++++ b/configs/nanopi-r6s-rk3588s_defconfig +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/neu6a-io-rk3588_defconfig b/configs/neu6a-io-rk3588_defconfig +index ac281e65392..3338f0a3160 100644 +--- a/configs/neu6a-io-rk3588_defconfig ++++ b/configs/neu6a-io-rk3588_defconfig +@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/neu6b-io-rk3588_defconfig b/configs/neu6b-io-rk3588_defconfig +index c01e5fb0d04..73cc8e6d0ff 100644 +--- a/configs/neu6b-io-rk3588_defconfig ++++ b/configs/neu6b-io-rk3588_defconfig +@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/nova-rk3588s_defconfig b/configs/nova-rk3588s_defconfig +index a2e2440359c..45862f403fb 100644 +--- a/configs/nova-rk3588s_defconfig ++++ b/configs/nova-rk3588s_defconfig +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/odroid-m1-rk3568_defconfig b/configs/odroid-m1-rk3568_defconfig +index b5263caff6d..a2217b530d1 100644 +--- a/configs/odroid-m1-rk3568_defconfig ++++ b/configs/odroid-m1-rk3568_defconfig +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/orangepi-3b-rk3566_defconfig b/configs/orangepi-3b-rk3566_defconfig +index 575dc4340d3..817de7b69e6 100644 +--- a/configs/orangepi-3b-rk3566_defconfig ++++ b/configs/orangepi-3b-rk3566_defconfig +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/orangepi-5-plus-rk3588_defconfig b/configs/orangepi-5-plus-rk3588_defconfig +index 138a633f320..e0aaa8dfb15 100644 +--- a/configs/orangepi-5-plus-rk3588_defconfig ++++ b/configs/orangepi-5-plus-rk3588_defconfig +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/orangepi-5-rk3588s_defconfig b/configs/orangepi-5-rk3588s_defconfig +index 33529d4cac3..09d8475d051 100644 +--- a/configs/orangepi-5-rk3588s_defconfig ++++ b/configs/orangepi-5-rk3588s_defconfig +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/pinetab2-rk3566_defconfig b/configs/pinetab2-rk3566_defconfig +index 2d075d12174..fcb3c474044 100644 +--- a/configs/pinetab2-rk3566_defconfig ++++ b/configs/pinetab2-rk3566_defconfig +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/powkiddy-x55-rk3566_defconfig b/configs/powkiddy-x55-rk3566_defconfig +index 2360bdbe84b..afb7f3ffafb 100644 +--- a/configs/powkiddy-x55-rk3566_defconfig ++++ b/configs/powkiddy-x55-rk3566_defconfig +@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/quartz64-a-rk3566_defconfig b/configs/quartz64-a-rk3566_defconfig +index 1ea8e0f40cc..a4211afb6a9 100644 +--- a/configs/quartz64-a-rk3566_defconfig ++++ b/configs/quartz64-a-rk3566_defconfig +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/quartz64-b-rk3566_defconfig b/configs/quartz64-b-rk3566_defconfig +index f61b2c181a1..408b63dbb08 100644 +--- a/configs/quartz64-b-rk3566_defconfig ++++ b/configs/quartz64-b-rk3566_defconfig +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/quartzpro64-rk3588_defconfig b/configs/quartzpro64-rk3588_defconfig +index 06c5cff3ca5..dccc550d4ef 100644 +--- a/configs/quartzpro64-rk3588_defconfig ++++ b/configs/quartzpro64-rk3588_defconfig +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/radxa-cm3-io-rk3566_defconfig b/configs/radxa-cm3-io-rk3566_defconfig +index 48c8fcf5a66..65198e4a507 100644 +--- a/configs/radxa-cm3-io-rk3566_defconfig ++++ b/configs/radxa-cm3-io-rk3566_defconfig +@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/radxa-e25-rk3568_defconfig b/configs/radxa-e25-rk3568_defconfig +index 496fee0e0a4..b726e47c3e0 100644 +--- a/configs/radxa-e25-rk3568_defconfig ++++ b/configs/radxa-e25-rk3568_defconfig +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/radxa-zero-3-rk3566_defconfig b/configs/radxa-zero-3-rk3566_defconfig +index 7606edf393e..d1611a638ae 100644 +--- a/configs/radxa-zero-3-rk3566_defconfig ++++ b/configs/radxa-zero-3-rk3566_defconfig +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/rock-3a-rk3568_defconfig b/configs/rock-3a-rk3568_defconfig +index 66ac2f6d7aa..1500691419d 100644 +--- a/configs/rock-3a-rk3568_defconfig ++++ b/configs/rock-3a-rk3568_defconfig +@@ -15,6 +15,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/rock-3b-rk3568_defconfig b/configs/rock-3b-rk3568_defconfig +index 937796811a9..38d048439ed 100644 +--- a/configs/rock-3b-rk3568_defconfig ++++ b/configs/rock-3b-rk3568_defconfig +@@ -15,6 +15,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/rock-3c-rk3566_defconfig b/configs/rock-3c-rk3566_defconfig +index f44b202c8c3..488b1c4e0c3 100644 +--- a/configs/rock-3c-rk3566_defconfig ++++ b/configs/rock-3c-rk3566_defconfig +@@ -15,6 +15,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/rock-5-itx-rk3588_defconfig b/configs/rock-5-itx-rk3588_defconfig +index bb9f148692a..1d6a9e9465b 100644 +--- a/configs/rock-5-itx-rk3588_defconfig ++++ b/configs/rock-5-itx-rk3588_defconfig +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/rock5a-rk3588s_defconfig b/configs/rock5a-rk3588s_defconfig +index c09e6655f02..39602d86845 100644 +--- a/configs/rock5a-rk3588s_defconfig ++++ b/configs/rock5a-rk3588s_defconfig +@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig +index 80a2f2fed58..d3cc8a19cfd 100644 +--- a/configs/rock5b-rk3588_defconfig ++++ b/configs/rock5b-rk3588_defconfig +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/sige7-rk3588_defconfig b/configs/sige7-rk3588_defconfig +index d15fc09fc8d..c77919cac79 100644 +--- a/configs/sige7-rk3588_defconfig ++++ b/configs/sige7-rk3588_defconfig +@@ -13,6 +13,8 @@ CONFIG_SPL_SPI=y + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/soquartz-blade-rk3566_defconfig b/configs/soquartz-blade-rk3566_defconfig +index 82910daf7cc..09fc6b6b6e5 100644 +--- a/configs/soquartz-blade-rk3566_defconfig ++++ b/configs/soquartz-blade-rk3566_defconfig +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/soquartz-cm4-rk3566_defconfig b/configs/soquartz-cm4-rk3566_defconfig +index 5744f1baa81..e5a9ee1938b 100644 +--- a/configs/soquartz-cm4-rk3566_defconfig ++++ b/configs/soquartz-cm4-rk3566_defconfig +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/soquartz-model-a-rk3566_defconfig b/configs/soquartz-model-a-rk3566_defconfig +index 920df9b622d..efcd3f5bc77 100644 +--- a/configs/soquartz-model-a-rk3566_defconfig ++++ b/configs/soquartz-model-a-rk3566_defconfig +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +diff --git a/configs/tiger-rk3588_defconfig b/configs/tiger-rk3588_defconfig +index 8eb1027e449..39e4946b0bf 100644 +--- a/configs/tiger-rk3588_defconfig ++++ b/configs/tiger-rk3588_defconfig +@@ -16,6 +16,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/toybrick-rk3588_defconfig b/configs/toybrick-rk3588_defconfig +index 12a076aeeae..c70210c0dee 100644 +--- a/configs/toybrick-rk3588_defconfig ++++ b/configs/toybrick-rk3588_defconfig +@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y + CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/turing-rk1-rk3588_defconfig b/configs/turing-rk1-rk3588_defconfig +index e6e1bda7ec1..e1bf365edc8 100644 +--- a/configs/turing-rk1-rk3588_defconfig ++++ b/configs/turing-rk1-rk3588_defconfig +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_FIT=y + CONFIG_FIT_VERBOSE=y +-- +2.46.1 + From 950f8e0de649f2a61bdd937a00fc67380c187f17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Such=C3=BD?= Date: Wed, 11 Sep 2024 04:33:22 +0000 Subject: [PATCH 052/128] Migrate to SPDX license (temporary ids) This is part of https://fedoraproject.org/wiki/Changes/SPDX_Licenses_Phase_4 Note that this is an SPDX identifier, but it still needs to be migrated to the proper identifiers in the fedora-license-data set. If there will be no comments in two weeks, I will merge this. --- uboot-tools.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index a7cc4bf..acb6f58 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -10,9 +10,9 @@ Version: 2024.10 Release: 0.6%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities -License: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ +# Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. +License: GPL-2.0-or-later AND LicenseRef-Callaway-BSD AND LGPL-2.1-or-later AND LGPL-2.0-or-later URL: http://www.denx.de/wiki/U-Boot - ExcludeArch: s390x Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}%{?candidate:-%{candidate}}.tar.bz2 Source1: aarch64-boards From 2605ac3cdc5da7e3d1fb3508929b9df553f5703f Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Wed, 2 Oct 2024 10:30:23 +0100 Subject: [PATCH 053/128] 2024.10 RC6 --- sources | 2 +- uboot-tools.spec | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sources b/sources index f50fe43..3a48403 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.10-rc5.tar.bz2) = bd86b6cc780ac79fef2abca1e6b27a97312105e6a8d809d8a7f93e3665342f90352124786ec075b5a64cf6705a91ae507dff127d2062c64ecdb325e395a7b0d9 +SHA512 (u-boot-2024.10-rc6.tar.bz2) = df569020757f330dc9f25f05712f02f4f8f1e3f5219223a439519050e684bee93971d85c2eb6a014e92e6ae6a2e59dac35b91c4f8e2cfa7884a5cf0083e8a023 diff --git a/uboot-tools.spec b/uboot-tools.spec index acb6f58..4a3fae8 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc5 +%global candidate rc6 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.10 -Release: 0.6%{?candidate:.%{candidate}}%{?dist} +Release: 0.7%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -207,6 +207,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Oct 01 2024 Peter Robinson - 1:2024.10-0.7.rc6 +- Update to 2024.10 RC6 + * Mon Sep 16 2024 Peter Robinson - 1:2024.10-0.6.rc5 - Update to 2024.10 RC5 From 33cdd961f3534e474899fc4f1d4f3e13f29aea83 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 3 Oct 2024 18:33:04 +0100 Subject: [PATCH 054/128] Pass CMA FW setting through to kernel DT for Raspberry Pi --- ...pi-Pass-CMA-through-from-firmware-DT.patch | 32 +++++++++++++++++++ uboot-tools.spec | 7 +++- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch diff --git a/0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch b/0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch new file mode 100644 index 0000000..aa19adf --- /dev/null +++ b/0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch @@ -0,0 +1,32 @@ +From 81a2ddb6c44ff87be51201372f8ca0d84aaef6c9 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Thu, 3 Oct 2024 18:25:51 +0100 +Subject: [PATCH] board: rpi: Pass CMA through from firmware DT + +For a lot of usecases, such as display, camera, media +the Raspberry Pi needs a lot more CMA than distros +configure as default so we should pass this parameter +through so things work as expected. + +Signed-off-by: Peter Robinson +--- + board/raspberrypi/rpi/rpi.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c +index ab5ea85cf9f..c50eb884074 100644 +--- a/board/raspberrypi/rpi/rpi.c ++++ b/board/raspberrypi/rpi/rpi.c +@@ -561,6 +561,9 @@ void update_fdt_from_fw(void *fdt, void *fw_fdt) + + /* address of the PHY device as provided by the firmware */ + copy_property(fdt, fw_fdt, "ethernet0/mdio@e14/ethernet-phy@1", "reg"); ++ ++ /* copy the CMA set from the firmware DT to linux */ ++ copy_property(fdt, fw_fdt, "cma", "size"); + } + + int ft_board_setup(void *blob, struct bd_info *bd) +-- +2.46.2 + diff --git a/uboot-tools.spec b/uboot-tools.spec index 4a3fae8..8fad7dc 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.10 -Release: 0.7%{?candidate:.%{candidate}}%{?dist} +Release: 0.8%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -34,6 +34,8 @@ Patch10: rockchip-Enable-preboot-start-for-pci-usb.patch Patch11: FUSB302-USB-C-controller-support.patch # QCom Patch15: Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch +# RPi +Patch20: 0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch BuildRequires: bc BuildRequires: bison @@ -207,6 +209,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Thu Oct 03 2024 Peter Robinson - 1:2024.10-0.8.rc6 +- Pass CMA FW setting through to kernel DT for Raspberry Pi + * Tue Oct 01 2024 Peter Robinson - 1:2024.10-0.7.rc6 - Update to 2024.10 RC6 From 53f4c13a16c04c4c85189c94a11367a42009e554 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 11 Oct 2024 17:03:55 +0100 Subject: [PATCH 055/128] Update to 2024.10 GA Fix passing RPi firmware CMA setting to kernel DT Update Geekbox --- ...pi-Pass-CMA-through-from-firmware-DT.patch | 32 --- rockchip-Modernise-Geekbox-config.patch | 189 ++++++++++++++++++ rpi-Pass-CMA-through-from-firmware-DT.patch | 40 ++++ sources | 2 +- uboot-tools.spec | 12 +- 5 files changed, 239 insertions(+), 36 deletions(-) delete mode 100644 0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch create mode 100644 rockchip-Modernise-Geekbox-config.patch create mode 100644 rpi-Pass-CMA-through-from-firmware-DT.patch diff --git a/0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch b/0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch deleted file mode 100644 index aa19adf..0000000 --- a/0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 81a2ddb6c44ff87be51201372f8ca0d84aaef6c9 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Thu, 3 Oct 2024 18:25:51 +0100 -Subject: [PATCH] board: rpi: Pass CMA through from firmware DT - -For a lot of usecases, such as display, camera, media -the Raspberry Pi needs a lot more CMA than distros -configure as default so we should pass this parameter -through so things work as expected. - -Signed-off-by: Peter Robinson ---- - board/raspberrypi/rpi/rpi.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c -index ab5ea85cf9f..c50eb884074 100644 ---- a/board/raspberrypi/rpi/rpi.c -+++ b/board/raspberrypi/rpi/rpi.c -@@ -561,6 +561,9 @@ void update_fdt_from_fw(void *fdt, void *fw_fdt) - - /* address of the PHY device as provided by the firmware */ - copy_property(fdt, fw_fdt, "ethernet0/mdio@e14/ethernet-phy@1", "reg"); -+ -+ /* copy the CMA set from the firmware DT to linux */ -+ copy_property(fdt, fw_fdt, "cma", "size"); - } - - int ft_board_setup(void *blob, struct bd_info *bd) --- -2.46.2 - diff --git a/rockchip-Modernise-Geekbox-config.patch b/rockchip-Modernise-Geekbox-config.patch new file mode 100644 index 0000000..ee49fcf --- /dev/null +++ b/rockchip-Modernise-Geekbox-config.patch @@ -0,0 +1,189 @@ +From 45d8808e95ddf0702ed78acde7678291ae52abdb Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Fri, 11 Oct 2024 17:14:26 +0100 +Subject: [PATCH] configs: rockchip: Modernise Geekbox config + +Modernise and move the Geekbox config to use SPL/TPL with +upstream TF-A, enable MMC/USB/Eth to make the device more +useful and work like other Rockchip devices. Update the +readme to reflect the changes to the build process. + +Signed-off-by: Peter Robinson +--- + arch/arm/dts/rk3368-geekbox-u-boot.dtsi | 10 ++++ + board/geekbuying/geekbox/README | 40 +++++++++++++- + configs/geekbox_defconfig | 71 ++++++++++++++++++++++++- + 3 files changed, 118 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/dts/rk3368-geekbox-u-boot.dtsi b/arch/arm/dts/rk3368-geekbox-u-boot.dtsi +index cfc8b9340a8..55d007f7ab8 100644 +--- a/arch/arm/dts/rk3368-geekbox-u-boot.dtsi ++++ b/arch/arm/dts/rk3368-geekbox-u-boot.dtsi +@@ -26,6 +26,16 @@ + bootph-all; + }; + ++&dmc { ++ bootph-all; ++ ++ rockchip,memory-schedule = ; ++ rockchip,ddr-frequency = <800000000>; ++ rockchip,ddr-speed-bin = ; ++ ++ status = "okay"; ++}; ++ + &grf { + bootph-all; + }; +diff --git a/board/geekbuying/geekbox/README b/board/geekbuying/geekbox/README +index de980f2f233..bd4d8cdd084 100644 +--- a/board/geekbuying/geekbox/README ++++ b/board/geekbuying/geekbox/README +@@ -1 +1,39 @@ +-see board/rockchip/sheep_rk3368/README ++Here is the step-by-step to boot to U-Boot on the Geekbox ++ ++Get the Source and build ATF ++============================ ++ ++ > git clone https://github.com/TrustedFirmware-A/trusted-firmware-a.git ++ > cd arm-trusted-firmware ++ > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3368 bl31 ++ ++Configure U-Boot ++================ ++ ++ > cd ../u-boot ++ > export BL31=../arm-trusted-firmware/build/rk3368/release/bl31.bin ++ > make geekbox_defconfig ++ ++Build the full U-Boot/ATF firmware stack ++======================================== ++ ++ > make CROSS_COMPILE=aarch64-unknown-elf- ++ ++Flash the image ++=============== ++ ++Copy the SPL to offset 32k and the FIT image containing the payloads ++(U-Boot proper, ATF, devicetree) to offset 256k card. ++ ++eMMC ++---- ++ ++rkdeveloptool allows to flash the on-board eMMC via the USB OTG interface with ++help of the Rockchip loader binary. ++ ++ > git clone https://github.com/rockchip-linux/rkdeveloptool ++ > cd rkdeveloptool ++ > autoreconf -i && && ./configure && make ++ > git clone https://github.com/rockchip-linux/rkbin.git ++ > ./rkdeveloptool db rkbin/rk33/rk3368_loader_v2.00.256.bin ++ > ./rkdeveloptool wl 64 ../u-boot-rockchip.bin +diff --git a/configs/geekbox_defconfig b/configs/geekbox_defconfig +index 8f4be79831a..1b116fa8602 100644 +--- a/configs/geekbox_defconfig ++++ b/configs/geekbox_defconfig +@@ -3,29 +3,96 @@ CONFIG_SKIP_LOWLEVEL_INIT=y + CONFIG_COUNTER_FREQUENCY=24000000 + CONFIG_ARCH_ROCKCHIP=y + CONFIG_TEXT_BASE=0x00200000 +-CONFIG_SYS_MALLOC_F_LEN=0x1000 + CONFIG_NR_DRAM_BANKS=1 + CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y + CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000 + CONFIG_DEFAULT_DEVICE_TREE="rk3368-geekbox" ++CONFIG_SPL_TEXT_BASE=0x00000000 + CONFIG_ROCKCHIP_RK3368=y ++CONFIG_TPL_LIBCOMMON_SUPPORT=y ++CONFIG_TPL_LIBGENERIC_SUPPORT=y ++CONFIG_SPL_DRIVERS_MISC=y ++CONFIG_SPL_STACK=0x188000 ++CONFIG_SPL_HAS_BSS_LINKER_SECTION=y ++CONFIG_SPL_BSS_START_ADDR=0x400000 ++CONFIG_SPL_BSS_MAX_SIZE=0x20000 ++CONFIG_SPL_STACK_R=y ++CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x4000 ++CONFIG_SPL=y + CONFIG_TARGET_GEEKBOX=y + CONFIG_DEBUG_UART_BASE=0xFF690000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SYS_LOAD_ADDR=0x800800 + CONFIG_DEBUG_UART=y ++CONFIG_FIT=y ++CONFIG_FIT_VERBOSE=y ++CONFIG_SPL_LOAD_FIT=y + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3368-geekbox.dtb" + # CONFIG_DISPLAY_CPUINFO is not set + CONFIG_DISPLAY_BOARDINFO_LATE=y ++CONFIG_SPL_MAX_SIZE=0x40000 ++CONFIG_SPL_PAD_TO=0x7f8000 ++CONFIG_SPL_BOOTROM_SUPPORT=y ++# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set ++# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set ++CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200 ++CONFIG_SPL_ATF=y ++CONFIG_TPL=y ++CONFIG_TPL_SYS_MALLOC_SIMPLE=y ++CONFIG_TPL_DRIVERS_MISC=y ++CONFIG_CMD_GPIO=y ++CONFIG_CMD_MMC=y ++CONFIG_CMD_REGULATOR=y ++CONFIG_CMD_USB=y ++CONFIG_SPL_OF_CONTROL=y ++CONFIG_TPL_OF_CONTROL=y ++CONFIG_OF_LIVE=y ++CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names interrupt-parent" ++CONFIG_TPL_OF_PLATDATA=y ++CONFIG_ENV_IS_IN_MMC=y + CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_TPL_DM=y + CONFIG_REGMAP=y ++CONFIG_SPL_REGMAP=y ++CONFIG_TPL_REGMAP=y + CONFIG_SYSCON=y +-CONFIG_BOUNCE_BUFFER=y ++CONFIG_SPL_SYSCON=y ++CONFIG_TPL_SYSCON=y + CONFIG_CLK=y ++CONFIG_SPL_CLK=y ++CONFIG_TPL_CLK=y ++CONFIG_ROCKCHIP_GPIO=y ++CONFIG_SYS_I2C_ROCKCHIP=y ++CONFIG_MMC_DW=y ++CONFIG_MMC_DW_ROCKCHIP=y + CONFIG_PINCTRL=y ++CONFIG_PHY_REALTEK=y ++CONFIG_DM_ETH_PHY=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_RGMII=y ++CONFIG_GMAC_ROCKCHIP=y ++CONFIG_PINCTRL=y ++CONFIG_SPL_PINCTRL=y ++CONFIG_DM_PMIC=y ++CONFIG_PMIC_RK8XX=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_REGULATOR_RK8XX=y + CONFIG_RAM=y ++CONFIG_SPL_RAM=y ++CONFIG_TPL_RAM=y + CONFIG_DEBUG_UART_SHIFT=2 + CONFIG_DEBUG_UART_ANNOUNCE=y + CONFIG_SYS_NS16550_MEM32=y ++CONFIG_SYSINFO=y ++CONFIG_SYSINFO_SMBIOS=y + CONFIG_SYSRESET=y ++CONFIG_USB=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_EHCI_GENERIC=y ++CONFIG_USB_DWC2=y ++CONFIG_USB_GADGET=y ++CONFIG_USB_GADGET_DWC2_OTG=y ++CONFIG_SPL_TINY_MEMSET=y ++CONFIG_LZO=y + CONFIG_ERRNO_STR=y +-- +2.47.0 + diff --git a/rpi-Pass-CMA-through-from-firmware-DT.patch b/rpi-Pass-CMA-through-from-firmware-DT.patch new file mode 100644 index 0000000..1185095 --- /dev/null +++ b/rpi-Pass-CMA-through-from-firmware-DT.patch @@ -0,0 +1,40 @@ +From c449955f6aece3148ccf67890df1083fb3a41884 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Fri, 11 Oct 2024 12:04:10 +0100 +Subject: [PATCH] board: rpi: Pass CMA through from firmware DT + +For a lot of usecases, such as display, camera, media +the Raspberry Pi needs a lot more CMA than distros +configure as default so we should pass this parameter +through so things work as expected. Fix a spelling +mistake while we're at it. + +Signed-off-by: Peter Robinson +--- + board/raspberrypi/rpi/rpi.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c +index ab5ea85cf9f..dd5a318d239 100644 +--- a/board/raspberrypi/rpi/rpi.c ++++ b/board/raspberrypi/rpi/rpi.c +@@ -540,12 +540,15 @@ void update_fdt_from_fw(void *fdt, void *fw_fdt) + if (fdt == fw_fdt) + return; + +- /* The firmware provides a more precie model; so copy that */ ++ /* The firmware provides a more precise model; so copy that */ + copy_property(fdt, fw_fdt, "/", "model"); + + /* memory reserve as suggested by the firmware */ + copy_property(fdt, fw_fdt, "/", "memreserve"); + ++ /* copy the CMA memory setting from the firmware DT to linux */ ++ copy_property(fdt, fw_fdt, "/reserved-memory/linux,cma", "size"); ++ + /* Adjust dma-ranges for the SD card and PCI bus as they can depend on + * the SoC revision + */ +-- +2.47.0 + diff --git a/sources b/sources index 3a48403..82c8edc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.10-rc6.tar.bz2) = df569020757f330dc9f25f05712f02f4f8f1e3f5219223a439519050e684bee93971d85c2eb6a014e92e6ae6a2e59dac35b91c4f8e2cfa7884a5cf0083e8a023 +SHA512 (u-boot-2024.10.tar.bz2) = ef817c9b5ae8dc6cd9e3f57811e90acc6a4d4394f0356aa5923e3e3c8559168f977bd5bf82824cd3650aa8e5e3c3d1b00e20818d21368151748682f1fc51152c diff --git a/uboot-tools.spec b/uboot-tools.spec index 8fad7dc..9eeb08e 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc6 +#global candidate rc0 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2024.10 -Release: 0.8%{?candidate:.%{candidate}}%{?dist} +Release: 1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -32,10 +32,11 @@ Patch5: enable-bootmenu-by-default.patch # Rockchips improvements Patch10: rockchip-Enable-preboot-start-for-pci-usb.patch Patch11: FUSB302-USB-C-controller-support.patch +Patch12: rockchip-Modernise-Geekbox-config.patch # QCom Patch15: Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch # RPi -Patch20: 0001-board-rpi-Pass-CMA-through-from-firmware-DT.patch +Patch20: rpi-Pass-CMA-through-from-firmware-DT.patch BuildRequires: bc BuildRequires: bison @@ -209,6 +210,11 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Fri Oct 11 2024 Peter Robinson - 1:2024.10-1 +- Update to 2024.10 GA +- Fix passing RPi firmware CMA setting to kernel DT +- Update Geekbox + * Thu Oct 03 2024 Peter Robinson - 1:2024.10-0.8.rc6 - Pass CMA FW setting through to kernel DT for Raspberry Pi From 9fb9e1ac57ec5784ff52eed70aa506f3d67cff95 Mon Sep 17 00:00:00 2001 From: Andrew Gunnerson Date: Mon, 4 Nov 2024 19:00:36 -0500 Subject: [PATCH 056/128] Install manpages for dumpimage, kwboot, and mkeficapsule Signed-off-by: Andrew Gunnerson --- uboot-tools.spec | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 9eeb08e..a63daa3 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -188,7 +188,10 @@ for tool in dumpimage env/fw_printenv fit_check_sign fit_info gdb/gdbcont gdb/gd do install -p -m 0755 builds/tools/$tool %{buildroot}%{_bindir} done -install -p -m 0644 doc/mkimage.1 %{buildroot}%{_mandir}/man1 +for tool in dumpimage kwboot mkeficapsule mkimage +do +install -p -m 0644 doc/$tool.1 %{buildroot}%{_mandir}/man1 +done install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} ( cd %{buildroot}%{_bindir}; ln -sf fw_printenv fw_setenv ) @@ -198,6 +201,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %doc README doc/develop/distro.rst doc/README.gpt %doc doc/develop/uefi doc/usage doc/arch/arm64.rst %{_bindir}/* +%{_mandir}/man1/dumpimage.1* +%{_mandir}/man1/kwboot.1* +%{_mandir}/man1/mkeficapsule.1* %{_mandir}/man1/mkimage.1* %if %{with toolsonly} From 139751f49cb6ae7547df1a1a4eff29e0ba0b2ffc Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 15 Oct 2024 22:33:40 +0100 Subject: [PATCH 057/128] drop unused duplicate firmwares --- uboot-tools.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index a63daa3..3ebc11a 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -157,7 +157,7 @@ mkdir -p %{buildroot}%{_datadir}/uboot/ %ifarch aarch64 for board in $(ls builds) do - for file in u-boot.bin u-boot.img u-boot-dtb.img u-boot.itb u-boot-sunxi-with-spl.bin u-boot-rockchip-spi.bin u-boot-rockchip.bin idbloader.img idbloader-spi.img spl/boot.bin + for file in u-boot.bin u-boot.img u-boot-dtb.img u-boot-sunxi-with-spl.bin u-boot-rockchip-spi.bin u-boot-rockchip.bin do if [ -f builds/$(echo $board)/$(echo $file) ]; then install -pD -m 0644 builds/$(echo $board)/$(echo $file) %{buildroot}%{_datadir}/uboot/$(echo $board)/$(echo $file) @@ -165,6 +165,10 @@ do done done +# Just for xilinx_zynqmp_virt +install -pD -m 0644 builds/xilinx_zynqmp_virt/u-boot.itb %{buildroot}%{_datadir}/uboot/xilinx_zynqmp_virt/u-boot.itb +install -pD -m 0644 builds/xilinx_zynqmp_virt/spl/boot.bin %{buildroot}%{_datadir}/uboot/xilinx_zynqmp_virt/boot.bin + # For Apple M-series we also need the nodtb variant install -pD -m 0644 builds/apple_m1/u-boot-nodtb.bin %{buildroot}%{_datadir}/uboot/apple_m1/u-boot-nodtb.bin From 357edb992292e9e396ed885a288dc42b1b72c763 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 31 Dec 2024 15:12:02 +0000 Subject: [PATCH 058/128] 2025.01 RC6 --- FUSB302-USB-C-controller-support.patch | 6018 ----------------- ...support-for-SC7280-and-the-RB3-Gen-2.patch | 1414 ---- aarch64-boards | 2 + ...hip-Enable-preboot-start-for-pci-usb.patch | 596 +- ...identifiers-for-the-new-RPi-5-series.patch | 43 + rpi-Pass-CMA-through-from-firmware-DT.patch | 40 - sources | 2 +- uboot-tools.spec | 23 +- ..._location-for-finding-the-DT-on-disk.patch | 32 +- 9 files changed, 365 insertions(+), 7805 deletions(-) delete mode 100644 FUSB302-USB-C-controller-support.patch delete mode 100644 Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch create mode 100644 rpi-Add-identifiers-for-the-new-RPi-5-series.patch delete mode 100644 rpi-Pass-CMA-through-from-firmware-DT.patch diff --git a/FUSB302-USB-C-controller-support.patch b/FUSB302-USB-C-controller-support.patch deleted file mode 100644 index a25f8dd..0000000 --- a/FUSB302-USB-C-controller-support.patch +++ /dev/null @@ -1,6018 +0,0 @@ -From patchwork Thu Sep 5 15:08:37 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Sebastian Reichel -X-Patchwork-Id: 1981315 -X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com - header.a=rsa-sha256 header.s=mail header.b=VOvjn+x1; - 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 4X02zx1gZpz1yXY - for ; Fri, 6 Sep 2024 01:18:05 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id E002A88CD2; - Thu, 5 Sep 2024 17:17:16 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com - header.b="VOvjn+x1"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 9ED9788CD2; Thu, 5 Sep 2024 17:17:16 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from bali.collaboradmins.com (bali.collaboradmins.com - [IPv6:2a01:4f8:201:9162::2]) - (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 8F95B88CC0 - for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sebastian.reichel@collabora.com -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; - s=mail; t=1725549428; - bh=GUi0ELUr54qxRL+zUYIh2cpnf8aAbxP3km5z9ihBLiA=; - h=From:To:Cc:Subject:Date:In-Reply-To:References:From; - b=VOvjn+x1YAGL8uuX8oe/eA1AShGOQ+65YCdPN4UIul65K52PZGC4Rh30foWYR3GYv - ksyxZc+jsHQcN72mVdV3njT/SIGekJFu683r6aomMjm3Mrc+uUUF7QcQdx2QgObWXW - 3RmaT4So9PLApr20wdqN8mqL3PND0cpUJiGoZG18Nu+sX+XJYGTtQ3qo+p00ZjT6TY - TXhYMaIJeqISS7ocTqHwKpWZQ/5uXBBLOuLnlKRVhjHEVg6Ds0DFB8/XFwU24CB0VM - Xutwxqot6qKBLUt/yDrX8upercY5M0tia9Ymno4ezs/mVrRI6ztNPgNmjPUzaBq/T2 - 9q+TUcwqV3v1A== -Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de - [91.248.189.231]) - (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) (Authenticated sender: sre) - by bali.collaboradmins.com (Postfix) with ESMTPSA id EC7AC17E1167; - Thu, 5 Sep 2024 17:17:07 +0200 (CEST) -Received: by jupiter.universe (Postfix, from userid 1000) - id 9F52C4800EB; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) -From: Sebastian Reichel -To: Marek Vasut , u-boot@lists.denx.de, - Jonas Karlman , Soeren Moch -Cc: Eugen Hristev , - Tim Harvey , Kever Yang , - Philipp Tomsich , Simon Glass , - Sebastian Reichel -Subject: [PATCH v6 1/6] usb: tcpm: add core framework -Date: Thu, 5 Sep 2024 17:08:37 +0200 -Message-ID: <20240905151707.59101-2-sebastian.reichel@collabora.com> -X-Mailer: git-send-email 2.45.2 -In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> -References: <20240905151707.59101-1-sebastian.reichel@collabora.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 - -This adds TCPM framework in preparation for fusb302 support, which can -handle USB power delivery messages. This is needed to solve issues with -devices, that are running from a USB-C port supporting USB-PD, but not -having a battery. - -Such a device currently boots to the kernel without interacting with -the power-supply at all. If there are no USB-PD message replies within -5 seconds, the power-supply assumes the peripheral is not capable of -USB-PD. It usually takes more than 5 seconds for the system to reach -the kernel and probe the I2C based fusb302 chip driver. Thus the -system always runs into this state. The power-supply's solution to -fix this error state is a hard reset, which involves removing the -power from VBUS. Boards without a battery (or huge capacitors) will -reset at this point resulting in a boot loop. - -This imports the TCPM framework from the kernel. The porting has -originally been done by Rockchip using hardware timers and the Linux -kernel's TCPM code from some years ago. - -I had a look at upgrading to the latest TCPM kernel code, but that -beast became a lot more complex due to adding more USB-C features. -I believe these features are not needed in U-Boot and with multiple -kthreads and hrtimers being involved it is non-trivial to port them. -Instead I worked on stripping down features from the Rockchip port -to an even more basic level. Also the TCPM code has been reworked -to avoid complete use of any timers (Rockchip used SoC specific -hardware timers + IRQ to implement delayed work mechanism). Instead -the delayed state changes are handled directly from the poll loop. - -Note, that (in contrast to the original Rockchip port) the state -machine has the same hard reset quirk, that the kernel has - i.e. -it avoids disabling the CC pin resistors for devices that are not -self-powered. Without that quirk, the Radxa Rock 5B will not just -end up doing a machine reset when a hard reset is triggered, but will -not even recover, because the CPU will loose power and the FUSB302 -will keep this state because of leak voltage arriving through the RX -serial pin (assuming a serial adapter is connected). - -This also includes a 'tcpm' command, which can be used to get -information about the current state and the negotiated voltage -and current. - -Co-developed-by: Wang Jie -Signed-off-by: Wang Jie -Tested-by: Soeren Moch -Signed-off-by: Sebastian Reichel ---- - Makefile | 1 + - cmd/Kconfig | 7 + - cmd/Makefile | 1 + - cmd/tcpm.c | 136 ++ - doc/usage/cmd/tcpm.rst | 66 + - doc/usage/index.rst | 1 + - drivers/usb/Kconfig | 2 + - drivers/usb/tcpm/Kconfig | 8 + - drivers/usb/tcpm/Makefile | 3 + - drivers/usb/tcpm/tcpm-internal.h | 173 +++ - drivers/usb/tcpm/tcpm-uclass.c | 149 ++ - drivers/usb/tcpm/tcpm.c | 2288 ++++++++++++++++++++++++++++++ - include/dm/uclass-id.h | 1 + - include/usb/pd.h | 516 +++++++ - include/usb/tcpm.h | 99 ++ - 15 files changed, 3451 insertions(+) - create mode 100644 cmd/tcpm.c - create mode 100644 doc/usage/cmd/tcpm.rst - create mode 100644 drivers/usb/tcpm/Kconfig - create mode 100644 drivers/usb/tcpm/Makefile - create mode 100644 drivers/usb/tcpm/tcpm-internal.h - create mode 100644 drivers/usb/tcpm/tcpm-uclass.c - create mode 100644 drivers/usb/tcpm/tcpm.c - create mode 100644 include/usb/pd.h - create mode 100644 include/usb/tcpm.h - -diff --git a/Makefile b/Makefile -index 74df5d177c1f..5a581199c170 100644 ---- a/Makefile -+++ b/Makefile -@@ -879,6 +879,7 @@ libs-y += drivers/usb/musb/ - libs-y += drivers/usb/musb-new/ - libs-y += drivers/usb/isp1760/ - libs-y += drivers/usb/phy/ -+libs-y += drivers/usb/tcpm/ - libs-y += drivers/usb/ulpi/ - ifdef CONFIG_POST - libs-y += post/ -diff --git a/cmd/Kconfig b/cmd/Kconfig -index 978f44eda426..7710bee22ace 100644 ---- a/cmd/Kconfig -+++ b/cmd/Kconfig -@@ -221,6 +221,13 @@ config CMD_REGINFO - help - Register dump - -+config CMD_TCPM -+ bool "tcpm" -+ depends on TYPEC_TCPM -+ help -+ Show voltage and current negotiated via USB PD as well as the -+ current state of the Type C Port Manager (TCPM) state machine. -+ - config CMD_TLV_EEPROM - bool "tlv_eeprom" - depends on I2C_EEPROM -diff --git a/cmd/Makefile b/cmd/Makefile -index 87133cc27a8a..bd0b23ef1013 100644 ---- a/cmd/Makefile -+++ b/cmd/Makefile -@@ -172,6 +172,7 @@ obj-$(CONFIG_CMD_SMBIOS) += smbios.o - obj-$(CONFIG_CMD_SMC) += smccc.o - obj-$(CONFIG_CMD_SYSBOOT) += sysboot.o - obj-$(CONFIG_CMD_STACKPROTECTOR_TEST) += stackprot_test.o -+obj-$(CONFIG_CMD_TCPM) += tcpm.o - obj-$(CONFIG_CMD_TEMPERATURE) += temperature.o - obj-$(CONFIG_CMD_TERMINAL) += terminal.o - obj-$(CONFIG_CMD_TIME) += time.o -diff --git a/cmd/tcpm.c b/cmd/tcpm.c -new file mode 100644 -index 000000000000..962cd234a869 ---- /dev/null -+++ b/cmd/tcpm.c -@@ -0,0 +1,136 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * (C) Copyright 2024 Collabora -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+ -+#define LIMIT_DEV 32 -+#define LIMIT_PARENT 20 -+ -+static struct udevice *currdev; -+ -+static int do_dev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) -+{ -+ char *name; -+ int ret = -ENODEV; -+ -+ switch (argc) { -+ case 2: -+ name = argv[1]; -+ ret = tcpm_get(name, &currdev); -+ if (ret) { -+ log_err("Can't get TCPM %s: %d (%s)!\n", name, ret, errno_str(ret)); -+ return CMD_RET_FAILURE; -+ } -+ case 1: -+ if (!currdev) { -+ log_err("TCPM device is not set!\n\n"); -+ return CMD_RET_USAGE; -+ } -+ -+ printf("dev: %d @ %s\n", dev_seq(currdev), currdev->name); -+ } -+ -+ return CMD_RET_SUCCESS; -+} -+ -+static int do_list(struct cmd_tbl *cmdtp, int flag, int argc, -+ char *const argv[]) -+{ -+ struct udevice *dev; -+ int ret, err = 0; -+ -+ printf("| %-*.*s| %-*.*s| %s @ %s\n", -+ LIMIT_DEV, LIMIT_DEV, "Name", -+ LIMIT_PARENT, LIMIT_PARENT, "Parent name", -+ "Parent uclass", "seq"); -+ -+ for (ret = uclass_first_device_check(UCLASS_TCPM, &dev); dev; -+ ret = uclass_next_device_check(&dev)) { -+ if (ret) -+ err = ret; -+ -+ printf("| %-*.*s| %-*.*s| %s @ %d | status: %i\n", -+ LIMIT_DEV, LIMIT_DEV, dev->name, -+ LIMIT_PARENT, LIMIT_PARENT, dev->parent->name, -+ dev_get_uclass_name(dev->parent), dev_seq(dev->parent), -+ ret); -+ } -+ -+ if (err) -+ return CMD_RET_FAILURE; -+ -+ return CMD_RET_SUCCESS; -+} -+ -+int do_print_info(struct udevice *dev) -+{ -+ enum typec_orientation orientation = tcpm_get_orientation(dev); -+ const char *state = tcpm_get_state(dev); -+ int pd_rev = tcpm_get_pd_rev(dev); -+ int mv = tcpm_get_voltage(dev); -+ int ma = tcpm_get_current(dev); -+ enum typec_role pwr_role = tcpm_get_pwr_role(dev); -+ enum typec_data_role data_role = tcpm_get_data_role(dev); -+ bool connected = tcpm_is_connected(dev); -+ -+ if (!connected) { -+ printf("TCPM State: %s\n", state); -+ return 0; -+ } -+ -+ printf("Orientation: %s\n", typec_orientation_name[orientation]); -+ printf("PD Revision: %s\n", typec_pd_rev_name[pd_rev]); -+ printf("Power Role: %s\n", typec_role_name[pwr_role]); -+ printf("Data Role: %s\n", typec_data_role_name[data_role]); -+ printf("Voltage: %2d.%03d V\n", mv / 1000, mv % 1000); -+ printf("Current: %2d.%03d A\n", ma / 1000, ma % 1000); -+ -+ return 0; -+} -+ -+static int do_info(struct cmd_tbl *cmdtp, int flag, int argc, -+ char *const argv[]) -+{ -+ if (!currdev) { -+ printf("First, set the TCPM device!\n"); -+ return CMD_RET_USAGE; -+ } -+ -+ return do_print_info(currdev); -+} -+ -+static struct cmd_tbl subcmd[] = { -+ U_BOOT_CMD_MKENT(dev, 2, 1, do_dev, "", ""), -+ U_BOOT_CMD_MKENT(list, 1, 1, do_list, "", ""), -+ U_BOOT_CMD_MKENT(info, 1, 1, do_info, "", ""), -+}; -+ -+static int do_tcpm(struct cmd_tbl *cmdtp, int flag, int argc, -+ char *const argv[]) -+{ -+ struct cmd_tbl *cmd; -+ -+ argc--; -+ argv++; -+ -+ cmd = find_cmd_tbl(argv[0], subcmd, ARRAY_SIZE(subcmd)); -+ if (!cmd || argc > cmd->maxargs) -+ return CMD_RET_USAGE; -+ -+ return cmd->cmd(cmdtp, flag, argc, argv); -+} -+ -+ /**************************************************/ -+ -+U_BOOT_CMD(tcpm, CONFIG_SYS_MAXARGS, 1, do_tcpm, -+ "TCPM sub-system", -+ "list - list TCPM devices\n" -+ "tcpm dev [name] - show or [set] operating TCPM device\n" -+ "tcpm info - dump information\n" -+); -diff --git a/doc/usage/cmd/tcpm.rst b/doc/usage/cmd/tcpm.rst -new file mode 100644 -index 000000000000..1e8199c0f89c ---- /dev/null -+++ b/doc/usage/cmd/tcpm.rst -@@ -0,0 +1,66 @@ -+.. SPDX-License-Identifier: GPL-2.0+: -+ -+.. index:: -+ single: tcpm (command) -+ -+tcpm command -+============ -+ -+Synopsis -+-------- -+ -+:: -+ -+ tcpm dev [devname] -+ tcpm info -+ tcpm list -+ -+Description -+----------- -+ -+The tcpm command is used to control USB-PD controllers, also known as TypeC Port Manager (TCPM). -+ -+The 'tcpm dev' command shows or set current TCPM device. -+ -+ devname -+ device name to change -+ -+The 'tcpm info' command displays the current state of the device -+ -+The 'tcpm list' command displays the list available devices. -+ -+Examples -+-------- -+ -+The 'tcpm info' command displays device's status: -+:: -+ -+ => tcpm info -+ Orientation: normal -+ PD Revision: rev3 -+ Power Role: sink -+ Data Role: device -+ Voltage: 20.000 V -+ Current: 2.250 A -+ -+The current device can be shown or set via 'tcpm dev' command: -+:: -+ -+ => tcpm dev -+ TCPM device is not set! -+ => tcpm dev usb-typec@22 -+ dev: 0 @ usb-typec@22 -+ => tcpm dev -+ dev: 0 @ usb-typec@22 -+ -+The list of available devices can be shown via 'tcpm list' command: -+:: -+ -+ => tcpm list -+ | Name | Parent name | Parent uclass @ seq -+ | usb-typec@22 | i2c@feac0000 | i2c @ 4 | status: 0 -+ -+Configuration -+------------- -+ -+The tcpm command is only available if CONFIG_CMD_TCPM=y. -diff --git a/doc/usage/index.rst b/doc/usage/index.rst -index 6a218c46b4e4..b4be42f59119 100644 ---- a/doc/usage/index.rst -+++ b/doc/usage/index.rst -@@ -111,6 +111,7 @@ Shell commands - cmd/smbios - cmd/sound - cmd/source -+ cmd/tcpm - cmd/temperature - cmd/tftpput - cmd/trace -diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig -index a972d87c7ad4..985d3a9ef7e6 100644 ---- a/drivers/usb/Kconfig -+++ b/drivers/usb/Kconfig -@@ -85,6 +85,8 @@ source "drivers/usb/emul/Kconfig" - - source "drivers/usb/phy/Kconfig" - -+source "drivers/usb/tcpm/Kconfig" -+ - source "drivers/usb/ulpi/Kconfig" - - if USB_HOST -diff --git a/drivers/usb/tcpm/Kconfig b/drivers/usb/tcpm/Kconfig -new file mode 100644 -index 000000000000..55bf8e202b90 ---- /dev/null -+++ b/drivers/usb/tcpm/Kconfig -@@ -0,0 +1,8 @@ -+# SPDX-License-Identifier: GPL-2.0 -+ -+config TYPEC_TCPM -+ tristate "USB Type-C Port Controller Manager" -+ depends on DM -+ help -+ The Type-C Port Controller Manager provides a USB PD and USB Type-C -+ state machine for use with Type-C Port Controllers. -diff --git a/drivers/usb/tcpm/Makefile b/drivers/usb/tcpm/Makefile -new file mode 100644 -index 000000000000..a0f76436f3fd ---- /dev/null -+++ b/drivers/usb/tcpm/Makefile -@@ -0,0 +1,3 @@ -+# SPDX-License-Identifier: GPL-2.0 -+ -+obj-$(CONFIG_TYPEC_TCPM) += tcpm.o tcpm-uclass.o -diff --git a/drivers/usb/tcpm/tcpm-internal.h b/drivers/usb/tcpm/tcpm-internal.h -new file mode 100644 -index 000000000000..561442090027 ---- /dev/null -+++ b/drivers/usb/tcpm/tcpm-internal.h -@@ -0,0 +1,173 @@ -+/* SPDX-License-Identifier: GPL-2.0-or-later */ -+/* -+ * Copyright 2015-2017 Google, Inc -+ * Copyright 2024 Collabora -+ */ -+ -+#ifndef __LINUX_USB_TCPM_INTERNAL_H -+#define __LINUX_USB_TCPM_INTERNAL_H -+ -+#define FOREACH_TCPM_STATE(S) \ -+ S(INVALID_STATE), \ -+ S(TOGGLING), \ -+ S(SRC_UNATTACHED), \ -+ S(SRC_ATTACH_WAIT), \ -+ S(SRC_ATTACHED), \ -+ S(SRC_STARTUP), \ -+ S(SRC_SEND_CAPABILITIES), \ -+ S(SRC_SEND_CAPABILITIES_TIMEOUT), \ -+ S(SRC_NEGOTIATE_CAPABILITIES), \ -+ S(SRC_TRANSITION_SUPPLY), \ -+ S(SRC_READY), \ -+ S(SRC_WAIT_NEW_CAPABILITIES), \ -+ \ -+ S(SNK_UNATTACHED), \ -+ S(SNK_ATTACH_WAIT), \ -+ S(SNK_DEBOUNCED), \ -+ S(SNK_ATTACHED), \ -+ S(SNK_STARTUP), \ -+ S(SNK_DISCOVERY), \ -+ S(SNK_DISCOVERY_DEBOUNCE), \ -+ S(SNK_DISCOVERY_DEBOUNCE_DONE), \ -+ S(SNK_WAIT_CAPABILITIES), \ -+ S(SNK_NEGOTIATE_CAPABILITIES), \ -+ S(SNK_TRANSITION_SINK), \ -+ S(SNK_TRANSITION_SINK_VBUS), \ -+ S(SNK_READY), \ -+ \ -+ S(HARD_RESET_SEND), \ -+ S(HARD_RESET_START), \ -+ S(SRC_HARD_RESET_VBUS_OFF), \ -+ S(SRC_HARD_RESET_VBUS_ON), \ -+ S(SNK_HARD_RESET_SINK_OFF), \ -+ S(SNK_HARD_RESET_WAIT_VBUS), \ -+ S(SNK_HARD_RESET_SINK_ON), \ -+ \ -+ S(SOFT_RESET), \ -+ S(SOFT_RESET_SEND), \ -+ \ -+ S(DR_SWAP_ACCEPT), \ -+ S(DR_SWAP_CHANGE_DR), \ -+ \ -+ S(ERROR_RECOVERY), \ -+ S(PORT_RESET), \ -+ S(PORT_RESET_WAIT_OFF) -+ -+#define GENERATE_TCPM_ENUM(e) e -+#define GENERATE_TCPM_STRING(s) #s -+#define TCPM_POLL_EVENT_TIME_OUT 2000 -+ -+enum tcpm_state { -+ FOREACH_TCPM_STATE(GENERATE_TCPM_ENUM) -+}; -+ -+enum pd_msg_request { -+ PD_MSG_NONE = 0, -+ PD_MSG_CTRL_REJECT, -+ PD_MSG_CTRL_WAIT, -+ PD_MSG_CTRL_NOT_SUPP, -+ PD_MSG_DATA_SINK_CAP, -+ PD_MSG_DATA_SOURCE_CAP, -+}; -+ -+struct tcpm_port { -+ enum typec_port_type typec_type; -+ int typec_prefer_role; -+ -+ enum typec_role vconn_role; -+ enum typec_role pwr_role; -+ enum typec_data_role data_role; -+ -+ struct typec_partner *partner; -+ -+ enum typec_cc_status cc_req; -+ enum typec_cc_status cc1; -+ enum typec_cc_status cc2; -+ enum typec_cc_polarity polarity; -+ -+ bool attached; -+ bool connected; -+ int poll_event_cnt; -+ enum typec_port_type port_type; -+ -+ /* -+ * Set to true when vbus is greater than VSAFE5V min. -+ * Set to false when vbus falls below vSinkDisconnect max threshold. -+ */ -+ bool vbus_present; -+ -+ /* -+ * Set to true when vbus is less than VSAFE0V max. -+ * Set to false when vbus is greater than VSAFE0V max. -+ */ -+ bool vbus_vsafe0v; -+ -+ bool vbus_never_low; -+ bool vbus_source; -+ bool vbus_charge; -+ -+ int try_role; -+ -+ enum pd_msg_request queued_message; -+ -+ enum tcpm_state enter_state; -+ enum tcpm_state prev_state; -+ enum tcpm_state state; -+ enum tcpm_state delayed_state; -+ unsigned long delay_ms; -+ -+ bool state_machine_running; -+ -+ bool tx_complete; -+ enum tcpm_transmit_status tx_status; -+ -+ unsigned int negotiated_rev; -+ unsigned int message_id; -+ unsigned int caps_count; -+ unsigned int hard_reset_count; -+ bool pd_capable; -+ bool explicit_contract; -+ unsigned int rx_msgid; -+ -+ /* Partner capabilities/requests */ -+ u32 sink_request; -+ u32 source_caps[PDO_MAX_OBJECTS]; -+ unsigned int nr_source_caps; -+ u32 sink_caps[PDO_MAX_OBJECTS]; -+ unsigned int nr_sink_caps; -+ -+ /* -+ * whether to wait for the Type-C device to send the DR_SWAP Message flag -+ * For Type-C device with Dual-Role Power and Dual-Role Data, the port side -+ * is used as sink + ufp, then the tcpm framework needs to wait for Type-C -+ * device to initiate DR_swap Message. -+ */ -+ bool wait_dr_swap_message; -+ -+ /* Local capabilities */ -+ u32 src_pdo[PDO_MAX_OBJECTS]; -+ unsigned int nr_src_pdo; -+ u32 snk_pdo[PDO_MAX_OBJECTS]; -+ unsigned int nr_snk_pdo; -+ -+ unsigned int operating_snk_mw; -+ bool update_sink_caps; -+ -+ /* Requested current / voltage to the port partner */ -+ u32 req_current_limit; -+ u32 req_supply_voltage; -+ /* Actual current / voltage limit of the local port */ -+ u32 current_limit; -+ u32 supply_voltage; -+ -+ /* port belongs to a self powered device */ -+ bool self_powered; -+ -+ unsigned long delay_target; -+}; -+ -+extern const char * const tcpm_states[]; -+ -+int tcpm_post_probe(struct udevice *dev); -+ -+#endif -diff --git a/drivers/usb/tcpm/tcpm-uclass.c b/drivers/usb/tcpm/tcpm-uclass.c -new file mode 100644 -index 000000000000..92f9eff1ada6 ---- /dev/null -+++ b/drivers/usb/tcpm/tcpm-uclass.c -@@ -0,0 +1,149 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright 2024 Collabora Ltd. -+ * -+ * USB Power Delivery protocol stack. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include "tcpm-internal.h" -+ -+int tcpm_get_voltage(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ return port->supply_voltage; -+} -+ -+int tcpm_get_current(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ return port->current_limit; -+} -+ -+enum typec_orientation tcpm_get_orientation(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ switch (port->polarity) { -+ case TYPEC_POLARITY_CC1: -+ return TYPEC_ORIENTATION_NORMAL; -+ case TYPEC_POLARITY_CC2: -+ return TYPEC_ORIENTATION_REVERSE; -+ default: -+ return TYPEC_ORIENTATION_NONE; -+ } -+} -+ -+const char *tcpm_get_state(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ return tcpm_states[port->state]; -+} -+ -+int tcpm_get_pd_rev(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ return port->negotiated_rev; -+} -+ -+enum typec_role tcpm_get_pwr_role(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ return port->pwr_role; -+} -+ -+enum typec_data_role tcpm_get_data_role(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ return port->data_role; -+} -+ -+bool tcpm_is_connected(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ return port->connected; -+} -+ -+int tcpm_get(const char *name, struct udevice **devp) -+{ -+ return uclass_get_device_by_name(UCLASS_TCPM, name, devp); -+} -+ -+static int tcpm_post_bind(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ const char *cap_str; -+ ofnode node; -+ int ret; -+ -+ /* -+ * USB Power Delivery (USB PD) specification requires, that communication -+ * with a sink happens within roughly 5 seconds. Otherwise the source -+ * might assume that the sink does not support USB PD. Starting to do -+ * USB PD communication after that results in a hard reset, which briefly -+ * removes any power from the USB-C port. -+ * -+ * On systems with alternative power supplies this is not an issue, but -+ * systems, which get soleley powered through their USB-C port will end -+ * up losing their power supply and doing a board level reset. The hard -+ * reset will also restart the 5 second timeout. That means a operating -+ * system initializing USB PD will put the system into a boot loop when -+ * it takes more than 5 seconds from cold boot to the operating system -+ * starting to transmit USB PD messages. -+ * -+ * The issue can be avoided by doing the initial USB PD communication -+ * in U-Boot. The operating system can then re-negotiate by doing a -+ * soft reset, which does not trigger removal of the supply voltage. -+ * -+ * Since the TCPM state machine is quite complex and depending on the -+ * remote side can take quite some time to finish, this tries to limit -+ * the automatic probing to systems probably relying on power being -+ * provided by the USB-C port(s): -+ * -+ * 1. self-powered devices won't reset when the USB-C port looses power -+ * 2. if the power is allowed to go into anything else than sink mode -+ * it is not the only power source -+ */ -+ ret = drvops->get_connector_node(dev, &node); -+ if (ret) -+ return ret; -+ -+ if (ofnode_read_bool(node, "self-powered")) -+ return 0; -+ -+ cap_str = ofnode_read_string(node, "power-role"); -+ if (!cap_str) -+ return -EINVAL; -+ -+ if (strcmp("sink", cap_str)) -+ return 0; -+ -+ /* Do not auto-probe PD controller when PD is disabled */ -+ if (ofnode_read_bool(node, "pd-disable")) -+ return 0; -+ -+ dev_info(dev, "probing Type-C port manager..."); -+ -+ dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND); -+ -+ return 0; -+} -+ -+UCLASS_DRIVER(tcpm) = { -+ .id = UCLASS_TCPM, -+ .name = "tcpm", -+ .per_device_plat_auto = sizeof(struct tcpm_port), -+ .post_bind = tcpm_post_bind, -+ .post_probe = tcpm_post_probe, -+}; -diff --git a/drivers/usb/tcpm/tcpm.c b/drivers/usb/tcpm/tcpm.c -new file mode 100644 -index 000000000000..0aee57cb2f4a ---- /dev/null -+++ b/drivers/usb/tcpm/tcpm.c -@@ -0,0 +1,2288 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright 2015-2017 Google, Inc -+ * -+ * USB Power Delivery protocol stack. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "tcpm-internal.h" -+ -+DECLARE_GLOBAL_DATA_PTR; -+ -+const char * const tcpm_states[] = { -+ FOREACH_TCPM_STATE(GENERATE_TCPM_STRING) -+}; -+ -+const char * const typec_pd_rev_name[] = { -+ [PD_REV10] = "rev1", -+ [PD_REV20] = "rev2", -+ [PD_REV30] = "rev3", -+}; -+ -+const char * const typec_role_name[] = { -+ [TYPEC_SINK] = "sink", -+ [TYPEC_SOURCE] = "source", -+}; -+ -+const char * const typec_data_role_name[] = { -+ [TYPEC_DEVICE] = "device", -+ [TYPEC_HOST] = "host", -+}; -+ -+const char * const typec_orientation_name[] = { -+ [TYPEC_ORIENTATION_NONE] = "none", -+ [TYPEC_ORIENTATION_NORMAL] = "normal", -+ [TYPEC_ORIENTATION_REVERSE] = "reverse", -+}; -+ -+const char * const typec_cc_status_name[] = { -+ [TYPEC_CC_OPEN] = "open", -+ [TYPEC_CC_RA] = "ra", -+ [TYPEC_CC_RD] = "rd", -+ [TYPEC_CC_RP_DEF] = "rp-def", -+ [TYPEC_CC_RP_1_5] = "rp-1.5", -+ [TYPEC_CC_RP_3_0] = "rp-3.0", -+}; -+ -+static inline bool tcpm_cc_is_sink(enum typec_cc_status cc) -+{ -+ return cc == TYPEC_CC_RP_DEF || -+ cc == TYPEC_CC_RP_1_5 || -+ cc == TYPEC_CC_RP_3_0; -+} -+ -+static inline bool tcpm_port_is_sink(struct tcpm_port *port) -+{ -+ bool cc1_is_snk = tcpm_cc_is_sink(port->cc1); -+ bool cc2_is_snk = tcpm_cc_is_sink(port->cc2); -+ -+ return (cc1_is_snk && !cc2_is_snk) || -+ (cc2_is_snk && !cc1_is_snk); -+} -+ -+static inline bool tcpm_cc_is_source(enum typec_cc_status cc) -+{ -+ return cc == TYPEC_CC_RD; -+} -+ -+static inline bool tcpm_port_is_source(struct tcpm_port *port) -+{ -+ bool cc1_is_src = tcpm_cc_is_source(port->cc1); -+ bool cc2_is_src = tcpm_cc_is_source(port->cc2); -+ -+ return (cc1_is_src && !cc2_is_src) || -+ (cc2_is_src && !cc1_is_src); -+} -+ -+static inline bool tcpm_try_src(struct tcpm_port *port) -+{ -+ return port->try_role == TYPEC_SOURCE && -+ port->port_type == TYPEC_PORT_DRP; -+} -+ -+static inline void tcpm_reset_event_cnt(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ port->poll_event_cnt = 0; -+} -+ -+static enum tcpm_state tcpm_default_state(struct tcpm_port *port) -+{ -+ if (port->port_type == TYPEC_PORT_DRP) { -+ if (port->try_role == TYPEC_SINK) -+ return SNK_UNATTACHED; -+ else if (port->try_role == TYPEC_SOURCE) -+ return SRC_UNATTACHED; -+ } else if (port->port_type == TYPEC_PORT_SNK) { -+ return SNK_UNATTACHED; -+ } -+ return SRC_UNATTACHED; -+} -+ -+static bool tcpm_port_is_disconnected(struct tcpm_port *port) -+{ -+ return (!port->attached && port->cc1 == TYPEC_CC_OPEN && -+ port->cc2 == TYPEC_CC_OPEN) || -+ (port->attached && ((port->polarity == TYPEC_POLARITY_CC1 && -+ port->cc1 == TYPEC_CC_OPEN) || -+ (port->polarity == TYPEC_POLARITY_CC2 && -+ port->cc2 == TYPEC_CC_OPEN))); -+} -+ -+static void tcpm_set_cc(struct udevice *dev, enum typec_cc_status cc) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ dev_dbg(dev, "TCPM: set cc = %d\n", cc); -+ port->cc_req = cc; -+ drvops->set_cc(dev, cc); -+} -+ -+/* -+ * Determine RP value to set based on maximum current supported -+ * by a port if configured as source. -+ * Returns CC value to report to link partner. -+ */ -+static enum typec_cc_status tcpm_rp_cc(struct tcpm_port *port) -+{ -+ const u32 *src_pdo = port->src_pdo; -+ int nr_pdo = port->nr_src_pdo; -+ int i; -+ -+ /* -+ * Search for first entry with matching voltage. -+ * It should report the maximum supported current. -+ */ -+ for (i = 0; i < nr_pdo; i++) { -+ const u32 pdo = src_pdo[i]; -+ -+ if (pdo_type(pdo) == PDO_TYPE_FIXED && -+ pdo_fixed_voltage(pdo) == 5000) { -+ unsigned int curr = pdo_max_current(pdo); -+ -+ if (curr >= 3000) -+ return TYPEC_CC_RP_3_0; -+ else if (curr >= 1500) -+ return TYPEC_CC_RP_1_5; -+ return TYPEC_CC_RP_DEF; -+ } -+ } -+ -+ return TYPEC_CC_RP_DEF; -+} -+ -+static void tcpm_check_and_run_delayed_work(struct udevice *dev); -+ -+static bool tcpm_transmit_helper(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ drvops->poll_event(dev); -+ udelay(500); -+ tcpm_check_and_run_delayed_work(dev); -+ return port->tx_complete; -+} -+ -+static int tcpm_pd_transmit(struct udevice *dev, -+ enum tcpm_transmit_type type, -+ const struct pd_message *msg) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ u32 timeout_us = PD_T_TCPC_TX_TIMEOUT * 1000; -+ bool tx_complete; -+ int ret; -+ -+ if (msg) -+ dev_dbg(dev, "TCPM: PD TX, header: %#x\n", -+ le16_to_cpu(msg->header)); -+ else -+ dev_dbg(dev, "TCPM: PD TX, type: %#x\n", type); -+ -+ port->tx_complete = false; -+ ret = drvops->pd_transmit(dev, type, msg, port->negotiated_rev); -+ if (ret < 0) -+ return ret; -+ -+ /* -+ * At this point we basically need to block until the TCPM controller -+ * returns successful transmission. Since this is usually done using -+ * the generic interrupt status bits, we poll for any events. That -+ * will clear the interrupt status, so we also need to process any -+ * of the incoming events. This means we will do more processing and -+ * thus let's give everything a bit more time. -+ */ -+ timeout_us *= 5; -+ ret = read_poll_timeout(tcpm_transmit_helper, tx_complete, -+ !tx_complete, false, timeout_us, dev); -+ if (ret < 0) { -+ dev_err(dev, "TCPM: PD transmit data failed: %d\n", ret); -+ return ret; -+ } -+ -+ switch (port->tx_status) { -+ case TCPC_TX_SUCCESS: -+ port->message_id = (port->message_id + 1) & PD_HEADER_ID_MASK; -+ break; -+ case TCPC_TX_DISCARDED: -+ ret = -EAGAIN; -+ break; -+ case TCPC_TX_FAILED: -+ default: -+ ret = -EIO; -+ break; -+ } -+ -+ return ret; -+} -+ -+void tcpm_pd_transmit_complete(struct udevice *dev, -+ enum tcpm_transmit_status status) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ dev_dbg(dev, "TCPM: PD TX complete, status: %u\n", status); -+ tcpm_reset_event_cnt(dev); -+ port->tx_status = status; -+ port->tx_complete = true; -+} -+ -+static int tcpm_set_polarity(struct udevice *dev, -+ enum typec_cc_polarity polarity) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ int ret; -+ -+ dev_dbg(dev, "TCPM: set polarity = %d\n", polarity); -+ -+ if (drvops->set_polarity) { -+ ret = drvops->set_polarity(dev, polarity); -+ if (ret < 0) -+ return ret; -+ } -+ -+ port->polarity = polarity; -+ -+ return 0; -+} -+ -+static int tcpm_set_vconn(struct udevice *dev, bool enable) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret; -+ -+ dev_dbg(dev, "TCPM: set vconn = %d\n", enable); -+ -+ ret = drvops->set_vconn(dev, enable); -+ if (!ret) -+ port->vconn_role = enable ? TYPEC_SOURCE : TYPEC_SINK; -+ -+ return ret; -+} -+ -+static inline u32 tcpm_get_current_limit(struct tcpm_port *port) -+{ -+ switch (port->polarity ? port->cc2 : port->cc1) { -+ case TYPEC_CC_RP_1_5: -+ return 1500; -+ case TYPEC_CC_RP_3_0: -+ return 3000; -+ case TYPEC_CC_RP_DEF: -+ default: -+ return 0; -+ } -+} -+ -+static int tcpm_set_current_limit(struct udevice *dev, u32 max_ma, u32 mv) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret = -EOPNOTSUPP; -+ -+ dev_info(dev, "TCPM: set voltage limit = %u mV\n", mv); -+ dev_info(dev, "TCPM: set current limit = %u mA\n", max_ma); -+ -+ port->supply_voltage = mv; -+ port->current_limit = max_ma; -+ -+ return ret; -+} -+ -+static int tcpm_set_attached_state(struct udevice *dev, bool attached) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ return drvops->set_roles(dev, attached, port->pwr_role, -+ port->data_role); -+} -+ -+static int tcpm_set_roles(struct udevice *dev, bool attached, -+ enum typec_role role, enum typec_data_role data) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret; -+ -+ ret = drvops->set_roles(dev, attached, role, data); -+ if (ret < 0) -+ return ret; -+ -+ port->pwr_role = role; -+ port->data_role = data; -+ -+ return 0; -+} -+ -+static int tcpm_pd_send_source_caps(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ struct pd_message msg; -+ int i; -+ -+ memset(&msg, 0, sizeof(msg)); -+ -+ if (!port->nr_src_pdo) { -+ /* No source capabilities defined, sink only */ -+ msg.header = PD_HEADER_LE(PD_CTRL_REJECT, -+ port->pwr_role, -+ port->data_role, -+ port->negotiated_rev, -+ port->message_id, 0); -+ } else { -+ msg.header = PD_HEADER_LE(PD_DATA_SOURCE_CAP, -+ port->pwr_role, -+ port->data_role, -+ port->negotiated_rev, -+ port->message_id, -+ port->nr_src_pdo); -+ } -+ -+ for (i = 0; i < port->nr_src_pdo; i++) -+ msg.payload[i] = cpu_to_le32(port->src_pdo[i]); -+ -+ return tcpm_pd_transmit(dev, TCPC_TX_SOP, &msg); -+} -+ -+static int tcpm_pd_send_sink_caps(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ struct pd_message msg; -+ unsigned int i; -+ -+ memset(&msg, 0, sizeof(msg)); -+ -+ if (!port->nr_snk_pdo) { -+ /* No sink capabilities defined, source only */ -+ msg.header = PD_HEADER_LE(PD_CTRL_REJECT, -+ port->pwr_role, -+ port->data_role, -+ port->negotiated_rev, -+ port->message_id, 0); -+ } else { -+ msg.header = PD_HEADER_LE(PD_DATA_SINK_CAP, -+ port->pwr_role, -+ port->data_role, -+ port->negotiated_rev, -+ port->message_id, -+ port->nr_snk_pdo); -+ } -+ -+ for (i = 0; i < port->nr_snk_pdo; i++) -+ msg.payload[i] = cpu_to_le32(port->snk_pdo[i]); -+ -+ return tcpm_pd_transmit(dev, TCPC_TX_SOP, &msg); -+} -+ -+static void tcpm_state_machine(struct udevice *dev); -+ -+static inline void tcpm_timer_uninit(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ port->delay_target = 0; -+} -+ -+static void tcpm_timer_init(struct udevice *dev, uint32_t ms) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ unsigned long time_us = ms * 1000; -+ -+ port->delay_target = timer_get_us() + time_us; -+} -+ -+static void tcpm_check_and_run_delayed_work(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ /* no delayed state changes scheduled */ -+ if (port->delay_target == 0) -+ return; -+ -+ /* it's not yet time */ -+ if (timer_get_us() < port->delay_target) -+ return; -+ -+ tcpm_timer_uninit(dev); -+ tcpm_state_machine(dev); -+} -+ -+static void mod_tcpm_delayed_work(struct udevice *dev, unsigned int delay_ms) -+{ -+ if (delay_ms) { -+ tcpm_timer_init(dev, delay_ms); -+ } else { -+ tcpm_timer_uninit(dev); -+ tcpm_state_machine(dev); -+ } -+} -+ -+static void tcpm_set_state(struct udevice *dev, enum tcpm_state state, -+ unsigned int delay_ms) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ if (delay_ms) { -+ dev_dbg(dev, "TCPM: pending state change %s -> %s @ %u ms [%s]\n", -+ tcpm_states[port->state], tcpm_states[state], delay_ms, -+ typec_pd_rev_name[port->negotiated_rev]); -+ port->delayed_state = state; -+ mod_tcpm_delayed_work(dev, delay_ms); -+ port->delay_ms = delay_ms; -+ } else { -+ dev_dbg(dev, "TCPM: state change %s -> %s\n", -+ tcpm_states[port->state], tcpm_states[state]); -+ port->delayed_state = INVALID_STATE; -+ port->prev_state = port->state; -+ port->state = state; -+ /* -+ * Don't re-queue the state machine work item if we're currently -+ * in the state machine and we're immediately changing states. -+ * tcpm_state_machine_work() will continue running the state -+ * machine. -+ */ -+ if (!port->state_machine_running) -+ mod_tcpm_delayed_work(dev, 0); -+ } -+} -+ -+static void tcpm_set_state_cond(struct udevice *dev, enum tcpm_state state, -+ unsigned int delay_ms) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ if (port->enter_state == port->state) -+ tcpm_set_state(dev, state, delay_ms); -+ else -+ dev_dbg(dev, "TCPM: skipped %sstate change %s -> %s [%u ms], context state %s [%s]\n", -+ delay_ms ? "delayed " : "", -+ tcpm_states[port->state], tcpm_states[state], -+ delay_ms, tcpm_states[port->enter_state], -+ typec_pd_rev_name[port->negotiated_rev]); -+} -+ -+static void tcpm_queue_message(struct udevice *dev, -+ enum pd_msg_request message) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ port->queued_message = message; -+ mod_tcpm_delayed_work(dev, 0); -+} -+ -+enum pdo_err { -+ PDO_NO_ERR, -+ PDO_ERR_NO_VSAFE5V, -+ PDO_ERR_VSAFE5V_NOT_FIRST, -+ PDO_ERR_PDO_TYPE_NOT_IN_ORDER, -+ PDO_ERR_FIXED_NOT_SORTED, -+ PDO_ERR_VARIABLE_BATT_NOT_SORTED, -+ PDO_ERR_DUPE_PDO, -+ PDO_ERR_PPS_APDO_NOT_SORTED, -+ PDO_ERR_DUPE_PPS_APDO, -+}; -+ -+static const char * const pdo_err_msg[] = { -+ [PDO_ERR_NO_VSAFE5V] = -+ " err: source/sink caps should at least have vSafe5V", -+ [PDO_ERR_VSAFE5V_NOT_FIRST] = -+ " err: vSafe5V Fixed Supply Object Shall always be the first object", -+ [PDO_ERR_PDO_TYPE_NOT_IN_ORDER] = -+ " err: PDOs should be in the following order: Fixed; Battery; Variable", -+ [PDO_ERR_FIXED_NOT_SORTED] = -+ " err: Fixed supply pdos should be in increasing order of their fixed voltage", -+ [PDO_ERR_VARIABLE_BATT_NOT_SORTED] = -+ " err: Variable/Battery supply pdos should be in increasing order of their minimum voltage", -+ [PDO_ERR_DUPE_PDO] = -+ " err: Variable/Batt supply pdos cannot have same min/max voltage", -+ [PDO_ERR_PPS_APDO_NOT_SORTED] = -+ " err: Programmable power supply apdos should be in increasing order of their maximum voltage", -+ [PDO_ERR_DUPE_PPS_APDO] = -+ " err: Programmable power supply apdos cannot have same min/max voltage and max current", -+}; -+ -+static enum pdo_err tcpm_caps_err(struct udevice *dev, const u32 *pdo, -+ unsigned int nr_pdo) -+{ -+ unsigned int i; -+ -+ /* Should at least contain vSafe5v */ -+ if (nr_pdo < 1) -+ return PDO_ERR_NO_VSAFE5V; -+ -+ /* The vSafe5V Fixed Supply Object Shall always be the first object */ -+ if (pdo_type(pdo[0]) != PDO_TYPE_FIXED || -+ pdo_fixed_voltage(pdo[0]) != VSAFE5V) -+ return PDO_ERR_VSAFE5V_NOT_FIRST; -+ -+ for (i = 1; i < nr_pdo; i++) { -+ if (pdo_type(pdo[i]) < pdo_type(pdo[i - 1])) { -+ return PDO_ERR_PDO_TYPE_NOT_IN_ORDER; -+ } else if (pdo_type(pdo[i]) == pdo_type(pdo[i - 1])) { -+ enum pd_pdo_type type = pdo_type(pdo[i]); -+ -+ switch (type) { -+ /* -+ * The remaining Fixed Supply Objects, if -+ * present, shall be sent in voltage order; -+ * lowest to highest. -+ */ -+ case PDO_TYPE_FIXED: -+ if (pdo_fixed_voltage(pdo[i]) <= -+ pdo_fixed_voltage(pdo[i - 1])) -+ return PDO_ERR_FIXED_NOT_SORTED; -+ break; -+ /* -+ * The Battery Supply Objects and Variable -+ * supply, if present shall be sent in Minimum -+ * Voltage order; lowest to highest. -+ */ -+ case PDO_TYPE_VAR: -+ case PDO_TYPE_BATT: -+ if (pdo_min_voltage(pdo[i]) < -+ pdo_min_voltage(pdo[i - 1])) -+ return PDO_ERR_VARIABLE_BATT_NOT_SORTED; -+ else if ((pdo_min_voltage(pdo[i]) == -+ pdo_min_voltage(pdo[i - 1])) && -+ (pdo_max_voltage(pdo[i]) == -+ pdo_max_voltage(pdo[i - 1]))) -+ return PDO_ERR_DUPE_PDO; -+ break; -+ /* -+ * The Programmable Power Supply APDOs, if present, -+ * shall be sent in Maximum Voltage order; -+ * lowest to highest. -+ */ -+ case PDO_TYPE_APDO: -+ if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS) -+ break; -+ -+ if (pdo_pps_apdo_max_voltage(pdo[i]) < -+ pdo_pps_apdo_max_voltage(pdo[i - 1])) -+ return PDO_ERR_PPS_APDO_NOT_SORTED; -+ else if (pdo_pps_apdo_min_voltage(pdo[i]) == -+ pdo_pps_apdo_min_voltage(pdo[i - 1]) && -+ pdo_pps_apdo_max_voltage(pdo[i]) == -+ pdo_pps_apdo_max_voltage(pdo[i - 1]) && -+ pdo_pps_apdo_max_current(pdo[i]) == -+ pdo_pps_apdo_max_current(pdo[i - 1])) -+ return PDO_ERR_DUPE_PPS_APDO; -+ break; -+ default: -+ dev_err(dev, "TCPM: Unknown pdo type\n"); -+ } -+ } -+ } -+ -+ return PDO_NO_ERR; -+} -+ -+static int tcpm_validate_caps(struct udevice *dev, const u32 *pdo, -+ unsigned int nr_pdo) -+{ -+ enum pdo_err err_index = tcpm_caps_err(dev, pdo, nr_pdo); -+ -+ if (err_index != PDO_NO_ERR) { -+ dev_err(dev, "TCPM:%s\n", pdo_err_msg[err_index]); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+/* -+ * PD (data, control) command handling functions -+ */ -+static inline enum tcpm_state ready_state(struct tcpm_port *port) -+{ -+ if (port->pwr_role == TYPEC_SOURCE) -+ return SRC_READY; -+ else -+ return SNK_READY; -+} -+ -+static void tcpm_pd_data_request(struct udevice *dev, -+ const struct pd_message *msg) -+{ -+ enum pd_data_msg_type type = pd_header_type_le(msg->header); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ unsigned int cnt = pd_header_cnt_le(msg->header); -+ unsigned int rev = pd_header_rev_le(msg->header); -+ unsigned int i; -+ -+ switch (type) { -+ case PD_DATA_SOURCE_CAP: -+ for (i = 0; i < cnt; i++) -+ port->source_caps[i] = le32_to_cpu(msg->payload[i]); -+ -+ port->nr_source_caps = cnt; -+ -+ tcpm_validate_caps(dev, port->source_caps, -+ port->nr_source_caps); -+ -+ /* -+ * Adjust revision in subsequent message headers, as required, -+ * to comply with 6.2.1.1.5 of the USB PD 3.0 spec. We don't -+ * support Rev 1.0 so just do nothing in that scenario. -+ */ -+ if (rev == PD_REV10) -+ break; -+ -+ if (rev < PD_MAX_REV) -+ port->negotiated_rev = rev; -+ -+ if ((pdo_type(port->source_caps[0]) == PDO_TYPE_FIXED) && -+ (port->source_caps[0] & PDO_FIXED_DUAL_ROLE) && -+ (port->source_caps[0] & PDO_FIXED_DATA_SWAP)) { -+ /* Dual role power and data, eg: self-powered Type-C */ -+ port->wait_dr_swap_message = true; -+ } else { -+ /* Non-Dual role power, eg: adapter */ -+ port->wait_dr_swap_message = false; -+ } -+ -+ /* -+ * This message may be received even if VBUS is not -+ * present. This is quite unexpected; see USB PD -+ * specification, sections 8.3.3.6.3.1 and 8.3.3.6.3.2. -+ * However, at the same time, we must be ready to -+ * receive this message and respond to it 15ms after -+ * receiving PS_RDY during power swap operations, no matter -+ * if VBUS is available or not (USB PD specification, -+ * section 6.5.9.2). -+ * So we need to accept the message either way, -+ * but be prepared to keep waiting for VBUS after it was -+ * handled. -+ */ -+ tcpm_set_state(dev, SNK_NEGOTIATE_CAPABILITIES, 0); -+ break; -+ case PD_DATA_REQUEST: -+ /* -+ * Adjust revision in subsequent message headers, as required, -+ * to comply with 6.2.1.1.5 of the USB PD 3.0 spec. We don't -+ * support Rev 1.0 so just reject in that scenario. -+ */ -+ if (rev == PD_REV10) { -+ tcpm_queue_message(dev, PD_MSG_CTRL_REJECT); -+ break; -+ } -+ -+ if (rev < PD_MAX_REV) -+ port->negotiated_rev = rev; -+ -+ port->sink_request = le32_to_cpu(msg->payload[0]); -+ -+ tcpm_set_state(dev, SRC_NEGOTIATE_CAPABILITIES, 0); -+ break; -+ case PD_DATA_SINK_CAP: -+ /* We don't do anything with this at the moment... */ -+ for (i = 0; i < cnt; i++) -+ port->sink_caps[i] = le32_to_cpu(msg->payload[i]); -+ -+ port->nr_sink_caps = cnt; -+ break; -+ default: -+ break; -+ } -+} -+ -+static void tcpm_pd_ctrl_request(struct udevice *dev, -+ const struct pd_message *msg) -+{ -+ enum pd_ctrl_msg_type type = pd_header_type_le(msg->header); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ enum tcpm_state next_state; -+ -+ switch (type) { -+ case PD_CTRL_GOOD_CRC: -+ case PD_CTRL_PING: -+ break; -+ case PD_CTRL_GET_SOURCE_CAP: -+ switch (port->state) { -+ case SRC_READY: -+ case SNK_READY: -+ tcpm_queue_message(dev, PD_MSG_DATA_SOURCE_CAP); -+ break; -+ default: -+ tcpm_queue_message(dev, PD_MSG_CTRL_REJECT); -+ break; -+ } -+ break; -+ case PD_CTRL_GET_SINK_CAP: -+ switch (port->state) { -+ case SRC_READY: -+ case SNK_READY: -+ tcpm_queue_message(dev, PD_MSG_DATA_SINK_CAP); -+ break; -+ default: -+ tcpm_queue_message(dev, PD_MSG_CTRL_REJECT); -+ break; -+ } -+ break; -+ case PD_CTRL_GOTO_MIN: -+ break; -+ case PD_CTRL_PS_RDY: -+ switch (port->state) { -+ case SNK_TRANSITION_SINK: -+ if (port->vbus_present) { -+ tcpm_set_current_limit(dev, -+ port->req_current_limit, -+ port->req_supply_voltage); -+ port->explicit_contract = true; -+ tcpm_set_state(dev, SNK_READY, 0); -+ } else { -+ /* -+ * Seen after power swap. Keep waiting for VBUS -+ * in a transitional state. -+ */ -+ tcpm_set_state(dev, -+ SNK_TRANSITION_SINK_VBUS, 0); -+ } -+ break; -+ default: -+ break; -+ } -+ break; -+ case PD_CTRL_REJECT: -+ case PD_CTRL_WAIT: -+ case PD_CTRL_NOT_SUPP: -+ switch (port->state) { -+ case SNK_NEGOTIATE_CAPABILITIES: -+ /* USB PD specification, Figure 8-43 */ -+ if (port->explicit_contract) -+ next_state = SNK_READY; -+ else -+ next_state = SNK_WAIT_CAPABILITIES; -+ -+ tcpm_set_state(dev, next_state, 0); -+ break; -+ default: -+ break; -+ } -+ break; -+ case PD_CTRL_ACCEPT: -+ switch (port->state) { -+ case SNK_NEGOTIATE_CAPABILITIES: -+ tcpm_set_state(dev, SNK_TRANSITION_SINK, 0); -+ break; -+ case SOFT_RESET_SEND: -+ port->message_id = 0; -+ port->rx_msgid = -1; -+ if (port->pwr_role == TYPEC_SOURCE) -+ next_state = SRC_SEND_CAPABILITIES; -+ else -+ next_state = SNK_WAIT_CAPABILITIES; -+ tcpm_set_state(dev, next_state, 0); -+ break; -+ default: -+ break; -+ } -+ break; -+ case PD_CTRL_SOFT_RESET: -+ tcpm_set_state(dev, SOFT_RESET, 0); -+ break; -+ case PD_CTRL_DR_SWAP: -+ if (port->port_type != TYPEC_PORT_DRP) { -+ tcpm_queue_message(dev, PD_MSG_CTRL_REJECT); -+ break; -+ } -+ /* -+ * 6.3.9: If an alternate mode is active, a request to swap -+ * alternate modes shall trigger a port reset. -+ */ -+ switch (port->state) { -+ case SRC_READY: -+ case SNK_READY: -+ tcpm_set_state(dev, DR_SWAP_ACCEPT, 0); -+ break; -+ default: -+ tcpm_queue_message(dev, PD_MSG_CTRL_WAIT); -+ break; -+ } -+ break; -+ case PD_CTRL_PR_SWAP: -+ case PD_CTRL_VCONN_SWAP: -+ case PD_CTRL_GET_SOURCE_CAP_EXT: -+ case PD_CTRL_GET_STATUS: -+ case PD_CTRL_FR_SWAP: -+ case PD_CTRL_GET_PPS_STATUS: -+ case PD_CTRL_GET_COUNTRY_CODES: -+ /* Currently not supported */ -+ dev_err(dev, "TCPM: Currently not supported type %#x\n", type); -+ tcpm_queue_message(dev, PD_MSG_CTRL_NOT_SUPP); -+ break; -+ default: -+ dev_err(dev, "TCPM: Unrecognized ctrl message type %#x\n", type); -+ break; -+ } -+} -+ -+static void tcpm_pd_rx_handler(struct udevice *dev, -+ const struct pd_message *msg) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ unsigned int cnt = pd_header_cnt_le(msg->header); -+ bool remote_is_host, local_is_host; -+ -+ dev_dbg(dev, "TCPM: PD RX, header: %#x [%d]\n", -+ le16_to_cpu(msg->header), port->attached); -+ -+ if (port->attached) { -+ enum pd_ctrl_msg_type type = pd_header_type_le(msg->header); -+ unsigned int msgid = pd_header_msgid_le(msg->header); -+ -+ /* -+ * USB PD standard, 6.6.1.2: -+ * "... if MessageID value in a received Message is the -+ * same as the stored value, the receiver shall return a -+ * GoodCRC Message with that MessageID value and drop -+ * the Message (this is a retry of an already received -+ * Message). Note: this shall not apply to the Soft_Reset -+ * Message which always has a MessageID value of zero." -+ */ -+ if (msgid == port->rx_msgid && type != PD_CTRL_SOFT_RESET) -+ return; -+ port->rx_msgid = msgid; -+ -+ /* -+ * If both ends believe to be DFP/host, we have a data role -+ * mismatch. -+ */ -+ remote_is_host = !!(le16_to_cpu(msg->header) & PD_HEADER_DATA_ROLE); -+ local_is_host = port->data_role == TYPEC_HOST; -+ if (remote_is_host == local_is_host) { -+ dev_err(dev, "TCPM: data role mismatch, initiating error recovery\n"); -+ tcpm_set_state(dev, ERROR_RECOVERY, 0); -+ } else { -+ if (cnt) -+ tcpm_pd_data_request(dev, msg); -+ else -+ tcpm_pd_ctrl_request(dev, msg); -+ } -+ } -+} -+ -+void tcpm_pd_receive(struct udevice *dev, const struct pd_message *msg) -+{ -+ tcpm_reset_event_cnt(dev); -+ tcpm_pd_rx_handler(dev, msg); -+} -+ -+static int tcpm_pd_send_control(struct udevice *dev, -+ enum pd_ctrl_msg_type type) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ struct pd_message msg; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.header = PD_HEADER_LE(type, port->pwr_role, -+ port->data_role, -+ port->negotiated_rev, -+ port->message_id, 0); -+ -+ return tcpm_pd_transmit(dev, TCPC_TX_SOP, &msg); -+} -+ -+/* -+ * Send queued message without affecting state. -+ * Return true if state machine should go back to sleep, -+ * false otherwise. -+ */ -+static bool tcpm_send_queued_message(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ enum pd_msg_request queued_message; -+ int max_messages = 100; -+ -+ do { -+ queued_message = port->queued_message; -+ port->queued_message = PD_MSG_NONE; -+ max_messages--; -+ -+ switch (queued_message) { -+ case PD_MSG_CTRL_WAIT: -+ tcpm_pd_send_control(dev, PD_CTRL_WAIT); -+ break; -+ case PD_MSG_CTRL_REJECT: -+ tcpm_pd_send_control(dev, PD_CTRL_REJECT); -+ break; -+ case PD_MSG_CTRL_NOT_SUPP: -+ tcpm_pd_send_control(dev, PD_CTRL_NOT_SUPP); -+ break; -+ case PD_MSG_DATA_SINK_CAP: -+ tcpm_pd_send_sink_caps(dev); -+ break; -+ case PD_MSG_DATA_SOURCE_CAP: -+ tcpm_pd_send_source_caps(dev); -+ break; -+ default: -+ break; -+ } -+ } while (max_messages > 0 && port->queued_message != PD_MSG_NONE); -+ -+ if (!max_messages) -+ dev_err(dev, "Aborted sending of too many queued messages\n"); -+ -+ return false; -+} -+ -+static int tcpm_pd_check_request(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ u32 pdo, rdo = port->sink_request; -+ unsigned int max, op, pdo_max, index; -+ enum pd_pdo_type type; -+ -+ index = rdo_index(rdo); -+ if (!index || index > port->nr_src_pdo) -+ return -EINVAL; -+ -+ pdo = port->src_pdo[index - 1]; -+ type = pdo_type(pdo); -+ switch (type) { -+ case PDO_TYPE_FIXED: -+ case PDO_TYPE_VAR: -+ max = rdo_max_current(rdo); -+ op = rdo_op_current(rdo); -+ pdo_max = pdo_max_current(pdo); -+ -+ if (op > pdo_max) -+ return -EINVAL; -+ if (max > pdo_max && !(rdo & RDO_CAP_MISMATCH)) -+ return -EINVAL; -+ -+ if (type == PDO_TYPE_FIXED) -+ dev_dbg(dev, "TCPM: Requested %u mV, %u mA for %u / %u mA\n", -+ pdo_fixed_voltage(pdo), pdo_max, op, max); -+ else -+ dev_dbg(dev, "TCPM: Requested %u -> %u mV, %u mA for %u / %u mA\n", -+ pdo_min_voltage(pdo), pdo_max_voltage(pdo), -+ pdo_max, op, max); -+ break; -+ case PDO_TYPE_BATT: -+ max = rdo_max_power(rdo); -+ op = rdo_op_power(rdo); -+ pdo_max = pdo_max_power(pdo); -+ -+ if (op > pdo_max) -+ return -EINVAL; -+ if (max > pdo_max && !(rdo & RDO_CAP_MISMATCH)) -+ return -EINVAL; -+ dev_info(dev, "TCPM: Requested %u -> %u mV, %u mW for %u / %u mW\n", -+ pdo_min_voltage(pdo), pdo_max_voltage(pdo), -+ pdo_max, op, max); -+ break; -+ default: -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+#define min_power(x, y) min(pdo_max_power(x), pdo_max_power(y)) -+#define min_current(x, y) min(pdo_max_current(x), pdo_max_current(y)) -+ -+static int tcpm_pd_select_pdo(struct udevice *dev, int *sink_pdo, -+ int *src_pdo) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ unsigned int i, j, max_src_mv = 0, min_src_mv = 0, max_mw = 0, -+ max_mv = 0, src_mw = 0, src_ma = 0, max_snk_mv = 0, -+ min_snk_mv = 0; -+ int ret = -EINVAL; -+ -+ /* -+ * Select the source PDO providing the most power which has a -+ * matchig sink cap. -+ */ -+ for (i = 0; i < port->nr_source_caps; i++) { -+ u32 pdo = port->source_caps[i]; -+ enum pd_pdo_type type = pdo_type(pdo); -+ -+ switch (type) { -+ case PDO_TYPE_FIXED: -+ max_src_mv = pdo_fixed_voltage(pdo); -+ min_src_mv = max_src_mv; -+ break; -+ case PDO_TYPE_BATT: -+ case PDO_TYPE_VAR: -+ max_src_mv = pdo_max_voltage(pdo); -+ min_src_mv = pdo_min_voltage(pdo); -+ break; -+ case PDO_TYPE_APDO: -+ continue; -+ default: -+ dev_err(dev, "TCPM: Invalid source PDO type, ignoring\n"); -+ continue; -+ } -+ -+ switch (type) { -+ case PDO_TYPE_FIXED: -+ case PDO_TYPE_VAR: -+ src_ma = pdo_max_current(pdo); -+ src_mw = src_ma * min_src_mv / 1000; -+ break; -+ case PDO_TYPE_BATT: -+ src_mw = pdo_max_power(pdo); -+ break; -+ case PDO_TYPE_APDO: -+ continue; -+ default: -+ dev_err(dev, "TCPM: Invalid source PDO type, ignoring\n"); -+ continue; -+ } -+ -+ for (j = 0; j < port->nr_snk_pdo; j++) { -+ pdo = port->snk_pdo[j]; -+ -+ switch (pdo_type(pdo)) { -+ case PDO_TYPE_FIXED: -+ max_snk_mv = pdo_fixed_voltage(pdo); -+ min_snk_mv = max_snk_mv; -+ break; -+ case PDO_TYPE_BATT: -+ case PDO_TYPE_VAR: -+ max_snk_mv = pdo_max_voltage(pdo); -+ min_snk_mv = pdo_min_voltage(pdo); -+ break; -+ case PDO_TYPE_APDO: -+ continue; -+ default: -+ dev_err(dev, "TCPM: Invalid sink PDO type, ignoring\n"); -+ continue; -+ } -+ -+ if (max_src_mv <= max_snk_mv && min_src_mv >= min_snk_mv) { -+ /* Prefer higher voltages if available */ -+ if ((src_mw == max_mw && min_src_mv > max_mv) || -+ src_mw > max_mw) { -+ *src_pdo = i; -+ *sink_pdo = j; -+ max_mw = src_mw; -+ max_mv = min_src_mv; -+ ret = 0; -+ } -+ } -+ } -+ } -+ -+ return ret; -+} -+ -+static int tcpm_pd_build_request(struct udevice *dev, u32 *rdo) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ unsigned int mv, ma, mw, flags; -+ unsigned int max_ma, max_mw; -+ enum pd_pdo_type type; -+ u32 pdo, matching_snk_pdo; -+ int src_pdo_index = 0; -+ int snk_pdo_index = 0; -+ int ret; -+ -+ ret = tcpm_pd_select_pdo(dev, &snk_pdo_index, &src_pdo_index); -+ if (ret < 0) -+ return ret; -+ -+ pdo = port->source_caps[src_pdo_index]; -+ matching_snk_pdo = port->snk_pdo[snk_pdo_index]; -+ type = pdo_type(pdo); -+ -+ switch (type) { -+ case PDO_TYPE_FIXED: -+ mv = pdo_fixed_voltage(pdo); -+ break; -+ case PDO_TYPE_BATT: -+ case PDO_TYPE_VAR: -+ mv = pdo_min_voltage(pdo); -+ break; -+ default: -+ dev_err(dev, "TCPM: Invalid PDO selected!\n"); -+ return -EINVAL; -+ } -+ -+ /* Select maximum available current within the sink pdo's limit */ -+ if (type == PDO_TYPE_BATT) { -+ mw = min_power(pdo, matching_snk_pdo); -+ ma = 1000 * mw / mv; -+ } else { -+ ma = min_current(pdo, matching_snk_pdo); -+ mw = ma * mv / 1000; -+ } -+ -+ flags = RDO_USB_COMM | RDO_NO_SUSPEND; -+ -+ /* Set mismatch bit if offered power is less than operating power */ -+ max_ma = ma; -+ max_mw = mw; -+ if (mw < port->operating_snk_mw) { -+ flags |= RDO_CAP_MISMATCH; -+ if (type == PDO_TYPE_BATT && -+ (pdo_max_power(matching_snk_pdo) > pdo_max_power(pdo))) -+ max_mw = pdo_max_power(matching_snk_pdo); -+ else if (pdo_max_current(matching_snk_pdo) > -+ pdo_max_current(pdo)) -+ max_ma = pdo_max_current(matching_snk_pdo); -+ } -+ -+ dev_dbg(dev, "TCPM: cc=%d cc1=%d cc2=%d vbus=%d vconn=%s polarity=%d\n", -+ port->cc_req, port->cc1, port->cc2, port->vbus_source, -+ port->vconn_role == TYPEC_SOURCE ? "source" : "sink", -+ port->polarity); -+ -+ if (type == PDO_TYPE_BATT) { -+ *rdo = RDO_BATT(src_pdo_index + 1, mw, max_mw, flags); -+ -+ dev_info(dev, "TCPM: requesting PDO %d: %u mV, %u mW%s\n", -+ src_pdo_index, mv, mw, -+ flags & RDO_CAP_MISMATCH ? " [mismatch]" : ""); -+ } else { -+ *rdo = RDO_FIXED(src_pdo_index + 1, ma, max_ma, flags); -+ -+ dev_info(dev, "TCPM: requesting PDO %d: %u mV, %u mA%s\n", -+ src_pdo_index, mv, ma, -+ flags & RDO_CAP_MISMATCH ? " [mismatch]" : ""); -+ } -+ -+ port->req_current_limit = ma; -+ port->req_supply_voltage = mv; -+ -+ return 0; -+} -+ -+static int tcpm_pd_send_request(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ struct pd_message msg; -+ int ret; -+ u32 rdo; -+ -+ ret = tcpm_pd_build_request(dev, &rdo); -+ if (ret < 0) -+ return ret; -+ -+ memset(&msg, 0, sizeof(msg)); -+ msg.header = PD_HEADER_LE(PD_DATA_REQUEST, -+ port->pwr_role, -+ port->data_role, -+ port->negotiated_rev, -+ port->message_id, 1); -+ msg.payload[0] = cpu_to_le32(rdo); -+ -+ return tcpm_pd_transmit(dev, TCPC_TX_SOP, &msg); -+} -+ -+static int tcpm_set_vbus(struct udevice *dev, bool enable) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ int ret; -+ -+ if (enable && port->vbus_charge) -+ return -EINVAL; -+ -+ dev_dbg(dev, "TCPM: set vbus = %d charge = %d\n", -+ enable, port->vbus_charge); -+ -+ ret = drvops->set_vbus(dev, enable, port->vbus_charge); -+ if (ret < 0) -+ return ret; -+ -+ port->vbus_source = enable; -+ return 0; -+} -+ -+static int tcpm_set_charge(struct udevice *dev, bool charge) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret; -+ -+ if (charge && port->vbus_source) -+ return -EINVAL; -+ -+ if (charge != port->vbus_charge) { -+ dev_dbg(dev, "TCPM: set vbus = %d charge = %d\n", -+ port->vbus_source, charge); -+ ret = drvops->set_vbus(dev, port->vbus_source, -+ charge); -+ if (ret < 0) -+ return ret; -+ } -+ port->vbus_charge = charge; -+ return 0; -+} -+ -+static bool tcpm_start_toggling(struct udevice *dev, enum typec_cc_status cc) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret; -+ -+ if (!drvops->start_toggling) -+ return false; -+ -+ dev_dbg(dev, "TCPM: Start toggling\n"); -+ ret = drvops->start_toggling(dev, port->port_type, cc); -+ return ret == 0; -+} -+ -+static int tcpm_init_vbus(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret; -+ -+ ret = drvops->set_vbus(dev, false, false); -+ port->vbus_source = false; -+ port->vbus_charge = false; -+ return ret; -+} -+ -+static int tcpm_init_vconn(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret; -+ -+ ret = drvops->set_vconn(dev, false); -+ port->vconn_role = TYPEC_SINK; -+ return ret; -+} -+ -+static inline void tcpm_typec_connect(struct tcpm_port *port) -+{ -+ if (!port->connected) -+ port->connected = true; -+} -+ -+static int tcpm_src_attach(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ enum typec_cc_polarity polarity = -+ port->cc2 == TYPEC_CC_RD ? TYPEC_POLARITY_CC2 -+ : TYPEC_POLARITY_CC1; -+ int ret; -+ -+ if (port->attached) -+ return 0; -+ -+ ret = tcpm_set_polarity(dev, polarity); -+ if (ret < 0) -+ return ret; -+ -+ ret = tcpm_set_roles(dev, true, TYPEC_SOURCE, TYPEC_HOST); -+ if (ret < 0) -+ return ret; -+ -+ ret = drvops->set_pd_rx(dev, true); -+ if (ret < 0) -+ goto out_disable_mux; -+ -+ /* -+ * USB Type-C specification, version 1.2, -+ * chapter 4.5.2.2.8.1 (Attached.SRC Requirements) -+ * Enable VCONN only if the non-RD port is set to RA. -+ */ -+ if ((polarity == TYPEC_POLARITY_CC1 && port->cc2 == TYPEC_CC_RA) || -+ (polarity == TYPEC_POLARITY_CC2 && port->cc1 == TYPEC_CC_RA)) { -+ ret = tcpm_set_vconn(dev, true); -+ if (ret < 0) -+ goto out_disable_pd; -+ } -+ -+ ret = tcpm_set_vbus(dev, true); -+ if (ret < 0) -+ goto out_disable_vconn; -+ -+ port->pd_capable = false; -+ -+ port->partner = NULL; -+ -+ port->attached = true; -+ -+ return 0; -+ -+out_disable_vconn: -+ tcpm_set_vconn(dev, false); -+out_disable_pd: -+ drvops->set_pd_rx(dev, false); -+out_disable_mux: -+ dev_err(dev, "TCPM: CC connected in %s as DFP\n", -+ polarity ? "CC2" : "CC1"); -+ return 0; -+} -+ -+static inline void tcpm_typec_disconnect(struct tcpm_port *port) -+{ -+ if (port->connected) { -+ port->partner = NULL; -+ port->connected = false; -+ } -+} -+ -+static void tcpm_reset_port(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ tcpm_timer_uninit(dev); -+ tcpm_typec_disconnect(port); -+ tcpm_reset_event_cnt(dev); -+ port->wait_dr_swap_message = false; -+ port->attached = false; -+ port->pd_capable = false; -+ -+ /* -+ * First Rx ID should be 0; set this to a sentinel of -1 so that -+ * we can check tcpm_pd_rx_handler() if we had seen it before. -+ */ -+ port->rx_msgid = -1; -+ -+ drvops->set_pd_rx(dev, false); -+ tcpm_init_vbus(dev); /* also disables charging */ -+ tcpm_init_vconn(dev); -+ tcpm_set_current_limit(dev, 0, 0); -+ tcpm_set_polarity(dev, TYPEC_POLARITY_CC1); -+ tcpm_set_attached_state(dev, false); -+ port->nr_sink_caps = 0; -+} -+ -+static void tcpm_detach(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ if (tcpm_port_is_disconnected(port)) -+ port->hard_reset_count = 0; -+ -+ if (!port->attached) -+ return; -+ -+ tcpm_reset_port(dev); -+} -+ -+static void tcpm_src_detach(struct udevice *dev) -+{ -+ tcpm_detach(dev); -+} -+ -+static int tcpm_snk_attach(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret; -+ -+ if (port->attached) -+ return 0; -+ -+ ret = tcpm_set_polarity(dev, port->cc2 != TYPEC_CC_OPEN ? -+ TYPEC_POLARITY_CC2 : TYPEC_POLARITY_CC1); -+ if (ret < 0) -+ return ret; -+ -+ ret = tcpm_set_roles(dev, true, TYPEC_SINK, TYPEC_DEVICE); -+ if (ret < 0) -+ return ret; -+ -+ port->pd_capable = false; -+ -+ port->partner = NULL; -+ -+ port->attached = true; -+ dev_info(dev, "TCPM: CC connected in %s as UFP\n", -+ port->cc1 != TYPEC_CC_OPEN ? "CC1" : "CC2"); -+ -+ return 0; -+} -+ -+static void tcpm_snk_detach(struct udevice *dev) -+{ -+ tcpm_detach(dev); -+} -+ -+static inline enum tcpm_state hard_reset_state(struct tcpm_port *port) -+{ -+ if (port->hard_reset_count < PD_N_HARD_RESET_COUNT) -+ return HARD_RESET_SEND; -+ if (port->pd_capable) -+ return ERROR_RECOVERY; -+ if (port->pwr_role == TYPEC_SOURCE) -+ return SRC_UNATTACHED; -+ if (port->state == SNK_WAIT_CAPABILITIES) -+ return SNK_READY; -+ return SNK_UNATTACHED; -+} -+ -+static inline enum tcpm_state unattached_state(struct tcpm_port *port) -+{ -+ if (port->port_type == TYPEC_PORT_DRP) { -+ if (port->pwr_role == TYPEC_SOURCE) -+ return SRC_UNATTACHED; -+ else -+ return SNK_UNATTACHED; -+ } else if (port->port_type == TYPEC_PORT_SRC) { -+ return SRC_UNATTACHED; -+ } -+ -+ return SNK_UNATTACHED; -+} -+ -+static void run_state_machine(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int ret; -+ -+ port->enter_state = port->state; -+ switch (port->state) { -+ case TOGGLING: -+ break; -+ /* SRC states */ -+ case SRC_UNATTACHED: -+ tcpm_src_detach(dev); -+ if (tcpm_start_toggling(dev, tcpm_rp_cc(port))) { -+ tcpm_set_state(dev, TOGGLING, 0); -+ break; -+ } -+ tcpm_set_cc(dev, tcpm_rp_cc(port)); -+ if (port->port_type == TYPEC_PORT_DRP) -+ tcpm_set_state(dev, SNK_UNATTACHED, PD_T_DRP_SNK); -+ break; -+ case SRC_ATTACH_WAIT: -+ if (tcpm_port_is_source(port)) -+ tcpm_set_state(dev, SRC_ATTACHED, PD_T_CC_DEBOUNCE); -+ break; -+ -+ case SRC_ATTACHED: -+ ret = tcpm_src_attach(dev); -+ /* -+ * Currently, vbus control is not implemented, -+ * and the SRC detection process cannot be fully implemented. -+ */ -+ tcpm_set_state(dev, SRC_READY, 0); -+ break; -+ case SRC_STARTUP: -+ port->caps_count = 0; -+ port->negotiated_rev = PD_MAX_REV; -+ port->message_id = 0; -+ port->rx_msgid = -1; -+ port->explicit_contract = false; -+ tcpm_set_state(dev, SRC_SEND_CAPABILITIES, 0); -+ break; -+ case SRC_SEND_CAPABILITIES: -+ port->caps_count++; -+ if (port->caps_count > PD_N_CAPS_COUNT) { -+ tcpm_set_state(dev, SRC_READY, 0); -+ break; -+ } -+ ret = tcpm_pd_send_source_caps(dev); -+ if (ret < 0) { -+ tcpm_set_state(dev, SRC_SEND_CAPABILITIES, -+ PD_T_SEND_SOURCE_CAP); -+ } else { -+ /* -+ * Per standard, we should clear the reset counter here. -+ * However, that can result in state machine hang-ups. -+ * Reset it only in READY state to improve stability. -+ */ -+ /* port->hard_reset_count = 0; */ -+ port->caps_count = 0; -+ port->pd_capable = true; -+ tcpm_set_state_cond(dev, SRC_SEND_CAPABILITIES_TIMEOUT, -+ PD_T_SEND_SOURCE_CAP); -+ } -+ break; -+ case SRC_SEND_CAPABILITIES_TIMEOUT: -+ /* -+ * Error recovery for a PD_DATA_SOURCE_CAP reply timeout. -+ * -+ * PD 2.0 sinks are supposed to accept src-capabilities with a -+ * 3.0 header and simply ignore any src PDOs which the sink does -+ * not understand such as PPS but some 2.0 sinks instead ignore -+ * the entire PD_DATA_SOURCE_CAP message, causing contract -+ * negotiation to fail. -+ * -+ * After PD_N_HARD_RESET_COUNT hard-reset attempts, we try -+ * sending src-capabilities with a lower PD revision to -+ * make these broken sinks work. -+ */ -+ if (port->hard_reset_count < PD_N_HARD_RESET_COUNT) { -+ tcpm_set_state(dev, HARD_RESET_SEND, 0); -+ } else if (port->negotiated_rev > PD_REV20) { -+ port->negotiated_rev--; -+ port->hard_reset_count = 0; -+ tcpm_set_state(dev, SRC_SEND_CAPABILITIES, 0); -+ } else { -+ tcpm_set_state(dev, hard_reset_state(port), 0); -+ } -+ break; -+ case SRC_NEGOTIATE_CAPABILITIES: -+ ret = tcpm_pd_check_request(dev); -+ if (ret < 0) { -+ tcpm_pd_send_control(dev, PD_CTRL_REJECT); -+ if (!port->explicit_contract) { -+ tcpm_set_state(dev, -+ SRC_WAIT_NEW_CAPABILITIES, 0); -+ } else { -+ tcpm_set_state(dev, SRC_READY, 0); -+ } -+ } else { -+ tcpm_pd_send_control(dev, PD_CTRL_ACCEPT); -+ tcpm_set_state(dev, SRC_TRANSITION_SUPPLY, -+ PD_T_SRC_TRANSITION); -+ } -+ break; -+ case SRC_TRANSITION_SUPPLY: -+ /* XXX: regulator_set_voltage(vbus, ...) */ -+ tcpm_pd_send_control(dev, PD_CTRL_PS_RDY); -+ port->explicit_contract = true; -+ tcpm_set_state_cond(dev, SRC_READY, 0); -+ break; -+ case SRC_READY: -+ port->hard_reset_count = 0; -+ -+ tcpm_typec_connect(port); -+ break; -+ case SRC_WAIT_NEW_CAPABILITIES: -+ /* Nothing to do... */ -+ break; -+ -+ /* SNK states */ -+ case SNK_UNATTACHED: -+ tcpm_snk_detach(dev); -+ if (tcpm_start_toggling(dev, TYPEC_CC_RD)) { -+ tcpm_set_state(dev, TOGGLING, 0); -+ break; -+ } -+ tcpm_set_cc(dev, TYPEC_CC_RD); -+ if (port->port_type == TYPEC_PORT_DRP) -+ tcpm_set_state(dev, SRC_UNATTACHED, PD_T_DRP_SRC); -+ break; -+ case SNK_ATTACH_WAIT: -+ if ((port->cc1 == TYPEC_CC_OPEN && -+ port->cc2 != TYPEC_CC_OPEN) || -+ (port->cc1 != TYPEC_CC_OPEN && -+ port->cc2 == TYPEC_CC_OPEN)) -+ tcpm_set_state(dev, SNK_DEBOUNCED, -+ PD_T_CC_DEBOUNCE); -+ else if (tcpm_port_is_disconnected(port)) -+ tcpm_set_state(dev, SNK_UNATTACHED, -+ PD_T_CC_DEBOUNCE); -+ break; -+ case SNK_DEBOUNCED: -+ if (tcpm_port_is_disconnected(port)) -+ tcpm_set_state(dev, SNK_UNATTACHED, PD_T_PD_DEBOUNCE); -+ else if (port->vbus_present) -+ tcpm_set_state(dev, SNK_ATTACHED, 0); -+ else -+ /* Wait for VBUS, but not forever */ -+ tcpm_set_state(dev, PORT_RESET, PD_T_PS_SOURCE_ON); -+ break; -+ case SNK_ATTACHED: -+ ret = tcpm_snk_attach(dev); -+ if (ret < 0) -+ tcpm_set_state(dev, SNK_UNATTACHED, 0); -+ else -+ tcpm_set_state(dev, SNK_STARTUP, 0); -+ break; -+ case SNK_STARTUP: -+ port->negotiated_rev = PD_MAX_REV; -+ port->message_id = 0; -+ port->rx_msgid = -1; -+ port->explicit_contract = false; -+ tcpm_set_state(dev, SNK_DISCOVERY, 0); -+ break; -+ case SNK_DISCOVERY: -+ if (port->vbus_present) { -+ tcpm_set_current_limit(dev, -+ tcpm_get_current_limit(port), -+ 5000); -+ tcpm_set_charge(dev, true); -+ tcpm_set_state(dev, SNK_WAIT_CAPABILITIES, 0); -+ break; -+ } -+ /* -+ * For DRP, timeouts differ. Also, handling is supposed to be -+ * different and much more complex (dead battery detection; -+ * see USB power delivery specification, section 8.3.3.6.1.5.1). -+ */ -+ tcpm_set_state(dev, hard_reset_state(port), -+ port->port_type == TYPEC_PORT_DRP ? -+ PD_T_DB_DETECT : PD_T_NO_RESPONSE); -+ break; -+ case SNK_DISCOVERY_DEBOUNCE: -+ tcpm_set_state(dev, SNK_DISCOVERY_DEBOUNCE_DONE, -+ PD_T_CC_DEBOUNCE); -+ break; -+ case SNK_DISCOVERY_DEBOUNCE_DONE: -+ tcpm_set_state(dev, unattached_state(port), 0); -+ break; -+ case SNK_WAIT_CAPABILITIES: -+ ret = drvops->set_pd_rx(dev, true); -+ if (ret < 0) { -+ tcpm_set_state(dev, SNK_READY, 0); -+ break; -+ } -+ /* -+ * If VBUS has never been low, and we time out waiting -+ * for source cap, try a soft reset first, in case we -+ * were already in a stable contract before this boot. -+ * Do this only once. -+ */ -+ if (port->vbus_never_low) { -+ port->vbus_never_low = false; -+ tcpm_set_state(dev, SOFT_RESET_SEND, -+ PD_T_SINK_WAIT_CAP); -+ } else { -+ tcpm_set_state(dev, hard_reset_state(port), -+ PD_T_SINK_WAIT_CAP); -+ } -+ break; -+ case SNK_NEGOTIATE_CAPABILITIES: -+ port->pd_capable = true; -+ port->hard_reset_count = 0; -+ ret = tcpm_pd_send_request(dev); -+ if (ret < 0) { -+ /* Let the Source send capabilities again. */ -+ tcpm_set_state(dev, SNK_WAIT_CAPABILITIES, 0); -+ } else { -+ tcpm_set_state_cond(dev, hard_reset_state(port), -+ PD_T_SENDER_RESPONSE); -+ } -+ break; -+ case SNK_TRANSITION_SINK: -+ case SNK_TRANSITION_SINK_VBUS: -+ tcpm_set_state(dev, hard_reset_state(port), -+ PD_T_PS_TRANSITION); -+ break; -+ case SNK_READY: -+ port->update_sink_caps = false; -+ tcpm_typec_connect(port); -+ /* -+ * Here poll_event_cnt is cleared, waiting for self-powered Type-C devices -+ * to send DR_swap Messge until 1s (TCPM_POLL_EVENT_TIME_OUT * 500us)timeout -+ */ -+ if (port->wait_dr_swap_message) -+ tcpm_reset_event_cnt(dev); -+ -+ break; -+ -+ /* Hard_Reset states */ -+ case HARD_RESET_SEND: -+ tcpm_pd_transmit(dev, TCPC_TX_HARD_RESET, NULL); -+ tcpm_set_state(dev, HARD_RESET_START, 0); -+ port->wait_dr_swap_message = false; -+ break; -+ case HARD_RESET_START: -+ port->hard_reset_count++; -+ drvops->set_pd_rx(dev, false); -+ port->nr_sink_caps = 0; -+ if (port->pwr_role == TYPEC_SOURCE) -+ tcpm_set_state(dev, SRC_HARD_RESET_VBUS_OFF, -+ PD_T_PS_HARD_RESET); -+ else -+ tcpm_set_state(dev, SNK_HARD_RESET_SINK_OFF, 0); -+ break; -+ case SRC_HARD_RESET_VBUS_OFF: -+ tcpm_set_vconn(dev, true); -+ tcpm_set_vbus(dev, false); -+ tcpm_set_roles(dev, port->self_powered, TYPEC_SOURCE, -+ TYPEC_HOST); -+ tcpm_set_state(dev, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); -+ break; -+ case SRC_HARD_RESET_VBUS_ON: -+ tcpm_set_vconn(dev, true); -+ tcpm_set_vbus(dev, true); -+ drvops->set_pd_rx(dev, true); -+ tcpm_set_attached_state(dev, true); -+ tcpm_set_state(dev, SRC_UNATTACHED, PD_T_PS_SOURCE_ON); -+ break; -+ case SNK_HARD_RESET_SINK_OFF: -+ tcpm_set_vconn(dev, false); -+ if (port->pd_capable) -+ tcpm_set_charge(dev, false); -+ tcpm_set_roles(dev, port->self_powered, TYPEC_SINK, -+ TYPEC_DEVICE); -+ /* -+ * VBUS may or may not toggle, depending on the adapter. -+ * If it doesn't toggle, transition to SNK_HARD_RESET_SINK_ON -+ * directly after timeout. -+ */ -+ tcpm_set_state(dev, SNK_HARD_RESET_SINK_ON, PD_T_SAFE_0V); -+ break; -+ case SNK_HARD_RESET_WAIT_VBUS: -+ /* Assume we're disconnected if VBUS doesn't come back. */ -+ tcpm_set_state(dev, SNK_UNATTACHED, -+ PD_T_SRC_RECOVER_MAX + PD_T_SRC_TURN_ON); -+ break; -+ case SNK_HARD_RESET_SINK_ON: -+ /* Note: There is no guarantee that VBUS is on in this state */ -+ /* -+ * XXX: -+ * The specification suggests that dual mode ports in sink -+ * mode should transition to state PE_SRC_Transition_to_default. -+ * See USB power delivery specification chapter 8.3.3.6.1.3. -+ * This would mean to -+ * - turn off VCONN, reset power supply -+ * - request hardware reset -+ * - turn on VCONN -+ * - Transition to state PE_Src_Startup -+ * SNK only ports shall transition to state Snk_Startup -+ * (see chapter 8.3.3.3.8). -+ * Similar, dual-mode ports in source mode should transition -+ * to PE_SNK_Transition_to_default. -+ */ -+ if (port->pd_capable) { -+ tcpm_set_current_limit(dev, -+ tcpm_get_current_limit(port), -+ 5000); -+ tcpm_set_charge(dev, true); -+ } -+ tcpm_set_attached_state(dev, true); -+ tcpm_set_state(dev, SNK_STARTUP, 0); -+ break; -+ -+ /* Soft_Reset states */ -+ case SOFT_RESET: -+ port->message_id = 0; -+ port->rx_msgid = -1; -+ tcpm_pd_send_control(dev, PD_CTRL_ACCEPT); -+ if (port->pwr_role == TYPEC_SOURCE) -+ tcpm_set_state(dev, SRC_SEND_CAPABILITIES, 0); -+ else -+ tcpm_set_state(dev, SNK_WAIT_CAPABILITIES, 0); -+ break; -+ case SOFT_RESET_SEND: -+ port->message_id = 0; -+ port->rx_msgid = -1; -+ if (tcpm_pd_send_control(dev, PD_CTRL_SOFT_RESET)) -+ tcpm_set_state_cond(dev, hard_reset_state(port), 0); -+ else -+ tcpm_set_state_cond(dev, hard_reset_state(port), -+ PD_T_SENDER_RESPONSE); -+ break; -+ -+ /* DR_Swap states */ -+ case DR_SWAP_ACCEPT: -+ tcpm_pd_send_control(dev, PD_CTRL_ACCEPT); -+ tcpm_set_state_cond(dev, DR_SWAP_CHANGE_DR, 0); -+ break; -+ case DR_SWAP_CHANGE_DR: -+ if (port->data_role == TYPEC_HOST) { -+ tcpm_set_roles(dev, true, port->pwr_role, -+ TYPEC_DEVICE); -+ } else { -+ tcpm_set_roles(dev, true, port->pwr_role, -+ TYPEC_HOST); -+ } -+ /* DR_swap process complete, wait_dr_swap_message is cleared */ -+ port->wait_dr_swap_message = false; -+ tcpm_set_state(dev, ready_state(port), 0); -+ break; -+ case ERROR_RECOVERY: -+ tcpm_set_state(dev, PORT_RESET, 0); -+ break; -+ case PORT_RESET: -+ tcpm_reset_port(dev); -+ if (port->self_powered) -+ tcpm_set_cc(dev, TYPEC_CC_OPEN); -+ else -+ tcpm_set_cc(dev, tcpm_default_state(port) == SNK_UNATTACHED ? -+ TYPEC_CC_RD : tcpm_rp_cc(port)); -+ tcpm_set_state(dev, PORT_RESET_WAIT_OFF, -+ PD_T_ERROR_RECOVERY); -+ break; -+ case PORT_RESET_WAIT_OFF: -+ tcpm_set_state(dev, -+ tcpm_default_state(port), -+ port->vbus_present ? PD_T_PS_SOURCE_OFF : 0); -+ break; -+ default: -+ dev_err(dev, "TCPM: Unexpected port state %d\n", port->state); -+ break; -+ } -+} -+ -+static void tcpm_state_machine(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ enum tcpm_state prev_state; -+ -+ mutex_lock(&port->lock); -+ port->state_machine_running = true; -+ -+ if (port->queued_message && tcpm_send_queued_message(dev)) -+ goto done; -+ -+ /* If we were queued due to a delayed state change, update it now */ -+ if (port->delayed_state) { -+ dev_dbg(dev, "TCPM: state change %s -> %s [delayed %ld ms]\n", -+ tcpm_states[port->state], -+ tcpm_states[port->delayed_state], port->delay_ms); -+ port->prev_state = port->state; -+ port->state = port->delayed_state; -+ port->delayed_state = INVALID_STATE; -+ } -+ -+ /* -+ * Continue running as long as we have (non-delayed) state changes -+ * to make. -+ */ -+ do { -+ prev_state = port->state; -+ run_state_machine(dev); -+ if (port->queued_message) -+ tcpm_send_queued_message(dev); -+ } while (port->state != prev_state && !port->delayed_state); -+ -+done: -+ port->state_machine_running = false; -+ mutex_unlock(&port->lock); -+} -+ -+static void _tcpm_cc_change(struct udevice *dev, enum typec_cc_status cc1, -+ enum typec_cc_status cc2) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ enum typec_cc_status old_cc1, old_cc2; -+ enum tcpm_state new_state; -+ -+ old_cc1 = port->cc1; -+ old_cc2 = port->cc2; -+ port->cc1 = cc1; -+ port->cc2 = cc2; -+ -+ dev_dbg(dev, "TCPM: CC1: %u -> %u, CC2: %u -> %u [state %s, polarity %d, %s]\n", -+ old_cc1, cc1, old_cc2, cc2, tcpm_states[port->state], -+ port->polarity, -+ tcpm_port_is_disconnected(port) ? "disconnected" : "connected"); -+ -+ switch (port->state) { -+ case TOGGLING: -+ if (tcpm_port_is_source(port)) -+ tcpm_set_state(dev, SRC_ATTACH_WAIT, 0); -+ else if (tcpm_port_is_sink(port)) -+ tcpm_set_state(dev, SNK_ATTACH_WAIT, 0); -+ break; -+ case SRC_UNATTACHED: -+ case SRC_ATTACH_WAIT: -+ if (tcpm_port_is_disconnected(port)) -+ tcpm_set_state(dev, SRC_UNATTACHED, 0); -+ else if (cc1 != old_cc1 || cc2 != old_cc2) -+ tcpm_set_state(dev, SRC_ATTACH_WAIT, 0); -+ break; -+ case SRC_ATTACHED: -+ case SRC_SEND_CAPABILITIES: -+ case SRC_READY: -+ if (tcpm_port_is_disconnected(port) || -+ !tcpm_port_is_source(port)) -+ tcpm_set_state(dev, SRC_UNATTACHED, 0); -+ break; -+ case SNK_UNATTACHED: -+ if (tcpm_port_is_sink(port)) -+ tcpm_set_state(dev, SNK_ATTACH_WAIT, 0); -+ break; -+ case SNK_ATTACH_WAIT: -+ if ((port->cc1 == TYPEC_CC_OPEN && -+ port->cc2 != TYPEC_CC_OPEN) || -+ (port->cc1 != TYPEC_CC_OPEN && -+ port->cc2 == TYPEC_CC_OPEN)) -+ new_state = SNK_DEBOUNCED; -+ else if (tcpm_port_is_disconnected(port)) -+ new_state = SNK_UNATTACHED; -+ else -+ break; -+ if (new_state != port->delayed_state) -+ tcpm_set_state(dev, SNK_ATTACH_WAIT, 0); -+ break; -+ case SNK_DEBOUNCED: -+ if (tcpm_port_is_disconnected(port)) -+ new_state = SNK_UNATTACHED; -+ else if (port->vbus_present) -+ new_state = tcpm_try_src(port) ? INVALID_STATE : SNK_ATTACHED; -+ else -+ new_state = SNK_UNATTACHED; -+ if (new_state != port->delayed_state) -+ tcpm_set_state(dev, SNK_DEBOUNCED, 0); -+ break; -+ case SNK_READY: -+ if (tcpm_port_is_disconnected(port)) -+ tcpm_set_state(dev, unattached_state(port), 0); -+ else if (!port->pd_capable && -+ (cc1 != old_cc1 || cc2 != old_cc2)) -+ tcpm_set_current_limit(dev, -+ tcpm_get_current_limit(port), -+ 5000); -+ break; -+ -+ case SNK_DISCOVERY: -+ /* CC line is unstable, wait for debounce */ -+ if (tcpm_port_is_disconnected(port)) -+ tcpm_set_state(dev, SNK_DISCOVERY_DEBOUNCE, 0); -+ break; -+ case SNK_DISCOVERY_DEBOUNCE: -+ break; -+ -+ case PORT_RESET: -+ case PORT_RESET_WAIT_OFF: -+ /* -+ * State set back to default mode once the timer completes. -+ * Ignore CC changes here. -+ */ -+ break; -+ default: -+ /* -+ * While acting as sink and auto vbus discharge is enabled, Allow disconnect -+ * to be driven by vbus disconnect. -+ */ -+ if (tcpm_port_is_disconnected(port)) -+ tcpm_set_state(dev, unattached_state(port), 0); -+ break; -+ } -+} -+ -+static void _tcpm_pd_vbus_on(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ dev_dbg(dev, "TCPM: VBUS on event\n"); -+ port->vbus_present = true; -+ /* -+ * When vbus_present is true i.e. Voltage at VBUS is greater than VSAFE5V implicitly -+ * states that vbus is not at VSAFE0V, hence clear the vbus_vsafe0v flag here. -+ */ -+ port->vbus_vsafe0v = false; -+ -+ switch (port->state) { -+ case SNK_TRANSITION_SINK_VBUS: -+ port->explicit_contract = true; -+ tcpm_set_state(dev, SNK_READY, 0); -+ break; -+ case SNK_DISCOVERY: -+ tcpm_set_state(dev, SNK_DISCOVERY, 0); -+ break; -+ case SNK_DEBOUNCED: -+ tcpm_set_state(dev, SNK_ATTACHED, 0); -+ break; -+ case SNK_HARD_RESET_WAIT_VBUS: -+ tcpm_set_state(dev, SNK_HARD_RESET_SINK_ON, 0); -+ break; -+ case SRC_ATTACHED: -+ tcpm_set_state(dev, SRC_STARTUP, 0); -+ break; -+ case SRC_HARD_RESET_VBUS_ON: -+ tcpm_set_state(dev, SRC_STARTUP, 0); -+ break; -+ -+ case PORT_RESET: -+ case PORT_RESET_WAIT_OFF: -+ /* -+ * State set back to default mode once the timer completes. -+ * Ignore vbus changes here. -+ */ -+ break; -+ -+ default: -+ break; -+ } -+} -+ -+static void _tcpm_pd_vbus_off(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ dev_dbg(dev, "TCPM: VBUS off event\n"); -+ port->vbus_present = false; -+ port->vbus_never_low = false; -+ switch (port->state) { -+ case SNK_HARD_RESET_SINK_OFF: -+ tcpm_set_state(dev, SNK_HARD_RESET_WAIT_VBUS, 0); -+ break; -+ case HARD_RESET_SEND: -+ break; -+ case SNK_ATTACH_WAIT: -+ tcpm_set_state(dev, SNK_UNATTACHED, 0); -+ break; -+ -+ case SNK_NEGOTIATE_CAPABILITIES: -+ break; -+ -+ case PORT_RESET_WAIT_OFF: -+ tcpm_set_state(dev, tcpm_default_state(port), 0); -+ break; -+ -+ case PORT_RESET: -+ /* -+ * State set back to default mode once the timer completes. -+ * Ignore vbus changes here. -+ */ -+ break; -+ -+ default: -+ if (port->pwr_role == TYPEC_SINK && port->attached) -+ tcpm_set_state(dev, SNK_UNATTACHED, 0); -+ break; -+ } -+} -+ -+void tcpm_cc_change(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ enum typec_cc_status cc1, cc2; -+ -+ tcpm_reset_event_cnt(dev); -+ if (drvops->get_cc(dev, &cc1, &cc2) == 0) -+ _tcpm_cc_change(dev, cc1, cc2); -+} -+ -+void tcpm_vbus_change(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ bool vbus; -+ -+ tcpm_reset_event_cnt(dev); -+ vbus = drvops->get_vbus(dev); -+ if (vbus) -+ _tcpm_pd_vbus_on(dev); -+ else -+ _tcpm_pd_vbus_off(dev); -+} -+ -+void tcpm_pd_hard_reset(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ tcpm_reset_event_cnt(dev); -+ dev_dbg(dev, "TCPM: Received hard reset\n"); -+ -+ /* If a hard reset message is received during the port reset process, -+ * we should ignore it, that is, do not set port->state to HARD_RESET_START. -+ */ -+ if (port->state == PORT_RESET || port->state == PORT_RESET_WAIT_OFF) -+ return; -+ -+ /* -+ * If we keep receiving hard reset requests, executing the hard reset -+ * must have failed. Revert to error recovery if that happens. -+ */ -+ tcpm_set_state(dev, -+ port->hard_reset_count < PD_N_HARD_RESET_COUNT ? -+ HARD_RESET_START : ERROR_RECOVERY, -+ 0); -+} -+ -+static void tcpm_init(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ enum typec_cc_status cc1, cc2; -+ -+ drvops->init(dev); -+ -+ tcpm_reset_port(dev); -+ -+ /* -+ * XXX -+ * Should possibly wait for VBUS to settle if it was enabled locally -+ * since tcpm_reset_port() will disable VBUS. -+ */ -+ port->vbus_present = drvops->get_vbus(dev); -+ if (port->vbus_present) -+ port->vbus_never_low = true; -+ -+ /* -+ * 1. When vbus_present is true, voltage on VBUS is already at VSAFE5V. -+ * So implicitly vbus_vsafe0v = false. -+ * -+ * 2. When vbus_present is false and TCPC does NOT support querying -+ * vsafe0v status, then, it's best to assume vbus is at VSAFE0V i.e. -+ * vbus_vsafe0v is true. -+ * -+ * 3. When vbus_present is false and TCPC does support querying vsafe0v, -+ * then, query tcpc for vsafe0v status. -+ */ -+ if (port->vbus_present) -+ port->vbus_vsafe0v = false; -+ else -+ port->vbus_vsafe0v = true; -+ -+ tcpm_set_state(dev, tcpm_default_state(port), 0); -+ -+ if (drvops->get_cc(dev, &cc1, &cc2) == 0) -+ _tcpm_cc_change(dev, cc1, cc2); -+} -+ -+static int tcpm_fw_get_caps(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ ofnode node; -+ const char *cap_str; -+ int ret; -+ u32 mw; -+ -+ ret = drvops->get_connector_node(dev, &node); -+ if (ret) -+ return ret; -+ -+ cap_str = ofnode_read_string(node, "power-role"); -+ if (!cap_str) -+ return -EINVAL; -+ -+ if (!strcmp("dual", cap_str)) -+ port->typec_type = TYPEC_PORT_DRP; -+ else if (!strcmp("source", cap_str)) -+ port->typec_type = TYPEC_PORT_SRC; -+ else if (!strcmp("sink", cap_str)) -+ port->typec_type = TYPEC_PORT_SNK; -+ else -+ return -EINVAL; -+ -+ port->port_type = port->typec_type; -+ -+ if (port->port_type == TYPEC_PORT_SNK) -+ goto sink; -+ -+ /* Get source pdos */ -+ ret = ofnode_read_size(node, "source-pdos") / sizeof(u32); -+ if (ret <= 0) -+ return -EINVAL; -+ -+ port->nr_src_pdo = min(ret, PDO_MAX_OBJECTS); -+ ret = ofnode_read_u32_array(node, "source-pdos", -+ port->src_pdo, port->nr_src_pdo); -+ if (ret || tcpm_validate_caps(dev, port->src_pdo, port->nr_src_pdo)) -+ return -EINVAL; -+ -+ if (port->port_type == TYPEC_PORT_SRC) -+ return 0; -+ -+ /* Get the preferred power role for DRP */ -+ cap_str = ofnode_read_string(node, "try-power-role"); -+ if (!cap_str) -+ return -EINVAL; -+ -+ if (!strcmp("sink", cap_str)) -+ port->typec_prefer_role = TYPEC_SINK; -+ else if (!strcmp("source", cap_str)) -+ port->typec_prefer_role = TYPEC_SOURCE; -+ else -+ return -EINVAL; -+ -+ if (port->typec_prefer_role < 0) -+ return -EINVAL; -+sink: -+ /* Get sink pdos */ -+ ret = ofnode_read_size(node, "sink-pdos") / sizeof(u32); -+ if (ret <= 0) -+ return -EINVAL; -+ -+ port->nr_snk_pdo = min(ret, PDO_MAX_OBJECTS); -+ ret = ofnode_read_u32_array(node, "sink-pdos", -+ port->snk_pdo, port->nr_snk_pdo); -+ if (ret || tcpm_validate_caps(dev, port->snk_pdo, port->nr_snk_pdo)) -+ return -EINVAL; -+ -+ if (ofnode_read_u32_array(node, "op-sink-microwatt", &mw, 1)) -+ return -EINVAL; -+ port->operating_snk_mw = mw / 1000; -+ -+ port->self_powered = ofnode_read_bool(node, "self-powered"); -+ -+ return 0; -+} -+ -+static int tcpm_port_init(struct udevice *dev) -+{ -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ int err; -+ -+ err = tcpm_fw_get_caps(dev); -+ if (err < 0) { -+ dev_err(dev, "TCPM: please check the dts config: %d\n", err); -+ return err; -+ } -+ -+ port->try_role = port->typec_prefer_role; -+ port->port_type = port->typec_type; -+ -+ tcpm_init(dev); -+ -+ dev_info(dev, "TCPM: init finished\n"); -+ -+ return 0; -+} -+ -+static void tcpm_poll_event(struct udevice *dev) -+{ -+ const struct dm_tcpm_ops *drvops = dev_get_driver_ops(dev); -+ struct tcpm_port *port = dev_get_uclass_plat(dev); -+ -+ if (!drvops->get_vbus(dev)) -+ return; -+ -+ while (port->poll_event_cnt < TCPM_POLL_EVENT_TIME_OUT) { -+ if (!port->wait_dr_swap_message && -+ (port->state == SNK_READY || port->state == SRC_READY)) -+ break; -+ -+ drvops->poll_event(dev); -+ port->poll_event_cnt++; -+ udelay(500); -+ tcpm_check_and_run_delayed_work(dev); -+ } -+ -+ if (port->state != SNK_READY && port->state != SRC_READY) -+ dev_warn(dev, "TCPM: exit in state %s\n", -+ tcpm_states[port->state]); -+ -+ /* -+ * At this time, call the callback function of the respective pd chip -+ * to enter the low-power mode. In order to reduce the time spent on -+ * the PD chip driver as much as possible, the tcpm framework does not -+ * fully process the communication initiated by the device,so it should -+ * be noted that we can disable the internal oscillator, etc., but do -+ * not turn off the power of the transceiver module, otherwise the -+ * self-powered Type-C device will initiate a Message(eg: self-powered -+ * Type-C hub initiates a SINK capability request(PD_CTRL_GET_SINK_CAP)) -+ * and the pd chip cannot reply to GoodCRC, causing the self-powered Type-C -+ * device to switch vbus to vSafe5v, or even turn off vbus. -+ */ -+ if (!drvops->enter_low_power_mode) -+ return; -+ -+ if (drvops->enter_low_power_mode(dev, port->attached, port->pd_capable)) -+ dev_err(dev, "TCPM: failed to enter low power\n"); -+ else -+ dev_info(dev, "TCPM: PD chip enter low power mode\n"); -+} -+ -+int tcpm_post_probe(struct udevice *dev) -+{ -+ int ret = tcpm_port_init(dev); -+ -+ if (ret < 0) { -+ dev_err(dev, "failed to tcpm port init\n"); -+ return ret; -+ } -+ -+ tcpm_poll_event(dev); -+ -+ return 0; -+} -diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h -index 5271e646bb16..270088ad94f7 100644 ---- a/include/dm/uclass-id.h -+++ b/include/dm/uclass-id.h -@@ -139,6 +139,7 @@ enum uclass_id { - UCLASS_SYSCON, /* System configuration device */ - UCLASS_SYSINFO, /* Device information from hardware */ - UCLASS_SYSRESET, /* System reset device */ -+ UCLASS_TCPM, /* TypeC port manager */ - UCLASS_TEE, /* Trusted Execution Environment device */ - UCLASS_THERMAL, /* Thermal sensor */ - UCLASS_TIMER, /* Timer device */ -diff --git a/include/usb/pd.h b/include/usb/pd.h -new file mode 100644 -index 000000000000..cacda322d7c6 ---- /dev/null -+++ b/include/usb/pd.h -@@ -0,0 +1,516 @@ -+/* SPDX-License-Identifier: GPL-2.0-or-later */ -+/* -+ * Copyright 2015-2017 Google, Inc -+ */ -+ -+#ifndef __LINUX_USB_PD_H -+#define __LINUX_USB_PD_H -+ -+#include -+#include -+ -+enum typec_port_type { -+ TYPEC_PORT_SRC, -+ TYPEC_PORT_SNK, -+ TYPEC_PORT_DRP, -+}; -+ -+enum typec_data_role { -+ TYPEC_DEVICE, -+ TYPEC_HOST, -+}; -+ -+enum typec_role { -+ TYPEC_SINK, -+ TYPEC_SOURCE, -+}; -+ -+/* USB PD Messages */ -+enum pd_ctrl_msg_type { -+ /* 0 Reserved */ -+ PD_CTRL_GOOD_CRC = 1, -+ PD_CTRL_GOTO_MIN = 2, -+ PD_CTRL_ACCEPT = 3, -+ PD_CTRL_REJECT = 4, -+ PD_CTRL_PING = 5, -+ PD_CTRL_PS_RDY = 6, -+ PD_CTRL_GET_SOURCE_CAP = 7, -+ PD_CTRL_GET_SINK_CAP = 8, -+ PD_CTRL_DR_SWAP = 9, -+ PD_CTRL_PR_SWAP = 10, -+ PD_CTRL_VCONN_SWAP = 11, -+ PD_CTRL_WAIT = 12, -+ PD_CTRL_SOFT_RESET = 13, -+ /* 14-15 Reserved */ -+ PD_CTRL_NOT_SUPP = 16, -+ PD_CTRL_GET_SOURCE_CAP_EXT = 17, -+ PD_CTRL_GET_STATUS = 18, -+ PD_CTRL_FR_SWAP = 19, -+ PD_CTRL_GET_PPS_STATUS = 20, -+ PD_CTRL_GET_COUNTRY_CODES = 21, -+ /* 22-31 Reserved */ -+}; -+ -+enum pd_data_msg_type { -+ /* 0 Reserved */ -+ PD_DATA_SOURCE_CAP = 1, -+ PD_DATA_REQUEST = 2, -+ PD_DATA_BIST = 3, -+ PD_DATA_SINK_CAP = 4, -+ PD_DATA_BATT_STATUS = 5, -+ PD_DATA_ALERT = 6, -+ PD_DATA_GET_COUNTRY_INFO = 7, -+ PD_DATA_ENTER_USB = 8, -+ /* 9-14 Reserved */ -+ PD_DATA_VENDOR_DEF = 15, -+ /* 16-31 Reserved */ -+}; -+ -+enum pd_ext_msg_type { -+ /* 0 Reserved */ -+ PD_EXT_SOURCE_CAP_EXT = 1, -+ PD_EXT_STATUS = 2, -+ PD_EXT_GET_BATT_CAP = 3, -+ PD_EXT_GET_BATT_STATUS = 4, -+ PD_EXT_BATT_CAP = 5, -+ PD_EXT_GET_MANUFACTURER_INFO = 6, -+ PD_EXT_MANUFACTURER_INFO = 7, -+ PD_EXT_SECURITY_REQUEST = 8, -+ PD_EXT_SECURITY_RESPONSE = 9, -+ PD_EXT_FW_UPDATE_REQUEST = 10, -+ PD_EXT_FW_UPDATE_RESPONSE = 11, -+ PD_EXT_PPS_STATUS = 12, -+ PD_EXT_COUNTRY_INFO = 13, -+ PD_EXT_COUNTRY_CODES = 14, -+ /* 15-31 Reserved */ -+}; -+ -+#define PD_REV10 0x0 -+#define PD_REV20 0x1 -+#define PD_REV30 0x2 -+#define PD_MAX_REV PD_REV30 -+ -+#define PD_HEADER_EXT_HDR BIT(15) -+#define PD_HEADER_CNT_SHIFT 12 -+#define PD_HEADER_CNT_MASK 0x7 -+#define PD_HEADER_ID_SHIFT 9 -+#define PD_HEADER_ID_MASK 0x7 -+#define PD_HEADER_PWR_ROLE BIT(8) -+#define PD_HEADER_REV_SHIFT 6 -+#define PD_HEADER_REV_MASK 0x3 -+#define PD_HEADER_DATA_ROLE BIT(5) -+#define PD_HEADER_TYPE_SHIFT 0 -+#define PD_HEADER_TYPE_MASK 0x1f -+ -+#define PD_HEADER(type, pwr, data, rev, id, cnt, ext_hdr) \ -+ ((((type) & PD_HEADER_TYPE_MASK) << PD_HEADER_TYPE_SHIFT) | \ -+ ((pwr) == TYPEC_SOURCE ? PD_HEADER_PWR_ROLE : 0) | \ -+ ((data) == TYPEC_HOST ? PD_HEADER_DATA_ROLE : 0) | \ -+ ((rev) << PD_HEADER_REV_SHIFT) | \ -+ (((id) & PD_HEADER_ID_MASK) << PD_HEADER_ID_SHIFT) | \ -+ (((cnt) & PD_HEADER_CNT_MASK) << PD_HEADER_CNT_SHIFT) | \ -+ ((ext_hdr) ? PD_HEADER_EXT_HDR : 0)) -+ -+#define PD_HEADER_LE(type, pwr, data, rev, id, cnt) \ -+ cpu_to_le16(PD_HEADER((type), (pwr), (data), (rev), (id), (cnt), (0))) -+ -+static inline unsigned int pd_header_cnt(u16 header) -+{ -+ return (header >> PD_HEADER_CNT_SHIFT) & PD_HEADER_CNT_MASK; -+} -+ -+static inline unsigned int pd_header_cnt_le(__le16 header) -+{ -+ return pd_header_cnt(le16_to_cpu(header)); -+} -+ -+static inline unsigned int pd_header_type(u16 header) -+{ -+ return (header >> PD_HEADER_TYPE_SHIFT) & PD_HEADER_TYPE_MASK; -+} -+ -+static inline unsigned int pd_header_type_le(__le16 header) -+{ -+ return pd_header_type(le16_to_cpu(header)); -+} -+ -+static inline unsigned int pd_header_msgid(u16 header) -+{ -+ return (header >> PD_HEADER_ID_SHIFT) & PD_HEADER_ID_MASK; -+} -+ -+static inline unsigned int pd_header_msgid_le(__le16 header) -+{ -+ return pd_header_msgid(le16_to_cpu(header)); -+} -+ -+static inline unsigned int pd_header_rev(u16 header) -+{ -+ return (header >> PD_HEADER_REV_SHIFT) & PD_HEADER_REV_MASK; -+} -+ -+static inline unsigned int pd_header_rev_le(__le16 header) -+{ -+ return pd_header_rev(le16_to_cpu(header)); -+} -+ -+#define PD_EXT_HDR_CHUNKED BIT(15) -+#define PD_EXT_HDR_CHUNK_NUM_SHIFT 11 -+#define PD_EXT_HDR_CHUNK_NUM_MASK 0xf -+#define PD_EXT_HDR_REQ_CHUNK BIT(10) -+#define PD_EXT_HDR_DATA_SIZE_SHIFT 0 -+#define PD_EXT_HDR_DATA_SIZE_MASK 0x1ff -+ -+#define PD_EXT_HDR(data_size, req_chunk, chunk_num, chunked) \ -+ ((((data_size) & PD_EXT_HDR_DATA_SIZE_MASK) << PD_EXT_HDR_DATA_SIZE_SHIFT) | \ -+ ((req_chunk) ? PD_EXT_HDR_REQ_CHUNK : 0) | \ -+ (((chunk_num) & PD_EXT_HDR_CHUNK_NUM_MASK) << PD_EXT_HDR_CHUNK_NUM_SHIFT) | \ -+ ((chunked) ? PD_EXT_HDR_CHUNKED : 0)) -+ -+#define PD_EXT_HDR_LE(data_size, req_chunk, chunk_num, chunked) \ -+ cpu_to_le16(PD_EXT_HDR((data_size), (req_chunk), (chunk_num), (chunked))) -+ -+static inline unsigned int pd_ext_header_chunk_num(u16 ext_header) -+{ -+ return (ext_header >> PD_EXT_HDR_CHUNK_NUM_SHIFT) & -+ PD_EXT_HDR_CHUNK_NUM_MASK; -+} -+ -+static inline unsigned int pd_ext_header_data_size(u16 ext_header) -+{ -+ return (ext_header >> PD_EXT_HDR_DATA_SIZE_SHIFT) & -+ PD_EXT_HDR_DATA_SIZE_MASK; -+} -+ -+static inline unsigned int pd_ext_header_data_size_le(__le16 ext_header) -+{ -+ return pd_ext_header_data_size(le16_to_cpu(ext_header)); -+} -+ -+#define PD_MAX_PAYLOAD 7 -+#define PD_EXT_MAX_CHUNK_DATA 26 -+ -+/* -+ * struct pd_chunked_ext_message_data - PD chunked extended message data as -+ * seen on wire -+ * @header: PD extended message header -+ * @data: PD extended message data -+ */ -+struct pd_chunked_ext_message_data { -+ __le16 header; -+ u8 data[PD_EXT_MAX_CHUNK_DATA]; -+} __packed; -+ -+/* -+ * struct pd_message - PD message as seen on wire -+ * @header: PD message header -+ * @payload: PD message payload -+ * @ext_msg: PD message chunked extended message data -+ */ -+struct pd_message { -+ __le16 header; -+ union { -+ __le32 payload[PD_MAX_PAYLOAD]; -+ struct pd_chunked_ext_message_data ext_msg; -+ }; -+} __packed; -+ -+/* PDO: Power Data Object */ -+#define PDO_MAX_OBJECTS 7 -+ -+enum pd_pdo_type { -+ PDO_TYPE_FIXED = 0, -+ PDO_TYPE_BATT = 1, -+ PDO_TYPE_VAR = 2, -+ PDO_TYPE_APDO = 3, -+}; -+ -+#define PDO_TYPE_SHIFT 30 -+#define PDO_TYPE_MASK 0x3 -+ -+#define PDO_TYPE(t) ((t) << PDO_TYPE_SHIFT) -+ -+#define PDO_VOLT_MASK 0x3ff -+#define PDO_CURR_MASK 0x3ff -+#define PDO_PWR_MASK 0x3ff -+ -+#define PDO_FIXED_DUAL_ROLE BIT(29) /* Power role swap supported */ -+#define PDO_FIXED_SUSPEND BIT(28) /* USB Suspend supported (Source) */ -+#define PDO_FIXED_HIGHER_CAP BIT(28) /* Requires more than vSafe5V (Sink) */ -+#define PDO_FIXED_EXTPOWER BIT(27) /* Externally powered */ -+#define PDO_FIXED_USB_COMM BIT(26) /* USB communications capable */ -+#define PDO_FIXED_DATA_SWAP BIT(25) /* Data role swap supported */ -+#define PDO_FIXED_UNCHUNK_EXT BIT(24) /* Unchunked Extended Message supported (Source) */ -+#define PDO_FIXED_FRS_CURR_MASK (BIT(24) | BIT(23)) /* FR_Swap Current (Sink) */ -+#define PDO_FIXED_FRS_CURR_SHIFT 23 -+#define PDO_FIXED_VOLT_SHIFT 10 /* 50mV units */ -+#define PDO_FIXED_CURR_SHIFT 0 /* 10mA units */ -+ -+#define PDO_FIXED_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_FIXED_VOLT_SHIFT) -+#define PDO_FIXED_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_FIXED_CURR_SHIFT) -+ -+#define PDO_FIXED(mv, ma, flags) \ -+ (PDO_TYPE(PDO_TYPE_FIXED) | (flags) | \ -+ PDO_FIXED_VOLT(mv) | PDO_FIXED_CURR(ma)) -+ -+#define VSAFE5V 5000 /* mv units */ -+ -+#define PDO_BATT_MAX_VOLT_SHIFT 20 /* 50mV units */ -+#define PDO_BATT_MIN_VOLT_SHIFT 10 /* 50mV units */ -+#define PDO_BATT_MAX_PWR_SHIFT 0 /* 250mW units */ -+ -+#define PDO_BATT_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MIN_VOLT_SHIFT) -+#define PDO_BATT_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MAX_VOLT_SHIFT) -+#define PDO_BATT_MAX_POWER(mw) ((((mw) / 250) & PDO_PWR_MASK) << PDO_BATT_MAX_PWR_SHIFT) -+ -+#define PDO_BATT(min_mv, max_mv, max_mw) \ -+ (PDO_TYPE(PDO_TYPE_BATT) | PDO_BATT_MIN_VOLT(min_mv) | \ -+ PDO_BATT_MAX_VOLT(max_mv) | PDO_BATT_MAX_POWER(max_mw)) -+ -+#define PDO_VAR_MAX_VOLT_SHIFT 20 /* 50mV units */ -+#define PDO_VAR_MIN_VOLT_SHIFT 10 /* 50mV units */ -+#define PDO_VAR_MAX_CURR_SHIFT 0 /* 10mA units */ -+ -+#define PDO_VAR_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT) -+#define PDO_VAR_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MAX_VOLT_SHIFT) -+#define PDO_VAR_MAX_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_VAR_MAX_CURR_SHIFT) -+ -+#define PDO_VAR(min_mv, max_mv, max_ma) \ -+ (PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) | \ -+ PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma)) -+ -+enum pd_apdo_type { -+ APDO_TYPE_PPS = 0, -+}; -+ -+#define PDO_APDO_TYPE_SHIFT 28 /* Only valid value currently is 0x0 - PPS */ -+#define PDO_APDO_TYPE_MASK 0x3 -+ -+#define PDO_APDO_TYPE(t) ((t) << PDO_APDO_TYPE_SHIFT) -+ -+#define PDO_PPS_APDO_MAX_VOLT_SHIFT 17 /* 100mV units */ -+#define PDO_PPS_APDO_MIN_VOLT_SHIFT 8 /* 100mV units */ -+#define PDO_PPS_APDO_MAX_CURR_SHIFT 0 /* 50mA units */ -+ -+#define PDO_PPS_APDO_VOLT_MASK 0xff -+#define PDO_PPS_APDO_CURR_MASK 0x7f -+ -+#define PDO_PPS_APDO_MIN_VOLT(mv) \ -+ ((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MIN_VOLT_SHIFT) -+#define PDO_PPS_APDO_MAX_VOLT(mv) \ -+ ((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MAX_VOLT_SHIFT) -+#define PDO_PPS_APDO_MAX_CURR(ma) \ -+ ((((ma) / 50) & PDO_PPS_APDO_CURR_MASK) << PDO_PPS_APDO_MAX_CURR_SHIFT) -+ -+#define PDO_PPS_APDO(min_mv, max_mv, max_ma) \ -+ (PDO_TYPE(PDO_TYPE_APDO) | PDO_APDO_TYPE(APDO_TYPE_PPS) | \ -+ PDO_PPS_APDO_MIN_VOLT(min_mv) | PDO_PPS_APDO_MAX_VOLT(max_mv) | \ -+ PDO_PPS_APDO_MAX_CURR(max_ma)) -+ -+static inline enum pd_pdo_type pdo_type(u32 pdo) -+{ -+ return (pdo >> PDO_TYPE_SHIFT) & PDO_TYPE_MASK; -+} -+ -+static inline unsigned int pdo_fixed_voltage(u32 pdo) -+{ -+ return ((pdo >> PDO_FIXED_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; -+} -+ -+static inline unsigned int pdo_min_voltage(u32 pdo) -+{ -+ return ((pdo >> PDO_VAR_MIN_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; -+} -+ -+static inline unsigned int pdo_max_voltage(u32 pdo) -+{ -+ return ((pdo >> PDO_VAR_MAX_VOLT_SHIFT) & PDO_VOLT_MASK) * 50; -+} -+ -+static inline unsigned int pdo_max_current(u32 pdo) -+{ -+ return ((pdo >> PDO_VAR_MAX_CURR_SHIFT) & PDO_CURR_MASK) * 10; -+} -+ -+static inline unsigned int pdo_max_power(u32 pdo) -+{ -+ return ((pdo >> PDO_BATT_MAX_PWR_SHIFT) & PDO_PWR_MASK) * 250; -+} -+ -+static inline enum pd_apdo_type pdo_apdo_type(u32 pdo) -+{ -+ return (pdo >> PDO_APDO_TYPE_SHIFT) & PDO_APDO_TYPE_MASK; -+} -+ -+static inline unsigned int pdo_pps_apdo_min_voltage(u32 pdo) -+{ -+ return ((pdo >> PDO_PPS_APDO_MIN_VOLT_SHIFT) & -+ PDO_PPS_APDO_VOLT_MASK) * 100; -+} -+ -+static inline unsigned int pdo_pps_apdo_max_voltage(u32 pdo) -+{ -+ return ((pdo >> PDO_PPS_APDO_MAX_VOLT_SHIFT) & -+ PDO_PPS_APDO_VOLT_MASK) * 100; -+} -+ -+static inline unsigned int pdo_pps_apdo_max_current(u32 pdo) -+{ -+ return ((pdo >> PDO_PPS_APDO_MAX_CURR_SHIFT) & -+ PDO_PPS_APDO_CURR_MASK) * 50; -+} -+ -+/* RDO: Request Data Object */ -+#define RDO_OBJ_POS_SHIFT 28 -+#define RDO_OBJ_POS_MASK 0x7 -+#define RDO_GIVE_BACK BIT(27) /* Supports reduced operating current */ -+#define RDO_CAP_MISMATCH BIT(26) /* Not satisfied by source caps */ -+#define RDO_USB_COMM BIT(25) /* USB communications capable */ -+#define RDO_NO_SUSPEND BIT(24) /* USB Suspend not supported */ -+ -+#define RDO_PWR_MASK 0x3ff -+#define RDO_CURR_MASK 0x3ff -+ -+#define RDO_FIXED_OP_CURR_SHIFT 10 -+#define RDO_FIXED_MAX_CURR_SHIFT 0 -+ -+#define RDO_OBJ(idx) (((idx) & RDO_OBJ_POS_MASK) << RDO_OBJ_POS_SHIFT) -+ -+#define PDO_FIXED_OP_CURR(ma) ((((ma) / 10) & RDO_CURR_MASK) << RDO_FIXED_OP_CURR_SHIFT) -+#define PDO_FIXED_MAX_CURR(ma) ((((ma) / 10) & RDO_CURR_MASK) << RDO_FIXED_MAX_CURR_SHIFT) -+ -+#define RDO_FIXED(idx, op_ma, max_ma, flags) \ -+ (RDO_OBJ(idx) | (flags) | \ -+ PDO_FIXED_OP_CURR(op_ma) | PDO_FIXED_MAX_CURR(max_ma)) -+ -+#define RDO_BATT_OP_PWR_SHIFT 10 /* 250mW units */ -+#define RDO_BATT_MAX_PWR_SHIFT 0 /* 250mW units */ -+ -+#define RDO_BATT_OP_PWR(mw) ((((mw) / 250) & RDO_PWR_MASK) << RDO_BATT_OP_PWR_SHIFT) -+#define RDO_BATT_MAX_PWR(mw) ((((mw) / 250) & RDO_PWR_MASK) << RDO_BATT_MAX_PWR_SHIFT) -+ -+#define RDO_BATT(idx, op_mw, max_mw, flags) \ -+ (RDO_OBJ(idx) | (flags) | \ -+ RDO_BATT_OP_PWR(op_mw) | RDO_BATT_MAX_PWR(max_mw)) -+ -+#define RDO_PROG_VOLT_MASK 0x7ff -+#define RDO_PROG_CURR_MASK 0x7f -+ -+#define RDO_PROG_VOLT_SHIFT 9 -+#define RDO_PROG_CURR_SHIFT 0 -+ -+#define RDO_PROG_VOLT_MV_STEP 20 -+#define RDO_PROG_CURR_MA_STEP 50 -+ -+#define PDO_PROG_OUT_VOLT(mv) \ -+ ((((mv) / RDO_PROG_VOLT_MV_STEP) & RDO_PROG_VOLT_MASK) << RDO_PROG_VOLT_SHIFT) -+#define PDO_PROG_OP_CURR(ma) \ -+ ((((ma) / RDO_PROG_CURR_MA_STEP) & RDO_PROG_CURR_MASK) << RDO_PROG_CURR_SHIFT) -+ -+#define RDO_PROG(idx, out_mv, op_ma, flags) \ -+ (RDO_OBJ(idx) | (flags) | \ -+ PDO_PROG_OUT_VOLT(out_mv) | PDO_PROG_OP_CURR(op_ma)) -+ -+static inline unsigned int rdo_index(u32 rdo) -+{ -+ return (rdo >> RDO_OBJ_POS_SHIFT) & RDO_OBJ_POS_MASK; -+} -+ -+static inline unsigned int rdo_op_current(u32 rdo) -+{ -+ return ((rdo >> RDO_FIXED_OP_CURR_SHIFT) & RDO_CURR_MASK) * 10; -+} -+ -+static inline unsigned int rdo_max_current(u32 rdo) -+{ -+ return ((rdo >> RDO_FIXED_MAX_CURR_SHIFT) & -+ RDO_CURR_MASK) * 10; -+} -+ -+static inline unsigned int rdo_op_power(u32 rdo) -+{ -+ return ((rdo >> RDO_BATT_OP_PWR_SHIFT) & RDO_PWR_MASK) * 250; -+} -+ -+static inline unsigned int rdo_max_power(u32 rdo) -+{ -+ return ((rdo >> RDO_BATT_MAX_PWR_SHIFT) & RDO_PWR_MASK) * 250; -+} -+ -+/* Enter_USB Data Object */ -+#define EUDO_USB_MODE_MASK GENMASK(30, 28) -+#define EUDO_USB_MODE_SHIFT 28 -+#define EUDO_USB_MODE_USB2 0 -+#define EUDO_USB_MODE_USB3 1 -+#define EUDO_USB_MODE_USB4 2 -+#define EUDO_USB4_DRD BIT(26) -+#define EUDO_USB3_DRD BIT(25) -+#define EUDO_CABLE_SPEED_MASK GENMASK(23, 21) -+#define EUDO_CABLE_SPEED_SHIFT 21 -+#define EUDO_CABLE_SPEED_USB2 0 -+#define EUDO_CABLE_SPEED_USB3_GEN1 1 -+#define EUDO_CABLE_SPEED_USB4_GEN2 2 -+#define EUDO_CABLE_SPEED_USB4_GEN3 3 -+#define EUDO_CABLE_TYPE_MASK GENMASK(20, 19) -+#define EUDO_CABLE_TYPE_SHIFT 19 -+#define EUDO_CABLE_TYPE_PASSIVE 0 -+#define EUDO_CABLE_TYPE_RE_TIMER 1 -+#define EUDO_CABLE_TYPE_RE_DRIVER 2 -+#define EUDO_CABLE_TYPE_OPTICAL 3 -+#define EUDO_CABLE_CURRENT_MASK GENMASK(18, 17) -+#define EUDO_CABLE_CURRENT_SHIFT 17 -+#define EUDO_CABLE_CURRENT_NOTSUPP 0 -+#define EUDO_CABLE_CURRENT_3A 2 -+#define EUDO_CABLE_CURRENT_5A 3 -+#define EUDO_PCIE_SUPPORT BIT(16) -+#define EUDO_DP_SUPPORT BIT(15) -+#define EUDO_TBT_SUPPORT BIT(14) -+#define EUDO_HOST_PRESENT BIT(13) -+ -+/* USB PD timers and counters */ -+#define PD_T_NO_RESPONSE 5000 /* 4.5 - 5.5 seconds */ -+#define PD_T_DB_DETECT 10000 /* 10 - 15 seconds */ -+#define PD_T_SEND_SOURCE_CAP 150 /* 100 - 200 ms */ -+#define PD_T_SENDER_RESPONSE 60 /* 24 - 30 ms, relaxed */ -+#define PD_T_RECEIVER_RESPONSE 15 /* 15ms max */ -+#define PD_T_SOURCE_ACTIVITY 45 -+#define PD_T_SINK_ACTIVITY 135 -+#define PD_T_SINK_WAIT_CAP 310 /* 310 - 620 ms */ -+#define PD_T_PS_TRANSITION 500 -+#define PD_T_SRC_TRANSITION 35 -+#define PD_T_DRP_SNK 40 -+#define PD_T_DRP_SRC 30 -+#define PD_T_PS_SOURCE_OFF 920 -+#define PD_T_PS_SOURCE_ON 480 -+#define PD_T_PS_SOURCE_ON_PRS 450 /* 390 - 480ms */ -+#define PD_T_PS_HARD_RESET 30 -+#define PD_T_SRC_RECOVER 760 -+#define PD_T_SRC_RECOVER_MAX 1000 -+#define PD_T_SRC_TURN_ON 275 -+#define PD_T_SAFE_0V 650 -+#define PD_T_VCONN_SOURCE_ON 100 -+#define PD_T_SINK_REQUEST 100 /* 100 ms minimum */ -+#define PD_T_ERROR_RECOVERY 100 /* minimum 25 is insufficient */ -+#define PD_T_SRCSWAPSTDBY 625 /* Maximum of 650ms */ -+#define PD_T_NEWSRC 250 /* Maximum of 275ms */ -+#define PD_T_SWAP_SRC_START 20 /* Minimum of 20ms */ -+#define PD_T_BIST_CONT_MODE 50 /* 30 - 60 ms */ -+#define PD_T_SINK_TX 16 /* 16 - 20 ms */ -+#define PD_T_CHUNK_NOT_SUPP 42 /* 40 - 50 ms */ -+ -+#define PD_T_DRP_TRY 100 /* 75 - 150 ms */ -+#define PD_T_DRP_TRYWAIT 600 /* 400 - 800 ms */ -+ -+#define PD_T_CC_DEBOUNCE 200 /* 100 - 200 ms */ -+#define PD_T_PD_DEBOUNCE 20 /* 10 - 20 ms */ -+#define PD_T_TRY_CC_DEBOUNCE 15 /* 10 - 20 ms */ -+ -+#define PD_N_CAPS_COUNT (PD_T_NO_RESPONSE / PD_T_SEND_SOURCE_CAP) -+#define PD_N_HARD_RESET_COUNT 1 -+ -+#define PD_P_SNK_STDBY_MW 2500 /* 2500 mW */ -+ -+/* Time to wait for TCPC to complete transmit */ -+#define PD_T_TCPC_TX_TIMEOUT 100 /* in ms */ -+ -+#endif /* __LINUX_USB_PD_H */ -diff --git a/include/usb/tcpm.h b/include/usb/tcpm.h -new file mode 100644 -index 000000000000..4574a5175ddb ---- /dev/null -+++ b/include/usb/tcpm.h -@@ -0,0 +1,99 @@ -+/* SPDX-License-Identifier: GPL-2.0-or-later */ -+/* -+ * Copyright 2015-2017 Google, Inc -+ * Copyright 2024 Collabora -+ */ -+ -+#ifndef __LINUX_USB_TCPM_H -+#define __LINUX_USB_TCPM_H -+ -+#include -+#include -+#include "pd.h" -+ -+enum typec_orientation { -+ TYPEC_ORIENTATION_NONE, -+ TYPEC_ORIENTATION_NORMAL, -+ TYPEC_ORIENTATION_REVERSE, -+}; -+ -+enum typec_cc_status { -+ TYPEC_CC_OPEN, -+ TYPEC_CC_RA, -+ TYPEC_CC_RD, -+ TYPEC_CC_RP_DEF, -+ TYPEC_CC_RP_1_5, -+ TYPEC_CC_RP_3_0, -+}; -+ -+enum typec_cc_polarity { -+ TYPEC_POLARITY_CC1, -+ TYPEC_POLARITY_CC2, -+}; -+ -+enum tcpm_transmit_status { -+ TCPC_TX_SUCCESS = 0, -+ TCPC_TX_DISCARDED = 1, -+ TCPC_TX_FAILED = 2, -+}; -+ -+enum tcpm_transmit_type { -+ TCPC_TX_SOP = 0, -+ TCPC_TX_SOP_PRIME = 1, -+ TCPC_TX_SOP_PRIME_PRIME = 2, -+ TCPC_TX_SOP_DEBUG_PRIME = 3, -+ TCPC_TX_SOP_DEBUG_PRIME_PRIME = 4, -+ TCPC_TX_HARD_RESET = 5, -+ TCPC_TX_CABLE_RESET = 6, -+ TCPC_TX_BIST_MODE_2 = 7 -+}; -+ -+struct dm_tcpm_ops { -+ int (*get_connector_node)(struct udevice *dev, ofnode *connector_node); -+ int (*init)(struct udevice *dev); -+ int (*get_vbus)(struct udevice *dev); -+ int (*set_cc)(struct udevice *dev, enum typec_cc_status cc); -+ int (*get_cc)(struct udevice *dev, enum typec_cc_status *cc1, -+ enum typec_cc_status *cc2); -+ int (*set_polarity)(struct udevice *dev, -+ enum typec_cc_polarity polarity); -+ int (*set_vconn)(struct udevice *dev, bool on); -+ int (*set_vbus)(struct udevice *dev, bool on, bool charge); -+ int (*set_pd_rx)(struct udevice *dev, bool on); -+ int (*set_roles)(struct udevice *dev, bool attached, -+ enum typec_role role, enum typec_data_role data); -+ int (*start_toggling)(struct udevice *dev, -+ enum typec_port_type port_type, -+ enum typec_cc_status cc); -+ int (*pd_transmit)(struct udevice *dev, enum tcpm_transmit_type type, -+ const struct pd_message *msg, unsigned int negotiated_rev); -+ void (*poll_event)(struct udevice *dev); -+ int (*enter_low_power_mode)(struct udevice *dev, bool attached, bool pd_capable); -+}; -+ -+/* API for drivers */ -+void tcpm_vbus_change(struct udevice *dev); -+void tcpm_cc_change(struct udevice *dev); -+void tcpm_pd_receive(struct udevice *dev, const struct pd_message *msg); -+void tcpm_pd_transmit_complete(struct udevice *dev, -+ enum tcpm_transmit_status status); -+void tcpm_pd_hard_reset(struct udevice *dev); -+ -+/* API for boards */ -+extern const char * const typec_pd_rev_name[]; -+extern const char * const typec_orientation_name[]; -+extern const char * const typec_role_name[]; -+extern const char * const typec_data_role_name[]; -+extern const char * const typec_cc_status_name[]; -+ -+int tcpm_get(const char *name, struct udevice **devp); -+int tcpm_get_pd_rev(struct udevice *dev); -+int tcpm_get_current(struct udevice *dev); -+int tcpm_get_voltage(struct udevice *dev); -+enum typec_orientation tcpm_get_orientation(struct udevice *dev); -+enum typec_role tcpm_get_pwr_role(struct udevice *dev); -+enum typec_data_role tcpm_get_data_role(struct udevice *dev); -+bool tcpm_is_connected(struct udevice *dev); -+const char *tcpm_get_state(struct udevice *dev); -+ -+#endif /* __LINUX_USB_TCPM_H */ - -From patchwork Thu Sep 5 15:08:38 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Sebastian Reichel -X-Patchwork-Id: 1981316 -X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com - header.a=rsa-sha256 header.s=mail header.b=d3aozlfW; - 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 4X030913Sdz1yXY - for ; Fri, 6 Sep 2024 01:18:17 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 4C12888CC2; - Thu, 5 Sep 2024 17:17:19 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com - header.b="d3aozlfW"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id F400788CC2; Thu, 5 Sep 2024 17:17:17 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from bali.collaboradmins.com (bali.collaboradmins.com - [IPv6:2a01:4f8:201:9162::2]) - (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 4C6CB88CB8 - for ; Thu, 5 Sep 2024 17:17:13 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sebastian.reichel@collabora.com -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; - s=mail; t=1725549433; - bh=fuHT4MalSjyQfKUjWdVq0nVnduu/AbWGeUChYJaCIeY=; - h=From:To:Cc:Subject:Date:In-Reply-To:References:From; - b=d3aozlfWwAG+KQBk/EM6vpvcIoIEEksahdSc+LhMi76PX8NNsu3zOQomQcug5dlmD - kqV/SDj3yszJBox46C1h2pfHNNLn7CD/u95G6BwH0A4cv33ZsWN3fEhJQKbkS9sUOB - hFzSWoKr7kCx/KDvBcjoS9Q5063JFZ6CJ1MF7XGgxT3H7WOMEybvC26Mp+j1/c1HNn - vWSjbh5lkW/dpx1unm3PUgMYNy2yrfANnaSFG7vKNtHyq0xHhs2qgOb4fATE80nKVY - RAY1F8b1JTYImazFA3NryRuA50InmvmHjpu9pyx8OQjy05tbnuScyau9SuyjO7usip - Q4lcqzzIB8AlQ== -Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de - [91.248.189.231]) - (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) (Authenticated sender: sre) - by bali.collaboradmins.com (Postfix) with ESMTPSA id ED3E617E0FD9; - Thu, 5 Sep 2024 17:17:12 +0200 (CEST) -Received: by jupiter.universe (Postfix, from userid 1000) - id A19EE4800F4; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) -From: Sebastian Reichel -To: Marek Vasut , u-boot@lists.denx.de, - Jonas Karlman , Soeren Moch -Cc: Eugen Hristev , - Tim Harvey , Kever Yang , - Philipp Tomsich , Simon Glass , - Sebastian Reichel -Subject: [PATCH v6 2/6] usb: tcpm: fusb302: add driver -Date: Thu, 5 Sep 2024 17:08:38 +0200 -Message-ID: <20240905151707.59101-3-sebastian.reichel@collabora.com> -X-Mailer: git-send-email 2.45.2 -In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> -References: <20240905151707.59101-1-sebastian.reichel@collabora.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 - -Now that the TCPM framework exists we can introduce fusb302 -driver using it. This chip is a very common USB-C controller -chip with PD support, which can be found in the Radxa Rock 5B -among many other boards. Apart from Power Delivery, it also -handles detection of the cable orientation. That can be used -to control a mux for connecting the right USB3 lane pair to -the USB3 controller. - -The driver is originally from the Linux kernel, but has been -adapted to the requirements of U-Boot and its TCPM framework. - -Co-developed-by: Wang Jie -Signed-off-by: Wang Jie -Tested-by: Soeren Moch -Signed-off-by: Sebastian Reichel ---- - drivers/usb/tcpm/Kconfig | 8 + - drivers/usb/tcpm/Makefile | 1 + - drivers/usb/tcpm/fusb302.c | 1323 ++++++++++++++++++++++++++++++++ - drivers/usb/tcpm/fusb302_reg.h | 177 +++++ - 4 files changed, 1509 insertions(+) - create mode 100644 drivers/usb/tcpm/fusb302.c - create mode 100644 drivers/usb/tcpm/fusb302_reg.h - -diff --git a/drivers/usb/tcpm/Kconfig b/drivers/usb/tcpm/Kconfig -index 55bf8e202b90..9be4b496e82f 100644 ---- a/drivers/usb/tcpm/Kconfig -+++ b/drivers/usb/tcpm/Kconfig -@@ -6,3 +6,11 @@ config TYPEC_TCPM - help - The Type-C Port Controller Manager provides a USB PD and USB Type-C - state machine for use with Type-C Port Controllers. -+ -+config TYPEC_FUSB302 -+ tristate "Fairchild FUSB302 Type-C chip driver" -+ depends on DM && DM_I2C && TYPEC_TCPM -+ help -+ The Fairchild FUSB302 Type-C chip driver that works with -+ Type-C Port Controller Manager to provide USB PD and USB -+ Type-C functionalities. -diff --git a/drivers/usb/tcpm/Makefile b/drivers/usb/tcpm/Makefile -index a0f76436f3fd..668d33155bf1 100644 ---- a/drivers/usb/tcpm/Makefile -+++ b/drivers/usb/tcpm/Makefile -@@ -1,3 +1,4 @@ - # SPDX-License-Identifier: GPL-2.0 - - obj-$(CONFIG_TYPEC_TCPM) += tcpm.o tcpm-uclass.o -+obj-$(CONFIG_TYPEC_FUSB302) += fusb302.o -diff --git a/drivers/usb/tcpm/fusb302.c b/drivers/usb/tcpm/fusb302.c -new file mode 100644 -index 000000000000..fe93ff3d3397 ---- /dev/null -+++ b/drivers/usb/tcpm/fusb302.c -@@ -0,0 +1,1323 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright 2016-2017 Google, Inc -+ * -+ * Fairchild FUSB302 Type-C Chip Driver -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include "fusb302_reg.h" -+ -+#define FUSB302_MAX_MSG_LEN 0x1F -+ -+enum toggling_mode { -+ TOGGLING_MODE_OFF, -+ TOGGLING_MODE_DRP, -+ TOGGLING_MODE_SNK, -+ TOGGLING_MODE_SRC, -+}; -+ -+enum src_current_status { -+ SRC_CURRENT_DEFAULT, -+ SRC_CURRENT_MEDIUM, -+ SRC_CURRENT_HIGH, -+}; -+ -+static const u8 ra_mda_value[] = { -+ [SRC_CURRENT_DEFAULT] = 4, /* 210mV */ -+ [SRC_CURRENT_MEDIUM] = 9, /* 420mV */ -+ [SRC_CURRENT_HIGH] = 18, /* 798mV */ -+}; -+ -+static const u8 rd_mda_value[] = { -+ [SRC_CURRENT_DEFAULT] = 38, /* 1638mV */ -+ [SRC_CURRENT_MEDIUM] = 38, /* 1638mV */ -+ [SRC_CURRENT_HIGH] = 61, /* 2604mV */ -+}; -+ -+struct fusb302_chip { -+ enum toggling_mode toggling_mode; -+ enum src_current_status src_current_status; -+ bool intr_togdone; -+ bool intr_bc_lvl; -+ bool intr_comp_chng; -+ -+ /* port status */ -+ bool vconn_on; -+ bool vbus_present; -+ enum typec_cc_polarity cc_polarity; -+ enum typec_cc_status cc1; -+ enum typec_cc_status cc2; -+}; -+ -+static int fusb302_i2c_write(struct udevice *dev, u8 address, u8 data) -+{ -+ int ret; -+ -+ ret = dm_i2c_write(dev, address, &data, 1); -+ if (ret) -+ dev_err(dev, "cannot write 0x%02x to 0x%02x, ret=%d\n", -+ data, address, ret); -+ -+ return ret; -+} -+ -+static int fusb302_i2c_block_write(struct udevice *dev, u8 address, -+ u8 length, const u8 *data) -+{ -+ int ret; -+ -+ if (!length) -+ return 0; -+ -+ ret = dm_i2c_write(dev, address, data, length); -+ if (ret) -+ dev_err(dev, "cannot block write 0x%02x, len=%d, ret=%d\n", -+ address, length, ret); -+ -+ return ret; -+} -+ -+static int fusb302_i2c_read(struct udevice *dev, u8 address, u8 *data) -+{ -+ int ret, retries; -+ -+ for (retries = 0; retries < 3; retries++) { -+ ret = dm_i2c_read(dev, address, data, 1); -+ if (ret == 0) -+ return ret; -+ dev_err(dev, "cannot read %02x, ret=%d\n", address, ret); -+ } -+ -+ return ret; -+} -+ -+static int fusb302_i2c_block_read(struct udevice *dev, u8 address, -+ u8 length, u8 *data) -+{ -+ int ret; -+ -+ if (!length) -+ return 0; -+ -+ ret = dm_i2c_read(dev, address, data, length); -+ if (ret) -+ dev_err(dev, "cannot block read 0x%02x, len=%d, ret=%d\n", -+ address, length, ret); -+ return ret; -+} -+ -+static int fusb302_i2c_mask_write(struct udevice *dev, u8 address, -+ u8 mask, u8 value) -+{ -+ int ret; -+ u8 data; -+ -+ ret = fusb302_i2c_read(dev, address, &data); -+ if (ret) -+ return ret; -+ data &= ~mask; -+ data |= value; -+ ret = fusb302_i2c_write(dev, address, data); -+ if (ret) -+ return ret; -+ -+ return ret; -+} -+ -+static int fusb302_i2c_set_bits(struct udevice *dev, u8 address, u8 set_bits) -+{ -+ return fusb302_i2c_mask_write(dev, address, 0x00, set_bits); -+} -+ -+static int fusb302_i2c_clear_bits(struct udevice *dev, u8 address, u8 clear_bits) -+{ -+ return fusb302_i2c_mask_write(dev, address, clear_bits, 0x00); -+} -+ -+static int fusb302_sw_reset(struct udevice *dev) -+{ -+ int ret = fusb302_i2c_write(dev, FUSB_REG_RESET, FUSB_REG_RESET_SW_RESET); -+ -+ if (ret) -+ dev_err(dev, "cannot sw reset the fusb302: %d\n", ret); -+ -+ return ret; -+} -+ -+static int fusb302_enable_tx_auto_retries(struct udevice *dev, u8 retry_count) -+{ -+ int ret; -+ -+ ret = fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL3, retry_count | -+ FUSB_REG_CONTROL3_AUTO_RETRY); -+ -+ return ret; -+} -+ -+/* -+ * mask all interrupt on the chip -+ */ -+static int fusb302_mask_interrupt(struct udevice *dev) -+{ -+ int ret; -+ -+ ret = fusb302_i2c_write(dev, FUSB_REG_MASK, 0xFF); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_write(dev, FUSB_REG_MASKA, 0xFF); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_write(dev, FUSB_REG_MASKB, 0xFF); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL0, -+ FUSB_REG_CONTROL0_INT_MASK); -+ return ret; -+} -+ -+/* -+ * initialize interrupt on the chip -+ * - unmasked interrupt: VBUS_OK -+ */ -+static int fusb302_init_interrupt(struct udevice *dev) -+{ -+ int ret; -+ -+ ret = fusb302_i2c_write(dev, FUSB_REG_MASK, -+ 0xFF & ~FUSB_REG_MASK_VBUSOK); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_write(dev, FUSB_REG_MASKA, 0xFF); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_write(dev, FUSB_REG_MASKB, 0xFF); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_CONTROL0, -+ FUSB_REG_CONTROL0_INT_MASK); -+ return ret; -+} -+ -+static int fusb302_set_power_mode(struct udevice *dev, u8 power_mode) -+{ -+ int ret; -+ -+ ret = fusb302_i2c_write(dev, FUSB_REG_POWER, power_mode); -+ -+ return ret; -+} -+ -+static int fusb302_init(struct udevice *dev) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ int ret; -+ u8 data; -+ -+ ret = fusb302_sw_reset(dev); -+ if (ret) -+ return ret; -+ ret = fusb302_enable_tx_auto_retries(dev, FUSB_REG_CONTROL3_N_RETRIES_3); -+ if (ret) -+ return ret; -+ ret = fusb302_init_interrupt(dev); -+ if (ret) -+ return ret; -+ ret = fusb302_set_power_mode(dev, FUSB_REG_POWER_PWR_ALL); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &data); -+ if (ret) -+ return ret; -+ chip->vbus_present = !!(data & FUSB_REG_STATUS0_VBUSOK); -+ ret = fusb302_i2c_read(dev, FUSB_REG_DEVICE_ID, &data); -+ if (ret) -+ return ret; -+ dev_info(dev, "fusb302 device ID: 0x%02x\n", data); -+ -+ return ret; -+} -+ -+static int fusb302_get_vbus(struct udevice *dev) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ -+ return chip->vbus_present ? 1 : 0; -+} -+ -+static int fusb302_set_src_current(struct udevice *dev, -+ enum src_current_status status) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ int ret; -+ -+ chip->src_current_status = status; -+ switch (status) { -+ case SRC_CURRENT_DEFAULT: -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL0, -+ FUSB_REG_CONTROL0_HOST_CUR_MASK, -+ FUSB_REG_CONTROL0_HOST_CUR_DEF); -+ break; -+ case SRC_CURRENT_MEDIUM: -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL0, -+ FUSB_REG_CONTROL0_HOST_CUR_MASK, -+ FUSB_REG_CONTROL0_HOST_CUR_MED); -+ break; -+ case SRC_CURRENT_HIGH: -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL0, -+ FUSB_REG_CONTROL0_HOST_CUR_MASK, -+ FUSB_REG_CONTROL0_HOST_CUR_HIGH); -+ break; -+ default: -+ ret = -EINVAL; -+ break; -+ } -+ -+ return ret; -+} -+ -+static int fusb302_set_toggling(struct udevice *dev, -+ enum toggling_mode mode) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ int ret; -+ -+ /* first disable toggling */ -+ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_CONTROL2, -+ FUSB_REG_CONTROL2_TOGGLE); -+ if (ret) -+ return ret; -+ /* mask interrupts for SRC or SNK */ -+ ret = fusb302_i2c_set_bits(dev, FUSB_REG_MASK, -+ FUSB_REG_MASK_BC_LVL | -+ FUSB_REG_MASK_COMP_CHNG); -+ if (ret) -+ return ret; -+ chip->intr_bc_lvl = false; -+ chip->intr_comp_chng = false; -+ /* configure toggling mode: none/snk/src/drp */ -+ switch (mode) { -+ case TOGGLING_MODE_OFF: -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL2, -+ FUSB_REG_CONTROL2_MODE_MASK, -+ FUSB_REG_CONTROL2_MODE_NONE); -+ break; -+ case TOGGLING_MODE_SNK: -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL2, -+ FUSB_REG_CONTROL2_MODE_MASK, -+ FUSB_REG_CONTROL2_MODE_UFP); -+ break; -+ case TOGGLING_MODE_SRC: -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL2, -+ FUSB_REG_CONTROL2_MODE_MASK, -+ FUSB_REG_CONTROL2_MODE_DFP); -+ break; -+ case TOGGLING_MODE_DRP: -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_CONTROL2, -+ FUSB_REG_CONTROL2_MODE_MASK, -+ FUSB_REG_CONTROL2_MODE_DRP); -+ break; -+ default: -+ break; -+ } -+ -+ if (ret) -+ return ret; -+ -+ if (mode == TOGGLING_MODE_OFF) { -+ /* mask TOGDONE interrupt */ -+ ret = fusb302_i2c_set_bits(dev, FUSB_REG_MASKA, -+ FUSB_REG_MASKA_TOGDONE); -+ if (ret) -+ return ret; -+ chip->intr_togdone = false; -+ } else { -+ /* Datasheet says vconn MUST be off when toggling */ -+ if (chip->vconn_on) -+ dev_warn(dev, "Vconn is on during toggle start\n"); -+ /* unmask TOGDONE interrupt */ -+ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_MASKA, -+ FUSB_REG_MASKA_TOGDONE); -+ if (ret) -+ return ret; -+ chip->intr_togdone = true; -+ /* start toggling */ -+ ret = fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL2, -+ FUSB_REG_CONTROL2_TOGGLE); -+ if (ret) -+ return ret; -+ /* during toggling, consider cc as Open */ -+ chip->cc1 = TYPEC_CC_OPEN; -+ chip->cc2 = TYPEC_CC_OPEN; -+ } -+ chip->toggling_mode = mode; -+ -+ return ret; -+} -+ -+static const enum src_current_status cc_src_current[] = { -+ [TYPEC_CC_OPEN] = SRC_CURRENT_DEFAULT, -+ [TYPEC_CC_RA] = SRC_CURRENT_DEFAULT, -+ [TYPEC_CC_RD] = SRC_CURRENT_DEFAULT, -+ [TYPEC_CC_RP_DEF] = SRC_CURRENT_DEFAULT, -+ [TYPEC_CC_RP_1_5] = SRC_CURRENT_MEDIUM, -+ [TYPEC_CC_RP_3_0] = SRC_CURRENT_HIGH, -+}; -+ -+static int fusb302_set_cc(struct udevice *dev, enum typec_cc_status cc) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ const u8 switches0_mask = FUSB_REG_SWITCHES0_CC1_PU_EN | -+ FUSB_REG_SWITCHES0_CC2_PU_EN | -+ FUSB_REG_SWITCHES0_CC1_PD_EN | -+ FUSB_REG_SWITCHES0_CC2_PD_EN; -+ u8 rd_mda, switches0_data = 0x00; -+ int ret; -+ -+ switch (cc) { -+ case TYPEC_CC_OPEN: -+ break; -+ case TYPEC_CC_RD: -+ switches0_data |= FUSB_REG_SWITCHES0_CC1_PD_EN | -+ FUSB_REG_SWITCHES0_CC2_PD_EN; -+ break; -+ case TYPEC_CC_RP_DEF: -+ case TYPEC_CC_RP_1_5: -+ case TYPEC_CC_RP_3_0: -+ switches0_data |= (chip->cc_polarity == TYPEC_POLARITY_CC1) ? -+ FUSB_REG_SWITCHES0_CC1_PU_EN : -+ FUSB_REG_SWITCHES0_CC2_PU_EN; -+ break; -+ default: -+ dev_err(dev, "unsupported CC value: %s\n", -+ typec_cc_status_name[cc]); -+ ret = -EINVAL; -+ goto done; -+ } -+ -+ ret = fusb302_set_toggling(dev, TOGGLING_MODE_OFF); -+ if (ret) { -+ dev_err(dev, "cannot set toggling mode: %d\n", ret); -+ goto done; -+ } -+ -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_SWITCHES0, -+ switches0_mask, switches0_data); -+ if (ret) { -+ dev_err(dev, "cannot set pull-up/-down: %d\n", ret); -+ goto done; -+ } -+ /* reset the cc status */ -+ chip->cc1 = TYPEC_CC_OPEN; -+ chip->cc2 = TYPEC_CC_OPEN; -+ -+ /* adjust current for SRC */ -+ ret = fusb302_set_src_current(dev, cc_src_current[cc]); -+ if (ret) { -+ dev_err(dev, "cannot set src current %s: %d\n", -+ typec_cc_status_name[cc], ret); -+ goto done; -+ } -+ -+ /* enable/disable interrupts, BC_LVL for SNK and COMP_CHNG for SRC */ -+ switch (cc) { -+ case TYPEC_CC_RP_DEF: -+ case TYPEC_CC_RP_1_5: -+ case TYPEC_CC_RP_3_0: -+ rd_mda = rd_mda_value[cc_src_current[cc]]; -+ ret = fusb302_i2c_write(dev, FUSB_REG_MEASURE, rd_mda); -+ if (ret) { -+ dev_err(dev, "cannot set SRC measure value: %d\n", ret); -+ goto done; -+ } -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_MASK, -+ FUSB_REG_MASK_BC_LVL | -+ FUSB_REG_MASK_COMP_CHNG, -+ FUSB_REG_MASK_BC_LVL); -+ if (ret) { -+ dev_err(dev, "cannot set SRC irq: %d\n", ret); -+ goto done; -+ } -+ chip->intr_comp_chng = true; -+ break; -+ case TYPEC_CC_RD: -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_MASK, -+ FUSB_REG_MASK_BC_LVL | -+ FUSB_REG_MASK_COMP_CHNG, -+ FUSB_REG_MASK_COMP_CHNG); -+ if (ret) { -+ dev_err(dev, "cannot set SRC irq: %d\n", ret); -+ goto done; -+ } -+ chip->intr_bc_lvl = true; -+ break; -+ default: -+ break; -+ } -+done: -+ return ret; -+} -+ -+static int fusb302_get_cc(struct udevice *dev, enum typec_cc_status *cc1, -+ enum typec_cc_status *cc2) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ -+ *cc1 = chip->cc1; -+ *cc2 = chip->cc2; -+ dev_dbg(dev, "get cc1 = %s, cc2 = %s\n", typec_cc_status_name[*cc1], -+ typec_cc_status_name[*cc2]); -+ -+ return 0; -+} -+ -+static int fusb302_set_vconn(struct udevice *dev, bool on) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ int ret; -+ u8 switches0_data = 0x00; -+ u8 switches0_mask = FUSB_REG_SWITCHES0_VCONN_CC1 | -+ FUSB_REG_SWITCHES0_VCONN_CC2; -+ -+ if (chip->vconn_on == on) { -+ ret = 0; -+ dev_dbg(dev, "vconn is already %s\n", on ? "on" : "off"); -+ goto done; -+ } -+ if (on) { -+ switches0_data = (chip->cc_polarity == TYPEC_POLARITY_CC1) ? -+ FUSB_REG_SWITCHES0_VCONN_CC2 : -+ FUSB_REG_SWITCHES0_VCONN_CC1; -+ } -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_SWITCHES0, -+ switches0_mask, switches0_data); -+ if (ret) -+ goto done; -+ dev_dbg(dev, "set vconn = %s\n", on ? "on" : "off"); -+done: -+ return ret; -+} -+ -+static int fusb302_set_vbus(struct udevice *dev, bool on, bool charge) -+{ -+ return 0; -+} -+ -+static int fusb302_pd_tx_flush(struct udevice *dev) -+{ -+ return fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL0, -+ FUSB_REG_CONTROL0_TX_FLUSH); -+} -+ -+static int fusb302_pd_rx_flush(struct udevice *dev) -+{ -+ return fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL1, -+ FUSB_REG_CONTROL1_RX_FLUSH); -+} -+ -+static int fusb302_pd_set_auto_goodcrc(struct udevice *dev, bool on) -+{ -+ if (on) -+ return fusb302_i2c_set_bits(dev, FUSB_REG_SWITCHES1, -+ FUSB_REG_SWITCHES1_AUTO_GCRC); -+ return fusb302_i2c_clear_bits(dev, FUSB_REG_SWITCHES1, -+ FUSB_REG_SWITCHES1_AUTO_GCRC); -+} -+ -+static int fusb302_pd_set_interrupts(struct udevice *dev, bool on) -+{ -+ int ret; -+ u8 mask_interrupts = FUSB_REG_MASK_COLLISION; -+ u8 maska_interrupts = FUSB_REG_MASKA_RETRYFAIL | -+ FUSB_REG_MASKA_HARDSENT | -+ FUSB_REG_MASKA_TX_SUCCESS | -+ FUSB_REG_MASKA_HARDRESET; -+ u8 maskb_interrupts = FUSB_REG_MASKB_GCRCSENT; -+ -+ ret = on ? -+ fusb302_i2c_clear_bits(dev, FUSB_REG_MASK, mask_interrupts) : -+ fusb302_i2c_set_bits(dev, FUSB_REG_MASK, mask_interrupts); -+ if (ret) -+ return ret; -+ ret = on ? -+ fusb302_i2c_clear_bits(dev, FUSB_REG_MASKA, maska_interrupts) : -+ fusb302_i2c_set_bits(dev, FUSB_REG_MASKA, maska_interrupts); -+ if (ret) -+ return ret; -+ ret = on ? -+ fusb302_i2c_clear_bits(dev, FUSB_REG_MASKB, maskb_interrupts) : -+ fusb302_i2c_set_bits(dev, FUSB_REG_MASKB, maskb_interrupts); -+ return ret; -+} -+ -+static int fusb302_set_pd_rx(struct udevice *dev, bool on) -+{ -+ int ret; -+ -+ ret = fusb302_pd_rx_flush(dev); -+ if (ret) { -+ dev_err(dev, "cannot flush pd rx buffer: %d\n", ret); -+ goto done; -+ } -+ ret = fusb302_pd_tx_flush(dev); -+ if (ret) { -+ dev_err(dev, "cannot flush pd tx buffer: %d\n", ret); -+ goto done; -+ } -+ ret = fusb302_pd_set_auto_goodcrc(dev, on); -+ if (ret) { -+ dev_err(dev, "cannot turn %s auto GoodCRC: %d\n", -+ on ? "on" : "off", ret); -+ goto done; -+ } -+ ret = fusb302_pd_set_interrupts(dev, on); -+ if (ret) { -+ dev_err(dev, "cannot turn %s pd interrupts: %d\n", -+ on ? "on" : "off", ret); -+ goto done; -+ } -+ dev_dbg(dev, "set pd RX %s\n", on ? "on" : "off"); -+done: -+ return ret; -+} -+ -+static int fusb302_set_roles(struct udevice *dev, bool attached, -+ enum typec_role pwr, enum typec_data_role data) -+{ -+ int ret; -+ u8 switches1_mask = FUSB_REG_SWITCHES1_POWERROLE | -+ FUSB_REG_SWITCHES1_DATAROLE; -+ u8 switches1_data = 0x00; -+ -+ if (pwr == TYPEC_SOURCE) -+ switches1_data |= FUSB_REG_SWITCHES1_POWERROLE; -+ if (data == TYPEC_HOST) -+ switches1_data |= FUSB_REG_SWITCHES1_DATAROLE; -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_SWITCHES1, -+ switches1_mask, switches1_data); -+ if (ret) { -+ dev_err(dev, "unable to set pd header %s, %s, ret=%d\n", -+ typec_role_name[pwr], typec_data_role_name[data], ret); -+ goto done; -+ } -+ dev_dbg(dev, "pd header : %s, %s\n", typec_role_name[pwr], -+ typec_data_role_name[data]); -+done: -+ -+ return ret; -+} -+ -+static int fusb302_start_toggling(struct udevice *dev, -+ enum typec_port_type port_type, -+ enum typec_cc_status cc) -+{ -+ enum toggling_mode mode = TOGGLING_MODE_OFF; -+ int ret; -+ -+ switch (port_type) { -+ case TYPEC_PORT_SRC: -+ mode = TOGGLING_MODE_SRC; -+ break; -+ case TYPEC_PORT_SNK: -+ mode = TOGGLING_MODE_SNK; -+ break; -+ case TYPEC_PORT_DRP: -+ mode = TOGGLING_MODE_DRP; -+ break; -+ } -+ -+ ret = fusb302_set_src_current(dev, cc_src_current[cc]); -+ if (ret) { -+ dev_err(dev, "unable to set src current %s, ret=%d", -+ typec_cc_status_name[cc], ret); -+ goto done; -+ } -+ ret = fusb302_set_toggling(dev, mode); -+ if (ret) { -+ dev_err(dev, "unable to start drp toggling: %d\n", ret); -+ goto done; -+ } -+ dev_info(dev, "fusb302 start drp toggling\n"); -+done: -+ -+ return ret; -+} -+ -+static int fusb302_pd_send_message(struct udevice *dev, -+ const struct pd_message *msg) -+{ -+ int ret; -+ /* SOP tokens */ -+ u8 buf[40] = {FUSB302_TKN_SYNC1, FUSB302_TKN_SYNC1, FUSB302_TKN_SYNC1, -+ FUSB302_TKN_SYNC2}; -+ u8 pos = 4; -+ int len; -+ -+ len = pd_header_cnt_le(msg->header) * 4; -+ /* plug 2 for header */ -+ len += 2; -+ if (len > FUSB302_MAX_MSG_LEN) { -+ dev_err(dev, "PD message too long %d (incl. header)", len); -+ return -EINVAL; -+ } -+ /* packsym tells the FUSB302 chip that the next X bytes are payload */ -+ buf[pos++] = FUSB302_TKN_PACKSYM | (len & FUSB302_MAX_MSG_LEN); -+ memcpy(&buf[pos], &msg->header, sizeof(msg->header)); -+ pos += sizeof(msg->header); -+ -+ len -= 2; -+ memcpy(&buf[pos], msg->payload, len); -+ pos += len; -+ -+ /* CRC */ -+ buf[pos++] = FUSB302_TKN_JAMCRC; -+ /* EOP */ -+ buf[pos++] = FUSB302_TKN_EOP; -+ /* turn tx off after sending message */ -+ buf[pos++] = FUSB302_TKN_TXOFF; -+ /* start transmission */ -+ buf[pos++] = FUSB302_TKN_TXON; -+ -+ ret = fusb302_i2c_block_write(dev, FUSB_REG_FIFOS, pos, buf); -+ if (ret) -+ return ret; -+ dev_dbg(dev, "Send PD message (header=0x%x len=%d)\n", msg->header, len); -+ -+ return ret; -+} -+ -+static int fusb302_pd_send_hardreset(struct udevice *dev) -+{ -+ return fusb302_i2c_set_bits(dev, FUSB_REG_CONTROL3, -+ FUSB_REG_CONTROL3_SEND_HARDRESET); -+} -+ -+static const char * const transmit_type_name[] = { -+ [TCPC_TX_SOP] = "SOP", -+ [TCPC_TX_SOP_PRIME] = "SOP'", -+ [TCPC_TX_SOP_PRIME_PRIME] = "SOP''", -+ [TCPC_TX_SOP_DEBUG_PRIME] = "DEBUG'", -+ [TCPC_TX_SOP_DEBUG_PRIME_PRIME] = "DEBUG''", -+ [TCPC_TX_HARD_RESET] = "HARD_RESET", -+ [TCPC_TX_CABLE_RESET] = "CABLE_RESET", -+ [TCPC_TX_BIST_MODE_2] = "BIST_MODE_2", -+}; -+ -+static int fusb302_pd_transmit(struct udevice *dev, enum tcpm_transmit_type type, -+ const struct pd_message *msg, unsigned int negotiated_rev) -+{ -+ int ret; -+ -+ switch (type) { -+ case TCPC_TX_SOP: -+ /* nRetryCount 3 in P2.0 spec, whereas 2 in PD3.0 spec */ -+ ret = fusb302_enable_tx_auto_retries(dev, negotiated_rev > PD_REV20 ? -+ FUSB_REG_CONTROL3_N_RETRIES_2 : -+ FUSB_REG_CONTROL3_N_RETRIES_3); -+ if (ret) -+ dev_err(dev, "cannot update retry count: %d\n", ret); -+ -+ ret = fusb302_pd_send_message(dev, msg); -+ if (ret) -+ dev_err(dev, "cannot send PD message: %d\n", ret); -+ break; -+ case TCPC_TX_HARD_RESET: -+ ret = fusb302_pd_send_hardreset(dev); -+ if (ret) -+ dev_err(dev, "cannot send hardreset: %d\n", ret); -+ break; -+ default: -+ dev_err(dev, "type %s not supported", transmit_type_name[type]); -+ ret = -EINVAL; -+ } -+ -+ return ret; -+} -+ -+static enum typec_cc_status fusb302_bc_lvl_to_cc(u8 bc_lvl) -+{ -+ if (bc_lvl == FUSB_REG_STATUS0_BC_LVL_1230_MAX) -+ return TYPEC_CC_RP_3_0; -+ if (bc_lvl == FUSB_REG_STATUS0_BC_LVL_600_1230) -+ return TYPEC_CC_RP_1_5; -+ if (bc_lvl == FUSB_REG_STATUS0_BC_LVL_200_600) -+ return TYPEC_CC_RP_DEF; -+ return TYPEC_CC_OPEN; -+} -+ -+static void fusb302_bc_lvl_handler(struct udevice *dev) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ enum typec_cc_status cc_status; -+ u8 status0, bc_lvl; -+ int ret; -+ -+ if (!chip->intr_bc_lvl) { -+ dev_err(dev, "BC_LVL interrupt is turned off, abort\n"); -+ goto done; -+ } -+ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); -+ if (ret) -+ goto done; -+ -+ dev_dbg(dev, "BC_LVL handler, status0 = 0x%02x\n", status0); -+ if (status0 & FUSB_REG_STATUS0_ACTIVITY) -+ dev_info(dev, "CC activities detected, delay handling\n"); -+ bc_lvl = status0 & FUSB_REG_STATUS0_BC_LVL_MASK; -+ cc_status = fusb302_bc_lvl_to_cc(bc_lvl); -+ if (chip->cc_polarity == TYPEC_POLARITY_CC1) { -+ if (chip->cc1 != cc_status) { -+ dev_dbg(dev, "cc1: %s -> %s\n", -+ typec_cc_status_name[chip->cc1], -+ typec_cc_status_name[cc_status]); -+ chip->cc1 = cc_status; -+ tcpm_cc_change(dev); -+ } -+ } else { -+ if (chip->cc2 != cc_status) { -+ dev_dbg(dev, "cc2: %s -> %s\n", -+ typec_cc_status_name[chip->cc2], -+ typec_cc_status_name[cc_status]); -+ chip->cc2 = cc_status; -+ tcpm_cc_change(dev); -+ } -+ } -+ -+done: -+ return; -+} -+ -+static int fusb302_enter_low_power_mode(struct udevice *dev, -+ bool attached, bool pd_capable) -+{ -+ unsigned int reg; -+ int ret; -+ -+ ret = fusb302_mask_interrupt(dev); -+ if (ret) -+ return ret; -+ if (attached && pd_capable) -+ reg = FUSB_REG_POWER_PWR_MEDIUM; -+ else if (attached) -+ reg = FUSB_REG_POWER_PWR_LOW; -+ else -+ reg = 0; -+ -+ return fusb302_set_power_mode(dev, reg); -+} -+ -+static const char * const cc_polarity_name[] = { -+ [TYPEC_POLARITY_CC1] = "Polarity_CC1", -+ [TYPEC_POLARITY_CC2] = "Polarity_CC2", -+}; -+ -+static int fusb302_set_cc_polarity_and_pull(struct udevice *dev, -+ enum typec_cc_polarity cc_polarity, -+ bool pull_up, bool pull_down) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ int ret; -+ u8 switches0_data = 0x00; -+ u8 switches1_mask = FUSB_REG_SWITCHES1_TXCC1_EN | -+ FUSB_REG_SWITCHES1_TXCC2_EN; -+ u8 switches1_data = 0x00; -+ -+ if (pull_down) -+ switches0_data |= FUSB_REG_SWITCHES0_CC1_PD_EN | -+ FUSB_REG_SWITCHES0_CC2_PD_EN; -+ -+ if (cc_polarity == TYPEC_POLARITY_CC1) { -+ switches0_data |= FUSB_REG_SWITCHES0_MEAS_CC1; -+ if (chip->vconn_on) -+ switches0_data |= FUSB_REG_SWITCHES0_VCONN_CC2; -+ if (pull_up) -+ switches0_data |= FUSB_REG_SWITCHES0_CC1_PU_EN; -+ switches1_data = FUSB_REG_SWITCHES1_TXCC1_EN; -+ } else { -+ switches0_data |= FUSB_REG_SWITCHES0_MEAS_CC2; -+ if (chip->vconn_on) -+ switches0_data |= FUSB_REG_SWITCHES0_VCONN_CC1; -+ if (pull_up) -+ switches0_data |= FUSB_REG_SWITCHES0_CC2_PU_EN; -+ switches1_data = FUSB_REG_SWITCHES1_TXCC2_EN; -+ } -+ ret = fusb302_i2c_write(dev, FUSB_REG_SWITCHES0, switches0_data); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_mask_write(dev, FUSB_REG_SWITCHES1, -+ switches1_mask, switches1_data); -+ if (ret) -+ return ret; -+ chip->cc_polarity = cc_polarity; -+ -+ return ret; -+} -+ -+static int fusb302_handle_togdone_snk(struct udevice *dev, -+ u8 togdone_result) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ int ret; -+ u8 status0; -+ u8 bc_lvl; -+ enum typec_cc_polarity cc_polarity; -+ enum typec_cc_status cc_status_active, cc1, cc2; -+ -+ /* set polarity and pull_up, pull_down */ -+ cc_polarity = (togdone_result == FUSB_REG_STATUS1A_TOGSS_SNK1) ? -+ TYPEC_POLARITY_CC1 : TYPEC_POLARITY_CC2; -+ ret = fusb302_set_cc_polarity_and_pull(dev, cc_polarity, false, true); -+ if (ret) { -+ dev_err(dev, "cannot set cc polarity %s, ret = %d\n", -+ cc_polarity_name[cc_polarity], ret); -+ return ret; -+ } -+ /* fusb302_set_cc_polarity() has set the correct measure block */ -+ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); -+ if (ret < 0) -+ return ret; -+ bc_lvl = status0 & FUSB_REG_STATUS0_BC_LVL_MASK; -+ cc_status_active = fusb302_bc_lvl_to_cc(bc_lvl); -+ /* restart toggling if the cc status on the active line is OPEN */ -+ if (cc_status_active == TYPEC_CC_OPEN) { -+ dev_info(dev, "restart toggling as CC_OPEN detected\n"); -+ ret = fusb302_set_toggling(dev, chip->toggling_mode); -+ return ret; -+ } -+ /* update tcpm with the new cc value */ -+ cc1 = (cc_polarity == TYPEC_POLARITY_CC1) ? -+ cc_status_active : TYPEC_CC_OPEN; -+ cc2 = (cc_polarity == TYPEC_POLARITY_CC2) ? -+ cc_status_active : TYPEC_CC_OPEN; -+ if (chip->cc1 != cc1 || chip->cc2 != cc2) { -+ chip->cc1 = cc1; -+ chip->cc2 = cc2; -+ tcpm_cc_change(dev); -+ } -+ /* turn off toggling */ -+ ret = fusb302_set_toggling(dev, TOGGLING_MODE_OFF); -+ if (ret) { -+ dev_err(dev, "cannot set toggling mode off, ret=%d\n", ret); -+ return ret; -+ } -+ /* unmask bc_lvl interrupt */ -+ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_MASK, FUSB_REG_MASK_BC_LVL); -+ if (ret) { -+ dev_err(dev, "cannot unmask bc_lcl irq, ret=%d\n", ret); -+ return ret; -+ } -+ chip->intr_bc_lvl = true; -+ dev_dbg(dev, "detected cc1=%s, cc2=%s\n", -+ typec_cc_status_name[cc1], -+ typec_cc_status_name[cc2]); -+ -+ return ret; -+} -+ -+/* On error returns < 0, otherwise a typec_cc_status value */ -+static int fusb302_get_src_cc_status(struct udevice *dev, -+ enum typec_cc_polarity cc_polarity, -+ enum typec_cc_status *cc) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ u8 ra_mda = ra_mda_value[chip->src_current_status]; -+ u8 rd_mda = rd_mda_value[chip->src_current_status]; -+ u8 switches0_data, status0; -+ int ret; -+ -+ /* Step 1: Set switches so that we measure the right CC pin */ -+ switches0_data = (cc_polarity == TYPEC_POLARITY_CC1) ? -+ FUSB_REG_SWITCHES0_CC1_PU_EN | FUSB_REG_SWITCHES0_MEAS_CC1 : -+ FUSB_REG_SWITCHES0_CC2_PU_EN | FUSB_REG_SWITCHES0_MEAS_CC2; -+ ret = fusb302_i2c_write(dev, FUSB_REG_SWITCHES0, switches0_data); -+ if (ret < 0) -+ return ret; -+ -+ fusb302_i2c_read(dev, FUSB_REG_SWITCHES0, &status0); -+ dev_dbg(dev, "get_src_cc_status switches: 0x%0x", status0); -+ -+ /* Step 2: Set compararator volt to differentiate between Open and Rd */ -+ ret = fusb302_i2c_write(dev, FUSB_REG_MEASURE, rd_mda); -+ if (ret) -+ return ret; -+ -+ udelay(100); -+ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); -+ if (ret) -+ return ret; -+ -+ dev_dbg(dev, "get_src_cc_status rd_mda status0: 0x%0x", status0); -+ if (status0 & FUSB_REG_STATUS0_COMP) { -+ *cc = TYPEC_CC_OPEN; -+ return 0; -+ } -+ -+ /* Step 3: Set compararator input to differentiate between Rd and Ra. */ -+ ret = fusb302_i2c_write(dev, FUSB_REG_MEASURE, ra_mda); -+ if (ret) -+ return ret; -+ -+ udelay(100); -+ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); -+ if (ret) -+ return ret; -+ -+ dev_dbg(dev, "get_src_cc_status ra_mda status0: 0x%0x", status0); -+ if (status0 & FUSB_REG_STATUS0_COMP) -+ *cc = TYPEC_CC_RD; -+ else -+ *cc = TYPEC_CC_RA; -+ -+ return 0; -+} -+ -+static int fusb302_handle_togdone_src(struct udevice *dev, -+ u8 togdone_result) -+{ -+ /* -+ * - set polarity (measure cc, vconn, tx) -+ * - set pull_up, pull_down -+ * - set cc1, cc2, and update to tcpm state machine -+ * - set I_COMP interrupt on -+ */ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ u8 rd_mda = rd_mda_value[chip->src_current_status]; -+ enum toggling_mode toggling_mode = chip->toggling_mode; -+ enum typec_cc_polarity cc_polarity; -+ enum typec_cc_status cc1, cc2; -+ int ret; -+ -+ /* -+ * The toggle-engine will stop in a src state if it sees either Ra or -+ * Rd. Determine the status for both CC pins, starting with the one -+ * where toggling stopped, as that is where the switches point now. -+ */ -+ if (togdone_result == FUSB_REG_STATUS1A_TOGSS_SRC1) -+ ret = fusb302_get_src_cc_status(dev, TYPEC_POLARITY_CC1, &cc1); -+ else -+ ret = fusb302_get_src_cc_status(dev, TYPEC_POLARITY_CC2, &cc2); -+ if (ret) -+ return ret; -+ /* we must turn off toggling before we can measure the other pin */ -+ ret = fusb302_set_toggling(dev, TOGGLING_MODE_OFF); -+ if (ret) { -+ dev_err(dev, "cannot set toggling mode off, ret=%d\n", ret); -+ return ret; -+ } -+ /* get the status of the other pin */ -+ if (togdone_result == FUSB_REG_STATUS1A_TOGSS_SRC1) -+ ret = fusb302_get_src_cc_status(dev, TYPEC_POLARITY_CC2, &cc2); -+ else -+ ret = fusb302_get_src_cc_status(dev, TYPEC_POLARITY_CC1, &cc1); -+ if (ret) -+ return ret; -+ -+ /* determine polarity based on the status of both pins */ -+ if (cc1 == TYPEC_CC_RD && (cc2 == TYPEC_CC_OPEN || cc2 == TYPEC_CC_RA)) { -+ cc_polarity = TYPEC_POLARITY_CC1; -+ } else if (cc2 == TYPEC_CC_RD && -+ (cc1 == TYPEC_CC_OPEN || cc1 == TYPEC_CC_RA)) { -+ cc_polarity = TYPEC_POLARITY_CC2; -+ } else { -+ dev_err(dev, "unexpected CC status cc1=%s, cc2=%s, restarting toggling\n", -+ typec_cc_status_name[cc1], -+ typec_cc_status_name[cc2]); -+ return fusb302_set_toggling(dev, toggling_mode); -+ } -+ /* set polarity and pull_up, pull_down */ -+ ret = fusb302_set_cc_polarity_and_pull(dev, cc_polarity, true, false); -+ if (ret < 0) { -+ dev_err(dev, "cannot set cc polarity %s, ret=%d\n", -+ cc_polarity_name[cc_polarity], ret); -+ return ret; -+ } -+ /* update tcpm with the new cc value */ -+ if (chip->cc1 != cc1 || chip->cc2 != cc2) { -+ chip->cc1 = cc1; -+ chip->cc2 = cc2; -+ tcpm_cc_change(dev); -+ } -+ /* set MDAC to Rd threshold, and unmask I_COMP for unplug detection */ -+ ret = fusb302_i2c_write(dev, FUSB_REG_MEASURE, rd_mda); -+ if (ret) -+ return ret; -+ /* unmask comp_chng interrupt */ -+ ret = fusb302_i2c_clear_bits(dev, FUSB_REG_MASK, -+ FUSB_REG_MASK_COMP_CHNG); -+ if (ret) { -+ dev_err(dev, "cannot unmask comp_chng irq, ret=%d\n", ret); -+ return ret; -+ } -+ chip->intr_comp_chng = true; -+ dev_dbg(dev, "detected cc1=%s, cc2=%s\n", -+ typec_cc_status_name[cc1], -+ typec_cc_status_name[cc2]); -+ -+ return ret; -+} -+ -+static int fusb302_handle_togdone(struct udevice *dev) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ u8 togdone_result, status1a; -+ int ret; -+ -+ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS1A, &status1a); -+ if (ret < 0) -+ return ret; -+ togdone_result = (status1a >> FUSB_REG_STATUS1A_TOGSS_POS) & -+ FUSB_REG_STATUS1A_TOGSS_MASK; -+ switch (togdone_result) { -+ case FUSB_REG_STATUS1A_TOGSS_SNK1: -+ case FUSB_REG_STATUS1A_TOGSS_SNK2: -+ return fusb302_handle_togdone_snk(dev, togdone_result); -+ case FUSB_REG_STATUS1A_TOGSS_SRC1: -+ case FUSB_REG_STATUS1A_TOGSS_SRC2: -+ return fusb302_handle_togdone_src(dev, togdone_result); -+ case FUSB_REG_STATUS1A_TOGSS_AA: -+ /* doesn't support */ -+ dev_err(dev, "AudioAccessory not supported\n"); -+ fusb302_set_toggling(dev, chip->toggling_mode); -+ break; -+ default: -+ dev_err(dev, "TOGDONE with an invalid state: %d\n", -+ togdone_result); -+ fusb302_set_toggling(dev, chip->toggling_mode); -+ break; -+ } -+ return ret; -+} -+ -+static int fusb302_pd_reset(struct udevice *dev) -+{ -+ return fusb302_i2c_set_bits(dev, FUSB_REG_RESET, -+ FUSB_REG_RESET_PD_RESET); -+} -+ -+static int fusb302_pd_read_message(struct udevice *dev, -+ struct pd_message *msg) -+{ -+ int len, ret; -+ u8 crc[4]; -+ u8 token; -+ -+ /* first SOP token */ -+ ret = fusb302_i2c_read(dev, FUSB_REG_FIFOS, &token); -+ if (ret) -+ return ret; -+ ret = fusb302_i2c_block_read(dev, FUSB_REG_FIFOS, 2, -+ (u8 *)&msg->header); -+ if (ret) -+ return ret; -+ len = pd_header_cnt_le(msg->header) * 4; -+ /* add 4 to length to include the CRC */ -+ if (len > PD_MAX_PAYLOAD * 4) { -+ dev_err(dev, "PD message too long %d\n", len); -+ return -EINVAL; -+ } -+ if (len > 0) { -+ ret = fusb302_i2c_block_read(dev, FUSB_REG_FIFOS, len, -+ (u8 *)msg->payload); -+ if (ret) -+ return ret; -+ } -+ /* another 4 bytes to read CRC out */ -+ ret = fusb302_i2c_block_read(dev, FUSB_REG_FIFOS, 4, crc); -+ if (ret) -+ return ret; -+ dev_dbg(dev, "Received PD message (header=0x%x len=%d)\n", msg->header, len); -+ -+ /* -+ * Check if we've read off a GoodCRC message. If so then indicate to -+ * TCPM that the previous transmission has completed. Otherwise we pass -+ * the received message over to TCPM for processing. -+ * -+ * We make this check here instead of basing the reporting decision on -+ * the IRQ event type, as it's possible for the chip to report the -+ * TX_SUCCESS and GCRCSENT events out of order on occasion, so we need -+ * to check the message type to ensure correct reporting to TCPM. -+ */ -+ if (!len && (pd_header_type_le(msg->header) == PD_CTRL_GOOD_CRC)) -+ tcpm_pd_transmit_complete(dev, TCPC_TX_SUCCESS); -+ else -+ tcpm_pd_receive(dev, msg); -+ -+ return ret; -+} -+ -+static void fusb302_interrupt_handle(struct udevice *dev) -+{ -+ struct fusb302_chip *chip = dev_get_priv(dev); -+ u8 interrupt; -+ u8 interrupta; -+ u8 interruptb; -+ u8 status0; -+ bool vbus_present; -+ bool comp_result; -+ bool intr_togdone; -+ bool intr_bc_lvl; -+ bool intr_comp_chng; -+ struct pd_message pd_msg; -+ int ret; -+ -+ /* grab a snapshot of intr flags */ -+ intr_togdone = chip->intr_togdone; -+ intr_bc_lvl = chip->intr_bc_lvl; -+ intr_comp_chng = chip->intr_comp_chng; -+ -+ ret = fusb302_i2c_read(dev, FUSB_REG_INTERRUPT, &interrupt); -+ if (ret) -+ return; -+ ret = fusb302_i2c_read(dev, FUSB_REG_INTERRUPTA, &interrupta); -+ if (ret) -+ return; -+ ret = fusb302_i2c_read(dev, FUSB_REG_INTERRUPTB, &interruptb); -+ if (ret) -+ return; -+ ret = fusb302_i2c_read(dev, FUSB_REG_STATUS0, &status0); -+ if (ret) -+ return; -+ -+ /* -+ * Since we are polling the IRQs, avoid printing messages when there -+ * no interrupts at all to avoid spamming the log. -+ */ -+ if (interrupt != 0 || interrupta != 0 || interruptb != 0) -+ dev_dbg(dev, "IRQ: 0x%02x, a: 0x%02x, b: 0x%02x, status0: 0x%02x\n", -+ interrupt, interrupta, interruptb, status0); -+ -+ if (interrupt & FUSB_REG_INTERRUPT_VBUSOK) { -+ vbus_present = !!(status0 & FUSB_REG_STATUS0_VBUSOK); -+ dev_dbg(dev, "IRQ: VBUS_OK, vbus=%s\n", -+ vbus_present ? "On" : "Off"); -+ if (vbus_present != chip->vbus_present) { -+ chip->vbus_present = vbus_present; -+ tcpm_vbus_change(dev); -+ } -+ } -+ -+ if ((interrupta & FUSB_REG_INTERRUPTA_TOGDONE) && intr_togdone) { -+ dev_dbg(dev, "IRQ: TOGDONE\n"); -+ ret = fusb302_handle_togdone(dev); -+ if (ret) { -+ dev_err(dev, "handle togdone error: %d\n", ret); -+ return; -+ } -+ } -+ -+ if ((interrupt & FUSB_REG_INTERRUPT_BC_LVL) && intr_bc_lvl) { -+ dev_dbg(dev, "IRQ: BC_LVL, handler pending\n"); -+ fusb302_bc_lvl_handler(dev); -+ } -+ -+ if ((interrupt & FUSB_REG_INTERRUPT_COMP_CHNG) && intr_comp_chng) { -+ comp_result = !!(status0 & FUSB_REG_STATUS0_COMP); -+ dev_dbg(dev, "IRQ: COMP_CHNG, comp=%s\n", -+ comp_result ? "true" : "false"); -+ if (comp_result) { -+ /* cc level > Rd_threshold, detach */ -+ chip->cc1 = TYPEC_CC_OPEN; -+ chip->cc2 = TYPEC_CC_OPEN; -+ tcpm_cc_change(dev); -+ } -+ } -+ -+ if (interrupt & FUSB_REG_INTERRUPT_COLLISION) { -+ dev_dbg(dev, "IRQ: PD collision\n"); -+ tcpm_pd_transmit_complete(dev, TCPC_TX_FAILED); -+ } -+ -+ if (interrupta & FUSB_REG_INTERRUPTA_RETRYFAIL) { -+ dev_dbg(dev, "IRQ: PD retry failed\n"); -+ tcpm_pd_transmit_complete(dev, TCPC_TX_FAILED); -+ } -+ -+ if (interrupta & FUSB_REG_INTERRUPTA_HARDSENT) { -+ dev_dbg(dev, "IRQ: PD hardreset sent\n"); -+ ret = fusb302_pd_reset(dev); -+ if (ret) { -+ dev_err(dev, "cannot PD reset, ret=%d\n", ret); -+ return; -+ } -+ tcpm_pd_transmit_complete(dev, TCPC_TX_SUCCESS); -+ } -+ -+ if (interrupta & FUSB_REG_INTERRUPTA_TX_SUCCESS) { -+ dev_dbg(dev, "IRQ: PD tx success\n"); -+ ret = fusb302_pd_read_message(dev, &pd_msg); -+ if (ret) { -+ dev_err(dev, "cannot read in PD message, ret=%d\n", ret); -+ return; -+ } -+ } -+ -+ if (interrupta & FUSB_REG_INTERRUPTA_HARDRESET) { -+ dev_dbg(dev, "IRQ: PD received hardreset\n"); -+ ret = fusb302_pd_reset(dev); -+ if (ret) { -+ dev_err(dev, "cannot PD reset, ret=%d\n", ret); -+ return; -+ } -+ tcpm_pd_hard_reset(dev); -+ } -+ -+ if (interruptb & FUSB_REG_INTERRUPTB_GCRCSENT) { -+ dev_dbg(dev, "IRQ: PD sent good CRC\n"); -+ ret = fusb302_pd_read_message(dev, &pd_msg); -+ if (ret) { -+ dev_err(dev, "cannot read in PD message, ret=%d\n", ret); -+ return; -+ } -+ } -+} -+ -+static void fusb302_poll_event(struct udevice *dev) -+{ -+ fusb302_interrupt_handle(dev); -+} -+ -+static int fusb302_get_connector_node(struct udevice *dev, ofnode *connector_node) -+{ -+ *connector_node = dev_read_subnode(dev, "connector"); -+ if (!ofnode_valid(*connector_node)) { -+ dev_err(dev, "'connector' node is not found\n"); -+ return -ENODEV; -+ } -+ -+ return 0; -+} -+ -+static struct dm_tcpm_ops fusb302_ops = { -+ .get_connector_node = fusb302_get_connector_node, -+ .init = fusb302_init, -+ .get_vbus = fusb302_get_vbus, -+ .set_cc = fusb302_set_cc, -+ .get_cc = fusb302_get_cc, -+ .set_vconn = fusb302_set_vconn, -+ .set_vbus = fusb302_set_vbus, -+ .set_pd_rx = fusb302_set_pd_rx, -+ .set_roles = fusb302_set_roles, -+ .start_toggling = fusb302_start_toggling, -+ .pd_transmit = fusb302_pd_transmit, -+ .poll_event = fusb302_poll_event, -+ .enter_low_power_mode = fusb302_enter_low_power_mode, -+}; -+ -+static const struct udevice_id fusb302_ids[] = { -+ { .compatible = "fcs,fusb302" }, -+ { } -+}; -+ -+U_BOOT_DRIVER(fusb302) = { -+ .name = "fusb302", -+ .id = UCLASS_TCPM, -+ .of_match = fusb302_ids, -+ .ops = &fusb302_ops, -+ .priv_auto = sizeof(struct fusb302_chip), -+}; -diff --git a/drivers/usb/tcpm/fusb302_reg.h b/drivers/usb/tcpm/fusb302_reg.h -new file mode 100644 -index 000000000000..edc0e4b0f1e6 ---- /dev/null -+++ b/drivers/usb/tcpm/fusb302_reg.h -@@ -0,0 +1,177 @@ -+/* SPDX-License-Identifier: GPL-2.0+ */ -+/* -+ * Copyright 2016-2017 Google, Inc -+ * -+ * Fairchild FUSB302 Type-C Chip Driver -+ */ -+ -+#ifndef FUSB302_REG_H -+#define FUSB302_REG_H -+ -+#define FUSB_REG_DEVICE_ID 0x01 -+#define FUSB_REG_SWITCHES0 0x02 -+#define FUSB_REG_SWITCHES0_CC2_PU_EN BIT(7) -+#define FUSB_REG_SWITCHES0_CC1_PU_EN BIT(6) -+#define FUSB_REG_SWITCHES0_VCONN_CC2 BIT(5) -+#define FUSB_REG_SWITCHES0_VCONN_CC1 BIT(4) -+#define FUSB_REG_SWITCHES0_MEAS_CC2 BIT(3) -+#define FUSB_REG_SWITCHES0_MEAS_CC1 BIT(2) -+#define FUSB_REG_SWITCHES0_CC2_PD_EN BIT(1) -+#define FUSB_REG_SWITCHES0_CC1_PD_EN BIT(0) -+#define FUSB_REG_SWITCHES1 0x03 -+#define FUSB_REG_SWITCHES1_POWERROLE BIT(7) -+#define FUSB_REG_SWITCHES1_SPECREV1 BIT(6) -+#define FUSB_REG_SWITCHES1_SPECREV0 BIT(5) -+#define FUSB_REG_SWITCHES1_DATAROLE BIT(4) -+#define FUSB_REG_SWITCHES1_AUTO_GCRC BIT(2) -+#define FUSB_REG_SWITCHES1_TXCC2_EN BIT(1) -+#define FUSB_REG_SWITCHES1_TXCC1_EN BIT(0) -+#define FUSB_REG_MEASURE 0x04 -+#define FUSB_REG_MEASURE_MDAC5 BIT(7) -+#define FUSB_REG_MEASURE_MDAC4 BIT(6) -+#define FUSB_REG_MEASURE_MDAC3 BIT(5) -+#define FUSB_REG_MEASURE_MDAC2 BIT(4) -+#define FUSB_REG_MEASURE_MDAC1 BIT(3) -+#define FUSB_REG_MEASURE_MDAC0 BIT(2) -+#define FUSB_REG_MEASURE_VBUS BIT(1) -+#define FUSB_REG_MEASURE_XXXX5 BIT(0) -+#define FUSB_REG_CONTROL0 0x06 -+#define FUSB_REG_CONTROL0_TX_FLUSH BIT(6) -+#define FUSB_REG_CONTROL0_INT_MASK BIT(5) -+#define FUSB_REG_CONTROL0_HOST_CUR_MASK (0xC) -+#define FUSB_REG_CONTROL0_HOST_CUR_HIGH (0xC) -+#define FUSB_REG_CONTROL0_HOST_CUR_MED (0x8) -+#define FUSB_REG_CONTROL0_HOST_CUR_DEF (0x4) -+#define FUSB_REG_CONTROL0_TX_START BIT(0) -+#define FUSB_REG_CONTROL1 0x07 -+#define FUSB_REG_CONTROL1_ENSOP2DB BIT(6) -+#define FUSB_REG_CONTROL1_ENSOP1DB BIT(5) -+#define FUSB_REG_CONTROL1_BIST_MODE2 BIT(4) -+#define FUSB_REG_CONTROL1_RX_FLUSH BIT(2) -+#define FUSB_REG_CONTROL1_ENSOP2 BIT(1) -+#define FUSB_REG_CONTROL1_ENSOP1 BIT(0) -+#define FUSB_REG_CONTROL2 0x08 -+#define FUSB_REG_CONTROL2_MODE BIT(1) -+#define FUSB_REG_CONTROL2_MODE_MASK (0x6) -+#define FUSB_REG_CONTROL2_MODE_DFP (0x6) -+#define FUSB_REG_CONTROL2_MODE_UFP (0x4) -+#define FUSB_REG_CONTROL2_MODE_DRP (0x2) -+#define FUSB_REG_CONTROL2_MODE_NONE (0x0) -+#define FUSB_REG_CONTROL2_TOGGLE BIT(0) -+#define FUSB_REG_CONTROL3 0x09 -+#define FUSB_REG_CONTROL3_SEND_HARDRESET BIT(6) -+#define FUSB_REG_CONTROL3_BIST_TMODE BIT(5) /* 302B Only */ -+#define FUSB_REG_CONTROL3_AUTO_HARDRESET BIT(4) -+#define FUSB_REG_CONTROL3_AUTO_SOFTRESET BIT(3) -+#define FUSB_REG_CONTROL3_N_RETRIES BIT(1) -+#define FUSB_REG_CONTROL3_N_RETRIES_MASK (0x6) -+#define FUSB_REG_CONTROL3_N_RETRIES_3 (0x6) -+#define FUSB_REG_CONTROL3_N_RETRIES_2 (0x4) -+#define FUSB_REG_CONTROL3_N_RETRIES_1 (0x2) -+#define FUSB_REG_CONTROL3_AUTO_RETRY BIT(0) -+#define FUSB_REG_MASK 0x0A -+#define FUSB_REG_MASK_VBUSOK BIT(7) -+#define FUSB_REG_MASK_ACTIVITY BIT(6) -+#define FUSB_REG_MASK_COMP_CHNG BIT(5) -+#define FUSB_REG_MASK_CRC_CHK BIT(4) -+#define FUSB_REG_MASK_ALERT BIT(3) -+#define FUSB_REG_MASK_WAKE BIT(2) -+#define FUSB_REG_MASK_COLLISION BIT(1) -+#define FUSB_REG_MASK_BC_LVL BIT(0) -+#define FUSB_REG_POWER 0x0B -+#define FUSB_REG_POWER_PWR BIT(0) -+#define FUSB_REG_POWER_PWR_LOW 0x1 -+#define FUSB_REG_POWER_PWR_MEDIUM 0x3 -+#define FUSB_REG_POWER_PWR_HIGH 0x7 -+#define FUSB_REG_POWER_PWR_ALL 0xF -+#define FUSB_REG_RESET 0x0C -+#define FUSB_REG_RESET_PD_RESET BIT(1) -+#define FUSB_REG_RESET_SW_RESET BIT(0) -+#define FUSB_REG_MASKA 0x0E -+#define FUSB_REG_MASKA_OCP_TEMP BIT(7) -+#define FUSB_REG_MASKA_TOGDONE BIT(6) -+#define FUSB_REG_MASKA_SOFTFAIL BIT(5) -+#define FUSB_REG_MASKA_RETRYFAIL BIT(4) -+#define FUSB_REG_MASKA_HARDSENT BIT(3) -+#define FUSB_REG_MASKA_TX_SUCCESS BIT(2) -+#define FUSB_REG_MASKA_SOFTRESET BIT(1) -+#define FUSB_REG_MASKA_HARDRESET BIT(0) -+#define FUSB_REG_MASKB 0x0F -+#define FUSB_REG_MASKB_GCRCSENT BIT(0) -+#define FUSB_REG_STATUS0A 0x3C -+#define FUSB_REG_STATUS0A_SOFTFAIL BIT(5) -+#define FUSB_REG_STATUS0A_RETRYFAIL BIT(4) -+#define FUSB_REG_STATUS0A_POWER BIT(2) -+#define FUSB_REG_STATUS0A_RX_SOFT_RESET BIT(1) -+#define FUSB_REG_STATUS0A_RX_HARD_RESET BIT(0) -+#define FUSB_REG_STATUS1A 0x3D -+#define FUSB_REG_STATUS1A_TOGSS BIT(3) -+#define FUSB_REG_STATUS1A_TOGSS_RUNNING 0x0 -+#define FUSB_REG_STATUS1A_TOGSS_SRC1 0x1 -+#define FUSB_REG_STATUS1A_TOGSS_SRC2 0x2 -+#define FUSB_REG_STATUS1A_TOGSS_SNK1 0x5 -+#define FUSB_REG_STATUS1A_TOGSS_SNK2 0x6 -+#define FUSB_REG_STATUS1A_TOGSS_AA 0x7 -+#define FUSB_REG_STATUS1A_TOGSS_POS (3) -+#define FUSB_REG_STATUS1A_TOGSS_MASK (0x7) -+#define FUSB_REG_STATUS1A_RXSOP2DB BIT(2) -+#define FUSB_REG_STATUS1A_RXSOP1DB BIT(1) -+#define FUSB_REG_STATUS1A_RXSOP BIT(0) -+#define FUSB_REG_INTERRUPTA 0x3E -+#define FUSB_REG_INTERRUPTA_OCP_TEMP BIT(7) -+#define FUSB_REG_INTERRUPTA_TOGDONE BIT(6) -+#define FUSB_REG_INTERRUPTA_SOFTFAIL BIT(5) -+#define FUSB_REG_INTERRUPTA_RETRYFAIL BIT(4) -+#define FUSB_REG_INTERRUPTA_HARDSENT BIT(3) -+#define FUSB_REG_INTERRUPTA_TX_SUCCESS BIT(2) -+#define FUSB_REG_INTERRUPTA_SOFTRESET BIT(1) -+#define FUSB_REG_INTERRUPTA_HARDRESET BIT(0) -+#define FUSB_REG_INTERRUPTB 0x3F -+#define FUSB_REG_INTERRUPTB_GCRCSENT BIT(0) -+#define FUSB_REG_STATUS0 0x40 -+#define FUSB_REG_STATUS0_VBUSOK BIT(7) -+#define FUSB_REG_STATUS0_ACTIVITY BIT(6) -+#define FUSB_REG_STATUS0_COMP BIT(5) -+#define FUSB_REG_STATUS0_CRC_CHK BIT(4) -+#define FUSB_REG_STATUS0_ALERT BIT(3) -+#define FUSB_REG_STATUS0_WAKE BIT(2) -+#define FUSB_REG_STATUS0_BC_LVL_MASK 0x03 -+#define FUSB_REG_STATUS0_BC_LVL_0_200 0x0 -+#define FUSB_REG_STATUS0_BC_LVL_200_600 0x1 -+#define FUSB_REG_STATUS0_BC_LVL_600_1230 0x2 -+#define FUSB_REG_STATUS0_BC_LVL_1230_MAX 0x3 -+#define FUSB_REG_STATUS0_BC_LVL1 BIT(1) -+#define FUSB_REG_STATUS0_BC_LVL0 BIT(0) -+#define FUSB_REG_STATUS1 0x41 -+#define FUSB_REG_STATUS1_RXSOP2 BIT(7) -+#define FUSB_REG_STATUS1_RXSOP1 BIT(6) -+#define FUSB_REG_STATUS1_RX_EMPTY BIT(5) -+#define FUSB_REG_STATUS1_RX_FULL BIT(4) -+#define FUSB_REG_STATUS1_TX_EMPTY BIT(3) -+#define FUSB_REG_STATUS1_TX_FULL BIT(2) -+#define FUSB_REG_INTERRUPT 0x42 -+#define FUSB_REG_INTERRUPT_VBUSOK BIT(7) -+#define FUSB_REG_INTERRUPT_ACTIVITY BIT(6) -+#define FUSB_REG_INTERRUPT_COMP_CHNG BIT(5) -+#define FUSB_REG_INTERRUPT_CRC_CHK BIT(4) -+#define FUSB_REG_INTERRUPT_ALERT BIT(3) -+#define FUSB_REG_INTERRUPT_WAKE BIT(2) -+#define FUSB_REG_INTERRUPT_COLLISION BIT(1) -+#define FUSB_REG_INTERRUPT_BC_LVL BIT(0) -+#define FUSB_REG_FIFOS 0x43 -+ -+/* Tokens defined for the FUSB302 TX FIFO */ -+enum fusb302_txfifo_tokens { -+ FUSB302_TKN_TXON = 0xA1, -+ FUSB302_TKN_SYNC1 = 0x12, -+ FUSB302_TKN_SYNC2 = 0x13, -+ FUSB302_TKN_SYNC3 = 0x1B, -+ FUSB302_TKN_RST1 = 0x15, -+ FUSB302_TKN_RST2 = 0x16, -+ FUSB302_TKN_PACKSYM = 0x80, -+ FUSB302_TKN_JAMCRC = 0xFF, -+ FUSB302_TKN_EOP = 0x14, -+ FUSB302_TKN_TXOFF = 0xFE, -+}; -+ -+#endif - -From patchwork Thu Sep 5 15:08:39 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Sebastian Reichel -X-Patchwork-Id: 1981310 -X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com - header.a=rsa-sha256 header.s=mail header.b=OlVGM1CY; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4X02yx4Yhtz1yXY - for ; Fri, 6 Sep 2024 01:17:13 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id DA19F88CC4; - Thu, 5 Sep 2024 17:17:10 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com - header.b="OlVGM1CY"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 818FF88CD1; Thu, 5 Sep 2024 17:17:10 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_VALIDITY_RPBL_BLOCKED, - RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from bali.collaboradmins.com (bali.collaboradmins.com - [148.251.105.195]) - (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 6EA7A88C91 - for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sebastian.reichel@collabora.com -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; - s=mail; t=1725549428; - bh=MaX9knvNNlkcoU7y63UAKlXcI2FWJjBx6Z541dTO9i4=; - h=From:To:Cc:Subject:Date:In-Reply-To:References:From; - b=OlVGM1CYARH8jR7hX1JCyzjLoOvYonq4dVpddV7tqHKv1GFwV9kFs0BQ4idvjHy/T - 8dmf8Dp7LkEStFeQOeVF3FgD3kjcRIYq3a5QWQFKwba/sLcp1VQ7mycHrCP+uN1RoX - /uKEccUu41G7R4ERpXHJ6QrLVyWLcW1x86YZPE/mq17AETdmUfj2OUO/vCeoZ4lpvg - zTniAnbJTy/4BLPaDtK760efy5eYghMStjR8BfjQNKUWA1h2UAW5anloE/cgSsgWjT - m9wxvIxG3UqPf1YKEMUUgxOAyu/gjKrdK4rCKEY/ox+UAyg1Q2EQaHWm50UFUlNLjj - q0jLt7uyLlMvg== -Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de - [91.248.189.231]) - (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) (Authenticated sender: sre) - by bali.collaboradmins.com (Postfix) with ESMTPSA id EDB4F17E145D; - Thu, 5 Sep 2024 17:17:07 +0200 (CEST) -Received: by jupiter.universe (Postfix, from userid 1000) - id A34D14800F6; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) -From: Sebastian Reichel -To: Marek Vasut , u-boot@lists.denx.de, - Jonas Karlman , Soeren Moch -Cc: Eugen Hristev , - Tim Harvey , Kever Yang , - Philipp Tomsich , Simon Glass , - Sebastian Reichel -Subject: [PATCH v6 3/6] board: rock5b-rk3588: enable USB-C in operating system -Date: Thu, 5 Sep 2024 17:08:39 +0200 -Message-ID: <20240905151707.59101-4-sebastian.reichel@collabora.com> -X-Mailer: git-send-email 2.45.2 -In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> -References: <20240905151707.59101-1-sebastian.reichel@collabora.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 - -Since older U-Boot releases do not negotiate USB PD, the kernel -DT may not enable the USB-C controller by default to avoid a -regression. The plan is to upstream it with 'status = "fail";' -instead. U-Boot should then mark it as 'status = "okay";' if -it negotiated USB PD. Currently existing upstream kernel DTs do -not yet have the USB-C controller at all, so we ignore any -failures. - -Reviewed-by: Kever Yang -Tested-by: Soeren Moch -Signed-off-by: Sebastian Reichel ---- - board/radxa/rock5b-rk3588/Makefile | 6 ++++++ - board/radxa/rock5b-rk3588/rock5b-rk3588.c | 16 ++++++++++++++++ - 2 files changed, 22 insertions(+) - create mode 100644 board/radxa/rock5b-rk3588/Makefile - create mode 100644 board/radxa/rock5b-rk3588/rock5b-rk3588.c - -diff --git a/board/radxa/rock5b-rk3588/Makefile b/board/radxa/rock5b-rk3588/Makefile -new file mode 100644 -index 000000000000..95d813596da4 ---- /dev/null -+++ b/board/radxa/rock5b-rk3588/Makefile -@@ -0,0 +1,6 @@ -+# SPDX-License-Identifier: GPL-2.0+ -+# -+# Copyright (c) 2022 Collabora Ltd. -+# -+ -+obj-y += rock5b-rk3588.o -diff --git a/board/radxa/rock5b-rk3588/rock5b-rk3588.c b/board/radxa/rock5b-rk3588/rock5b-rk3588.c -new file mode 100644 -index 000000000000..fc2f69db2241 ---- /dev/null -+++ b/board/radxa/rock5b-rk3588/rock5b-rk3588.c -@@ -0,0 +1,16 @@ -+// SPDX-License-Identifier: GPL-2.0+ -+/* -+ * Copyright (c) 2023-2024 Collabora Ltd. -+ */ -+ -+#include -+#include -+ -+#ifdef CONFIG_OF_BOARD_SETUP -+int ft_board_setup(void *blob, struct bd_info *bd) -+{ -+ if (IS_ENABLED(CONFIG_TYPEC_FUSB302)) -+ fdt_status_okay_by_compatible(blob, "fcs,fusb302"); -+ return 0; -+} -+#endif - -From patchwork Thu Sep 5 15:08:40 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Sebastian Reichel -X-Patchwork-Id: 1981311 -X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com - header.a=rsa-sha256 header.s=mail header.b=Hn8Z4MVu; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4X02z82c6zz1yXY - for ; Fri, 6 Sep 2024 01:17:24 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 3EDBD88CA2; - Thu, 5 Sep 2024 17:17:13 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com - header.b="Hn8Z4MVu"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 710CF88CA2; Thu, 5 Sep 2024 17:17:12 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from bali.collaboradmins.com (bali.collaboradmins.com - [IPv6:2a01:4f8:201:9162::2]) - (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 7D4DC88CAC - for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sebastian.reichel@collabora.com -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; - s=mail; t=1725549428; - bh=kRtQV3aUzqRixo2bcjF9nXzgL+cYAS6B3o857NdybTM=; - h=From:To:Cc:Subject:Date:In-Reply-To:References:From; - b=Hn8Z4MVuPomOScWvWRuPJHT3m84jMoUdUdcI4V6fC8w0zfN0PSB22YMSaMxRDqiQR - D1gyzQpG0bCWuGp89DNtLngEOXCfXPqQh98ArUJFVvn5FVbYDlml9cXwVW02zXglIb - KP92KXxaQTgjWDb6QntmbJHNZVhAMNOCCqIknf4YFMc4/7yGTUsOxI5VD/oY5bbwVJ - aTVCT3SuwJvmXu7Dj150fFYeT0furN5MZT1P/MPFXd1/bnC9Dj+YTT6lm3kw6waCZN - OcRx6P7sRha82dm44zV4xjWnpHPDGGYqTyWNSD72Xj7/CASin5aosS6NbZFpndvcfx - 30yLrCrJPsm3g== -Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de - [91.248.189.231]) - (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) (Authenticated sender: sre) - by bali.collaboradmins.com (Postfix) with ESMTPSA id EF4D117E14D6; - Thu, 5 Sep 2024 17:17:07 +0200 (CEST) -Received: by jupiter.universe (Postfix, from userid 1000) - id A518D4800F8; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) -From: Sebastian Reichel -To: Marek Vasut , u-boot@lists.denx.de, - Jonas Karlman , Soeren Moch -Cc: Eugen Hristev , - Tim Harvey , Kever Yang , - Philipp Tomsich , Simon Glass , - Sebastian Reichel -Subject: [PATCH v6 4/6] rockchip: rk3588-rock-5b: Add USB-C controller to - u-boot.dtsi -Date: Thu, 5 Sep 2024 17:08:40 +0200 -Message-ID: <20240905151707.59101-5-sebastian.reichel@collabora.com> -X-Mailer: git-send-email 2.45.2 -In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> -References: <20240905151707.59101-1-sebastian.reichel@collabora.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 USB-C controller (fusb302), which will be used by U-Boot to -initialize USB-PD. This is needed, because USB-PD communication -must happen within 5 seconds after the USB-C connector got plugged. -On my Rock 5B it often takes 5 seconds to jump to the Linux binary, -so it must happen before Linux is initialized. - -This adds the DT node to the U-Boot specific file, since the Linux -kernel DT currently does not describe it to avoid a system reset. -The plan is to add it to the Linux DT with status = 'fail' and then -let U-Boot mark it as status = 'okay' if it properly dealt with -early USB-PD initialization. Until the Kernel DT has the node, let's -add it in U-Boot to get things going. - -Reviewed-by: Kever Yang -Tested-by: Soeren Moch -Signed-off-by: Sebastian Reichel ---- - arch/arm/dts/rk3588-rock-5b-u-boot.dtsi | 28 +++++++++++++++++++++++++ - 1 file changed, 28 insertions(+) - -diff --git a/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi b/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi -index 4dd17ff408cb..b0ad1158854c 100644 ---- a/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi -+++ b/arch/arm/dts/rk3588-rock-5b-u-boot.dtsi -@@ -3,6 +3,7 @@ - * Copyright (c) 2023 Collabora Ltd. - */ - -+#include - #include "rk3588-u-boot.dtsi" - - &fspim2_pins { -@@ -10,6 +11,33 @@ - bootph-some-ram; - }; - -+&i2c4 { -+ pinctrl-names = "default"; -+ pinctrl-0 = <&i2c4m1_xfer>; -+ status = "okay"; -+ -+ usbc0: usb-typec@22 { -+ compatible = "fcs,fusb302"; -+ reg = <0x22>; -+ interrupt-parent = <&gpio3>; -+ interrupts = ; -+ pinctrl-names = "default"; -+ status = "okay"; -+ -+ usb_con: connector { -+ compatible = "usb-c-connector"; -+ label = "USB-C"; -+ data-role = "dual"; -+ power-role = "sink"; -+ try-power-role = "sink"; -+ op-sink-microwatt = <1000000>; -+ sink-pdos = -+ , -+ ; -+ }; -+ }; -+}; -+ - &sdhci { - cap-mmc-highspeed; - mmc-hs200-1_8v; - -From patchwork Thu Sep 5 15:08:41 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Sebastian Reichel -X-Patchwork-Id: 1981313 -X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com - header.a=rsa-sha256 header.s=mail header.b=q3YksfJp; - 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 4X02zX1GHQz1yXY - for ; Fri, 6 Sep 2024 01:17:44 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 23B9E88C91; - Thu, 5 Sep 2024 17:17:15 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com - header.b="q3YksfJp"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 4A27388CC2; Thu, 5 Sep 2024 17:17:14 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no - version=3.4.2 -Received: from bali.collaboradmins.com (bali.collaboradmins.com - [IPv6:2a01:4f8:201:9162::2]) - (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 AA9CC88CCA - for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sebastian.reichel@collabora.com -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; - s=mail; t=1725549428; - bh=2Lc5Z/YfVP+p0ckRM3rvfdY5jCUdmYScP+mrStWhXgc=; - h=From:To:Cc:Subject:Date:In-Reply-To:References:From; - b=q3YksfJpB4KE3b6jOT8upI79aMX8TsaVAMMBCfHQfd81c94VAOjQE0sKeQG7MZhks - 8MtawvxDPZLokcfL/SI5h7MM+BY3PUAHRF0055L3SENSD8jyNOgSjkmmOOLY27PFGF - LNYyTuhYLE7uZyVOevaq9skCiKVRhV7HtSQcv1ac6YuIyinwrpCN42yaHFG/m6SpO+ - lTxi9/43YenBpHkbZHxt8llNxRKcPbDdXMQcwZE6f0ksz92jfSioU5dJEMwJnFYvLm - XSuzTPYuERV+/O82eUGYarkAczW2F0SfMOKWdb6C85FiS1hNj2Wqo6bM4G+GNyDUWz - ORIxUtmwVAgwg== -Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de - [91.248.189.231]) - (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) (Authenticated sender: sre) - by bali.collaboradmins.com (Postfix) with ESMTPSA id 3C7D917E14D7; - Thu, 5 Sep 2024 17:17:08 +0200 (CEST) -Received: by jupiter.universe (Postfix, from userid 1000) - id A72CD4800FF; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) -From: Sebastian Reichel -To: Marek Vasut , u-boot@lists.denx.de, - Jonas Karlman , Soeren Moch -Cc: Eugen Hristev , - Tim Harvey , Kever Yang , - Philipp Tomsich , Simon Glass , - Sebastian Reichel -Subject: [PATCH v6 5/6] rockchip: rock5b-rk3588: Enable USB-C PD support -Date: Thu, 5 Sep 2024 17:08:41 +0200 -Message-ID: <20240905151707.59101-6-sebastian.reichel@collabora.com> -X-Mailer: git-send-email 2.45.2 -In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> -References: <20240905151707.59101-1-sebastian.reichel@collabora.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 - -Now that all code has been prepared update the default configuration to -make use of it. - -Reviewed-by: Kever Yang -Tested-by: Soeren Moch -Signed-off-by: Sebastian Reichel ---- - configs/rock5b-rk3588_defconfig | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig -index 80a2f2fed586..82c942a52d62 100644 ---- a/configs/rock5b-rk3588_defconfig -+++ b/configs/rock5b-rk3588_defconfig -@@ -23,6 +23,7 @@ CONFIG_FIT_VERBOSE=y - CONFIG_SPL_FIT_SIGNATURE=y - CONFIG_SPL_LOAD_FIT=y - CONFIG_LEGACY_IMAGE_FORMAT=y -+CONFIG_OF_BOARD_SETUP=y - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-rock-5b.dtb" - # CONFIG_DISPLAY_CPUINFO is not set - CONFIG_DISPLAY_BOARDINFO_LATE=y -@@ -103,3 +104,6 @@ CONFIG_USB_GADGET=y - CONFIG_USB_GADGET_DOWNLOAD=y - CONFIG_USB_FUNCTION_ROCKUSB=y - CONFIG_ERRNO_STR=y -+CONFIG_TYPEC_TCPM=y -+CONFIG_TYPEC_FUSB302=y -+CONFIG_CMD_TCPM=y - -From patchwork Thu Sep 5 15:08:42 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Sebastian Reichel -X-Patchwork-Id: 1981314 -X-Patchwork-Delegate: ykai007@gmail.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=collabora.com header.i=@collabora.com - header.a=rsa-sha256 header.s=mail header.b=Ci2PO1GU; - 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 4X02zk6YyNz1yXY - for ; Fri, 6 Sep 2024 01:17:54 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 7F41A88CE5; - Thu, 5 Sep 2024 17:17:15 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.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=collabora.com header.i=@collabora.com - header.b="Ci2PO1GU"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 6ED1888CC2; Thu, 5 Sep 2024 17:17:14 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from bali.collaboradmins.com (bali.collaboradmins.com - [IPv6:2a01:4f8:201:9162::2]) - (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 CD5F888CD0 - for ; Thu, 5 Sep 2024 17:17:08 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=collabora.com -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=sebastian.reichel@collabora.com -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; - s=mail; t=1725549428; - bh=l4Xv+BpciSynhuTx8UEne0BTouVROBqh6qBZSM+vxDg=; - h=From:To:Cc:Subject:Date:In-Reply-To:References:From; - b=Ci2PO1GUFnjJQSAIA8bOSaKduXeFJwF8D+1yGRBAT9+M+oNdtaLQKmdPE/XuBAMBF - hEDngnCgvcZdH4Q3uiLUEDi1jZqjU3+VPGTR6fECGe8zriHIja8R6NQR3NCHsfcQMr - E74ZH8bkjhX6S3MYLjZMLTrFBjTAGvshUtI7gKh7Xyet03KYD1xZlvJV71d196Ygty - pr1imuqccIOh7cUE8V2YsSoaibrkiiA9uEpvNr0u9JxE2dvd5HrVR+Uftjzh21ATyo - RERAB90Lf6rr4hdtA1KaFrpuFgWMWKwVL2OKtE8wxPHaUo23Cq36LXmMeeho8nL73T - 5XslHm2u6aESA== -Received: from jupiter.universe (dyndsl-091-248-189-231.ewe-ip-backbone.de - [91.248.189.231]) - (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) (Authenticated sender: sre) - by bali.collaboradmins.com (Postfix) with ESMTPSA id 3F1DD17E14D8; - Thu, 5 Sep 2024 17:17:08 +0200 (CEST) -Received: by jupiter.universe (Postfix, from userid 1000) - id A909F480100; Thu, 05 Sep 2024 17:17:07 +0200 (CEST) -From: Sebastian Reichel -To: Marek Vasut , u-boot@lists.denx.de, - Jonas Karlman , Soeren Moch -Cc: Eugen Hristev , - Tim Harvey , Kever Yang , - Philipp Tomsich , Simon Glass , - Sebastian Reichel -Subject: [PATCH v6 6/6] MAINTAINERS: add TCPM section -Date: Thu, 5 Sep 2024 17:08:42 +0200 -Message-ID: <20240905151707.59101-7-sebastian.reichel@collabora.com> -X-Mailer: git-send-email 2.45.2 -In-Reply-To: <20240905151707.59101-1-sebastian.reichel@collabora.com> -References: <20240905151707.59101-1-sebastian.reichel@collabora.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 new section for USB TypeC Port Manager (TCPM) support, which -is needed to figure out cable orientation of USB-C plus and to do -USB PD communication. - -Signed-off-by: Sebastian Reichel ---- - MAINTAINERS | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/MAINTAINERS b/MAINTAINERS -index 2050ae24df82..f3cf84d20dbd 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -1721,6 +1721,15 @@ F: common/usb_kbd.c - F: common/usb_storage.c - F: include/usb.h - -+USB TCPM -+M: Sebastian Reichel -+S: Maintained -+F: cmd/tcpm.c -+F: doc/usage/cmd/tcpm.rst -+F: drivers/usb/tcpm/ -+F: include/usb/pd.h -+F: include/usb/tcpm.h -+ - USB xHCI - M: Bin Meng - S: Maintained diff --git a/Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch b/Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch deleted file mode 100644 index 0dec1ea..0000000 --- a/Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch +++ /dev/null @@ -1,1414 +0,0 @@ -From patchwork Wed Aug 21 13:41:46 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Caleb Connolly -X-Patchwork-Id: 1974970 -X-Patchwork-Delegate: caleb.connolly@linaro.org -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=BpF9pRLA; - 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 4WpnZD73RJz1yXf - for ; Wed, 21 Aug 2024 23:42:12 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 99F6188D9B; - Wed, 21 Aug 2024 15:42:00 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="BpF9pRLA"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 86A7E88D9B; Wed, 21 Aug 2024 15:41:58 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com - [IPv6:2a00:1450:4864:20::133]) - (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 896B7887D4 - for ; Wed, 21 Aug 2024 15:41:55 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=caleb.connolly@linaro.org -Received: by mail-lf1-x133.google.com with SMTP id - 2adb3069b0e04-5333b2fbedaso4381657e87.0 - for ; Wed, 21 Aug 2024 06:41:55 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1724247715; x=1724852515; darn=lists.denx.de; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:from:to:cc:subject:date:message-id - :reply-to; bh=vYpvXZhAM0wjWc6QeTnHyYsF2xjKAb2Bg/9VNGJ7oC4=; - b=BpF9pRLArbhamTTSvF+LPOjqIaruq3137+Td+Y4qA32sBPKjZN2zyabjh/Rafnr5O1 - 9d/0nOcXmbKi3CTtdUN3qV19169r8d2lAuPiUwXoxGf4v9wPlXv1TnQilC0/IpdephxJ - oRj9+5DwMh1C/THNGdn6N9M7PrZ33uVwOawlqlGPGaBUlZzEtdpeQt8mGBT72vsWTwEc - g9XIuP7GYNy3Ztzy8JMYfvFT0MCUQmkDb9anAIfRkARVMxMTI3X0lz9nXqhgNHGXF/vc - tw9UbbFQc5bsonufEXl0cg3x4yHX3dzV2NcPvnGJWBUgHbNoQ1dUvmUD8ivz8xpCGh95 - /uLg== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1724247715; x=1724852515; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=vYpvXZhAM0wjWc6QeTnHyYsF2xjKAb2Bg/9VNGJ7oC4=; - b=F/jmt2BY3txUp2Xo6ouNkmlNd7uQWuOBEkIGKUIwLL3jKl7uBJ/Ptt5k5n2REXJ3RX - qQv2x7FQlJXgvIfdnyr82QJx4EA7lV3SciLcJsTQMrrE0URCNMdIzUgMi0Su+QUw2rkH - 3F6BNFc2AUknW7ohrfLBnJWKHecIEJy7NbLcVve5RxNTga9md5WoIqlyL0PMo+pbTH/P - t4upinI57g3mt/aAFxlETKF7TY9fUiDnKfmp6NNkTAYVemvziHPE4LO78hHLLRggdYJE - li/V+pZa6jdmhd9c2wPO7Qlhlw3i48ti0LmA6PBMgebLO+YTAXf2pUpLQl4gdayX4WJr - 21qA== -X-Gm-Message-State: AOJu0YzCxBg0ApyZrMj/flKnSEzT/WdNXsTISMZEYTB2A2c9+9pYoTt8 - Y4o4D/Wn7JKEhGJS9pejsVJGp3BVDAbME2fz2uL63aeV9h8aeA7aQIfST443wEE= -X-Google-Smtp-Source: - AGHT+IHwtmpvp1KyCpCFrQ9m8b9mZocGdoGZKOOBbCOdWXgPOOaJpvIzD+wO9cPMXI0xJJ299Vb3aw== -X-Received: by 2002:a05:6512:2526:b0:533:4b07:a8dc with SMTP id - 2adb3069b0e04-5334b07a924mr853860e87.35.1724247714485; - Wed, 21 Aug 2024 06:41:54 -0700 (PDT) -Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) - by smtp.gmail.com with ESMTPSA id - a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.53 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 21 Aug 2024 06:41:53 -0700 (PDT) -From: Caleb Connolly -Date: Wed, 21 Aug 2024 15:41:46 +0200 -Subject: [PATCH v2 1/7] clk/qcom: add initial clock driver for sc7280 -MIME-Version: 1.0 -Message-Id: <20240821-b4-rb3gen2-v2-1-49b07633f3a8@linaro.org> -References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -To: Tom Rini , Lukasz Majewski , - Sean Anderson , - Caleb Connolly , - Neil Armstrong , - Sumit Garg -Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io -X-Mailer: b4 0.14-dev -X-Developer-Signature: v=1; a=openpgp-sha256; l=6610; - i=caleb.connolly@linaro.org; h=from:subject:message-id; - bh=Ml3U758Os52kpw+GNgmPmB5Bs0weI+7Cu8LeGmVUjJs=; - b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6dj9dkbc0E3zPhQL/6lm1ahALcexDRPoBcO - ng26jm+QUiJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k - ttaKD/9DtqMqfY7Do5CxJU3qRYk5ZmdeMIF9JTXN0APLu1fGGMznfgoUn93safNuzgw/exm5CNI - rSoCXHGtBpKM+SWjYe9ir4C7PQqdJt0J5vgdUOHVqfy87jgC4RQkE6HUDCtd9s1HitZNCtiZGrs - BeJ7SVOrAakL3QgXCssgvhDmNmQoMDd5l1lTXL9p5RQTVAZuQuihQJ1fcVtXVH9DlYidlvNdwKZ - wLXps20Hc7uStWohI/+MtDq5OzwxfEXVLBOktJ8cR26UZ1N5pFItdarRZpmJCJFtWU4ORyamCKW - EcPSjaDo7r2GT7CbiILoXpsQLGX5SNrEWFAFQJKUjAyHe0x2H0394aVGd4Yt9kFBG8KSvhzwsVq - tVzpKmy0oe/2CCcVsRHhT4b1j7H+MiudmxYpUByqcljtWKm/0Nd6C42oqHSs4NP+DRHHPzDGpxm - Bzaex1Y5tkwivXqgISlHEX99R605X8KWM3LJnKMPBU5qdHN7x1/8tdcpsnCHd/+AobL+Ty7gaH4 - CXqmB2zZY/1VAhboMRJnDaOooBlBlGfaiMu9/sOpQJo0xWPYtANjyli/9TIsBSBkctEAa4rv0WN - ruiueb3HXdDqzPGpcaVMnApPjkNEUGiMlhaJKTJPcBuIDaC0uNwquaRv7fmLRE5oqWlX1uQ7Seu - fUzYzzESEzLWSGg== -X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; - fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 -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 - -We don't actually need any clocks to get UFS up and running, resets are -useful though. - -Reviewed-by: Neil Armstrong -Signed-off-by: Caleb Connolly ---- - drivers/clk/qcom/Kconfig | 8 +++ - drivers/clk/qcom/Makefile | 1 + - drivers/clk/qcom/clock-qcom.h | 1 + - drivers/clk/qcom/clock-sc7280.c | 132 ++++++++++++++++++++++++++++++++++++++++ - 4 files changed, 142 insertions(+) - -diff --git a/drivers/clk/qcom/Kconfig b/drivers/clk/qcom/Kconfig -index 45d63c6d6dbf..0d2c0ac225c5 100644 ---- a/drivers/clk/qcom/Kconfig -+++ b/drivers/clk/qcom/Kconfig -@@ -85,7 +85,15 @@ config CLK_QCOM_SM8650 - Say Y here to enable support for the Global Clock Controller - on the Snapdragon SM8650 SoC. This driver supports the clocks - and resets exposed by the GCC hardware block. - -+config CLK_QCOM_SC7280 -+ bool "Qualcomm SC7280 GCC" -+ select CLK_QCOM -+ help -+ Say Y here to enable support for the Global Clock Controller -+ on the Snapdragon SC7280 SoC. This driver supports the clocks -+ and resets exposed by the GCC hardware block. -+ - endmenu - - endif -diff --git a/drivers/clk/qcom/Makefile b/drivers/clk/qcom/Makefile -index dec20e4b5943..e223c131ee4d 100644 ---- a/drivers/clk/qcom/Makefile -+++ b/drivers/clk/qcom/Makefile -@@ -8,8 +8,9 @@ obj-$(CONFIG_CLK_QCOM_APQ8016) += clock-apq8016.o - obj-$(CONFIG_CLK_QCOM_APQ8096) += clock-apq8096.o - obj-$(CONFIG_CLK_QCOM_IPQ4019) += clock-ipq4019.o - obj-$(CONFIG_CLK_QCOM_QCM2290) += clock-qcm2290.o - obj-$(CONFIG_CLK_QCOM_QCS404) += clock-qcs404.o -+obj-$(CONFIG_CLK_QCOM_SC7280) += clock-sc7280.o - obj-$(CONFIG_CLK_QCOM_SM6115) += clock-sm6115.o - obj-$(CONFIG_CLK_QCOM_SM8250) += clock-sm8250.o - obj-$(CONFIG_CLK_QCOM_SM8550) += clock-sm8550.o - obj-$(CONFIG_CLK_QCOM_SM8650) += clock-sm8650.o -diff --git a/drivers/clk/qcom/clock-qcom.h b/drivers/clk/qcom/clock-qcom.h -index f6445c8f566f..7aa6ca59aad5 100644 ---- a/drivers/clk/qcom/clock-qcom.h -+++ b/drivers/clk/qcom/clock-qcom.h -@@ -10,8 +10,9 @@ - #define CFG_CLK_SRC_CXO (0 << 8) - #define CFG_CLK_SRC_GPLL0 (1 << 8) - #define CFG_CLK_SRC_GPLL0_AUX2 (2 << 8) - #define CFG_CLK_SRC_GPLL9 (2 << 8) -+#define CFG_CLK_SRC_GPLL0_ODD (3 << 8) - #define CFG_CLK_SRC_GPLL6 (4 << 8) - #define CFG_CLK_SRC_GPLL7 (3 << 8) - #define CFG_CLK_SRC_GPLL4 (5 << 8) - #define CFG_CLK_SRC_GPLL0_EVEN (6 << 8) -diff --git a/drivers/clk/qcom/clock-sc7280.c b/drivers/clk/qcom/clock-sc7280.c -new file mode 100644 -index 000000000000..5d343f120519 ---- /dev/null -+++ b/drivers/clk/qcom/clock-sc7280.c -@@ -0,0 +1,132 @@ -+// SPDX-License-Identifier: GPL-2.0 -+/* -+ * Clock drivers for Qualcomm sc7280 -+ * -+ * (C) Copyright 2024 Linaro Ltd. -+ */ -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "clock-qcom.h" -+ -+#define USB30_PRIM_MOCK_UTMI_CLK_CMD_RCGR 0xf038 -+#define USB30_PRIM_MASTER_CLK_CMD_RCGR 0xf020 -+ -+static ulong sc7280_set_rate(struct clk *clk, ulong rate) -+{ -+ struct msm_clk_priv *priv = dev_get_priv(clk->dev); -+ -+ if (clk->id < priv->data->num_clks) -+ debug("%s: %s, requested rate=%ld\n", __func__, priv->data->clks[clk->id].name, rate); -+ -+ switch (clk->id) { -+ case GCC_USB30_PRIM_MOCK_UTMI_CLK: -+ WARN(rate != 19200000, "Unexpected rate for USB30_PRIM_MOCK_UTMI_CLK: %lu\n", rate); -+ clk_rcg_set_rate(priv->base, USB30_PRIM_MASTER_CLK_CMD_RCGR, 0, CFG_CLK_SRC_CXO); -+ return rate; -+ case GCC_USB30_PRIM_MASTER_CLK: -+ WARN(rate != 200000000, "Unexpected rate for USB30_PRIM_MASTER_CLK: %lu\n", rate); -+ clk_rcg_set_rate_mnd(priv->base, USB30_PRIM_MASTER_CLK_CMD_RCGR, -+ 1, 0, 0, CFG_CLK_SRC_GPLL0_ODD, 8); -+ clk_rcg_set_rate(priv->base, 0xf064, 0, 0); -+ return rate; -+ default: -+ return 0; -+ } -+} -+ -+static const struct gate_clk sc7280_clks[] = { -+ GATE_CLK(GCC_CFG_NOC_USB3_PRIM_AXI_CLK, 0xf07c, 1), -+ GATE_CLK(GCC_USB30_PRIM_MASTER_CLK, 0xf010, 1), -+ GATE_CLK(GCC_AGGRE_USB3_PRIM_AXI_CLK, 0xf080, 1), -+ GATE_CLK(GCC_USB30_PRIM_SLEEP_CLK, 0xf018, 1), -+ GATE_CLK(GCC_USB30_PRIM_MOCK_UTMI_CLK, 0xf01c, 1), -+ GATE_CLK(GCC_USB3_PRIM_PHY_AUX_CLK, 0xf054, 1), -+ GATE_CLK(GCC_USB3_PRIM_PHY_COM_AUX_CLK, 0xf058, 1), -+}; -+ -+static int sc7280_enable(struct clk *clk) -+{ -+ struct msm_clk_priv *priv = dev_get_priv(clk->dev); -+ -+ if (priv->data->num_clks < clk->id) { -+ debug("%s: unknown clk id %lu\n", __func__, clk->id); -+ return 0; -+ } -+ -+ debug("%s: clk %ld: %s\n", __func__, clk->id, sc7280_clks[clk->id].name); -+ -+ switch (clk->id) { -+ case GCC_AGGRE_USB3_PRIM_AXI_CLK: -+ qcom_gate_clk_en(priv, GCC_USB30_PRIM_MASTER_CLK); -+ fallthrough; -+ case GCC_USB30_PRIM_MASTER_CLK: -+ qcom_gate_clk_en(priv, GCC_USB3_PRIM_PHY_AUX_CLK); -+ qcom_gate_clk_en(priv, GCC_USB3_PRIM_PHY_COM_AUX_CLK); -+ break; -+ } -+ -+ qcom_gate_clk_en(priv, clk->id); -+ -+ return 0; -+} -+ -+static const struct qcom_reset_map sc7280_gcc_resets[] = { -+ [GCC_PCIE_0_BCR] = { 0x6b000 }, -+ [GCC_PCIE_0_PHY_BCR] = { 0x6c01c }, -+ [GCC_PCIE_1_BCR] = { 0x8d000 }, -+ [GCC_PCIE_1_PHY_BCR] = { 0x8e01c }, -+ [GCC_QUSB2PHY_PRIM_BCR] = { 0x12000 }, -+ [GCC_QUSB2PHY_SEC_BCR] = { 0x12004 }, -+ [GCC_SDCC1_BCR] = { 0x75000 }, -+ [GCC_SDCC2_BCR] = { 0x14000 }, -+ [GCC_SDCC4_BCR] = { 0x16000 }, -+ [GCC_UFS_PHY_BCR] = { 0x77000 }, -+ [GCC_USB30_PRIM_BCR] = { 0xf000 }, -+ [GCC_USB30_SEC_BCR] = { 0x9e000 }, -+ [GCC_USB3_DP_PHY_PRIM_BCR] = { 0x50008 }, -+ [GCC_USB3_PHY_PRIM_BCR] = { 0x50000 }, -+ [GCC_USB3PHY_PHY_PRIM_BCR] = { 0x50004 }, -+ [GCC_USB_PHY_CFG_AHB2PHY_BCR] = { 0x6a000 }, -+}; -+ -+static const struct qcom_power_map sc7280_gdscs[] = { -+ [GCC_UFS_PHY_GDSC] = { 0x77004 }, -+ [GCC_USB30_PRIM_GDSC] = { 0xf004 }, -+}; -+ -+static struct msm_clk_data qcs404_gcc_data = { -+ .resets = sc7280_gcc_resets, -+ .num_resets = ARRAY_SIZE(sc7280_gcc_resets), -+ .clks = sc7280_clks, -+ .num_clks = ARRAY_SIZE(sc7280_clks), -+ -+ .power_domains = sc7280_gdscs, -+ .num_power_domains = ARRAY_SIZE(sc7280_gdscs), -+ -+ .enable = sc7280_enable, -+ .set_rate = sc7280_set_rate, -+}; -+ -+static const struct udevice_id gcc_sc7280_of_match[] = { -+ { -+ .compatible = "qcom,gcc-sc7280", -+ .data = (ulong)&qcs404_gcc_data, -+ }, -+ { } -+}; -+ -+U_BOOT_DRIVER(gcc_sc7280) = { -+ .name = "gcc_sc7280", -+ .id = UCLASS_NOP, -+ .of_match = gcc_sc7280_of_match, -+ .bind = qcom_cc_bind, -+ .flags = DM_FLAG_PRE_RELOC | DM_FLAG_DEFAULT_PD_CTRL_OFF, -+}; - -From patchwork Wed Aug 21 13:41:47 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Caleb Connolly -X-Patchwork-Id: 1974971 -X-Patchwork-Delegate: caleb.connolly@linaro.org -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=D8cipZN8; - 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 4WpnZS1lFqz1yXf - for ; Wed, 21 Aug 2024 23:42:24 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 2404B88DB7; - Wed, 21 Aug 2024 15:42:01 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="D8cipZN8"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id CF84288B3C; Wed, 21 Aug 2024 15:41:58 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com - [IPv6:2a00:1450:4864:20::22f]) - (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 BC82A88AC0 - for ; Wed, 21 Aug 2024 15:41:56 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=caleb.connolly@linaro.org -Received: by mail-lj1-x22f.google.com with SMTP id - 38308e7fff4ca-2f136e23229so67636651fa.1 - for ; Wed, 21 Aug 2024 06:41:56 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1724247716; x=1724852516; darn=lists.denx.de; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:from:to:cc:subject:date:message-id - :reply-to; bh=BtQqdiFk/5BGUCz4O21vl/84vcKElfs3QSU/TjahAhA=; - b=D8cipZN8vnM60gNnxvkm4MeJi0YUs2ejIG0MSF/WWYvpmyESE3mh38i9CQho0bxU6i - iX63Dsb/6xtE1YF26oNdy6430/ePndpn9VXSnZ4+c+0j1Er/qSEXlX7/BzwYSxhKFXP2 - /F6RsyF3R5s2HPndcU3OSppiLYNDSZZFa5XBwBVgNsjEoAOmVBZspDGJXberoFWSw1Xd - jvCW7H8KY4DgeuHAJAF1udHYqYfpDTGmijGk1cl6yddFZ4BX5AHEetjJMm6/Sfs0rYEE - D0REEYmHiwa1dm8mN6J+XMp2tgzg/8RPlQ5p4k9lcZlrCuZ7TnFF+HgnR7TLnMaOY5WI - DeWw== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1724247716; x=1724852516; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=BtQqdiFk/5BGUCz4O21vl/84vcKElfs3QSU/TjahAhA=; - b=P16tCzEGlwXh2HUe2zkd2EwD+lVsUJ2nv3xZT1gSdJfgv9uFCy5uHQOHx+GfyeFiFB - ZTZeGSznoCm+BqR4Rw1gx+Pw4M5rk38MOzZj6eb1PVfM7DKBk1C0g3ddxLBWvXwGky/P - /PMojneROHfJG+HpIjemGUIP4Cnbl+J0M1VqM1cJazIQocK+IpbqphhjI7IDKfPwZz0O - Cxn70edXPpLuZvBwbSJEk5zEyh+2b0oiyPP8VwzVfimOrP0nSJ/TkZiKVgEAVBmiRq1c - hpW2xFrDixDe+Ioa2hCXcbsIoDf8EyCdmxWVIiA8h4xsXfXpSbgDCAgBz0wi9Uw3Jy/h - LRZg== -X-Gm-Message-State: AOJu0Yz5oP45hJMUwyK8DU9sBL6vYfuGjHAeVLt3bxXXNCuBLvCzIx7F - gF97feq0wgpXLIEQ7uqwcBXQ46wbHQs8IEvoNGTarDCXSFeggfCqEC7oDzM4U48= -X-Google-Smtp-Source: - AGHT+IFRfsXmk97RBDrPRNGuRiWGpZ4udOpM/gdavhIAP7Vw5jIX1oJ1BZ6+tqyctFDutWKn/+6X5g== -X-Received: by 2002:ac2:4e09:0:b0:52f:2ea:499f with SMTP id - 2adb3069b0e04-5334855d512mr1561479e87.24.1724247715821; - Wed, 21 Aug 2024 06:41:55 -0700 (PDT) -Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) - by smtp.gmail.com with ESMTPSA id - a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.54 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 21 Aug 2024 06:41:55 -0700 (PDT) -From: Caleb Connolly -Date: Wed, 21 Aug 2024 15:41:47 +0200 -Subject: [PATCH v2 2/7] dts: qcs6490-rb3gen2-u-boot: add override dtsi -MIME-Version: 1.0 -Message-Id: <20240821-b4-rb3gen2-v2-2-49b07633f3a8@linaro.org> -References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -To: Tom Rini , Lukasz Majewski , - Sean Anderson , - Caleb Connolly , - Neil Armstrong , - Sumit Garg -Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io -X-Mailer: b4 0.14-dev -X-Developer-Signature: v=1; a=openpgp-sha256; l=1273; - i=caleb.connolly@linaro.org; h=from:subject:message-id; - bh=WycUvGIX1Vb2Dt9TSRhlFTIc8lgmewYYBQWg2kxs6NI=; - b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6djNLXRIVPQZZW1FVYvOn/tPtr3vGLbnTcN - EIiqQUfY2uJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k - tnN7D/0d90bQBLWvZQ8d0lHinZ/3zwe3FEdaLK31OGRD7VJd7Q8ckuOxOF/eO8TLmksQovgvrTY - 68llyxkNZe/nnmY9UX+DJ+i5pzqINuLlGRqANukMePwwJxJZilb6dRXB9sR+hSBHC+YTyfY67xk - 78ILyZhMmZqmi/ya6lBqxLieP+CnHq1V9n07s3jljhE1oSp4NucQzFXpv48MGEpOt/sIyjtzQ5w - aw7r1Wsay9w+xmNly+kBT+05q5dp/CTnqMp1koKGG/fWWkSZUgo5yODYeRAiieb7ZQ5JaVmxJkf - G3K0BPkFJ+kaPyU6Mbe0d573tY+oZsWDWEBFP/diduz8lw27tIDOmpTIyT8lMsu1vL7dcj38NsS - 50a7smXimMWcKwJsEQV32Tw0QYv4kfJyqjxXVj6kJ+DWL1bm15LZ6fZpXy3tbTHzJvWRr2Lx/AZ - mWXbylc+uUx4tQkb+7+OhSN376NPfWUNlGHMdHSfQHgzcFuGbMmf9v58sPXa7ZKb3UFkKk2MAzA - 8kiDEMgp/6k55lHxdc4ndxK/vXTKxiU59H2k+okeAQ2iMnA39r/M7yOe6a8vyXDyeuCmJHncNAX - /Uy4yr757EQpUKygo3DjdfRcZQ/h5hQ2TFiWm3BlU87k8MlQl5JEGwxqpkM+9JXFjRwiGcR2ZSO - fOkmL+X6FXNHw3A== -X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; - fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 -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 - -For running U-Boot as primary bootloader we must define the memory -layout statically. - -Signed-off-by: Caleb Connolly ---- - arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi | 23 +++++++++++++++++++++++ - 1 file changed, 23 insertions(+) - -diff --git a/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi b/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi -new file mode 100644 -index 000000000000..c3ec4a317f7c ---- /dev/null -+++ b/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi -@@ -0,0 +1,23 @@ -+// SPDX-License-Identifier: BSD-3-Clause -+/* -+ * Copyright (c) 2024 Linaro Ltd. -+ */ -+/ { -+ /* When running as the primary bootloader there is no prior -+ * stage to populate the memory layout for us. We *should* -+ * have two nodes here, but ABL does NOT like that. -+ * sooo we're stuck with this. -+ */ -+ memory@80000000 { -+ device_type = "memory"; -+ reg = <0 0x80000000 0 0x3A800000>, -+ <0 0xC0000000 0 0x01800000>, -+ <0 0xC3400000 0 0x3CC00000>, -+ <1 0x00000000 1 0x00000000>; -+ }; -+}; -+ -+// RAM Entry 0 : Base 0x0080000000 Size 0x003A800000 -+// RAM Entry 1 : Base 0x00C0000000 Size 0x0001800000 -+// RAM Entry 2 : Base 0x00C3400000 Size 0x003CC00000 -+// RAM Entry 3 : Base 0x0100000000 Size 0x0100000000 - -From patchwork Wed Aug 21 13:41:48 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Caleb Connolly -X-Patchwork-Id: 1974972 -X-Patchwork-Delegate: caleb.connolly@linaro.org -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=W/enKPtj; - 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 4WpnZg6XLXz1yXf - for ; Wed, 21 Aug 2024 23:42:35 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 8FCF188DD8; - Wed, 21 Aug 2024 15:42:03 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="W/enKPtj"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 7430788BF6; Wed, 21 Aug 2024 15:42:00 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com - [IPv6:2a00:1450:4864:20::436]) - (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 BB78388C7E - for ; Wed, 21 Aug 2024 15:41:57 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=caleb.connolly@linaro.org -Received: by mail-wr1-x436.google.com with SMTP id - ffacd0b85a97d-3718706cf8aso4087426f8f.3 - for ; Wed, 21 Aug 2024 06:41:57 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1724247717; x=1724852517; darn=lists.denx.de; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:from:to:cc:subject:date:message-id - :reply-to; bh=zLolcdfhpnv2Sr4+jU2o0ZvxpFWa2r7z1o+vmKY3kNM=; - b=W/enKPtjbLPpOfXBJ95XWpBN74SHMzSf7YfqzclhQ8DglD54/Ubm8hmtMAJr3dU4oc - 7QSmg2IojIWCgmF7ZVpPpPipkl0d0NJdhrbZgltHWn6DI5oa5z8H/oPL2qgfxOvi1mol - GkNDzmOd9DogYJbDxazFLX/yuyObHE0Frbk1+5S+dUC9Mk6TEn/kAnphDP0/pIcoFqNS - MHhPWfxQj8qNWFF683e2CNpiiQmhvIyxMnx2XDqHqr0sARkmDhEdmDt6/J2uDEpAXIqS - gfb2ryOgrf0ymsrNXXmgtPBlJ1Nk+WvqQNZ+fFud6rDTMI7k3T6vg9LtuKRk5l0ZeW9z - 9ukA== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1724247717; x=1724852517; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=zLolcdfhpnv2Sr4+jU2o0ZvxpFWa2r7z1o+vmKY3kNM=; - b=Bk58APruZpAfRV6OKvJFR/r6nSOZTRk1lGotJZ/7Ps1APRn4QEUIEES/nAymFAlsZK - IuAn5ixOz3aQip+GhlTd5ZX/4G2D90T9SLGu+jKI2zHbc9HfYsLUaLImDouZanKiy3DN - rSF/DzczN7mNahfl++0WXyuhXE1l5coIb99U116QJ4etTFEC+YvBD2zWg7RpfxE6F2MA - tu2L+KZX2xor/7JzMfyV/FeFyAo5X53e7JPAVpvXa6vGTXfyZa8kzv4oIa1vTbwsuxLK - D4AcwfMHj4eyGTilDPHRn292bg79eS+R3MX3EpFEW6J/Zr5fKhsyDSDcjBuR2TYJ7Gcv - BDrw== -X-Gm-Message-State: AOJu0YxuxBBsFKKWph/SGz+J1lDRx2i4hMnvb9KUEI3p7sCb122LZSOU - lTiuOgJUeGU0ryXFmDTRlVFUVDC+WlMh98BjXmGjDc74hcUPn0EuM1QELuQYSNk= -X-Google-Smtp-Source: - AGHT+IFF8AJ5Hu9iRBb/BV7cCxp9j5UJEcpMy4SVnJcq2ijih+8KFAvBMsil1LfJlPGBheg9LAatHw== -X-Received: by 2002:adf:cc82:0:b0:368:6633:c550 with SMTP id - ffacd0b85a97d-372fd82f325mr1509038f8f.52.1724247717163; - Wed, 21 Aug 2024 06:41:57 -0700 (PDT) -Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) - by smtp.gmail.com with ESMTPSA id - a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.56 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 21 Aug 2024 06:41:56 -0700 (PDT) -From: Caleb Connolly -Date: Wed, 21 Aug 2024 15:41:48 +0200 -Subject: [PATCH v2 3/7] dts: qcs6490-rb3gen2-u-boot: USB host mode -MIME-Version: 1.0 -Message-Id: <20240821-b4-rb3gen2-v2-3-49b07633f3a8@linaro.org> -References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -To: Tom Rini , Lukasz Majewski , - Sean Anderson , - Caleb Connolly , - Neil Armstrong , - Sumit Garg -Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io -X-Mailer: b4 0.14-dev -X-Developer-Signature: v=1; a=openpgp-sha256; l=955; - i=caleb.connolly@linaro.org; h=from:subject:message-id; - bh=HTbXxsrMd17GClJdrUxqmv1t42K8cKHfbuWdCzpCB0M=; - b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6djkazDSIeIn+UGkfv2WCzgyN2+Nv9IFp8u - /7f/kVTNzKJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k - tt0qEACLN54DQLVEpmwhpZIBzCPjtaeMTHKNrVejy201O3Ts9I8BmKyuCQmcJReF8E1oTvhVE2p - RRdEnopYd86hGyIc6pZZ1tNwmwCxeADAERIygNKEAGK6f6v29CJZt0OMSVRx7emdUn6wDP0/6FQ - W7zfmxJKZMNp1gEMS80FJSa+PkI148T6WzfmKEfNbENYTwwIwC/e8yqlKXp+joiPv269f/nYbtY - ZR6mW3re0fvIoCbUjHcIRmu5ZWB92qqfwAiSCLLlajpzIF8iDrDyOYOdb7/TxM5eWZloPwDYHaK - 0eJde2EIysMA1TJFP8ynVnUe1c4sZxDLB+ZnVUpbvGTvHjguamxfazEZlUmd1kV6m+ilTqAIlUP - 2v5eY2KUjx+MD8qm5FLgpj6JHDE9jszg3LSETAPwJDk0MICXQoY9HMu03kO8KE62j2HrRwVn7/G - i1agSOBRJyNDHqTiUh2vYQnwwBPANZPjipnQgPkZ6Ebd98KbzzHr9Dh+kR7eC/caSf0V82YK4G8 - mPCaznXAPS+VNfT+JZQxQz7Axm1O7bWfIuSdLGqVGBRj4+4W3k1PzFWI7S46Vj4qWbpJXuWKl6I - UlE67yw71FwYzQt6B7xLMSCr2O8bFmlv42AVl6bNjG53CZ8HmBo5AuKrhbdhpLv5HfjWK1j58tW - Ci+WPJUvj2lPPfg== -X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; - fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 -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 - -Adjust DTS so USB runs in host mode. The type-c port is the only -supported port (since the others need PCIe). Booting from USB is -possible with a powered type-c dock. - -Signed-off-by: Caleb Connolly ---- - arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi b/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi -index c3ec4a317f7c..fbe72595f5ac 100644 ---- a/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi -+++ b/arch/arm/dts/qcs6490-rb3gen2-u-boot.dtsi -@@ -16,8 +16,13 @@ - <1 0x00000000 1 0x00000000>; - }; - }; - -+&usb_1_dwc3 { -+ dr_mode = "host"; -+ /delete-property/ usb-role-switch; -+}; -+ - // RAM Entry 0 : Base 0x0080000000 Size 0x003A800000 - // RAM Entry 1 : Base 0x00C0000000 Size 0x0001800000 - // RAM Entry 2 : Base 0x00C3400000 Size 0x003CC00000 - // RAM Entry 3 : Base 0x0100000000 Size 0x0100000000 - -From patchwork Wed Aug 21 13:41:49 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Caleb Connolly -X-Patchwork-Id: 1974973 -X-Patchwork-Delegate: caleb.connolly@linaro.org -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=fxhzRRWP; - 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 4WpnZv2VSTz1yXf - for ; Wed, 21 Aug 2024 23:42:47 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id F1A1E88DBB; - Wed, 21 Aug 2024 15:42:03 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="fxhzRRWP"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 5F28288DBF; Wed, 21 Aug 2024 15:42:01 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com - [IPv6:2a00:1450:4864:20::12c]) - (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 5838488AC0 - for ; Wed, 21 Aug 2024 15:41:59 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=caleb.connolly@linaro.org -Received: by mail-lf1-x12c.google.com with SMTP id - 2adb3069b0e04-52efc60a6e6so9447535e87.1 - for ; Wed, 21 Aug 2024 06:41:59 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1724247718; x=1724852518; darn=lists.denx.de; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:from:to:cc:subject:date:message-id - :reply-to; bh=cqF2st4G7Whhok3VZo6aDGC//+kV3J+exZKhkiiSLFQ=; - b=fxhzRRWPt+qpJciGSAITWCo8l8X60UfTDq85wh8FY7dCx3uklUdpEcoF9mZQvZEARc - JdrCoNahI2M7n7uxXFkWNU8HAYP8adAfEIdzL9A74GE5HVYfUWU28+jLirmyAHbts2I/ - SdPX01laMMuUBZNO1+eQTpYWK/pAO7J5BnazS9JOOedrSlBLeiX74zICTx9l/ogHIvar - oyR9/w28as1z3kdFFAACkxGoDrWsz0kGqhEBXGOOnKRQeXi16Wyq/ZOkZwrDs+ZaOCj0 - Np0K2VryzXH+5acK/T8VFyaO/kiwyVE+oBQ9+t4QRslHCVoK+vniJFjWJmyiLbcrR+VF - Ug3g== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1724247718; x=1724852518; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=cqF2st4G7Whhok3VZo6aDGC//+kV3J+exZKhkiiSLFQ=; - b=luGrCmqihUFezhJWv4e5vJ9xNHo14vlaEyeUAxelx59D64ZJJ1t0Wp71nzKQ4MjeF1 - +a5ZoV7GeqYCdriLcYtSAm+mGfHYq6wqLK7MUxTJJXQiQ+8YNOE8O5jZPRQOnykhrHyv - SGgBu95T4t2+iops0PoEG1WJgUFfQdguMeIxCF/3egeF2vbuiLdkag3f/P1oZ+WId9d8 - CdjoDP22VLYkI737XGw5dPYXjw8n5aElyW4w8a8+s/+LSHr2DqhP6jBRBHoEr96u9caD - MD/ZJMxHUIF5HVF49slrJCvxOVaE1BLLfvGg6DsgTGbiJ1R04nnqmP4eIiihjxGfokAz - ayDA== -X-Gm-Message-State: AOJu0YyYd+xZ/CF0vx8K/xUigIplSGcNj9+ZYg92++5jyNrmeP/Dw2mb - YdY8603ttFOxzF77F9uZemMCCMk9Yqe06DIg4zk9AmmXVSdjOM16xI4mPU3kNko= -X-Google-Smtp-Source: - AGHT+IEiWiQ2+rnq9ygkkGwKWRO1l7vPXtE6nv9tq+GTkhXNeXOlV9Q+YJri22fWRmcjXR32eVPTAg== -X-Received: by 2002:a05:6512:696:b0:52e:f77b:bb58 with SMTP id - 2adb3069b0e04-5334858e2dbmr1246801e87.36.1724247718271; - Wed, 21 Aug 2024 06:41:58 -0700 (PDT) -Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) - by smtp.gmail.com with ESMTPSA id - a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.57 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 21 Aug 2024 06:41:57 -0700 (PDT) -From: Caleb Connolly -Date: Wed, 21 Aug 2024 15:41:49 +0200 -Subject: [PATCH v2 4/7] iommu: qcom-smmu: add sc7280-smmu-500 compatible -MIME-Version: 1.0 -Message-Id: <20240821-b4-rb3gen2-v2-4-49b07633f3a8@linaro.org> -References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -To: Tom Rini , Lukasz Majewski , - Sean Anderson , - Caleb Connolly , - Neil Armstrong , - Sumit Garg -Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io -X-Mailer: b4 0.14-dev -X-Developer-Signature: v=1; a=openpgp-sha256; l=735; - i=caleb.connolly@linaro.org; h=from:subject:message-id; - bh=kxKBScKaYeuETfEZtkdyvgk1CIJk9dkzDtE1GYwaPOI=; - b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6dVYUKBuKYzxniyjNVxYEoPmLImzpJJVKSN - fZ8OGllgq+JAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k - thhHD/sEX0G2aVw1Y8dD02U8Fg111EK/PNvDyUlifhchP/sTDJHxyzWJc0zxsb1FtSosTWlnv1i - tgFSLVCLklzMwrcUCZb5Fe/9bWGRL6Uz0dEbDXZohGWagR4SC9MoM/shyb6R7Xm2ywwaR1dBkHM - alh2af0YAoJi0TljeQz70GlUCBAyLiLhLD9/V7JDfkdAgUj1R7tGibGbz7plVk1ySD/JUbXLyRD - Oj3l66FUGleJAA+KrvbPR5sVcA8Zt+Mak0xp5xyjQ0T8TUNfwJF0VUgWEpiVHWZGPgOgw2OnE5U - Iv4mBGteHGHC0WjCdjt/thyn2+QCx/LjPwrBDrsyw6FFyg43yWEmDkEgfCiTDSHMtTMSPLvYbXM - b00Egv5OZrrhIGahpHxdd2Ui/6zicLanexZopGSaMu4DnMnhfm7GGdRxNphtP9VMWwgy+vePa+a - ghVuG+oIgtIOoEwE/SN2zBpMIxLNuzTi3c80xsxh6uA+5VH9X937eNFlB0fouXJjG27Jo4NSbKL - oeSE2rLXYtJ2bCV0ee7E5InyvUsdzHynjewLM0usEvnFHn433yCibXdQ1VjAZJVOJlFwxt85evc - Y/3ckT+iau+N7Z8un7Vhsp2FKf/IR5/QGd1NrfOyZuZ4V3ojqtD71Hymz1874HoW492BdpUytut - 5WHbOvM4jWAm5dQ== -X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; - fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 -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 - -This soc doesn't have the generic compatible. - -Reviewed-by: Neil Armstrong -Signed-off-by: Caleb Connolly -Reviewed-by: Simon Glass ---- - drivers/iommu/qcom-hyp-smmu.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/iommu/qcom-hyp-smmu.c b/drivers/iommu/qcom-hyp-smmu.c -index 7b646d840dd4..1b5a09bb7b39 100644 ---- a/drivers/iommu/qcom-hyp-smmu.c -+++ b/drivers/iommu/qcom-hyp-smmu.c -@@ -380,8 +380,9 @@ static struct iommu_ops qcom_smmu_ops = { - }; - - static const struct udevice_id qcom_smmu500_ids[] = { - { .compatible = "qcom,sdm845-smmu-500" }, -+ { .compatible = "qcom,sc7280-smmu-500" }, - { .compatible = "qcom,smmu-500", }, - { /* sentinel */ } - }; - - -From patchwork Wed Aug 21 13:41:50 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Caleb Connolly -X-Patchwork-Id: 1974974 -X-Patchwork-Delegate: caleb.connolly@linaro.org -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=yOMaz64l; - 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) server-digest SHA384) - (No client certificate requested) - by legolas.ozlabs.org (Postfix) with ESMTPS id 4Wpnb85tThz1yXf - for ; Wed, 21 Aug 2024 23:43:00 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 6572A88DE5; - Wed, 21 Aug 2024 15:42:04 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="yOMaz64l"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 47E5388AFF; Wed, 21 Aug 2024 15:42: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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com - [IPv6:2a00:1450:4864:20::62b]) - (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 2E9D188C36 - for ; Wed, 21 Aug 2024 15:42:00 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=caleb.connolly@linaro.org -Received: by mail-ej1-x62b.google.com with SMTP id - a640c23a62f3a-a7a81bd549eso556008566b.3 - for ; Wed, 21 Aug 2024 06:42:00 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1724247719; x=1724852519; darn=lists.denx.de; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:from:to:cc:subject:date:message-id - :reply-to; bh=VGpHi3k7vxgehhynkHpyKJwxi4oKfB4A2A00OXKPkFQ=; - b=yOMaz64lma1hQ0+Gt5CgMdElox51jZtnVyBitVGl6NvVmTuRWyklxImOrmwqsD3xYC - LGVcaLqh6/Q1W84/a/VQjQXnjBnf7rwjs1wqMs2mxBSvIXqX84EaEYJsYQK255NuFmeY - NXA0Iw/mLc/lgHAufmAUkAE02OVXH7AAyOjuEUceM/a6s9P5xPF82ucP7uH1adqOkAZQ - MTmKJK30kZjuhrZasD0UafyDCfMinXHhHFqlIcrhxmitRK4qDTzbktP/Atn3wfIJpVyh - Zbfra3N7AwxLidGI4lgrZSdfJWx7xo7f78GLzrxxtf9EQNN97axpLHFCTql16lK6z8qx - 3Psg== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1724247719; x=1724852519; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=VGpHi3k7vxgehhynkHpyKJwxi4oKfB4A2A00OXKPkFQ=; - b=wjTgODezMYlCn5sKcCnnp1Vd0OLBd5uCD0eBpdaJdRReSR2EsRO7RyUqvKoOvz7NPc - O7v24bEyP8vKrldHxpNvN9R6RqnobFMDUq1urWi4ObeXiFLrgH/iVa6h8fQXs239YyyD - x2v2ZGzHy5LuWMQItcPDAfgV1NMl9e9Whd1LOS9mJBgHAuX64ve4uf3jQhpIAG52PGNG - PqZklpeuYNZrK/gG7RZSuSUlrHkd3f3UF6b7jqC16TpwDc+4RuW5vF35uLCqnjMjHRPK - jxAj6zbq1QxznhNSLn6wMt4SHd44YvPRET9SWyLNJ69jL8f3LA+/2vyrgQdg3UYIUTaf - WunQ== -X-Gm-Message-State: AOJu0YyYxzvh/Kq2TnmE45KUz4jNc/HfUkc2DCE5IqW05whgtX84/Uou - QvsSOrpkiSoyoRX00nQTJ6PEghMnyz/il1CvQOq6oIHOYo7ZMLMN86AVf2+SA9g= -X-Google-Smtp-Source: - AGHT+IF2/DupIr7S3Tf/n9l6fXvTAbuD5E3nSTqZnLUH17vrwUpiB2tHgdlyQp8XysNBhZpXN+tPXA== -X-Received: by 2002:a17:907:d864:b0:a86:6cb1:4d49 with SMTP id - a640c23a62f3a-a866f0fd56emr197816466b.13.1724247719583; - Wed, 21 Aug 2024 06:41:59 -0700 (PDT) -Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) - by smtp.gmail.com with ESMTPSA id - a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.58 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 21 Aug 2024 06:41:58 -0700 (PDT) -From: Caleb Connolly -Date: Wed, 21 Aug 2024 15:41:50 +0200 -Subject: [PATCH v2 5/7] qcom_defconfig: enable SC7280 clocks -MIME-Version: 1.0 -Message-Id: <20240821-b4-rb3gen2-v2-5-49b07633f3a8@linaro.org> -References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -To: Tom Rini , Lukasz Majewski , - Sean Anderson , - Caleb Connolly , - Neil Armstrong , - Sumit Garg -Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io -X-Mailer: b4 0.14-dev -X-Developer-Signature: v=1; a=openpgp-sha256; l=670; - i=caleb.connolly@linaro.org; h=from:subject:message-id; - bh=yS4s6QOgfiWQfzfc4REiZuaFQ3cRc+UaGAPzZhg/0tY=; - b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6dlBkL0sqAHkV82+rSk3ED8IQyQvi4gHZz1 - YfE45yCF8SJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXunQAKCRAFgzErGV9k - trAoD/9/6KH2Cobld2UEMHFj+Lh80HJIGWdNHdhodfzYtlvCFU8pC/pmYwgBd9Opd24rU+Xh7dU - 8f+9HBKcRKgLmbuUy1fAn84B+kgl/IJtVeHpaP6LRp12NuJudZYl+woPx3mAgz9Wqv/+74nKYok - lVr1q9hbq4ZuMItcuzU5fWoyh7iC3th7KYUhh6939F1PQ8FFeF/5+9jJpRBMpuNZPFETxhlBTwY - YDXZL75cWg6ImurwaM4Hj1zQpHnR8V8HDa5GTTDNMxHOBFYCL+cJ3Bfd0FjqXFsL2/zjefqsewa - 0rWWQPMC8az8WvyczZAvB5JTq+M3VbP7kEWemCdedXmHiJ33dO6+jabm0ikvLooz1z7G6rlwZxZ - P7Rgc3ewW+RHOYbVYFLRKCdFVOFtiwOcEke50gPqQr/sbz0p39olzaE+D8WdNvgjW2uBRzLJDnR - EqyAYWncrWyAANXM3RSiICge87zZ/l4iUb8t8qm/8dYAs8KgPk6YNYVgLxtQqfVFNqnkHlmyy43 - 82JCgSSVggB9phNSVn/poUjlMlaImqGWB+zHDgf968J0a7mz/uFRgVgb8cjuG/Y5oX0xhNMkfqW - 2VymGoOrNlNvBNHyYEoEWgOMRiPvB/lL7PwbM9FFXmNyMMkx6FkzFgyopVkSWvCzKZQfgwBaUev - z00CkhnUndrSe5w== -X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; - fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 -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 - -Enable clocks on SC7280 - -Reviewed-by: Neil Armstrong -Signed-off-by: Caleb Connolly -Reviewed-by: Simon Glass ---- - configs/qcom_defconfig | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/configs/qcom_defconfig b/configs/qcom_defconfig -index 24b71ba7be29..1a079264a554 100644 ---- a/configs/qcom_defconfig -+++ b/configs/qcom_defconfig -@@ -44,8 +44,9 @@ CONFIG_CLK=y - CONFIG_CLK_QCOM_APQ8016=y - CONFIG_CLK_QCOM_APQ8096=y - CONFIG_CLK_QCOM_QCM2290=y - CONFIG_CLK_QCOM_QCS404=y -+CONFIG_CLK_QCOM_SC7280=y - CONFIG_CLK_QCOM_SDM845=y - CONFIG_CLK_QCOM_SM6115=y - CONFIG_CLK_QCOM_SM8250=y - CONFIG_CLK_QCOM_SM8550=y - -From patchwork Wed Aug 21 13:41:51 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Caleb Connolly -X-Patchwork-Id: 1974975 -X-Patchwork-Delegate: caleb.connolly@linaro.org -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=K30ji2S3; - 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 4WpnbM59VXz1yXf - for ; Wed, 21 Aug 2024 23:43:11 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id D2D6288C25; - Wed, 21 Aug 2024 15:42:06 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="K30ji2S3"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 9300088DD4; Wed, 21 Aug 2024 15:42:03 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com - [IPv6:2a00:1450:4864:20::62f]) - (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 3E8D188DBE - for ; Wed, 21 Aug 2024 15:42:01 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=caleb.connolly@linaro.org -Received: by mail-ej1-x62f.google.com with SMTP id - a640c23a62f3a-a7a94478a4eso147841366b.1 - for ; Wed, 21 Aug 2024 06:42:01 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1724247721; x=1724852521; darn=lists.denx.de; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:from:to:cc:subject:date:message-id - :reply-to; bh=yPrDPgQU7/bvZow9laSNg4WMEx5CRzVugf/oAUblCT4=; - b=K30ji2S3yioeE5/M0vSF0qrx1STvg5+c45nG5Kg+dcjyT1GMIsiX0GbpHc8+aTeWpp - Bd16xS5DE9TAuA1s2WmMq1TNdKHCyyx3MSSHMP9S9SctgsZSxIypHfGf7m6duOmEf5I8 - HBAumCuGiHTW3NkqIl8H2yZjkAbajsM1Q98+NyYJskO8owlNVyczk44QEbJ16Jtmntq6 - u+v7SADVhB3LrWu30OOWnwu/Z/9TVapcDx+ZAGflSfCy5P54TgqYIRYrBtjn9huobmaJ - XJED4Ak8A7iJHUQ5Savv+T4lTPHHfD+J+1NZDr1ciKMujXdnFUuZYcUZLoAn0PHLVsDD - +S6A== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1724247721; x=1724852521; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=yPrDPgQU7/bvZow9laSNg4WMEx5CRzVugf/oAUblCT4=; - b=RTxkaBLhQgRZeSdTWakNQdltrcGw4Cw+6Jge9dwNM3Q/YJMSuM1z7N2JGOntXjHxD2 - NZzz61S7FHFOOjYJoubSodORxK53ddoKFuwUvxurdOy+9Y67fPtAweqdd8NJnDdvBrEh - 35wnkzs6ItOpaYe1StAVW06cFPwhqK7ajV3yVdoyKwzCfp8oTYHC5QFJUhi0EM4KnF97 - HepCXvJdv+Qm1/hOVJu19Y6L2RKwXEWztyS53XVwtLOeyKO5x4Qk4PuhnZEAcGkT5lBB - 0kaoF4zSuIX8CVYMJ4oa/4TJg/epJPEtpdDjPDJ2KEWVWbay4/E7PLlgi/tDNndUgOGI - 5vvw== -X-Gm-Message-State: AOJu0Ywpr+aZcIll1/M3ZGdzXawgIEMgRfu4GacRerzZeNne6pIDfvz0 - FBjk4XnDaPXHLxU60pO20RaUjuXG+96oqxwOdmGkP/6Hf3yiMbOJc/ikC/obqxQ= -X-Google-Smtp-Source: - AGHT+IFBBHXs1fwWXLXlqsclsjPN/CITy3andQbbeClu6l28M7g0bUERMexbKgeMqQwwLkcBMwvMRA== -X-Received: by 2002:a17:907:1b2a:b0:a86:668a:8b28 with SMTP id - a640c23a62f3a-a8670182bd0mr296134266b.30.1724247720548; - Wed, 21 Aug 2024 06:42:00 -0700 (PDT) -Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) - by smtp.gmail.com with ESMTPSA id - a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.41.59 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 21 Aug 2024 06:42:00 -0700 (PDT) -From: Caleb Connolly -Date: Wed, 21 Aug 2024 15:41:51 +0200 -Subject: [PATCH v2 6/7] configs: add qcm6490_defconfig -MIME-Version: 1.0 -Message-Id: <20240821-b4-rb3gen2-v2-6-49b07633f3a8@linaro.org> -References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -To: Tom Rini , Lukasz Majewski , - Sean Anderson , - Caleb Connolly , - Neil Armstrong , - Sumit Garg -Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io -X-Mailer: b4 0.14-dev -X-Developer-Signature: v=1; a=openpgp-sha256; l=1579; - i=caleb.connolly@linaro.org; h=from:subject:message-id; - bh=ACfbGsu6Qfhpulh7cWGr4R2PHD6f1xBOaMcu/oMTV/k=; - b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6eltJAuAi418HOLC6BvAwvNrE6K+OD4tmaU - 8Agtuwf3TuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXungAKCRAFgzErGV9k - tp2fD/4izqkO8vl46KJDMg5exEAzqayxPJyZcBnhIQyekkEfHowP0Hnr0xDZqbYbl6BAapt+ZBA - 237lBMrvuWc45PJO228GrtQw+7AcU8UqYXvy0mhiS+xUJHhirFotdPZX8jly9sRdw54SUINx7vl - HThC3BXeYgmzugZXoSGA3Dw/d8NZXgf5aCjqXW/pIMBWK4RB/4r84gPQG3dgNT12yTVuNtN81ng - 7UMKgDHnK5kaXNh630td4ZmmJQ2jhUU/DShNLmKJnpe67xiK6DjHJiQqgqqj2ZZ38qvlRRpNYgx - 0iwUSyvlnNrB6dHAyzgUjMFaqxReb+rJKvr7+k9YB1dbmysbh9MM3WlWKmf9P39qLjJp1zBwd5z - 9lolc/k+9FT0hziFLDd1sMPQ0oBSZQQNFxZCEtncn387cDFCvJb/nUZnyt6XVzimfnSfssBGQ/g - A04MCaVXei5UeDZHc2kuv4yi7bWWnN3hZVdkoSHMe5esd0cYlVmz2tBkPzTDWIckquNRo/2dWyE - k5yQoqRVqg/V1GTE0f3B9aL/diPmJdYp+Z2FAAihFEUEOAKSPr+BfGIm2bNoMHUUQRGecjNoitg - qLmRTfs21gQs6x1ZivJ1tm3WGl2u+FUm9uuyYwB0bGnXasAzIBB+F4K2AL3dcULGf3Au2Q4w7Y1 - ULXtGjABlmE9Z5w== -X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; - fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 -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 - -Introduce a defconfig for the RB3 Gen 2 and other QCM6490 boards with a -dedicated uefi partition. These can replace EDK2 entirely with U-Boot. - -Signed-off-by: Caleb Connolly -Reviewed-by: Simon Glass ---- - MAINTAINERS | 1 + - configs/qcm6490_defconfig | 18 ++++++++++++++++++ - 2 files changed, 19 insertions(+) - -diff --git a/MAINTAINERS b/MAINTAINERS -index daaf0345d0e8..7ab39d91a553 100644 ---- a/MAINTAINERS -+++ b/MAINTAINERS -@@ -616,8 +616,9 @@ M: Neil Armstrong - R: Sumit Garg - L: u-boot-qcom@groups.io - S: Maintained - T: git https://source.denx.de/u-boot/custodians/u-boot-snapdragon.git -+F: configs/qcm6490_defconfig - F: drivers/*/*/pm8???-* - F: drivers/gpio/msm_gpio.c - F: drivers/mmc/msm_sdhci.c - F: drivers/phy/msm8916-usbh-phy.c -diff --git a/configs/qcm6490_defconfig b/configs/qcm6490_defconfig -new file mode 100644 -index 000000000000..25413ac9ed5a ---- /dev/null -+++ b/configs/qcm6490_defconfig -@@ -0,0 +1,18 @@ -+# Configuration for building U-Boot to be flashed -+# to the uefi partition of QCM6490 dev boards with -+# the "Linux Embedded" partition layout (which have -+# a dedicated "uefi" partition for edk2/U-Boot) -+ -+#include "qcom_defconfig" -+ -+CONFIG_DEBUG_UART=y -+CONFIG_DEBUG_UART_ANNOUNCE=y -+CONFIG_DEBUG_UART_BASE=0x994000 -+CONFIG_DEBUG_UART_MSM_GENI=y -+CONFIG_DEBUG_UART_CLOCK=14745600 -+ -+# Address where U-Boot will be loaded -+CONFIG_TEXT_BASE=0x9fc00000 -+CONFIG_REMAKE_ELF=y -+ -+CONFIG_DEFAULT_DEVICE_TREE="qcom/qcs6490-rb3gen2" - -From patchwork Wed Aug 21 13:41:52 2024 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Caleb Connolly -X-Patchwork-Id: 1974976 -X-Patchwork-Delegate: caleb.connolly@linaro.org -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=linaro.org header.i=@linaro.org header.a=rsa-sha256 - header.s=google header.b=N7ncWeh3; - 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 4Wpnbc6Cbtz1yXf - for ; Wed, 21 Aug 2024 23:43:24 +1000 (AEST) -Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) - by phobos.denx.de (Postfix) with ESMTP id 3D6FC88C7E; - Wed, 21 Aug 2024 15:42:07 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -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=linaro.org header.i=@linaro.org header.b="N7ncWeh3"; - dkim-atps=neutral -Received: by phobos.denx.de (Postfix, from userid 109) - id 78A2D88BF6; Wed, 21 Aug 2024 15:42:05 +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,DKIM_SIGNED, - DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, - T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 -Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com - [IPv6:2a00:1450:4864:20::22a]) - (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 0804988BBC - for ; Wed, 21 Aug 2024 15:42:02 +0200 (CEST) -Authentication-Results: phobos.denx.de; - dmarc=pass (p=none dis=none) header.from=linaro.org -Authentication-Results: phobos.denx.de; - spf=pass smtp.mailfrom=caleb.connolly@linaro.org -Received: by mail-lj1-x22a.google.com with SMTP id - 38308e7fff4ca-2f3bfcc2727so47717401fa.0 - for ; Wed, 21 Aug 2024 06:42:02 -0700 (PDT) -DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=linaro.org; s=google; t=1724247722; x=1724852522; darn=lists.denx.de; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:from:to:cc:subject:date:message-id - :reply-to; bh=IvOluZPLzD78/HF1gfteCSftNGDnvO7+RNQKT4a8rSE=; - b=N7ncWeh3cbNIFm16gC0ycocqUu7FjIH/X5KUs3ng3VOMDiDB9bx6yqvhqYvjQxyBc0 - NtX/AEn+6kLdyYda7FlKDaCMV9zQy5kNC993I5rZ4A9iW9QyJTuwBSzH7qa4sO6gQ1ol - 8Lo1+ZJhhBum9Ni+61giewvGR09iEusCmwVImeU5GAZaibju4E3OPBByXLzP8iW1CXee - Td0YEp/5GqF/suNSfz0LIe3u7qAf4ym1XGfXSuoSZTlAKYusX8Hr8p7r6eeQe98FId8k - K8EtjvWCpjafWWcaMyS2hMQJ9qVg2oN+O0BWIVzab1rmcZfKqTsdCdRmT5zJ8/UuskiJ - ovww== -X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; - d=1e100.net; s=20230601; t=1724247722; x=1724852522; - h=cc:to:in-reply-to:references:message-id:content-transfer-encoding - :mime-version:subject:date:from:x-gm-message-state:from:to:cc - :subject:date:message-id:reply-to; - bh=IvOluZPLzD78/HF1gfteCSftNGDnvO7+RNQKT4a8rSE=; - b=irJmZUIlQ9YqUetM6kgCgWcp0L2t2cRcBdc7BANQ6GSkyblKM0IhcjmShs/YQLTvfD - kcy+qKFJUBLqwl/GS2t28MNGXs5+jyhkJJtmlWXg0jksArLnCgxQNWggqkJHxHr4QXWm - yQUR1tfzoSdEPgisANBnh6pIR2x4I+INopwPke0bJOnMgq6gauZ6e7Sb5DK8+XfB+ub7 - 4BwZrBRNSgdQL4GZy7yJ7/tDy+Rb77CKeC82GlbeYSYWjhnyNHiApHXii7b3P9K1dIpH - TuIXX+CoDUWK9SpsTDPZQ9TKah8sMs4lll+6bxADx28pav2gXGoDzIq8+8njC4mnAW8D - QRKA== -X-Gm-Message-State: AOJu0YxQDsjOdfe21vx3pm9NQzQM6F9uuV8kmavTQJuc2Dc6UIFEBXIw - Yp6RPVVelZ9sExmiTtDcpYm6jM3fkV9MKKhMmd5jCa8HvsIjbjln6JXyuICIMFA= -X-Google-Smtp-Source: - AGHT+IFOXObF674O6U9t5YWoWgiOsh1cr3c2B3a47ilhjVWpLEAWrw7hptc9n6o8T5A7NFea+26OwA== -X-Received: by 2002:a05:6512:118f:b0:52f:d17e:46b with SMTP id - 2adb3069b0e04-533485eff58mr1798728e87.54.1724247721704; - Wed, 21 Aug 2024 06:42:01 -0700 (PDT) -Received: from [192.168.0.113] ([2a02:8109:aa0d:be00::676e]) - by smtp.gmail.com with ESMTPSA id - a640c23a62f3a-a83839342f6sm904164066b.137.2024.08.21.06.42.00 - (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); - Wed, 21 Aug 2024 06:42:01 -0700 (PDT) -From: Caleb Connolly -Date: Wed, 21 Aug 2024 15:41:52 +0200 -Subject: [PATCH v2 7/7] doc: board/qualcomm: document rb3gen2 - building/flashing -MIME-Version: 1.0 -Message-Id: <20240821-b4-rb3gen2-v2-7-49b07633f3a8@linaro.org> -References: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -In-Reply-To: <20240821-b4-rb3gen2-v2-0-49b07633f3a8@linaro.org> -To: Tom Rini , Lukasz Majewski , - Sean Anderson , - Caleb Connolly , - Neil Armstrong , - Sumit Garg -Cc: u-boot@lists.denx.de, u-boot-qcom@groups.io -X-Mailer: b4 0.14-dev -X-Developer-Signature: v=1; a=openpgp-sha256; l=3002; - i=caleb.connolly@linaro.org; h=from:subject:message-id; - bh=Zfbm5IKZooOMQaYWVdjsboSGnZBH9tpLor1DsgqeCLA=; - b=owEBbQKS/ZANAwAIAQWDMSsZX2S2AcsmYgBmxe6eOpavbRRq/Mmd1u2iOzwt3wx46uoOvpDbB - SjdW6jqdcuJAjMEAAEIAB0WIQS2UaFGPGq+0GkMVc0FgzErGV9ktgUCZsXungAKCRAFgzErGV9k - th2IEACXQhOGwtEPSr0Jpv9CdMJZvP6O7/us/hUgF9Bir4ETF1KQoReZ18goCIPH2bfLWQIT4eN - CS7gQ46J/jZfFKYl2ORIB7BUUfe58/nB4VvbfGfmskbHi4sdVSemgHxu04xNtj1ttCaiVKX58D5 - GLThMjr4w80H1RLlEnlJmDf8RC/bp6PPHv1a9f0mDH3y00HDTJInV1+p8Bp5T/foomvjYfdcB86 - okdAJzhvNDYeA+xQxp5zTAzDoGI1K/5NYiLyqYoNzpb2sVBTjEBl6fiQqZ6q9b6TWoP5H64s3VC - OsD4ZgATKSXgEYuNYGx5XwDd66lN31jnu4BRhav643sBpOwpN/UN3cLVeqHbD5K3QiI6j+afC7w - o1QNNxNE9pBp3ZBWWWWFbbOv+rwy5npvZHZKWUSNC21l2/4hI6XwAFLDlu5nm+yQ+fYdb4HnMc0 - 1kGJhpGz0/guwKXxpSVxijQT5lFbr81ADvFLzoRD33x8EnbG4aFGa6PhIU+H/9TNpDOaDWHQdIb - 18rqauYLxwejAvFKDC8EIWM9n+6Qkn8caR37H11EnKkNX15ZRKn3Oiv7n8Wy6CukVoFquvjL4IU - t/2E8nV32ksuehndbsDXnpRpSAefggkQ9TjkuGaV29j0nvSrlJiCud0Dzj0lTdjxBvJKpaXG7XN - YCCZ/x5nTtnxdyg== -X-Developer-Key: i=caleb.connolly@linaro.org; a=openpgp; - fpr=83B24DA7FE145076BC38BB250CD904EB673A7C47 -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 process here is almost identical to the Dragonboard 410c, we've come -full circle! - -Signed-off-by: Caleb Connolly -Reviewed-by: Simon Glass ---- - doc/board/qualcomm/index.rst | 1 + - doc/board/qualcomm/rb3gen2.rst | 53 ++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 54 insertions(+) - -diff --git a/doc/board/qualcomm/index.rst b/doc/board/qualcomm/index.rst -index 4955274a39bc..8c7969987a97 100644 ---- a/doc/board/qualcomm/index.rst -+++ b/doc/board/qualcomm/index.rst -@@ -6,6 +6,7 @@ Qualcomm - .. toctree:: - :maxdepth: 2 - - dragonboard410c -+ rb3gen2 - board - debugging -diff --git a/doc/board/qualcomm/rb3gen2.rst b/doc/board/qualcomm/rb3gen2.rst -new file mode 100644 -index 000000000000..4240606224f5 ---- /dev/null -+++ b/doc/board/qualcomm/rb3gen2.rst -@@ -0,0 +1,53 @@ -+.. SPDX-License-Identifier: GPL-2.0+ -+.. sectionauthor:: Caleb Connolly -+ -+Qualcomm Robotics RB3 Gen 2 -+=========================== -+ -+The RB3 Gen 2 is a development board based on the Qualcomm QCM6490 SoC (a derivative -+of SC7280). More information can be found on `Qualcomm's product page`_. -+ -+U-Boot can be used as a replacement for Qualcomm's original EDK2 bootloader by -+flashing it directly to the uefi_a (or _b) partition. -+ -+.. _Qualcomm's product page: https://www.qualcomm.com/developer/hardware/rb3-gen-2-development-kit -+ -+Installation -+------------ -+First, setup ``CROSS_COMPILE`` for aarch64. Then, build U-Boot for ``qcm6490``:: -+ -+ $ export CROSS_COMPILE= -+ $ make qcm6490_defconfig -+ $ make -j8 -+ -+This will build ``u-boot.elf`` in the configured output directory. -+ -+Although the RB3 Gen 2 does not have secure boot set up by default, -+the firmware still expects firmware ELF images to be "signed". The signature -+does not provide any security in this case, but it provides the firmware with -+some required metadata. -+ -+To "sign" ``u-boot.elf`` you can use e.g. `qtestsign`_:: -+ -+ $ qtestsign -v6 aboot -o u-boot.mbn u-boot.elf -+ -+Then install the resulting ``u-boot.mbn`` to the ``uefi_a`` partition -+on your device with ``fastboot flash uefi_a u-boot.mbn``. -+ -+U-Boot should be running after a reboot (``fastboot reboot``). -+ -+Note that fastboot is not yet supported in U-Boot on this board, as a result, -+to flash back the original firmware, or new versoins of the U-Boot, EDL mode -+must be used. This can be accessed by pressing the EDL mode button as described -+in the Qualcomm Linux documentation. A tool like bkerler's `edl`_ can be used -+for flashing with the firehose loader binary appropriate for the board. -+ -+.. _qtestsign: https://github.com/msm8916-mainline/qtestsign -+.. _edl: https://github.com/bkerler/edl -+ -+Usage -+----- -+ -+The USB Type-A ports are connected via a PCIe USB hub, which is not supported yet. -+However, the Type-C port can be used with a powered USB dock to connect peripherals -+like a USB stick. diff --git a/aarch64-boards b/aarch64-boards index 0530e42..b66a8a6 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -44,6 +44,7 @@ nanopi_neo_plus2 nanopi_r1s_h5 nanopi-r2c-plus-rk3328 nanopi-r2c-rk3328 +nanopi-r2s-plus-rk3328 nanopi-r2s-rk3328 nanopi-r4s-rk3399 oceanic_5205_5inmfd @@ -79,6 +80,7 @@ puma-rk3399 qcm6490 qcom qemu_arm64 +qemu_arm64_lwip roc-cc-rk3328 rock-4c-plus-rk3399 rock-4se-rk3399 diff --git a/rockchip-Enable-preboot-start-for-pci-usb.patch b/rockchip-Enable-preboot-start-for-pci-usb.patch index 0542ab0..64e6883 100644 --- a/rockchip-Enable-preboot-start-for-pci-usb.patch +++ b/rockchip-Enable-preboot-start-for-pci-usb.patch @@ -1,177 +1,10 @@ -From 3665ff79304fcb47427651125ccc2cfac01cb9f1 Mon Sep 17 00:00:00 2001 +From 020f67a37342b091c74dab93a133253401d4d899 Mon Sep 17 00:00:00 2001 From: Peter Robinson -Date: Sat, 25 May 2024 12:23:42 +0100 +Date: Tue, 31 Dec 2024 14:15:41 +0000 Subject: [PATCH] rockchip: Enable preboot start for pci/usb Enable the preboot so nvme works OOTB -Signed-off-by: Peter Robinson ---- - configs/firefly-rk3399_defconfig | 2 ++ - configs/nanopc-t4-rk3399_defconfig | 2 ++ - configs/pinebook-pro-rk3399_defconfig | 1 + - configs/roc-pc-mezzanine-rk3399_defconfig | 2 ++ - configs/rock-4c-plus-rk3399_defconfig | 2 ++ - configs/rock-4se-rk3399_defconfig | 2 ++ - configs/rock-pi-4-rk3399_defconfig | 2 ++ - configs/rock-pi-4c-rk3399_defconfig | 2 ++ - configs/rock-pi-n10-rk3399pro_defconfig | 2 ++ - configs/rock960-rk3399_defconfig | 2 ++ - configs/rockpro64-rk3399_defconfig | 2 ++ - 11 files changed, 21 insertions(+) - -diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig -index edacef29edf..71db7b7834e 100644 ---- a/configs/firefly-rk3399_defconfig -+++ b/configs/firefly-rk3399_defconfig -@@ -14,6 +14,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-firefly.dtb" - CONFIG_DISPLAY_BOARDINFO_LATE=y - CONFIG_SPL_MAX_SIZE=0x40000 -diff --git a/configs/nanopc-t4-rk3399_defconfig b/configs/nanopc-t4-rk3399_defconfig -index c63f4c076d5..7174b82cfa4 100644 ---- a/configs/nanopc-t4-rk3399_defconfig -+++ b/configs/nanopc-t4-rk3399_defconfig -@@ -14,6 +14,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopc-t4.dtb" - CONFIG_DISPLAY_BOARDINFO_LATE=y - CONFIG_SPL_MAX_SIZE=0x40000 -diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig -index 5d3e32f9108..c9b3615f2ff 100644 ---- a/configs/pinebook-pro-rk3399_defconfig -+++ b/configs/pinebook-pro-rk3399_defconfig -@@ -21,6 +21,7 @@ CONFIG_PCI=y - CONFIG_DEBUG_UART=y - CONFIG_BOOTDELAY=3 - CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinebook-pro.dtb" - CONFIG_DISPLAY_BOARDINFO_LATE=y - CONFIG_SPL_MAX_SIZE=0x40000 -diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig -index a57899bfdfa..bd7030b237c 100644 ---- a/configs/roc-pc-mezzanine-rk3399_defconfig -+++ b/configs/roc-pc-mezzanine-rk3399_defconfig -@@ -20,6 +20,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - # CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb" - CONFIG_DISPLAY_BOARDINFO_LATE=y -diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig -index 80dc44986e7..0ff8afe8e1e 100644 ---- a/configs/rock-4c-plus-rk3399_defconfig -+++ b/configs/rock-4c-plus-rk3399_defconfig -@@ -16,6 +16,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y - CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - # CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-4c-plus.dtb" - CONFIG_DISPLAY_BOARDINFO_LATE=y -diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se-rk3399_defconfig -index f52d4bf9913..72ff304cff7 100644 ---- a/configs/rock-4se-rk3399_defconfig -+++ b/configs/rock-4se-rk3399_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_AHCI=y - # CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-4se.dtb" -diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig -index e71c4588b94..387dbf83be3 100644 ---- a/configs/rock-pi-4-rk3399_defconfig -+++ b/configs/rock-pi-4-rk3399_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_AHCI=y - # CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4a.dtb" -diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig -index 14373933a34..34e09eeccd2 100644 ---- a/configs/rock-pi-4c-rk3399_defconfig -+++ b/configs/rock-pi-4c-rk3399_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_AHCI=y - # CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock-pi-4c.dtb" -diff --git a/configs/rock-pi-n10-rk3399pro_defconfig b/configs/rock-pi-n10-rk3399pro_defconfig -index ec995a54a0e..1a973ea2c97 100644 ---- a/configs/rock-pi-n10-rk3399pro_defconfig -+++ b/configs/rock-pi-n10-rk3399pro_defconfig -@@ -13,6 +13,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - # CONFIG_ANDROID_BOOT_IMAGE is not set - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399pro-rock-pi-n10.dtb" - # CONFIG_CONSOLE_MUX is not set -diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig -index 8fff3ed17c2..ea6d6d4a319 100644 ---- a/configs/rock960-rk3399_defconfig -+++ b/configs/rock960-rk3399_defconfig -@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock960.dtb" - CONFIG_SYS_PBSIZE=1052 - CONFIG_DISPLAY_BOARDINFO_LATE=y -diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig -index fc0804a0b80..9a94d96b148 100644 ---- a/configs/rockpro64-rk3399_defconfig -+++ b/configs/rockpro64-rk3399_defconfig -@@ -19,6 +19,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0x800800 - CONFIG_PCI=y - CONFIG_DEBUG_UART=y -+CONFIG_USE_PREBOOT=y -+CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_BOOTSTAGE=y - CONFIG_BOOTSTAGE_REPORT=y - CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb" --- -2.45.1 - -From 5116720be74a92417c69229fc45a97502869ff9b Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Mon, 23 Sep 2024 19:51:00 +0100 -Subject: [PATCH] rockchip: rk35xx: Enable preboot start for pci/usb - -Enable the preboot so nvme works OOTB - Signed-off-by: Peter Robinson --- configs/anbernic-rgxx3-rk3566_defconfig | 2 ++ @@ -181,10 +14,12 @@ Signed-off-by: Peter Robinson configs/coolpi-cm5-evb-rk3588_defconfig | 2 ++ configs/evb-rk3568_defconfig | 2 ++ configs/evb-rk3588_defconfig | 2 ++ + configs/firefly-rk3399_defconfig | 2 ++ configs/generic-rk3568_defconfig | 2 ++ configs/generic-rk3588_defconfig | 2 ++ configs/jaguar-rk3588_defconfig | 2 ++ configs/lubancat-2-rk3568_defconfig | 2 ++ + configs/nanopc-t4-rk3399_defconfig | 2 ++ configs/nanopc-t6-rk3588_defconfig | 2 ++ configs/nanopi-r5c-rk3568_defconfig | 2 ++ configs/nanopi-r5s-rk3568_defconfig | 2 ++ @@ -197,6 +32,7 @@ Signed-off-by: Peter Robinson configs/orangepi-3b-rk3566_defconfig | 2 ++ configs/orangepi-5-plus-rk3588_defconfig | 2 ++ configs/orangepi-5-rk3588s_defconfig | 2 ++ + configs/pinebook-pro-rk3399_defconfig | 1 + configs/pinetab2-rk3566_defconfig | 2 ++ configs/powkiddy-x55-rk3566_defconfig | 2 ++ configs/quartz64-a-rk3566_defconfig | 2 ++ @@ -205,12 +41,20 @@ Signed-off-by: Peter Robinson configs/radxa-cm3-io-rk3566_defconfig | 2 ++ configs/radxa-e25-rk3568_defconfig | 2 ++ configs/radxa-zero-3-rk3566_defconfig | 2 ++ + configs/roc-pc-mezzanine-rk3399_defconfig | 2 ++ configs/rock-3a-rk3568_defconfig | 2 ++ configs/rock-3b-rk3568_defconfig | 2 ++ configs/rock-3c-rk3566_defconfig | 2 ++ + configs/rock-4c-plus-rk3399_defconfig | 2 ++ + configs/rock-4se-rk3399_defconfig | 2 ++ configs/rock-5-itx-rk3588_defconfig | 2 ++ + configs/rock-pi-4-rk3399_defconfig | 2 ++ + configs/rock-pi-4c-rk3399_defconfig | 2 ++ + configs/rock-pi-n10-rk3399pro_defconfig | 2 ++ configs/rock5a-rk3588s_defconfig | 2 ++ configs/rock5b-rk3588_defconfig | 2 ++ + configs/rock960-rk3399_defconfig | 2 ++ + configs/rockpro64-rk3399_defconfig | 2 ++ configs/sige7-rk3588_defconfig | 2 ++ configs/soquartz-blade-rk3566_defconfig | 2 ++ configs/soquartz-cm4-rk3566_defconfig | 2 ++ @@ -218,28 +62,28 @@ Signed-off-by: Peter Robinson configs/tiger-rk3588_defconfig | 2 ++ configs/toybrick-rk3588_defconfig | 2 ++ configs/turing-rk1-rk3588_defconfig | 2 ++ - 44 files changed, 88 insertions(+) + 55 files changed, 109 insertions(+) diff --git a/configs/anbernic-rgxx3-rk3566_defconfig b/configs/anbernic-rgxx3-rk3566_defconfig -index a03509bf467..45cfaf5deb7 100644 +index 14c97b4c5bf..de92e1b4141 100644 --- a/configs/anbernic-rgxx3-rk3566_defconfig +++ b/configs/anbernic-rgxx3-rk3566_defconfig -@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 +@@ -12,6 +12,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFE660000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_EFI_LOADER is not set CONFIG_FIT=y CONFIG_FIT_VERBOSE=y - CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/bpi-r2-pro-rk3568_defconfig b/configs/bpi-r2-pro-rk3568_defconfig -index eccc15a0ae5..57d4fafbef4 100644 +index d84ea2f955f..de777817c37 100644 --- a/configs/bpi-r2-pro-rk3568_defconfig +++ b/configs/bpi-r2-pro-rk3568_defconfig -@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 +@@ -9,6 +9,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFE660000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -247,11 +91,11 @@ index eccc15a0ae5..57d4fafbef4 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/cm3588-nas-rk3588_defconfig b/configs/cm3588-nas-rk3588_defconfig -index d6d82757a2d..7ef75dfedeb 100644 +index fd0a32d6d79..e561be511d4 100644 --- a/configs/cm3588-nas-rk3588_defconfig +++ b/configs/cm3588-nas-rk3588_defconfig -@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -260,11 +104,11 @@ index d6d82757a2d..7ef75dfedeb 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/coolpi-4b-rk3588s_defconfig b/configs/coolpi-4b-rk3588s_defconfig -index 3d45d939abb..6005d0b556b 100644 +index ea985b81670..96d7cffb075 100644 --- a/configs/coolpi-4b-rk3588s_defconfig +++ b/configs/coolpi-4b-rk3588s_defconfig -@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -273,11 +117,11 @@ index 3d45d939abb..6005d0b556b 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/coolpi-cm5-evb-rk3588_defconfig b/configs/coolpi-cm5-evb-rk3588_defconfig -index 5190d69c1c5..30f1690fe4d 100644 +index 58ffe7baf5f..5eadc091242 100644 --- a/configs/coolpi-cm5-evb-rk3588_defconfig +++ b/configs/coolpi-cm5-evb-rk3588_defconfig -@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -286,12 +130,12 @@ index 5190d69c1c5..30f1690fe4d 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/evb-rk3568_defconfig b/configs/evb-rk3568_defconfig -index 2076f55122b..543c1a7d6ba 100644 +index a068bc6846c..8c94f7b21bc 100644 --- a/configs/evb-rk3568_defconfig +++ b/configs/evb-rk3568_defconfig -@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 +@@ -9,6 +9,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFE660000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -299,25 +143,38 @@ index 2076f55122b..543c1a7d6ba 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/evb-rk3588_defconfig b/configs/evb-rk3588_defconfig -index 1d5585677a4..44ef0fd0f54 100644 +index 3d4d2747145..051015fd811 100644 --- a/configs/evb-rk3588_defconfig +++ b/configs/evb-rk3588_defconfig -@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 +@@ -10,6 +10,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFEB50000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/firefly-rk3399_defconfig b/configs/firefly-rk3399_defconfig +index 3871627318b..b96aadc78eb 100644 +--- a/configs/firefly-rk3399_defconfig ++++ b/configs/firefly-rk3399_defconfig +@@ -14,6 +14,8 @@ CONFIG_DEBUG_UART_BASE=0xFF1A0000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-firefly.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y + CONFIG_SPL_MAX_SIZE=0x40000 diff --git a/configs/generic-rk3568_defconfig b/configs/generic-rk3568_defconfig -index 66a33afbbaf..b1bfb831aa5 100644 +index f79f0e84400..ba5339a004f 100644 --- a/configs/generic-rk3568_defconfig +++ b/configs/generic-rk3568_defconfig -@@ -13,6 +13,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y +@@ -14,6 +14,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -325,12 +182,12 @@ index 66a33afbbaf..b1bfb831aa5 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/generic-rk3588_defconfig b/configs/generic-rk3588_defconfig -index 42bc2c9a765..6c713094bf0 100644 +index 51e31dce3a9..1c767caa06a 100644 --- a/configs/generic-rk3588_defconfig +++ b/configs/generic-rk3588_defconfig -@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 +@@ -10,6 +10,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFEB50000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -338,11 +195,11 @@ index 42bc2c9a765..6c713094bf0 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/jaguar-rk3588_defconfig b/configs/jaguar-rk3588_defconfig -index 18006467dde..a5d7612d9a5 100644 +index 6e853991d1d..a5a56a33d09 100644 --- a/configs/jaguar-rk3588_defconfig +++ b/configs/jaguar-rk3588_defconfig -@@ -15,6 +15,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -16,6 +16,8 @@ CONFIG_DEBUG_UART_BASE=0xfeb50000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -351,24 +208,37 @@ index 18006467dde..a5d7612d9a5 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/lubancat-2-rk3568_defconfig b/configs/lubancat-2-rk3568_defconfig -index 88593bfa705..870d8f72317 100644 +index 46cc3c03fff..8915d5bfba9 100644 --- a/configs/lubancat-2-rk3568_defconfig +++ b/configs/lubancat-2-rk3568_defconfig -@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 +@@ -9,6 +9,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFE660000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_EFI_VAR_BUF_SIZE=16384 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y - CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/nanopc-t4-rk3399_defconfig b/configs/nanopc-t4-rk3399_defconfig +index 26c12c51078..33f7e838c2c 100644 +--- a/configs/nanopc-t4-rk3399_defconfig ++++ b/configs/nanopc-t4-rk3399_defconfig +@@ -14,6 +14,8 @@ CONFIG_DEBUG_UART_BASE=0xFF1A0000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-nanopc-t4.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y + CONFIG_SPL_MAX_SIZE=0x40000 diff --git a/configs/nanopc-t6-rk3588_defconfig b/configs/nanopc-t6-rk3588_defconfig -index 926267f93ad..7b0ac43d8c1 100644 +index 772b7df1555..ba6cf48308c 100644 --- a/configs/nanopc-t6-rk3588_defconfig +++ b/configs/nanopc-t6-rk3588_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -377,11 +247,11 @@ index 926267f93ad..7b0ac43d8c1 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/nanopi-r5c-rk3568_defconfig b/configs/nanopi-r5c-rk3568_defconfig -index 8e30093ed9d..2c1d7b7435b 100644 +index 4a43b17ccb1..91c95b491d5 100644 --- a/configs/nanopi-r5c-rk3568_defconfig +++ b/configs/nanopi-r5c-rk3568_defconfig -@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -390,11 +260,11 @@ index 8e30093ed9d..2c1d7b7435b 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/nanopi-r5s-rk3568_defconfig b/configs/nanopi-r5s-rk3568_defconfig -index e1865b2e171..1afce812b22 100644 +index a60d229fbbf..355d8114a9b 100644 --- a/configs/nanopi-r5s-rk3568_defconfig +++ b/configs/nanopi-r5s-rk3568_defconfig -@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -403,11 +273,11 @@ index e1865b2e171..1afce812b22 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/nanopi-r6c-rk3588s_defconfig b/configs/nanopi-r6c-rk3588s_defconfig -index f8d2d67bd35..e6e9cf1101a 100644 +index c4de5518a72..92697c536d9 100644 --- a/configs/nanopi-r6c-rk3588s_defconfig +++ b/configs/nanopi-r6c-rk3588s_defconfig -@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -416,11 +286,11 @@ index f8d2d67bd35..e6e9cf1101a 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/nanopi-r6s-rk3588s_defconfig b/configs/nanopi-r6s-rk3588s_defconfig -index f7b364655ff..fd28485db93 100644 +index 2726729b9ac..63a3690db8e 100644 --- a/configs/nanopi-r6s-rk3588s_defconfig +++ b/configs/nanopi-r6s-rk3588s_defconfig -@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -429,12 +299,12 @@ index f7b364655ff..fd28485db93 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/neu6a-io-rk3588_defconfig b/configs/neu6a-io-rk3588_defconfig -index ac281e65392..3338f0a3160 100644 +index 291e0d26d42..e385aba7bc4 100644 --- a/configs/neu6a-io-rk3588_defconfig +++ b/configs/neu6a-io-rk3588_defconfig -@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 +@@ -10,6 +10,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFEB50000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -442,12 +312,12 @@ index ac281e65392..3338f0a3160 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/neu6b-io-rk3588_defconfig b/configs/neu6b-io-rk3588_defconfig -index c01e5fb0d04..73cc8e6d0ff 100644 +index 4e22852f23c..79f4e66cb9b 100644 --- a/configs/neu6b-io-rk3588_defconfig +++ b/configs/neu6b-io-rk3588_defconfig -@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 +@@ -10,6 +10,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFEB50000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -455,11 +325,11 @@ index c01e5fb0d04..73cc8e6d0ff 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/nova-rk3588s_defconfig b/configs/nova-rk3588s_defconfig -index a2e2440359c..45862f403fb 100644 +index fb30dfd1db8..e99898355e1 100644 --- a/configs/nova-rk3588s_defconfig +++ b/configs/nova-rk3588s_defconfig -@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -468,11 +338,11 @@ index a2e2440359c..45862f403fb 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/odroid-m1-rk3568_defconfig b/configs/odroid-m1-rk3568_defconfig -index b5263caff6d..a2217b530d1 100644 +index a8e8a8781e1..a3ea2e592b9 100644 --- a/configs/odroid-m1-rk3568_defconfig +++ b/configs/odroid-m1-rk3568_defconfig -@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -481,11 +351,11 @@ index b5263caff6d..a2217b530d1 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/orangepi-3b-rk3566_defconfig b/configs/orangepi-3b-rk3566_defconfig -index 575dc4340d3..817de7b69e6 100644 +index 2181c9caf58..fee0c719f25 100644 --- a/configs/orangepi-3b-rk3566_defconfig +++ b/configs/orangepi-3b-rk3566_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -494,11 +364,11 @@ index 575dc4340d3..817de7b69e6 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/orangepi-5-plus-rk3588_defconfig b/configs/orangepi-5-plus-rk3588_defconfig -index 138a633f320..e0aaa8dfb15 100644 +index 9050fceda45..2e1fe2c6dc5 100644 --- a/configs/orangepi-5-plus-rk3588_defconfig +++ b/configs/orangepi-5-plus-rk3588_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -507,11 +377,11 @@ index 138a633f320..e0aaa8dfb15 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/orangepi-5-rk3588s_defconfig b/configs/orangepi-5-rk3588s_defconfig -index 33529d4cac3..09d8475d051 100644 +index 6e2ff7d338a..7ec7d13e1f9 100644 --- a/configs/orangepi-5-rk3588s_defconfig +++ b/configs/orangepi-5-rk3588s_defconfig -@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -519,13 +389,25 @@ index 33529d4cac3..09d8475d051 100644 CONFIG_AHCI=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y +diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig +index dfa927ccb17..acc2a0a9fcd 100644 +--- a/configs/pinebook-pro-rk3399_defconfig ++++ b/configs/pinebook-pro-rk3399_defconfig +@@ -22,6 +22,7 @@ CONFIG_PCI=y + CONFIG_DEBUG_UART=y + CONFIG_BOOTDELAY=3 + CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-pinebook-pro.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y + CONFIG_SPL_MAX_SIZE=0x40000 diff --git a/configs/pinetab2-rk3566_defconfig b/configs/pinetab2-rk3566_defconfig -index 2d075d12174..fcb3c474044 100644 +index 45e63b42d19..3ef0ddbbe31 100644 --- a/configs/pinetab2-rk3566_defconfig +++ b/configs/pinetab2-rk3566_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y +@@ -18,6 +18,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -533,12 +415,12 @@ index 2d075d12174..fcb3c474044 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/powkiddy-x55-rk3566_defconfig b/configs/powkiddy-x55-rk3566_defconfig -index 2360bdbe84b..afb7f3ffafb 100644 +index 85280839889..f93a463087b 100644 --- a/configs/powkiddy-x55-rk3566_defconfig +++ b/configs/powkiddy-x55-rk3566_defconfig -@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 +@@ -9,6 +9,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFE660000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -546,11 +428,11 @@ index 2360bdbe84b..afb7f3ffafb 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/quartz64-a-rk3566_defconfig b/configs/quartz64-a-rk3566_defconfig -index 1ea8e0f40cc..a4211afb6a9 100644 +index fe3fa37611a..60b1f8f1784 100644 --- a/configs/quartz64-a-rk3566_defconfig +++ b/configs/quartz64-a-rk3566_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -559,11 +441,11 @@ index 1ea8e0f40cc..a4211afb6a9 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/quartz64-b-rk3566_defconfig b/configs/quartz64-b-rk3566_defconfig -index f61b2c181a1..408b63dbb08 100644 +index 929736f76af..c3155d9b835 100644 --- a/configs/quartz64-b-rk3566_defconfig +++ b/configs/quartz64-b-rk3566_defconfig -@@ -16,6 +16,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -17,6 +17,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -572,11 +454,11 @@ index f61b2c181a1..408b63dbb08 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/quartzpro64-rk3588_defconfig b/configs/quartzpro64-rk3588_defconfig -index 06c5cff3ca5..dccc550d4ef 100644 +index ade7be27e92..263d21bee8b 100644 --- a/configs/quartzpro64-rk3588_defconfig +++ b/configs/quartzpro64-rk3588_defconfig -@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -585,12 +467,12 @@ index 06c5cff3ca5..dccc550d4ef 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/radxa-cm3-io-rk3566_defconfig b/configs/radxa-cm3-io-rk3566_defconfig -index 48c8fcf5a66..65198e4a507 100644 +index 2655fdc3170..c1a27f6e310 100644 --- a/configs/radxa-cm3-io-rk3566_defconfig +++ b/configs/radxa-cm3-io-rk3566_defconfig -@@ -9,6 +9,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 +@@ -9,6 +9,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFE660000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -598,11 +480,11 @@ index 48c8fcf5a66..65198e4a507 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/radxa-e25-rk3568_defconfig b/configs/radxa-e25-rk3568_defconfig -index 496fee0e0a4..b726e47c3e0 100644 +index 4df594ddc01..3830d27b264 100644 --- a/configs/radxa-e25-rk3568_defconfig +++ b/configs/radxa-e25-rk3568_defconfig -@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -611,24 +493,37 @@ index 496fee0e0a4..b726e47c3e0 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/radxa-zero-3-rk3566_defconfig b/configs/radxa-zero-3-rk3566_defconfig -index 7606edf393e..d1611a638ae 100644 +index 5989b07ad79..1b571ec3847 100644 --- a/configs/radxa-zero-3-rk3566_defconfig +++ b/configs/radxa-zero-3-rk3566_defconfig -@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 +@@ -11,6 +11,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFE660000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" CONFIG_FIT=y CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y +diff --git a/configs/roc-pc-mezzanine-rk3399_defconfig b/configs/roc-pc-mezzanine-rk3399_defconfig +index 3ab5fd69c62..ba254d8f6c0 100644 +--- a/configs/roc-pc-mezzanine-rk3399_defconfig ++++ b/configs/roc-pc-mezzanine-rk3399_defconfig +@@ -21,6 +21,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-roc-pc-mezzanine.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y diff --git a/configs/rock-3a-rk3568_defconfig b/configs/rock-3a-rk3568_defconfig -index 66ac2f6d7aa..1500691419d 100644 +index 733ce631457..3387796a0c5 100644 --- a/configs/rock-3a-rk3568_defconfig +++ b/configs/rock-3a-rk3568_defconfig -@@ -15,6 +15,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -637,11 +532,11 @@ index 66ac2f6d7aa..1500691419d 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/rock-3b-rk3568_defconfig b/configs/rock-3b-rk3568_defconfig -index 937796811a9..38d048439ed 100644 +index 2023feb36c2..84c6aab6b33 100644 --- a/configs/rock-3b-rk3568_defconfig +++ b/configs/rock-3b-rk3568_defconfig -@@ -15,6 +15,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -650,11 +545,11 @@ index 937796811a9..38d048439ed 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/rock-3c-rk3566_defconfig b/configs/rock-3c-rk3566_defconfig -index f44b202c8c3..488b1c4e0c3 100644 +index 2528c7c639c..0a0010b1268 100644 --- a/configs/rock-3c-rk3566_defconfig +++ b/configs/rock-3c-rk3566_defconfig -@@ -15,6 +15,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -16,6 +16,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -662,12 +557,38 @@ index f44b202c8c3..488b1c4e0c3 100644 CONFIG_AHCI=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y +diff --git a/configs/rock-4c-plus-rk3399_defconfig b/configs/rock-4c-plus-rk3399_defconfig +index 0c73a212ea1..2ae2eff39e2 100644 +--- a/configs/rock-4c-plus-rk3399_defconfig ++++ b/configs/rock-4c-plus-rk3399_defconfig +@@ -17,6 +17,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_EFI_CAPSULE_ON_DISK=y + CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y + # CONFIG_ANDROID_BOOT_IMAGE is not set +diff --git a/configs/rock-4se-rk3399_defconfig b/configs/rock-4se-rk3399_defconfig +index 3ae19692155..12621b8a41b 100644 +--- a/configs/rock-4se-rk3399_defconfig ++++ b/configs/rock-4se-rk3399_defconfig +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_EFI_CAPSULE_ON_DISK=y + CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y diff --git a/configs/rock-5-itx-rk3588_defconfig b/configs/rock-5-itx-rk3588_defconfig -index bb9f148692a..1d6a9e9465b 100644 +index d0dd1c20ece..b3a778907c8 100644 --- a/configs/rock-5-itx-rk3588_defconfig +++ b/configs/rock-5-itx-rk3588_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -675,13 +596,52 @@ index bb9f148692a..1d6a9e9465b 100644 CONFIG_AHCI=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y +diff --git a/configs/rock-pi-4-rk3399_defconfig b/configs/rock-pi-4-rk3399_defconfig +index f3a5c2c45f3..d95576e804a 100644 +--- a/configs/rock-pi-4-rk3399_defconfig ++++ b/configs/rock-pi-4-rk3399_defconfig +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_EFI_CAPSULE_ON_DISK=y + CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y +diff --git a/configs/rock-pi-4c-rk3399_defconfig b/configs/rock-pi-4c-rk3399_defconfig +index 9bda50c8c77..d26eb3dcb44 100644 +--- a/configs/rock-pi-4c-rk3399_defconfig ++++ b/configs/rock-pi-4c-rk3399_defconfig +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_AHCI=y + CONFIG_EFI_CAPSULE_ON_DISK=y + CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y +diff --git a/configs/rock-pi-n10-rk3399pro_defconfig b/configs/rock-pi-n10-rk3399pro_defconfig +index a9c6d8a907a..1cde3859eef 100644 +--- a/configs/rock-pi-n10-rk3399pro_defconfig ++++ b/configs/rock-pi-n10-rk3399pro_defconfig +@@ -13,6 +13,8 @@ CONFIG_DEBUG_UART_BASE=0xFF1A0000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + # CONFIG_ANDROID_BOOT_IMAGE is not set + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399pro-rock-pi-n10.dtb" + # CONFIG_CONSOLE_MUX is not set diff --git a/configs/rock5a-rk3588s_defconfig b/configs/rock5a-rk3588s_defconfig -index c09e6655f02..39602d86845 100644 +index 9618d590009..9608f7e7e4c 100644 --- a/configs/rock5a-rk3588s_defconfig +++ b/configs/rock5a-rk3588s_defconfig -@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 +@@ -10,6 +10,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFEB50000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -689,11 +649,11 @@ index c09e6655f02..39602d86845 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/rock5b-rk3588_defconfig b/configs/rock5b-rk3588_defconfig -index 80a2f2fed58..d3cc8a19cfd 100644 +index 47ee2109f8e..e1c6961a3ab 100644 --- a/configs/rock5b-rk3588_defconfig +++ b/configs/rock5b-rk3588_defconfig -@@ -17,6 +17,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -18,6 +18,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -701,12 +661,38 @@ index 80a2f2fed58..d3cc8a19cfd 100644 CONFIG_AHCI=y CONFIG_FIT=y CONFIG_FIT_VERBOSE=y +diff --git a/configs/rock960-rk3399_defconfig b/configs/rock960-rk3399_defconfig +index aebfa73459c..8b60ad3bf00 100644 +--- a/configs/rock960-rk3399_defconfig ++++ b/configs/rock960-rk3399_defconfig +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_BASE=0xFF1A0000 + CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rock960.dtb" + CONFIG_SYS_PBSIZE=1052 + CONFIG_DISPLAY_BOARDINFO_LATE=y +diff --git a/configs/rockpro64-rk3399_defconfig b/configs/rockpro64-rk3399_defconfig +index 08b7e2784e9..d80e120c66f 100644 +--- a/configs/rockpro64-rk3399_defconfig ++++ b/configs/rockpro64-rk3399_defconfig +@@ -20,6 +20,8 @@ CONFIG_SPL_SPI_FLASH_SUPPORT=y + CONFIG_SPL_SPI=y + CONFIG_PCI=y + CONFIG_DEBUG_UART=y ++CONFIG_USE_PREBOOT=y ++CONFIG_PREBOOT="pci enum; usb start; nvme scan;" + CONFIG_BOOTSTAGE=y + CONFIG_BOOTSTAGE_REPORT=y + CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb" diff --git a/configs/sige7-rk3588_defconfig b/configs/sige7-rk3588_defconfig -index d15fc09fc8d..c77919cac79 100644 +index 8b033e22b84..978df10442c 100644 --- a/configs/sige7-rk3588_defconfig +++ b/configs/sige7-rk3588_defconfig -@@ -13,6 +13,8 @@ CONFIG_SPL_SPI=y - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -13,6 +13,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + CONFIG_SPL_SPI=y CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -715,11 +701,11 @@ index d15fc09fc8d..c77919cac79 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/soquartz-blade-rk3566_defconfig b/configs/soquartz-blade-rk3566_defconfig -index 82910daf7cc..09fc6b6b6e5 100644 +index a1a51b2c657..4083f217c0b 100644 --- a/configs/soquartz-blade-rk3566_defconfig +++ b/configs/soquartz-blade-rk3566_defconfig -@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -728,11 +714,11 @@ index 82910daf7cc..09fc6b6b6e5 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/soquartz-cm4-rk3566_defconfig b/configs/soquartz-cm4-rk3566_defconfig -index 5744f1baa81..e5a9ee1938b 100644 +index a8bca0eaccc..c3dd48d9dc1 100644 --- a/configs/soquartz-cm4-rk3566_defconfig +++ b/configs/soquartz-cm4-rk3566_defconfig -@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -741,11 +727,11 @@ index 5744f1baa81..e5a9ee1938b 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/soquartz-model-a-rk3566_defconfig b/configs/soquartz-model-a-rk3566_defconfig -index 920df9b622d..efcd3f5bc77 100644 +index f080d2e36d2..f6f2f67b0a6 100644 --- a/configs/soquartz-model-a-rk3566_defconfig +++ b/configs/soquartz-model-a-rk3566_defconfig -@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -11,6 +11,8 @@ CONFIG_DEBUG_UART_BASE=0xFE660000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -754,11 +740,11 @@ index 920df9b622d..efcd3f5bc77 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y diff --git a/configs/tiger-rk3588_defconfig b/configs/tiger-rk3588_defconfig -index 8eb1027e449..39e4946b0bf 100644 +index f962ac416f3..1fc7301f6ae 100644 --- a/configs/tiger-rk3588_defconfig +++ b/configs/tiger-rk3588_defconfig -@@ -16,6 +16,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -17,6 +17,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 + # CONFIG_DEBUG_UART_BOARD_INIT is not set CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -767,12 +753,12 @@ index 8eb1027e449..39e4946b0bf 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/toybrick-rk3588_defconfig b/configs/toybrick-rk3588_defconfig -index 12a076aeeae..c70210c0dee 100644 +index 5e70341c987..fd7e842f9e5 100644 --- a/configs/toybrick-rk3588_defconfig +++ b/configs/toybrick-rk3588_defconfig -@@ -10,6 +10,8 @@ CONFIG_DEBUG_UART_BASE=0xFEB50000 +@@ -10,6 +10,8 @@ CONFIG_SYS_LOAD_ADDR=0xc00800 + CONFIG_DEBUG_UART_BASE=0xFEB50000 CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" @@ -780,11 +766,11 @@ index 12a076aeeae..c70210c0dee 100644 CONFIG_FIT_VERBOSE=y CONFIG_SPL_FIT_SIGNATURE=y diff --git a/configs/turing-rk1-rk3588_defconfig b/configs/turing-rk1-rk3588_defconfig -index e6e1bda7ec1..e1bf365edc8 100644 +index 0eddf15833c..1a9aacc7b5d 100644 --- a/configs/turing-rk1-rk3588_defconfig +++ b/configs/turing-rk1-rk3588_defconfig -@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_CLOCK=24000000 - CONFIG_SYS_LOAD_ADDR=0xc00800 +@@ -12,6 +12,8 @@ CONFIG_DEBUG_UART_BASE=0xFEBC0000 + CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_PCI=y CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y @@ -793,5 +779,5 @@ index e6e1bda7ec1..e1bf365edc8 100644 CONFIG_FIT=y CONFIG_FIT_VERBOSE=y -- -2.46.1 +2.47.1 diff --git a/rpi-Add-identifiers-for-the-new-RPi-5-series.patch b/rpi-Add-identifiers-for-the-new-RPi-5-series.patch new file mode 100644 index 0000000..66db2ca --- /dev/null +++ b/rpi-Add-identifiers-for-the-new-RPi-5-series.patch @@ -0,0 +1,43 @@ +From 49423505898eef1baefa2823408dad8321571353 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Sun, 29 Dec 2024 14:43:33 +0000 +Subject: [PATCH] rpi: Add identifiers for the new RPi 5 series + +The Raspberry Pi foundation have released the Raspberry +Pi 500, CM5 an CM5 lite devices so add the assoicated +revision identifers so we can detect them. + +Signed-off-by: Peter Robinson +--- + board/raspberrypi/rpi/rpi.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c +index 18be244aa79..1e43c631898 100644 +--- a/board/raspberrypi/rpi/rpi.c ++++ b/board/raspberrypi/rpi/rpi.c +@@ -193,6 +193,21 @@ static const struct rpi_model rpi_models_new_scheme[] = { + DTB_DIR "bcm2712-rpi-5-b.dtb", + true, + }, ++ [0x18] = { ++ "Compute Module 5", ++ DTB_DIR "bcm2712-rpi-cm5-cm5io.dtb", ++ true, ++ }, ++ [0x19] = { ++ "500", ++ DTB_DIR "bcm2712-rpi-500.dtb", ++ true, ++ }, ++ [0x1A] = { ++ "Compute Module 5 Lite", ++ DTB_DIR "bcm2712-rpi-cm5l-cm5io.dtb", ++ true, ++ }, + }; + + static const struct rpi_model rpi_models_old_scheme[] = { +-- +2.47.1 + diff --git a/rpi-Pass-CMA-through-from-firmware-DT.patch b/rpi-Pass-CMA-through-from-firmware-DT.patch deleted file mode 100644 index 1185095..0000000 --- a/rpi-Pass-CMA-through-from-firmware-DT.patch +++ /dev/null @@ -1,40 +0,0 @@ -From c449955f6aece3148ccf67890df1083fb3a41884 Mon Sep 17 00:00:00 2001 -From: Peter Robinson -Date: Fri, 11 Oct 2024 12:04:10 +0100 -Subject: [PATCH] board: rpi: Pass CMA through from firmware DT - -For a lot of usecases, such as display, camera, media -the Raspberry Pi needs a lot more CMA than distros -configure as default so we should pass this parameter -through so things work as expected. Fix a spelling -mistake while we're at it. - -Signed-off-by: Peter Robinson ---- - board/raspberrypi/rpi/rpi.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/board/raspberrypi/rpi/rpi.c b/board/raspberrypi/rpi/rpi.c -index ab5ea85cf9f..dd5a318d239 100644 ---- a/board/raspberrypi/rpi/rpi.c -+++ b/board/raspberrypi/rpi/rpi.c -@@ -540,12 +540,15 @@ void update_fdt_from_fw(void *fdt, void *fw_fdt) - if (fdt == fw_fdt) - return; - -- /* The firmware provides a more precie model; so copy that */ -+ /* The firmware provides a more precise model; so copy that */ - copy_property(fdt, fw_fdt, "/", "model"); - - /* memory reserve as suggested by the firmware */ - copy_property(fdt, fw_fdt, "/", "memreserve"); - -+ /* copy the CMA memory setting from the firmware DT to linux */ -+ copy_property(fdt, fw_fdt, "/reserved-memory/linux,cma", "size"); -+ - /* Adjust dma-ranges for the SD card and PCI bus as they can depend on - * the SoC revision - */ --- -2.47.0 - diff --git a/sources b/sources index 82c8edc..467430d 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2024.10.tar.bz2) = ef817c9b5ae8dc6cd9e3f57811e90acc6a4d4394f0356aa5923e3e3c8559168f977bd5bf82824cd3650aa8e5e3c3d1b00e20818d21368151748682f1fc51152c +SHA512 (u-boot-2025.01-rc4.tar.bz2) = d088cee1947ede1f1db6eb1dc5e5e583aa44e9c8508eae4420a91b2f83826767e1978c8e85e9c76aaf84921a64c69248386d7ab117b82563ae0daad1443d7ad4 diff --git a/uboot-tools.spec b/uboot-tools.spec index 3ebc11a..a4b1e4e 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -#global candidate rc0 +%global candidate rc6 %if 0%{?rhel} %bcond_with toolsonly %else @@ -6,8 +6,8 @@ %endif Name: uboot-tools -Version: 2024.10 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Version: 2025.01 +Release: 0.1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -29,14 +29,12 @@ Patch5: enable-bootmenu-by-default.patch # Should be upstream but it's taking time #Patch6: Add-video-damage-tracking.patch -# Rockchips improvements -Patch10: rockchip-Enable-preboot-start-for-pci-usb.patch -Patch11: FUSB302-USB-C-controller-support.patch -Patch12: rockchip-Modernise-Geekbox-config.patch -# QCom -Patch15: Qualcomm-add-support-for-SC7280-and-the-RB3-Gen-2.patch +# Device improvments # RPi -Patch20: rpi-Pass-CMA-through-from-firmware-DT.patch +Patch10: rpi-Add-identifiers-for-the-new-RPi-5-series.patch +# Rockchips improvements +Patch11: rockchip-Enable-preboot-start-for-pci-usb.patch +#Patch12: rockchip-Modernise-Geekbox-config.patch BuildRequires: bc BuildRequires: bison @@ -122,7 +120,7 @@ do echo "Board: $board using sun50i_h616" cp /usr/share/arm-trusted-firmware/sun50i_h616/bl31.bin builds/$(echo $board)/atf-bl31 fi - rk3328=(evb-rk3328 nanopi-r2c-plus-rk3328 nanopi-r2c-rk3328 nanopi-r2s-rk3328 orangepi-r1-plus-lts-rk3328 orangepi-r1-plus-rk3328 roc-cc-rk3328 rock64-rk3328 rock-pi-e-rk3328 rock-pi-e-v3-rk3328) + rk3328=(evb-rk3328 nanopi-r2c-plus-rk3328 nanopi-r2c-rk3328 nanopi-r2s-rk3328 nanopi-r2s-plus-rk3328 orangepi-r1-plus-lts-rk3328 orangepi-r1-plus-rk3328 roc-cc-rk3328 rock64-rk3328 rock-pi-e-rk3328 rock-pi-e-v3-rk3328) if [[ " ${rk3328[*]} " == *" $board "* ]]; then echo "Board: $board using rk3328" cp /usr/share/arm-trusted-firmware/rk3328/bl31.elf builds/$(echo $board)/atf-bl31 @@ -220,6 +218,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Dec 31 2024 Peter Robinson - 1:2025.01-0.1.rc6 +- Update to 2025.01 RC6 + * Fri Oct 11 2024 Peter Robinson - 1:2024.10-1 - Update to 2024.10 GA - Fix passing RPi firmware CMA setting to kernel DT diff --git a/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch b/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch index 232e121..c45924d 100644 --- a/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch +++ b/uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch @@ -1,6 +1,6 @@ -From 8abb44f89aefd25cda27c54c08b68b3a60bea7c3 Mon Sep 17 00:00:00 2001 +From 121fd475757e183428ca78f43420c42b9973aa33 Mon Sep 17 00:00:00 2001 From: Peter Robinson -Date: Thu, 21 Mar 2024 13:43:24 +0000 +Date: Tue, 31 Dec 2024 14:11:12 +0000 Subject: [PATCH] initial find_fdt_location for finding the DT on disk The old distro boot looked for a DT on the first boot partition @@ -23,10 +23,10 @@ Signed-off-by: Peter Robinson 4 files changed, 112 insertions(+), 1 deletion(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c -index 9cf9027bf40..8b6194a8702 100644 +index c1454ffb948..ec869047f05 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c -@@ -144,6 +144,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, +@@ -143,6 +143,7 @@ static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc, if (argc > 2) { uintptr_t fdt_addr; @@ -35,10 +35,10 @@ index 9cf9027bf40..8b6194a8702 100644 fdt = map_sysmem(fdt_addr, 0); } else { diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c -index 78184fccab2..48368c8d42e 100644 +index b633aedf011..96a71a96820 100644 --- a/cmd/bootmenu.c +++ b/cmd/bootmenu.c -@@ -448,6 +448,11 @@ static void handle_uefi_bootnext(void) +@@ -461,6 +461,11 @@ static void handle_uefi_bootnext(void) u16 bootnext; efi_status_t ret; efi_uintn_t size; @@ -51,10 +51,10 @@ index 78184fccab2..48368c8d42e 100644 /* Initialize EFI drivers */ ret = efi_init_obj_list(); diff --git a/include/efi_loader.h b/include/efi_loader.h -index 7daca0afba2..a969378ff2f 100644 +index 39809eac1bc..511eba655e7 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h -@@ -524,6 +524,8 @@ struct efi_register_notify_event { +@@ -514,6 +514,8 @@ struct efi_register_notify_event { struct list_head handles; }; @@ -64,7 +64,7 @@ index 7daca0afba2..a969378ff2f 100644 int efi_init_early(void); /* Initialize efi execution environment */ diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c -index 5dd9cc876e4..a33ec39ff74 100644 +index bf96f61d3d0..3f496cc0dfb 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -12,6 +12,7 @@ @@ -72,12 +72,12 @@ index 5dd9cc876e4..a33ec39ff74 100644 #include #include +#include + #include #include #include - #include -@@ -24,6 +25,99 @@ - const efi_guid_t efi_lf2_initrd_guid = EFI_INITRD_MEDIA_GUID; - #endif +@@ -95,6 +96,99 @@ int efi_get_pxe_arch(void) + return -EINVAL; + } +/* We need to pass a blk device in and return a location, or a loaded DT */ +char *find_fdt_location(void) @@ -175,7 +175,7 @@ index 5dd9cc876e4..a33ec39ff74 100644 /** * efi_create_current_boot_var() - Return Boot#### name were #### is replaced by * the value of BootCurrent -@@ -432,11 +526,20 @@ efi_status_t efi_install_fdt(void *fdt) +@@ -548,11 +642,20 @@ efi_status_t efi_install_fdt(void *fdt) /* Look for device tree that is already installed */ if (efi_get_configuration_table(&efi_guid_fdt)) return EFI_SUCCESS; @@ -195,8 +195,8 @@ index 5dd9cc876e4..a33ec39ff74 100644 fdt_opt = env_get("fdtcontroladdr"); + log_debug("Using DT from U-Boot\n"); if (!fdt_opt) { - log_err("ERROR: need device tree\n"); + log_err("need device tree\n"); return EFI_NOT_FOUND; -- -2.44.0 +2.47.1 From f7a78315e4c2c70e8ba1990fedf4f9e0be27ac19 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Thu, 2 Jan 2025 10:08:31 +0000 Subject: [PATCH 059/128] Upload RC6 source --- sources | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sources b/sources index 467430d..ed581bf 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2025.01-rc4.tar.bz2) = d088cee1947ede1f1db6eb1dc5e5e583aa44e9c8508eae4420a91b2f83826767e1978c8e85e9c76aaf84921a64c69248386d7ab117b82563ae0daad1443d7ad4 +SHA512 (u-boot-2025.01-rc6.tar.bz2) = 17860d15410b2d8c88611b3040082869a9a21596c705f0137d46a28a107c3cad3f482e992fd9a5fb101488e8691ce9dd16ca8ef38d8a74b0514c26d32afca700 From eb2323f190918283f861e718f7b1ca7f26625ecf Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Mon, 6 Jan 2025 15:25:03 +0000 Subject: [PATCH 060/128] Rebuild for TF-A 2.12 --- uboot-tools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index a4b1e4e..1d5efa6 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2025.01 -Release: 0.1%{?candidate:.%{candidate}}%{?dist} +Release: 0.2%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -218,6 +218,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Mon Jan 06 2025 Peter Robinson - 1:2025.01-0.2.rc6 +- Rebuild for TF-A 2.12 + * Tue Dec 31 2024 Peter Robinson - 1:2025.01-0.1.rc6 - Update to 2025.01 RC6 From d3e7f7d440edf713d7a54e9a0759a08b866de930 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 7 Jan 2025 09:49:48 +0000 Subject: [PATCH 061/128] 2025.01 GA --- sources | 2 +- uboot-tools.spec | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sources b/sources index ed581bf..da1e0e7 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2025.01-rc6.tar.bz2) = 17860d15410b2d8c88611b3040082869a9a21596c705f0137d46a28a107c3cad3f482e992fd9a5fb101488e8691ce9dd16ca8ef38d8a74b0514c26d32afca700 +SHA512 (u-boot-2025.01.tar.bz2) = e22202b568f90de15e4e20317e13d68ce106256eadeeae5017241cdd4a1d133cdfd14297b403c7391bf65d022061ad4e1cbe862c480fddbd13f97b756305f188 diff --git a/uboot-tools.spec b/uboot-tools.spec index 1d5efa6..06ba9bf 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc6 +#global candidate rc0 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2025.01 -Release: 0.2%{?candidate:.%{candidate}}%{?dist} +Release: 1%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -218,6 +218,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Jan 07 2025 Peter Robinson - 1:2025.01-1 +- Update to 2025.01 GA + * Mon Jan 06 2025 Peter Robinson - 1:2025.01-0.2.rc6 - Rebuild for TF-A 2.12 From 3cc9ea7c96406873fe8a37a959fe0b1a30503677 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Sun, 19 Jan 2025 13:33:58 +0000 Subject: [PATCH 062/128] Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild --- uboot-tools.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 06ba9bf..657db17 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2025.01 -Release: 1%{?candidate:.%{candidate}}%{?dist} +Release: 2%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -218,6 +218,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Sun Jan 19 2025 Fedora Release Engineering - 1:2025.01-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild + * Tue Jan 07 2025 Peter Robinson - 1:2025.01-1 - Update to 2025.01 GA From 8c6f3ce53a5cd2785e05b126ce17dafff11e3408 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 28 Jan 2025 06:22:57 +0000 Subject: [PATCH 063/128] Add new fdt_add_pubkey tool --- uboot-tools.spec | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/uboot-tools.spec b/uboot-tools.spec index 657db17..cd060f9 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2025.01 -Release: 2%{?candidate:.%{candidate}}%{?dist} +Release: 3%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -186,7 +186,7 @@ done %endif %endif -for tool in dumpimage env/fw_printenv fit_check_sign fit_info gdb/gdbcont gdb/gdbsend gen_eth_addr gen_ethaddr_crc ifwitool img2srec kwboot mkeficapsule mkenvimage mkimage mksunxiboot ncb proftool sunxi-spl-image-builder +for tool in dumpimage env/fw_printenv fdt_add_pubkey fit_check_sign fit_info gdb/gdbcont gdb/gdbsend gen_eth_addr gen_ethaddr_crc ifwitool img2srec kwboot mkeficapsule mkenvimage mkimage mksunxiboot ncb proftool sunxi-spl-image-builder do install -p -m 0755 builds/tools/$tool %{buildroot}%{_bindir} done @@ -218,6 +218,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Jan 28 2025 Peter Robinson - 1:2025.01-3 +- Add new fdt_add_pubkey tool + * Sun Jan 19 2025 Fedora Release Engineering - 1:2025.01-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild From f713a0fe6af55f09f7c302fc5a684bf19930da66 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 11 Feb 2025 09:34:06 +0000 Subject: [PATCH 064/128] 2025.05 RC1 --- aarch64-boards | 3 +- ...hip-Enable-preboot-start-for-pci-usb.patch | 4 +-- sources | 2 +- uboot-tools.spec | 34 ++++++++++++------- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/aarch64-boards b/aarch64-boards index b66a8a6..bb4c9fd 100644 --- a/aarch64-boards +++ b/aarch64-boards @@ -1,6 +1,7 @@ a64-olinuxino a64-olinuxino-emmc amarula_a64_relic +anbernic_rg35xx_h700 apple_m1 bananapi_m2_plus_h5 bananapi_m64 @@ -78,6 +79,7 @@ pinetab poplar puma-rk3399 qcm6490 +qcs9100 qcom qemu_arm64 qemu_arm64_lwip @@ -102,4 +104,3 @@ transpeed-8k618-t turris_mox vexpress_aemv8a_juno x96_mate -xilinx_zynqmp_virt diff --git a/rockchip-Enable-preboot-start-for-pci-usb.patch b/rockchip-Enable-preboot-start-for-pci-usb.patch index 64e6883..177b44c 100644 --- a/rockchip-Enable-preboot-start-for-pci-usb.patch +++ b/rockchip-Enable-preboot-start-for-pci-usb.patch @@ -684,9 +684,9 @@ index 08b7e2784e9..d80e120c66f 100644 CONFIG_DEBUG_UART=y +CONFIG_USE_PREBOOT=y +CONFIG_PREBOOT="pci enum; usb start; nvme scan;" - CONFIG_BOOTSTAGE=y - CONFIG_BOOTSTAGE_REPORT=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-rockpro64.dtb" + CONFIG_DISPLAY_BOARDINFO_LATE=y + CONFIG_SPL_MAX_SIZE=0x40000 diff --git a/configs/sige7-rk3588_defconfig b/configs/sige7-rk3588_defconfig index 8b033e22b84..978df10442c 100644 --- a/configs/sige7-rk3588_defconfig diff --git a/sources b/sources index da1e0e7..180c13e 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2025.01.tar.bz2) = e22202b568f90de15e4e20317e13d68ce106256eadeeae5017241cdd4a1d133cdfd14297b403c7391bf65d022061ad4e1cbe862c480fddbd13f97b756305f188 +SHA512 (u-boot-2025.04-rc1.tar.bz2) = b973b39c2665d30ab1a9b96fb1eaae70bbdd29dabb68e4cdcf84a11174482e8861ccd8984ca17f594ca6af15bf0517c5263574385836676413e16f911b5bbb4e diff --git a/uboot-tools.spec b/uboot-tools.spec index cd060f9..5c55822 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -#global candidate rc0 +%global candidate rc1 %if 0%{?rhel} %bcond_with toolsonly %else @@ -6,8 +6,8 @@ %endif Name: uboot-tools -Version: 2025.01 -Release: 3%{?candidate:.%{candidate}}%{?dist} +Version: 2025.04 +Release: 0.2%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -115,7 +115,7 @@ do cp /usr/share/arm-trusted-firmware/sun50i_h6/bl31.bin builds/$(echo $board)/atf-bl31 cp /usr/share/crust-firmware/h6/scp.bin builds/$(echo $board)/ fi - sun50i_h616=(orangepi_zero2 orangepi_zero2w orangepi_zero3 transpeed-8k618-t x96_mate) + sun50i_h616=(anbernic_rg35xx_h700 orangepi_zero2 orangepi_zero2w orangepi_zero3 transpeed-8k618-t x96_mate) if [[ " ${sun50i_h616[*]} " == *" $board "* ]]; then echo "Board: $board using sun50i_h616" cp /usr/share/arm-trusted-firmware/sun50i_h616/bl31.bin builds/$(echo $board)/atf-bl31 @@ -136,6 +136,11 @@ do cp /usr/share/arm-trusted-firmware/rk3399/* builds/$(echo $board)/ cp builds/$(echo $board)/bl31.elf builds/$(echo $board)/atf-bl31 fi + zynqmp=(xilinx_zynqmp_kria xilinx_zynqmp_virt) + if [[ " ${zynqmp[*]} " == *" $board "* ]]; then + echo "Board: $board using zynqmp" + cp /usr/share/arm-trusted-firmware/zynqmp/bl31.bin builds/$(echo $board)/atf-bl31 + fi # End ATF make $(echo $board)_defconfig O=builds/$(echo $board)/ @@ -163,9 +168,16 @@ do done done -# Just for xilinx_zynqmp_virt -install -pD -m 0644 builds/xilinx_zynqmp_virt/u-boot.itb %{buildroot}%{_datadir}/uboot/xilinx_zynqmp_virt/u-boot.itb -install -pD -m 0644 builds/xilinx_zynqmp_virt/spl/boot.bin %{buildroot}%{_datadir}/uboot/xilinx_zynqmp_virt/boot.bin +# Just for xilinx_zynqmp +for board in "xilinx_zynqmp_kria xilinx_zynqmp_virt" +do + for file in u-boot.itb spl/boot.bin + do + if [ -f builds/$(echo $board)/$(echo $file) ]; then + install -pD -m 0644 builds/$(echo $board)/$(echo $file) %{buildroot}%{_datadir}/uboot/$(echo $board)/$(echo $file) + fi + done +done # For Apple M-series we also need the nodtb variant install -pD -m 0644 builds/apple_m1/u-boot-nodtb.bin %{buildroot}%{_datadir}/uboot/apple_m1/u-boot-nodtb.bin @@ -176,11 +188,6 @@ do rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.dtb if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot-sunxi-with-spl.bin ]; then rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot{,-dtb}.* - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/sunxi-spl.bin - fi - if [ -f %{buildroot}%{_datadir}/uboot/$(echo $board)/idbloader.img ]; then - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot.bin - rm -f %{buildroot}%{_datadir}/uboot/$(echo $board)/u-boot{,-dtb}.img fi done %endif @@ -218,6 +225,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Feb 11 2025 Peter Robinson - 1:2025.04-0.2.rc1 +- Update to 2025.05 RC1 + * Tue Jan 28 2025 Peter Robinson - 1:2025.01-3 - Add new fdt_add_pubkey tool From 630e77de009a1286f9559467581543f4fcd6bfa6 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Tue, 18 Feb 2025 22:28:52 +0000 Subject: [PATCH 065/128] 2025.05 RC2 --- Add-video-damage-tracking.patch | 439 +++++++++++++++----------------- sources | 2 +- uboot-tools.spec | 9 +- 3 files changed, 218 insertions(+), 232 deletions(-) diff --git a/Add-video-damage-tracking.patch b/Add-video-damage-tracking.patch index 1aea71e..72475de 100644 --- a/Add-video-damage-tracking.patch +++ b/Add-video-damage-tracking.patch @@ -1,4 +1,4 @@ -From 26fad18312fe9cb0ed97ed8550b1c704d0985ebe Mon Sep 17 00:00:00 2001 +From a05aeec18576ddce60c2fbd797245b5eeaddee25 Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Mon, 21 Aug 2023 16:50:58 +0300 Subject: [PATCH 01/13] video: test: Split copy frame buffer check into a @@ -18,10 +18,10 @@ Reviewed-by: Simon Glass 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/test/dm/video.c b/test/dm/video.c -index d907f681600..641a6250100 100644 +index e347c1403fd..01fa9e1b241 100644 --- a/test/dm/video.c +++ b/test/dm/video.c -@@ -55,9 +55,6 @@ DM_TEST(dm_test_video_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +@@ -54,9 +54,6 @@ DM_TEST(dm_test_video_base, UTF_SCAN_PDATA | UTF_SCAN_FDT); * size of the compressed data. This provides a pretty good level of * certainty and the resulting tests need only check a single value. * @@ -31,7 +31,7 @@ index d907f681600..641a6250100 100644 * @uts: Test state * @dev: Video device * Return: compressed size of the frame buffer, or -ve on error -@@ -66,7 +63,6 @@ static int compress_frame_buffer(struct unit_test_state *uts, +@@ -65,7 +62,6 @@ static int compress_frame_buffer(struct unit_test_state *uts, struct udevice *dev) { struct video_priv *priv = dev_get_uclass_priv(dev); @@ -39,7 +39,7 @@ index d907f681600..641a6250100 100644 uint destlen; void *dest; int ret; -@@ -82,16 +78,34 @@ static int compress_frame_buffer(struct unit_test_state *uts, +@@ -81,16 +77,34 @@ static int compress_frame_buffer(struct unit_test_state *uts, if (ret) return ret; @@ -81,7 +81,7 @@ index d907f681600..641a6250100 100644 /* * Call this function at any point to halt and show the current display. Be * sure to run the test with the -l flag. -@@ -155,24 +169,30 @@ static int dm_test_video_text(struct unit_test_state *uts) +@@ -154,24 +168,30 @@ static int dm_test_video_text(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ut_assertok(vidconsole_select_font(con, "8x16", 0)); ut_asserteq(46, compress_frame_buffer(uts, dev)); @@ -112,7 +112,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -191,24 +211,30 @@ static int dm_test_video_text_12x22(struct unit_test_state *uts) +@@ -190,24 +210,30 @@ static int dm_test_video_text_12x22(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ut_assertok(vidconsole_select_font(con, "12x22", 0)); ut_asserteq(46, compress_frame_buffer(uts, dev)); @@ -143,7 +143,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -226,6 +252,7 @@ static int dm_test_video_chars(struct unit_test_state *uts) +@@ -225,6 +251,7 @@ static int dm_test_video_chars(struct unit_test_state *uts) ut_assertok(vidconsole_select_font(con, "8x16", 0)); vidconsole_put_string(con, test_string); ut_asserteq(466, compress_frame_buffer(uts, dev)); @@ -151,7 +151,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -247,19 +274,23 @@ static int dm_test_video_ansi(struct unit_test_state *uts) +@@ -246,19 +273,23 @@ static int dm_test_video_ansi(struct unit_test_state *uts) video_clear(con->parent); video_sync(con->parent, false); ut_asserteq(46, compress_frame_buffer(uts, dev)); @@ -175,7 +175,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -292,11 +323,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, +@@ -291,11 +322,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ut_assertok(vidconsole_select_font(con, "8x16", 0)); ut_asserteq(46, compress_frame_buffer(uts, dev)); @@ -189,7 +189,7 @@ index d907f681600..641a6250100 100644 /* Check display scrolling */ for (i = 0; i < SCROLL_LINES; i++) { -@@ -304,11 +337,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, +@@ -303,11 +336,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, vidconsole_put_char(con, '\n'); } ut_asserteq(scroll_size, compress_frame_buffer(uts, dev)); @@ -203,7 +203,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -383,6 +418,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts) +@@ -382,6 +417,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); ut_asserteq(1368, compress_frame_buffer(uts, dev)); @@ -211,7 +211,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -402,6 +438,7 @@ static int dm_test_video_bmp8(struct unit_test_state *uts) +@@ -401,6 +437,7 @@ static int dm_test_video_bmp8(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); ut_asserteq(1247, compress_frame_buffer(uts, dev)); @@ -219,7 +219,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -425,6 +462,7 @@ static int dm_test_video_bmp16(struct unit_test_state *uts) +@@ -424,6 +461,7 @@ static int dm_test_video_bmp16(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); ut_asserteq(3700, compress_frame_buffer(uts, dev)); @@ -227,7 +227,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -448,6 +486,7 @@ static int dm_test_video_bmp24(struct unit_test_state *uts) +@@ -447,6 +485,7 @@ static int dm_test_video_bmp24(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); ut_asserteq(3656, compress_frame_buffer(uts, dev)); @@ -235,7 +235,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -471,6 +510,7 @@ static int dm_test_video_bmp24_32(struct unit_test_state *uts) +@@ -470,6 +509,7 @@ static int dm_test_video_bmp24_32(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); ut_asserteq(6827, compress_frame_buffer(uts, dev)); @@ -243,7 +243,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -489,6 +529,7 @@ static int dm_test_video_bmp32(struct unit_test_state *uts) +@@ -488,6 +528,7 @@ static int dm_test_video_bmp32(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); ut_asserteq(2024, compress_frame_buffer(uts, dev)); @@ -251,7 +251,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -505,6 +546,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts) +@@ -504,6 +545,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); ut_asserteq(1368, compress_frame_buffer(uts, dev)); @@ -259,7 +259,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -524,6 +566,7 @@ static int dm_test_video_comp_bmp32(struct unit_test_state *uts) +@@ -523,6 +565,7 @@ static int dm_test_video_comp_bmp32(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); ut_asserteq(2024, compress_frame_buffer(uts, dev)); @@ -267,7 +267,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -543,6 +586,7 @@ static int dm_test_video_comp_bmp8(struct unit_test_state *uts) +@@ -542,6 +585,7 @@ static int dm_test_video_comp_bmp8(struct unit_test_state *uts) ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); ut_asserteq(1247, compress_frame_buffer(uts, dev)); @@ -275,7 +275,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -558,6 +602,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) +@@ -557,6 +601,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); ut_asserteq(12174, compress_frame_buffer(uts, dev)); @@ -283,7 +283,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -579,6 +624,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) +@@ -578,6 +623,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); ut_asserteq(34287, compress_frame_buffer(uts, dev)); @@ -291,7 +291,7 @@ index d907f681600..641a6250100 100644 return 0; } -@@ -600,6 +646,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) +@@ -599,6 +645,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); ut_asserteq(29471, compress_frame_buffer(uts, dev)); @@ -300,9 +300,9 @@ index d907f681600..641a6250100 100644 return 0; } -- -2.45.1 +2.48.1 -From 6c7cff43f374242ed4d585f7359fa5c334332a0a Mon Sep 17 00:00:00 2001 +From 37f92f0ac721bc300659d166d8a19f6b18b2bbcb Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Mon, 21 Aug 2023 16:50:59 +0300 Subject: [PATCH 02/13] video: test: Support checking copy frame buffer @@ -325,10 +325,10 @@ Reviewed-by: Simon Glass 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/test/dm/video.c b/test/dm/video.c -index 641a6250100..b9ff3da10c1 100644 +index 01fa9e1b241..edb1b4ede8c 100644 --- a/test/dm/video.c +++ b/test/dm/video.c -@@ -57,22 +57,28 @@ DM_TEST(dm_test_video_base, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +@@ -56,22 +56,28 @@ DM_TEST(dm_test_video_base, UTF_SCAN_PDATA | UTF_SCAN_FDT); * * @uts: Test state * @dev: Video device @@ -359,7 +359,7 @@ index 641a6250100..b9ff3da10c1 100644 3, 0, 0); free(dest); if (ret) -@@ -168,30 +174,30 @@ static int dm_test_video_text(struct unit_test_state *uts) +@@ -167,30 +173,30 @@ static int dm_test_video_text(struct unit_test_state *uts) ut_assertok(video_get_nologo(uts, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ut_assertok(vidconsole_select_font(con, "8x16", 0)); @@ -396,7 +396,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -210,30 +216,30 @@ static int dm_test_video_text_12x22(struct unit_test_state *uts) +@@ -209,30 +215,30 @@ static int dm_test_video_text_12x22(struct unit_test_state *uts) ut_assertok(video_get_nologo(uts, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ut_assertok(vidconsole_select_font(con, "12x22", 0)); @@ -433,7 +433,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -251,7 +257,7 @@ static int dm_test_video_chars(struct unit_test_state *uts) +@@ -250,7 +256,7 @@ static int dm_test_video_chars(struct unit_test_state *uts) ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ut_assertok(vidconsole_select_font(con, "8x16", 0)); vidconsole_put_string(con, test_string); @@ -442,7 +442,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -273,23 +279,23 @@ static int dm_test_video_ansi(struct unit_test_state *uts) +@@ -272,23 +278,23 @@ static int dm_test_video_ansi(struct unit_test_state *uts) /* reference clear: */ video_clear(con->parent); video_sync(con->parent, false); @@ -470,7 +470,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -322,13 +328,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, +@@ -321,13 +327,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, ut_assertok(video_get_nologo(uts, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); ut_assertok(vidconsole_select_font(con, "8x16", 0)); @@ -486,7 +486,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); /* Check display scrolling */ -@@ -336,13 +342,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, +@@ -335,13 +341,13 @@ static int check_vidconsole_output(struct unit_test_state *uts, int rot, vidconsole_put_char(con, 'A' + i % 50); vidconsole_put_char(con, '\n'); } @@ -502,7 +502,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -417,7 +423,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts) +@@ -416,7 +422,7 @@ static int dm_test_video_bmp(struct unit_test_state *uts) ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); @@ -511,7 +511,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -437,7 +443,7 @@ static int dm_test_video_bmp8(struct unit_test_state *uts) +@@ -436,7 +442,7 @@ static int dm_test_video_bmp8(struct unit_test_state *uts) ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); @@ -520,7 +520,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -461,7 +467,7 @@ static int dm_test_video_bmp16(struct unit_test_state *uts) +@@ -460,7 +466,7 @@ static int dm_test_video_bmp16(struct unit_test_state *uts) &src_len)); ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); @@ -529,7 +529,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -485,7 +491,7 @@ static int dm_test_video_bmp24(struct unit_test_state *uts) +@@ -484,7 +490,7 @@ static int dm_test_video_bmp24(struct unit_test_state *uts) &src_len)); ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); @@ -538,7 +538,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -509,7 +515,7 @@ static int dm_test_video_bmp24_32(struct unit_test_state *uts) +@@ -508,7 +514,7 @@ static int dm_test_video_bmp24_32(struct unit_test_state *uts) &src_len)); ut_assertok(video_bmp_display(dev, dst, 0, 0, false)); @@ -547,7 +547,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -528,7 +534,7 @@ static int dm_test_video_bmp32(struct unit_test_state *uts) +@@ -527,7 +533,7 @@ static int dm_test_video_bmp32(struct unit_test_state *uts) ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); @@ -556,7 +556,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -545,7 +551,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts) +@@ -544,7 +550,7 @@ static int dm_test_video_bmp_comp(struct unit_test_state *uts) ut_assertok(read_file(uts, "tools/logos/denx-comp.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); @@ -565,7 +565,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -565,7 +571,7 @@ static int dm_test_video_comp_bmp32(struct unit_test_state *uts) +@@ -564,7 +570,7 @@ static int dm_test_video_comp_bmp32(struct unit_test_state *uts) ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); @@ -574,7 +574,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -585,7 +591,7 @@ static int dm_test_video_comp_bmp8(struct unit_test_state *uts) +@@ -584,7 +590,7 @@ static int dm_test_video_comp_bmp8(struct unit_test_state *uts) ut_assertok(read_file(uts, "tools/logos/denx.bmp", &addr)); ut_assertok(video_bmp_display(dev, addr, 0, 0, false)); @@ -583,7 +583,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -601,7 +607,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) +@@ -600,7 +606,7 @@ static int dm_test_video_truetype(struct unit_test_state *uts) ut_assertok(video_get_nologo(uts, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); @@ -592,7 +592,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -623,7 +629,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) +@@ -622,7 +628,7 @@ static int dm_test_video_truetype_scroll(struct unit_test_state *uts) ut_assertok(video_get_nologo(uts, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); @@ -601,7 +601,7 @@ index 641a6250100..b9ff3da10c1 100644 ut_assertok(check_copy_frame_buffer(uts, dev)); return 0; -@@ -645,7 +651,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) +@@ -644,7 +650,7 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) ut_assertok(video_get_nologo(uts, &dev)); ut_assertok(uclass_get_device(UCLASS_VIDEO_CONSOLE, 0, &con)); vidconsole_put_string(con, test_string); @@ -611,11 +611,11 @@ index 641a6250100..b9ff3da10c1 100644 return 0; -- -2.45.1 +2.48.1 -From 1020e92b30457fa042a78395dabce0f50d07de8e Mon Sep 17 00:00:00 2001 -From: Alper Nebi Yasak -Date: Mon, 21 Aug 2023 16:51:00 +0300 +From eb739214f97a59e2d902b965f9990eab9b243658 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Tue, 18 Feb 2025 21:42:26 +0000 Subject: [PATCH 03/13] video: test: Test partial updates of hardware frame buffer @@ -627,18 +627,19 @@ sync. Signed-off-by: Alper Nebi Yasak Reviewed-by: Simon Glass +Signed-off-by: Peter Robinson --- test/dm/video.c | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/test/dm/video.c b/test/dm/video.c -index b9ff3da10c1..e4bd27a6b76 100644 +index edb1b4ede8c..d520938d1b2 100644 --- a/test/dm/video.c +++ b/test/dm/video.c -@@ -657,3 +657,57 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) +@@ -656,3 +656,57 @@ static int dm_test_video_truetype_bs(struct unit_test_state *uts) return 0; } - DM_TEST(dm_test_video_truetype_bs, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + DM_TEST(dm_test_video_truetype_bs, UTF_SCAN_PDATA | UTF_SCAN_FDT); + +/* Test partial rendering onto hardware frame buffer */ +static int dm_test_video_copy(struct unit_test_state *uts) @@ -694,11 +695,11 @@ index b9ff3da10c1..e4bd27a6b76 100644 +} +DM_TEST(dm_test_video_copy, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); -- -2.45.1 +2.48.1 -From 57b3429b596c7ed89c1858663c87865e11d965e2 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Mon, 21 Aug 2023 16:51:01 +0300 +From 60e428bb54f2f7ee922f53ec3d3e0976a37bd47d Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Tue, 18 Feb 2025 21:51:29 +0000 Subject: [PATCH 04/13] dm: video: Add damage tracking API We are going to introduce image damage tracking to fasten up screen @@ -714,17 +715,18 @@ Reported-by: Da Xue Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak Reviewed-by: Simon Glass +Signed-off-by: Peter Robinson --- - drivers/video/Kconfig | 13 ++++++++++++ - drivers/video/video-uclass.c | 41 +++++++++++++++++++++++++++++++++--- - include/video.h | 32 ++++++++++++++++++++++++++-- - 3 files changed, 81 insertions(+), 5 deletions(-) + drivers/video/Kconfig | 13 +++++++++++++ + drivers/video/video-uclass.c | 37 ++++++++++++++++++++++++++++++++++++ + include/video.h | 32 +++++++++++++++++++++++++++++-- + 3 files changed, 80 insertions(+), 2 deletions(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index 7808ae7919e..7815b590481 100644 +index 3c3cebaacd0..5d67067891b 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig -@@ -92,6 +92,19 @@ config VIDEO_COPY +@@ -98,6 +98,19 @@ config VIDEO_COPY To use this, your video driver must set @copy_base in struct video_uc_plat. @@ -745,10 +747,10 @@ index 7808ae7919e..7815b590481 100644 bool "Generic PWM based Backlight Driver" depends on BACKLIGHT && DM_PWM diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 7b5d1dfbb3b..99a8458199a 100644 +index ff4f2199585..ad20af760b8 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -347,9 +347,39 @@ void video_set_default_colors(struct udevice *dev, bool invert) +@@ -367,6 +367,35 @@ void video_set_default_colors(struct udevice *dev, bool invert) priv->colour_bg = video_index_to_colour(priv, back); } @@ -784,31 +786,13 @@ index 7b5d1dfbb3b..99a8458199a 100644 /* Flush video activity to the caches */ int video_sync(struct udevice *vid, bool force) { -+ struct video_priv *priv = dev_get_uclass_priv(vid); - struct video_ops *ops = video_get_ops(vid); - int ret; - -@@ -365,15 +395,12 @@ int video_sync(struct udevice *vid, bool force) - * out whether it exists? For now, ARM is safe. - */ - #if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) -- struct video_priv *priv = dev_get_uclass_priv(vid); -- - if (priv->flush_dcache) { - flush_dcache_range((ulong)priv->fb, - ALIGN((ulong)priv->fb + priv->fb_size, - CONFIG_SYS_CACHELINE_SIZE)); - } +@@ -398,8 +427,16 @@ int video_sync(struct udevice *vid, bool force) #elif defined(CONFIG_VIDEO_SANDBOX_SDL) -- struct video_priv *priv = dev_get_uclass_priv(vid); - static ulong last_sync; - - if (force || get_timer(last_sync) > 100) { -@@ -381,6 +408,14 @@ int video_sync(struct udevice *vid, bool force) - last_sync = get_timer(0); - } + sandbox_sdl_sync(priv->fb); #endif + + priv->last_sync = get_timer(0); + + if (IS_ENABLED(CONFIG_VIDEO_DAMAGE)) { + priv->damage.xstart = priv->xsize; + priv->damage.ystart = priv->ysize; @@ -820,10 +804,10 @@ index 7b5d1dfbb3b..99a8458199a 100644 } diff --git a/include/video.h b/include/video.h -index 4d8df9baaad..1310195f307 100644 +index a1f7fd7e839..92aa5da4ff3 100644 --- a/include/video.h +++ b/include/video.h -@@ -88,6 +88,11 @@ enum video_format { +@@ -85,6 +85,11 @@ enum video_format { * @fb_size: Frame buffer size * @copy_fb: Copy of the frame buffer to keep up to date; see struct * video_uc_plat @@ -835,7 +819,7 @@ index 4d8df9baaad..1310195f307 100644 * @line_length: Length of each frame buffer line, in bytes. This can be * set by the driver, but if not, the uclass will set it after * probing -@@ -115,6 +120,12 @@ struct video_priv { +@@ -113,6 +118,12 @@ struct video_priv { void *fb; int fb_size; void *copy_fb; @@ -848,7 +832,7 @@ index 4d8df9baaad..1310195f307 100644 int line_length; u32 colour_fg; u32 colour_bg; -@@ -257,8 +268,9 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -259,8 +270,9 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, * @return: 0 on success, error code otherwise * * Some frame buffers are cached or have a secondary frame buffer. This @@ -860,7 +844,7 @@ index 4d8df9baaad..1310195f307 100644 */ int video_sync(struct udevice *vid, bool force); -@@ -378,6 +390,22 @@ static inline int video_sync_copy_all(struct udevice *dev) +@@ -380,6 +392,22 @@ static inline int video_sync_copy_all(struct udevice *dev) #endif @@ -884,9 +868,9 @@ index 4d8df9baaad..1310195f307 100644 * video_is_active() - Test if one video device it active * -- -2.45.1 +2.48.1 -From 6677746b0fc8b653af608513bdef54b379b4ee7d Mon Sep 17 00:00:00 2001 +From 8c180ab43a35b355a4f1612d813ec2e655bc7b37 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:02 +0300 Subject: [PATCH 05/13] dm: video: Add damage notification on display fills @@ -904,10 +888,10 @@ Reviewed-by: Simon Glass 1 file changed, 4 insertions(+) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 99a8458199a..96b8962b8de 100644 +index ad20af760b8..43b714085a7 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -196,6 +196,8 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -214,6 +214,8 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, if (ret) return ret; @@ -916,7 +900,7 @@ index 99a8458199a..96b8962b8de 100644 return 0; } -@@ -245,6 +247,8 @@ int video_fill(struct udevice *dev, u32 colour) +@@ -262,6 +264,8 @@ int video_fill(struct udevice *dev, u32 colour) if (ret) return ret; @@ -926,9 +910,9 @@ index 99a8458199a..96b8962b8de 100644 } -- -2.45.1 +2.48.1 -From 96ee787a7966c0357e5f028317b85a8593757883 Mon Sep 17 00:00:00 2001 +From 8047ae54ddde0b5ac6aa7503710e7c3d9c56bc67 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:03 +0300 Subject: [PATCH 06/13] vidconsole: Add damage notifications to all vidconsole @@ -953,10 +937,10 @@ Reviewed-by: Simon Glass 4 files changed, 94 insertions(+) diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c -index 34ef5a52294..6634d3f27da 100644 +index 6f4194a1814..51ac8cc78e9 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c -@@ -40,6 +40,12 @@ static int console_set_row(struct udevice *dev, uint row, int clr) +@@ -39,6 +39,12 @@ static int console_set_row(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -969,7 +953,7 @@ index 34ef5a52294..6634d3f27da 100644 return 0; } -@@ -61,6 +67,12 @@ static int console_move_rows(struct udevice *dev, uint rowdst, +@@ -60,6 +66,12 @@ static int console_move_rows(struct udevice *dev, uint rowdst, if (ret) return ret; @@ -982,7 +966,7 @@ index 34ef5a52294..6634d3f27da 100644 return 0; } -@@ -92,6 +104,12 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) +@@ -91,6 +103,12 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -996,10 +980,10 @@ index 34ef5a52294..6634d3f27da 100644 if (ret) return ret; diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c -index e4303dfb364..8129c7b2aa7 100644 +index a3f8c6352f8..f11dc3a0b07 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c -@@ -37,6 +37,12 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) +@@ -36,6 +36,12 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1012,7 +996,7 @@ index e4303dfb364..8129c7b2aa7 100644 return 0; } -@@ -65,6 +71,12 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -64,6 +70,12 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, dst += vid_priv->line_length; } @@ -1025,7 +1009,7 @@ index e4303dfb364..8129c7b2aa7 100644 return 0; } -@@ -98,6 +110,12 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, int cp) +@@ -97,6 +109,12 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -1038,7 +1022,7 @@ index e4303dfb364..8129c7b2aa7 100644 return VID_TO_POS(fontdata->width); } -@@ -123,6 +141,12 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) +@@ -121,6 +139,12 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1051,7 +1035,7 @@ index e4303dfb364..8129c7b2aa7 100644 return 0; } -@@ -144,6 +168,12 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -142,6 +166,12 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, vidconsole_memmove(dev, dst, src, fontdata->height * vid_priv->line_length * count); @@ -1064,7 +1048,7 @@ index e4303dfb364..8129c7b2aa7 100644 return 0; } -@@ -177,6 +207,12 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, int cp) +@@ -175,6 +205,12 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -1077,7 +1061,7 @@ index e4303dfb364..8129c7b2aa7 100644 return VID_TO_POS(fontdata->width); } -@@ -201,6 +237,12 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) +@@ -199,6 +235,12 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1090,7 +1074,7 @@ index e4303dfb364..8129c7b2aa7 100644 return 0; } -@@ -227,6 +269,12 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -225,6 +267,12 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, dst += vid_priv->line_length; } @@ -1103,7 +1087,7 @@ index e4303dfb364..8129c7b2aa7 100644 return 0; } -@@ -259,6 +307,12 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, int cp) +@@ -257,6 +305,12 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -1117,10 +1101,10 @@ index e4303dfb364..8129c7b2aa7 100644 } diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c -index 28665a32757..ed6c9cbb4f4 100644 +index 17a29817664..073ddcfb695 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c -@@ -191,6 +191,7 @@ struct console_tt_store { +@@ -190,6 +190,7 @@ struct console_tt_store { static int console_truetype_set_row(struct udevice *dev, uint row, int clr) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -1128,7 +1112,7 @@ index 28665a32757..ed6c9cbb4f4 100644 struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *end, *line; -@@ -234,6 +235,12 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -233,6 +234,12 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) if (ret) return ret; @@ -1141,7 +1125,7 @@ index 28665a32757..ed6c9cbb4f4 100644 return 0; } -@@ -241,6 +248,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -240,6 +247,7 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, uint rowsrc, uint count) { struct video_priv *vid_priv = dev_get_uclass_priv(dev->parent); @@ -1149,7 +1133,7 @@ index 28665a32757..ed6c9cbb4f4 100644 struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *dst; -@@ -259,6 +267,12 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -258,6 +266,12 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, for (i = 0; i < priv->pos_ptr; i++) priv->pos[i].ypos -= diff; @@ -1162,7 +1146,7 @@ index 28665a32757..ed6c9cbb4f4 100644 return 0; } -@@ -419,6 +433,13 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, +@@ -418,6 +432,13 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, line += vid_priv->line_length; } @@ -1177,10 +1161,10 @@ index 28665a32757..ed6c9cbb4f4 100644 if (ret) return ret; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index 96b8962b8de..cbdda274f2d 100644 +index 43b714085a7..d175ed61ac8 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -192,6 +192,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -210,6 +210,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, } line += priv->line_length; } @@ -1189,9 +1173,9 @@ index 96b8962b8de..cbdda274f2d 100644 if (ret) return ret; -- -2.45.1 +2.48.1 -From 077a499a8fc2ccad28114264c8792d342bf8536c Mon Sep 17 00:00:00 2001 +From f701195fca932fda3b08ddfe6317fb2ca01f0fcf Mon Sep 17 00:00:00 2001 From: Alper Nebi Yasak Date: Mon, 21 Aug 2023 16:51:04 +0300 Subject: [PATCH 07/13] video: test: Test video damage tracking via vidconsole @@ -1209,10 +1193,10 @@ Reviewed-by: Simon Glass 2 files changed, 57 insertions(+) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index 93b52f2de5c..2051f0a3d7a 100644 +index 7b35ad8a88f..d9e5ac6af48 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig -@@ -319,6 +319,7 @@ CONFIG_USB_ETH_CDC=y +@@ -328,6 +328,7 @@ CONFIG_USB_ETH_CDC=y CONFIG_VIDEO=y CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_VIDEO_COPY=y @@ -1221,10 +1205,10 @@ index 93b52f2de5c..2051f0a3d7a 100644 CONFIG_CONSOLE_TRUETYPE=y CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y diff --git a/test/dm/video.c b/test/dm/video.c -index e4bd27a6b76..8c7d9800a42 100644 +index d520938d1b2..9da00be5479 100644 --- a/test/dm/video.c +++ b/test/dm/video.c -@@ -711,3 +711,59 @@ static int dm_test_video_copy(struct unit_test_state *uts) +@@ -710,3 +710,59 @@ static int dm_test_video_copy(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_copy, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); @@ -1285,9 +1269,9 @@ index e4bd27a6b76..8c7d9800a42 100644 +} +DM_TEST(dm_test_video_damage, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); -- -2.45.1 +2.48.1 -From e5b927255d0375408a5ff14403a978aca09fa68f Mon Sep 17 00:00:00 2001 +From 88bc7e2c640a504bbd7de27b28a3ad2b05d43163 Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:05 +0300 Subject: [PATCH 08/13] video: Add damage notification on bmp display @@ -1304,10 +1288,10 @@ Signed-off-by: Alper Nebi Yasak 1 file changed, 2 insertions(+) diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c -index 45f003c8251..10943b9ca19 100644 +index ad512d99a1b..78de9560792 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c -@@ -460,6 +460,8 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, +@@ -459,6 +459,8 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, break; }; @@ -1317,9 +1301,9 @@ index 45f003c8251..10943b9ca19 100644 fb = (uchar *)(priv->fb + y * priv->line_length + x * bpix / 8); ret = video_sync_copy(dev, start, fb); -- -2.45.1 +2.48.1 -From d31ef2b17c98d0b7b1040e5abda99bb1720eb8c0 Mon Sep 17 00:00:00 2001 +From a3680479d62d38637fc26750756a8cddac380aaf Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:06 +0300 Subject: [PATCH 09/13] efi_loader: GOP: Add damage notification on BLT @@ -1338,10 +1322,10 @@ Reviewed-by: Simon Glass 1 file changed, 7 insertions(+) diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c -index 41e12fa7246..1694e23dcc6 100644 +index 4593975be5a..3abb47d610e 100644 --- a/lib/efi_loader/efi_gop.c +++ b/lib/efi_loader/efi_gop.c -@@ -24,6 +24,7 @@ static const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; +@@ -26,6 +26,7 @@ static const efi_guid_t efi_gop_guid = EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID; * @ops: graphical output protocol interface * @info: graphical output mode information * @mode: graphical output mode @@ -1349,7 +1333,7 @@ index 41e12fa7246..1694e23dcc6 100644 * @bpix: bits per pixel * @fb: frame buffer */ -@@ -32,6 +33,7 @@ struct efi_gop_obj { +@@ -34,6 +35,7 @@ struct efi_gop_obj { struct efi_gop ops; struct efi_gop_mode_info info; struct efi_gop_mode mode; @@ -1357,7 +1341,7 @@ index 41e12fa7246..1694e23dcc6 100644 /* Fields we only have access to during init */ u32 bpix; void *fb; -@@ -120,6 +122,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, +@@ -122,6 +124,7 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, u32 *fb32 = gopobj->fb; u16 *fb16 = gopobj->fb; struct efi_gop_pixel *buffer = __builtin_assume_aligned(bufferp, 4); @@ -1365,7 +1349,7 @@ index 41e12fa7246..1694e23dcc6 100644 if (delta) { /* Check for 4 byte alignment */ -@@ -243,6 +246,9 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, +@@ -245,6 +248,9 @@ static __always_inline efi_status_t gop_blt_int(struct efi_gop *this, dlineoff += dwidth; } @@ -1375,7 +1359,7 @@ index 41e12fa7246..1694e23dcc6 100644 return EFI_SUCCESS; } -@@ -549,6 +555,7 @@ efi_status_t efi_gop_register(void) +@@ -551,6 +557,7 @@ efi_status_t efi_gop_register(void) gopobj->info.pixels_per_scanline = col; gopobj->bpix = bpix; gopobj->fb = map_sysmem(fb_base, fb_size); @@ -1384,11 +1368,11 @@ index 41e12fa7246..1694e23dcc6 100644 return EFI_SUCCESS; } -- -2.45.1 +2.48.1 -From 63e4c90e38c476d89148f4328778af0adcbe7adf Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Mon, 21 Aug 2023 16:51:07 +0300 +From cbbd24764c84943078d07728e3c0f4b55268b0dc Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Tue, 18 Feb 2025 21:53:28 +0000 Subject: [PATCH 10/13] video: Only dcache flush damaged lines Now that we have a damage area tells us which parts of the frame buffer @@ -1401,15 +1385,16 @@ Reported-by: Da Xue [Alper: Use damage.xstart/yend, IS_ENABLED()] Co-developed-by: Alper Nebi Yasak Signed-off-by: Alper Nebi Yasak +Signed-off-by: Peter Robinson --- drivers/video/video-uclass.c | 41 +++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index cbdda274f2d..e009be4f55d 100644 +index d175ed61ac8..6452ff5039e 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -381,6 +381,41 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) +@@ -401,6 +401,41 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) priv->damage.yend = max(yend, priv->damage.yend); } @@ -1451,7 +1436,7 @@ index cbdda274f2d..e009be4f55d 100644 /* Flush video activity to the caches */ int video_sync(struct udevice *vid, bool force) { -@@ -400,11 +435,7 @@ int video_sync(struct udevice *vid, bool force) +@@ -424,11 +459,7 @@ int video_sync(struct udevice *vid, bool force) * out whether it exists? For now, ARM is safe. */ #if defined(CONFIG_ARM) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) @@ -1462,18 +1447,15 @@ index cbdda274f2d..e009be4f55d 100644 - } + video_flush_dcache(vid); #elif defined(CONFIG_VIDEO_SANDBOX_SDL) - static ulong last_sync; - + sandbox_sdl_sync(priv->fb); + #endif -- -2.45.1 +2.48.1 -From 09e504af253b3f3062891d59ad17c4fb8193dcc7 Mon Sep 17 00:00:00 2001 +From d0c47756db0fbd0c50d4cbc377a35af7133493f3 Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Sat, 25 May 2024 12:18:41 +0100 -Subject: [PATCH 11/13] From e9d51b4dcbfa43aa0e4d2b4f285bf94c295603e4 Mon Sep - 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug - 2023 16:51:08 +0300 Subject: [PATCH 11/13] video: Use VIDEO_DAMAGE for - VIDEO_COPY +Subject: [PATCH 11/13] video: Use VIDEO_DAMAGE for VIDEO_COPY CONFIG_VIDEO_COPY implemented a range-based copying mechanism: If we print a single character, it will always copy the full range of bytes @@ -1513,10 +1495,10 @@ Signed-off-by: Peter Robinson 11 files changed, 43 insertions(+), 248 deletions(-) diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index 2051f0a3d7a..93b52f2de5c 100644 +index d9e5ac6af48..7b35ad8a88f 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig -@@ -319,7 +319,6 @@ CONFIG_USB_ETH_CDC=y +@@ -328,7 +328,6 @@ CONFIG_USB_ETH_CDC=y CONFIG_VIDEO=y CONFIG_VIDEO_FONT_SUN12X22=y CONFIG_VIDEO_COPY=y @@ -1525,10 +1507,10 @@ index 2051f0a3d7a..93b52f2de5c 100644 CONFIG_CONSOLE_TRUETYPE=y CONFIG_CONSOLE_TRUETYPE_CANTORAONE=y diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index 7815b590481..88c6f8e6897 100644 +index 5d67067891b..964174b01ac 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig -@@ -83,11 +83,14 @@ config VIDEO_PCI_DEFAULT_FB_SIZE +@@ -89,11 +89,14 @@ config VIDEO_PCI_DEFAULT_FB_SIZE config VIDEO_COPY bool "Enable copying the frame buffer to a hardware copy" @@ -1543,7 +1525,7 @@ index 7815b590481..88c6f8e6897 100644 To use this, your video driver must set @copy_base in struct video_uc_plat. -@@ -105,6 +108,8 @@ config VIDEO_DAMAGE +@@ -111,6 +114,8 @@ config VIDEO_DAMAGE regions of the frame buffer that were modified before, speeding up screen refreshes significantly. @@ -1553,10 +1535,10 @@ index 7815b590481..88c6f8e6897 100644 bool "Generic PWM based Backlight Driver" depends on BACKLIGHT && DM_PWM diff --git a/drivers/video/console_normal.c b/drivers/video/console_normal.c -index 6634d3f27da..fbfd2caabc6 100644 +index 51ac8cc78e9..07db613ac53 100644 --- a/drivers/video/console_normal.c +++ b/drivers/video/console_normal.c -@@ -36,10 +36,6 @@ static int console_set_row(struct udevice *dev, uint row, int clr) +@@ -35,10 +35,6 @@ static int console_set_row(struct udevice *dev, uint row, int clr) fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); end = dst; @@ -1567,7 +1549,7 @@ index 6634d3f27da..fbfd2caabc6 100644 video_damage(dev->parent, 0, fontdata->height * row, -@@ -58,14 +54,11 @@ static int console_move_rows(struct udevice *dev, uint rowdst, +@@ -57,14 +53,11 @@ static int console_move_rows(struct udevice *dev, uint rowdst, void *dst; void *src; int size; @@ -1583,7 +1565,7 @@ index 6634d3f27da..fbfd2caabc6 100644 video_damage(dev->parent, 0, -@@ -110,10 +103,6 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) +@@ -109,10 +102,6 @@ static int console_putc_xy(struct udevice *dev, uint x_frac, uint y, int cp) fontdata->width, fontdata->height); @@ -1595,10 +1577,10 @@ index 6634d3f27da..fbfd2caabc6 100644 } diff --git a/drivers/video/console_rotate.c b/drivers/video/console_rotate.c -index 8129c7b2aa7..fa0b4faf63b 100644 +index f11dc3a0b07..886b25dcfaf 100644 --- a/drivers/video/console_rotate.c +++ b/drivers/video/console_rotate.c -@@ -22,7 +22,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) +@@ -21,7 +21,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) int pbytes = VNBYTES(vid_priv->bpix); void *start, *dst, *line; int i, j; @@ -1606,7 +1588,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 start = vid_priv->fb + vid_priv->line_length - (row + 1) * fontdata->height * pbytes; -@@ -33,9 +32,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) +@@ -32,9 +31,6 @@ static int console_set_row_1(struct udevice *dev, uint row, int clr) fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); line += vid_priv->line_length; } @@ -1616,7 +1598,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 video_damage(dev->parent, vid_priv->xsize - ((row + 1) * fontdata->height), -@@ -55,7 +51,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -54,7 +50,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, int pbytes = VNBYTES(vid_priv->bpix); void *dst; void *src; @@ -1625,7 +1607,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 dst = vid_priv->fb + vid_priv->line_length - (rowdst + count) * fontdata->height * pbytes; -@@ -63,10 +59,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -62,10 +58,7 @@ static int console_move_rows_1(struct udevice *dev, uint rowdst, uint rowsrc, (rowsrc + count) * fontdata->height * pbytes; for (j = 0; j < vid_priv->ysize; j++) { @@ -1637,7 +1619,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 src += vid_priv->line_length; dst += vid_priv->line_length; } -@@ -106,10 +99,6 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, int cp) +@@ -105,10 +98,6 @@ static int console_putc_xy_1(struct udevice *dev, uint x_frac, uint y, int cp) return ret; /* We draw backwards from 'start, so account for the first line */ @@ -1648,7 +1630,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 video_damage(dev->parent, vid_priv->xsize - y - fontdata->height, linenum - 1, -@@ -127,7 +116,7 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) +@@ -125,7 +114,7 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) struct video_fontdata *fontdata = priv->fontdata; void *start, *line, *dst, *end; int pixels = fontdata->height * vid_priv->xsize; @@ -1657,7 +1639,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 int pbytes = VNBYTES(vid_priv->bpix); start = vid_priv->fb + vid_priv->ysize * vid_priv->line_length - -@@ -137,9 +126,6 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) +@@ -135,9 +124,6 @@ static int console_set_row_2(struct udevice *dev, uint row, int clr) for (i = 0; i < pixels; i++) fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); end = dst; @@ -1667,7 +1649,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 video_damage(dev->parent, 0, -@@ -165,8 +151,7 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -163,8 +149,7 @@ static int console_move_rows_2(struct udevice *dev, uint rowdst, uint rowsrc, vid_priv->line_length; src = end - (rowsrc + count) * fontdata->height * vid_priv->line_length; @@ -1677,7 +1659,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 video_damage(dev->parent, 0, -@@ -202,11 +187,6 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, int cp) +@@ -200,11 +185,6 @@ static int console_putc_xy_2(struct udevice *dev, uint x_frac, uint y, int cp) if (ret) return ret; @@ -1689,7 +1671,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 video_damage(dev->parent, x - fontdata->width + 1, linenum - fontdata->height + 1, -@@ -223,7 +203,7 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) +@@ -221,7 +201,7 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) struct video_fontdata *fontdata = priv->fontdata; int pbytes = VNBYTES(vid_priv->bpix); void *start, *dst, *line; @@ -1698,7 +1680,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 start = vid_priv->fb + row * fontdata->height * pbytes; line = start; -@@ -233,9 +213,6 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) +@@ -231,9 +211,6 @@ static int console_set_row_3(struct udevice *dev, uint row, int clr) fill_pixel_and_goto_next(&dst, clr, pbytes, pbytes); line += vid_priv->line_length; } @@ -1708,7 +1690,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 video_damage(dev->parent, row * fontdata->height, -@@ -255,16 +232,13 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, +@@ -253,16 +230,13 @@ static int console_move_rows_3(struct udevice *dev, uint rowdst, uint rowsrc, int pbytes = VNBYTES(vid_priv->bpix); void *dst; void *src; @@ -1727,7 +1709,7 @@ index 8129c7b2aa7..fa0b4faf63b 100644 src += vid_priv->line_length; dst += vid_priv->line_length; } -@@ -300,10 +274,6 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, int cp) +@@ -298,10 +272,6 @@ static int console_putc_xy_3(struct udevice *dev, uint x_frac, uint y, int cp) line = start; ret = fill_char_horizontally(pfont, &line, vid_priv, fontdata, NORMAL_DIRECTION); @@ -1739,10 +1721,10 @@ index 8129c7b2aa7..fa0b4faf63b 100644 return ret; diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c -index ed6c9cbb4f4..4cf9b013293 100644 +index 073ddcfb695..0dfd7914dc1 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c -@@ -195,7 +195,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -194,7 +194,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) struct console_tt_priv *priv = dev_get_priv(dev); struct console_tt_metrics *met = priv->cur_met; void *end, *line; @@ -1750,7 +1732,7 @@ index ed6c9cbb4f4..4cf9b013293 100644 line = vid_priv->fb + row * met->font_size * vid_priv->line_length; end = line + met->font_size * vid_priv->line_length; -@@ -231,9 +230,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) +@@ -230,9 +229,6 @@ static int console_truetype_set_row(struct udevice *dev, uint row, int clr) default: return -ENOSYS; } @@ -1760,7 +1742,7 @@ index ed6c9cbb4f4..4cf9b013293 100644 video_damage(dev->parent, 0, -@@ -253,14 +249,11 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, +@@ -252,14 +248,11 @@ static int console_truetype_move_rows(struct udevice *dev, uint rowdst, struct console_tt_metrics *met = priv->cur_met; void *dst; void *src; @@ -1777,7 +1759,7 @@ index ed6c9cbb4f4..4cf9b013293 100644 /* Scroll up our position history */ diff = (rowsrc - rowdst) * met->font_size; -@@ -293,7 +286,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, +@@ -292,7 +285,7 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, u8 *bits, *data; int advance; void *start, *end, *line; @@ -1786,7 +1768,7 @@ index ed6c9cbb4f4..4cf9b013293 100644 /* First get some basic metrics about this character */ stbtt_GetCodepointHMetrics(font, cp, &advance, &lsb); -@@ -440,9 +433,6 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, +@@ -439,9 +432,6 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, width, height); @@ -1797,10 +1779,10 @@ index ed6c9cbb4f4..4cf9b013293 100644 return width_frac; diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c -index 5d06e51ff23..5f1dd0aaa41 100644 +index ebe96bf0c2f..a1dfd35b7b8 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c -@@ -760,22 +760,6 @@ UCLASS_DRIVER(vidconsole) = { +@@ -761,22 +761,6 @@ UCLASS_DRIVER(vidconsole) = { .per_device_auto = sizeof(struct vidconsole_priv), }; @@ -1824,10 +1806,10 @@ index 5d06e51ff23..5f1dd0aaa41 100644 { int ret; diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index e009be4f55d..b3eeccb996d 100644 +index 6452ff5039e..a828e67341b 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -153,7 +153,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -171,7 +171,7 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, struct video_priv *priv = dev_get_uclass_priv(dev); void *start, *line; int pixels = xend - xstart; @@ -1836,7 +1818,7 @@ index e009be4f55d..b3eeccb996d 100644 start = priv->fb + ystart * priv->line_length; start += xstart * VNBYTES(priv->bpix); -@@ -193,10 +193,6 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, +@@ -211,10 +211,6 @@ int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend, line += priv->line_length; } @@ -1847,7 +1829,7 @@ index e009be4f55d..b3eeccb996d 100644 video_damage(dev, xstart, ystart, xend - xstart, yend - ystart); return 0; -@@ -219,7 +215,6 @@ int video_reserve_from_bloblist(struct video_handoff *ho) +@@ -236,7 +232,6 @@ int video_reserve_from_bloblist(struct video_handoff *ho) int video_fill(struct udevice *dev, u32 colour) { struct video_priv *priv = dev_get_uclass_priv(dev); @@ -1855,7 +1837,7 @@ index e009be4f55d..b3eeccb996d 100644 switch (priv->bpix) { case VIDEO_BPP16: -@@ -244,9 +239,6 @@ int video_fill(struct udevice *dev, u32 colour) +@@ -261,9 +256,6 @@ int video_fill(struct udevice *dev, u32 colour) memset(priv->fb, colour, priv->fb_size); break; } @@ -1865,7 +1847,7 @@ index e009be4f55d..b3eeccb996d 100644 video_damage(dev, 0, 0, priv->xsize, priv->ysize); -@@ -416,6 +408,27 @@ static void video_flush_dcache(struct udevice *vid) +@@ -436,6 +428,27 @@ static void video_flush_dcache(struct udevice *vid) } #endif @@ -1893,7 +1875,7 @@ index e009be4f55d..b3eeccb996d 100644 /* Flush video activity to the caches */ int video_sync(struct udevice *vid, bool force) { -@@ -423,6 +436,9 @@ int video_sync(struct udevice *vid, bool force) +@@ -443,6 +456,9 @@ int video_sync(struct udevice *vid, bool force) struct video_ops *ops = video_get_ops(vid); int ret; @@ -1903,7 +1885,7 @@ index e009be4f55d..b3eeccb996d 100644 if (ops && ops->video_sync) { ret = ops->video_sync(vid); if (ret) -@@ -503,69 +519,6 @@ int video_get_ysize(struct udevice *dev) +@@ -524,69 +540,6 @@ int video_get_ysize(struct udevice *dev) return priv->ysize; } @@ -1974,10 +1956,10 @@ index e009be4f55d..b3eeccb996d 100644 extern u8 __splash_ ## _name ## _begin[]; \ extern u8 __splash_ ## _name ## _end[] diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c -index 10943b9ca19..da2bbe864a0 100644 +index 78de9560792..1f267d45812 100644 --- a/drivers/video/video_bmp.c +++ b/drivers/video/video_bmp.c -@@ -268,7 +268,6 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, +@@ -267,7 +267,6 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, enum video_format eformat; struct bmp_color_table_entry *palette; int hdr_size; @@ -1985,7 +1967,7 @@ index 10943b9ca19..da2bbe864a0 100644 if (!bmp || !(bmp->header.signature[0] == 'B' && bmp->header.signature[1] == 'M')) { -@@ -462,11 +461,5 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, +@@ -461,11 +460,5 @@ int video_bmp_display(struct udevice *dev, ulong bmp_image, int x, int y, video_damage(dev, x, y, width, height); @@ -1998,10 +1980,10 @@ index 10943b9ca19..da2bbe864a0 100644 return video_sync(dev, false); } diff --git a/include/video.h b/include/video.h -index 1310195f307..29eff3c0900 100644 +index 92aa5da4ff3..26327473738 100644 --- a/include/video.h +++ b/include/video.h -@@ -353,43 +353,6 @@ void video_set_default_colors(struct udevice *dev, bool invert); +@@ -355,43 +355,6 @@ void video_set_default_colors(struct udevice *dev, bool invert); */ int video_default_font_height(struct udevice *dev); @@ -2046,10 +2028,10 @@ index 1310195f307..29eff3c0900 100644 * video_damage() - Notify the video subsystem about screen updates. * diff --git a/include/video_console.h b/include/video_console.h -index 8b5928dc5eb..8806d10f946 100644 +index 723d2315606..13197fa4518 100644 --- a/include/video_console.h +++ b/include/video_console.h -@@ -529,56 +529,4 @@ void vidconsole_list_fonts(struct udevice *dev); +@@ -537,56 +537,4 @@ void vidconsole_list_fonts(struct udevice *dev); */ int vidconsole_get_font_size(struct udevice *dev, const char **name, uint *sizep); @@ -2107,10 +2089,10 @@ index 8b5928dc5eb..8806d10f946 100644 - #endif diff --git a/test/dm/video.c b/test/dm/video.c -index 8c7d9800a42..4c3bcd26e94 100644 +index 9da00be5479..eda1195d3b9 100644 --- a/test/dm/video.c +++ b/test/dm/video.c -@@ -106,6 +106,7 @@ static int check_copy_frame_buffer(struct unit_test_state *uts, +@@ -105,6 +105,7 @@ static int check_copy_frame_buffer(struct unit_test_state *uts, if (!IS_ENABLED(CONFIG_VIDEO_COPY)) return 0; @@ -2118,7 +2100,7 @@ index 8c7d9800a42..4c3bcd26e94 100644 ut_assertf(!memcmp(priv->fb, priv->copy_fb, priv->fb_size), "Copy framebuffer does not match fb"); -@@ -706,7 +707,7 @@ static int dm_test_video_copy(struct unit_test_state *uts) +@@ -705,7 +706,7 @@ static int dm_test_video_copy(struct unit_test_state *uts) vidconsole_put_string(con, test_string); vidconsole_put_string(con, test_string); ut_asserteq(7589, compress_frame_buffer(uts, dev, false)); @@ -2128,11 +2110,11 @@ index 8c7d9800a42..4c3bcd26e94 100644 return 0; } -- -2.45.1 +2.48.1 -From 6b90fed4745a705c1ca660a346a3563f0da8def5 Mon Sep 17 00:00:00 2001 -From: Alexander Graf -Date: Mon, 21 Aug 2023 16:51:09 +0300 +From 3fb044255ec50a026195586ced9e53499d701254 Mon Sep 17 00:00:00 2001 +From: Peter Robinson +Date: Tue, 18 Feb 2025 21:57:38 +0000 Subject: [PATCH 12/13] video: Always compile cache flushing code The dcache flushing code path was conditional on ARM && !DCACHE config @@ -2150,15 +2132,16 @@ Reported-by: Heinrich Schuchardt Signed-off-by: Alexander Graf Reviewed-by: Simon Glass Signed-off-by: Alper Nebi Yasak +Signed-off-by: Peter Robinson --- drivers/video/video-uclass.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c -index b3eeccb996d..33ad9ff3fab 100644 +index a828e67341b..c566931a050 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c -@@ -373,11 +373,13 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) +@@ -393,11 +393,13 @@ void video_damage(struct udevice *vid, int x, int y, int width, int height) priv->damage.yend = max(yend, priv->damage.yend); } @@ -2173,7 +2156,7 @@ index b3eeccb996d..33ad9ff3fab 100644 if (!priv->flush_dcache) return; -@@ -406,7 +408,6 @@ static void video_flush_dcache(struct udevice *vid) +@@ -426,7 +428,6 @@ static void video_flush_dcache(struct udevice *vid) } } } @@ -2181,9 +2164,9 @@ index b3eeccb996d..33ad9ff3fab 100644 static void video_flush_copy(struct udevice *vid) { -@@ -445,14 +446,9 @@ int video_sync(struct udevice *vid, bool force) - return ret; - } +@@ -469,14 +470,9 @@ int video_sync(struct udevice *vid, bool force) + get_timer(priv->last_sync) < CONFIG_VIDEO_SYNC_MS) + return 0; - /* - * flush_dcache_range() is declared in common.h but it seems that some @@ -2195,13 +2178,13 @@ index b3eeccb996d..33ad9ff3fab 100644 -#elif defined(CONFIG_VIDEO_SANDBOX_SDL) + +#if defined(CONFIG_VIDEO_SANDBOX_SDL) - static ulong last_sync; + sandbox_sdl_sync(priv->fb); + #endif - if (force || get_timer(last_sync) > 100) { -- -2.45.1 +2.48.1 -From 7cfa667a11f245596e4b31842b0d646929be24e9 Mon Sep 17 00:00:00 2001 +From 7d1ef5a8dafc5e95d5db753010f53880f49e979e Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Mon, 21 Aug 2023 16:51:10 +0300 Subject: [PATCH 13/13] video: Enable VIDEO_DAMAGE for drivers that need it @@ -2232,10 +2215,10 @@ Reviewed-by: Simon Glass 9 files changed, 16 insertions(+) diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig -index ddf9414b08e..3c9745065ba 100644 +index ba1b1541437..bb1ea961704 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig -@@ -863,6 +863,7 @@ config VIDEO_SUNXI +@@ -882,6 +882,7 @@ config VIDEO_SUNXI depends on !SUNXI_GEN_NCAT2 select VIDEO select DISPLAY @@ -2244,10 +2227,10 @@ index ddf9414b08e..3c9745065ba 100644 default y ---help--- diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig -index 88c6f8e6897..06d3ed8a736 100644 +index 964174b01ac..6e1577ae687 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig -@@ -499,6 +499,7 @@ config VIDEO_LCD_ANX9804 +@@ -534,6 +534,7 @@ config VIDEO_LCD_ANX9804 config ATMEL_LCD bool "Atmel LCD panel support" @@ -2255,7 +2238,7 @@ index 88c6f8e6897..06d3ed8a736 100644 depends on ARCH_AT91 config ATMEL_LCD_BGR555 -@@ -508,6 +509,7 @@ config ATMEL_LCD_BGR555 +@@ -543,6 +544,7 @@ config ATMEL_LCD_BGR555 config VIDEO_BCM2835 bool "Display support for BCM2835" @@ -2263,7 +2246,7 @@ index 88c6f8e6897..06d3ed8a736 100644 help The graphics processor already sets up the display so this driver simply checks the resolution and then sets up the frame buffer with -@@ -671,6 +673,7 @@ source "drivers/video/meson/Kconfig" +@@ -715,6 +717,7 @@ source "drivers/video/meson/Kconfig" config VIDEO_MVEBU bool "Armada XP LCD controller" @@ -2271,7 +2254,7 @@ index 88c6f8e6897..06d3ed8a736 100644 ---help--- Support for the LCD controller integrated in the Marvell Armada XP SoC. -@@ -705,6 +708,7 @@ config NXP_TDA19988 +@@ -749,6 +752,7 @@ config NXP_TDA19988 config ATMEL_HLCD bool "Enable ATMEL video support using HLCDC" @@ -2279,7 +2262,7 @@ index 88c6f8e6897..06d3ed8a736 100644 help HLCDC supports video output to an attached LCD panel. -@@ -781,6 +785,7 @@ source "drivers/video/tidss/Kconfig" +@@ -825,6 +829,7 @@ source "drivers/video/tidss/Kconfig" config VIDEO_TEGRA124 bool "Enable video support on Tegra124" @@ -2287,7 +2270,7 @@ index 88c6f8e6897..06d3ed8a736 100644 help Tegra124 supports many video output options including eDP and HDMI. At present only eDP is supported by U-Boot. This option -@@ -795,6 +800,7 @@ source "drivers/video/imx/Kconfig" +@@ -839,6 +844,7 @@ source "drivers/video/imx/Kconfig" config VIDEO_MXS bool "Enable video support on i.MX28/i.MX6UL/i.MX7 SoCs" @@ -2295,7 +2278,7 @@ index 88c6f8e6897..06d3ed8a736 100644 help Enable framebuffer driver for i.MX28/i.MX6UL/i.MX7 processors -@@ -857,6 +863,7 @@ config VIDEO_DW_MIPI_DSI +@@ -901,6 +907,7 @@ config VIDEO_DW_MIPI_DSI config VIDEO_SIMPLE bool "Simple display driver for preconfigured display" @@ -2303,7 +2286,7 @@ index 88c6f8e6897..06d3ed8a736 100644 help Enables a simple generic display driver which utilizes the simple-framebuffer devicetree bindings. -@@ -875,6 +882,7 @@ config VIDEO_DT_SIMPLEFB +@@ -919,6 +926,7 @@ config VIDEO_DT_SIMPLEFB config VIDEO_MCDE_SIMPLE bool "Simple driver for ST-Ericsson MCDE with preconfigured display" @@ -2395,5 +2378,5 @@ index 95086f3a5d6..3291b3ceb8d 100644 TIDSS supports video output options LVDS and DPI . This option enables these supports which can be used on -- -2.45.1 +2.48.1 diff --git a/sources b/sources index 180c13e..f13eabc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (u-boot-2025.04-rc1.tar.bz2) = b973b39c2665d30ab1a9b96fb1eaae70bbdd29dabb68e4cdcf84a11174482e8861ccd8984ca17f594ca6af15bf0517c5263574385836676413e16f911b5bbb4e +SHA512 (u-boot-2025.04-rc2.tar.bz2) = 1f86359009f69899c9310bf2cde21cede48541a5985f4d7dc4d4e4eddfb247ea6e778ca648e21df3d79231eb6b0d9f45646f09e972d5fb60a6fbfca013cecd57 diff --git a/uboot-tools.spec b/uboot-tools.spec index 5c55822..b655b95 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -1,4 +1,4 @@ -%global candidate rc1 +%global candidate rc2 %if 0%{?rhel} %bcond_with toolsonly %else @@ -7,7 +7,7 @@ Name: uboot-tools Version: 2025.04 -Release: 0.2%{?candidate:.%{candidate}}%{?dist} +Release: 0.3%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -27,7 +27,7 @@ Patch3: uefi-initial-find_fdt_location-for-finding-the-DT-on-disk.patch Patch4: disable-VBE-by-default.patch Patch5: enable-bootmenu-by-default.patch # Should be upstream but it's taking time -#Patch6: Add-video-damage-tracking.patch +Patch6: Add-video-damage-tracking.patch # Device improvments # RPi @@ -225,6 +225,9 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %endif %changelog +* Tue Feb 11 2025 Peter Robinson - 1:2025.04-0.3.rc2 +- Update to 2025.05 RC2 + * Tue Feb 11 2025 Peter Robinson - 1:2025.04-0.2.rc1 - Update to 2025.05 RC1 From df50b5d41bf91308089c9548d2955963ee4d7eba Mon Sep 17 00:00:00 2001 From: David Abdurachmanov Date: Tue, 20 Aug 2024 11:16:49 +0300 Subject: [PATCH 066/128] Add support for riscv64 Signed-off-by: David Abdurachmanov --- riscv64-boards | 4 ++++ uboot-tools.spec | 51 ++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 riscv64-boards diff --git a/riscv64-boards b/riscv64-boards new file mode 100644 index 0000000..f96e775 --- /dev/null +++ b/riscv64-boards @@ -0,0 +1,4 @@ +qemu-riscv64_spl +sifive_unleashed +sifive_unmatched +starfive_visionfive2 diff --git a/uboot-tools.spec b/uboot-tools.spec index b655b95..90aae1f 100644 --- a/uboot-tools.spec +++ b/uboot-tools.spec @@ -5,9 +5,12 @@ %bcond_without toolsonly %endif +# Set it to "opensbi" (stable) or "opensbi-unstable" (unstable, git) +%global opensbi opensbi + Name: uboot-tools Version: 2025.04 -Release: 0.3%{?candidate:.%{candidate}}%{?dist} +Release: 0.4%{?candidate:.%{candidate}}%{?dist} Epoch: 1 Summary: U-Boot utilities # Automatically converted from old format: GPLv2+ BSD LGPL-2.1+ LGPL-2.0+ - review is highly recommended. @@ -16,6 +19,7 @@ URL: http://www.denx.de/wiki/U-Boot ExcludeArch: s390x Source0: https://ftp.denx.de/pub/u-boot/u-boot-%{version}%{?candidate:-%{candidate}}.tar.bz2 Source1: aarch64-boards +Source2: riscv64-boards # This is now legacy, most devices use bootflow, we keep this for the laggards Patch1: uefi-distro-load-FDT-from-any-partition-on-boot-device.patch @@ -62,6 +66,9 @@ BuildRequires: xxd %endif %endif Requires: dtc +%ifarch riscv64 +BuildRequires: %{opensbi} +%endif %description This package contains a few U-Boot utilities - mkimage for creating boot images @@ -76,12 +83,21 @@ BuildArch: noarch %description -n uboot-images-armv8 U-Boot firmware binaries for aarch64 boards %endif + +%ifarch riscv64 +%package -n uboot-images-riscv64 +Summary: U-Boot firmware images for riscv64 boards +BuildArch: noarch + +%description -n uboot-images-riscv64 +U-Boot firmware binaries for riscv64 boards +%endif %endif %prep %autosetup -p1 -n u-boot-%{version}%{?candidate:-%{candidate}} -cp %SOURCE1 . +cp %SOURCE1 %SOURCE2 . %build mkdir builds @@ -90,7 +106,12 @@ mkdir builds %make_build HOSTCC="gcc $RPM_OPT_FLAGS" CROSS_COMPILE="" tools-all O=builds/ %if %{with toolsonly} -%ifarch aarch64 +# OpenSBI firmware is distributed in U-Boot SPL images +%ifarch riscv64 +export OPENSBI=%{_datadir}/%{opensbi}/generic/firmware/fw_dynamic.bin +%endif + +%ifarch aarch64 riscv64 for board in $(cat %{_arch}-boards) do echo "Building board: $board" @@ -181,6 +202,19 @@ done # For Apple M-series we also need the nodtb variant install -pD -m 0644 builds/apple_m1/u-boot-nodtb.bin %{buildroot}%{_datadir}/uboot/apple_m1/u-boot-nodtb.bin +%endif + +%ifarch riscv64 +for board in $(ls builds) +do + for file in u-boot.itb spl/u-boot-spl.bin spl/u-boot-spl.bin.normal.out + do + if [ -f builds/$(echo $board)/$(echo $file) ]; then + install -pD -m 0644 builds/$(echo $board)/$(echo $file) %{buildroot}%{_datadir}/uboot/$(echo $board)/$(echo $file) + fi + done +done +%endif # Bit of a hack to remove binaries we don't use as they're large for board in $(ls builds) @@ -191,7 +225,6 @@ do fi done %endif -%endif for tool in dumpimage env/fw_printenv fdt_add_pubkey fit_check_sign fit_info gdb/gdbcont gdb/gdbsend gen_eth_addr gen_ethaddr_crc ifwitool img2srec kwboot mkeficapsule mkenvimage mkimage mksunxiboot ncb proftool sunxi-spl-image-builder do @@ -222,9 +255,19 @@ install -p -m 0755 builds/tools/env/fw_printenv %{buildroot}%{_bindir} %dir %{_datadir}/uboot/ %{_datadir}/uboot/* %endif + +%ifarch riscv64 +%files -n uboot-images-riscv64 +%license Licenses/* +%dir %{_datadir}/uboot/ +%{_datadir}/uboot/* +%endif %endif %changelog +* Tue Feb 18 2025 David Abdurachmanov - 1:2025.04-0.4.rc2 +- Add support for riscv64 + * Tue Feb 11 2025 Peter Robinson - 1:2025.04-0.3.rc2 - Update to 2025.05 RC2 From 4aaac8b6b212340fc9b92daacbcd33c9d09c930f Mon Sep 17 00:00:00 2001 From: Peter Robinson Date: Fri, 7 Mar 2025 12:45:32 +0000 Subject: [PATCH 067/128] 2025.04 RC3 --- ...mem-node-for-preserving-distro-ISO-s.patch | 1288 +++++++++++++++++ USB-PD-TCPM-improvements.patch | 717 +++++++++ sources | 2 +- uboot-tools.spec | 11 +- 4 files changed, 2015 insertions(+), 3 deletions(-) create mode 100644 Add-pmem-node-for-preserving-distro-ISO-s.patch create mode 100644 USB-PD-TCPM-improvements.patch diff --git a/Add-pmem-node-for-preserving-distro-ISO-s.patch b/Add-pmem-node-for-preserving-distro-ISO-s.patch new file mode 100644 index 0000000..bc8620b --- /dev/null +++ b/Add-pmem-node-for-preserving-distro-ISO-s.patch @@ -0,0 +1,1288 @@ +From patchwork Fri Feb 28 08:45:24 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sughosh Ganu +X-Patchwork-Id: 2053441 +X-Patchwork-Delegate: xypron.glpk@gmx.de +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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 4Z41yQ5Fkdz1yKH + for ; Fri, 28 Feb 2025 19:46:06 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 2504E81100; + Fri, 28 Feb 2025 09:46:02 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de +Received: by phobos.denx.de (Postfix, from userid 109) + id B0BC2807D7; Fri, 28 Feb 2025 09:46:00 +0100 (CET) +X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de +X-Spam-Level: +X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, + RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, + RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no + autolearn_force=no version=3.4.2 +Received: from foss.arm.com (foss.arm.com [217.140.110.172]) + by phobos.denx.de (Postfix) with ESMTP id E55D680BA4 + for ; Fri, 28 Feb 2025 09:45:57 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=fail smtp.mailfrom=sughosh.ganu@linaro.org +Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) + by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 99830150C; + Fri, 28 Feb 2025 00:46:12 -0800 (PST) +Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) + by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2C1F13F673; + Fri, 28 Feb 2025 00:45:53 -0800 (PST) +From: Sughosh Ganu +To: u-boot@lists.denx.de +Cc: Ilias Apalodimas , + Simon Glass , Tom Rini , + Heinrich Schuchardt , + Anton Antonov , + Tobias Waldekranz , Bin Meng , + Masahisa Kojima , + Sughosh Ganu +Subject: [PATCH v6 1/6] fdt: add support for adding pmem nodes +Date: Fri, 28 Feb 2025 14:15:24 +0530 +Message-Id: <20250228084529.127823-2-sughosh.ganu@linaro.org> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20250228084529.127823-1-sughosh.ganu@linaro.org> +References: <20250228084529.127823-1-sughosh.ganu@linaro.org> +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 + +From: Masahisa Kojima + +One of the problems OS installers face, when running in EFI, is that +the mounted ISO after calling ExitBootServices goes away. For some +distros this is a problem since they rely on finding some core packages +before continuing the installation. Distros have works around this -- +e.g Fedora has a special kernel command line parameter called +inst.stage2 [0]. + +ACPI has NFIT and NVDIMM support to provide ramdisks to the OS, but we +don't have anything in place for DTs. Linux and device trees have support +for persistent memory devices. So add a function that can inject a pmem +node in a DT, so we can use it when launhing OS installers with EFI. + +[0] +https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options#sect-boot-options-installer + +Signed-off-by: Masahisa Kojima +Signed-off-by: Sughosh Ganu +--- +Changes since V5: None + + boot/fdt_support.c | 41 ++++++++++++++++++++++++++++++++++++++++- + include/fdt_support.h | 14 ++++++++++++++ + 2 files changed, 54 insertions(+), 1 deletion(-) + +diff --git a/boot/fdt_support.c b/boot/fdt_support.c +index 49efeec3681..e20b9759138 100644 +--- a/boot/fdt_support.c ++++ b/boot/fdt_support.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -464,7 +465,6 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat, + do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create); + } + +-#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY + /* + * fdt_pack_reg - pack address and size array into the "reg"-suitable stream + */ +@@ -493,6 +493,7 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size, + return p - (char *)buf; + } + ++#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY + #if CONFIG_NR_DRAM_BANKS > 4 + #define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS + #else +@@ -2222,3 +2223,41 @@ int fdt_valid(struct fdt_header **blobp) + } + return 1; + } ++ ++int fdt_fixup_pmem_region(void *blob, ulong addr, u32 size) ++{ ++ u64 pmem_start[2] = { 0 }; ++ u64 pmem_size[2] = { 0 }; ++ char pmem_node[32] = {0}; ++ int nodeoffset, len; ++ int err; ++ u8 tmp[4 * 16]; /* Up to 64-bit address + 64-bit size */ ++ ++ if (!IS_ALIGNED(addr, SZ_2M) || !IS_ALIGNED(addr + size, SZ_2M)) { ++ printf("Start and end address must be 2MiB aligned\n"); ++ return -1; ++ } ++ ++ snprintf(pmem_node, sizeof(pmem_node), "pmem@%lx", addr); ++ nodeoffset = fdt_find_or_add_subnode(blob, 0, pmem_node); ++ if (nodeoffset < 0) ++ return nodeoffset; ++ ++ err = fdt_setprop_string(blob, nodeoffset, "compatible", "pmem-region"); ++ if (err) ++ return err; ++ err = fdt_setprop_empty(blob, nodeoffset, "volatile"); ++ if (err) ++ return err; ++ pmem_start[0] = addr; ++ pmem_size[0] = size; ++ len = fdt_pack_reg(blob, tmp, pmem_start, pmem_size, 1); ++ err = fdt_setprop(blob, nodeoffset, "reg", tmp, len); ++ if (err < 0) { ++ printf("WARNING: could not set pmem %s %s.\n", "reg", ++ fdt_strerror(err)); ++ return err; ++ } ++ ++ return 0; ++} +diff --git a/include/fdt_support.h b/include/fdt_support.h +index f0ad2e6b365..b72cd2920de 100644 +--- a/include/fdt_support.h ++++ b/include/fdt_support.h +@@ -507,4 +507,18 @@ void fdt_fixup_pstore(void *blob); + */ + int fdt_kaslrseed(void *blob, bool overwrite); + ++/** ++ * fdt_fixup_pmem_region() - add a pmem node on the device tree ++ * ++ * This functions adds/updates a pmem node to the device tree. ++ * Usually used with EFI installers to preserve installer ++ * images ++ * ++ * @blob: device tree provided by caller ++ * @addr: start address of the pmem node ++ * @size: size of the memory of the pmem node ++ * Return: 0 on success or < 0 on failure ++ */ ++int fdt_fixup_pmem_region(void *blob, ulong addr, u32 size); ++ + #endif /* ifndef __FDT_SUPPORT_H */ + +From patchwork Fri Feb 28 08:45:25 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sughosh Ganu +X-Patchwork-Id: 2053442 +X-Patchwork-Delegate: xypron.glpk@gmx.de +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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 4Z41yc0t0Hz1yKH + for ; Fri, 28 Feb 2025 19:46:16 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 70EA880BA4; + Fri, 28 Feb 2025 09:46:06 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de +Received: by phobos.denx.de (Postfix, from userid 109) + id 7E3C9810ED; Fri, 28 Feb 2025 09:46:05 +0100 (CET) +X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de +X-Spam-Level: +X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, + RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, + RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no + autolearn_force=no version=3.4.2 +Received: from foss.arm.com (foss.arm.com [217.140.110.172]) + by phobos.denx.de (Postfix) with ESMTP id A11D3810EB + for ; Fri, 28 Feb 2025 09:46:01 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=fail smtp.mailfrom=sughosh.ganu@linaro.org +Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) + by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 58EBF113E; + Fri, 28 Feb 2025 00:46:16 -0800 (PST) +Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) + by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E0A503F673; + Fri, 28 Feb 2025 00:45:57 -0800 (PST) +From: Sughosh Ganu +To: u-boot@lists.denx.de +Cc: Ilias Apalodimas , + Simon Glass , Tom Rini , + Heinrich Schuchardt , + Anton Antonov , + Tobias Waldekranz , Bin Meng , + Sughosh Ganu , + Heinrich Schuchardt +Subject: [PATCH v6 2/6] efi_loader: add a function to remove memory from the + EFI map +Date: Fri, 28 Feb 2025 14:15:25 +0530 +Message-Id: <20250228084529.127823-3-sughosh.ganu@linaro.org> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20250228084529.127823-1-sughosh.ganu@linaro.org> +References: <20250228084529.127823-1-sughosh.ganu@linaro.org> +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 + +From: Ilias Apalodimas + +With upcoming changes supporting pmem nodes, we need to remove the +pmem area from the EFI memory map. Add a function to do that. + +Signed-off-by: Ilias Apalodimas +Signed-off-by: Sughosh Ganu +Reviewed-by: Heinrich Schuchardt +--- +Changes since V5: None + + include/efi_loader.h | 18 ++++++++++++ + lib/efi_loader/efi_memory.c | 56 ++++++++++++++++++++++++++----------- + 2 files changed, 58 insertions(+), 16 deletions(-) + +diff --git a/include/efi_loader.h b/include/efi_loader.h +index 1d75d97ebbc..0ac00911598 100644 +--- a/include/efi_loader.h ++++ b/include/efi_loader.h +@@ -852,6 +852,24 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, + /* Adds a range into the EFI memory map */ + efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type); + ++/** ++ * efi_update_memory_map() - update the memory map by adding/removing pages ++ * ++ * @start: start address, must be a multiple of ++ * EFI_PAGE_SIZE ++ * @pages: number of pages to add ++ * @memory_type: type of memory added ++ * @overlap_conventional: region may only overlap free(conventional) ++ * memory ++ * @remove: remove memory map ++ * Return: status code ++ */ ++efi_status_t efi_update_memory_map(u64 start, u64 pages, int memory_type, ++ bool overlap_conventional, bool remove); ++ ++/* Remove memory from the EFI memory map */ ++efi_status_t efi_remove_memory_map(u64 start, u64 size, int memory_type); ++ + /* Called by board init to initialize the EFI drivers */ + efi_status_t efi_driver_init(void); + /* Called when a block device is added */ +diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c +index 6d00b186250..3fec40b6de5 100644 +--- a/lib/efi_loader/efi_memory.c ++++ b/lib/efi_loader/efi_memory.c +@@ -258,7 +258,7 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map, + } + + /** +- * efi_add_memory_map_pg() - add pages to the memory map ++ * efi_update_memory_map() - update the memory map by adding/removing pages + * + * @start: start address, must be a multiple of + * EFI_PAGE_SIZE +@@ -266,12 +266,11 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map, + * @memory_type: type of memory added + * @overlap_conventional: region may only overlap free(conventional) + * memory ++ * @remove: remove memory map + * Return: status code + */ +-static +-efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, +- int memory_type, +- bool overlap_conventional) ++efi_status_t efi_update_memory_map(u64 start, u64 pages, int memory_type, ++ bool overlap_conventional, bool remove) + { + struct efi_mem_list *lmem; + struct efi_mem_list *newlist; +@@ -279,9 +278,9 @@ efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, + uint64_t carved_pages = 0; + struct efi_event *evt; + +- EFI_PRINT("%s: 0x%llx 0x%llx %d %s\n", __func__, ++ EFI_PRINT("%s: 0x%llx 0x%llx %d %s %s\n", __func__, + start, pages, memory_type, overlap_conventional ? +- "yes" : "no"); ++ "yes" : "no", remove ? "remove" : "add"); + + if (memory_type >= EFI_MAX_MEMORY_TYPE) + return EFI_INVALID_PARAMETER; +@@ -364,7 +363,10 @@ efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, + } + + /* Add our new map */ +- list_add_tail(&newlist->link, &efi_mem); ++ if (!remove) ++ list_add_tail(&newlist->link, &efi_mem); ++ else ++ free(newlist); + + /* And make sure memory is listed in descending order */ + efi_mem_sort(); +@@ -401,7 +403,29 @@ efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type) + pages = efi_size_in_pages(size + (start & EFI_PAGE_MASK)); + start &= ~EFI_PAGE_MASK; + +- return efi_add_memory_map_pg(start, pages, memory_type, false); ++ return efi_update_memory_map(start, pages, memory_type, false, false); ++} ++ ++/** ++ * efi_remove_memory_map() - remove memory area to the memory map ++ * ++ * @start: start address of the memory area ++ * @size: length in bytes of the memory area ++ * @memory_type: type of memory removed ++ * ++ * Return: status code ++ * ++ * This function automatically aligns the start and size of the memory area ++ * to EFI_PAGE_SIZE. ++ */ ++efi_status_t efi_remove_memory_map(u64 start, u64 size, int memory_type) ++{ ++ u64 pages; ++ ++ pages = efi_size_in_pages(size + (start & EFI_PAGE_MASK)); ++ start &= ~EFI_PAGE_MASK; ++ ++ return efi_update_memory_map(start, pages, memory_type, false, true); + } + + /** +@@ -502,7 +526,7 @@ efi_status_t efi_allocate_pages(enum efi_allocate_type type, + + efi_addr = (u64)(uintptr_t)map_sysmem(addr, 0); + /* Reserve that map in our memory maps */ +- ret = efi_add_memory_map_pg(efi_addr, pages, memory_type, true); ++ ret = efi_update_memory_map(efi_addr, pages, memory_type, true, false); + if (ret != EFI_SUCCESS) { + /* Map would overlap, bail out */ + lmb_free_flags(addr, (u64)pages << EFI_PAGE_SHIFT, flags); +@@ -823,8 +847,8 @@ static void add_u_boot_and_runtime(void) + uboot_stack_size) & ~EFI_PAGE_MASK; + uboot_pages = ((uintptr_t)map_sysmem(gd->ram_top - 1, 0) - + uboot_start + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT; +- efi_add_memory_map_pg(uboot_start, uboot_pages, EFI_BOOT_SERVICES_CODE, +- false); ++ efi_update_memory_map(uboot_start, uboot_pages, EFI_BOOT_SERVICES_CODE, ++ false, false); + #if defined(__aarch64__) + /* + * Runtime Services must be 64KiB aligned according to the +@@ -842,8 +866,8 @@ static void add_u_boot_and_runtime(void) + runtime_end = (uintptr_t)__efi_runtime_stop; + runtime_end = (runtime_end + runtime_mask) & ~runtime_mask; + runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; +- efi_add_memory_map_pg(runtime_start, runtime_pages, +- EFI_RUNTIME_SERVICES_CODE, false); ++ efi_update_memory_map(runtime_start, runtime_pages, ++ EFI_RUNTIME_SERVICES_CODE, false, false); + } + + int efi_memory_init(void) +@@ -878,11 +902,11 @@ int efi_map_update_notify(phys_addr_t addr, phys_size_t size, + pages = efi_size_in_pages(size + (efi_addr & EFI_PAGE_MASK)); + efi_addr &= ~EFI_PAGE_MASK; + +- status = efi_add_memory_map_pg(efi_addr, pages, ++ status = efi_update_memory_map(efi_addr, pages, + op == LMB_MAP_OP_RESERVE ? + EFI_BOOT_SERVICES_DATA : + EFI_CONVENTIONAL_MEMORY, +- false); ++ false, false); + if (status != EFI_SUCCESS) { + log_err("LMB Map notify failure %lu\n", + status & ~EFI_ERROR_MASK); + +From patchwork Fri Feb 28 08:45:26 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sughosh Ganu +X-Patchwork-Id: 2053443 +X-Patchwork-Delegate: xypron.glpk@gmx.de +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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 4Z41ym1cNCz1yKH + for ; Fri, 28 Feb 2025 19:46:24 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id BD37E810F1; + Fri, 28 Feb 2025 09:46:08 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de +Received: by phobos.denx.de (Postfix, from userid 109) + id 4D257810F1; Fri, 28 Feb 2025 09:46:07 +0100 (CET) +X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de +X-Spam-Level: +X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, + RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, + RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no + autolearn_force=no version=3.4.2 +Received: from foss.arm.com (foss.arm.com [217.140.110.172]) + by phobos.denx.de (Postfix) with ESMTP id 23B3B80FE1 + for ; Fri, 28 Feb 2025 09:46:05 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=fail smtp.mailfrom=sughosh.ganu@linaro.org +Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) + by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB084113E; + Fri, 28 Feb 2025 00:46:19 -0800 (PST) +Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) + by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A01053F673; + Fri, 28 Feb 2025 00:46:01 -0800 (PST) +From: Sughosh Ganu +To: u-boot@lists.denx.de +Cc: Ilias Apalodimas , + Simon Glass , Tom Rini , + Heinrich Schuchardt , + Anton Antonov , + Tobias Waldekranz , Bin Meng , + Sughosh Ganu +Subject: [PATCH v6 3/6] efi_loader: preserve installer images in pmem +Date: Fri, 28 Feb 2025 14:15:26 +0530 +Message-Id: <20250228084529.127823-4-sughosh.ganu@linaro.org> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20250228084529.127823-1-sughosh.ganu@linaro.org> +References: <20250228084529.127823-1-sughosh.ganu@linaro.org> +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 + +From: Ilias Apalodimas + +One of the problems OS installers face, when running in EFI, is that +the mounted ISO after calling ExitBootServices goes away. For some +distros this is a problem since they rely on finding some core packages +before continuing the installation. Distros have works around this -- +e.g Fedora has a special kernel command line parameter called +inst.stage2 [0]. + +ACPI has NFIT and NVDIMM support to provide ramdisks to the OS, but we +don't have anything in place for DTs. Linux and device trees have support +for persistent memory devices. + +It's worth noting that for linux to instantiate the /dev/pmemX device, +the memory described in the pmem node has to be omitted from the EFI +memory map we hand over to the OS if ZONE_DEVICES and SPARSEMEM is +enabled. With those enabled the pmem driver ends up calling +devm_memremap_pages() instead of devm_memremap(). The latter works +whether the memory is omitted or marked as reserved, but mapping pages +only works if the memory is omitted. + +On top of that, depending on how the kernel is configured, that memory +area must be page aligned or 2MB aligned. PowerPC is an exception here +and requires 16MB alignment, but since we don't have EFI support for +it, limit the alignment to 2MB. + +Ensure that the ISO image is 2MB aligned and remove the region +occupied by the image from the EFI memory map. + +Signed-off-by: Ilias Apalodimas +Signed-off-by: Sughosh Ganu +--- +Changes since V5: None + + lib/efi_loader/efi_bootmgr.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c +index c6124c590d9..081eff057f4 100644 +--- a/lib/efi_loader/efi_bootmgr.c ++++ b/lib/efi_loader/efi_bootmgr.c +@@ -18,6 +18,8 @@ + #include + #include + #include ++#include ++#include + + static const struct efi_boot_services *bs; + static const struct efi_runtime_services *rs; +@@ -362,13 +364,16 @@ static efi_status_t prepare_loaded_image(u16 *label, ulong addr, ulong size, + } + + /* +- * TODO: expose the ramdisk to OS. +- * Need to pass the ramdisk information by the architecture-specific +- * methods such as 'pmem' device-tree node. ++ * Linux supports 'pmem' which allows OS installers to find, reclaim ++ * the mounted images and continue the installation since the contents ++ * of the pmem region are treated as local media. ++ * ++ * The memory regions used for it needs to be carved out of the EFI ++ * memory map. + */ +- ret = efi_add_memory_map(addr, size, EFI_RESERVED_MEMORY_TYPE); ++ ret = efi_remove_memory_map(addr, size, EFI_CONVENTIONAL_MEMORY); + if (ret != EFI_SUCCESS) { +- log_err("Memory reservation failed\n"); ++ log_err("Failed to reserve memory\n"); + goto err; + } + +@@ -490,6 +495,13 @@ static efi_status_t try_load_from_uri_path(struct efi_device_path_uri *uridp, + ret = EFI_INVALID_PARAMETER; + goto err; + } ++ /* ++ * Depending on the kernel configuration, pmem memory area must be page ++ * aligned or 2MB aligned. PowerPC is an exception here and requires ++ * 16MB alignment, but since we don't have EFI support for it, limit ++ * the alignment to 2MB. ++ */ ++ image_size = ALIGN(image_size, SZ_2M); + + /* + * If the file extension is ".iso" or ".img", mount it and try to load + +From patchwork Fri Feb 28 08:45:27 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sughosh Ganu +X-Patchwork-Id: 2053444 +X-Patchwork-Delegate: xypron.glpk@gmx.de +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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 4Z41z21cqkz1yKH + for ; Fri, 28 Feb 2025 19:46:38 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id B7A2B810FE; + Fri, 28 Feb 2025 09:46:11 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de +Received: by phobos.denx.de (Postfix, from userid 109) + id 9A8D9811C5; Fri, 28 Feb 2025 09:46:10 +0100 (CET) +X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de +X-Spam-Level: +X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, + RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, + RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no + autolearn_force=no version=3.4.2 +Received: from foss.arm.com (foss.arm.com [217.140.110.172]) + by phobos.denx.de (Postfix) with ESMTP id A52C180FE1 + for ; Fri, 28 Feb 2025 09:46:08 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=fail smtp.mailfrom=sughosh.ganu@linaro.org +Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) + by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 48F081688; + Fri, 28 Feb 2025 00:46:23 -0800 (PST) +Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) + by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E23D3F673; + Fri, 28 Feb 2025 00:46:04 -0800 (PST) +From: Sughosh Ganu +To: u-boot@lists.denx.de +Cc: Ilias Apalodimas , + Simon Glass , Tom Rini , + Heinrich Schuchardt , + Anton Antonov , + Tobias Waldekranz , Bin Meng , + Sughosh Ganu +Subject: [PATCH v6 4/6] blkmap: store type of blkmap slice in corresponding + structure +Date: Fri, 28 Feb 2025 14:15:27 +0530 +Message-Id: <20250228084529.127823-5-sughosh.ganu@linaro.org> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20250228084529.127823-1-sughosh.ganu@linaro.org> +References: <20250228084529.127823-1-sughosh.ganu@linaro.org> +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 information about the type of blkmap slice as an attribute in the +corresponding slice structure. Put information in the blkmap slice +structure to identify if it is associated with a memory or linear +mapped device. Which can then be used to take specific action based on +the type of the blkmap slice. + +Signed-off-by: Sughosh Ganu +Reviewed-by: Tobias Waldekranz +Reviewed-by: Ilias Apalodimas +--- +Changes since V5: None + + drivers/block/blkmap.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/block/blkmap.c b/drivers/block/blkmap.c +index 34eed1380dc..453510cca62 100644 +--- a/drivers/block/blkmap.c ++++ b/drivers/block/blkmap.c +@@ -16,6 +16,10 @@ + + struct blkmap; + ++/* Attributes of blkmap slice */ ++#define BLKMAP_SLICE_LINEAR BIT(0) ++#define BLKMAP_SLICE_MEM BIT(1) ++ + /** + * struct blkmap_slice - Region mapped to a blkmap + * +@@ -25,12 +29,14 @@ struct blkmap; + * @node: List node used to associate this slice with a blkmap + * @blknr: Start block number of the mapping + * @blkcnt: Number of blocks covered by this mapping ++ * @attr: Attributes of blkmap slice + */ + struct blkmap_slice { + struct list_head node; + + lbaint_t blknr; + lbaint_t blkcnt; ++ uint attr; + + /** + * @read: - Read from slice +@@ -169,6 +175,7 @@ int blkmap_map_linear(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, + .slice = { + .blknr = blknr, + .blkcnt = blkcnt, ++ .attr = BLKMAP_SLICE_LINEAR, + + .read = blkmap_linear_read, + .write = blkmap_linear_write, +@@ -248,6 +255,7 @@ int __blkmap_map_mem(struct udevice *dev, lbaint_t blknr, lbaint_t blkcnt, + .slice = { + .blknr = blknr, + .blkcnt = blkcnt, ++ .attr = BLKMAP_SLICE_MEM, + + .read = blkmap_mem_read, + .write = blkmap_mem_write, + +From patchwork Fri Feb 28 08:45:28 2025 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: Sughosh Ganu +X-Patchwork-Id: 2053445 +X-Patchwork-Delegate: xypron.glpk@gmx.de +Return-Path: +X-Original-To: incoming@patchwork.ozlabs.org +Delivered-To: patchwork-incoming@legolas.ozlabs.org +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) server-digest SHA384) + (No client certificate requested) + by legolas.ozlabs.org (Postfix) with ESMTPS id 4Z41zB6lfpz1yKH + for ; Fri, 28 Feb 2025 19:46:46 +1100 (AEDT) +Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) + by phobos.denx.de (Postfix) with ESMTP id 1822281111; + Fri, 28 Feb 2025 09:46:15 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de +Received: by phobos.denx.de (Postfix, from userid 109) + id A6651807D7; Fri, 28 Feb 2025 09:46:14 +0100 (CET) +X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de +X-Spam-Level: +X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, + RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, + RCVD_IN_VALIDITY_RPBL_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no + autolearn_force=no version=3.4.2 +Received: from foss.arm.com (foss.arm.com [217.140.110.172]) + by phobos.denx.de (Postfix) with ESMTP id 7B487811C5 + for ; Fri, 28 Feb 2025 09:46:12 +0100 (CET) +Authentication-Results: phobos.denx.de; + dmarc=fail (p=none dis=none) header.from=linaro.org +Authentication-Results: phobos.denx.de; + spf=fail smtp.mailfrom=sughosh.ganu@linaro.org +Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) + by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B092113E; + Fri, 28 Feb 2025 00:46:27 -0800 (PST) +Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) + by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 103233F673; + Fri, 28 Feb 2025 00:46:08 -0800 (PST) +From: Sughosh Ganu +To: u-boot@lists.denx.de +Cc: Ilias Apalodimas , + Simon Glass , Tom Rini , + Heinrich Schuchardt , + Anton Antonov , + Tobias Waldekranz , Bin Meng , + Sughosh Ganu +Subject: [PATCH v6 5/6] blkmap: add an attribute to preserve the mem mapping +Date: Fri, 28 Feb 2025 14:15:28 +0530 +Message-Id: <20250228084529.127823-6-sughosh.ganu@linaro.org> +X-Mailer: git-send-email 2.34.1 +In-Reply-To: <20250228084529.127823-1-sughosh.ganu@linaro.org> +References: <20250228084529.127823-1-sughosh.ganu@linaro.org> +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 + +Some blkmap memory mapped devices might have to be be relevant even +after U-Boot passes control to the next image as part of the platform +boot. An example of such a mapping would be an OS installer ISO image, +information for which has to be provided to the OS kernel. Use the +'preserve' attribute for such mappings. The code for adding a pmem +node to the device-tree then checks if this attribute is set, and adds +a node only for mappings which have this attribute. + +Signed-off-by: Sughosh Ganu +Reviewed-by: Tobias Waldekranz +Reviewed-by: Ilias Apalodimas +--- +Changes since V5: None + + cmd/blkmap.c | 9 +++++++-- + drivers/block/blkmap.c | 12 ++++++++---- + drivers/block/blkmap_helper.c | 2 +- + include/blkmap.h | 4 +++- + 4 files changed, 19 insertions(+), 8 deletions(-) + +diff --git a/cmd/blkmap.c b/cmd/blkmap.c +index 164f80f1387..86a123b1cd3 100644 +--- a/cmd/blkmap.c ++++ b/cmd/blkmap.c +@@ -62,13 +62,18 @@ static int do_blkmap_map_mem(struct map_ctx *ctx, int argc, char *const argv[]) + { + phys_addr_t addr; + int err; ++ bool preserve = false; + + if (argc < 2) + return CMD_RET_USAGE; + + addr = hextoul(argv[1], NULL); + +- err = blkmap_map_pmem(ctx->dev, ctx->blknr, ctx->blkcnt, addr); ++ if (argc == 3 && !strcmp(argv[2], "preserve")) ++ preserve = true; ++ ++ err = blkmap_map_pmem(ctx->dev, ctx->blknr, ctx->blkcnt, addr, ++ preserve); + if (err) { + printf("Unable to map %#llx at block 0x" LBAF ": %d\n", + (unsigned long long)addr, ctx->blknr, err); +@@ -221,7 +226,7 @@ U_BOOT_CMD_WITH_SUBCMDS( + "blkmap create