[PATCH 4/5] net: remove unreachable legacy LED code
Quentin Schulz
foss+uboot at 0leil.net
Wed Nov 19 17:43:48 CET 2025
From: Quentin Schulz <quentin.schulz at cherry.de>
The code is guarded by a condition none of the defconfigs meet (that is
CONFIG_SYS_FAULT_ECHO_LINK_DOWN and CONFIG_LED_STATUS_RED both enabled),
so we can remove the unreachable code sections.
When doing that, there's no caller for miiphy_link anymore, so it can be
removed.
This in turns makes CONFIG_SYS_FAULT_ECHO_LINK_DOWN and
CONFIG_SYS_FAULT_MII_ADDR unused so they are removed as well.
Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
---
common/miiphyutil.c | 25 -------------------------
include/miiphy.h | 3 ---
net/Kconfig | 11 -----------
net/net.c | 35 -----------------------------------
4 files changed, 74 deletions(-)
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 274e88a4921..dd4cc3c2e4e 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -523,28 +523,3 @@ int miiphy_is_1000base_x(const char *devname, unsigned char addr)
return 0;
#endif
}
-
-#ifdef CONFIG_SYS_FAULT_ECHO_LINK_DOWN
-/*****************************************************************************
- *
- * Determine link status
- */
-int miiphy_link(const char *devname, unsigned char addr)
-{
- unsigned short reg;
-
- /* dummy read; needed to latch some phys */
- (void)miiphy_read(devname, addr, MII_BMSR, ®);
- if (miiphy_read(devname, addr, MII_BMSR, ®)) {
- puts("MII_BMSR read failed, assuming no link\n");
- return 0;
- }
-
- /* Determine if a link is active */
- if ((reg & BMSR_LSTATUS) != 0) {
- return 1;
- } else {
- return 0;
- }
-}
-#endif
diff --git a/include/miiphy.h b/include/miiphy.h
index 96afe5f4030..817d77add37 100644
--- a/include/miiphy.h
+++ b/include/miiphy.h
@@ -29,9 +29,6 @@ int miiphy_reset(const char *devname, unsigned char addr);
int miiphy_speed(const char *devname, unsigned char addr);
int miiphy_duplex(const char *devname, unsigned char addr);
int miiphy_is_1000base_x(const char *devname, unsigned char addr);
-#ifdef CONFIG_SYS_FAULT_ECHO_LINK_DOWN
-int miiphy_link(const char *devname, unsigned char addr);
-#endif
int miiphy_set_current_dev(const char *devname);
const char *miiphy_get_current_dev(void);
diff --git a/net/Kconfig b/net/Kconfig
index 42fcba5323f..e45ceb25106 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -53,17 +53,6 @@ config NET_MAXDEFRAG
used for reassembly, and thus an upper bound for the size of
IP datagrams that can be received.
-config SYS_FAULT_ECHO_LINK_DOWN
- bool "Echo the inverted Ethernet link state to the fault LED"
- help
- Echo the inverted Ethernet link state to the fault LED. Note, if
- this option is active, then CONFIG_SYS_FAULT_MII_ADDR also needs to
- be configured.
-
-config SYS_FAULT_MII_ADDR
- hex "MII address of the PHY to check for the Ethernet link state"
- depends on SYS_FAULT_ECHO_LINK_DOWN && LED_STATUS_RED_ENABLE
-
config TFTP_WINDOWSIZE
int "TFTP window size"
default 1
diff --git a/net/net.c b/net/net.c
index f579f6ac5bc..44ce0ba4011 100644
--- a/net/net.c
+++ b/net/net.c
@@ -88,15 +88,9 @@
#include <image.h>
#include <led.h>
#include <log.h>
-#if defined(CONFIG_LED_STATUS)
-#include <miiphy.h>
-#endif
#include <net.h>
#include <net6.h>
#include <ndisc.h>
-#if defined(CONFIG_LED_STATUS)
-#include <status_led.h>
-#endif
#include <watchdog.h>
#include <linux/compiler.h>
#include <net/fastboot_udp.h>
@@ -615,19 +609,6 @@ restart:
break;
}
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
-#if defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN) && \
- defined(CONFIG_LED_STATUS) && \
- defined(CONFIG_LED_STATUS_RED)
- /*
- * Echo the inverted link state to the fault LED.
- */
- if (miiphy_link(eth_get_dev()->name, CONFIG_SYS_FAULT_MII_ADDR))
- status_led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_OFF);
- else
- status_led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_ON);
-#endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */
-#endif /* CONFIG_MII, ... */
#ifdef CONFIG_USB_KEYBOARD
net_busy_flag = 1;
#endif
@@ -688,22 +669,6 @@ restart:
((get_timer(0) - time_start) > time_delta)) {
thand_f *x;
-#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
-#if defined(CONFIG_SYS_FAULT_ECHO_LINK_DOWN) && \
- defined(CONFIG_LED_STATUS) && \
- defined(CONFIG_LED_STATUS_RED)
- /*
- * Echo the inverted link state to the fault LED.
- */
- if (miiphy_link(eth_get_dev()->name,
- CONFIG_SYS_FAULT_MII_ADDR))
- status_led_set(CONFIG_LED_STATUS_RED,
- CONFIG_LED_STATUS_OFF);
- else
- status_led_set(CONFIG_LED_STATUS_RED,
- CONFIG_LED_STATUS_ON);
-#endif /* CONFIG_SYS_FAULT_ECHO_LINK_DOWN, ... */
-#endif /* CONFIG_MII, ... */
debug_cond(DEBUG_INT_STATE, "--- net_loop timeout\n");
x = time_handler;
time_handler = (thand_f *)0;
--
2.51.1
More information about the U-Boot
mailing list