diff options
author | Pekka Enberg <penberg@cs.helsinki.fi> | 2009-04-08 04:51:20 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-19 14:00:38 -0400 |
commit | 22a82bcd5bc99fb7411ea8eca6e926bb0a82a6d5 (patch) | |
tree | 0d143ace060942bef15377350191373f8e6528e8 /drivers/staging | |
parent | c6e523c0cbb610cc59f6afebfdeff751dd4601bd (diff) |
Staging: w35und: merge wbhal.c to wbusb.c
Impact: cleanup
This patch moves all the functions in wbhal.c that are used only in
wbusb.c to the latter file.
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/winbond/wbhal.c | 206 | ||||
-rw-r--r-- | drivers/staging/winbond/wbhal_f.h | 13 | ||||
-rw-r--r-- | drivers/staging/winbond/wbusb.c | 202 |
3 files changed, 202 insertions, 219 deletions
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c index e40fdca4b9f..01626a11088 100644 --- a/drivers/staging/winbond/wbhal.c +++ b/drivers/staging/winbond/wbhal.c | |||
@@ -2,212 +2,6 @@ | |||
2 | #include "wbhal_f.h" | 2 | #include "wbhal_f.h" |
3 | #include "wblinux_f.h" | 3 | #include "wblinux_f.h" |
4 | 4 | ||
5 | void hal_set_ethernet_address(struct hw_data *pHwData, u8 * current_address) | ||
6 | { | ||
7 | u32 ltmp[2]; | ||
8 | |||
9 | if (pHwData->SurpriseRemove) | ||
10 | return; | ||
11 | |||
12 | memcpy(pHwData->CurrentMacAddress, current_address, ETH_ALEN); | ||
13 | |||
14 | ltmp[0] = cpu_to_le32(*(u32 *) pHwData->CurrentMacAddress); | ||
15 | ltmp[1] = | ||
16 | cpu_to_le32(*(u32 *) (pHwData->CurrentMacAddress + 4)) & 0xffff; | ||
17 | |||
18 | Wb35Reg_BurstWrite(pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT); | ||
19 | } | ||
20 | |||
21 | void hal_get_permanent_address(struct hw_data *pHwData, u8 * pethernet_address) | ||
22 | { | ||
23 | if (pHwData->SurpriseRemove) | ||
24 | return; | ||
25 | |||
26 | memcpy(pethernet_address, pHwData->PermanentMacAddress, 6); | ||
27 | } | ||
28 | |||
29 | //--------------------------------------------------------------------------------------------------- | ||
30 | void hal_set_beacon_period(struct hw_data *pHwData, u16 beacon_period) | ||
31 | { | ||
32 | u32 tmp; | ||
33 | |||
34 | if (pHwData->SurpriseRemove) | ||
35 | return; | ||
36 | |||
37 | pHwData->BeaconPeriod = beacon_period; | ||
38 | tmp = pHwData->BeaconPeriod << 16; | ||
39 | tmp |= pHwData->ProbeDelay; | ||
40 | Wb35Reg_Write(pHwData, 0x0848, tmp); | ||
41 | } | ||
42 | |||
43 | static void hal_set_current_channel_ex(struct hw_data *pHwData, | ||
44 | ChanInfo channel) | ||
45 | { | ||
46 | struct wb35_reg *reg = &pHwData->reg; | ||
47 | |||
48 | if (pHwData->SurpriseRemove) | ||
49 | return; | ||
50 | |||
51 | printk("Going to channel: %d/%d\n", channel.band, channel.ChanNo); | ||
52 | |||
53 | RFSynthesizer_SwitchingChannel(pHwData, channel); // Switch channel | ||
54 | pHwData->Channel = channel.ChanNo; | ||
55 | pHwData->band = channel.band; | ||
56 | #ifdef _PE_STATE_DUMP_ | ||
57 | printk("Set channel is %d, band =%d\n", pHwData->Channel, | ||
58 | pHwData->band); | ||
59 | #endif | ||
60 | reg->M28_MacControl &= ~0xff; // Clean channel information field | ||
61 | reg->M28_MacControl |= channel.ChanNo; | ||
62 | Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl, | ||
63 | (s8 *) & channel, sizeof(ChanInfo)); | ||
64 | } | ||
65 | |||
66 | //--------------------------------------------------------------------------------------------------- | ||
67 | void hal_set_current_channel(struct hw_data *pHwData, ChanInfo channel) | ||
68 | { | ||
69 | hal_set_current_channel_ex(pHwData, channel); | ||
70 | } | ||
71 | |||
72 | //--------------------------------------------------------------------------------------------------- | ||
73 | void hal_set_accept_broadcast(struct hw_data *pHwData, u8 enable) | ||
74 | { | ||
75 | struct wb35_reg *reg = &pHwData->reg; | ||
76 | |||
77 | if (pHwData->SurpriseRemove) | ||
78 | return; | ||
79 | |||
80 | reg->M00_MacControl &= ~0x02000000; //The HW value | ||
81 | |||
82 | if (enable) | ||
83 | reg->M00_MacControl |= 0x02000000; //The HW value | ||
84 | |||
85 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
86 | } | ||
87 | |||
88 | //for wep key error detection, we need to accept broadcast packets to be received temporary. | ||
89 | void hal_set_accept_promiscuous(struct hw_data *pHwData, u8 enable) | ||
90 | { | ||
91 | struct wb35_reg *reg = &pHwData->reg; | ||
92 | |||
93 | if (pHwData->SurpriseRemove) | ||
94 | return; | ||
95 | if (enable) { | ||
96 | reg->M00_MacControl |= 0x00400000; | ||
97 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
98 | } else { | ||
99 | reg->M00_MacControl &= ~0x00400000; | ||
100 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
101 | } | ||
102 | } | ||
103 | |||
104 | void hal_set_accept_multicast(struct hw_data *pHwData, u8 enable) | ||
105 | { | ||
106 | struct wb35_reg *reg = &pHwData->reg; | ||
107 | |||
108 | if (pHwData->SurpriseRemove) | ||
109 | return; | ||
110 | |||
111 | reg->M00_MacControl &= ~0x01000000; //The HW value | ||
112 | if (enable) | ||
113 | reg->M00_MacControl |= 0x01000000; //The HW value | ||
114 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
115 | } | ||
116 | |||
117 | void hal_set_accept_beacon(struct hw_data *pHwData, u8 enable) | ||
118 | { | ||
119 | struct wb35_reg *reg = &pHwData->reg; | ||
120 | |||
121 | if (pHwData->SurpriseRemove) | ||
122 | return; | ||
123 | |||
124 | // 20040108 debug | ||
125 | if (!enable) //Due to SME and MLME are not suitable for 35 | ||
126 | return; | ||
127 | |||
128 | reg->M00_MacControl &= ~0x04000000; //The HW value | ||
129 | if (enable) | ||
130 | reg->M00_MacControl |= 0x04000000; //The HW value | ||
131 | |||
132 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
133 | } | ||
134 | |||
135 | //--------------------------------------------------------------------------------------------------- | ||
136 | |||
137 | void hal_stop(struct hw_data *pHwData) | ||
138 | { | ||
139 | struct wb35_reg *reg = &pHwData->reg; | ||
140 | |||
141 | pHwData->Wb35Rx.rx_halt = 1; | ||
142 | Wb35Rx_stop(pHwData); | ||
143 | |||
144 | pHwData->Wb35Tx.tx_halt = 1; | ||
145 | Wb35Tx_stop(pHwData); | ||
146 | |||
147 | reg->D00_DmaControl &= ~0xc0000000; //Tx Off, Rx Off | ||
148 | Wb35Reg_Write(pHwData, 0x0400, reg->D00_DmaControl); | ||
149 | } | ||
150 | |||
151 | unsigned char hal_idle(struct hw_data *pHwData) | ||
152 | { | ||
153 | struct wb35_reg *reg = &pHwData->reg; | ||
154 | struct wb_usb *pWbUsb = &pHwData->WbUsb; | ||
155 | |||
156 | if (!pHwData->SurpriseRemove | ||
157 | && (pWbUsb->DetectCount || reg->EP0vm_state != VM_STOP)) | ||
158 | return false; | ||
159 | |||
160 | return true; | ||
161 | } | ||
162 | |||
163 | void hal_set_radio_mode(struct hw_data *pHwData, unsigned char radio_off) | ||
164 | { | ||
165 | struct wb35_reg *reg = &pHwData->reg; | ||
166 | |||
167 | if (pHwData->SurpriseRemove) | ||
168 | return; | ||
169 | |||
170 | if (radio_off) //disable Baseband receive off | ||
171 | { | ||
172 | pHwData->CurrentRadioSw = 1; // off | ||
173 | reg->M24_MacControl &= 0xffffffbf; | ||
174 | } else { | ||
175 | pHwData->CurrentRadioSw = 0; // on | ||
176 | reg->M24_MacControl |= 0x00000040; | ||
177 | } | ||
178 | Wb35Reg_Write(pHwData, 0x0824, reg->M24_MacControl); | ||
179 | } | ||
180 | |||
181 | u8 hal_get_antenna_number(struct hw_data *pHwData) | ||
182 | { | ||
183 | struct wb35_reg *reg = &pHwData->reg; | ||
184 | |||
185 | if ((reg->BB2C & BIT(11)) == 0) | ||
186 | return 0; | ||
187 | else | ||
188 | return 1; | ||
189 | } | ||
190 | |||
191 | //---------------------------------------------------------------------------------------------------- | ||
192 | //0 : radio on; 1: radio off | ||
193 | u8 hal_get_hw_radio_off(struct hw_data * pHwData) | ||
194 | { | ||
195 | struct wb35_reg *reg = &pHwData->reg; | ||
196 | |||
197 | if (pHwData->SurpriseRemove) | ||
198 | return 1; | ||
199 | |||
200 | //read the bit16 of register U1B0 | ||
201 | Wb35Reg_Read(pHwData, 0x3b0, ®->U1B0); | ||
202 | if ((reg->U1B0 & 0x00010000)) { | ||
203 | pHwData->CurrentRadioHw = 1; | ||
204 | return 1; | ||
205 | } else { | ||
206 | pHwData->CurrentRadioHw = 0; | ||
207 | return 0; | ||
208 | } | ||
209 | } | ||
210 | |||
211 | unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue) | 5 | unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue) |
212 | { | 6 | { |
213 | if (number < 0x1000) | 7 | if (number < 0x1000) |
diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h index bdea22fbbc2..c4934cbe0c6 100644 --- a/drivers/staging/winbond/wbhal_f.h +++ b/drivers/staging/winbond/wbhal_f.h | |||
@@ -18,9 +18,6 @@ void hal_clear_all_default_key( struct hw_data * pHwData ); | |||
18 | void hal_clear_all_group_key( struct hw_data * pHwData ); | 18 | void hal_clear_all_group_key( struct hw_data * pHwData ); |
19 | void hal_clear_all_mapping_key( struct hw_data * pHwData ); | 19 | void hal_clear_all_mapping_key( struct hw_data * pHwData ); |
20 | void hal_clear_all_key( struct hw_data * pHwData ); | 20 | void hal_clear_all_key( struct hw_data * pHwData ); |
21 | void hal_get_ethernet_address( struct hw_data * pHwData, u8 *current_address ); | ||
22 | void hal_set_ethernet_address( struct hw_data * pHwData, u8 *current_address ); | ||
23 | void hal_get_permanent_address( struct hw_data * pHwData, u8 *pethernet_address ); | ||
24 | void hal_set_power_save_mode( struct hw_data * pHwData, unsigned char power_save, unsigned char wakeup, unsigned char dtim ); | 21 | void hal_set_power_save_mode( struct hw_data * pHwData, unsigned char power_save, unsigned char wakeup, unsigned char dtim ); |
25 | void hal_get_power_save_mode( struct hw_data * pHwData, u8 *pin_pwr_save ); | 22 | void hal_get_power_save_mode( struct hw_data * pHwData, u8 *pin_pwr_save ); |
26 | void hal_set_slot_time( struct hw_data * pHwData, u8 type ); | 23 | void hal_set_slot_time( struct hw_data * pHwData, u8 type ); |
@@ -32,15 +29,9 @@ void hal_resume_sync_bss( struct hw_data * pHwData); | |||
32 | void hal_set_aid( struct hw_data * pHwData, u16 aid ); | 29 | void hal_set_aid( struct hw_data * pHwData, u16 aid ); |
33 | void hal_set_bssid( struct hw_data * pHwData, u8 *pbssid ); | 30 | void hal_set_bssid( struct hw_data * pHwData, u8 *pbssid ); |
34 | void hal_get_bssid( struct hw_data * pHwData, u8 *pbssid ); | 31 | void hal_get_bssid( struct hw_data * pHwData, u8 *pbssid ); |
35 | void hal_set_beacon_period( struct hw_data * pHwData, u16 beacon_period ); | ||
36 | void hal_set_listen_interval( struct hw_data * pHwData, u16 listen_interval ); | 32 | void hal_set_listen_interval( struct hw_data * pHwData, u16 listen_interval ); |
37 | void hal_set_cap_info( struct hw_data * pHwData, u16 capability_info ); | 33 | void hal_set_cap_info( struct hw_data * pHwData, u16 capability_info ); |
38 | void hal_set_ssid( struct hw_data * pHwData, u8 *pssid, u8 ssid_len ); | 34 | void hal_set_ssid( struct hw_data * pHwData, u8 *pssid, u8 ssid_len ); |
39 | void hal_set_current_channel( struct hw_data * pHwData, ChanInfo channel ); | ||
40 | void hal_set_accept_broadcast( struct hw_data * pHwData, u8 enable ); | ||
41 | void hal_set_accept_multicast( struct hw_data * pHwData, u8 enable ); | ||
42 | void hal_set_accept_beacon( struct hw_data * pHwData, u8 enable ); | ||
43 | void hal_stop( struct hw_data * pHwData ); | ||
44 | void hal_start_tx0( struct hw_data * pHwData ); | 35 | void hal_start_tx0( struct hw_data * pHwData ); |
45 | #define hal_get_cwmin( _A ) ( (_A)->cwmin ) | 36 | #define hal_get_cwmin( _A ) ( (_A)->cwmin ) |
46 | void hal_set_cwmax( struct hw_data * pHwData, u16 cwin_max ); | 37 | void hal_set_cwmax( struct hw_data * pHwData, u16 cwin_max ); |
@@ -49,14 +40,11 @@ void hal_set_rsn_wpa( struct hw_data * pHwData, u32 * RSN_IE_Bitmap , u32 * RS | |||
49 | void hal_set_connect_info( struct hw_data * pHwData, unsigned char boConnect ); | 40 | void hal_set_connect_info( struct hw_data * pHwData, unsigned char boConnect ); |
50 | u8 hal_get_est_sq3( struct hw_data * pHwData, u8 Count ); | 41 | u8 hal_get_est_sq3( struct hw_data * pHwData, u8 Count ); |
51 | void hal_set_rf_power( struct hw_data * pHwData, u8 PowerIndex ); // 20060621 Modify | 42 | void hal_set_rf_power( struct hw_data * pHwData, u8 PowerIndex ); // 20060621 Modify |
52 | void hal_set_radio_mode( struct hw_data * pHwData, unsigned char boValue); | ||
53 | void hal_descriptor_indicate( struct hw_data * pHwData, PDESCRIPTOR pDes ); | 43 | void hal_descriptor_indicate( struct hw_data * pHwData, PDESCRIPTOR pDes ); |
54 | u8 hal_get_antenna_number( struct hw_data * pHwData ); | 44 | u8 hal_get_antenna_number( struct hw_data * pHwData ); |
55 | u32 hal_get_bss_pk_cnt( struct hw_data * pHwData ); | 45 | u32 hal_get_bss_pk_cnt( struct hw_data * pHwData ); |
56 | #define hal_get_region_from_EEPROM( _A ) ( (_A)->reg.EEPROMRegion ) | 46 | #define hal_get_region_from_EEPROM( _A ) ( (_A)->reg.EEPROMRegion ) |
57 | void hal_set_accept_promiscuous ( struct hw_data * pHwData, u8 enable); | ||
58 | #define hal_get_tx_buffer( _A, _B ) Wb35Tx_get_tx_buffer( _A, _B ) | 47 | #define hal_get_tx_buffer( _A, _B ) Wb35Tx_get_tx_buffer( _A, _B ) |
59 | u8 hal_get_hw_radio_off ( struct hw_data * pHwData ); | ||
60 | #define hal_software_set( _A ) (_A->SoftwareSet) | 48 | #define hal_software_set( _A ) (_A->SoftwareSet) |
61 | #define hal_driver_init_OK( _A ) (_A->IsInitOK) | 49 | #define hal_driver_init_OK( _A ) (_A->IsInitOK) |
62 | #define hal_rssi_boundary_high( _A ) (_A->RSSI_high) | 50 | #define hal_rssi_boundary_high( _A ) (_A->RSSI_high) |
@@ -79,7 +67,6 @@ unsigned char hal_set_dxx_reg( struct hw_data * pHwData, u16 number, u32 valu | |||
79 | #define hal_get_clear_interrupt(_A) | 67 | #define hal_get_clear_interrupt(_A) |
80 | #define hal_ibss_disconnect(_A) hal_stop_sync_bss(_A) | 68 | #define hal_ibss_disconnect(_A) hal_stop_sync_bss(_A) |
81 | #define hal_join_request_stop(_A) | 69 | #define hal_join_request_stop(_A) |
82 | unsigned char hal_idle( struct hw_data * pHwData ); | ||
83 | #define hw_get_cxx_reg( _A, _B, _C ) | 70 | #define hw_get_cxx_reg( _A, _B, _C ) |
84 | #define hw_set_cxx_reg( _A, _B, _C ) | 71 | #define hw_set_cxx_reg( _A, _B, _C ) |
85 | #define hw_get_dxx_reg( _A, _B, _C ) hal_get_dxx_reg( _A, _B, (u32 *)_C ) | 72 | #define hw_get_dxx_reg( _A, _B, _C ) hal_get_dxx_reg( _A, _B, (u32 *)_C ) |
diff --git a/drivers/staging/winbond/wbusb.c b/drivers/staging/winbond/wbusb.c index c5fd054c0fa..c46ff4717b1 100644 --- a/drivers/staging/winbond/wbusb.c +++ b/drivers/staging/winbond/wbusb.c | |||
@@ -120,6 +120,127 @@ static int wbsoft_start(struct ieee80211_hw *dev) | |||
120 | return 0; | 120 | return 0; |
121 | } | 121 | } |
122 | 122 | ||
123 | static void hal_set_radio_mode(struct hw_data *pHwData, unsigned char radio_off) | ||
124 | { | ||
125 | struct wb35_reg *reg = &pHwData->reg; | ||
126 | |||
127 | if (pHwData->SurpriseRemove) | ||
128 | return; | ||
129 | |||
130 | if (radio_off) //disable Baseband receive off | ||
131 | { | ||
132 | pHwData->CurrentRadioSw = 1; // off | ||
133 | reg->M24_MacControl &= 0xffffffbf; | ||
134 | } else { | ||
135 | pHwData->CurrentRadioSw = 0; // on | ||
136 | reg->M24_MacControl |= 0x00000040; | ||
137 | } | ||
138 | Wb35Reg_Write(pHwData, 0x0824, reg->M24_MacControl); | ||
139 | } | ||
140 | |||
141 | static void hal_set_beacon_period(struct hw_data *pHwData, u16 beacon_period) | ||
142 | { | ||
143 | u32 tmp; | ||
144 | |||
145 | if (pHwData->SurpriseRemove) | ||
146 | return; | ||
147 | |||
148 | pHwData->BeaconPeriod = beacon_period; | ||
149 | tmp = pHwData->BeaconPeriod << 16; | ||
150 | tmp |= pHwData->ProbeDelay; | ||
151 | Wb35Reg_Write(pHwData, 0x0848, tmp); | ||
152 | } | ||
153 | |||
154 | static void | ||
155 | hal_set_current_channel_ex(struct hw_data *pHwData, ChanInfo channel) | ||
156 | { | ||
157 | struct wb35_reg *reg = &pHwData->reg; | ||
158 | |||
159 | if (pHwData->SurpriseRemove) | ||
160 | return; | ||
161 | |||
162 | printk("Going to channel: %d/%d\n", channel.band, channel.ChanNo); | ||
163 | |||
164 | RFSynthesizer_SwitchingChannel(pHwData, channel); // Switch channel | ||
165 | pHwData->Channel = channel.ChanNo; | ||
166 | pHwData->band = channel.band; | ||
167 | #ifdef _PE_STATE_DUMP_ | ||
168 | printk("Set channel is %d, band =%d\n", pHwData->Channel, | ||
169 | pHwData->band); | ||
170 | #endif | ||
171 | reg->M28_MacControl &= ~0xff; // Clean channel information field | ||
172 | reg->M28_MacControl |= channel.ChanNo; | ||
173 | Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl, | ||
174 | (s8 *) & channel, sizeof(ChanInfo)); | ||
175 | } | ||
176 | |||
177 | static void hal_set_current_channel(struct hw_data *pHwData, ChanInfo channel) | ||
178 | { | ||
179 | hal_set_current_channel_ex(pHwData, channel); | ||
180 | } | ||
181 | |||
182 | static void hal_set_accept_broadcast(struct hw_data *pHwData, u8 enable) | ||
183 | { | ||
184 | struct wb35_reg *reg = &pHwData->reg; | ||
185 | |||
186 | if (pHwData->SurpriseRemove) | ||
187 | return; | ||
188 | |||
189 | reg->M00_MacControl &= ~0x02000000; //The HW value | ||
190 | |||
191 | if (enable) | ||
192 | reg->M00_MacControl |= 0x02000000; //The HW value | ||
193 | |||
194 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
195 | } | ||
196 | |||
197 | //for wep key error detection, we need to accept broadcast packets to be received temporary. | ||
198 | static void hal_set_accept_promiscuous(struct hw_data *pHwData, u8 enable) | ||
199 | { | ||
200 | struct wb35_reg *reg = &pHwData->reg; | ||
201 | |||
202 | if (pHwData->SurpriseRemove) | ||
203 | return; | ||
204 | if (enable) { | ||
205 | reg->M00_MacControl |= 0x00400000; | ||
206 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
207 | } else { | ||
208 | reg->M00_MacControl &= ~0x00400000; | ||
209 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
210 | } | ||
211 | } | ||
212 | |||
213 | static void hal_set_accept_multicast(struct hw_data *pHwData, u8 enable) | ||
214 | { | ||
215 | struct wb35_reg *reg = &pHwData->reg; | ||
216 | |||
217 | if (pHwData->SurpriseRemove) | ||
218 | return; | ||
219 | |||
220 | reg->M00_MacControl &= ~0x01000000; //The HW value | ||
221 | if (enable) | ||
222 | reg->M00_MacControl |= 0x01000000; //The HW value | ||
223 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
224 | } | ||
225 | |||
226 | static void hal_set_accept_beacon(struct hw_data *pHwData, u8 enable) | ||
227 | { | ||
228 | struct wb35_reg *reg = &pHwData->reg; | ||
229 | |||
230 | if (pHwData->SurpriseRemove) | ||
231 | return; | ||
232 | |||
233 | // 20040108 debug | ||
234 | if (!enable) //Due to SME and MLME are not suitable for 35 | ||
235 | return; | ||
236 | |||
237 | reg->M00_MacControl &= ~0x04000000; //The HW value | ||
238 | if (enable) | ||
239 | reg->M00_MacControl |= 0x04000000; //The HW value | ||
240 | |||
241 | Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl); | ||
242 | } | ||
243 | |||
123 | static int wbsoft_config(struct ieee80211_hw *dev, u32 changed) | 244 | static int wbsoft_config(struct ieee80211_hw *dev, u32 changed) |
124 | { | 245 | { |
125 | struct wbsoft_priv *priv = dev->priv; | 246 | struct wbsoft_priv *priv = dev->priv; |
@@ -171,6 +292,87 @@ static const struct ieee80211_ops wbsoft_ops = { | |||
171 | .get_tsf = wbsoft_get_tsf, | 292 | .get_tsf = wbsoft_get_tsf, |
172 | }; | 293 | }; |
173 | 294 | ||
295 | static void | ||
296 | hal_set_ethernet_address(struct hw_data *pHwData, u8 * current_address) | ||
297 | { | ||
298 | u32 ltmp[2]; | ||
299 | |||
300 | if (pHwData->SurpriseRemove) | ||
301 | return; | ||
302 | |||
303 | memcpy(pHwData->CurrentMacAddress, current_address, ETH_ALEN); | ||
304 | |||
305 | ltmp[0] = cpu_to_le32(*(u32 *) pHwData->CurrentMacAddress); | ||
306 | ltmp[1] = | ||
307 | cpu_to_le32(*(u32 *) (pHwData->CurrentMacAddress + 4)) & 0xffff; | ||
308 | |||
309 | Wb35Reg_BurstWrite(pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT); | ||
310 | } | ||
311 | |||
312 | static void | ||
313 | hal_get_permanent_address(struct hw_data *pHwData, u8 * pethernet_address) | ||
314 | { | ||
315 | if (pHwData->SurpriseRemove) | ||
316 | return; | ||
317 | |||
318 | memcpy(pethernet_address, pHwData->PermanentMacAddress, 6); | ||
319 | } | ||
320 | |||
321 | static void hal_stop(struct hw_data *pHwData) | ||
322 | { | ||
323 | struct wb35_reg *reg = &pHwData->reg; | ||
324 | |||
325 | pHwData->Wb35Rx.rx_halt = 1; | ||
326 | Wb35Rx_stop(pHwData); | ||
327 | |||
328 | pHwData->Wb35Tx.tx_halt = 1; | ||
329 | Wb35Tx_stop(pHwData); | ||
330 | |||
331 | reg->D00_DmaControl &= ~0xc0000000; //Tx Off, Rx Off | ||
332 | Wb35Reg_Write(pHwData, 0x0400, reg->D00_DmaControl); | ||
333 | } | ||
334 | |||
335 | static unsigned char hal_idle(struct hw_data *pHwData) | ||
336 | { | ||
337 | struct wb35_reg *reg = &pHwData->reg; | ||
338 | struct wb_usb *pWbUsb = &pHwData->WbUsb; | ||
339 | |||
340 | if (!pHwData->SurpriseRemove | ||
341 | && (pWbUsb->DetectCount || reg->EP0vm_state != VM_STOP)) | ||
342 | return false; | ||
343 | |||
344 | return true; | ||
345 | } | ||
346 | |||
347 | u8 hal_get_antenna_number(struct hw_data *pHwData) | ||
348 | { | ||
349 | struct wb35_reg *reg = &pHwData->reg; | ||
350 | |||
351 | if ((reg->BB2C & BIT(11)) == 0) | ||
352 | return 0; | ||
353 | else | ||
354 | return 1; | ||
355 | } | ||
356 | |||
357 | /* 0 : radio on; 1: radio off */ | ||
358 | static u8 hal_get_hw_radio_off(struct hw_data * pHwData) | ||
359 | { | ||
360 | struct wb35_reg *reg = &pHwData->reg; | ||
361 | |||
362 | if (pHwData->SurpriseRemove) | ||
363 | return 1; | ||
364 | |||
365 | //read the bit16 of register U1B0 | ||
366 | Wb35Reg_Read(pHwData, 0x3b0, ®->U1B0); | ||
367 | if ((reg->U1B0 & 0x00010000)) { | ||
368 | pHwData->CurrentRadioHw = 1; | ||
369 | return 1; | ||
370 | } else { | ||
371 | pHwData->CurrentRadioHw = 0; | ||
372 | return 0; | ||
373 | } | ||
374 | } | ||
375 | |||
174 | static u8 LED_GRAY[20] = { | 376 | static u8 LED_GRAY[20] = { |
175 | 0, 3, 4, 6, 8, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 8, 6, 4, 2 | 377 | 0, 3, 4, 6, 8, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 8, 6, 4, 2 |
176 | }; | 378 | }; |