aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/brcm80211/brcmfmac/usb.c
diff options
context:
space:
mode:
authorHante Meuleman <meuleman@broadcom.com>2014-10-28 09:56:10 -0400
committerJohn W. Linville <linville@tuxdriver.com>2014-10-30 15:24:50 -0400
commitac83d0b0aae152385ae998c65fc03ea790d8c025 (patch)
treef873e4476a755cd4c81bf7a9a2e7893d47a43b9c /drivers/net/wireless/brcm80211/brcmfmac/usb.c
parent9c6476668025e76a8365be783f2649fe3259b91c (diff)
brcmfmac: (clean) Remove usb_rdl.h as it is not needed.
Reviewed-by: Arend Van Spriel <arend@broadcom.com> Reviewed-by: Franky (Zhenhui) Lin <frankyl@broadcom.com> Reviewed-by: Pieter-Paul Giesberts <pieterpg@broadcom.com> Reviewed-by: Daniel (Deognyoun) Kim <dekim@broadcom.com> Signed-off-by: Hante Meuleman <meuleman@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/usb.c')
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c88
1 files changed, 69 insertions, 19 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{