[PATCH 08/25] corvus: Migrate CONFIG_*_LED out of CONFIG namespace

Tom Rini trini at konsulko.com
Thu Mar 31 00:07:18 CEST 2022


This code is only used on the corvus platform, so migrate the LED on/off
code to this platform and remove it from the CONFIG namespace.  In
theory, this should likely be moved to the modern GPIO LED driver as a
further cleanup.

Cc: Heiko Schocher <hs at denx.de>
Signed-off-by: Tom Rini <trini at konsulko.com>
---
 board/siemens/corvus/board.c | 24 ++++++++++++++++++++++--
 include/configs/corvus.h     |  4 ----
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/board/siemens/corvus/board.c b/board/siemens/corvus/board.c
index a6e1737be022..90fece7f958d 100644
--- a/board/siemens/corvus/board.c
+++ b/board/siemens/corvus/board.c
@@ -52,8 +52,28 @@ static void corvus_request_gpio(void)
 	gpio_request(AT91_PIN_PD3, "USB1");
 	gpio_request(AT91_PIN_PB18, "SPICS1");
 	gpio_request(AT91_PIN_PB3, "SPICS0");
-	gpio_request(CONFIG_RED_LED, "red led");
-	gpio_request(CONFIG_GREEN_LED, "green led");
+	gpio_request(AT91_PIN_PD31, "red led"); /* this is the user1 led */
+	gpio_request(AT91_PIN_PD0, "green led"); /* this is the user2 led */
+}
+
+void red_led_on(void)
+{
+	gpio_set_value(AT91_PIN_PD31, 1);
+}
+
+void red_led_off(void)
+{
+	gpio_set_value(AT91_PIN_PD31, 0);
+}
+
+void green_led_on(void)
+{
+	gpio_set_value(AT91_PIN_PD0, 0);
+}
+
+void green_led_off(void)
+{
+	gpio_set_value(AT91_PIN_PD0, 1);
 }
 
 static void corvus_nand_hw_init(void)
diff --git a/include/configs/corvus.h b/include/configs/corvus.h
index bb73201b54fe..4809b59ecc39 100644
--- a/include/configs/corvus.h
+++ b/include/configs/corvus.h
@@ -31,10 +31,6 @@
 #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
 #define CONFIG_USART_ID			ATMEL_ID_SYS
 
-/* LED */
-#define CONFIG_RED_LED		AT91_PIN_PD31	/* this is the user1 led */
-#define CONFIG_GREEN_LED	AT91_PIN_PD0	/* this is the user2 led */
-
 /* SDRAM */
 #define CONFIG_SYS_SDRAM_BASE           ATMEL_BASE_CS6
 #define CONFIG_SYS_SDRAM_SIZE		0x08000000
-- 
2.25.1



More information about the U-Boot mailing list