Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelv...
[pandora-kernel.git] / drivers / staging / ath6kl / include / common_drv.h
1 //------------------------------------------------------------------------------
2 // Copyright (c) 2010 Atheros Corporation.  All rights reserved.
3 // 
4 //
5 // Permission to use, copy, modify, and/or distribute this software for any
6 // purpose with or without fee is hereby granted, provided that the above
7 // copyright notice and this permission notice appear in all copies.
8 //
9 // THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 // WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 // MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 // ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 // ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 // OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 //
17 //
18 //------------------------------------------------------------------------------
19 //==============================================================================
20 // Author(s): ="Atheros"
21 //==============================================================================
22 #ifndef COMMON_DRV_H_
23 #define COMMON_DRV_H_
24
25 #include "hif.h"
26 #include "htc_packet.h"
27 #include "htc_api.h"
28
29 /* structure that is the state information for the default credit distribution callback
30  * drivers should instantiate (zero-init as well) this structure in their driver instance
31  * and pass it as a context to the HTC credit distribution functions */
32 typedef struct _COMMON_CREDIT_STATE_INFO {
33     int TotalAvailableCredits;      /* total credits in the system at startup */
34     int CurrentFreeCredits;         /* credits available in the pool that have not been
35                                        given out to endpoints */
36     HTC_ENDPOINT_CREDIT_DIST *pLowestPriEpDist;  /* pointer to the lowest priority endpoint dist struct */
37 } COMMON_CREDIT_STATE_INFO;
38
39 typedef struct {
40     A_INT32 (*setupTransport)(void *ar);
41     void (*cleanupTransport)(void *ar);
42 } HCI_TRANSPORT_CALLBACKS;
43
44 typedef struct {
45    void *netDevice;
46    void *hifDevice;
47    void *htcHandle;
48 } HCI_TRANSPORT_MISC_HANDLES;
49
50 /* HTC TX packet tagging definitions */
51 #define AR6K_CONTROL_PKT_TAG    HTC_TX_PACKET_TAG_USER_DEFINED
52 #define AR6K_DATA_PKT_TAG       (AR6K_CONTROL_PKT_TAG + 1)
53
54 #define AR6002_VERSION_REV1     0x20000086
55 #define AR6002_VERSION_REV2     0x20000188
56 #define AR6003_VERSION_REV1     0x300002ba
57 #define AR6003_VERSION_REV2     0x30000384
58
59 #define AR6002_CUST_DATA_SIZE 112
60 #define AR6003_CUST_DATA_SIZE 16
61
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65
66 /* OS-independent APIs */
67 A_STATUS ar6000_setup_credit_dist(HTC_HANDLE HTCHandle, COMMON_CREDIT_STATE_INFO *pCredInfo);
68
69 A_STATUS ar6000_ReadRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data);
70
71 A_STATUS ar6000_WriteRegDiag(HIF_DEVICE *hifDevice, A_UINT32 *address, A_UINT32 *data);
72
73 A_STATUS ar6000_ReadDataDiag(HIF_DEVICE *hifDevice, A_UINT32 address,  A_UCHAR *data, A_UINT32 length);
74
75 A_STATUS ar6000_reset_device(HIF_DEVICE *hifDevice, A_UINT32 TargetType, A_BOOL waitForCompletion, A_BOOL coldReset);
76
77 void ar6000_dump_target_assert_info(HIF_DEVICE *hifDevice, A_UINT32 TargetType);
78
79 A_STATUS ar6000_set_htc_params(HIF_DEVICE *hifDevice,
80                                A_UINT32    TargetType,
81                                A_UINT32    MboxIsrYieldValue,
82                                A_UINT8     HtcControlBuffers);
83
84 A_STATUS ar6000_prepare_target(HIF_DEVICE *hifDevice,
85                                A_UINT32    TargetType,
86                                A_UINT32    TargetVersion);
87
88 A_STATUS ar6000_set_hci_bridge_flags(HIF_DEVICE *hifDevice,
89                                      A_UINT32    TargetType,
90                                      A_UINT32    Flags);
91
92 void ar6000_copy_cust_data_from_target(HIF_DEVICE *hifDevice, A_UINT32 TargetType);
93
94 A_UINT8 *ar6000_get_cust_data_buffer(A_UINT32 TargetType);
95
96 A_STATUS ar6000_setBTState(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize);
97
98 A_STATUS ar6000_setDevicePowerState(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize);
99
100 A_STATUS ar6000_setWowMode(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize);
101
102 A_STATUS ar6000_setHostMode(void *context, A_UINT8 *pInBuf, A_UINT32 InBufSize);
103
104 #ifdef __cplusplus
105 }
106 #endif
107
108 #endif /*COMMON_DRV_H_*/