[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cdi-devel] [PATCH 7/7] e1000: Wait for Link Up
As we currently don't forward any link changes to the OS, the most
reasonable thing to do is to wait a bit during device initialisation to
give it a chance to have the link set up before the OS tries to make a
DHCP request.
Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
e1000/device.c | 10 ++++++++++
e1000/device.h | 5 +++++
2 files changed, 15 insertions(+)
diff --git a/e1000/device.c b/e1000/device.c
index d9e65c5..95ca731 100644
--- a/e1000/device.c
+++ b/e1000/device.c
@@ -508,6 +508,13 @@ found:
printf("e1000: Fuehre Reset der Karte durch\n");
reset_nic(netcard);
+ printf("e1000: Warte auf Link\n");
+ CDI_CONDITION_WAIT_SLEEP(reg_inl(netcard, REG_STATUS) & STATUS_LINK_UP,
+ 3000, 10);
+ if ((reg_inl(netcard, REG_STATUS) & STATUS_LINK_UP) == 0) {
+ printf("e1000: Kein Link\n");
+ }
+
cdi_net_device_init(&netcard->net);
// Interrupts aktivieren
@@ -634,6 +641,9 @@ static void e1000_handle_interrupt(struct cdi_device* device)
} else if (icr & ICR_TRANSMIT) {
// Nichts zu tun
+ } else if (icr & ICR_LINK_CHANGE) {
+ printf("e1000: Link %s\n",
+ reg_inl(netcard, REG_STATUS) & STATUS_LINK_UP ? "up" : "down");
} else {
#ifdef DEBUG
printf("e1000: Unerwarteter Interrupt.\n");
diff --git a/e1000/device.h b/e1000/device.h
index 638e6f9..85bca25 100644
--- a/e1000/device.h
+++ b/e1000/device.h
@@ -81,6 +81,10 @@ enum {
};
enum {
+ STATUS_LINK_UP = (1 << 1), /* LU */
+};
+
+enum {
RCTL_ENABLE = (1 << 1),
RCTL_BROADCAST = (1 << 15), /* BAM */
RCTL_2K_BUFSIZE = (0 << 16), /* BSIZE */
@@ -101,6 +105,7 @@ enum {
enum {
ICR_TRANSMIT = (1 << 0),
+ ICR_LINK_CHANGE = (1 << 2),
ICR_RECEIVE = (1 << 7),
};
--
2.1.4