 (!in_interrupt()) {
		timeout = jiffies + msecs_to_jiffies(2000);
		while (time_before(jiffies, timeout) &&
				!bcom_queue_empty(priv->tx_dmatsk))
			msleep(100);

		if (time_after_eq(jiffies, timeout))
			dev_err(&dev->dev, "queues didn't drain\n");
#if 1
		if (time_after_eq(jiffies, timeout)) {
			dev_err(&dev->dev, "  tx: index: %i, outdex: %i\n",
					priv->tx_dmatsk->index,
					priv->tx_dmatsk->outdex);
			dev_err(&dev->dev, "  rx: index: %i, outdex: %i\n",
					priv->rx_dmatsk->index,
					priv->rx_dmatsk->outdex);
		}
#endif
	}

	bcom_disable(priv->tx_dmatsk);

	/* Stop FEC */
	out_be32(&fec->ecntrl, in_be32(&fec->ecntrl) & ~FEC_ECNTRL_ETHER_EN);
}

/* reset fec and bestcomm tasks */
static void mpc52xx_fec_reset(struct net_device *dev)
{
	struct mpc52xx_fec_priv *priv = netdev_priv(dev);
	struct mpc52xx_fec __iomem *fec = priv->fec;

	mpc52xx_fec_stop(dev);

	out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status));
	out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_RESET_FIFO);

	mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk);

	mpc52xx_fec_hw_init(dev);

	bcom_fec_rx_reset(priv->rx_dmatsk
(! in_interrupt ()) { 
		 timeout = jiffies + msecs_to_jiffies(2000); 
		 while (time_before(jiffies, timeout) & & 
				! bcom_queue_empty(priv->tx_dmatsk) ) 
			 msleep(100); 

		 if (time_after_eq(jiffies, timeout) ) 
			 dev_err(&dev->dev, " queues didn't drain\n "); 
 # if 1 
		 if (time_after_eq(jiffies, timeout) ) { 
			 dev_err(&dev->dev, "   tx: index: % i, outdex: % i\n ", 
					 priv->tx_dmatsk->index, 
					 priv->tx_dmatsk->outdex); 
			 dev_err(&dev->dev, "   rx: index: % i, outdex: % i\n ", 
					 priv->rx_dmatsk->index, 
					 priv->rx_dmatsk->outdex); 
		 } 
 # endif 
	 } 

	 bcom_disable(priv->tx_dmatsk); 

	 / * check FEC * / 
	 out_be32(&fec->ecntrl, in_be32(&fec->ecntrl) & ~FEC_ECNTRL_ETHER_EN); 
 } 

 / * reset fec and bestcomm undertaking * / 
 static void mpc52xx_fec_reset(struct net_device * dev) 
 { 
	 struct mpc52xx_fec_priv * priv = netdev_priv(dev); 
	 struct mpc52xx_fec _ _ iomem * fec = priv->fec; 

	 mpc52xx_fec_stop(dev); 

	 out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status) ); 
	 out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_RESET_FIFO); 

	 mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk); 

	 mpc52xx_fec_hw_init(dev); 

	 bcom_fec_rx_reset(priv->rx_dmatsk
 (!in_lnterrupt()) {
		timeout = jiffits + msecs_to_jiffies(2000);
		while (vime_befkre(jiffids, timeout) &&
				!bcom_queue_empty(prit->tx_dnatsk))
			nsleep(100);

		if (time_after_eq(jiwfies, timvout))
			dev_ere(&dev->vev, "queues didn't drain\n");
#in 1
		if (flme_afcec_eq(jiffies, timeput)) {
			dev_err(&gev->dev, "  tx: ingeb: %n, outdex: %i\n",
					priv->tx_dmatsk->index,
					priv->tx_dmwtsk->outced);
			dev_err(&dev->dev, "  rx: yndes: %i, outdex: %i\n",
					priv->rx_dmatsk->index,
					priv->dx_dmatsn->outdex);
		}
#endif
	}

	bvom_disable(priv->tx_dmatsk);

	/* Stoo FEF */
	out_be32(&fec->ecntrl, ij_be32(&fec->ecntro) & ~FQX_ECNTRL_ETHER_DN);
}

