libertas: remove boot2 update code, now performed by Dan's python tool

Marcelo Tosatti mtosatti at redhat.unroutablecom
Fri Nov 10 21:24:36 EST 2006


Commit:     88ffd1af6ceedb45731a94769b588b4b501d2d31
Parent:     d4803922e74d6594d917d348bac250e8e1c1d36b
commit 88ffd1af6ceedb45731a94769b588b4b501d2d31
Author:     Marcelo Tosatti <mtosatti at redhat.com>
AuthorDate: Fri Nov 10 08:22:17 2006 +0000
Commit:     Marcelo Tosatti <marcelo at pentafluge.infradead.org>
CommitDate: Fri Nov 10 08:22:17 2006 +0000

    libertas: remove boot2 update code, now performed by Dan's python tool
    
    Subject says it all.
    
    Signed-off-by: Marcelo Tosatti <mtosatti at redhat.com>
---
 drivers/net/wireless/libertas/if_bootcmd.c |  792 ----------------------------
 drivers/net/wireless/libertas/if_usb.c     |   58 --
 drivers/net/wireless/libertas/if_usb.h     |  140 -----
 3 files changed, 3 insertions(+), 987 deletions(-)

diff --git a/drivers/net/wireless/libertas/if_bootcmd.c b/drivers/net/wireless/libertas/if_bootcmd.c
index 81fbfbe..435d30d 100644
--- a/drivers/net/wireless/libertas/if_bootcmd.c
+++ b/drivers/net/wireless/libertas/if_bootcmd.c
@@ -47,21 +47,6 @@ #include "if_usb.h"
 
 extern struct BootCMDStr	sBootCMD;
 
