Re: fec(4) cleanup

2016-09-21 Thread Mike Belopuhov
On 21 September 2016 at 10:15, Mark Kettenis  wrote:
> Diff below removes nused code from the driver and makes sure we only
> enable the tx and rx interrupts.  This seems to work fine for me.
> Next step will be to add the missing PHY tick stuff.
>
> ok?
>

OK mikeb.  I was going to send a diff like this yesterday
but realised that I didn't know which interrupt mask bit to
toggle.  This "unmask everything" hack looks like a good
candidate, indeed.



fec(4) cleanup

2016-09-21 Thread Mark Kettenis
Diff below removes nused code from the driver and makes sure we only
enable the tx and rx interrupts.  This seems to work fine for me.
Next step will be to add the missing PHY tick stuff.

ok?


Index: sys/arch/armv7/imx/if_fec.c
===
RCS file: /cvs/src/sys/arch/armv7/imx/if_fec.c,v
retrieving revision 1.16
diff -u -p -r1.16 if_fec.c
--- sys/arch/armv7/imx/if_fec.c 19 Aug 2016 18:25:53 -  1.16
+++ sys/arch/armv7/imx/if_fec.c 21 Sep 2016 08:11:53 -
@@ -221,7 +221,6 @@ struct fec_softc {
bus_space_handle_t  sc_ioh;
void*sc_ih; /* Interrupt handler */
bus_dma_tag_t   sc_dma_tag;
-   uint32_tintr_status;/* soft interrupt status */
struct fec_dma_alloctxdma;  /* bus_dma glue for tx desc */
struct fec_buf_desc *tx_desc_base;
struct fec_dma_allocrxdma;  /* bus_dma glue for rx desc */
@@ -250,7 +249,6 @@ void fec_iff(struct fec_softc *);
 struct mbuf * fec_newbuf(void);
 int fec_intr(void *);
 void fec_recv(struct fec_softc *);
-int fec_wait_intr(struct fec_softc *, int, int);
 int fec_miibus_readreg(struct device *, int, int);
 void fec_miibus_writereg(struct device *, int, int, int);
 void fec_miibus_statchg(struct device *);
@@ -680,7 +678,6 @@ fec_init(struct fec_softc *sc)
 
/* enable interrupts for tx/rx */
HWRITE4(sc, ENET_EIMR, ENET_EIR_TXF | ENET_EIR_RXF);
-   HWRITE4(sc, ENET_EIMR, 0x);
 
fec_start(ifp);
 }
@@ -900,15 +897,6 @@ fec_intr(void *arg)
HWRITE4(sc, ENET_EIR, status);
 
/*
-* Wake up the blocking process to service command
-* related interrupt(s).
-*/
-   if (ISSET(status, ENET_EIR_MII)) {
-   sc->intr_status |= status;
-   wakeup(&sc->intr_status);
-   }
-
-   /*
 * Handle incoming packets.
 */
if (ISSET(status, ENET_EIR_RXF)) {
@@ -978,28 +966,6 @@ done:
HWRITE4(sc, ENET_RDAR, ENET_RDAR_RDAR);
 
if_input(ifp, &ml);
-}
-
-int
-fec_wait_intr(struct fec_softc *sc, int mask, int timo)
-{
-   int status;
-   int s;
-
-   s = splnet();
-
-   status = sc->intr_status;
-   while (status == 0) {
-   if (tsleep(&sc->intr_status, PWAIT, "hcintr", timo)
-   == EWOULDBLOCK) {
-   break;
-   }
-   status = sc->intr_status;
-   }
-   sc->intr_status &= ~status;
-
-   splx(s);
-   return status;
 }
 
 /*