 if (mr3 & MAC_BOOT_COMPLETE) 
 if (mr3 & MAC_BOOT_COMPLETE) 
static int atmel_wakeup_firmware(struct atmel_private *priv){	struct host_info_struct *iface = &priv->host_info;	u16 mr1, mr3;	int i;	if (priv->card_type == CARD_TYPE_SPI_FLASH)		atmel_set_gcr(priv->dev, GCR_REMAP);		/* wake up on-board processor */	atmel_clear_gcr(priv->dev, 0x0040);	atmel_write16(priv->dev, BSR, BSS_SRAM);		if (priv->card_type == CARD_TYPE_SPI_FLASH)		mdelay(100);	/* and wait for it */	for (i =  LOOP_RETRY_LIMIT; i; i--) {		mr1 = atmel_read16(priv->dev, MR1);		mr3 = atmel_read16(priv->dev, MR3);				if (mr3 & MAC_BOOT_COMPLETE) 			break;		if (mr1 & MAC_BOOT_COMPLETE &&		    priv->bus_type == BUS_TYPE_PCCARD)			break;	}	if (i == 0) {		printk(KERN_ALERT "%s: MAC failed to boot.\n", priv->dev->name);		return 0;	}			if ((priv->host_info_base = atmel_read16(priv->dev, MR2)) == 0xffff) {		printk(KERN_ALERT "%s: card missing.\n", priv->dev->name);		return 0;	}		/* now check for completion of MAC initialization through  	   the FunCtrl field of the IFACE, poll MR1 to detect completion of	  	   MAC initialization, check completion status, set interrupt mask,  	   enables interrupts and calls Tx and Rx initialization functions */  		atmel_wmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET), FUNC_CTRL_INIT_COMPLETE);		for (i =  LOOP_RETRY_LIMIT; i; i--) {		mr1 = atmel_read16(priv->dev, MR1);		mr3 = atmel_read16(priv->dev, MR3);				if (mr3 & MAC_INIT_COMPLETE) 			break;		if (mr1 & MAC_INIT_COMPLETE &&		    priv->bus_type == BUS_TYPE_PCCARD)			break;	}		if (i == 0) {		printk(KERN_ALERT "%s: MAC failed to initialise.\n", priv->dev->name);		return 0;	}		/* Check for MAC_INIT_OK only on the register that the MAC_INIT_OK was set */	if ((mr3 & MAC_INIT_COMPLETE) &&	    !(atmel_read16(priv->dev, MR3) & MAC_INIT_OK)) {		printk(KERN_ALERT "%s: MAC failed MR3 self-test.\n", priv->dev->name);		return 0;	}	if ((mr1 & MAC_INIT_COMPLETE) &&	    !(atmel_read16(priv->dev, MR1) & MAC_INIT_OK)) {		printk(KERN_ALERT "%s: MAC failed MR1 self-test.\n", priv->dev->name);		return 0;	}	atmel_copy_to_host(priv->dev, (unsigned char *)iface, 			   priv->host_info_base, sizeof(*iface));        	iface->tx_buff_pos = le16_to_cpu(iface->tx_buff_pos);	iface->tx_buff_size = le16_to_cpu(iface->tx_buff_size);	iface->tx_desc_pos = le16_to_cpu(iface->tx_desc_pos);	iface->tx_desc_count = le16_to_cpu(iface->tx_desc_count);	iface->rx_buff_pos = le16_to_cpu(iface->rx_buff_pos);	iface->rx_buff_size = le16_to_cpu(iface->rx_buff_size);	iface->rx_desc_pos = le16_to_cpu(iface->rx_desc_pos);	iface->rx_desc_count = le16_to_cpu(iface->rx_desc_count);	iface->build_version = le16_to_cpu(iface->build_version);	iface->command_pos = le16_to_cpu(iface->command_pos);	iface->major_version = le16_to_cpu(iface->major_version);	iface->minor_version = le16_to_cpu(iface->minor_version);	iface->func_ctrl = le16_to_cpu(iface->func_ctrl);	iface->mac_status = le16_to_cpu(iface->mac_status);	return 1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4d791aadf63c9d605bc9a4144e79d5756fc29fb3/atmel.c/clean/drivers/net/wireless/atmel.c