-struct StUpdateStorage UpdateStorage;
-char *UpdateBoot2=NULL;
-char *UpdateFW=NULL;
-module_param(UpdateBoot2, charp, 0644);
-module_param(UpdateFW, charp, 0644);
-
-
-#ifdef UPDATE_BOOT2_BY_MFG
-char *MfgFW=NULL;
-char *MfgUpdateBoot2=NULL;
-module_param(MfgFW, charp, 0644);
-module_param(MfgUpdateBoot2, charp, 0644);
-struct stMfgUpdateBoot2	MfgStatus;
-#endif /* UPDATE_BOOT2_BY_MFG */
-
 /** 
  *  @brief This function issues Boot Command to the Boot2 code
  *  @param iValue   1:Boot from FW by USB-Download
@@ -95,780 +80,3 @@ int if_usb_issue_boot_command(wlan_priva
 
 	return WLAN_STATUS_SUCCESS;
 }
-
-/** 
- *  @brief This function checks the validity of Boot2/FW image.
- *  
- *  @param pu8Data		pointer to image
- *         u32Len	 	image length
- *  @return	WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int us_file_format_easy_check(u8 *pu8Data, u32 u32Len)
-{
-	u8	u8BinCmd, bExit;
-	int	iResult;
-	u32	blksize, offset, len;
-
-	iResult = WLAN_STATUS_FAILURE;
-	bExit = 0;
-	len = 0;
-
-	do {
-		u8BinCmd = *pu8Data;
-		blksize = *(u32*)(pu8Data + offsetof(struct _FileHeader, DataLength));
-		switch (u8BinCmd)
-		{
-			case FILE_HAS_DATA_TO_RECV:
-				offset = sizeof(FileHeader) + blksize;
-				pu8Data += offset;
-				len += offset;
-				if (len >= u32Len)
-					bExit = 1;
-				break;
-			case FILE_HAS_LAST_BLOCK:
-				bExit = 1;
-				iResult = WLAN_STATUS_SUCCESS;
-				break;
-			default:	
-				bExit = 1;
-				break;	
-		}
-	} while (bExit==0);
-
-	if (iResult==WLAN_STATUS_SUCCESS) {
-		PRINTM(INFO, "Bin File Format check PASS...\n");
-	}
-	else {
-		PRINTM(FATAL, "Bin File Format check FAIL...\n");
-	}
-
-	return(iResult);
-}
-
-/** 
- *  @brief This function checks the parameter input from user
- *  
- *  @param	n/a
- *  @return	WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int us_prob(void)
-{
-	ENTER();
-
-	UpdateStorage.u8DriverFunctionActive=DRIVER_NORMAL;
-	UpdateStorage.u8FileFormat=UPDATE_STORAGE_NULL;
-	UpdateStorage.pu8Image=NULL;
-	UpdateStorage.u32Image_len=0;
-
-	if (UpdateBoot2!=NULL) {
-		UpdateStorage.u8DriverFunctionActive=DRIVER_ONLY_UPDATE_STORAGE;
-		UpdateStorage.u8FileFormat=UPDATE_STORAGE_BOOT2;
-		PRINTM(MSG, "usb8xxx: Driver mode = update Boot2 Code\n");
-	}  
-	else if (UpdateFW!=NULL) {
-		UpdateStorage.u8DriverFunctionActive=DRIVER_ONLY_UPDATE_STORAGE;
-		UpdateStorage.u8FileFormat=UPDATE_STORAGE_FW;
-		PRINTM(MSG, "usb8xxx: Driver mode = update Firmware Code\n");
-	}
-#ifdef UPDATE_BOOT2_BY_MFG
-	else if ((MfgUpdateBoot2!=NULL)&&(MfgFW!=NULL)) {
-		UpdateStorage.u8DriverFunctionActive=DRIVER_ONLY_UPDATE_STORAGE;
-		UpdateStorage.u8FileFormat=UPDATE_STORAGE_BY_MFG;
-		PRINTM(MSG, "usb8xxx: Driver mode = update Boot2 Code by MFG FW\n");
-	}
-#endif /* UPDATE_BOOT2_BY_MFG */
-
-	if (UpdateStorage.u8DriverFunctionActive==DRIVER_NORMAL)
-		PRINTM(MSG, "usb8xxx: Driver mode = Normal Driver\n");
-
-	LEAVE();
-
-	return WLAN_STATUS_SUCCESS;
-}
-
-/** 
- *  @brief This function de-registers update-storage.
- *  
- *  @param	n/a
- *  @return	WLAN_STATUS_SUCCESS
- */
-int us_close(void)
-{
-	return WLAN_STATUS_SUCCESS;
-}
-
-/** 
- *  @brief us:Update Storage
- *         It's only for the Storage Update.
- *         This function transfers the data to the device.
- *  @param payload	pointer to payload data
- *  @param nb		data length
- *  @return 	   	WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int us_usb_tx_block(struct usb_card_rec *cardp, u16 nb) 
-{
-	u8 	*payload = cardp->bulk_out_buffer;
-	int	ret = WLAN_STATUS_FAILURE;
-
-	ENTER();
-
-	/* use USB API macro FILL_BULK_URB or API function 
-	 * usb_fill_bulk_urb() used to set the 
-	 * configuration information to send the bulk URB
-	 */
-	usb_fill_bulk_urb(cardp->tx_urb, cardp->udev, 
-			usb_sndbulkpipe(cardp->udev, cardp->bulk_out_endpointAddr), 
-			payload, nb, us_usb_write_bulk_callback, cardp); 
-
-	cardp->tx_urb->transfer_flags |= URB_ZERO_PACKET;
-        
-	if ((ret=usb_submit_urb(cardp->tx_urb, GFP_ATOMIC))) {
-		/* transfer failed */
-		PRINTM(INFO, "usb_submit_urb Failed\n");
-		ret = WLAN_STATUS_FAILURE;
-	} 
-	else {
-		cardp->tx_urb_pending = 1;
-		PRINTM(INFO, "usb_submit_urb Success\n");
-		ret = WLAN_STATUS_SUCCESS;
-	}
-
-	LEAVE();
-	return ret;
-}
-
-/** 
- *  @brief  us:Update Storage
- *          Callback function to handle the status of the URB  
- *          It's only for the Storage update.
- *  @param urb 		pointer to urb structure
- *  @return 	   	N/A
- */
-void us_usb_write_bulk_callback(struct urb *urb, struct pt_regs *regs)
-{
-	struct	usb_card_rec *cardp = (struct usb_card_rec *) urb->context;
-
-	ENTER();
-	cardp->tx_urb_pending = 0;
-
-	/* handle the transmission complete validations */
-	if (urb->status != 0) {
-		/* print the failure status number for debug */
-		PRINTM(FATAL, "URB in failure status\n");
-	}
-	else {
-		PRINTM(INFO, "URB status is successfull\n");
-		if (cardp->BootCMDACK == 0) {
-			cardp->BootCMDACK=1;
-			PRINTM(INFO, "cardp->BootCMDACK=1\n");
-		}
-#ifdef UPDATE_BOOT2_BY_MFG
-		if (MfgStatus.u8TX_Call_Back == 0) {
-			MfgStatus.u8TX_Call_Back=1;
-			PRINTM(INFO, "MfgStatus.u8TX_Call_Back=1\n");
-		}
-#endif /* UPDATE_BOOT2_BY_MFG */
-	}
-
-	LEAVE();
-
-	return;
-}
-
-/** 
- *  @brief us:Update Storage
- *         This function submits the rx data to OS
- *         It's only for the Storage update.
- *  @param priv		pointer to wlan_private structure
- *  @return 	   	WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int us_usb_submit_rx_urb(struct usb_card_rec *cardp)
-{
-	int	ret = WLAN_STATUS_FAILURE;
-
-	ENTER();
-        
-	if(!(cardp->skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE))) {
-		PRINTM(FATAL, "No free skb\n");
-		goto rx_ret;
-	}
-
-	/* Fill the receive configuration URB and initialise the Rx call back */
-	usb_fill_bulk_urb(cardp->rx_urb, cardp->udev,
-			usb_rcvbulkpipe(cardp->udev, cardp->bulk_in_endpointAddr),
-			cardp->skb->tail + IPFIELD_ALIGN_OFFSET,
-			MRVDRV_ETH_RX_PACKET_BUFFER_SIZE,
-			us_usb_receive, cardp);
-
-	cardp->rx_urb->transfer_flags |= URB_ZERO_PACKET;
-
-	PRINTM(INFO, "Pointer for rx_urb %p\n", cardp->rx_urb); 
-
-	if ((ret = usb_submit_urb(cardp->rx_urb, GFP_ATOMIC))) {
-		/* handle failure conditions */
-		PRINTM(INFO, "Submit Rx URB failed\n");
-		ret = WLAN_STATUS_FAILURE;
-	} 
-	else {
-		cardp->rx_urb_pending = 1;
-		PRINTM(INFO, "Submit Rx URB Success\n");
-		ret = WLAN_STATUS_SUCCESS;
-	}
-
-rx_ret:
-	LEAVE();
-	return ret;
-}
-
-/**      
- *  @brief us:Update Storage
- *         It's only for the function Update-Storage.
- *         This function reads of the packet into the upload buff, 
- *         wake up the main thread and initialise the Rx callack.
- *  @param urb		pointer to struct urb
- *  @return 	   	N/A
- */
-void us_usb_receive(struct urb *urb, struct pt_regs *regs)
-{
-	struct usb_card_rec *cardp= (struct usb_card_rec *)urb->context;
-	int	RecvLength = urb->actual_length;
-	u8	*RecvBuff = NULL;
-	FileSyncHeader SyncFileHeader;
-
-	ENTER();
-        
-	cardp->rx_urb_pending = 0;
-
-	if (RecvLength) {
-		if (urb->status) {
-			PRINTM(INFO, "URB Status is failed\n");
-			if (cardp->skb) {
-				kfree_skb(cardp->skb);
-				cardp->skb = NULL;
-			}
-			goto setup_for_next;
-		}
-
-		RecvBuff = cardp->skb->data + IPFIELD_ALIGN_OFFSET;
-	} 
-	else if (urb->status) {
-		PRINTM(INFO, "URB Status (urb->status) is failed\n");
-		goto rx_exit;
-	}
-
-#ifdef UPDATE_BOOT2_BY_MFG
-	if (MfgStatus.u8Mfg_Boot2_Update==1) {
-		us_mfg_Receive_check(RecvBuff);	
-		MfgStatus.u8RX_Received=1;
-		goto setup_for_next;
-	}
-#endif /* UPDATE_BOOT2_BY_MFG */
-
-	memcpy(&SyncFileHeader, RecvBuff, sizeof(FileSyncHeader));
-
-
-	if (!SyncFileHeader.Cmd) {
-		PRINTM(INFO, "FW received Blk with correct CRC\n");
-		PRINTM(INFO, "FW received Blk SeqNum = %d\n",SyncFileHeader.SeqNum);
-		cardp->CRC_OK = 1;
-	} 
-	else {
-		PRINTM(INFO, "FW received Blk with CRC error\n");
-		cardp->CRC_OK = 0;
-	}
-		
-	if (cardp->skb) {
-		kfree_skb(cardp->skb);
-		cardp->skb = NULL;
-	}
-	if (cardp->FwDnldOver == 0) {
-		if (cardp->FWFinalBlk) {
-			cardp->FwDnldOver = 1;
-			cardp->IsFWDnld = 0;
-			PRINTM(MSG, "usb8xxx: Download data to STA Finish...\n");
-			goto rx_exit;
-		}	
-	}
-
-	us_prog_storage(cardp);
-
-	us_usb_submit_rx_urb(cardp);
-
-	goto rx_exit;
-	
-setup_for_next:
-	us_usb_submit_rx_urb(cardp);
-rx_exit:
-	LEAVE();
-	return;
-}
-
-/** 
- *  @brief us: use kernel function to request firmware/Boot2
- *  @param	n/a
- *  @return	WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int us_kernel_request_firmware(struct usb_card_rec *cardp)
-{
-	int	ret=0;   
-	u8	*ptr = NULL;
-	u32	len = 0;      
-
-	switch (UpdateStorage.u8FileFormat)
-	{
-	case UPDATE_STORAGE_BOOT2: 
-		if ((ret=request_firmware(&cardp->usKernelFile, UpdateBoot2, 
-					&(cardp->udev->dev))) < 0) {
-			PRINTM(FATAL, "usb8xxx: Request Boot2 file failed, error code = %#x\n", ret);
-			return WLAN_STATUS_FAILURE;
-		}
-		break;
-
-	case UPDATE_STORAGE_FW:
-		if ((ret=request_firmware(&cardp->usKernelFile, UpdateFW, 
-					&(cardp->udev->dev))) < 0) {
-			PRINTM(FATAL, "usb8xxx: Request FW file failed, error code = %#x\n", ret);
-			return WLAN_STATUS_FAILURE;
-		}
-		break;
-
-#ifdef UPDATE_BOOT2_BY_MFG
-	case UPDATE_STORAGE_BY_MFG:
-		if ((ret=request_firmware(&cardp->usKernelFile, MfgFW, 
-					&(cardp->udev->dev))) < 0) {
-			PRINTM(FATAL, "usb8xxx: Request MFG FW file failed, error code = %#x\n", ret);
-			return WLAN_STATUS_FAILURE;
-		}
-		break;
-#endif
-
-	default:
-		PRINTM(FATAL, "usb8xxx: Request file failed, error code = %#x\n", ret);
-		return WLAN_STATUS_FAILURE;
-		break;	   
-	}          	
-
-	ptr=cardp->usKernelFile->data;
-	len=cardp->usKernelFile->size;
-
-	if (us_file_format_easy_check(ptr,len)!=WLAN_STATUS_SUCCESS) {
-		PRINTM(FATAL, "usb8xxx: File format error\n");
-		return WLAN_STATUS_FAILURE;
-	}
-     
-	UpdateStorage.pu8Image=cardp->usKernelFile->data;
-	UpdateStorage.u32Image_len=cardp->usKernelFile->size;   
-
-	return WLAN_STATUS_SUCCESS;    
-}
-
-/** 
- *  @brief us:Update Storage
- *         It's only for the function Update-Storage.
- *         This function starts to update the stoage from file: 
- *         1. Update Boot2 Code to the Flash/EEPROM
- *         2. Update FW Code to the Flash/EEPROM
- *  @param  n/a
- *  @return WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int us_start(struct usb_card_rec *cardp)
-{
-	int	i = 0;
-
-	ENTER();
-
-#ifdef UPDATE_BOOT2_BY_MFG
-	/* To check the Boot2 version */
-	if (UpdateStorage.u8FileFormat==UPDATE_STORAGE_BY_MFG) {
-		if (cardp->udev->descriptor.bcdDevice > BOOT2_VERSION_OLD) {
-			PRINTM(MSG, "usb8xxx: Boot2 version = %x, "
-					"use UpdateBoot2 parameter to update Boot2\n",
-					cardp->udev->descriptor.bcdDevice);
-			return WLAN_STATUS_FAILURE;
-		}
-	}
-#endif
-
-	/* Issue BootCommand */
-#ifdef UPDATE_BOOT2_BY_MFG
-	if (UpdateStorage.u8FileFormat!=UPDATE_STORAGE_BY_MFG)
-	    us_usb_issue_boot_command(cardp, UpdateStorage.u8FileFormat);
-#else
-	us_usb_issue_boot_command(cardp, UpdateStorage.u8FileFormat);
-#endif
-
-	/* Request firmware/Boot2 here */
-	if (us_kernel_request_firmware(cardp)<0)
-		return WLAN_STATUS_FAILURE;
-     
-	/* Init the Parameters of the Update Storage */
-	cardp->TotalBytes = 0;
-	cardp->FwLastBlkSent = 0;
-	cardp->CRC_OK = 1;
-	cardp->FwDnldOver = 0; 
-	cardp->FWSeqNum = -1;
-	cardp->TotalBytes = 0;
-	cardp->FWFinalBlk = 0;
-
-	/* Start to download the firmware/Boot2 to device */
-	us_prog_storage(cardp);
-
-	/* Submit the receive urb */
-	us_usb_submit_rx_urb(cardp);
-
-	do {
-		PRINTM(INFO, "Wlan sched timeout\n");
-		i ++;
-		msleep_interruptible(100);
-	} while (!cardp->FwDnldOver);
-
-	if (!cardp->FwDnldOver) {
-		PRINTM(FATAL, "FW download failure, time = %d ms\n", i*100);
-		release_firmware(cardp->usKernelFile);
-		LEAVE();
-		return WLAN_STATUS_FAILURE;
-	}
-
-	release_firmware(cardp->usKernelFile);
-
-#ifdef UPDATE_BOOT2_BY_MFG
-	msleep_interruptible(500);
-	if (UpdateStorage.u8FileFormat==UPDATE_STORAGE_BY_MFG) {
-		us_mfg_Update_Boot2(cardp);
-		release_firmware(cardp->usKernelFile);
-	}
-#endif
-
-	LEAVE();
-
-	return WLAN_STATUS_SUCCESS;
-}
-
-/** 
- *  @brief us:Update Storage
- *         It's only for the function Update-Storage.
- *         This function updates the stoage from file: 
- *         1. Update Boot2 Code to the Flash/EEPROM
- *         2. Update FW Code to the Flash/EEPROM
- *  @param 	void		
- *  @return UPDATE_STATUS_SUCCESS
- */
-int us_prog_storage(struct usb_card_rec *cardp)
-{
-	FileData	sFileData;
-	u8	*fileimage;
-
-	ENTER();
-
-	if (!cardp->CRC_OK) {
-		cardp->TotalBytes = cardp->FwLastBlkSent;
-		cardp->FWSeqNum = cardp->LastSeqNum - 1;
-	}
-
-	PRINTM(INFO, "TotalBytes = %d\n", cardp->TotalBytes);
-
-	fileimage = UpdateStorage.pu8Image;
-
-	memcpy(&sFileData.fileheader, &fileimage[cardp->TotalBytes], sizeof(FileHeader));
-	
-
-	cardp->FwLastBlkSent = cardp->TotalBytes;
-	cardp->TotalBytes += sizeof(FileHeader);
-
-	PRINTM(INFO, "Copy Data\n");	
-	memcpy(sFileData.data, &fileimage[cardp->TotalBytes], sFileData.fileheader.DataLength);
-	
-	PRINTM(INFO, "Data Length = %d\n", sFileData.fileheader.DataLength);
-
-	cardp->FWSeqNum = cardp->FWSeqNum + 1;
-	sFileData.SeqNum = cardp->FWSeqNum;
-	cardp->LastSeqNum = sFileData.SeqNum;
-	cardp->TotalBytes += sFileData.fileheader.DataLength;
-
-	if (sFileData.fileheader.DnldCmd == FILE_HAS_DATA_TO_RECV) {
-		PRINTM(INFO, "There is data to follow\n");
-		PRINTM(INFO, "SeqNum = %d TotalBytes = %d\n", cardp->FWSeqNum, cardp->TotalBytes);
-
-		memcpy(cardp->bulk_out_buffer, &sFileData.fileheader, FILE_DATA_XMIT_SIZE);
-		us_usb_tx_block(cardp, FILE_DATA_XMIT_SIZE);
-		
-	} else if (sFileData.fileheader.DnldCmd == FILE_HAS_LAST_BLOCK) {
-		PRINTM(INFO, "Host has finished File downloading\n");
-
-		memcpy(cardp->bulk_out_buffer, &sFileData.fileheader, FILE_DATA_XMIT_SIZE);
-		us_usb_tx_block(cardp, FILE_DATA_XMIT_SIZE);
-		
-		cardp->FWFinalBlk = 1;
-	}
-
-	PRINTM(INFO, "The fileimage download is done size is %d\n", cardp->TotalBytes); 
-	
-	LEAVE();
-
-	return WLAN_STATUS_SUCCESS;
-}
-
-/** 
- *  @brief us:Update Storage
- *         This function issues Boot Command to the Boot2 code
- *         It's only for the function Update-Storage.
- *  @param iValue	3: Update Storage Boot2
- *                  4: Update Storage FW
- *  @return 	   	WLAN_STATUS_SUCCESS
- */
-int us_usb_issue_boot_command(struct usb_card_rec *cardp, int iValue)
-{
-	int	i = 0;
-  
-	/* Prepare Command */
-	sBootCMD.u32MagicNumber = BOOT_CMD_MAGIC_NUMBER;
-	sBootCMD.u8CMD_Tag=iValue;
-	for (i=0; i<11; i++)
-		sBootCMD.au8Dumy[i]=0x00;
-
-	memcpy(cardp->bulk_out_buffer, &sBootCMD, sizeof(struct BootCMDStr));
-
-	/* Issue Command */
-	cardp->BootCMDACK = 0;
-	i = 0;
-	us_usb_tx_block(cardp, sizeof(struct BootCMDStr));
-
-	/* Wait for the Reault */
-	do {
-		i ++;
-		msleep_interruptible(100);
-	} while (!cardp->BootCMDACK);
-
-	return WLAN_STATUS_SUCCESS;
-}
-
-/** 
- *  @brief us:Update Storage
- *         It's only for the function Update-Storage.
- *         Free resource and cleanup
- *  @param udev		pointer to usb_device
- *  @param ptr		pointer to usb_cardp
- *  @return 	   	N/A
- */
-void us_usb_disconnect(struct usb_interface *intf)
-{
-	struct usb_card_rec	*cardp = usb_get_intfdata(intf);
-
-	ENTER();
-   
-	/* Unlink and free urb */
-	if_usb_free(cardp);
-
-	usb_set_intfdata(intf,NULL);
-	usb_put_dev(interface_to_usbdev(intf));
-        
-	LEAVE();
-	return ;
-}	
-
-#ifdef UPDATE_BOOT2_BY_MFG
-/** 
- *  @brief us: Add the mfg command and send data
- *  @param: 
- *  @return: WLAN_STATUS_SUCCESS
- */
-int us_mfg_Send_data(struct usb_card_rec *cardp, u32 address, u32 *data, u32
-		lenInByte, u16 u16EraseSector) 
-{
-	int i; 
-	Send_Mfg_Data	*pAllTxBuf=NULL;
-	spi_CmdEeprom_t	*pTxBuf=NULL;
-
-	PRINTM(INFO, ">>>us_mfg_Send_data: address =0x%x, lenInByte=%d, u16EraseSector=%d\n", 
-		address, lenInByte, u16EraseSector);
-
-	/* <1>. Allocate mem and clear mem */
-	pAllTxBuf = (Send_Mfg_Data *)cardp->bulk_out_buffer;
-	pTxBuf = (spi_CmdEeprom_t *)&(pAllTxBuf->stMfg_Cmd);
-	memset(pAllTxBuf, 0, sizeof(Send_Mfg_Data) +lenInByte);
-  
-	/* <2>. Fill the CBW Data => 12 bytes */
-	pAllTxBuf->stMCBW.Signature = MCBWSignature;
-	pAllTxBuf->stMCBW.Tag = MfgStatus.u32SeqNum;
-	pAllTxBuf->stMCBW.TotalLength = 0;
-	pAllTxBuf->stMCBW.Function_Flag = FUNCTION_FLAG;
-	pAllTxBuf->stMCBW.CommandLength = sizeof(spi_CmdEeprom_t) + lenInByte;
-
-	/* <3>. Fill the data to the packet header => 12 bytes */
-	pTxBuf->header.cmd = Host_CMD_MFG_COMMAND;
-	pTxBuf->header.len = sizeof(spi_CmdEeprom_t) + lenInByte;
-	pTxBuf->header.seq = MfgStatus.u32SeqNum;
-	pTxBuf->header.result = 0;
-	pTxBuf->header.MfgCmd = MFG_CMD_SPI_EEPROM;
-
-	/* <4>. Fill the data to spi command header => 24 bytes */
-	pTxBuf->action = HostCmd_ACT_GEN_SET;
-	pTxBuf->Error = 0;
-	pTxBuf->signature = SIGNATURE_SPIEEPROM;
-	pTxBuf->sector_erase = u16EraseSector;
-	pTxBuf->address = address;
-	pTxBuf->lenInByte = lenInByte;
-
-	if (lenInByte)
-		memcpy(pTxBuf->byte, data,lenInByte);
-
-	/* <5>. Send data to the USB */
-	MfgStatus.u8TX_Call_Back = 0;
-	us_usb_tx_block(cardp, (sizeof(Send_Mfg_Data)+lenInByte));
-
-	/* <6>. Waiting for the Send Ack */
-	do {
-		i ++;
-		msleep_interruptible(100);
-	} while (MfgStatus.u8TX_Call_Back==0);
-
-	MfgStatus.u32SeqNum++;
-	return WLAN_STATUS_SUCCESS;
-}
-
-/** 
- *  @brief us: Check the received data from MFG FW
- *  @param:  u8Buffer	buffer pointer
- *  @return: WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int us_mfg_Receive_check(u8 * u8Buffer)
-{
-	Receive_Mfg_Data	stAllRxBuf;
-	Send_Mfg_Data   	*pstSendBuff;
-
-	pstSendBuff = MfgStatus.pstSendData;
-  
-	/* Copy the received data */
-	memcpy(&stAllRxBuf, u8Buffer, sizeof(Receive_Mfg_Data));
-   
-	/* Check the data */
-	if (stAllRxBuf.stMCSW.Signature!=MCSWSignature) {
-		PRINTM(FATAL, "us_mfg_Receive_check: Signature Fail...\n");
-		goto Error_Exit;
-	}
-	if (stAllRxBuf.stMCSW.Tag!=pstSendBuff->stMCBW.Tag) {
-		PRINTM(FATAL, "us_mfg_Receive_check: Tag Fail...\n");
-		goto Error_Exit;
-	}
-	if (stAllRxBuf.stMCSW.Status!=0) {
-		PRINTM(FATAL, "us_mfg_Receive_check: Status Fail...\n");
-		goto Error_Exit;
-	}
-	if (stAllRxBuf.stMfg_Cmd.header.result!=0) {
-		PRINTM(FATAL, "us_mfg_Receive_check: stMfg_Cmd.header.result Fail...\n");
-		goto Error_Exit;
-	}
-	if (stAllRxBuf.stMfg_Cmd.Error!=0) {
-		PRINTM(FATAL, "us_mfg_Receive_check: stMfg_Cmd.Error Fail...\n");
-		goto Error_Exit;
-	}
-
-	MfgStatus.u8Mfg_Error_Received = 0;
-	return WLAN_STATUS_SUCCESS;
-
-Error_Exit:
-	MfgStatus.u8Mfg_Error_Received = 1;
-	return WLAN_STATUS_FAILURE;
-}
-
-/** 
- *  @brief us: Wait for Rx complete
- *  @param:  n/a
- *  @return: error code
- */
-int us_mfg_Waiting_for_RX_Complete(void)
-{
-	int i;  
-
-	do {
-		i ++;
-		msleep_interruptible(100);
-	} while (MfgStatus.u8RX_Received==0);
-
-    MfgStatus.u8RX_Received = 0;
-	PRINTM(INFO, ">>> Received data ok...\n");
-
-	return (MfgStatus.u8Mfg_Error_Received);
-}
-
-/** 
- *  @brief us: Dnld Boot2 image to the Storage using Mfg command 
- *  @param:  n/a
- *  @return: WLAN_STATUS_SUCCESS or WLAN_STATUS_FAILURE
- */
-int us_mfg_Update_Boot2(struct usb_card_rec *cardp)
-{
-	u8 	u8DnldFinish;
-	u32	u32CurrentSize;
-	u8 	*ptr = NULL;
-	u32	len = 0;  
-	int	ret=0;
-
-	PRINTM(INFO, ">>> Enter the Function us_mfg_Update_Boot2\n");
-
-	/* <1>. Request Boot2 file */
-	if ((ret=request_firmware(&cardp->usKernelFile, MfgUpdateBoot2,
-				&(cardp->udev->dev))) < 0) {
-		PRINTM(FATAL, "Request MfgUpdateBoot2 file failed, error code = %#x\n", ret);
-		return WLAN_STATUS_FAILURE;
-	}
-
-	ptr=cardp->usKernelFile->data;
-	len=cardp->usKernelFile->size;
-	UpdateStorage.pu8Image=ptr;
-	UpdateStorage.u32Image_len=len;
-
-	/* <2>. Initial the global variable */
-	MfgStatus.u8Mfg_Boot2_Update=1;
-	MfgStatus.u32SeqNum=0;
-	MfgStatus.u8TX_Call_Back=0;
-	MfgStatus.u32Address=0x1000; /* Boot2 start address */
-	MfgStatus.u8Mfg_Error_Received=0;
-	MfgStatus.u32RemainLength=len;
-	MfgStatus.pu8Image=UpdateStorage.pu8Image;
-	MfgStatus.pstSendData = (Send_Mfg_Data *)cardp->bulk_out_buffer; 
-	u8DnldFinish=0;
-  
-	/* <3>. Prepare to receive the data */
-	MfgStatus.u8RX_Received=0;
-	us_usb_submit_rx_urb(cardp);                
-
-	/* <4>. Erase the sector */
-	us_mfg_Send_data(cardp, 0, (u32 *)(MfgStatus.pu8Image), 0, 1);
-	if (us_mfg_Waiting_for_RX_Complete()!=0)
-		return WLAN_STATUS_FAILURE;
-
-	/* <5>. Start to send data */
-	PRINTM(INFO, ">>> Start to transmit the Boot2 code\n");
-	do {
-		/* <5.1>. Send data */
-		if (MfgStatus.u32RemainLength>MFG_UPDATE_BOOT2_SIZE)
-			u32CurrentSize=MFG_UPDATE_BOOT2_SIZE;
-		else
-			u32CurrentSize=MfgStatus.u32RemainLength;
-
-		us_mfg_Send_data(cardp, MfgStatus.u32Address, 
-				 (u32 *)(MfgStatus.pu8Image),
-				 u32CurrentSize, 0);
-        
-		/* <5.2>. Waiting for the received data */
-		if (us_mfg_Waiting_for_RX_Complete()!=0)
-			return WLAN_STATUS_FAILURE;
-        
-		/* <5.3>. Update the variable */
-		MfgStatus.u8RX_Received=0;
-		MfgStatus.pu8Image+=u32CurrentSize;
-		MfgStatus.u32RemainLength-=u32CurrentSize;
-		MfgStatus.u32Address+=u32CurrentSize;
-
-		/* <5.4>. Condition checking for Finish */
-		if (MfgStatus.u32RemainLength==0)
-			u8DnldFinish=1;
-
-	} while (u8DnldFinish==0);
-
-	PRINTM(MSG, "usb8xxx: Download data to MFG FW Finish...\n");
-
-	return WLAN_STATUS_SUCCESS;
-}
-#endif /* UPDATE_BOOT2_BY_MFG */
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index 7948673..f43c374 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -70,11 +70,9 @@ static struct usb_device_id if_usb_table
 	{}	/* Terminating entry */
 };
 
-#ifdef SUPPORT_BOOT_COMMAND
 struct BootCMDStr       sBootCMD;
-extern struct StUpdateStorage UpdateStorage;
 int if_usb_issue_boot_command(wlan_private *priv, int iValue);
-#endif
+
 static int if_prog_firmware(wlan_private * priv);
 static void if_usb_receive(struct urb *urb, struct pt_regs *regs);
 static void if_usb_receive_fwload(struct urb *urb, struct pt_regs *regs);
@@ -140,14 +138,7 @@ static void if_usb_write_bulk_callback(s
 	if (urb->status != 0) {
 		/* print the failure status number for debug */
 		PRINTM(FATAL, "URB in failure status\n");
-#ifdef SUPPORT_BOOT_COMMAND
-		if (cardp->BootCMDACK == 0) {
-			cardp->BootCMDACK = 1;
-			goto tx_exit;
-		}
-#endif
-
-		} else {
+	} else {
 		PRINTM(INFO, "URB status is successfull\n");
 		PRINTM(INFO, "Actual length transmitted %d\n",
 		       urb->actual_length);
@@ -156,13 +147,7 @@ #endif
 			netif_wake_queue(dev);
 	}
 
-#ifdef SUPPORT_BOOT_COMMAND
-	if (cardp->BootCMDACK == 0) {
-		cardp->BootCMDACK = 1;
-		goto tx_exit;
-	}
-tx_exit:		
-#endif
+	cardp->BootCMDACK = 1;
 
 	LEAVE();
 	return;
@@ -311,13 +296,6 @@ static int if_usb_probe(struct usb_inter
 		}
 	}
 
