List Info

Thread: Re: MI SONIC Ethernet driver for mac68k




Re: MI SONIC Ethernet driver for mac68k
user name
2008-04-16 10:29:23
stixstix.id.au wrote:

> Looks like it reads the MAC ok.

Ok, now I see there is some differnece around CAM code
between old MD sonic and current MI one.

I'm not sure how the MI one works on arc and LC630 (CS
Twisted-Pair),
but could you try the attached patch?
---
Izumi Tsutsui


Index: dev/ic/dp83932.c
============================================================
=======
RCS file: /cvsroot/src/sys/dev/ic/dp83932.c,v
retrieving revision 1.23
diff -u -r1.23 dp83932.c
--- dev/ic/dp83932.c	8 Apr 2008 12:07:26 -0000	1.23
+++ dev/ic/dp83932.c	16 Apr 2008 15:15:56 -0000
 -1229,6
+1229,11 
 	rcr |= RCR_AMC;
 
  setit:
+	if (sc->sc_32bit) {
+		sc->sc_cdaenable32 = htosonic32(sc, camvalid);
+	} else {
+		sc->sc_cdaenable16 = htosonic16(sc, camvalid);
+	}
 	/* Load the CAM. */
 	SONIC_CDCAMSYNC(sc, BUS_DMASYNC_PREWRITE);
 	CSR_WRITE(sc, SONIC_CDP, SONIC_CDCAMADDR(sc) &
0xffff);
Index: dev/ic/dp83932var.h
============================================================
=======
RCS file: /cvsroot/src/sys/dev/ic/dp83932var.h,v
retrieving revision 1.7
diff -u -r1.7 dp83932var.h
--- dev/ic/dp83932var.h	25 Dec 2007 18:33:38 -0000	1.7
+++ dev/ic/dp83932var.h	16 Apr 2008 15:15:56 -0000
 -94,6
+94,7 
 	 * The CAM descriptors.
 	 */
 	struct sonic_cda16 scd_cam[16];
+	uint16_t scd_camenable;
 };
 
 #define	SONIC_CDOFF16(x)	offsetof(struct
sonic_control_data16, x)
 -122,6
+123,7 
 	 * The CAM descriptors.
 	 */
 	struct sonic_cda32 scd_cam[16];
+	uint32_t scd_camenable;
 };
 
 #define	SONIC_CDOFF32(x)	offsetof(struct
sonic_control_data32, x)
 -180,11
+182,13 
 #define	sc_rda16	sc_cdun.cdun_16->scd_rxdescs
 #define	sc_rra16	sc_cdun.cdun_16->scd_rxbufs
 #define	sc_cda16	sc_cdun.cdun_16->scd_cam
+#define	sc_cdaenable16	sc_cdun.cdun_16->scd_camenable
 
 #define	sc_tda32	sc_cdun.cdun_32->scd_txdescs
 #define	sc_rda32	sc_cdun.cdun_32->scd_rxdescs
 #define	sc_rra32	sc_cdun.cdun_32->scd_rxbufs
 #define	sc_cda32	sc_cdun.cdun_32->scd_cam
+#define	sc_cdaenable32	sc_cdun.cdun_32->scd_camenable
 
 	int	sc_txpending;		/* number of Tx requests pending */
 	int	sc_txdirty;		/* first dirty Tx descriptor */
 -261,11
+265,13 
 do {									
 	if ((sc)->sc_32bit)						
 		bus_dmamap_sync((sc)->sc_dmat,
(sc)->sc_cddmamap,	
-		    SONIC_CDCAMOFF32, sizeof(struct sonic_cda32) * 16,	
+		    SONIC_CDCAMOFF32,					
+		    sizeof(struct sonic_cda32) * 16 +
sizeof(uint32_t),	
 		    (ops));						
 	else								
 		bus_dmamap_sync((sc)->sc_dmat,
(sc)->sc_cddmamap,	
-		    SONIC_CDCAMOFF16, sizeof(struct sonic_cda16) * 16,	
+		    SONIC_CDCAMOFF16,					
+		    sizeof(struct sonic_cda16) * 16 +
sizeof(uint16_t),	
 		    (ops));						
 } while (/*CONSTCOND*/0)
 

Re: MI SONIC Ethernet driver for mac68k
user name
2008-04-16 12:41:49
I wrote:

> but could you try the attached patch?

Ah, that doesn't work on arc.
Please try this one instead:

---
Index: dev/ic/dp83932.c
============================================================
=======
RCS file: /cvsroot/src/sys/dev/ic/dp83932.c,v
retrieving revision 1.23
diff -u -r1.23 dp83932.c
--- dev/ic/dp83932.c	8 Apr 2008 12:07:26 -0000	1.23
+++ dev/ic/dp83932.c	16 Apr 2008 17:37:25 -0000
 -1229,6
+1229,19 
 	rcr |= RCR_AMC;
 
  setit:
+	if (sc->sc_32bit) {
+		if (entry == 16)
+			sc->sc_cdaenable32 = htosonic32(sc, camvalid);
+		else
+			sc->sc_cda32[entry].cda_entry =
+			    htosonic32(sc, camvalid);
+	} else {
+		if (entry == 16)
+			sc->sc_cdaenable16 = htosonic16(sc, camvalid);
+		else
+			sc->sc_cda16[entry].cda_entry =
+			    htosonic16(sc, camvalid);
+	}
 	/* Load the CAM. */
 	SONIC_CDCAMSYNC(sc, BUS_DMASYNC_PREWRITE);
 	CSR_WRITE(sc, SONIC_CDP, SONIC_CDCAMADDR(sc) &
0xffff);
 -1243,9
+1256,6 
 		aprint_error_dev(&sc->sc_dev, "CAM load
failedn");
 	SONIC_CDCAMSYNC(sc, BUS_DMASYNC_POSTWRITE);
 
-	/* Set the CAM enable resgiter. */
-	CSR_WRITE(sc, SONIC_CER, camvalid);
-
 	/* Set the receive control register. */
 	CSR_WRITE(sc, SONIC_RCR, rcr);
 }
Index: dev/ic/dp83932var.h
============================================================
=======
RCS file: /cvsroot/src/sys/dev/ic/dp83932var.h,v
retrieving revision 1.7
diff -u -r1.7 dp83932var.h
--- dev/ic/dp83932var.h	25 Dec 2007 18:33:38 -0000	1.7
+++ dev/ic/dp83932var.h	16 Apr 2008 17:37:25 -0000
 -94,6
+94,7 
 	 * The CAM descriptors.
 	 */
 	struct sonic_cda16 scd_cam[16];
+	uint16_t scd_camenable;
 };
 
 #define	SONIC_CDOFF16(x)	offsetof(struct
sonic_control_data16, x)
 -122,6
+123,7 
 	 * The CAM descriptors.
 	 */
 	struct sonic_cda32 scd_cam[16];
+	uint32_t scd_camenable;
 };
 
 #define	SONIC_CDOFF32(x)	offsetof(struct
sonic_control_data32, x)
 -180,11
+182,13 
 #define	sc_rda16	sc_cdun.cdun_16->scd_rxdescs
 #define	sc_rra16	sc_cdun.cdun_16->scd_rxbufs
 #define	sc_cda16	sc_cdun.cdun_16->scd_cam
+#define	sc_cdaenable16	sc_cdun.cdun_16->scd_camenable
 
 #define	sc_tda32	sc_cdun.cdun_32->scd_txdescs
 #define	sc_rda32	sc_cdun.cdun_32->scd_rxdescs
 #define	sc_rra32	sc_cdun.cdun_32->scd_rxbufs
 #define	sc_cda32	sc_cdun.cdun_32->scd_cam
+#define	sc_cdaenable32	sc_cdun.cdun_32->scd_camenable
 
 	int	sc_txpending;		/* number of Tx requests pending */
 	int	sc_txdirty;		/* first dirty Tx descriptor */
 -261,11
+265,13 
 do {									
 	if ((sc)->sc_32bit)						
 		bus_dmamap_sync((sc)->sc_dmat,
(sc)->sc_cddmamap,	
-		    SONIC_CDCAMOFF32, sizeof(struct sonic_cda32) * 16,	
+		    SONIC_CDCAMOFF32,					
+		    sizeof(struct sonic_cda32) * 16 +
sizeof(uint32_t),	
 		    (ops));						
 	else								
 		bus_dmamap_sync((sc)->sc_dmat,
(sc)->sc_cddmamap,	
-		    SONIC_CDCAMOFF16, sizeof(struct sonic_cda16) * 16,	
+		    SONIC_CDCAMOFF16,					
+		    sizeof(struct sonic_cda16) * 16 +
sizeof(uint16_t),	
 		    (ops));						
 } while (/*CONSTCOND*/0)
 

---
Izumi Tsutsui

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )