aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c88
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h75
2 files changed, 69 insertions, 94 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index e533000787f3..3f12b606839e 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -27,9 +27,9 @@
27#include <dhd_dbg.h> 27#include <dhd_dbg.h>
28 28
29#include "firmware.h" 29#include "firmware.h"
30#include "usb_rdl.h"
31#include "usb.h" 30#include "usb.h"
32 31
32
33#define IOCTL_RESP_TIMEOUT 2000 33#define IOCTL_RESP_TIMEOUT 2000
34 34
35#define BRCMF_USB_RESET_GETVER_SPINWAIT 100 /* in unit of ms */ 35#define BRCMF_USB_RESET_GETVER_SPINWAIT 100 /* in unit of ms */
@@ -49,6 +49,71 @@
49#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin" 49#define BRCMF_USB_43242_FW_NAME "brcm/brcmfmac43242a.bin"
50#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin" 50#define BRCMF_USB_43569_FW_NAME "brcm/brcmfmac43569.bin"
51 51
52#define TRX_MAGIC 0x30524448 /* "HDR0" */
53#define TRX_MAX_OFFSET 3 /* Max number of file offsets */
54#define TRX_UNCOMP_IMAGE 0x20 /* Trx holds uncompressed img */
55#define TRX_RDL_CHUNK 1500 /* size of each dl transfer */
56#define TRX_OFFSETS_DLFWLEN_IDX 0
57
58/* Control messages: bRequest values */
59#define DL_GETSTATE 0 /* returns the rdl_state_t struct */
60#define DL_CHECK_CRC 1 /* currently unused */
61#define DL_GO 2 /* execute downloaded image */
62#define DL_START 3 /* initialize dl state */
63#define DL_REBOOT 4 /* reboot the device in 2 seconds */
64#define DL_GETVER 5 /* returns the bootrom_id_t struct */
65#define DL_GO_PROTECTED 6 /* execute the downloaded code and set reset
66 * event to occur in 2 seconds. It is the
67 * responsibility of the downloaded code to
68 * clear this event
69 */
70#define DL_EXEC 7 /* jump to a supplied address */
71#define DL_RESETCFG 8 /* To support single enum on dongle
72 * - Not used by bootloader
73 */
74#define DL_DEFER_RESP_OK 9 /* Potentially defer the response to setup
75 * if resp unavailable
76 */
77
78/* states */
79#define DL_WAITING 0 /* waiting to rx first pkt */
80#define DL_READY 1 /* hdr was good, waiting for more of the
81 * compressed image
82 */
83#define DL_BAD_HDR 2 /* hdr was corrupted */
84#define DL_BAD_CRC 3 /* compressed image was corrupted */
85#define DL_RUNNABLE 4 /* download was successful,waiting for go cmd */
86#define DL_START_FAIL 5 /* failed to initialize correctly */
87#define DL_NVRAM_TOOBIG 6 /* host specified nvram data exceeds DL_NVRAM
88 * value
89 */
90#define DL_IMAGE_TOOBIG 7 /* firmware image too big */
91
92
93struct trx_header_le {
94 __le32 magic; /* "HDR0" */
95 __le32 len; /* Length of file including header */
96 __le32 crc32; /* CRC from flag_version to end of file */
97 __le32 flag_version; /* 0:15 flags, 16:31 version */
98 __le32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of
99 * header
100 */
101};
102
103struct rdl_state_le {
104 __le32 state;
105 __le32 bytes;
106};
107
108struct bootrom_id_le {
109 __le32 chip; /* Chip id */
110 __le32 chiprev; /* Chip rev */
111 __le32 ramsize; /* Size of RAM */
112 __le32 remapbase; /* Current remap base address */
113 __le32 boardtype; /* Type of board */
114 __le32 boardrev; /* Board revision */
115};
116
52struct brcmf_usb_image { 117struct brcmf_usb_image {
53 struct list_head list; 118 struct list_head list;
54 s8 *fwname; 119 s8 *fwname;
@@ -788,7 +853,7 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen)
788 853
789 brcmf_dbg(USB, "Enter, fw %p, len %d\n", fw, fwlen); 854 brcmf_dbg(USB, "Enter, fw %p, len %d\n", fw, fwlen);
790 855
791 bulkchunk = kmalloc(RDL_CHUNK, GFP_ATOMIC); 856 bulkchunk = kmalloc(TRX_RDL_CHUNK, GFP_ATOMIC);
792 if (bulkchunk == NULL) { 857 if (bulkchunk == NULL) {
793 err = -ENOMEM; 858 err = -ENOMEM;
794 goto fail; 859 goto fail;
@@ -815,10 +880,10 @@ brcmf_usb_dl_writeimage(struct brcmf_usbdev_info *devinfo, u8 *fw, int fwlen)
815 /* Wait until the usb device reports it received all 880 /* Wait until the usb device reports it received all
816 * the bytes we sent */ 881 * the bytes we sent */
817 if ((rdlbytes == sent) && (rdlbytes != dllen)) { 882 if ((rdlbytes == sent) && (rdlbytes != dllen)) {
818 if ((dllen-sent) < RDL_CHUNK) 883 if ((dllen-sent) < TRX_RDL_CHUNK)
819 sendlen = dllen-sent; 884 sendlen = dllen-sent;
820 else 885 else
821 sendlen = RDL_CHUNK; 886 sendlen = TRX_RDL_CHUNK;
822 887
823 /* simply avoid having to send a ZLP by ensuring we 888 /* simply avoid having to send a ZLP by ensuring we
824 * never have an even 889 * never have an even
@@ -983,21 +1048,6 @@ static void brcmf_usb_detach(struct brcmf_usbdev_info *devinfo)
983 kfree(devinfo->rx_reqs); 1048 kfree(devinfo->rx_reqs);
984} 1049}
985 1050
986#define TRX_MAGIC 0x30524448 /* "HDR0" */
987#define TRX_VERSION 1 /* Version 1 */
988#define TRX_MAX_LEN 0x3B0000 /* Max length */
989#define TRX_NO_HEADER 1 /* Do not write TRX header */
990#define TRX_MAX_OFFSET 3 /* Max number of individual files */
991#define TRX_UNCOMP_IMAGE 0x20 /* Trx contains uncompressed image */
992
993struct trx_header_le {
994 __le32 magic; /* "HDR0" */
995 __le32 len; /* Length of file including header */
996 __le32 crc32; /* CRC from flag_version to end of file */
997 __le32 flag_version; /* 0:15 flags, 16:31 version */
998 __le32 offsets[TRX_MAX_OFFSET]; /* Offsets of partitions from start of
999 * header */
1000};
1001 1051
1002static int check_file(const u8 *headers) 1052static int check_file(const u8 *headers)
1003{ 1053{
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h b/drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h
deleted file mode 100644
index 0a35c51c3da2..000000000000
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb_rdl.h
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * Copyright (c) 2011 Broadcom Corporation
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
11 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#ifndef _USB_RDL_H
18#define _USB_RDL_H
19
20/* Control messages: bRequest values */
21#define DL_GETSTATE 0 /* returns the rdl_state_t struct */
22#define DL_CHECK_CRC 1 /* currently unused */
23#define DL_GO 2 /* execute downloaded image */
24#define DL_START 3 /* initialize dl state */
25#define DL_REBOOT 4 /* reboot the device in 2 seconds */
26#define DL_GETVER 5 /* returns the bootrom_id_t struct */
27#define DL_GO_PROTECTED 6 /* execute the downloaded code and set reset
28 * event to occur in 2 seconds. It is the
29 * responsibility of the downloaded code to
30 * clear this event
31 */
32#define DL_EXEC 7 /* jump to a supplied address */
33#define DL_RESETCFG 8 /* To support single enum on dongle
34 * - Not used by bootloader
35 */
36#define DL_DEFER_RESP_OK 9 /* Potentially defer the response to setup
37 * if resp unavailable
38 */
39
40/* states */
41#define DL_WAITING 0 /* waiting to rx first pkt */
42#define DL_READY 1 /* hdr was good, waiting for more of the
43 * compressed image */
44#define DL_BAD_HDR 2 /* hdr was corrupted */
45#define DL_BAD_CRC 3 /* compressed image was corrupted */
46#define DL_RUNNABLE 4 /* download was successful,waiting for go cmd */
47#define DL_START_FAIL 5 /* failed to initialize correctly */
48#define DL_NVRAM_TOOBIG 6 /* host specified nvram data exceeds DL_NVRAM
49 * value */
50#define DL_IMAGE_TOOBIG 7 /* download image too big (exceeds DATA_START
51 * for rdl) */
52
53struct rdl_state_le {
54 __le32 state;
55 __le32 bytes;
56};
57
58struct bootrom_id_le {
59 __le32 chip; /* Chip id */
60 __le32 chiprev; /* Chip rev */
61 __le32 ramsize; /* Size of RAM */
62 __le32 remapbase; /* Current remap base address */
63 __le32 boardtype; /* Type of board */
64 __le32 boardrev; /* Board revision */
65};
66
67#define RDL_CHUNK 1500 /* size of each dl transfer */
68
69#define TRX_OFFSETS_DLFWLEN_IDX 0
70#define TRX_OFFSETS_JUMPTO_IDX 1
71#define TRX_OFFSETS_NVM_LEN_IDX 2
72
73#define TRX_OFFSETS_DLBASE_IDX 0
74
75#endif /* _USB_RDL_H */