Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
if_usb.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008, cozybit Inc.
3  * Copyright (C) 2003-2006, Marvell International Ltd.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or (at
8  * your option) any later version.
9  */
10 #include <linux/wait.h>
11 #include <linux/timer.h>
12 
13 struct lbtf_private;
14 
18 #define CMD_TYPE_REQUEST 0xF00DFACE
19 #define CMD_TYPE_DATA 0xBEADC0DE
20 #define CMD_TYPE_INDICATION 0xBEEFFACE
21 
22 #define BOOT_CMD_FW_BY_USB 0x01
23 #define BOOT_CMD_FW_IN_EEPROM 0x02
24 #define BOOT_CMD_UPDATE_BOOT2 0x03
25 #define BOOT_CMD_UPDATE_FW 0x04
26 #define BOOT_CMD_MAGIC_NUMBER 0x4C56524D /* LVRM */
27 
28 struct bootcmd {
29  __le32 magic;
30  uint8_t cmd;
31  uint8_t pad[11];
32 };
33 
34 #define BOOT_CMD_RESP_OK 0x0001
35 #define BOOT_CMD_RESP_FAIL 0x0000
36 
37 struct bootcmdresp {
38  __le32 magic;
39  uint8_t cmd;
41  uint8_t pad[2];
42 };
43 
45 struct if_usb_card {
46  struct usb_device *udev;
47  struct urb *rx_urb, *tx_urb, *cmd_urb;
48  struct lbtf_private *priv;
49 
50  struct sk_buff *rx_skb;
51 
52  uint8_t ep_in;
54 
56 
57  int ep_in_size;
58 
59  void *ep_out_buf;
60  int ep_out_size;
61 
62  const struct firmware *fw;
63  struct timer_list fw_timeout;
71 
73 };
74 
76 struct fwheader {
80  __le32 CRC;
81 };
82 
83 #define FW_MAX_DATA_BLK_SIZE 600
84 
85 struct fwdata {
86  struct fwheader hdr;
87  __le32 seqnum;
88  uint8_t data[0];
89 };
90 
92 struct fwsyncheader {
93  __le32 cmd;
94  __le32 seqnum;
95 };
96 
97 #define FW_HAS_DATA_TO_RECV 0x00000001
98 #define FW_HAS_LAST_BLOCK 0x00000004