summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/libertas/if_bootcmd.c
blob: 8bca306ffad9e7e3b0916db45cbddbf4283a7851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
  * This file contains functions used in USB Boot command
  * and Boot2/FW update
  */

#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/netdevice.h>
#include <linux/usb.h>

#define DRV_NAME "usb8xxx"

#include "defs.h"
#include "dev.h"
#include "if_usb.h"

/**
 *  @brief This function issues Boot command to the Boot2 code
 *  @param ivalue   1:Boot from FW by USB-Download
 *                  2:Boot from FW in EEPROM
 *  @return 	   	0
 */
int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
{
	struct usb_card_rec	*cardp = priv->card;
	struct bootcmdstr	sbootcmd;
	int i;

	/* Prepare command */
	sbootcmd.u32magicnumber = cpu_to_le32(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 */
	usb_tx_block(priv, cardp->bulk_out_buffer, sizeof(struct bootcmdstr));

	return 0;
}