These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / 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 int wilc_debugfs_init(void);
42 void wilc_debugfs_remove(void);
43
44 extern atomic_t REGION;
45 extern atomic_t DEBUG_LEVEL;
46
47 #define DEBUG           BIT(0)
48 #define INFO            BIT(1)
49 #define WRN             BIT(2)
50 #define ERR             BIT(3)
51
52 #define PRINT_D(region, ...)                                            \
53         do {                                                            \
54                 if ((atomic_read(&DEBUG_LEVEL) & DEBUG) &&              \
55                    ((atomic_read(&REGION)) & (region))) {               \
56                         printk("DBG [%s: %d]", __func__, __LINE__);     \
57                         printk(__VA_ARGS__);                            \
58                 }                                                       \
59         } while (0)
60
61 #define PRINT_INFO(region, ...)                                         \
62         do {                                                            \
63                 if ((atomic_read(&DEBUG_LEVEL) & INFO) &&               \
64                    ((atomic_read(&REGION)) & (region))) {               \
65                         printk("INFO [%s]", __func__);                  \
66                         printk(__VA_ARGS__);                            \
67                 }                                                       \
68         } while (0)
69
70 #define PRINT_WRN(region, ...)                                          \
71         do {                                                            \
72                 if ((atomic_read(&DEBUG_LEVEL) & WRN) &&                \
73                    ((atomic_read(&REGION)) & (region))) {               \
74                         printk("WRN [%s: %d]", __func__, __LINE__);     \
75                         printk(__VA_ARGS__);                            \
76                 }                                                       \
77         } while (0)
78
79 #define PRINT_ER(...)                                                   \
80         do {                                                            \
81                 if ((atomic_read(&DEBUG_LEVEL) & ERR)) {                \
82                         printk("ERR [%s: %d]", __func__, __LINE__);     \
83                         printk(__VA_ARGS__);                            \
84                 }                                                       \
85         } while (0)
86
87 #else
88
89 #define REGION  (INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG)
90
91 #define DEBUG       1
92 #define INFO        0
93 #define WRN         0
94
95 #define PRINT_D(region, ...)                                            \
96         do {                                                            \
97                 if (DEBUG == 1 && ((REGION)&(region))) {                \
98                         printk("DBG [%s: %d]", __func__, __LINE__);     \
99                         printk(__VA_ARGS__);                            \
100                 }                                                       \
101         } while (0)
102
103 #define PRINT_INFO(region, ...)                                         \
104         do {                                                            \
105                 if (INFO == 1 && ((REGION)&(region))) {                 \
106                         printk("INFO [%s]", __func__);                  \
107                         printk(__VA_ARGS__);                            \
108                 }                                                       \
109         } while (0)
110
111 #define PRINT_WRN(region, ...)                                          \
112         do {                                                            \
113                 if (WRN == 1 && ((REGION)&(region))) {                  \
114                         printk("WRN [%s: %d]", __func__, __LINE__);     \
115                         printk(__VA_ARGS__);                            \
116                 }                                                       \
117         } while (0)
118
119 #define PRINT_ER(...)                                                   \
120         do {                                                            \
121                 printk("ERR [%s: %d]", __func__, __LINE__);             \
122                 printk(__VA_ARGS__);                                    \
123         } while (0)
124 #endif
125
126 #define FN_IN   /* PRINT_D(">>> \n") */
127 #define FN_OUT  /* PRINT_D("<<<\n") */
128
129 #ifdef MEMORY_STATIC
130 #define LINUX_RX_SIZE   (96 * 1024)
131 #endif
132 #define LINUX_TX_SIZE   (64 * 1024)
133
134
135 #define WILC_MULTICAST_TABLE_SIZE       8
136
137 #if defined (BEAGLE_BOARD)
138         #define SPI_CHANNEL     4
139
140         #if SPI_CHANNEL == 4
141                 #define MODALIAS        "wilc_spi4"
142                 #define GPIO_NUM        162
143         #else
144                 #define MODALIAS        "wilc_spi3"
145                 #define GPIO_NUM        133
146         #endif
147 #elif defined(PLAT_WMS8304)             /* rachel */
148         #define MODALIAS        "wilc_spi"
149         #define GPIO_NUM        139
150 #elif defined (PLAT_RKXXXX)
151  #define MODALIAS       "WILC_IRQ"
152  #define GPIO_NUM       RK30_PIN3_PD2 /* RK30_PIN3_PA1 */
153 /* RK30_PIN3_PD2 */
154 /* RK2928_PIN1_PA7 */
155
156 #elif defined(CUSTOMER_PLATFORM)
157 /*
158  TODO : specify MODALIAS name and GPIO number. This is certainly necessary for SPI interface.
159  *
160  * ex)
161  * #define MODALIAS  "WILC_SPI"
162  * #define GPIO_NUM  139
163  */
164
165 #else
166 /* base on SAMA5D3_Xplained Board */
167         #define MODALIAS        "WILC_SPI"
168         #define GPIO_NUM        0x44
169 #endif
170 #endif