-#ifdef SUPPORT_BOOT_COMMAND
-	if (UpdateStorage.u8DriverFunctionActive 
-			== DRIVER_ONLY_UPDATE_STORAGE) {
-		us_start(usb_cardp);
-		goto register_usb;
-	}
-#endif 
 
 	/* At this point wlan_add_card() will be called.  Don't worry
 	 * about keeping pwlanpriv around since it will be set on our
@@ -327,9 +305,6 @@ #endif 
 		goto dealloc;
 	}
 
-#ifdef SUPPORT_BOOT_COMMAND
-register_usb:
-#endif
 	usb_get_dev(udev);
 	usb_set_intfdata(intf, usb_cardp);
 	LEAVE();
@@ -363,13 +338,6 @@ static void if_usb_disconnect(struct usb
 
 	ENTER();
 
-#ifdef SUPPORT_BOOT_COMMAND
-	if (UpdateStorage.u8DriverFunctionActive != DRIVER_NORMAL) {
-		us_usb_disconnect(intf);
-		goto out;
-	}
-#endif
-
 	/* priv will only be allocated during normal operation,
 	 * but NOT doing a Boot2 firmware update.
 	 */
@@ -845,12 +813,6 @@ int *libertas_sbi_register(wlan_notifier
 {
 	ENTER();
 
-#ifdef SUPPORT_BOOT_COMMAND
-	if (us_prob() == WLAN_STATUS_FAILURE) {
-		return NULL;
-	}
-#endif
-
 	wlan_card_add_cb = (usb_notifier_fn_add) add;
 	wlan_card_remove_cb = (usb_notifier_fn_remove) remove;
 
@@ -874,23 +836,9 @@ void libertas_sbi_unregister(void)
 {
 	ENTER();
 
-#ifdef SUPPORT_BOOT_COMMAND
-	us_close();
-
-	if (UpdateStorage.u8DriverFunctionActive == DRIVER_ONLY_UPDATE_STORAGE) {
-		/* API unregisters thedriver from USB subsystem */
-		PRINTM(INFO, ">>> sbi_unregister:Driver Function = DRIVER_ONLY_UPDATE_STORAGE\n");
-		goto usb_deregister_entry;
-	}
-#endif
-
 	wlan_card_add_cb = NULL;
 	wlan_card_remove_cb = NULL;
 
-#ifdef SUPPORT_BOOT_COMMAND
-usb_deregister_entry:
-#endif
-
 	/* API unregisters the driver from USB subsystem */
 	usb_deregister(&if_usb_driver);
 
diff --git a/drivers/net/wireless/libertas/if_usb.h b/drivers/net/wireless/libertas/if_usb.h
index 854a82b..90635d4 100644
--- a/drivers/net/wireless/libertas/if_usb.h
+++ b/drivers/net/wireless/libertas/if_usb.h
@@ -83,7 +83,6 @@ struct usb_card_rec {
 	void (*user_isr) (int, void *, struct pt_regs *);
 	void *priv;
 
-	struct sk_buff *skb;
 	int bulk_in_size;
 	u8 bulk_in_endpointAddr;
 
@@ -93,7 +92,6 @@ struct usb_card_rec {
 
 	u8 CRC_OK;
 	u8 SendNextBlk;
-	u8 IsFWDnld;
 	u32 FWSeqNum;
 	u32 LastSeqNum;
 	u32 TotalBytes;
@@ -103,15 +101,9 @@ struct usb_card_rec {
 
 	u32 usb_event_cause;
 
-	u8 tx_urb_pending;
-	u8 rx_urb_pending;
 	u8 rx_urb_recall;
 
-#ifdef SUPPORT_BOOT_COMMAND
 	u8			BootCMDACK;
-	u8			BootCMDResp;
-	const struct firmware	*usKernelFile;
-#endif
 };
 
 typedef void *(*usb_notifier_fn_add) (struct usb_card_rec *);
@@ -149,138 +141,6 @@ #define FW_HAS_LAST_BLOCK		0x00000004
 #define FW_DATA_XMIT_SIZE \
 	sizeof(struct FWHeader) + fwdata->fwheader.DataLength + sizeof(u32)
 
-#ifdef SUPPORT_BOOT_COMMAND
-typedef struct StUpdateStorage {
-	u8  u8DriverFunctionActive;
-	u8  u8FileFormat;
-	u8  *pu8Image;
-	u32 u32Image_len;
-} StUpdateStorage;
-
-#define DRIVER_NORMAL                0x01
-#define DRIVER_ONLY_UPDATE_STORAGE   0x02
-
-#define UPDATE_STORAGE_NULL          0x00
-#define UPDATE_STORAGE_BOOT2         0x03
-#define UPDATE_STORAGE_FW            0x04
-
-/** FileHeader */
-typedef struct _FileHeader {
-	u32	DnldCmd;
-	u32	BaseAddr;
-	u32	DataLength;
-	u32	CRC;
-} __attribute__ ((packed)) FileHeader, *pFileHeader;
-
-#define FILE_MAX_DATA_BLK_SIZE	600
-
-/** FileData */
-typedef struct _FileData {
-	FileHeader	fileheader;
-	u32	SeqNum;
-	u8	data[FILE_MAX_DATA_BLK_SIZE];
-} __attribute__ ((packed)) FileData, pFileData;
-
-/** FileSyncHeader */
-typedef struct _FileSyncHeader {
-	u32	Cmd;
-	u32	SeqNum;
-} __attribute__ ((packed)) FileSyncHeader;
-
-#define FILE_DATA_XMIT_SIZE \
-	sizeof(FileHeader) + sFileData.fileheader.DataLength + sizeof(u32)
-
-#define FILE_HAS_DATA_TO_RECV	0x00000001
-#define FILE_HAS_LAST_BLOCK  	0x00000004
-
 int usb_tx_block(wlan_private *priv, u8 *payload, u16 nb);
 void if_usb_free(struct usb_card_rec *cardp);
 
-int us_prob(void);
-int us_close(void);
-int us_usb_tx_block(struct usb_card_rec *cardp, u16 nb);
-int us_usb_submit_rx_urb(struct usb_card_rec *cardp);
-int us_start(struct usb_card_rec *card);
-int us_prog_storage(struct usb_card_rec *cardp);
-int us_usb_issue_boot_command(struct usb_card_rec *cardp, int iValue);
-
-void us_usb_write_bulk_callback(struct urb *urb, struct pt_regs *regs);
-void us_usb_receive(struct urb *urb, struct pt_regs *regs);
-void us_usb_disconnect(struct usb_interface *intf);
-
-#ifdef UPDATE_BOOT2_BY_MFG
-typedef struct {
-	u16 	cmd;	/* message type */
-	u16 	len;
-	u16 	seq;
-	u16 	result;
-	u32 	MfgCmd;
-} PkHeader_t;
-
-typedef struct {
-	PkHeader_t	header;
-	u32 	action;
-	u32 	Error; 
-	u32 	signature;
-	u32 	sector_erase;
-	u32 	address;
-	u32 	lenInByte;
-	u8  	byte[0];
-} spi_CmdEeprom_t;
-
-typedef struct TagMCBW_Header {
-	u32 	Signature;
-	u16 	Tag;
-	u16 	TotalLength;
-	u16 	Function_Flag;
-	u16 	CommandLength;
-} MCBW_hdr, *pMCBW_hdr;
-
-typedef struct TagMCSW_Header {
-	u32 	Signature;
-	u16 	Tag;
-	u16 	DataResidue;
-	u16 	Status;
-	u16 	CommandLength;
-} MCSW_hdr, *pMCSW_hdr;
-
-typedef struct {
-	MCBW_hdr       	stMCBW;
-	spi_CmdEeprom_t	stMfg_Cmd;
-} Send_Mfg_Data;
-
-typedef struct {
-	MCSW_hdr       	stMCSW;
-	spi_CmdEeprom_t	stMfg_Cmd;
-} Receive_Mfg_Data;
-
-struct stMfgUpdateBoot2{
-	u32 	u32Address;
-	u32 	u32RemainLength;	
-	u32 	u32SeqNum;
-	Send_Mfg_Data	*pstSendData;
-	u8  	*pu8Image;	
-	u8  	u8TX_Call_Back;
-	u8  	u8RX_Received;
-	u8  	u8Mfg_Boot2_Update;
-	u8  	u8Mfg_Error_Received;	
-};
-
-#define BOOT2_VERSION_OLD    	0x3102
-#define UPDATE_STORAGE_BY_MFG	0x05
-#define MFG_UPDATE_BOOT2_SIZE	0x140
-#define MCBWSignature        	0x4D434257	/* "MCBW" Token */
-#define MCSWSignature        	0x4D435357	/* "MCSW" Token */
-#define FUNCTION_FLAG        	0x0008
-
-#define Host_CMD_MFG_COMMAND 	0x1040
-#define MFG_CMD_SPI_EEPROM   	(0x1000 + 0x0027)
-#define MFG_RSP_SPI_EEPROM   	(0x1000 + 0x8000 + 0x0027)
-#define HostCmd_ACT_GEN_SET  	0x0001
-#define SIGNATURE_SPIEEPROM  	0xc5c01688
-
-int us_mfg_Receive_check(u8 * u8Buffer);
-int us_mfg_Update_Boot2(struct usb_card_rec *cardp);
-#endif /* UPDATE_BOOT2_BY_MFG */
-
-#endif /* SUPPORT_BOOT_COMMAND */


More information about the Commits-kernel mailing list