{"id":2223046,"url":"http://patchwork.ozlabs.org/api/patches/2223046/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/patch/20260414-fix_usb_adc_meausurement-v1-1-8cdbd4c10dd8@foss.st.com/","project":{"id":18,"url":"http://patchwork.ozlabs.org/api/projects/18/?format=json","name":"U-Boot","link_name":"uboot","list_id":"u-boot.lists.denx.de","list_email":"u-boot@lists.denx.de","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260414-fix_usb_adc_meausurement-v1-1-8cdbd4c10dd8@foss.st.com>","list_archive_url":null,"date":"2026-04-14T09:06:50","name":"board: stm32pm1: Fix board_check_usb_power()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"09404765bd68bf13fe5d3f812a85eed3318dc1a7","submitter":{"id":80709,"url":"http://patchwork.ozlabs.org/api/people/80709/?format=json","name":"Patrice Chotard","email":"patrice.chotard@foss.st.com"},"delegate":{"id":70413,"url":"http://patchwork.ozlabs.org/api/users/70413/?format=json","username":"pchotard","first_name":"Patrice","last_name":"Chotard","email":"patrice.chotard@st.com"},"mbox":"http://patchwork.ozlabs.org/project/uboot/patch/20260414-fix_usb_adc_meausurement-v1-1-8cdbd4c10dd8@foss.st.com/mbox/","series":[{"id":499803,"url":"http://patchwork.ozlabs.org/api/series/499803/?format=json","web_url":"http://patchwork.ozlabs.org/project/uboot/list/?series=499803","date":"2026-04-14T09:06:50","name":"board: stm32pm1: Fix board_check_usb_power()","version":1,"mbox":"http://patchwork.ozlabs.org/series/499803/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223046/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223046/checks/","tags":{},"related":[],"headers":{"Return-Path":"<u-boot-bounces@lists.denx.de>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=foss.st.com header.i=@foss.st.com header.a=rsa-sha256\n header.s=selector2 header.b=ZUj9GJh2;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de\n (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de;\n envelope-from=u-boot-bounces@lists.denx.de; receiver=patchwork.ozlabs.org)","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=foss.st.com","phobos.denx.de;\n spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de","phobos.denx.de;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=foss.st.com header.i=@foss.st.com header.b=\"ZUj9GJh2\";\n\tdkim-atps=neutral","phobos.denx.de;\n dmarc=pass (p=none dis=none) header.from=foss.st.com","phobos.denx.de;\n spf=pass smtp.mailfrom=patrice.chotard@foss.st.com"],"Received":["from phobos.denx.de (unknown\n [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvz1f3SgYz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 19:07:17 +1000 (AEST)","from h2850616.stratoserver.net (localhost [IPv6:::1])\n\tby phobos.denx.de (Postfix) with ESMTP id 55EFA841C2;\n\tTue, 14 Apr 2026 11:07:03 +0200 (CEST)","by phobos.denx.de (Postfix, from userid 109)\n id 5135A841CD; Tue, 14 Apr 2026 11:07:00 +0200 (CEST)","from OSPPR02CU001.outbound.protection.outlook.com\n (mail-norwayeastazlp170130007.outbound.protection.outlook.com\n [IPv6:2a01:111:f403:c20f::7])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))\n (No client certificate requested)\n by phobos.denx.de (Postfix) with ESMTPS id 2E724841B9\n for <u-boot@lists.denx.de>; Tue, 14 Apr 2026 11:06:58 +0200 (CEST)","from CWLP265CA0517.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:18c::18)\n by PAVPR10MB6791.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:102:2fe::11)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.48; Tue, 14 Apr\n 2026 09:06:55 +0000","from AM3PEPF00009B9E.eurprd04.prod.outlook.com\n (2603:10a6:400:18c:cafe::d4) by CWLP265CA0517.outlook.office365.com\n (2603:10a6:400:18c::18) with Microsoft SMTP Server (version=TLS1_3,\n cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.48 via Frontend Transport; Tue,\n 14 Apr 2026 09:06:55 +0000","from smtpO365.st.com (164.130.1.59) by\n AM3PEPF00009B9E.mail.protection.outlook.com (10.167.16.23) with Microsoft\n SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.20.9769.17 via Frontend Transport; Tue, 14 Apr 2026 09:06:55 +0000","from STKDAG1NODE1.st.com (10.75.128.132) by smtpo365.st.com\n (10.250.44.71) with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 14 Apr\n 2026 11:10:03 +0200","from localhost (10.48.87.93) by STKDAG1NODE1.st.com (10.75.128.132)\n with Microsoft SMTP Server (version=TLS1_2,\n cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.29; Tue, 14 Apr\n 2026 11:06:54 +0200"],"X-Spam-Checker-Version":"SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de","X-Spam-Level":"","X-Spam-Status":"No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,\n DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS\n autolearn=ham autolearn_force=no version=3.4.2","ARC-Seal":"i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;\n b=Mvhg7t80q4uDj42hFgDvoO1k83HFxKnoDGTyCKmyrLJ9K0bodC0zvc7MewW7qmmz9HcQruo+JTPW5tdAFCHs8xVFvH7VGRlnHCt8oGxqBpzv9BrNSCndM4IWcG08EzpG8wzMy6eLf/vFm6YwpLWW0j669iQ+JRlJn0+L9iD9n5fn7ooS4pB85kj2DRsqMc+xcOukyDoer3TRPZv68UgsKXg/QgKfqoGocfjvA3sIR+E/Hg0icRm3XYGznSMtqB7HngQuyogrpU2XM8MIhGWCVk/cCbblkcarR6qIh3xkrGViR6gf+3ybqrhH2dwBEFN7PtsFq5ucHyWTg2BMp3WKnw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;\n s=arcselector10001;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;\n bh=dPQqIMq6EZjqNVOAL9IxvlHh6PoJjLH+om8aeJIYX+8=;\n b=Hq5jEtlDViIeVpPfvTKYdJgwlaiqC3N0pCbESBF4ABCQ2/h1v1G4ptq6c5SETkRWmphePkLbfXNH3GyaCinHynAc1XujYNlPt8WhS7cWKrcQocz/XxLPCCGgM2ilV5YNhRNI8vejxYY6fpb1HHM65jQy4Y7CCaCaZcsxQ8xqhXqvzKbkeTz8OHUJq4T4V7nI8kC4KZoVhIjWdkedS21VTCg62krRghtMUpbnpm67HqSyXsXuRZMNI/eaqu3o37XOjgSmBbBmQpY6aDhdU+13dPLZy5ATnpOLJZlWqy5pt28Vm/SAXEFfD7iitFXkNVcSqzyeqEipZ13cV59vis909Q==","ARC-Authentication-Results":"i=1; mx.microsoft.com 1; spf=fail (sender ip is\n 164.130.1.59) smtp.rcpttodomain=konsulko.com smtp.mailfrom=foss.st.com;\n dmarc=fail (p=none sp=none pct=100) action=none header.from=foss.st.com;\n dkim=none (message not signed); arc=none (0)","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com;\n s=selector2;\n h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;\n bh=dPQqIMq6EZjqNVOAL9IxvlHh6PoJjLH+om8aeJIYX+8=;\n b=ZUj9GJh2tN2oMdjaL7gvNfCNw37lZWrRpbsSGikM3PmIJ11h7T4Ybnc2308DrzYPTi+jzWhda381knCqwq1aef03LF/qJIO2Kv8jlxbzY/V34IMKf0+JuoMjciUGXcPHwwNYwHrLXUzrCMQiIt62K3o57pPioDE8Z0e4QBoHYsi0gYBOudwON0Fdsk1JNZAAs4Kxz0uV9jUwSrI1OrhVEKaTi2hHF9xBTRj2eDUJdtur61KDbrKDE6B8wCCDihUlEVRWgoA1Gm8136Z2bUOxVc3GXh4hlmDlVpp7e7WmPtmdealSeTTVdSKkpB0Txayb9Ocw55nWk5fEP98F6BfVcQ==","X-MS-Exchange-Authentication-Results":"spf=fail (sender IP is 164.130.1.59)\n smtp.mailfrom=foss.st.com; dkim=none (message not signed)\n header.d=none;dmarc=fail action=none header.from=foss.st.com;","Received-SPF":"Fail (protection.outlook.com: domain of foss.st.com does not\n designate 164.130.1.59 as permitted sender) receiver=protection.outlook.com;\n client-ip=164.130.1.59; helo=smtpO365.st.com;","From":"Patrice Chotard <patrice.chotard@foss.st.com>","Date":"Tue, 14 Apr 2026 11:06:50 +0200","Subject":"[PATCH] board: stm32pm1: Fix board_check_usb_power()","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-ID":"<20260414-fix_usb_adc_meausurement-v1-1-8cdbd4c10dd8@foss.st.com>","X-B4-Tracking":"v=1; b=H4sIAKkD3mkC/x2MQQqDMBQFryJ/3YBK0OhVpIQkPtu/MEp+UwrBu\n ze4HJiZQoLEEJqbQglfFj5ihe7RUHi7+ILitTL1bT+0utNq45/N4q1bg93hsuSEHfGjoDH5cTI\n mBE81PxOqe6+X53X9ARH1lCBqAAAA","X-Change-ID":"20260414-fix_usb_adc_meausurement-e4e9b7988ccb","To":"<uboot-stm32@st-md-mailman.stormreply.com>, <u-boot@lists.denx.de>","CC":"Patrick Delaunay <patrick.delaunay@foss.st.com>, Tom Rini\n <trini@konsulko.com>, Kory Maincent <kory.maincent@bootlin.com>, Marek Vasut\n <marek.vasut+renesas@mailbox.org>, Patrice Chotard\n <patrice.chotard@foss.st.com>","X-Mailer":"b4 0.14.3","X-Originating-IP":"[10.48.87.93]","X-ClientProxiedBy":"ENXCAS1NODE2.st.com (10.75.128.138) To STKDAG1NODE1.st.com\n (10.75.128.132)","X-EOPAttributedMessage":"0","X-MS-PublicTrafficType":"Email","X-MS-TrafficTypeDiagnostic":"AM3PEPF00009B9E:EE_|PAVPR10MB6791:EE_","X-MS-Office365-Filtering-Correlation-Id":"d6bddc44-4cb0-4a49-69bb-08de9a052ce1","X-LD-Processed":"75e027c9-20d5-47d5-b82f-77d7cd041e8f,ExtAddr","X-MS-Exchange-SenderADCheck":"1","X-MS-Exchange-AntiSpam-Relay":"0","X-Microsoft-Antispam":"BCL:0;\n ARA:13230040|36860700016|82310400026|376014|1800799024|56012099003|18002099003;","X-Microsoft-Antispam-Message-Info":"\n cH+ajMEsZn/FdoYEeGgueyLfm63cymK2tOA20E05/mx/QulAKhb6uENuzP3SjPyvCb83ba6vBAMEV5xFiQg5LKB6HyaFqK1wqE2qma+rL3zY9VLaH9HgkCn/TgWpHxhGuO9sZgBklGL/LB4YlHuVsKm1U11L7hbk3U9v/32vxP3v/Jg6UbERPFLotTnGrKmIwIT1iiZHJxxl7rFsI0kV/aJXnniSjzQGyXp7rdwUepZTYN0nWDlzcflLV3sV2mopDsxNwFwsBY+T802iIzwDlnkgx7ZVPLnsjOUPfTsw4OVK2s/6JMS52Z220T3uoiX8OysNAI7RK4dpeCtP+SqYbVyKXbXIIqqIYDiEvJX+ZCuKT/xFycldnLZaxx7Ua9m/AvD0JDKLg7+KgPNskufVBn/x9sWl60LC7xUUCU8bTtUpcZvsVRAf3/+9cS1kAYjtpA4ila2BfHqRthzrmd5/TZz/CxV7PBQiNj3PVNQeRcz4CG0eqqAoEyasBQQsmDlOOWTIbjPLRu1C1O0R33XoHl73a2dLGZL3fouk5ofP3MWYXthE/reRDpyet3m+2Bjosmpi0Eu/bmWwwm2eoZKZw+jDtVLvCHC4zL9Hn5WBY9x0HB4wzrd8QgP4V1riXBcs26guQYfhCOXZgMFdy3qZpLKcWXoRjvfjfI0a0qWxLWsSmeGsmoIwe3BYpVtyqyCbTYxokkSxV5WhkUs5Co5EOlBZcyO2Tzlf+z8qmgVNAEI6CRbCD+Vx9hekoZFHynr1lWIDiQIFKj2rCGHN4y9ypQ==","X-Forefront-Antispam-Report":"CIP:164.130.1.59; CTRY:IT; LANG:en; SCL:1; SRV:;\n IPV:CAL; SFV:NSPM; H:smtpO365.st.com; PTR:InfoDomainNonexistent; CAT:NONE;\n SFS:(13230040)(36860700016)(82310400026)(376014)(1800799024)(56012099003)(18002099003);\n DIR:OUT; SFP:1101;","X-MS-Exchange-AntiSpam-MessageData-ChunkCount":"1","X-MS-Exchange-AntiSpam-MessageData-0":"\n QVRtXIH5QX8cguUWvTNjatWOpyp+t9ZxF3vMYmt/xgr0WWaVk5y8DGR/k+lnTw2hm5cYww8Ex0JlD+kthAaVFKTmuIEka3MTy9o1D+NQTzn3SFWafALWgrSRsXOcUVngirrs7WxnAigaE8/gEdieUOK12QovyPDPy6XsPWJo4e5b0+l0vyF1XkXIHFUEqrz1JUFFmkScFPJ65ayJob/SKqFowB2VMal5F2Y5ZGgcPZjC6FEUPjq64uZITsx+8HaEykA1hnSpr9nMiqFlN+eqvE0mfqtjckbw3Z6AIl2WKhoDwzmL4g4pOOiKyykpbBDnx1IQab0lquwxDWu4NSAYubA/EnR8LNHrLyXEY74lMjTT/BJ5pVDnc8cIV4g9Asdz3HVkXeAZHxiDjtdcNMVRPwG+h2i5kY/rOtTqEszvlAw5DK7/5083QLy6jDRbjOvK","X-OriginatorOrg":"foss.st.com","X-MS-Exchange-CrossTenant-OriginalArrivalTime":"14 Apr 2026 09:06:55.0785 (UTC)","X-MS-Exchange-CrossTenant-Network-Message-Id":"\n d6bddc44-4cb0-4a49-69bb-08de9a052ce1","X-MS-Exchange-CrossTenant-Id":"75e027c9-20d5-47d5-b82f-77d7cd041e8f","X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp":"\n TenantId=75e027c9-20d5-47d5-b82f-77d7cd041e8f; Ip=[164.130.1.59];\n Helo=[smtpO365.st.com]","X-MS-Exchange-CrossTenant-AuthSource":"\n AM3PEPF00009B9E.eurprd04.prod.outlook.com","X-MS-Exchange-CrossTenant-AuthAs":"Anonymous","X-MS-Exchange-CrossTenant-FromEntityHeader":"HybridOnPrem","X-MS-Exchange-Transport-CrossTenantHeadersStamped":"PAVPR10MB6791","X-BeenThere":"u-boot@lists.denx.de","X-Mailman-Version":"2.1.39","Precedence":"list","List-Id":"U-Boot discussion <u-boot.lists.denx.de>","List-Unsubscribe":"<https://lists.denx.de/options/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=unsubscribe>","List-Archive":"<https://lists.denx.de/pipermail/u-boot/>","List-Post":"<mailto:u-boot@lists.denx.de>","List-Help":"<mailto:u-boot-request@lists.denx.de?subject=help>","List-Subscribe":"<https://lists.denx.de/listinfo/u-boot>,\n <mailto:u-boot-request@lists.denx.de?subject=subscribe>","Errors-To":"u-boot-bounces@lists.denx.de","Sender":"\"U-Boot\" <u-boot-bounces@lists.denx.de>","X-Virus-Scanned":"clamav-milter 0.103.8 at phobos.denx.de","X-Virus-Status":"Clean"},"content":"Depending of plugged power source (computer, wall charger, ...) it can\nhappen that we got the following message:\n\n\"****************************************************\"\n\"*      USB TYPE-C charger not compliant with       *\"\n\"*                   specification                  *\"\n\"****************************************************\"\n\"                                                    \"\n\"### ERROR ### Please RESET the board ###            \"\n\nThis issue has been detected on STM32MP135f-DK board.\n\nIt's due to max_uV and min_uV value are initialized at beginning of\nboard_check_usb_power() and can then be used for the 2 iteration of\nadc_measurement().\nmax_uV/min_uV values issued of the first adc_measurement() iteration\nare used as input of the second adc_measurement() iteration, which\ncan lead to incoherent pair of min_uV/max_uV values.\n\nTo ensure that adc_measurement() returns coherent value for max_uV and\nmin_uV, initialize max_uV and min_uV at each loop start.\n\nSigned-off-by: Patrice Chotard <patrice.chotard@foss.st.com>\n---\n board/st/stm32mp1/stm32mp1.c | 7 +++++--\n 1 file changed, 5 insertions(+), 2 deletions(-)\n\n\n---\nbase-commit: 88dc2788777babfd6322fa655df549a019aa1e69\nchange-id: 20260414-fix_usb_adc_meausurement-e4e9b7988ccb\n\nBest regards,","diff":"diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c\nindex 5f7c6822116..88ede4e3910 100644\n--- a/board/st/stm32mp1/stm32mp1.c\n+++ b/board/st/stm32mp1/stm32mp1.c\n@@ -326,8 +326,8 @@ static int adc_measurement(ofnode node, int adc_count, int *min_uV, int *max_uV)\n static int board_check_usb_power(void)\n {\n \tofnode node;\n-\tint max_uV = 0;\n-\tint min_uV = USB_START_HIGH_THRESHOLD_UV;\n+\tint max_uV;\n+\tint min_uV;\n \tint adc_count, ret;\n \tu32 nb_blink;\n \tu8 i;\n@@ -358,6 +358,9 @@ static int board_check_usb_power(void)\n \n \t/* perform maximum of 2 ADC measurements to detect power supply current */\n \tfor (i = 0; i < 2; i++) {\n+\t\tmax_uV = 0;\n+\t\tmin_uV = USB_START_HIGH_THRESHOLD_UV;\n+\n \t\tret = adc_measurement(node, adc_count, &min_uV, &max_uV);\n \t\tif (ret)\n \t\t\treturn ret;\n","prefixes":[]}