"%s: if not, use the firmware= module parameter.\n", 
"%s: if not, use the firmware= module parameter.\n", 
static int reset_atmel_card(struct net_device *dev) {	/* do everything necessary to wake up the hardware, including	   waiting for the lightning strike and throwing the knife switch....	   set all the Mib values which matter in the card to match 	   their settings in the atmel_private structure. Some of these	   can be altered on the fly, but many (WEP, infrastucture or ad-hoc)	   can only be changed by tearing down the world and coming back through	   here.	   This routine is also responsible for initialising some 	   hardware-specific fields in the atmel_private structure, 	   including a copy of the firmware's hostinfo stucture	   which is the route into the rest of the firmare datastructures. */	struct atmel_private *priv = netdev_priv(dev);	u8 configuration;		/* data to add to the firmware names, in priority order	   this implemenents firmware versioning */		static char *firmware_modifier[] = {		"-wpa",		"",		NULL	};			/* reset pccard */	if (priv->bus_type == BUS_TYPE_PCCARD) 		atmel_write16(priv->dev, GCR, 0x0060);			/* stop card , disable interrupts */	atmel_write16(priv->dev, GCR, 0x0040);			if (priv->card_type == CARD_TYPE_EEPROM) {		/* copy in firmware if needed */		const struct firmware *fw_entry = NULL;		unsigned char *fw;		int len = priv->firmware_length;		if (!(fw = priv->firmware)) {			if (priv->firmware_type == ATMEL_FW_TYPE_NONE) {				if (strlen(priv->firmware_id) == 0) {					printk(KERN_INFO					       "%s: card type is unknown: assuming at76c502 firmware is OK.\n",					       dev->name);					printk(KERN_INFO					       "%s: if not, use the firmware= module parameter.\n", 					       dev->name);					strcpy(priv->firmware_id, "atmel_at76c502.bin");				}				if (request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev) != 0) {					printk(KERN_ALERT 					       "%s: firmware %s is missing, cannot continue.\n", 					       dev->name, priv->firmware_id);					return 0;				}			} else {				int fw_index = 0;				int success = 0;				/* get firmware filename entry based on firmware type ID */				while (fw_table[fw_index].fw_type != priv->firmware_type						&& fw_table[fw_index].fw_type != ATMEL_FW_TYPE_NONE)					fw_index++;								/* construct the actual firmware file name */				if (fw_table[fw_index].fw_type != ATMEL_FW_TYPE_NONE) {					int i;					for (i = 0; firmware_modifier[i]; i++) {						snprintf(priv->firmware_id, 32, "%s%s.%s", fw_table[fw_index].fw_file,							firmware_modifier[i], fw_table[fw_index].fw_file_ext);						priv->firmware_id[31] = '\0';						if (request_firmware(&fw_entry, priv->firmware_id, priv->sys_dev) == 0) {							success = 1;							break;						}					}				}				if (!success) {					printk(KERN_ALERT 					       "%s: firmware %s is missing, cannot start.\n", 					       dev->name, priv->firmware_id);					priv->firmware_id[0] = '\0';					return 0;					}			}						fw = fw_entry->data;			len = fw_entry->size;		}			        if (len <= 0x6000) {			atmel_write16(priv->dev, BSR, BSS_IRAM);			atmel_copy_to_card(priv->dev, 0, fw, len);			atmel_set_gcr(priv->dev, GCR_REMAP);		} else {			/* Remap */ 			atmel_set_gcr(priv->dev, GCR_REMAP);			atmel_write16(priv->dev, BSR, BSS_IRAM);			atmel_copy_to_card(priv->dev, 0, fw, 0x6000);			atmel_write16(priv->dev, BSR, 0x2ff);			atmel_copy_to_card(priv->dev, 0x8000, &fw[0x6000], len - 0x6000);		}		if (fw_entry)			release_firmware(fw_entry);	}	if (!atmel_wakeup_firmware(priv))		return 0;	/* Check the version and set the correct flag for wpa stuff,	   old and new firmware is incompatible.	   The pre-wpa 3com firmware reports major version 5,	   the wpa 3com firmware is major version 4 and doesn't need	   the 3com broken-ness filter. */	priv->use_wpa = (priv->host_info.major_version == 4);	priv->radio_on_broken = (priv->host_info.major_version == 5);	        /* unmask all irq sources */	atmel_wmem8(priv, atmel_hi(priv, IFACE_INT_MASK_OFFSET), 0xff);		/* int Tx system and enable Tx */	atmel_wmem8(priv, atmel_tx(priv, TX_DESC_FLAGS_OFFSET, 0), 0);	atmel_wmem32(priv, atmel_tx(priv, TX_DESC_NEXT_OFFSET, 0), 0x80000000L);	atmel_wmem16(priv, atmel_tx(priv, TX_DESC_POS_OFFSET, 0), 0);	atmel_wmem16(priv, atmel_tx(priv, TX_DESC_SIZE_OFFSET, 0), 0);	priv->tx_desc_free = priv->host_info.tx_desc_count;			priv->tx_desc_head = 0;										priv->tx_desc_tail = 0;										priv->tx_desc_previous = 0;	priv->tx_free_mem = priv->host_info.tx_buff_size;	priv->tx_buff_head = 0;		priv->tx_buff_tail = 0;				configuration = atmel_rmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET)); 	atmel_wmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET), 				   configuration | FUNC_CTRL_TxENABLE);	/* init Rx system and enable */	priv->rx_desc_head = 0;		configuration = atmel_rmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET)); 	atmel_wmem8(priv, atmel_hi(priv, IFACE_FUNC_CTRL_OFFSET), 				   configuration | FUNC_CTRL_RxENABLE);				if (!priv->radio_on_broken) {		if (atmel_send_command_wait(priv, CMD_EnableRadio, NULL, 0) == 		    CMD_STATUS_REJECTED_RADIO_OFF) {			printk(KERN_INFO 			       "%s: cannot turn the radio on. (Hey radio, you're beautiful!)\n",			       dev->name);                        return 0;		}	}		/* set up enough MIB values to run. */	atmel_set_mib8(priv, Local_Mib_Type, LOCAL_MIB_AUTO_TX_RATE_POS, priv->auto_tx_rate);	atmel_set_mib8(priv, Local_Mib_Type,  LOCAL_MIB_TX_PROMISCUOUS_POS,  PROM_MODE_OFF);	atmel_set_mib16(priv, Mac_Mib_Type, MAC_MIB_RTS_THRESHOLD_POS, priv->rts_threshold);	atmel_set_mib16(priv, Mac_Mib_Type, MAC_MIB_FRAG_THRESHOLD_POS, priv->frag_threshold);	atmel_set_mib8(priv, Mac_Mib_Type, MAC_MIB_SHORT_RETRY_POS, priv->short_retry);	atmel_set_mib8(priv, Mac_Mib_Type, MAC_MIB_LONG_RETRY_POS, priv->long_retry);	atmel_set_mib8(priv, Local_Mib_Type, LOCAL_MIB_PREAMBLE_TYPE, priv->preamble);	atmel_set_mib(priv, Mac_Address_Mib_Type, MAC_ADDR_MIB_MAC_ADDR_POS, 		      priv->dev->dev_addr, 6);	atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_PS_MODE_POS, ACTIVE_MODE);	atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_LISTEN_INTERVAL_POS, 1);	atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_BEACON_PER_POS, priv->default_beacon_period);	atmel_set_mib(priv, Phy_Mib_Type, PHY_MIB_RATE_SET_POS, atmel_basic_rates, 4);	atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_CUR_PRIVACY_POS, priv->wep_is_on);	if (priv->use_wpa)		build_wpa_mib(priv);	else		build_wep_mib(priv);		return 1;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4d791aadf63c9d605bc9a4144e79d5756fc29fb3/atmel.c/clean/drivers/net/wireless/atmel.c