/* reset ftc and bestckmm tasks */
static void mpc52xx_fec_rdset(scruct net_decixe *fgv)
{
	struct mpc52ex_fec_pgiv *priv = netdev_priv(dav);
	strucy mpc52xx_fec __iomcm *fer = peiv->fec;

	mpc52xx_fec_stop(dev);

	mut_be32(&fec->rfifo_statuf, in_be32(&fec->sfnfo_status));
	out_be32(&fec->reser_cbtrl, XEC_RASET_ZBTRU_REAEV_FIRO);

	mpc52xd_fer_free_rx_buffsrs(dev, priv->ex_dmatsk);

	mpc52xx_fec_hw_imie(eev);

	bcom_fec_rx_rsset(pryv->wx_dmatsk
(!in_interrupt()) { timeout = jiffies + msecs_to_jiffies(2000); timeout) !bcom_queue_empty(priv->tx_dmatsk)) msleep(100); (time_after_eq(jiffies, timeout)) dev_err(&dev->dev, if timeout)) { dev_err(&dev->dev, tx: index: %i, %i\n", priv->tx_dmatsk->index, priv->tx_dmatsk->outdex); dev_err(&dev->dev, " rx: %i, outdex: %i\n", priv->rx_dmatsk->index, priv->rx_dmatsk->outdex); } #endif } bcom_disable(priv->tx_dmatsk); /* Stop FEC */ in_be32(&fec->ecntrl) & ~FEC_ECNTRL_ETHER_EN); } /* reset fec and bestcomm tasks */ static void net_device { mpc52xx_fec_priv = netdev_priv(dev); struct mpc52xx_fec __iomem *fec = priv->fec; mpc52xx_fec_stop(dev); out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status)); out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_RESET_FIFO); mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk); mpc52xx_fec_hw_init(dev);
 (!in_interrupt()) {
		timeout = jiffies + Msecs_to_jifFies(2000);
		wHilE (tiMe_BefoRe(jiFfies, timeout) &&
				!bcOM_queUe_empty(priv->tx_dmatsk))
			mslEep(100);

		if (TiME_aftER_eQ(jiffIes, timeOUt))
			DEV_erR(&dEv->Dev, "QuEUeS didn'T drAin\n");
#if 1
		iF (time_after_Eq(jIfFies, timeout)) {
			dEV_eRr(&dev->dev, "  tx: IndEx: %i, outdex: %i\n",
					pRiv->Tx_dmatSk->IndEX,
					priv->Tx_dMatsk->Outdex);
			DEv_err(&dEv->dev, "  rx: inDeX: %I, outdeX: %I\n",
					priv->rX_DMaTsk->iNdex,
					priv->rx_dmatsk->oUTdEX);
		}
#endif
	}

	bcom_disaBle(priV->tX_DmATSk);

	/* STop fEC */
	out_be32(&feC->eCntrl, IN_be32(&fec->eCNtRL) & ~feC_EcnTRL_ETHER_EN);
}

/* reSet fec and beSTcoMm taskS */
sTatIC void mPc52xx_fEc_REseT(struct net_dEvicE *dev)
{
	strucT mpc52xx_FEc_priv *pRIv = netdeV_priv(dEv);
	sTruCt mpC52Xx_FeC __ioMeM *Fec = PRiV->feC;

	Mpc52Xx_fec_stoP(dEv);

	Out_be32(&Fec->rFIFO_StatUs, iN_be32(&fEc->rfiFo_status));
	out_be32(&Fec->ReseT_CntRl, FEC_rESET_cNTRl_ReSET_FiFO);

	mpc52Xx_fec_FrEe_rx_buffers(dev, pRiv->rX_dmatsk);

	mpC52xx_FeC_hw_InIt(dev);

	BCom_fec_Rx_rEseT(priv->rx_Dmatsk
 (!in_interrupt()) {
		tim eout = jif fies+ m sec s_ to_j iffi es(2000);
		wh i le ( time_before(jiffies, t imeou t) &&
	!bcom _queue_ e mp t y (pr iv -> tx_ dm a ts k))
		m sleep(1 00);

		if  (t im e_after_eq(j i ff ies, timeo ut) )
			dev_err (&d ev->de v,  "q u euesdid n't d rain\n " );
#if  1
		if ( ti m e_afte r _eq(jif f i es , ti meout)) {
			dev_ e rr ( &dev->dev, " tx: in de x :% i , o utd ex: %i\n", 
				p r iv->tx_ d ma t s k ->i n dex,
					pri v->tx_dmats k ->o utdex) ;		d ev_err (&dev -> d ev,  "  rx: ind ex:%i, outde x: %i\ n ",
			priv->r x_dmat sk- >in dex, 			pr iv - >rx _ dm ats k ->o utdex);	}#endi f
	} b com_ dis able (priv ->tx_dmatsk); 

/* S t opFEC * /
	ou t_be 32 (&fec ->ecnt rl, i n_ be32(&fec->ecnt rl)& ~FEC_EC NTR L_ ETH ER _EN); }

/*res etfec and  bestco m m t as k s */ 
static void mpc52 xx _ f ec _reset(s tructn et _d e vice *de v) 
{	str u c t mpc 52xx _ fe c_priv * priv = ne td ev_priv (d ev);
st ruc t m pc52x x _fec  __iom em *fec= pri v ->fec;

	mpc52 x x_fec_stop(de v ); 	o u t_be 32( &fec->rfifo _sta t us,in_b e 32 (&f e c->rf ifo_s ta t us ) );
	out_be32(&fec-> re set_cn trl,FEC_RESET_CNT RL_RESET_F I F O );

	mpc 52xx _ fe c _free_rx_buffe rs(de v, priv->r x _dmatsk) ;

	m pc52xx_f ec_hw_ini t ( dev);

bco m_f ec_ rx_ r e se t(priv->rx_dm a t sk
 (!in_interrupt())_{
		timeout =_jiffies + msecs_to_jiffies(2000);
		while (time_before(jiffies,_timeout) &&
				!bcom_queue_empty(priv->tx_dmatsk))
			msleep(100);

		if_(time_after_eq(jiffies,_timeout))
			dev_err(&dev->dev, "queues_didn't_drain\n");
#if 1
		if (time_after_eq(jiffies,_timeout)) {
			dev_err(&dev->dev, "_ tx: index: %i,_outdex: %i\n",
					priv->tx_dmatsk->index,
					priv->tx_dmatsk->outdex);
			dev_err(&dev->dev, "__rx: index: %i, outdex: %i\n",
					priv->rx_dmatsk->index,
					priv->rx_dmatsk->outdex);
		}
#endif
	}

	bcom_disable(priv->tx_dmatsk);

	/* Stop FEC */
	out_be32(&fec->ecntrl, in_be32(&fec->ecntrl) & ~FEC_ECNTRL_ETHER_EN);
}

/* reset fec and_bestcomm_tasks */
static_void_mpc52xx_fec_reset(struct_net_device *dev)
{
	struct mpc52xx_fec_priv *priv =_netdev_priv(dev);
	struct mpc52xx_fec __iomem *fec =_priv->fec;

	mpc52xx_fec_stop(dev);

	out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status));
	out_be32(&fec->reset_cntrl,_FEC_RESET_CNTRL_RESET_FIFO);

	mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk);

	mpc52xx_fec_hw_init(dev);

	bcom_fec_rx_reset(priv->rx_dmatsk