SBMAC_WRITECSR(s->sbm_mdio, M_MAC_MDIO_DIR_INPUT|M_MAC_MDC | mac_mdio_genc); SBMAC_WRITECSR(s->sbm_mdio, M_MAC_MDIO_DIR_INPUT | mac_mdio_genc); 
__raw_writeq(M_MAC_MDIO_DIR_INPUT|M_MAC_MDC | mac_mdio_genc, s->sbm_mdio); __raw_writeq(M_MAC_MDIO_DIR_INPUT | mac_mdio_genc, s->sbm_mdio); 
static unsigned int sbmac_mii_read(struct sbmac_softc *s,int phyaddr,int regidx){	int idx;	int error;	int regval;	int mac_mdio_genc;	/*	 * Synchronize ourselves so that the PHY knows the next	 * thing coming down is a command	 */		sbmac_mii_sync(s);		/*	 * Send the data to the PHY.  The sequence is	 * a "start" command (2 bits)	 * a "read" command (2 bits)	 * the PHY addr (5 bits)	 * the register index (5 bits)	 */		sbmac_mii_senddata(s,MII_COMMAND_START, 2);	sbmac_mii_senddata(s,MII_COMMAND_READ, 2);	sbmac_mii_senddata(s,phyaddr, 5);	sbmac_mii_senddata(s,regidx, 5);		mac_mdio_genc = SBMAC_READCSR(s->sbm_mdio) & M_MAC_GENC;		/* 	 * Switch the port around without a clock transition.	 */	SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc);		/*	 * Send out a clock pulse to signal we want the status	 */		SBMAC_WRITECSR(s->sbm_mdio,		       M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc);	SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc);		/* 	 * If an error occurred, the PHY will signal '1' back	 */	error = SBMAC_READCSR(s->sbm_mdio) & M_MAC_MDIO_IN;		/* 	 * Issue an 'idle' clock pulse, but keep the direction	 * the same.	 */	SBMAC_WRITECSR(s->sbm_mdio,		       M_MAC_MDIO_DIR_INPUT | M_MAC_MDC | mac_mdio_genc);	SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_INPUT | mac_mdio_genc);		regval = 0;		for (idx = 0; idx < 16; idx++) {		regval <<= 1;				if (error == 0) {			if (SBMAC_READCSR(s->sbm_mdio) & M_MAC_MDIO_IN)				regval |= 1;		}				SBMAC_WRITECSR(s->sbm_mdio,			       M_MAC_MDIO_DIR_INPUT|M_MAC_MDC | mac_mdio_genc);		SBMAC_WRITECSR(s->sbm_mdio,			       M_MAC_MDIO_DIR_INPUT | mac_mdio_genc);	}		/* Switch back to output */	SBMAC_WRITECSR(s->sbm_mdio,M_MAC_MDIO_DIR_OUTPUT | mac_mdio_genc);		if (error == 0)		return regval;	return 0;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/2039973af59889fea0d14362eae56792cfe8d25a/sb1250-mac.c/buggy/drivers/net/sb1250-mac.c