1  /*
2   * Copyright (c) 2012, 2018 The Linux Foundation. All rights reserved.
3   *
4   * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5   *
6   *
7   * Permission to use, copy, modify, and/or distribute this software for
8   * any purpose with or without fee is hereby granted, provided that the
9   * above copyright notice and this permission notice appear in all
10   * copies.
11   *
12   * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13   * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14   * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15   * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16   * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17   * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18   * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19   * PERFORMANCE OF THIS SOFTWARE.
20   */
21  
22  /*
23   * This file was originally distributed by Qualcomm Atheros, Inc.
24   * under proprietary terms before Copyright ownership was assigned
25   * to the Linux Foundation.
26   */
27  
28  /* USB definitions shared between host and target */
29  
30  #ifndef __A_USB_DEFS_H__
31  #define __A_USB_DEFS_H__
32  
33  #ifndef ATH_TARGET
34  #include "athstartpack.h"
35  #endif
36  
37  /* USB endpoint definitions */
38  #ifdef PLATFORM_GENOA
39  
40  #define USB_EP_ADDR_APP_CTRL_IN          0x88
41  #define USB_EP_ADDR_APP_DATA_IN          0x89
42  #define USB_EP_ADDR_APP_QMI_IN           0x8A
43  #define USB_EP_ADDR_APP_DIAG_IN          0x8B
44  
45  #define USB_EP_ADDR_APP_CTRL_OUT         0x08
46  #define USB_EP_ADDR_APP_DATA_OUT         0x09
47  #define USB_EP_ADDR_APP_QMI_OUT          0x0A
48  #define USB_EP_ADDR_APP_DIAG_OUT         0x0B
49  
50  #else /* PLATFORM_GENOA */
51  
52  #define USB_EP_ADDR_APP_CTRL_IN          0x81
53  #define USB_EP_ADDR_APP_DATA_IN          0x82
54  #define USB_EP_ADDR_APP_DATA2_IN         0x83
55  #define USB_EP_ADDR_APP_INT_IN           0x84
56  
57  #define USB_EP_ADDR_APP_CTRL_OUT         0x01
58  #define USB_EP_ADDR_APP_DATA_LP_OUT      0x02
59  #define USB_EP_ADDR_APP_DATA_MP_OUT      0x03
60  #define USB_EP_ADDR_APP_DATA_HP_OUT      0x04
61  
62  #endif /* PLATFORM_GENOA */
63  
64  #define USB_CONTROL_REQ_SEND_BMI_CMD        1
65  #define USB_CONTROL_REQ_RECV_BMI_RESP       2
66  #define USB_CONTROL_REQ_DIAG_CMD            3
67  #define USB_CONTROL_REQ_DIAG_RESP           4
68  
69  
70  //#define USB_CONTROL_MAX_BMI_TRANSFER_SIZE   64
71  #define USB_CONTROL_MAX_BMI_TRANSFER_SIZE   252
72  
73  #define HIF_BMI_MAX_TRANSFER_SIZE           USB_CONTROL_MAX_BMI_TRANSFER_SIZE
74  
75  #define USB_HS_BULK_MAXP_SIZE   0x200  //512 Bytes Maxp for High Speed for BULK EP
76  #define USB_FS_BULK_MAXP_SIZE   0x40   //64 Bytes Maxp for Full Speed for BULK EP
77  
78  
79  
80  /* diagnostic command defnitions */
81  #define USB_CTRL_DIAG_CC_READ       0
82  #define USB_CTRL_DIAG_CC_WRITE      1
83  #define USB_CTRL_DIAG_CC_WARM_RESET 2
84  
85  typedef PREPACK struct {
86      A_UINT32    Cmd;
87      A_UINT32    Address;
88      A_UINT32    Value;
89      A_UINT32    _pad[1];
90  } POSTPACK USB_CTRL_DIAG_CMD_WRITE;
91  
92  typedef PREPACK struct {
93      A_UINT32    Cmd;
94      A_UINT32    Address;
95  } POSTPACK USB_CTRL_DIAG_CMD_READ;
96  
97  typedef PREPACK struct {
98      A_UINT32    ReadValue;
99  } POSTPACK USB_CTRL_DIAG_RESP_READ;
100  
101  #define USB_CTRL_MAX_DIAG_CMD_SIZE  (sizeof(USB_CTRL_DIAG_CMD_WRITE))
102  #define USB_CTRL_MAX_DIAG_RESP_SIZE (sizeof(USB_CTRL_DIAG_RESP_READ))
103  
104  #ifndef ATH_TARGET
105  #include "athendpack.h"
106  #endif
107  
108  #endif
109