From patchwork Wed Jun 5 19:21:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944133 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=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=WLRuoNfp; 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 4Vvd8q1Vg1z20KL for ; Thu, 6 Jun 2024 05:40:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A015C884BA; Wed, 5 Jun 2024 21:37:41 +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="WLRuoNfp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 858AE88300; Wed, 5 Jun 2024 21:22: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,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-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (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 8CC9B8825E for ; Wed, 5 Jun 2024 21:21:58 +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=ansuelsmth@gmail.com Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-42147970772so1511485e9.0 for ; Wed, 05 Jun 2024 12:21:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717615318; x=1718220118; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=tFLs4djXMjy4iXY0nn18T3TiYUGeLDPIB6Xqyuip8VI=; b=WLRuoNfpb+yB0zPGWfnPHFbJ5jmS+hUalw1X91W32HbfgmLl6bpfO8M2YkCuzdxrFT YiI0C1ieypRHKVzzC9lMvsDfeFKoTWp7TmixeSlRII8xdBGRLX9nTTrj4fG7Ejcg2Tku n4X0rLKSb1WnsNSovvoatycMPczRPj5QRH1Ykx3U5RlFDkn1Y5RnoP6c1IAmniOpDEy4 i1lsvCdbnkxtpKL2BCJja/gt+RpB5ysRcqYyawrUbkrIayptcjsCh+kvrec2ReLJ4RTd owyAxcBICmlAv0VQnWnTaGX61KQFTz20+DWBH0rQsJCL5p12mFlWOIP5Q//gZTK1nge6 SD6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717615318; x=1718220118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tFLs4djXMjy4iXY0nn18T3TiYUGeLDPIB6Xqyuip8VI=; b=M7h4byQTf8AaPPbc3+HYqjutDEVWJQ3+zWKQ5cNizulGsgaEfyICZvavxdpvEtO1H+ RDSaAb2iW2FqKKbfs6ShbA6iaPxteGEkZBnvZiBTFuARQZ1UcRP0xV3u5wAtOl63vbB6 kYl79/exLwuqn8bQZSq96NaGHfDVvViJ1Q7Siav9A3lA0F1j041oK+OhXZ8T1vZa6GiK MHVoKW0LLOxMUN4Z1pfVDbb/j1whZ498xVh4wmMJb8nJHyWg1b3EHQKQ+cVwadNV7Rs0 1mfGd3vLhcSTL5C0LevoZ04qkuDfq9sJSV/QHwFlYVWpSzyQr6j1yugwC0kC39oHgU8d ZauA== X-Forwarded-Encrypted: i=1; AJvYcCU058oVziXANEGTPYKoYx+Gs/mgQN7KsfA7UU1FiEoR4o/xwXT+5ZJAbKwoEUMkA/5PekPWJuS0mowdUHgYJiET2JQugA== X-Gm-Message-State: AOJu0YxfUVjprB3mXEGxHelX8TFkZF7awduEyiSkMRQH3vOO+ALsXCZ0 Y4KhJJHukRNzl4qMgn9rJTuEar/lCNBWw1Y7GcSD4dPcXAyrrR8/ X-Google-Smtp-Source: AGHT+IGiX2LAnPfXvoiYiWPwxB7YUqVTWflFtU2cD61pbKMWs+3HBc7rsX8+nvISMLPUvYLCTVIxzQ== X-Received: by 2002:a05:600c:4f83:b0:420:66e:4c31 with SMTP id 5b1f17b1804b1-4215634de43mr31102835e9.34.1717615317813; Wed, 05 Jun 2024 12:21:57 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4214bf5994csm36079625e9.1.2024.06.05.12.21.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:21:57 -0700 (PDT) From: Christian Marangi To: Tom Rini , Dario Binacchi , Michael Trimarchi , Frieder Schrempf , Jagan Teki , Vignesh R , Joe Hershberger , Ramon Fried , Christian Marangi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Rasmus Villemoes , Doug Zobel , William Zhang , Mikhail Kshevetskiy , Igor Prusov , Bruce Suen , Takahiro Kuwano , Pratyush Yadav , Venkatesh Yadav Abbarapu , Vaishnav Achath , AKASHI Takahiro , u-boot@lists.denx.de Subject: [PATCH 1/7] misc: gpio_led: fix broken coloured LED status functions Date: Wed, 5 Jun 2024 21:21:33 +0200 Message-ID: <20240605192146.19052-2-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605192146.19052-1-ansuelsmth@gmail.com> References: <20240605192146.19052-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 Jun 2024 21:37:35 +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 The GPIO LED driver is a backend to provide LED status functions via the GPIO common functions. The coloured LED functions are currently broken and deviates from what is written in README.LED Quoting the README.LED: CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be a valid LED number (0-5). Other similar color LED's macros are CONFIG_STATUS_LED_GREEN, CONFIG_STATUS_LED_YELLOW and CONFIG_STATUS_LED_BLUE. Hence the value of the config must refer to the ID. Currently this is not the case and the driver expect the GPIO ID to be put in these config. On top of this to actually have these functions, a never define in Kconfig config must be declared to actually compile them. (CONFIG_GPIO_LED_STUBS) To fix this and the GPIO problem, introduce some define that reference the LED_STATUS_BIT config to have the ID->BIT connection (as described in Docs) and drop the never defined config. The gpio_led already provide a wrapper to the functions and should not be enabled if the board provide their custom function hence it's ok to also provide the wrapper for the colour functions. Signed-off-by: Christian Marangi --- drivers/misc/gpio_led.c | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c index 30679f80cf1..0f3682e1465 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -52,56 +52,63 @@ void __led_toggle(led_id_t mask) gpio_set_value(mask, !gpio_get_value(mask)); } -#ifdef CONFIG_GPIO_LED_STUBS - /* 'generic' override of colored LED stubs, to use GPIO functions instead */ +/* We support up to 6 LEDs, LED 0 STATUS BIT doesn't have the number suffix */ +#define GPIO_BIT0 CONFIG_LED_STATUS_BIT +#define GPIO_BIT1 CONFIG_LED_STATUS_BIT1 +#define GPIO_BIT2 CONFIG_LED_STATUS_BIT2 +#define GPIO_BIT3 CONFIG_LED_STATUS_BIT3 +#define GPIO_BIT4 CONFIG_LED_STATUS_BIT4 +#define GPIO_BIT5 CONFIG_LED_STATUS_BIT5 +/* C preprocessor magic way to generate a GPIO_LED reference */ +#define GPIO_BIT(id) ___PASTE(GPIO_BIT, id) + #ifdef CONFIG_LED_STATUS_RED + void red_led_on(void) { - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_ON); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_RED), CONFIG_LED_STATUS_ON); } void red_led_off(void) { - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_OFF); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_RED), CONFIG_LED_STATUS_OFF); } #endif #ifdef CONFIG_LED_STATUS_GREEN void green_led_on(void) { - __led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_ON); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_GREEN), CONFIG_LED_STATUS_ON); } void green_led_off(void) { - __led_set(CONFIG_LED_STATUS_GREEN, CONFIG_LED_STATUS_OFF); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_GREEN), CONFIG_LED_STATUS_OFF); } #endif #ifdef CONFIG_LED_STATUS_YELLOW void yellow_led_on(void) { - __led_set(CONFIG_LED_STATUS_YELLOW, CONFIG_LED_STATUS_ON); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_YELLOW), CONFIG_LED_STATUS_ON); } void yellow_led_off(void) { - __led_set(CONFIG_LED_STATUS_YELLOW, CONFIG_LED_STATUS_OFF); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_YELLOW), CONFIG_LED_STATUS_OFF); } #endif #ifdef CONFIG_LED_STATUS_BLUE void blue_led_on(void) { - __led_set(CONFIG_LED_STATUS_BLUE, CONFIG_LED_STATUS_ON); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_BLUE), CONFIG_LED_STATUS_ON); } void blue_led_off(void) { - __led_set(CONFIG_LED_STATUS_BLUE, CONFIG_LED_STATUS_OFF); + __led_set(GPIO_BIT(CONFIG_LED_STATUS_BLUE), CONFIG_LED_STATUS_OFF); } #endif - -#endif /* CONFIG_GPIO_LED_STUBS */ From patchwork Wed Jun 5 19:21:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944134 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=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=Z/++txgC; 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 4Vvd911lY8z20WK for ; Thu, 6 Jun 2024 05:40:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 02430884BE; Wed, 5 Jun 2024 21:37: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="Z/++txgC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 167718831D; Wed, 5 Jun 2024 21:22: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,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-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) (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 22D2F87AD2 for ; Wed, 5 Jun 2024 21:22:00 +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=ansuelsmth@gmail.com Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-421555a4454so2268095e9.3 for ; Wed, 05 Jun 2024 12:22:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717615319; x=1718220119; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=USHF67Hvkkr6X6WZ90mIvVSk959Bhec2gU9xl0MKgOk=; b=Z/++txgCngDR0da7G+Mp5xfsUUteD4Y2xoOKqr2CwFMt5X3NDraDHZMwWmq+c+pKmV XJDMiQul/BmajE/KyXoUTJyuYmTd99i3i2e1o6G+qCzW4q+ToBjyHRaViW0LGKioSnLd P10JTpRgudPIttXzGfIqB76N+nzncm8jDQ9HXfVLKic5N3+j7uILd4AeT0MHLzAFT2lt BhEmJHRFtNVhee/eAfXtKTHzPPHeiiVOCAfR1rnAKrp01y3jf2bM2gDXWqwlrSPEw9+R ivq79JmTjkzRRCqTFWvhzcjneKeleoRk6T+L5gnC8fCNP6c9ujoRJsaTlaOmQzLgPKo9 DvIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717615319; x=1718220119; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=USHF67Hvkkr6X6WZ90mIvVSk959Bhec2gU9xl0MKgOk=; b=gKlO611XRyD3/ThFyzm9aIVQZsnL4w/aophWX9C/W/SAC3Z3Ie3KLWin3k8rrU6U2z drKUcGOI7yOmrVlyxEylLG/sMuxMlxkMfDLPDqmyTXyfoAbwpVjMS4eLinrJLOQn48Uu 4rEsdj14hwZeFGpC6pjrdFs5l2/REeIZjQ5xnxqumJnerJnMPPkWRcq84AKiGQJSlPe8 V+7DohcKhd3GDzNTrEdHLOt+zL+y3B6oMD7dVkMWfZdDhH8bTXP1SyitEE/SugQUH1EU 6qCcZ6Kr+Qm1nYn4vMMknXLSzW7hQBW6IProgO03GwUId31bEI9Shei9Ttjr7hSfGnnu SguQ== X-Forwarded-Encrypted: i=1; AJvYcCUNkzV0dRgVp0v3F5+3eb+Gmc0mGXWQFpI+WbtoYcKIuUdymwwVx5nAdJzVHzz6ZldMOQBWuD+8L3/Bs/zwDK2qVTK5ow== X-Gm-Message-State: AOJu0Yz236UpXP9ehxHe5hZXkB7d1srHvVC6LLCF5B8DB/FjMZuDL4xe RJSB3UmMO5qRk3g2XBYPp4pH5icAD38Iu12N9hRkVj4PTK/ct5DS X-Google-Smtp-Source: AGHT+IHZ0wYpyHUSXQ8ZIXozoCjCIJNrBDTdg9RKNpUSV5pazuk4h51GXpcdi5R8IdtM6JRcIn2Jag== X-Received: by 2002:a05:600c:45c8:b0:41c:2931:e670 with SMTP id 5b1f17b1804b1-421562d4717mr28226085e9.2.1717615319498; Wed, 05 Jun 2024 12:21:59 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4214bf5994csm36079625e9.1.2024.06.05.12.21.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:21:59 -0700 (PDT) From: Christian Marangi To: Tom Rini , Dario Binacchi , Michael Trimarchi , Frieder Schrempf , Jagan Teki , Vignesh R , Joe Hershberger , Ramon Fried , Christian Marangi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Rasmus Villemoes , Doug Zobel , William Zhang , Mikhail Kshevetskiy , Igor Prusov , Bruce Suen , Takahiro Kuwano , Pratyush Yadav , Venkatesh Yadav Abbarapu , Vaishnav Achath , AKASHI Takahiro , u-boot@lists.denx.de Subject: [PATCH 2/7] led: status_led: add support for white LED colour Date: Wed, 5 Jun 2024 21:21:34 +0200 Message-ID: <20240605192146.19052-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605192146.19052-1-ansuelsmth@gmail.com> References: <20240605192146.19052-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 Jun 2024 21:37:35 +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 Add support for white LED colour present on many devices. Signed-off-by: Christian Marangi --- cmd/legacy_led.c | 6 ++++++ common/board_f.c | 2 ++ drivers/led/Kconfig | 14 ++++++++++++++ drivers/misc/gpio_led.c | 12 ++++++++++++ include/status_led.h | 4 ++++ 5 files changed, 38 insertions(+) diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c index 5256255f052..40dbc05a651 100644 --- a/cmd/legacy_led.c +++ b/cmd/legacy_led.c @@ -57,6 +57,9 @@ static const led_tbl_t led_commands[] = { #endif #ifdef CONFIG_LED_STATUS_BLUE { "blue", CONFIG_LED_STATUS_BLUE, blue_led_off, blue_led_on, NULL }, +#endif +#ifdef CONFIG_LED_STATUS_WHITE + { "white", CONFIG_LED_STATUS_WHITE, white_led_off, white_led_on, NULL }, #endif { NULL, 0, NULL, NULL, NULL } }; @@ -180,6 +183,9 @@ U_BOOT_CMD( #endif #ifdef CONFIG_LED_STATUS_BLUE "blue|" +#endif +#ifdef CONFIG_LED_STATUS_WHITE + "white|" #endif "all] [on|off|toggle|blink] [blink-freq in ms]", "[led_name] [on|off|toggle|blink] sets or clears led(s)" diff --git a/common/board_f.c b/common/board_f.c index 039d6d712d0..54e2009339e 100644 --- a/common/board_f.c +++ b/common/board_f.c @@ -72,6 +72,8 @@ __weak void yellow_led_on(void) {} __weak void yellow_led_off(void) {} __weak void blue_led_on(void) {} __weak void blue_led_off(void) {} +__weak void white_led_on(void) {} +__weak void white_led_off(void) {} /* * Why is gd allocated a register? Prior to reloc it might be better to diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 9837960198d..6c4f02d71f2 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -415,6 +415,20 @@ config LED_STATUS_GREEN endif # LED_STATUS_GREEN_ENABLE +config LED_STATUS_WHITE_ENABLE + bool "Enable white LED" + help + Enable white status LED. + +if LED_STATUS_WHITE_ENABLE + +config LED_STATUS_WHITE + int "White LED identification" + help + Valid enabled LED device number (0-5). + +endif # LED_STATUS_WHITE_ENABLE + config LED_STATUS_CMD bool "Enable status LED commands" diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c index 0f3682e1465..de84c206b6b 100644 --- a/drivers/misc/gpio_led.c +++ b/drivers/misc/gpio_led.c @@ -112,3 +112,15 @@ void blue_led_off(void) __led_set(GPIO_BIT(CONFIG_LED_STATUS_BLUE), CONFIG_LED_STATUS_OFF); } #endif + +#ifdef CONFIG_LED_STATUS_WHITE +void white_led_on(void) +{ + __led_set(GPIO_BIT(CONFIG_LED_STATUS_WHITE), CONFIG_LED_STATUS_ON); +} + +void white_led_off(void) +{ + __led_set(GPIO_BIT(CONFIG_LED_STATUS_WHITE), CONFIG_LED_STATUS_OFF); +} +#endif diff --git a/include/status_led.h b/include/status_led.h index 6707ab1d29d..5ce4522b029 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -87,6 +87,8 @@ void yellow_led_on(void); void yellow_led_off(void); void blue_led_on(void); void blue_led_off(void); +void white_led_on(void); +void white_led_off(void); #else .extern LED_init .extern red_led_on @@ -97,6 +99,8 @@ void blue_led_off(void); .extern green_led_off .extern blue_led_on .extern blue_led_off + .extern white_led_on + .extern white_led_off #endif #endif /* _STATUS_LED_H_ */ From patchwork Wed Jun 5 19:21:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944135 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=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=iI08PEPS; 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 4Vvd9D1lqHz20WK for ; Thu, 6 Jun 2024 05:40:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 571A5884C6; Wed, 5 Jun 2024 21:37: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="iI08PEPS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8385D88354; Wed, 5 Jun 2024 21:22: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,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-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (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 9EBD3882E6 for ; Wed, 5 Jun 2024 21:22:01 +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=ansuelsmth@gmail.com Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-421555a4454so2268385e9.3 for ; Wed, 05 Jun 2024 12:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717615321; x=1718220121; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=LiJxSrHUQxU7ezUE98DdkJgahWdu8Tg6y94tQni3u9Y=; b=iI08PEPSFc7uMoI+sYAkd/WoRG21YWt0yJK773fe37AtUFsgvs3GcSDIxw2UnYQvAP 2XSH8sa+LKlwFNjF9e41DPcufeenWo7Npq5h726ngRuBrE2gRNLd8PFvsbFBCU+/1PjV hZE2AiCT5GKAxwH22/a4vzEarlsTAXkLer2y2xjS6Gs0ddzujE62y8sONqnLyrOcz/D4 43rl3n7pKQ9G7poiOSMuTll61o8WwEJEIMYBES4u15TZ2+xgwoXrCp8ocb4ceos0RmSi t1x30CpyYxzM0b2CyVW8YS2ATWCtvZjnbDi2Tp1qNczyw1OnzJJSGplms4EKxWJ/3UWN 3zSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717615321; x=1718220121; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LiJxSrHUQxU7ezUE98DdkJgahWdu8Tg6y94tQni3u9Y=; b=H8lELUy2N06yhoNnKKkh5dcYPZp9+/QGX8rza0F1shq0hVaV2OmLV6T/Rp3XORsyn2 Yi0QuQYWTh/htzAgwaJ5IW1imYaZh4ZZV2X4WZuNUwIPFJbdPnA0fbxC6cj8jF45qR3C 7BlWLIepBLK4r7lOzvJy0Km3x/kgZwnIshDF63+Q2yzyztKPxJWQPNluh33wPB1mD2kA OSlJ0mAyW6TBzbA8KnaAVeyJnEAm4kOMmJogRtPPdk7Fo6EubySBvovclLJV91uYesUq QEelF+fEyImmHle3zVLiZqNhMS50Zi1/42bv1PMSM5D1JGSvGHhePA0FzJOFYbKaSOWH DrMw== X-Forwarded-Encrypted: i=1; AJvYcCWDWcn3VBZypyMbZ4kacTouybWmTtr5KE21doUaEOGeOpI9usL45S7imkE7u88m12zo/65LDS7mPfWK5FVxnXMuOmyxcA== X-Gm-Message-State: AOJu0Yymt0Xm+9wkDxwtMjqKlznGxwpD09GcdIIKsaBoEiEirmyh2PDu lPqAS6XQfbOm1YveyLWrs4EThBboFZs8t2ss2bw8s494mpkbtrqj X-Google-Smtp-Source: AGHT+IEcIGWepmfZIMz/OWkBKNnKbEV8M208yOqrxXgNuSuoz1JEz0a1XPJDZMKrECQWr+VITpIopQ== X-Received: by 2002:a05:600c:35ca:b0:421:494c:9e74 with SMTP id 5b1f17b1804b1-421562f0f7bmr28441515e9.23.1717615321107; Wed, 05 Jun 2024 12:22:01 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4214bf5994csm36079625e9.1.2024.06.05.12.21.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:22:00 -0700 (PDT) From: Christian Marangi To: Tom Rini , Dario Binacchi , Michael Trimarchi , Frieder Schrempf , Jagan Teki , Vignesh R , Joe Hershberger , Ramon Fried , Christian Marangi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Rasmus Villemoes , Doug Zobel , William Zhang , Mikhail Kshevetskiy , Igor Prusov , Bruce Suen , Takahiro Kuwano , Pratyush Yadav , Venkatesh Yadav Abbarapu , Vaishnav Achath , AKASHI Takahiro , u-boot@lists.denx.de Subject: [PATCH 3/7] led: status_led: add function to toggle a status LED Date: Wed, 5 Jun 2024 21:21:35 +0200 Message-ID: <20240605192146.19052-4-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605192146.19052-1-ansuelsmth@gmail.com> References: <20240605192146.19052-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 Jun 2024 21:37:35 +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 Add function to toggle a status LED by using the status LED ID reference configs. Signed-off-by: Christian Marangi --- drivers/misc/status_led.c | 28 +++++++++++++++++++++++----- include/status_led.h | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c index a6e9c03a02e..93bfb410662 100644 --- a/drivers/misc/status_led.c +++ b/drivers/misc/status_led.c @@ -103,17 +103,24 @@ void status_led_tick(ulong timestamp) } } -void status_led_set(int led, int state) +static led_dev_t *status_get_led_dev(int led) { - led_dev_t *ld; - if (led < 0 || led >= MAX_LED_DEV) - return; + return NULL; if (!status_led_init_done) status_led_init(); - ld = &led_dev[led]; + return &led_dev[led]; +} + +void status_led_set(int led, int state) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; ld->state = state; if (state == CONFIG_LED_STATUS_BLINKING) { @@ -122,3 +129,14 @@ void status_led_set(int led, int state) } __led_set (ld->mask, state); } + +void status_led_toggle(int led) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; + + __led_toggle(ld->mask); +} diff --git a/include/status_led.h b/include/status_led.h index 5ce4522b029..fe0c84fb4b4 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -38,6 +38,7 @@ void status_led_init(void); void status_led_tick(unsigned long timestamp); void status_led_set(int led, int state); +void status_led_toggle(int led); /***** MVS v1 **********************************************************/ #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) From patchwork Wed Jun 5 19:21:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944136 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=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=CHtiy/xP; 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 4Vvd9Q65xqz20WK for ; Thu, 6 Jun 2024 05:40:42 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B07D688489; Wed, 5 Jun 2024 21:37: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="CHtiy/xP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A2FC088354; Wed, 5 Jun 2024 21:22: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,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-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) (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 7D80588193 for ; Wed, 5 Jun 2024 21:22:03 +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=ansuelsmth@gmail.com Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-4210aa012e5so2698795e9.0 for ; Wed, 05 Jun 2024 12:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717615323; x=1718220123; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=TNivcV9fIP6piDP5txka5GQYQ+I/DYUHWTGBY1OTgpM=; b=CHtiy/xPFoYr35PW4cGv7QbjE4dDIz5BGoAw1tZnGxLlJriUuAouc3n817lLqI5O/G GECGGLjb7iYkz6Ob+/v63UcYGe0DZh3BW3IbXxHHUbE/wfbRX5raEfPx/kL/LUY8P2Wr 4/Tp+j3uLzA+t8Lmvr4tl1m86XCy1pXwTfoKjFH8VMubLL+JTGhKAdXDFG+uKV5BYP24 4Q+BkiBZDF0yBj4cc1de1tJ0LNYWogcfp/aGpBZC5ZFFOYLO+IsMWVotzdLpf3qvi1Q+ 0to0KrrRI/rKKi48n4kZ1oZZO6YQxVoLni59DO/ZxkB2Sg7crdVGQ2h7ISuInoa45bdG cOAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717615323; x=1718220123; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TNivcV9fIP6piDP5txka5GQYQ+I/DYUHWTGBY1OTgpM=; b=QQYho4PUbLdPrAobVdVd6LLrFeUCv8JRBF163TvibbZX7AGBrIZcOT+do9TeRRv0zD FKRfTWCBpRxMjOCOKnIadxhBhhd+Oc3M2gTbAcMfRh0Hn1+TWBZNa1YG0MhkD63nhLmT FlZZfzMCl55wX5+WXydwr29Ja8lxRpmvMopjPGMNhmE1aE0o/vP2kJVx/KXn2Io1vgUh nDYskfWTyspuLQupWXMvAQlnLUzxz/HeP8VyQOl/nIulR062cX4g65JBpHXEvy7XIY/b Ak6PmOLTtbIqU4iAl//OHu2DuuxelR7uFKBSU4JSpTgS/6SOHuhXw9fc5wsOHlHsQAoP BMHw== X-Forwarded-Encrypted: i=1; AJvYcCVNORJtgcasM2W8JsFt016n6yWxTNChxjkDLfwB8O8BjV3g0nuZU43aq+zVjTfUVmgAKiXm4Ny/pkfKjYYeYccrbrCSeA== X-Gm-Message-State: AOJu0YymYQMKDHayUYWt095Ilj3TJCIp8/VsCzsKMbx4GYJo0HfGxXfZ U76aUPe3JMSVo4JAwRSiqoDgfskHgfi/hVzgb+3iTuCJ3XgxOs9Y X-Google-Smtp-Source: AGHT+IGT9+3D9UD80TiBI3TFi6cZpJx9+WTpFk67YPUOm5iAhPwLt81InOzx0HRlzW+Z/VvM80qhIg== X-Received: by 2002:a05:600c:154a:b0:421:2b3e:3a22 with SMTP id 5b1f17b1804b1-421562cce3dmr27899135e9.14.1717615322817; Wed, 05 Jun 2024 12:22:02 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4214bf5994csm36079625e9.1.2024.06.05.12.22.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:22:02 -0700 (PDT) From: Christian Marangi To: Tom Rini , Dario Binacchi , Michael Trimarchi , Frieder Schrempf , Jagan Teki , Vignesh R , Joe Hershberger , Ramon Fried , Christian Marangi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Rasmus Villemoes , Doug Zobel , William Zhang , Mikhail Kshevetskiy , Igor Prusov , Bruce Suen , Takahiro Kuwano , Pratyush Yadav , Venkatesh Yadav Abbarapu , Vaishnav Achath , AKASHI Takahiro , u-boot@lists.denx.de Subject: [PATCH 4/7] led: status_led: add new activity LED config and functions Date: Wed, 5 Jun 2024 21:21:36 +0200 Message-ID: <20240605192146.19052-5-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605192146.19052-1-ansuelsmth@gmail.com> References: <20240605192146.19052-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 Jun 2024 21:37:35 +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 Add a new activity LED config and additional functions to implement a simple software blink feature to signal activity of any kind. Usual activity might be a file transfer with TFTP, a flash write... Driver will call status_led_activity on each activity and LED will be toggled based on the defined FREQ config value. Signed-off-by: Christian Marangi --- drivers/led/Kconfig | 15 +++++++++++++++ drivers/misc/status_led.c | 25 ++++++++++++++++++++----- include/status_led.h | 1 + 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig index 6c4f02d71f2..8eaa74bdd27 100644 --- a/drivers/led/Kconfig +++ b/drivers/led/Kconfig @@ -359,6 +359,21 @@ config LED_STATUS_BOOT endif # LED_STATUS_BOOT_ENABLE +config LED_STATUS_ACTIVITY_ENABLE + bool "Enable BOOT LED" + help + Enable to turn an LED on when the board is doing some + activity (flash write, file download). + +if LED_STATUS_ACTIVITY_ENABLE + +config LED_STATUS_ACTIVITY + int "LED to light when the board is doing some activity" + help + Valid enabled LED device number. + +endif # LED_STATUS_ACTIVITY_ENABLE + config LED_STATUS_RED_ENABLE bool "Enable red LED" help diff --git a/drivers/misc/status_led.c b/drivers/misc/status_led.c index 93bfb410662..9490e1d7341 100644 --- a/drivers/misc/status_led.c +++ b/drivers/misc/status_led.c @@ -82,6 +82,14 @@ void status_led_init(void) status_led_init_done = 1; } +static void status_led_sw_blink(led_dev_t *ld) +{ + if (++ld->cnt >= ld->period) { + __led_toggle(ld->mask); + ld->cnt -= ld->period; + } +} + void status_led_tick(ulong timestamp) { led_dev_t *ld; @@ -95,11 +103,7 @@ void status_led_tick(ulong timestamp) if (ld->state != CONFIG_LED_STATUS_BLINKING) continue; - if (++ld->cnt >= ld->period) { - __led_toggle (ld->mask); - ld->cnt -= ld->period; - } - + status_led_sw_blink(ld); } } @@ -140,3 +144,14 @@ void status_led_toggle(int led) __led_toggle(ld->mask); } + +void status_led_activity(int led) +{ + led_dev_t *ld; + + ld = status_get_led_dev(led); + if (!ld) + return; + + status_led_sw_blink(ld); +} diff --git a/include/status_led.h b/include/status_led.h index fe0c84fb4b4..037bad159c2 100644 --- a/include/status_led.h +++ b/include/status_led.h @@ -39,6 +39,7 @@ void status_led_init(void); void status_led_tick(unsigned long timestamp); void status_led_set(int led, int state); void status_led_toggle(int led); +void status_led_activity(int led); /***** MVS v1 **********************************************************/ #if (defined(CONFIG_MVS) && CONFIG_MVS < 2) From patchwork Wed Jun 5 19:21:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944137 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=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=GSKI8RGu; 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 4Vvd9d1cczz20WK for ; Thu, 6 Jun 2024 05:40:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 131A6884CA; Wed, 5 Jun 2024 21:37:43 +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="GSKI8RGu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8916A8831D; Wed, 5 Jun 2024 21:22:07 +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 106C788369 for ; Wed, 5 Jun 2024 21:22:05 +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=ansuelsmth@gmail.com Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4210aa012e5so2699255e9.0 for ; Wed, 05 Jun 2024 12:22:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717615324; x=1718220124; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=DMtQynVUynIygMJG+HZoR5ODD0Kxq9UV2wpCO2Dk7eU=; b=GSKI8RGuBlaPWcKrxTwOz6Ut/nhcDxRUY23r9iDj51M3qxyiqDTM1ey37+SpYqF8uD PsrSLx3BwfDNUFZ8l+MlJRwhBj4JNro86VzkOMZn/rz7g4SmBrDo6LHrYL2ZIkx1IUXq RGevFXMdFVJv0iOeXU6r3PK2fT8/zT3sWFuRzZtClGar1WqtnYc3TkHx96MbBjyiceEl 5JxbBnG8aT3aCTwmTayRch1cPvHev1kckGbjmfrUHls5bGu8PfnECFVBFRGDkfnIxyc2 h6L34ZlFiZUauBPUZVipRY0E+dsMO/bD3M3IzV1WkCO01c45jveUayHVAQkcHnKGWczV WzxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717615324; x=1718220124; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DMtQynVUynIygMJG+HZoR5ODD0Kxq9UV2wpCO2Dk7eU=; b=vbZvHL3UbvCuAbVptFvI9lNtgACmYYI5mFEY93glRvyLHepinWC4AyuqjzIg3euRKp 5u0HyOpcWoQ5pRijkVIdQsyAgWxVLhMZJg9g9ikmm+5o+Ym9xO+XOHMVQ9Fe9s1ahnid smpS54Twbj05xAsybmOQ3ReK0r4VAPYhdyQnIeIS0IWRIKfGKZQSOl0p42+MiWUg7kXo 8XR/KW/rKOCEHs3QVW9pzuTyIWfPSnwJxKYphaqnkCL0F557FW7vVPoaa0y7dimdUXzN sT7oFHjjdKjNI0te0pSLiNgaZE4emcOgpd/WLHXlY3pLRsFinBdXh6Z/F9rlCe1m/yIw kXPQ== X-Forwarded-Encrypted: i=1; AJvYcCUuF/dy5q+F6pqJsvlyScUaQYrA+ai7je5Ey8Fg3p80RSr4CLLeDL2QLRS7zWNOc68UPa5FPDtnvNvDOgjH8Mv9+I5Fsg== X-Gm-Message-State: AOJu0YwDiRsQc0hWw4Jmyoo6fHMkoCHQ9+Nm+UrqbA5YPlqRH+3M1gJo 3HYIiZ948Wj6hfVYOdKbfg81nVpmQRJBq5t3Jlr8CkJ0Zz3ZUS4b X-Google-Smtp-Source: AGHT+IF/DLKpxiFUV75gz22btwZA5UcxYrHoZb3JmMGS3S6+dahFuKAktbgTaShNUPBrB/VsohhVog== X-Received: by 2002:a05:600c:4ed1:b0:421:54f7:c294 with SMTP id 5b1f17b1804b1-4215632d74fmr29771825e9.29.1717615324462; Wed, 05 Jun 2024 12:22:04 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4214bf5994csm36079625e9.1.2024.06.05.12.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:22:04 -0700 (PDT) From: Christian Marangi To: Tom Rini , Dario Binacchi , Michael Trimarchi , Frieder Schrempf , Jagan Teki , Vignesh R , Joe Hershberger , Ramon Fried , Christian Marangi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Rasmus Villemoes , Doug Zobel , William Zhang , Mikhail Kshevetskiy , Igor Prusov , Bruce Suen , Takahiro Kuwano , Pratyush Yadav , Venkatesh Yadav Abbarapu , Vaishnav Achath , AKASHI Takahiro , u-boot@lists.denx.de Subject: [PATCH 5/7] tftp: implement support for LED status activity Date: Wed, 5 Jun 2024 21:21:37 +0200 Message-ID: <20240605192146.19052-6-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605192146.19052-1-ansuelsmth@gmail.com> References: <20240605192146.19052-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 Jun 2024 21:37:35 +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 Implement support for LED status activity. If the feature is enabled, make the defined ACTIVITY LED to signal traffic. Signed-off-by: Christian Marangi --- net/tftp.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/net/tftp.c b/net/tftp.c index 2e335413492..07dea321bb4 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -19,6 +19,7 @@ #include #include #include "bootp.h" +#include DECLARE_GLOBAL_DATA_PTR; @@ -193,6 +194,10 @@ static void new_transfer(void) #ifdef CONFIG_CMD_TFTPPUT tftp_put_final_block_sent = 0; #endif +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_BLINKING); +#endif } #ifdef CONFIG_CMD_TFTPPUT @@ -228,6 +233,10 @@ static void show_block_marker(void) { ulong pos; +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); +#endif + #ifdef CONFIG_TFTP_TSIZE if (tftp_tsize) { pos = tftp_cur_block * tftp_block_size + @@ -290,6 +299,9 @@ static void tftp_complete(void) /* Print hash marks for the last packet received */ while (tftp_tsize && tftp_tsize_num_hash < 49) { putc('#'); +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); +#endif tftp_tsize_num_hash++; } puts(" "); @@ -302,6 +314,10 @@ static void tftp_complete(void) time_start * 1000, "/s"); } puts("\ndone\n"); +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_OFF); +#endif if (!tftp_put_active) efi_set_bootdev("Net", "", tftp_filename, map_sysmem(tftp_load_addr, 0), From patchwork Wed Jun 5 19:21:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944138 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=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=OxyzgfbY; 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 4Vvd9p3vNYz20WK for ; Thu, 6 Jun 2024 05:41:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 67E1B884D2; Wed, 5 Jun 2024 21:37:43 +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="OxyzgfbY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 13AC98836E; Wed, 5 Jun 2024 21:22:09 +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 0A53488300 for ; Wed, 5 Jun 2024 21:22:07 +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=ansuelsmth@gmail.com Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-35dce6102f4so100927f8f.3 for ; Wed, 05 Jun 2024 12:22:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717615326; x=1718220126; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=N/Gdt7/+lZ0binabe9ZcG2ArhZluimuOacqq/Lpqfk4=; b=OxyzgfbYRpxJ+QqP+DlWn1/N/EsBao3U5kw6uoRmAml7bLYryOM/Sa0T5q6jp+D+i1 9nhND9HfiYXbZv9AdhB4jp2w4PUm3P+guXrsbtK/cKJ9aSvtmhf46LZc2kzCKaTcn0Cs vXhlcgQr1KDrG5glVRVQT6+eFnmDX46WNMFxwsz4C/F2redy6Fgz8xOleevPoTVBdEMK xViBxVwlIZPA5sMFjYbkwNOS1wL1DT06ryYtUd3ylYc77fPYS4xywRFjvwNtRdZbTYnd 9yPt5WlrGu6DVOUNz1cbNJzLrTwqpUsQ2OEPEWofOIMGo4EUqM2Lz0A/QUMxJSyQjTLz uXJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717615326; x=1718220126; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N/Gdt7/+lZ0binabe9ZcG2ArhZluimuOacqq/Lpqfk4=; b=ws9rsBDCVGMkfX8MrOY8bZOeAHM08iRimBMCW2H/2B5bvF5O1lmuvTziR0AeAsLclC G4pKKWlXbVyZQq99Y0xQ2lle/fVJNz36y2N/3a4xPyhCLlDz8T/69X6Bn5NdFux0lp07 Gp5gibblHEfmmFPL05g7GL5MWlDXeT18zLrfq/KZWEhkQUoKd7R609hriVTc18gE5S84 9dCMqeVqzwt9dOsajqD8RYHZcgEq6F7UILipmYWginCQBT4XNLqVLCIOzI+pCcgoT4MB K4hjXkAbDR4R8VaDYN837dbygb955sM7dpFFrQOJODQEnElihP4PweAweLzMbMC8kZGW 2JyA== X-Forwarded-Encrypted: i=1; AJvYcCUeQhuEPHetNAVBTx56IwQRgNcFLDZm3zD3kIXUfrFOmnLh0W/oGtA6O27gg/Pyhad0WY8OHSjrXEEnKc+ML0PVgMc75w== X-Gm-Message-State: AOJu0YxrGa1fqNP9RQcEF6OoQ81aIJkpoGUiBEUybawnJss8hLquYqUg 2zuIkZxierJjcQo69pm0DSSw338EaVRv147fqoL+cwu3zR8Ady8K X-Google-Smtp-Source: AGHT+IFRONZK8RGRC5x6pa76z50dfB1U6LM+8CSQvvATEkVm7j8/Po7g1HUZxhWHUHcDvCBzMjEpUg== X-Received: by 2002:a5d:4e91:0:b0:35d:bf15:dac2 with SMTP id ffacd0b85a97d-35e8ef0aad3mr2652191f8f.39.1717615326216; Wed, 05 Jun 2024 12:22:06 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4214bf5994csm36079625e9.1.2024.06.05.12.22.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:22:05 -0700 (PDT) From: Christian Marangi To: Tom Rini , Dario Binacchi , Michael Trimarchi , Frieder Schrempf , Jagan Teki , Vignesh R , Joe Hershberger , Ramon Fried , Christian Marangi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Rasmus Villemoes , Doug Zobel , William Zhang , Mikhail Kshevetskiy , Igor Prusov , Bruce Suen , Takahiro Kuwano , Pratyush Yadav , Venkatesh Yadav Abbarapu , Vaishnav Achath , AKASHI Takahiro , u-boot@lists.denx.de Subject: [PATCH 6/7] mtd: implement support for LED status activity Date: Wed, 5 Jun 2024 21:21:38 +0200 Message-ID: <20240605192146.19052-7-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605192146.19052-1-ansuelsmth@gmail.com> References: <20240605192146.19052-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 Jun 2024 21:37:35 +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 Implement support for LED status activity. If the feature is enabled, make the defined ACTIVITY LED to signal mtd write or erase operations. Signed-off-by: Christian Marangi --- cmd/mtd.c | 23 +++++++++++++++++++++++ drivers/mtd/nand/core.c | 4 ++++ drivers/mtd/nand/spi/core.c | 5 +++++ drivers/mtd/spi/spi-nor-core.c | 9 +++++++++ 4 files changed, 41 insertions(+) diff --git a/cmd/mtd.c b/cmd/mtd.c index 9189f45cabd..aa0a41ac3bb 100644 --- a/cmd/mtd.c +++ b/cmd/mtd.c @@ -11,6 +11,7 @@ #include #include #include +#include #if CONFIG_IS_ENABLED(CMD_MTD_OTP) #include #endif @@ -559,6 +560,12 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, while (mtd_block_isbad(mtd, off)) off += mtd->erasesize; +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + if (!read) + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_BLINKING); +#endif + /* Loop over the pages to do the actual read/write */ while (remaining) { /* Skip the block if it is bad */ @@ -586,6 +593,12 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc, io_op.oobbuf += io_op.oobretlen; } +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + if (!read) + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_OFF); +#endif + if (!ret && dump) mtd_dump_device_buf(mtd, start_off, buf, len, woob); @@ -653,6 +666,11 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, erase_op.addr = off; erase_op.len = mtd->erasesize; +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_ON); +#endif + while (len) { if (!scrub) { ret = mtd_block_isbad(mtd, erase_op.addr); @@ -681,6 +699,11 @@ static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc, erase_op.addr += mtd->erasesize; } +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_OFF); +#endif + if (ret && ret != -EIO) ret = CMD_RET_FAILURE; else diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index f6d9c584f78..631a4c83e04 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c @@ -18,6 +18,7 @@ #include #include #include +#include /** * nanddev_isbad() - Check if a block is bad @@ -182,6 +183,9 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo) } nanddev_pos_next_eraseblock(nand, &pos); +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); +#endif } return 0; diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index 62c28aa422d..86d7ed9e9d0 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -32,6 +32,7 @@ #include #include #include +#include #endif /* SPI NAND index visible in MTD names */ @@ -657,6 +658,10 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to, ops->retlen += iter.req.datalen; ops->oobretlen += iter.req.ooblen; + +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); +#endif } #ifndef __UBOOT__ diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index f86003ca8c0..1e7436079e9 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -32,6 +32,8 @@ #include #include +#include + #include "sf_internal.h" /* Define max times to check status register before we give up. */ @@ -1039,6 +1041,10 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr) ret = spi_nor_wait_till_ready(nor); if (ret) goto erase_err; + +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); +#endif } addr_known = false; @@ -1816,6 +1822,9 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len, goto write_err; *retlen += written; i += written; +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_activity(CONFIG_LED_STATUS_ACTIVITY); +#endif } write_err: From patchwork Wed Jun 5 19:21:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Marangi X-Patchwork-Id: 1944139 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=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=lQIv3bVp; 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 4VvdB013g6z20WK for ; Thu, 6 Jun 2024 05:41:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C06AB884E7; Wed, 5 Jun 2024 21:37:43 +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="lQIv3bVp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AAA0A88354; Wed, 5 Jun 2024 21:22: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,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-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) (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 B17F68836C for ; Wed, 5 Jun 2024 21:22:08 +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=ansuelsmth@gmail.com Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-4213870aafdso2242095e9.2 for ; Wed, 05 Jun 2024 12:22:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717615328; x=1718220128; darn=lists.denx.de; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=uXkXlxaFoE7EdVjfBeOn9iAr3jACb605iugKm19iiDE=; b=lQIv3bVpIvffDEOC9QexJH0yaRXo0V6nuHcCT371hDzpt3OfGWBXCeu6u8+KWp+ojt 81c2e16anhjkXw0hQ4Hiks+a9s+Sz4oMN2Y64Tlo+CiHPRkF4Nk0oY4nshI+h9gJlVcU 28MDr8DzaMs2PlmVZ405DLqcUzVxOkf42sExCMvPs3VgOrufFYWtFglxARjuZjhe9Eyp IwYbR0NEyC3GxrqI2PDiWNvmrmB3kxmcTQvqQNJ3FkX4Xn+TW2izZO5BtZekcipeQ+IB End0WJmyM3cq6mNtLh2lYk8j0Pt336aeQSFhthm8z2/qhfdAuPdQ+DvHksjqSSvEA9ar tfDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717615328; x=1718220128; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uXkXlxaFoE7EdVjfBeOn9iAr3jACb605iugKm19iiDE=; b=EOxx5sspQPXF2bjmbFSVhdH9elTzFzuT4XDvl+wCi7mTJsQ2tUydWB7vTVy5e2lBP9 UjtZEMdVztgU0zxDCl/hObdcR460/3ljDPmhbS/B/QdalExzgHGz5+wdJNSGqjz5GLeF qcnexBdg8Tcv76CmSnNXiXr+NCqvOzEbVhmZy0BjND4qdNdqEH+AO75r8vBqfOQUCNEl bHOHW3LeHmMPNJGt1CMcfz9nC+ng9yqqPJep2rVX9M9LtL5fmMncrryyDWfSBve+ub1z WcbsuWMPDihZv9f/KXcmsXgk/nKEEdah1gOvPHT+ynFDWl61ENI4csAyg2XxQvgeIf0X HBvQ== X-Forwarded-Encrypted: i=1; AJvYcCXXE0k7AnUdMDMi4zdJ9xuTkXRlIF0YTn5iU3jPHuwCVOQ8fiJcH/q3NAACAchaUF6ONdMacfwtXlBYQKlqkjptH5BQrA== X-Gm-Message-State: AOJu0YwlpsE3Yac3uzn8YOzDsbe3PXS2fG7TgUJKOmtKbqrpoSc4hnRr M22Bm+qsNEiRZaAeocVFjq1iXUPI9Ff+/DghlqqwefHk+OfuuNhn X-Google-Smtp-Source: AGHT+IErBhjLsRxsMG74ZnVXIuy6g++nKkoDlCz82M9dDcJzW9H8oUZp6W3oAh5397d34nLRCaLFTQ== X-Received: by 2002:a05:600c:458e:b0:420:2986:ccee with SMTP id 5b1f17b1804b1-4215633febamr27014155e9.30.1717615328083; Wed, 05 Jun 2024 12:22:08 -0700 (PDT) Received: from localhost.localdomain (93-34-90-105.ip49.fastwebnet.it. [93.34.90.105]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-4214bf5994csm36079625e9.1.2024.06.05.12.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:22:07 -0700 (PDT) From: Christian Marangi To: Tom Rini , Dario Binacchi , Michael Trimarchi , Frieder Schrempf , Jagan Teki , Vignesh R , Joe Hershberger , Ramon Fried , Christian Marangi , Arseniy Krasnov , Miquel Raynal , Simon Glass , Heinrich Schuchardt , Dmitry Dunaev , Devarsh Thakkar , Bin Meng , Eugene Uriev , Nikhil M Jain , Shiji Yang , Raymond Mao , Rasmus Villemoes , Doug Zobel , William Zhang , Mikhail Kshevetskiy , Igor Prusov , Bruce Suen , Takahiro Kuwano , Pratyush Yadav , Venkatesh Yadav Abbarapu , Vaishnav Achath , AKASHI Takahiro , u-boot@lists.denx.de Subject: [PATCH 7/7] ubi: implement support for LED status activity Date: Wed, 5 Jun 2024 21:21:39 +0200 Message-ID: <20240605192146.19052-8-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605192146.19052-1-ansuelsmth@gmail.com> References: <20240605192146.19052-1-ansuelsmth@gmail.com> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 05 Jun 2024 21:37:35 +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 Implement support for LED status activity. If the feature is enabled, make the defined ACTIVITY LED to signal ubi write operation. Signed-off-by: Christian Marangi --- cmd/ubi.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/ubi.c b/cmd/ubi.c index 0a6a80bdd10..c300f1dc853 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -417,7 +418,21 @@ int ubi_volume_begin_write(char *volume, void *buf, size_t size, int ubi_volume_write(char *volume, void *buf, size_t size) { - return ubi_volume_begin_write(volume, buf, size, size); + int ret; + +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_BLINKING); +#endif + + ret = ubi_volume_begin_write(volume, buf, size, size); + +#ifdef CONFIG_LED_STATUS_ACTIVITY_ENABLE + status_led_set(CONFIG_LED_STATUS_ACTIVITY, + CONFIG_LED_STATUS_OFF); +#endif + + return ret; } int ubi_volume_read(char *volume, char *buf, size_t size)