[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sk(4) diff to handle "no PHY found!" issue



Please try this out, especially if you have a system
experiencing the "no PHY found!" issue when booting up
sometimes...

Index: if_sk.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_sk.c,v
retrieving revision 1.63
diff -u -p -r1.63 if_sk.c
--- if_sk.c	25 Apr 2005 17:55:51 -0000	1.63
+++ if_sk.c	8 May 2005 17:36:12 -0000
@@ -1593,12 +1593,21 @@ skc_attach(struct device *parent, struct
 	case SK_YUKON_LP:
 		sc->sk_name = "Marvell Yukon LP Gigabit Ethernet";
 		break;
+	case SK_YUKON_XL:
+		sc->sk_name = "Marvell Yukon-2 XL Gigabit Ethernet";
+		break;
+	case SK_YUKON_EC:
+		sc->sk_name = "Marvell Yukon-2 EC Fast Ethernet";
+		break;
+	case SK_YUKON_FE:
+		sc->sk_name = "Marvell Yukon-2 FE Fast Ethernet";
+		break;
 	default:
 		sc->sk_name = "Marvell Yukon (Unknown) Gigabit Ethernet";
 	}
 
 	/* Yukon Lite Rev A0 needs special test, from sk98lin driver */
-	if (sc->sk_type == SK_YUKON) {
+	if (sc->sk_type == SK_YUKON || sc->sk_type == SK_YUKON_LP) {
 		uint32_t flashaddr;
 		uint8_t testbyte;
 
@@ -2078,7 +2087,6 @@ sk_tick(void *xsc_if)
 	SK_XM_CLRBIT_2(sc_if, XM_IMR, XM_IMR_GP0_SET);
 	SK_XM_READ_2(sc_if, XM_ISR);
 	mii_tick(mii);
-	mii_pollstat(mii);
 	timeout_del(&sc_if->sk_tick_ch);
 }
 
@@ -2125,7 +2133,6 @@ sk_intr_bcom(struct sk_if_softc *sc_if)
 			SK_IF_WRITE_1(sc_if, 0, SK_LINKLED1_CTL,
 			    SK_LINKLED_ON|SK_LINKLED_LINKSYNC_OFF|
 			    SK_LINKLED_BLINK_OFF);
-			mii_pollstat(mii);
 		} else {
 			mii_tick(mii);
 			timeout_add(&sc_if->sk_tick_ch, hz);
@@ -2423,11 +2430,21 @@ void sk_init_yukon(sc_if)
 {
 	u_int32_t		phy;
 	u_int16_t		reg;
+	struct sk_softc		*sc;
 	int			i;
 
+	sc = sc_if->sk_softc;
+
 	DPRINTFN(2, ("sk_init_yukon: start: sk_csr=%#x\n",
 		     CSR_READ_4(sc_if->sk_softc, SK_CSR)));
 
+	if (sc->sk_type == SK_YUKON_LITE &&
+	    sc->sk_rev >= SK_YUKON_LITE_REV_A3) {
+		/* Take PHY out of reset. */
+		sk_win_write_4(sc, SK_GPIO,
+			(sk_win_read_4(sc, SK_GPIO) | SK_GPIO_DIR9) & ~SK_GPIO_DAT9);
+	}
+
 	/* GMAC and GPHY Reset */
 	SK_IF_WRITE_4(sc_if, 0, SK_GPHY_CTRL, SK_GPHY_RESET_SET);
 
@@ -2438,7 +2455,6 @@ void sk_init_yukon(sc_if)
 	SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_RESET_CLEAR);
 	SK_IF_WRITE_4(sc_if, 0, SK_GMAC_CTRL, SK_GMAC_RESET_SET);
 	DELAY(1000);
-
 
 	DPRINTFN(6, ("sk_init_yukon: 2\n"));