summaryrefslogtreecommitdiff
path: root/net/eth-uclass.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-01-19 22:46:45 +0300
committerTom Rini <trini@konsulko.com>2021-01-19 22:46:45 +0300
commit9d13cd95f1df7d04f702975cdcdd8e087f71f74c (patch)
treeecdb97433ba17bf82c463affdf47ab96100cf64b /net/eth-uclass.c
parentdb0dd72e27ce62c5b28f07595b91ed00d0565819 (diff)
parent1231184caacad32c180d7e2338a645f7dfe9571a (diff)
downloadu-boot-9d13cd95f1df7d04f702975cdcdd8e087f71f74c.tar.xz
Merge branch '2021-01-19-networking-improvements'
- e1000, ftgmac100: Add support for getting the MAC - General networking improvements - dwc_eth_qos, ks8851 fixes
Diffstat (limited to 'net/eth-uclass.c')
-rw-r--r--net/eth-uclass.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 0156324032..8a22d8bf59 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -26,6 +26,7 @@ DECLARE_GLOBAL_DATA_PTR;
*/
struct eth_device_priv {
enum eth_state_t state;
+ bool running;
};
/**
@@ -290,6 +291,7 @@ int eth_init(void)
dev_get_uclass_priv(current);
priv->state = ETH_STATE_ACTIVE;
+ priv->running = true;
return 0;
}
} else {
@@ -319,13 +321,16 @@ void eth_halt(void)
struct eth_device_priv *priv;
current = eth_get_dev();
- if (!current || !eth_is_active(current))
+ if (!current)
return;
- eth_get_ops(current)->stop(current);
priv = dev_get_uclass_priv(current);
- if (priv)
- priv->state = ETH_STATE_PASSIVE;
+ if (!priv || !priv->running)
+ return;
+
+ eth_get_ops(current)->stop(current);
+ priv->state = ETH_STATE_PASSIVE;
+ priv->running = false;
}
int eth_is_active(struct udevice *dev)
@@ -534,6 +539,7 @@ static int eth_post_probe(struct udevice *dev)
#endif
priv->state = ETH_STATE_INIT;
+ priv->running = false;
/* Check if the device has a valid MAC address in device tree */
if (!eth_dev_get_mac_address(dev, pdata->enetaddr) ||
@@ -591,8 +597,8 @@ static int eth_pre_remove(struct udevice *dev)
return 0;
}
-UCLASS_DRIVER(eth) = {
- .name = "eth",
+UCLASS_DRIVER(ethernet) = {
+ .name = "ethernet",
.id = UCLASS_ETH,
.post_bind = eth_post_bind,
.pre_unbind = eth_pre_unbind,