aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/wilc1000/linux_wlan_common.h
blob: 5d40f05124c1cdecbdf76a05d926529ce5e32ad4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#ifndef LINUX_WLAN_COMMON_H
#define LINUX_WLAN_COMMON_H

enum debug_region {
	Generic_debug = 0,
	Hostapd_debug,
	Hostinf_debug,
	CFG80211_debug,
	Coreconfig_debug,
	Interrupt_debug,
	TX_debug,
	RX_debug,
	Lock_debug,
	Tcp_enhance,
	Spin_debug,

	Init_debug,
	Bus_debug,
	Mem_debug,
	Firmware_debug,
	COMP = 0xFFFFFFFF,
};

#define GENERIC_DBG             (1 << Generic_debug)
#define HOSTAPD_DBG             (1 << Hostapd_debug)
#define HOSTINF_DBG             (1 << Hostinf_debug)
#define CORECONFIG_DBG          (1 << Coreconfig_debug)
#define CFG80211_DBG            (1 << CFG80211_debug)
#define INT_DBG                 (1 << Interrupt_debug)
#define TX_DBG                  (1 << TX_debug)
#define RX_DBG                  (1 << RX_debug)
#define LOCK_DBG                (1 << Lock_debug)
#define TCP_ENH                 (1 << Tcp_enhance)
#define SPIN_DEBUG              (1 << Spin_debug)
#define INIT_DBG                (1 << Init_debug)
#define BUS_DBG                 (1 << Bus_debug)
#define MEM_DBG                 (1 << Mem_debug)
#define FIRM_DBG                (1 << Firmware_debug)

#if defined (WILC_DEBUGFS)
extern atomic_t WILC_REGION;
extern atomic_t WILC_DEBUG_LEVEL;

#define DEBUG           BIT(0)
#define INFO            BIT(1)
#define WRN             BIT(2)
#define ERR             BIT(3)

#define PRINT_D(region, ...)						\
	do {								\
		if ((atomic_read(&WILC_DEBUG_LEVEL) & DEBUG) &&	\
		   ((atomic_read(&WILC_REGION)) & (region))) {	\
			printk("DBG [%s: %d]", __func__, __LINE__);	\
			printk(__VA_ARGS__);				\
		}							\
	} while (0)

#define PRINT_INFO(region, ...)						\
	do {								\
		if ((atomic_read(&WILC_DEBUG_LEVEL) & INFO) &&	\
		   ((atomic_read(&WILC_REGION)) & (region))) {	\
			printk("INFO [%s]", __func__);			\
			printk(__VA_ARGS__);				\
		}							\
	} while (0)

#define PRINT_WRN(region, ...)						\
	do {								\
		if ((atomic_read(&WILC_DEBUG_LEVEL) & WRN) &&	\
		   ((atomic_read(&WILC_REGION)) & (region))) {	\
			printk("WRN [%s: %d]", __func__, __LINE__);	\
			printk(__VA_ARGS__);				\
		}							\
	} while (0)

#define PRINT_ER(...)							\
	do {								\
		if ((atomic_read(&WILC_DEBUG_LEVEL) & ERR)) {	\
			printk("ERR [%s: %d]", __func__, __LINE__);	\
			printk(__VA_ARGS__);				\
		}							\
	} while (0)

#else

#define REGION  (INIT_DBG | GENERIC_DBG | CFG80211_DBG | FIRM_DBG | HOSTAPD_DBG)

#define DEBUG       1
#define INFO        0
#define WRN         0

#define PRINT_D(region, ...)						\
	do {								\
		if (DEBUG == 1 && ((REGION)&(region))) {		\
			printk("DBG [%s: %d]", __func__, __LINE__);	\
			printk(__VA_ARGS__);				\
		}							\
	} while (0)

#define PRINT_INFO(region, ...)						\
	do {								\
		if (INFO == 1 && ((REGION)&(region))) {			\
			printk("INFO [%s]", __func__);			\
			printk(__VA_ARGS__);				\
		}							\
	} while (0)

#define PRINT_WRN(region, ...)						\
	do {								\
		if (WRN == 1 && ((REGION)&(region))) {			\
			printk("WRN [%s: %d]", __func__, __LINE__);	\
			printk(__VA_ARGS__);				\
		}							\
	} while (0)

#define PRINT_ER(...)							\
	do {								\
		printk("ERR [%s: %d]", __func__, __LINE__);		\
		printk(__VA_ARGS__);					\
	} while (0)

#endif

#define FN_IN   /* PRINT_D(">>> \n") */
#define FN_OUT  /* PRINT_D("<<<\n") */

#define LINUX_RX_SIZE	(96 * 1024)
#define LINUX_TX_SIZE	(64 * 1024)


#define WILC_MULTICAST_TABLE_SIZE	8

#if defined (BEAGLE_BOARD)
	#define SPI_CHANNEL	4

	#if SPI_CHANNEL == 4
		#define MODALIAS	"wilc_spi4"
		#define GPIO_NUM	162
	#else
		#define MODALIAS	"wilc_spi3"
		#define GPIO_NUM	133
	#endif
#elif defined(PLAT_WMS8304)             /* rachel */
	#define MODALIAS	"wilc_spi"
	#define GPIO_NUM	139
#elif defined (PLAT_RKXXXX)
 #define MODALIAS	"WILC_IRQ"
 #define GPIO_NUM	RK30_PIN3_PD2 /* RK30_PIN3_PA1 */
/* RK30_PIN3_PD2 */
/* RK2928_PIN1_PA7 */

#elif defined(CUSTOMER_PLATFORM)
/*
 TODO : specify MODALIAS name and GPIO number. This is certainly necessary for SPI interface.
 *
 * ex)
 * #define MODALIAS  "WILC_SPI"
 * #define GPIO_NUM  139
 */

#else
/* base on SAMA5D3_Xplained Board */
	#define MODALIAS	"WILC_SPI"
	#define GPIO_NUM	0x44
#endif
#endif