Merge tag 'nfs-for-4.3-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
[linux-2.6-microblaze.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         /*Added by amr - BugID_4720*/
16         Spin_debug,
17
18         Init_debug,
19         Bus_debug,
20         Mem_debug,
21         Firmware_debug,
22         COMP = 0xFFFFFFFF,
23 };
24
25 #define GENERIC_DBG             (1 << Generic_debug)
26 #define HOSTAPD_DBG             (1 << Hostapd_debug)
27 #define HOSTINF_DBG             (1 << Hostinf_debug)
28 #define CORECONFIG_DBG          (1 << Coreconfig_debug)
29 #define CFG80211_DBG            (1 << CFG80211_debug)
30 #define INT_DBG                 (1 << Interrupt_debug)
31 #define TX_DBG                  (1 << TX_debug)
32 #define RX_DBG                  (1 << RX_debug)
33 #define LOCK_DBG                (1 << Lock_debug)
34 #define TCP_ENH                 (1 << Tcp_enhance)
35 #define SPIN_DEBUG              (1 << Spin_debug)
36 #define INIT_DBG                (1 << Init_debug)
37 #define BUS_DBG                 (1 << Bus_debug)
38 #define MEM_DBG                 (1 << Mem_debug)
39 #define FIRM_DBG                (1 << Firmware_debug)
40
41 #if defined (WILC_DEBUGFS)
42 int wilc_debugfs_init(void);
43 void wilc_debugfs_remove(void);
44
45 extern atomic_t REGION;
46 extern atomic_t DEBUG_LEVEL;
47
48 #define DEBUG           (1 << 0)
49 #define INFO            (1 << 1)
50 #define WRN             (1 << 2)
51 #define ERR             (1 << 3)
52
53 #define PRINT_D(region, ...)                                            \
54         do {                                                            \
55                 if ((atomic_read(&DEBUG_LEVEL) & DEBUG) &&              \
56                    ((atomic_read(&REGION)) & (region))) {               \
57                         printk("DBG [%s: %d]", __func__, __LINE__);     \
58                         printk(__VA_ARGS__);                            \
59                 }                                                       \
60         } while (0)
61
62 #define PRINT_INFO(region, ...)                                         \
63         do {                                                            \
64                 if ((atomic_read(&DEBUG_LEVEL) & INFO) &&               \
65                    ((atomic_read(&REGION)) & (region))) {               \
66                         printk("INFO [%s]", __func__);                  \
67                         printk(__VA_ARGS__);                            \
68                 }                                                       \
69         } while (0)
70
71 #define PRINT_WRN(region, ...)                                          \
72         do {                                                            \
73                 if ((atomic_read(&DEBUG_LEVEL) & WRN) &&                \
74                    ((atomic_read(&REGION)) & (region))) {               \
75                         printk("WRN [%s: %d]", __func__, __LINE__);     \
76                         printk(__VA_ARGS__);                            \
77                 }                                                       \
78         } while (0)
79
80 #define PRINT_ER(...)                                                   \
81         do {                                                            \
82                 if ((atomic_read(&DEBUG_LEVEL) & ERR)) {                \
83                         printk("ERR [%s: %d]", __func__, __LINE__);     \
84                         printk(__VA_ARGS__);                            \
85                 }                                                       \
86         } while (0)
87
88 #else
89
90 #define REGION  (INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG)
91
92 #define DEBUG       1
93 #define INFO        0
94 #define WRN         0
95
96 #define PRINT_D(region, ...)                                            \
97         do {                                                            \
98                 if (DEBUG == 1 && ((REGION)&(region))) {                \
99                         printk("DBG [%s: %d]", __func__, __LINE__);     \
100                         printk(__VA_ARGS__);                            \
101                 }                                                       \
102         } while (0)
103
104 #define PRINT_INFO(region, ...)                                         \
105         do {                                                            \
106                 if (INFO == 1 && ((REGION)&(region))) {                 \
107                         printk("INFO [%s]", __func__);                  \
108                         printk(__VA_ARGS__);                            \
109                 }                                                       \
110         } while (0)
111
112 #define PRINT_WRN(region, ...)                                          \
113         do {                                                            \
114                 if (WRN == 1 && ((REGION)&(region))) {                  \
115                         printk("WRN [%s: %d]", __func__, __LINE__);     \
116                         printk(__VA_ARGS__);                            \
117                 }                                                       \
118         } while (0)
119
120 #define PRINT_ER(...)                                                   \
121         do {                                                            \
122                 printk("ERR [%s: %d]", __func__, __LINE__);             \
123                 printk(__VA_ARGS__);                                    \
124         } while (0)
125 #endif
126
127 #define FN_IN   /* PRINT_D(">>> \n") */
128 #define FN_OUT  /* PRINT_D("<<<\n") */
129
130 #ifdef MEMORY_STATIC
131 #define LINUX_RX_SIZE   (96 * 1024)
132 #endif
133 #define LINUX_TX_SIZE   (64 * 1024)
134
135
136 #define WILC_MULTICAST_TABLE_SIZE       8
137
138 #if defined (NM73131_0_BOARD)
139
140 #define MODALIAS "wilc_spi"
141 #define GPIO_NUM        IRQ_WILC1000_GPIO
142
143 #elif defined (BEAGLE_BOARD)
144         #define SPI_CHANNEL     4
145
146         #if SPI_CHANNEL == 4
147                 #define MODALIAS        "wilc_spi4"
148                 #define GPIO_NUM        162
149         #else
150                 #define MODALIAS        "wilc_spi3"
151                 #define GPIO_NUM        133
152         #endif
153 #elif defined(PANDA_BOARD)
154         #define MODALIAS        "WILC_SPI"
155         #define GPIO_NUM        139
156 #elif defined(PLAT_WMS8304)             /* rachel */
157         #define MODALIAS        "wilc_spi"
158         #define GPIO_NUM        139
159 #elif defined (PLAT_RKXXXX)
160  #define MODALIAS       "WILC_IRQ"
161  #define GPIO_NUM       RK30_PIN3_PD2 /* RK30_PIN3_PA1 */
162 /* RK30_PIN3_PD2 */
163 /* RK2928_PIN1_PA7 */
164
165 #elif defined(CUSTOMER_PLATFORM)
166 /*
167  TODO : specify MODALIAS name and GPIO number. This is certainly necessary for SPI interface.
168  *
169  * ex)
170  * #define MODALIAS  "WILC_SPI"
171  * #define GPIO_NUM  139
172  */
173
174 #else
175 /* base on SAMA5D3_Xplained Board */
176         #define MODALIAS        "WILC_SPI"
177         #define GPIO_NUM        0x44
178 #endif
179
180
181 void linux_wlan_enable_irq(void);
182 #endif