* [PATCH 1/4] w35und: reformat wbhal.c
@ 2009-04-08 8:51 Pekka Enberg
2009-04-08 8:51 ` [PATCH 2/4] w35und: merge wbhal.c to wbusb.c Pekka Enberg
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Pekka Enberg @ 2009-04-08 8:51 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pavel Machek
Impact: cleanup
In preparation for merging wbhal.c with wbusb.c, use Lindet to reformat
the file.
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/wbhal.c | 166 +++++++++++++++++++++------------------
1 files changed, 90 insertions(+), 76 deletions(-)
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
index 14253f0..e40fdca 100644
--- a/drivers/staging/winbond/wbhal.c
+++ b/drivers/staging/winbond/wbhal.c
@@ -2,170 +2,183 @@
#include "wbhal_f.h"
#include "wblinux_f.h"
-void hal_set_ethernet_address( struct hw_data * pHwData, u8 *current_address )
+void hal_set_ethernet_address(struct hw_data *pHwData, u8 * current_address)
{
u32 ltmp[2];
- if( pHwData->SurpriseRemove ) return;
+ if (pHwData->SurpriseRemove)
+ return;
- memcpy( pHwData->CurrentMacAddress, current_address, ETH_ALEN );
+ memcpy(pHwData->CurrentMacAddress, current_address, ETH_ALEN);
- ltmp[0]= cpu_to_le32( *(u32 *)pHwData->CurrentMacAddress );
- ltmp[1]= cpu_to_le32( *(u32 *)(pHwData->CurrentMacAddress + 4) ) & 0xffff;
+ ltmp[0] = cpu_to_le32(*(u32 *) pHwData->CurrentMacAddress);
+ ltmp[1] =
+ cpu_to_le32(*(u32 *) (pHwData->CurrentMacAddress + 4)) & 0xffff;
- Wb35Reg_BurstWrite( pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT );
+ Wb35Reg_BurstWrite(pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT);
}
-void hal_get_permanent_address( struct hw_data * pHwData, u8 *pethernet_address )
+void hal_get_permanent_address(struct hw_data *pHwData, u8 * pethernet_address)
{
- if( pHwData->SurpriseRemove ) return;
+ if (pHwData->SurpriseRemove)
+ return;
- memcpy( pethernet_address, pHwData->PermanentMacAddress, 6 );
+ memcpy(pethernet_address, pHwData->PermanentMacAddress, 6);
}
//---------------------------------------------------------------------------------------------------
-void hal_set_beacon_period( struct hw_data * pHwData, u16 beacon_period )
+void hal_set_beacon_period(struct hw_data *pHwData, u16 beacon_period)
{
- u32 tmp;
+ u32 tmp;
- if( pHwData->SurpriseRemove ) return;
+ if (pHwData->SurpriseRemove)
+ return;
pHwData->BeaconPeriod = beacon_period;
tmp = pHwData->BeaconPeriod << 16;
tmp |= pHwData->ProbeDelay;
- Wb35Reg_Write( pHwData, 0x0848, tmp );
+ Wb35Reg_Write(pHwData, 0x0848, tmp);
}
-
-static void hal_set_current_channel_ex( struct hw_data * pHwData, ChanInfo channel )
+static void hal_set_current_channel_ex(struct hw_data *pHwData,
+ ChanInfo channel)
{
struct wb35_reg *reg = &pHwData->reg;
- if( pHwData->SurpriseRemove )
+ if (pHwData->SurpriseRemove)
return;
printk("Going to channel: %d/%d\n", channel.band, channel.ChanNo);
- RFSynthesizer_SwitchingChannel( pHwData, channel );// Switch channel
+ RFSynthesizer_SwitchingChannel(pHwData, channel); // Switch channel
pHwData->Channel = channel.ChanNo;
pHwData->band = channel.band;
- #ifdef _PE_STATE_DUMP_
- printk("Set channel is %d, band =%d\n", pHwData->Channel, pHwData->band);
- #endif
- reg->M28_MacControl &= ~0xff; // Clean channel information field
+#ifdef _PE_STATE_DUMP_
+ printk("Set channel is %d, band =%d\n", pHwData->Channel,
+ pHwData->band);
+#endif
+ reg->M28_MacControl &= ~0xff; // Clean channel information field
reg->M28_MacControl |= channel.ChanNo;
- Wb35Reg_WriteWithCallbackValue( pHwData, 0x0828, reg->M28_MacControl,
- (s8 *)&channel, sizeof(ChanInfo));
+ Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl,
+ (s8 *) & channel, sizeof(ChanInfo));
}
+
//---------------------------------------------------------------------------------------------------
-void hal_set_current_channel( struct hw_data * pHwData, ChanInfo channel )
+void hal_set_current_channel(struct hw_data *pHwData, ChanInfo channel)
{
- hal_set_current_channel_ex( pHwData, channel );
+ hal_set_current_channel_ex(pHwData, channel);
}
+
//---------------------------------------------------------------------------------------------------
-void hal_set_accept_broadcast( struct hw_data * pHwData, u8 enable )
+void hal_set_accept_broadcast(struct hw_data *pHwData, u8 enable)
{
struct wb35_reg *reg = &pHwData->reg;
- if( pHwData->SurpriseRemove ) return;
+ if (pHwData->SurpriseRemove)
+ return;
- reg->M00_MacControl &= ~0x02000000;//The HW value
+ reg->M00_MacControl &= ~0x02000000; //The HW value
if (enable)
- reg->M00_MacControl |= 0x02000000;//The HW value
+ reg->M00_MacControl |= 0x02000000; //The HW value
- Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl );
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
}
//for wep key error detection, we need to accept broadcast packets to be received temporary.
-void hal_set_accept_promiscuous( struct hw_data * pHwData, u8 enable)
+void hal_set_accept_promiscuous(struct hw_data *pHwData, u8 enable)
{
struct wb35_reg *reg = &pHwData->reg;
- if (pHwData->SurpriseRemove) return;
+ if (pHwData->SurpriseRemove)
+ return;
if (enable) {
reg->M00_MacControl |= 0x00400000;
- Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl );
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
} else {
- reg->M00_MacControl&=~0x00400000;
- Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl );
+ reg->M00_MacControl &= ~0x00400000;
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
}
}
-void hal_set_accept_multicast( struct hw_data * pHwData, u8 enable )
+void hal_set_accept_multicast(struct hw_data *pHwData, u8 enable)
{
struct wb35_reg *reg = &pHwData->reg;
- if( pHwData->SurpriseRemove ) return;
+ if (pHwData->SurpriseRemove)
+ return;
- reg->M00_MacControl &= ~0x01000000;//The HW value
- if (enable) reg->M00_MacControl |= 0x01000000;//The HW value
- Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl );
+ reg->M00_MacControl &= ~0x01000000; //The HW value
+ if (enable)
+ reg->M00_MacControl |= 0x01000000; //The HW value
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
}
-void hal_set_accept_beacon( struct hw_data * pHwData, u8 enable )
+void hal_set_accept_beacon(struct hw_data *pHwData, u8 enable)
{
struct wb35_reg *reg = &pHwData->reg;
- if( pHwData->SurpriseRemove ) return;
+ if (pHwData->SurpriseRemove)
+ return;
// 20040108 debug
- if( !enable )//Due to SME and MLME are not suitable for 35
+ if (!enable) //Due to SME and MLME are not suitable for 35
return;
- reg->M00_MacControl &= ~0x04000000;//The HW value
- if( enable )
- reg->M00_MacControl |= 0x04000000;//The HW value
+ reg->M00_MacControl &= ~0x04000000; //The HW value
+ if (enable)
+ reg->M00_MacControl |= 0x04000000; //The HW value
- Wb35Reg_Write( pHwData, 0x0800, reg->M00_MacControl );
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
}
+
//---------------------------------------------------------------------------------------------------
-void hal_stop( struct hw_data * pHwData )
+void hal_stop(struct hw_data *pHwData)
{
struct wb35_reg *reg = &pHwData->reg;
pHwData->Wb35Rx.rx_halt = 1;
- Wb35Rx_stop( pHwData );
+ Wb35Rx_stop(pHwData);
pHwData->Wb35Tx.tx_halt = 1;
- Wb35Tx_stop( pHwData );
+ Wb35Tx_stop(pHwData);
- reg->D00_DmaControl &= ~0xc0000000;//Tx Off, Rx Off
- Wb35Reg_Write( pHwData, 0x0400, reg->D00_DmaControl );
+ reg->D00_DmaControl &= ~0xc0000000; //Tx Off, Rx Off
+ Wb35Reg_Write(pHwData, 0x0400, reg->D00_DmaControl);
}
-unsigned char hal_idle(struct hw_data * pHwData)
+unsigned char hal_idle(struct hw_data *pHwData)
{
struct wb35_reg *reg = &pHwData->reg;
struct wb_usb *pWbUsb = &pHwData->WbUsb;
- if( !pHwData->SurpriseRemove && ( pWbUsb->DetectCount || reg->EP0vm_state!=VM_STOP ) )
+ if (!pHwData->SurpriseRemove
+ && (pWbUsb->DetectCount || reg->EP0vm_state != VM_STOP))
return false;
return true;
}
-void hal_set_radio_mode( struct hw_data * pHwData, unsigned char radio_off)
+void hal_set_radio_mode(struct hw_data *pHwData, unsigned char radio_off)
{
struct wb35_reg *reg = &pHwData->reg;
- if( pHwData->SurpriseRemove ) return;
+ if (pHwData->SurpriseRemove)
+ return;
- if (radio_off) //disable Baseband receive off
+ if (radio_off) //disable Baseband receive off
{
- pHwData->CurrentRadioSw = 1; // off
+ pHwData->CurrentRadioSw = 1; // off
reg->M24_MacControl &= 0xffffffbf;
- }
- else
- {
- pHwData->CurrentRadioSw = 0; // on
+ } else {
+ pHwData->CurrentRadioSw = 0; // on
reg->M24_MacControl |= 0x00000040;
}
- Wb35Reg_Write( pHwData, 0x0824, reg->M24_MacControl );
+ Wb35Reg_Write(pHwData, 0x0824, reg->M24_MacControl);
}
-u8 hal_get_antenna_number( struct hw_data * pHwData )
+u8 hal_get_antenna_number(struct hw_data *pHwData)
{
struct wb35_reg *reg = &pHwData->reg;
@@ -177,14 +190,15 @@ u8 hal_get_antenna_number( struct hw_data * pHwData )
//----------------------------------------------------------------------------------------------------
//0 : radio on; 1: radio off
-u8 hal_get_hw_radio_off( struct hw_data * pHwData )
+u8 hal_get_hw_radio_off(struct hw_data * pHwData)
{
struct wb35_reg *reg = &pHwData->reg;
- if( pHwData->SurpriseRemove ) return 1;
+ if (pHwData->SurpriseRemove)
+ return 1;
//read the bit16 of register U1B0
- Wb35Reg_Read( pHwData, 0x3b0, ®->U1B0 );
+ Wb35Reg_Read(pHwData, 0x3b0, ®->U1B0);
if ((reg->U1B0 & 0x00010000)) {
pHwData->CurrentRadioHw = 1;
return 1;
@@ -194,24 +208,24 @@ u8 hal_get_hw_radio_off( struct hw_data * pHwData )
}
}
-unsigned char hal_get_dxx_reg( struct hw_data * pHwData, u16 number, u32 * pValue )
+unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue)
{
- if( number < 0x1000 )
+ if (number < 0x1000)
number += 0x1000;
- return Wb35Reg_ReadSync( pHwData, number, pValue );
+ return Wb35Reg_ReadSync(pHwData, number, pValue);
}
-unsigned char hal_set_dxx_reg( struct hw_data * pHwData, u16 number, u32 value )
+unsigned char hal_set_dxx_reg(struct hw_data *pHwData, u16 number, u32 value)
{
- unsigned char ret;
+ unsigned char ret;
- if( number < 0x1000 )
+ if (number < 0x1000)
number += 0x1000;
- ret = Wb35Reg_WriteSync( pHwData, number, value );
+ ret = Wb35Reg_WriteSync(pHwData, number, value);
return ret;
}
-void hal_set_rf_power(struct hw_data * pHwData, u8 PowerIndex)
+void hal_set_rf_power(struct hw_data *pHwData, u8 PowerIndex)
{
- RFSynthesizer_SetPowerIndex( pHwData, PowerIndex );
+ RFSynthesizer_SetPowerIndex(pHwData, PowerIndex);
}
--
1.5.6.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] w35und: merge wbhal.c to wbusb.c
2009-04-08 8:51 [PATCH 1/4] w35und: reformat wbhal.c Pekka Enberg
@ 2009-04-08 8:51 ` Pekka Enberg
2009-04-08 8:51 ` [PATCH 3/4] w35und: inline hal_set_rf_power() to mto.c Pekka Enberg
2009-04-08 8:51 ` [PATCH 4/4] w35und: merge rest of wbhal.c to phy_calibration.c Pekka Enberg
2 siblings, 0 replies; 5+ messages in thread
From: Pekka Enberg @ 2009-04-08 8:51 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pavel Machek
Impact: cleanup
This patch moves all the functions in wbhal.c that are used only in
wbusb.c to the latter file.
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/wbhal.c | 206 -------------------------------------
drivers/staging/winbond/wbhal_f.h | 13 ---
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 e40fdca..01626a1 100644
--- a/drivers/staging/winbond/wbhal.c
+++ b/drivers/staging/winbond/wbhal.c
@@ -2,212 +2,6 @@
#include "wbhal_f.h"
#include "wblinux_f.h"
-void hal_set_ethernet_address(struct hw_data *pHwData, u8 * current_address)
-{
- u32 ltmp[2];
-
- if (pHwData->SurpriseRemove)
- return;
-
- memcpy(pHwData->CurrentMacAddress, current_address, ETH_ALEN);
-
- ltmp[0] = cpu_to_le32(*(u32 *) pHwData->CurrentMacAddress);
- ltmp[1] =
- cpu_to_le32(*(u32 *) (pHwData->CurrentMacAddress + 4)) & 0xffff;
-
- Wb35Reg_BurstWrite(pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT);
-}
-
-void hal_get_permanent_address(struct hw_data *pHwData, u8 * pethernet_address)
-{
- if (pHwData->SurpriseRemove)
- return;
-
- memcpy(pethernet_address, pHwData->PermanentMacAddress, 6);
-}
-
-//---------------------------------------------------------------------------------------------------
-void hal_set_beacon_period(struct hw_data *pHwData, u16 beacon_period)
-{
- u32 tmp;
-
- if (pHwData->SurpriseRemove)
- return;
-
- pHwData->BeaconPeriod = beacon_period;
- tmp = pHwData->BeaconPeriod << 16;
- tmp |= pHwData->ProbeDelay;
- Wb35Reg_Write(pHwData, 0x0848, tmp);
-}
-
-static void hal_set_current_channel_ex(struct hw_data *pHwData,
- ChanInfo channel)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if (pHwData->SurpriseRemove)
- return;
-
- printk("Going to channel: %d/%d\n", channel.band, channel.ChanNo);
-
- RFSynthesizer_SwitchingChannel(pHwData, channel); // Switch channel
- pHwData->Channel = channel.ChanNo;
- pHwData->band = channel.band;
-#ifdef _PE_STATE_DUMP_
- printk("Set channel is %d, band =%d\n", pHwData->Channel,
- pHwData->band);
-#endif
- reg->M28_MacControl &= ~0xff; // Clean channel information field
- reg->M28_MacControl |= channel.ChanNo;
- Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl,
- (s8 *) & channel, sizeof(ChanInfo));
-}
-
-//---------------------------------------------------------------------------------------------------
-void hal_set_current_channel(struct hw_data *pHwData, ChanInfo channel)
-{
- hal_set_current_channel_ex(pHwData, channel);
-}
-
-//---------------------------------------------------------------------------------------------------
-void hal_set_accept_broadcast(struct hw_data *pHwData, u8 enable)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if (pHwData->SurpriseRemove)
- return;
-
- reg->M00_MacControl &= ~0x02000000; //The HW value
-
- if (enable)
- reg->M00_MacControl |= 0x02000000; //The HW value
-
- Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
-}
-
-//for wep key error detection, we need to accept broadcast packets to be received temporary.
-void hal_set_accept_promiscuous(struct hw_data *pHwData, u8 enable)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if (pHwData->SurpriseRemove)
- return;
- if (enable) {
- reg->M00_MacControl |= 0x00400000;
- Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
- } else {
- reg->M00_MacControl &= ~0x00400000;
- Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
- }
-}
-
-void hal_set_accept_multicast(struct hw_data *pHwData, u8 enable)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if (pHwData->SurpriseRemove)
- return;
-
- reg->M00_MacControl &= ~0x01000000; //The HW value
- if (enable)
- reg->M00_MacControl |= 0x01000000; //The HW value
- Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
-}
-
-void hal_set_accept_beacon(struct hw_data *pHwData, u8 enable)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if (pHwData->SurpriseRemove)
- return;
-
- // 20040108 debug
- if (!enable) //Due to SME and MLME are not suitable for 35
- return;
-
- reg->M00_MacControl &= ~0x04000000; //The HW value
- if (enable)
- reg->M00_MacControl |= 0x04000000; //The HW value
-
- Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
-}
-
-//---------------------------------------------------------------------------------------------------
-
-void hal_stop(struct hw_data *pHwData)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- pHwData->Wb35Rx.rx_halt = 1;
- Wb35Rx_stop(pHwData);
-
- pHwData->Wb35Tx.tx_halt = 1;
- Wb35Tx_stop(pHwData);
-
- reg->D00_DmaControl &= ~0xc0000000; //Tx Off, Rx Off
- Wb35Reg_Write(pHwData, 0x0400, reg->D00_DmaControl);
-}
-
-unsigned char hal_idle(struct hw_data *pHwData)
-{
- struct wb35_reg *reg = &pHwData->reg;
- struct wb_usb *pWbUsb = &pHwData->WbUsb;
-
- if (!pHwData->SurpriseRemove
- && (pWbUsb->DetectCount || reg->EP0vm_state != VM_STOP))
- return false;
-
- return true;
-}
-
-void hal_set_radio_mode(struct hw_data *pHwData, unsigned char radio_off)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if (pHwData->SurpriseRemove)
- return;
-
- if (radio_off) //disable Baseband receive off
- {
- pHwData->CurrentRadioSw = 1; // off
- reg->M24_MacControl &= 0xffffffbf;
- } else {
- pHwData->CurrentRadioSw = 0; // on
- reg->M24_MacControl |= 0x00000040;
- }
- Wb35Reg_Write(pHwData, 0x0824, reg->M24_MacControl);
-}
-
-u8 hal_get_antenna_number(struct hw_data *pHwData)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if ((reg->BB2C & BIT(11)) == 0)
- return 0;
- else
- return 1;
-}
-
-//----------------------------------------------------------------------------------------------------
-//0 : radio on; 1: radio off
-u8 hal_get_hw_radio_off(struct hw_data * pHwData)
-{
- struct wb35_reg *reg = &pHwData->reg;
-
- if (pHwData->SurpriseRemove)
- return 1;
-
- //read the bit16 of register U1B0
- Wb35Reg_Read(pHwData, 0x3b0, ®->U1B0);
- if ((reg->U1B0 & 0x00010000)) {
- pHwData->CurrentRadioHw = 1;
- return 1;
- } else {
- pHwData->CurrentRadioHw = 0;
- return 0;
- }
-}
-
unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue)
{
if (number < 0x1000)
diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
index bdea22f..c4934cb 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 );
void hal_clear_all_group_key( struct hw_data * pHwData );
void hal_clear_all_mapping_key( struct hw_data * pHwData );
void hal_clear_all_key( struct hw_data * pHwData );
-void hal_get_ethernet_address( struct hw_data * pHwData, u8 *current_address );
-void hal_set_ethernet_address( struct hw_data * pHwData, u8 *current_address );
-void hal_get_permanent_address( struct hw_data * pHwData, u8 *pethernet_address );
void hal_set_power_save_mode( struct hw_data * pHwData, unsigned char power_save, unsigned char wakeup, unsigned char dtim );
void hal_get_power_save_mode( struct hw_data * pHwData, u8 *pin_pwr_save );
void hal_set_slot_time( struct hw_data * pHwData, u8 type );
@@ -32,15 +29,9 @@ void hal_resume_sync_bss( struct hw_data * pHwData);
void hal_set_aid( struct hw_data * pHwData, u16 aid );
void hal_set_bssid( struct hw_data * pHwData, u8 *pbssid );
void hal_get_bssid( struct hw_data * pHwData, u8 *pbssid );
-void hal_set_beacon_period( struct hw_data * pHwData, u16 beacon_period );
void hal_set_listen_interval( struct hw_data * pHwData, u16 listen_interval );
void hal_set_cap_info( struct hw_data * pHwData, u16 capability_info );
void hal_set_ssid( struct hw_data * pHwData, u8 *pssid, u8 ssid_len );
-void hal_set_current_channel( struct hw_data * pHwData, ChanInfo channel );
-void hal_set_accept_broadcast( struct hw_data * pHwData, u8 enable );
-void hal_set_accept_multicast( struct hw_data * pHwData, u8 enable );
-void hal_set_accept_beacon( struct hw_data * pHwData, u8 enable );
-void hal_stop( struct hw_data * pHwData );
void hal_start_tx0( struct hw_data * pHwData );
#define hal_get_cwmin( _A ) ( (_A)->cwmin )
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
void hal_set_connect_info( struct hw_data * pHwData, unsigned char boConnect );
u8 hal_get_est_sq3( struct hw_data * pHwData, u8 Count );
void hal_set_rf_power( struct hw_data * pHwData, u8 PowerIndex ); // 20060621 Modify
-void hal_set_radio_mode( struct hw_data * pHwData, unsigned char boValue);
void hal_descriptor_indicate( struct hw_data * pHwData, PDESCRIPTOR pDes );
u8 hal_get_antenna_number( struct hw_data * pHwData );
u32 hal_get_bss_pk_cnt( struct hw_data * pHwData );
#define hal_get_region_from_EEPROM( _A ) ( (_A)->reg.EEPROMRegion )
-void hal_set_accept_promiscuous ( struct hw_data * pHwData, u8 enable);
#define hal_get_tx_buffer( _A, _B ) Wb35Tx_get_tx_buffer( _A, _B )
-u8 hal_get_hw_radio_off ( struct hw_data * pHwData );
#define hal_software_set( _A ) (_A->SoftwareSet)
#define hal_driver_init_OK( _A ) (_A->IsInitOK)
#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
#define hal_get_clear_interrupt(_A)
#define hal_ibss_disconnect(_A) hal_stop_sync_bss(_A)
#define hal_join_request_stop(_A)
-unsigned char hal_idle( struct hw_data * pHwData );
#define hw_get_cxx_reg( _A, _B, _C )
#define hw_set_cxx_reg( _A, _B, _C )
#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 dc7cc08..36d8c33 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)
return 0;
}
+static void hal_set_radio_mode(struct hw_data *pHwData, unsigned char radio_off)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ if (pHwData->SurpriseRemove)
+ return;
+
+ if (radio_off) //disable Baseband receive off
+ {
+ pHwData->CurrentRadioSw = 1; // off
+ reg->M24_MacControl &= 0xffffffbf;
+ } else {
+ pHwData->CurrentRadioSw = 0; // on
+ reg->M24_MacControl |= 0x00000040;
+ }
+ Wb35Reg_Write(pHwData, 0x0824, reg->M24_MacControl);
+}
+
+static void hal_set_beacon_period(struct hw_data *pHwData, u16 beacon_period)
+{
+ u32 tmp;
+
+ if (pHwData->SurpriseRemove)
+ return;
+
+ pHwData->BeaconPeriod = beacon_period;
+ tmp = pHwData->BeaconPeriod << 16;
+ tmp |= pHwData->ProbeDelay;
+ Wb35Reg_Write(pHwData, 0x0848, tmp);
+}
+
+static void
+hal_set_current_channel_ex(struct hw_data *pHwData, ChanInfo channel)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ if (pHwData->SurpriseRemove)
+ return;
+
+ printk("Going to channel: %d/%d\n", channel.band, channel.ChanNo);
+
+ RFSynthesizer_SwitchingChannel(pHwData, channel); // Switch channel
+ pHwData->Channel = channel.ChanNo;
+ pHwData->band = channel.band;
+#ifdef _PE_STATE_DUMP_
+ printk("Set channel is %d, band =%d\n", pHwData->Channel,
+ pHwData->band);
+#endif
+ reg->M28_MacControl &= ~0xff; // Clean channel information field
+ reg->M28_MacControl |= channel.ChanNo;
+ Wb35Reg_WriteWithCallbackValue(pHwData, 0x0828, reg->M28_MacControl,
+ (s8 *) & channel, sizeof(ChanInfo));
+}
+
+static void hal_set_current_channel(struct hw_data *pHwData, ChanInfo channel)
+{
+ hal_set_current_channel_ex(pHwData, channel);
+}
+
+static void hal_set_accept_broadcast(struct hw_data *pHwData, u8 enable)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ if (pHwData->SurpriseRemove)
+ return;
+
+ reg->M00_MacControl &= ~0x02000000; //The HW value
+
+ if (enable)
+ reg->M00_MacControl |= 0x02000000; //The HW value
+
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
+}
+
+//for wep key error detection, we need to accept broadcast packets to be received temporary.
+static void hal_set_accept_promiscuous(struct hw_data *pHwData, u8 enable)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ if (pHwData->SurpriseRemove)
+ return;
+ if (enable) {
+ reg->M00_MacControl |= 0x00400000;
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
+ } else {
+ reg->M00_MacControl &= ~0x00400000;
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
+ }
+}
+
+static void hal_set_accept_multicast(struct hw_data *pHwData, u8 enable)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ if (pHwData->SurpriseRemove)
+ return;
+
+ reg->M00_MacControl &= ~0x01000000; //The HW value
+ if (enable)
+ reg->M00_MacControl |= 0x01000000; //The HW value
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
+}
+
+static void hal_set_accept_beacon(struct hw_data *pHwData, u8 enable)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ if (pHwData->SurpriseRemove)
+ return;
+
+ // 20040108 debug
+ if (!enable) //Due to SME and MLME are not suitable for 35
+ return;
+
+ reg->M00_MacControl &= ~0x04000000; //The HW value
+ if (enable)
+ reg->M00_MacControl |= 0x04000000; //The HW value
+
+ Wb35Reg_Write(pHwData, 0x0800, reg->M00_MacControl);
+}
+
static int wbsoft_config(struct ieee80211_hw *dev, u32 changed)
{
struct wbsoft_priv *priv = dev->priv;
@@ -171,6 +292,87 @@ static const struct ieee80211_ops wbsoft_ops = {
.get_tsf = wbsoft_get_tsf,
};
+static void
+hal_set_ethernet_address(struct hw_data *pHwData, u8 * current_address)
+{
+ u32 ltmp[2];
+
+ if (pHwData->SurpriseRemove)
+ return;
+
+ memcpy(pHwData->CurrentMacAddress, current_address, ETH_ALEN);
+
+ ltmp[0] = cpu_to_le32(*(u32 *) pHwData->CurrentMacAddress);
+ ltmp[1] =
+ cpu_to_le32(*(u32 *) (pHwData->CurrentMacAddress + 4)) & 0xffff;
+
+ Wb35Reg_BurstWrite(pHwData, 0x03e8, ltmp, 2, AUTO_INCREMENT);
+}
+
+static void
+hal_get_permanent_address(struct hw_data *pHwData, u8 * pethernet_address)
+{
+ if (pHwData->SurpriseRemove)
+ return;
+
+ memcpy(pethernet_address, pHwData->PermanentMacAddress, 6);
+}
+
+static void hal_stop(struct hw_data *pHwData)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ pHwData->Wb35Rx.rx_halt = 1;
+ Wb35Rx_stop(pHwData);
+
+ pHwData->Wb35Tx.tx_halt = 1;
+ Wb35Tx_stop(pHwData);
+
+ reg->D00_DmaControl &= ~0xc0000000; //Tx Off, Rx Off
+ Wb35Reg_Write(pHwData, 0x0400, reg->D00_DmaControl);
+}
+
+static unsigned char hal_idle(struct hw_data *pHwData)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+ struct wb_usb *pWbUsb = &pHwData->WbUsb;
+
+ if (!pHwData->SurpriseRemove
+ && (pWbUsb->DetectCount || reg->EP0vm_state != VM_STOP))
+ return false;
+
+ return true;
+}
+
+u8 hal_get_antenna_number(struct hw_data *pHwData)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ if ((reg->BB2C & BIT(11)) == 0)
+ return 0;
+ else
+ return 1;
+}
+
+/* 0 : radio on; 1: radio off */
+static u8 hal_get_hw_radio_off(struct hw_data * pHwData)
+{
+ struct wb35_reg *reg = &pHwData->reg;
+
+ if (pHwData->SurpriseRemove)
+ return 1;
+
+ //read the bit16 of register U1B0
+ Wb35Reg_Read(pHwData, 0x3b0, ®->U1B0);
+ if ((reg->U1B0 & 0x00010000)) {
+ pHwData->CurrentRadioHw = 1;
+ return 1;
+ } else {
+ pHwData->CurrentRadioHw = 0;
+ return 0;
+ }
+}
+
static u8 LED_GRAY[20] = {
0, 3, 4, 6, 8, 10, 11, 12, 13, 14, 15, 14, 13, 12, 11, 10, 8, 6, 4, 2
};
--
1.5.6.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] w35und: inline hal_set_rf_power() to mto.c
2009-04-08 8:51 [PATCH 1/4] w35und: reformat wbhal.c Pekka Enberg
2009-04-08 8:51 ` [PATCH 2/4] w35und: merge wbhal.c to wbusb.c Pekka Enberg
@ 2009-04-08 8:51 ` Pekka Enberg
2009-04-08 8:51 ` [PATCH 4/4] w35und: merge rest of wbhal.c to phy_calibration.c Pekka Enberg
2 siblings, 0 replies; 5+ messages in thread
From: Pekka Enberg @ 2009-04-08 8:51 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pavel Machek
Impact: cleanup
It's a trivial wrapper that is used in only one place, so lets inline it.
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/mto.c | 2 +-
drivers/staging/winbond/wbhal.c | 5 -----
drivers/staging/winbond/wbhal_f.h | 1 -
3 files changed, 1 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/winbond/mto.c b/drivers/staging/winbond/mto.c
index 94a060b..7deb5c7 100644
--- a/drivers/staging/winbond/mto.c
+++ b/drivers/staging/winbond/mto.c
@@ -175,7 +175,7 @@ void MTO_Init(struct wbsoft_priv *adapter)
}
else //follow the setting from EEPROM
MTOPARA_TXPOWER_INDEX() = MTO_TXPOWER_FROM_EEPROM;
- hal_set_rf_power(MTO_HAL(), (u8)MTOPARA_TXPOWER_INDEX());
+ RFSynthesizer_SetPowerIndex(MTO_HAL(), (u8)MTOPARA_TXPOWER_INDEX());
//------------------------------------------------
// For RSSI turning 20060808.4 Cancel load from EEPROM
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
index 01626a1..b9a6e38 100644
--- a/drivers/staging/winbond/wbhal.c
+++ b/drivers/staging/winbond/wbhal.c
@@ -18,8 +18,3 @@ unsigned char hal_set_dxx_reg(struct hw_data *pHwData, u16 number, u32 value)
ret = Wb35Reg_WriteSync(pHwData, number, value);
return ret;
}
-
-void hal_set_rf_power(struct hw_data *pHwData, u8 PowerIndex)
-{
- RFSynthesizer_SetPowerIndex(pHwData, PowerIndex);
-}
diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
index c4934cb..fd1d3c2 100644
--- a/drivers/staging/winbond/wbhal_f.h
+++ b/drivers/staging/winbond/wbhal_f.h
@@ -39,7 +39,6 @@ void hal_set_cwmax( struct hw_data * pHwData, u16 cwin_max );
void hal_set_rsn_wpa( struct hw_data * pHwData, u32 * RSN_IE_Bitmap , u32 * RSN_OUI_type , unsigned char bDesiredAuthMode);
void hal_set_connect_info( struct hw_data * pHwData, unsigned char boConnect );
u8 hal_get_est_sq3( struct hw_data * pHwData, u8 Count );
-void hal_set_rf_power( struct hw_data * pHwData, u8 PowerIndex ); // 20060621 Modify
void hal_descriptor_indicate( struct hw_data * pHwData, PDESCRIPTOR pDes );
u8 hal_get_antenna_number( struct hw_data * pHwData );
u32 hal_get_bss_pk_cnt( struct hw_data * pHwData );
--
1.5.6.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] w35und: merge rest of wbhal.c to phy_calibration.c
2009-04-08 8:51 [PATCH 1/4] w35und: reformat wbhal.c Pekka Enberg
2009-04-08 8:51 ` [PATCH 2/4] w35und: merge wbhal.c to wbusb.c Pekka Enberg
2009-04-08 8:51 ` [PATCH 3/4] w35und: inline hal_set_rf_power() to mto.c Pekka Enberg
@ 2009-04-08 8:51 ` Pekka Enberg
2009-04-08 10:03 ` Pavel Machek
2 siblings, 1 reply; 5+ messages in thread
From: Pekka Enberg @ 2009-04-08 8:51 UTC (permalink / raw)
To: greg; +Cc: linux-kernel, Pavel Machek
Impact: cleanup
The remaining functions are local to phy_calibration.c so move them
there and remove wbhal.c.
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
---
drivers/staging/winbond/Makefile | 1 -
drivers/staging/winbond/phy_calibration.c | 19 +++++++++++++++++++
drivers/staging/winbond/wbhal.c | 20 --------------------
drivers/staging/winbond/wbhal_f.h | 4 ----
4 files changed, 19 insertions(+), 25 deletions(-)
delete mode 100644 drivers/staging/winbond/wbhal.c
diff --git a/drivers/staging/winbond/Makefile b/drivers/staging/winbond/Makefile
index b49c973..fb2b7d4 100644
--- a/drivers/staging/winbond/Makefile
+++ b/drivers/staging/winbond/Makefile
@@ -7,7 +7,6 @@ w35und-objs := \
wb35reg.o \
wb35rx.o \
wb35tx.o \
- wbhal.o \
wbusb.o \
diff --git a/drivers/staging/winbond/phy_calibration.c b/drivers/staging/winbond/phy_calibration.c
index af8c01e..8c56962 100644
--- a/drivers/staging/winbond/phy_calibration.c
+++ b/drivers/staging/winbond/phy_calibration.c
@@ -340,6 +340,25 @@ void _sin_cos(s32 angle, s32 *sin, s32 *cos)
}
}
+static unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue)
+{
+ if (number < 0x1000)
+ number += 0x1000;
+ return Wb35Reg_ReadSync(pHwData, number, pValue);
+}
+#define hw_get_dxx_reg( _A, _B, _C ) hal_get_dxx_reg( _A, _B, (u32 *)_C )
+
+static unsigned char hal_set_dxx_reg(struct hw_data *pHwData, u16 number, u32 value)
+{
+ unsigned char ret;
+
+ if (number < 0x1000)
+ number += 0x1000;
+ ret = Wb35Reg_WriteSync(pHwData, number, value);
+ return ret;
+}
+#define hw_set_dxx_reg( _A, _B, _C ) hal_set_dxx_reg( _A, _B, (u32)_C )
+
void _reset_rx_cal(struct hw_data *phw_data)
{
diff --git a/drivers/staging/winbond/wbhal.c b/drivers/staging/winbond/wbhal.c
deleted file mode 100644
index b9a6e38..0000000
--- a/drivers/staging/winbond/wbhal.c
+++ /dev/null
@@ -1,20 +0,0 @@
-#include "sysdef.h"
-#include "wbhal_f.h"
-#include "wblinux_f.h"
-
-unsigned char hal_get_dxx_reg(struct hw_data *pHwData, u16 number, u32 * pValue)
-{
- if (number < 0x1000)
- number += 0x1000;
- return Wb35Reg_ReadSync(pHwData, number, pValue);
-}
-
-unsigned char hal_set_dxx_reg(struct hw_data *pHwData, u16 number, u32 value)
-{
- unsigned char ret;
-
- if (number < 0x1000)
- number += 0x1000;
- ret = Wb35Reg_WriteSync(pHwData, number, value);
- return ret;
-}
diff --git a/drivers/staging/winbond/wbhal_f.h b/drivers/staging/winbond/wbhal_f.h
index fd1d3c2..bfdf05d 100644
--- a/drivers/staging/winbond/wbhal_f.h
+++ b/drivers/staging/winbond/wbhal_f.h
@@ -52,8 +52,6 @@ u32 hal_get_bss_pk_cnt( struct hw_data * pHwData );
#define PHY_DEBUG( msg, args... )
-unsigned char hal_get_dxx_reg( struct hw_data * pHwData, u16 number, u32 * pValue );
-unsigned char hal_set_dxx_reg( struct hw_data * pHwData, u16 number, u32 value );
#define hal_get_time_count( _P ) (_P->time_count/10) // return 100ms count
#define hal_detect_error( _P ) (_P->WbUsb.DetectCount)
@@ -68,7 +66,5 @@ unsigned char hal_set_dxx_reg( struct hw_data * pHwData, u16 number, u32 valu
#define hal_join_request_stop(_A)
#define hw_get_cxx_reg( _A, _B, _C )
#define hw_set_cxx_reg( _A, _B, _C )
-#define hw_get_dxx_reg( _A, _B, _C ) hal_get_dxx_reg( _A, _B, (u32 *)_C )
-#define hw_set_dxx_reg( _A, _B, _C ) hal_set_dxx_reg( _A, _B, (u32)_C )
--
1.5.6.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 4/4] w35und: merge rest of wbhal.c to phy_calibration.c
2009-04-08 8:51 ` [PATCH 4/4] w35und: merge rest of wbhal.c to phy_calibration.c Pekka Enberg
@ 2009-04-08 10:03 ` Pavel Machek
0 siblings, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2009-04-08 10:03 UTC (permalink / raw)
To: Pekka Enberg; +Cc: greg, linux-kernel
On Wed 2009-04-08 11:51:22, Pekka Enberg wrote:
> Impact: cleanup
>
> The remaining functions are local to phy_calibration.c so move them
> there and remove wbhal.c.
>
Whole series looks ok to me.
Acked-by: Pavel Machek <pavel@ucw.cz>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-04-08 10:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08 8:51 [PATCH 1/4] w35und: reformat wbhal.c Pekka Enberg
2009-04-08 8:51 ` [PATCH 2/4] w35und: merge wbhal.c to wbusb.c Pekka Enberg
2009-04-08 8:51 ` [PATCH 3/4] w35und: inline hal_set_rf_power() to mto.c Pekka Enberg
2009-04-08 8:51 ` [PATCH 4/4] w35und: merge rest of wbhal.c to phy_calibration.c Pekka Enberg
2009-04-08 10:03 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome