]> git.karo-electronics.de Git - linux-beck.git/blob - drivers/staging/wilc1000/linux_wlan_common.h
Merge tag 'iio-for-4.5c' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio...
[linux-beck.git] / drivers / staging / wilc1000 / linux_wlan_common.h
1 #ifndef LINUX_WLAN_COMMON_H
2 #define LINUX_WLAN_COMMON_H
3
4 enum debug_region {
5         Generic_debug = 0,
6         Hostapd_debug,
7         Hostinf_debug,
8         CFG80211_debug,
9         Coreconfig_debug,
10         Interrupt_debug,
11         TX_debug,
12         RX_debug,
13         Lock_debug,
14         Tcp_enhance,
15         Spin_debug,
16
17         Init_debug,
18         Bus_debug,
19         Mem_debug,
20         Firmware_debug,
21         COMP = 0xFFFFFFFF,
22 };
23
24 #define GENERIC_DBG             (1 << Generic_debug)
25 #define HOSTAPD_DBG             (1 << Hostapd_debug)
26 #define HOSTINF_DBG             (1 << Hostinf_debug)
27 #define CORECONFIG_DBG          (1 << Coreconfig_debug)
28 #define CFG80211_DBG            (1 << CFG80211_debug)
29 #define INT_DBG                 (1 << Interrupt_debug)
30 #define TX_DBG                  (1 << TX_debug)
31 #define RX_DBG                  (1 << RX_debug)
32 #define LOCK_DBG                (1 << Lock_debug)
33 #define TCP_ENH                 (1 << Tcp_enhance)
34 #define SPIN_DEBUG              (1 << Spin_debug)
35 #define INIT_DBG                (1 << Init_debug)
36 #define BUS_DBG                 (1 << Bus_debug)
37 #define MEM_DBG                 (1 << Mem_debug)
38 #define FIRM_DBG                (1 << Firmware_debug)
39
40 #if defined (WILC_DEBUGFS)
41 extern atomic_t WILC_REGION;
42 extern atomic_t WILC_DEBUG_LEVEL;
43
44 #define DEBUG           BIT(0)
45 #define INFO            BIT(1)
46 #define WRN             BIT(2)
47 #define ERR             BIT(3)
48
49 #define PRINT_D(region, ...)                                            \
50         do {                                                            \
51                 if ((atomic_read(&WILC_DEBUG_LEVEL) & DEBUG) && \
52                    ((atomic_read(&WILC_REGION)) & (region))) {  \
53                         printk("DBG [%s: %d]", __func__, __LINE__);     \
54                         printk(__VA_ARGS__);                            \
55                 }                                                       \
56         } while (0)
57
58 #define PRINT_INFO(region, ...)                                         \
59         do {                                                            \
60                 if ((atomic_read(&WILC_DEBUG_LEVEL) & INFO) &&  \
61                    ((atomic_read(&WILC_REGION)) & (region))) {  \
62                         printk("INFO [%s]", __func__);                  \
63                         printk(__VA_ARGS__);                            \
64                 }                                                       \
65         } while (0)
66
67 #define PRINT_WRN(region, ...)                                          \
68         do {                                                            \
69                 if ((atomic_read(&WILC_DEBUG_LEVEL) & WRN) &&   \
70                    ((atomic_read(&WILC_REGION)) & (region))) {  \
71                         printk("WRN [%s: %d]", __func__, __LINE__);     \
72                         printk(__VA_ARGS__);                            \
73                 }                                                       \
74         } while (0)
75
76 #define PRINT_ER(...)                                                   \
77         do {                                                            \
78                 if ((atomic_read(&WILC_DEBUG_LEVEL) & ERR)) {   \
79                         printk("ERR [%s: %d]", __func__, __LINE__);     \
80                         printk(__VA_ARGS__);                            \
81                 }                                                       \
82         } while (0)
83
84 #else
85
86 #define REGION  (INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG)
87
88 #define DEBUG       1
89 #define INFO        0
90 #define WRN         0
91
92 #define PRINT_D(region, ...)                                            \
93         do {                                                            \
94                 if (DEBUG == 1 && ((REGION)&(region))) {                \
95                         printk("DBG [%s: %d]", __func__, __LINE__);     \
96                         printk(__VA_ARGS__);                            \
97                 }                                                       \
98         } while (0)
99
100 #define PRINT_INFO(region, ...)                                         \
101         do {                                                            \
102                 if (INFO == 1 && ((REGION)&(region))) {                 \
103                         printk("INFO [%s]", __func__);                  \
104                         printk(__VA_ARGS__);                            \
105                 }                                                       \
106         } while (0)
107
108 #define PRINT_WRN(region, ...)                                          \
109         do {                                                            \
110                 if (WRN == 1 && ((REGION)&(region))) {                  \
111                         printk("WRN [%s: %d]", __func__, __LINE__);     \
112                         printk(__VA_ARGS__);                            \
113                 }                                                       \
114         } while (0)
115
116 #define PRINT_ER(...)                                                   \
117         do {                                                            \
118                 printk("ERR [%s: %d]", __func__, __LINE__);             \
119                 printk(__VA_ARGS__);                                    \
120         } while (0)
121
122 #endif
123
124 #define FN_IN   /* PRINT_D(">>> \n") */
125 #define FN_OUT  /* PRINT_D("<<<\n") */
126
127 #define LINUX_RX_SIZE   (96 * 1024)
128 #define LINUX_TX_SIZE   (64 * 1024)
129
130
131 #define WILC_MULTICAST_TABLE_SIZE       8
132
133 #if defined (BEAGLE_BOARD)
134         #define SPI_CHANNEL     4
135
136         #if SPI_CHANNEL == 4
137                 #define MODALIAS        "wilc_spi4"
138                 #define GPIO_NUM        162
139         #else
140                 #define MODALIAS        "wilc_spi3"
141                 #define GPIO_NUM        133
142         #endif
143 #elif defined(PLAT_WMS8304)             /* rachel */
144         #define MODALIAS        "wilc_spi"
145         #define GPIO_NUM        139
146 #elif defined (PLAT_RKXXXX)
147  #define MODALIAS       "WILC_IRQ"
148  #define GPIO_NUM       RK30_PIN3_PD2 /* RK30_PIN3_PA1 */
149 /* RK30_PIN3_PD2 */
150 /* RK2928_PIN1_PA7 */
151
152 #elif defined(CUSTOMER_PLATFORM)
153 /*
154  TODO : specify MODALIAS name and GPIO number. This is certainly necessary for SPI interface.
155  *
156  * ex)
157  * #define MODALIAS  "WILC_SPI"
158  * #define GPIO_NUM  139
159  */
160
161 #else
162 /* base on SAMA5D3_Xplained Board */
163         #define MODALIAS        "WILC_SPI"
164         #define GPIO_NUM        0x44
165 #endif
166 #endif