New patch series for merge
cover New patch series for merge
Hi John,
This patch series catches wireless-dev up to my
current wireless-development patchset.
Please merge this into wireless-dev.
PATCH 1/9 b43: Add more LO debugging
This makes it possible to find uses of uncalibrated LO value pairs.
drivers/net/wireless/b43/lo.c +94 -22
@@ -986,6 +986,8 @@ static void lo_measure(struct b43_wldevcontinue ; }memcpy (&loctl, ploctl,sizeof (loctl)); + loctl.i =0 ; + loctl.q =0 ; max_rx_gain = lo->rfatt_list.list[rfidx].att *2 ; max_rx_gain += lo->bbatt_list.list[bbidx].att /2 ;
@@ -1004,6 +1006,7 @@ static void lo_measure(struct b43_wldev loctl.i++; loctl.q++; } +b43_loctl_set_calibrated (&loctl,1 );memcpy (ploctl, &loctl,sizeof (loctl)); } }
@@ -1013,23 +1016,58 @@ static void lo_measure(struct b43_wldevstatic void do_validate_loctl (struct b43_wldev *dev,struct b43_loctl *control) {const int is_initializing = (b43_status (dev) ==B43_STAT_UNINIT ); +int i = control->i; +int q = control->q; -if (unlikely (abs (control->i) >16 || -abs (control->q) >16 || - (is_initializing && control->used))) { -bcmdbg (dev->wl,"ERROR: LO control pair validation failed " -"(first: %d, second: %d, used %u)\n" , - control->i, control->q, control->used); +if (b43_loctl_is_calibrated (control)) { +if ((abs (i) >16 ) || (abs (q) >16 )) + goto error; + }else { +if (control->used) + goto error; +if (dev->phy.lo_control->rebuild) { + control->i =0 ; + control->q =0 ; +if ((i !=B43_LOCTL_POISON ) || + (q !=B43_LOCTL_POISON )) + goto error; + } } +if (is_initializing && control->used) + goto error; + +return ; +error: +bcmerr (dev->wl,"LO control pair validation failed " +"(I: %d, Q: %d, used %u, calib: %u, initing: %d)\n" , + i, q, control->used, +b43_loctl_is_calibrated (control), + is_initializing); } +static void validate_all_loctls (struct b43_wldev *dev) {b43_call_for_each_loctl (dev, do_validate_loctl); } -#else /* B43_DEBUG */ -static inline void validate_all_loctls (struct b43_wldev *dev) + +static void do_reset_calib (struct b43_wldev *dev,struct b43_loctl *control) { +if (dev->phy.lo_control->rebuild || + control->used) { +b43_loctl_set_calibrated (control,0 ); + control->i =B43_LOCTL_POISON ; + control->q =B43_LOCTL_POISON ; + } } + +static void reset_all_loctl_calibration_states (struct b43_wldev *dev) +{ +b43_call_for_each_loctl (dev, do_reset_calib); +} + +#else /* B43_DEBUG */ +static inline void validate_all_loctls (struct b43_wldev *dev) { } +static inline void reset_all_loctl_calibration_states (struct b43_wldev *dev) { }#endif /* B43_DEBUG */ void b43_lo_g_measure (struct b43_wldev *dev)
@@ -1042,6 +1080,7 @@ void b43_lo_g_measure(struct b43_wldev * sav.old_channel = phy->channel;lo_measure_setup (dev, &sav); +reset_all_loctl_calibration_states (dev);lo_measure (dev);lo_measure_restore (dev, &sav);
@@ -1051,10 +1090,33 @@ void b43_lo_g_measure(struct b43_wldev * phy->lo_control->rebuild =0 ; } -void b43_lo_g_adjust (struct b43_wldev *dev) +#if B43_DEBUG +static void validate_loctl_calibration (struct b43_wldev *dev, +struct b43_loctl *loctl, +struct b43_rfatt *rfatt, +struct b43_bbatt *bbatt) +{ +if (b43_loctl_is_calibrated (loctl)) +return ; +if (!dev->phy.lo_control->lo_measured) { +/* On init we set the attenuation values before we +* calibrated the LO. I guess that's OK. */ +return ; + } +bcmerr (dev->wl,"Adjusting Local Oscillator to an uncalibrated " +"control pair: rfatt=%u,%spadmix bbatt=%u\n" , + rfatt->att, + (rfatt->with_padmix) ?"" :"no-" , + bbatt->att); +} +#else +static inline void validate_loctl_calibration (struct b43_wldev *dev, +struct b43_loctl *loctl, +struct b43_rfatt *rfatt, +struct b43_bbatt *bbatt) { -b43_lo_write (dev,b43_lo_g_ctl_current (dev)); } +#endif static inline void fixup_rfatt_for_txcontrol (struct b43_rfatt *rf,u8 tx_control)
@@ -1065,6 +1127,20 @@ static inline void fixup_rfatt_for_txcon } } +void b43_lo_g_adjust (struct b43_wldev *dev) +{ +struct b43_phy *phy = &dev->phy; +struct b43_rfatt rf; +struct b43_loctl *loctl; + +memcpy (&rf, &phy->rfatt,sizeof (rf)); +fixup_rfatt_for_txcontrol (&rf, phy->tx_control); + + loctl =b43_get_lo_g_ctl (dev, &rf, &phy->bbatt); +validate_loctl_calibration (dev, loctl, &rf, &phy->bbatt); +b43_lo_write (dev, loctl); +} +void b43_lo_g_adjust_to (struct b43_wldev *dev,u16 rfatt,u16 bbatt,u16 tx_control) {
@@ -1078,20 +1154,10 @@ void b43_lo_g_adjust_to(struct b43_wldev bb.att = bbatt;fixup_rfatt_for_txcontrol (&rf, tx_control); loctl =b43_get_lo_g_ctl (dev, &rf, &bb); +validate_loctl_calibration (dev, loctl, &rf, &bb);b43_lo_write (dev, loctl); } -struct b43_loctl *b43_lo_g_ctl_current (struct b43_wldev *dev) -{ -struct b43_phy *phy = &dev->phy; -struct b43_rfatt rf; - -memcpy (&rf, &phy->rfatt,sizeof (rf)); -fixup_rfatt_for_txcontrol (&rf, phy->tx_control); - -return b43_get_lo_g_ctl (dev, &rf, &phy->bbatt); -} -static void do_mark_unused (struct b43_wldev *dev,struct b43_loctl *control) { control->used =0 ;
@@ -1108,5 +1174,11 @@ void b43_lo_g_ctl_mark_all_unused(structvoid b43_lo_g_ctl_mark_cur_used (struct b43_wldev *dev) { -b43_lo_g_ctl_current (dev)->used =1 ; +struct b43_phy *phy = &dev->phy; +struct b43_rfatt rf; + +memcpy (&rf, &phy->rfatt,sizeof (rf)); +fixup_rfatt_for_txcontrol (&rf, phy->tx_control); + +b43_get_lo_g_ctl (dev, &rf, &phy->bbatt)->used =1 ; }
drivers/net/wireless/b43/lo.h +30 -5
@@ -11,9 +11,38 @@ struct b43_loctl {s8 i;s8 q;/* "Used by hardware" flag. */ -u8 used; +bool used; +#ifdef CONFIG_B43_DEBUG +/* Is this lo-control-array entry calibrated? */ +bool calibrated; +#endif }; +/* Debugging: Poison value for i and q values. */ +#define B43_LOCTL_POISON 111 + +/* loctl->calibrated debugging mechanism */ +#ifdef CONFIG_B43_DEBUG +static inline void b43_loctl_set_calibrated (struct b43_loctl *loctl, +bool calibrated) +{ + loctl->calibrated = calibrated; +} +static inline bool b43_loctl_is_calibrated (struct b43_loctl *loctl) +{ +return loctl->calibrated; +} +#else +static inline void b43_loctl_set_calibrated (struct b43_loctl *loctl, +bool calibrated) +{ +} +static inline bool b43_loctl_is_calibrated (struct b43_loctl *loctl) +{ +return 1 ; +} +#endif +/* TX Power LO Control Array. * Value-pairs to adjust the LocalOscillator are stored * in this structure.
@@ -66,10 +95,6 @@ void b43_lo_g_adjust(struct b43_wldev *dvoid b43_lo_g_adjust_to (struct b43_wldev *dev,u16 rfatt,u16 bbatt,u16 tx_control); -/* Returns the b43_lo_g_ctl corresponding to the current -* attenuation values. -*/ -struct b43_loctl *b43_lo_g_ctl_current (struct b43_wldev *dev);/* Mark all possible b43_lo_g_ctl as "unused" */ void b43_lo_g_ctl_mark_all_unused (struct b43_wldev *dev);/* Mark the b43_lo_g_ctl corresponding to the current
PATCH 2/9 b43: Remove PCI to SSB bridge code
In reply to Michael BueschThis will be added to ssb
drivers/net/wireless/b43/main.c +16 -47
@@ -104,7 +104,11 @@ module_param_named(hwpctl, modparam_hwpcMODULE_PARM_DESC (hwpctl,"Enable hardware-side power control (default off)" );static const struct ssb_device_id b43_ssb_tbl[] = { -SSB_DEVICE (SSB_VENDOR_BROADCOM ,SSB_DEV_80211 ,SSB_ANY_REV ), +SSB_DEVICE (SSB_VENDOR_BROADCOM ,SSB_DEV_80211 ,5 ), +SSB_DEVICE (SSB_VENDOR_BROADCOM ,SSB_DEV_80211 ,6 ), +SSB_DEVICE (SSB_VENDOR_BROADCOM ,SSB_DEV_80211 ,7 ), +SSB_DEVICE (SSB_VENDOR_BROADCOM ,SSB_DEV_80211 ,9 ), +SSB_DEVICE (SSB_VENDOR_BROADCOM ,SSB_DEV_80211 ,10 ),SSB_DEVTABLE_END };
@@ -3959,67 +3963,35 @@ static int b43_resume(struct ssb_device#else /* CONFIG_PM */ # define b43_suspend NULL -# define b43_resume NULL +# define b43_resume NULL#endif /* CONFIG_PM */ static struct ssb_driver b43_ssb_driver = { - .name =KBUILD_MODNAME , - .id_table = b43_ssb_tbl, - .probe = b43_probe, - .remove = b43_remove, - .suspend = b43_suspend, - .resume = b43_resume, + .name =KBUILD_MODNAME , + .id_table = b43_ssb_tbl, + .probe = b43_probe, + .remove = b43_remove, + .suspend = b43_suspend, + .resume = b43_resume, }; -#ifdef CONFIG_B43_PCI -/* The PCI frontend stub */ -static const struct pci_device_id b43_pci_tbl[] = { - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4307 )}, - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4311 )}, - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4312 )}, - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4318 )}, - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4319 )}, - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4320 )}, - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4321 )}, - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4324 )}, - {PCI_DEVICE (PCI_VENDOR_ID_BROADCOM ,0x4325 )}, - {0 }, -}; - -MODULE_DEVICE_TABLE (pci, b43_pci_tbl); - -static struct pci_driver b43_pci_driver = { - .name ="b43-pci" , - .id_table = b43_pci_tbl, -}; -#endif /* CONFIG_B43_PCI */ -static int __init b43_init (void ) {int err;b43_debugfs_init (); -#ifdef CONFIG_B43_PCI - err =ssb_pcihost_register (&b43_pci_driver); -if (err) - goto err_dfs_exit; -#endif err =b43_pcmcia_init ();if (err) - goto err_pci_exit; + goto err_dfs_exit; err =ssb_driver_register (&b43_ssb_driver);if (err) goto err_pcmcia_exit;return err; - err_pcmcia_exit: +err_pcmcia_exit:b43_pcmcia_exit (); - err_pci_exit: -#ifdef CONFIG_B43_PCI -ssb_pcihost_unregister (&b43_pci_driver); -#endif - err_dfs_exit: +err_dfs_exit:b43_debugfs_exit ();return err; }
@@ -4028,11 +4000,8 @@ static void __exit b43_exit(void) {ssb_driver_unregister (&b43_ssb_driver);b43_pcmcia_exit (); -#ifdef CONFIG_B43_PCI -ssb_pcihost_unregister (&b43_pci_driver); -#endif b43_debugfs_exit (); }module_init (b43_init) -module_exit (b43_exit) +module_exit (b43_exit)
PATCH 3/9 b43: Powerup the bus before accessing any MMIO
In reply to Michael BueschThis crashes otherwise.
drivers/net/wireless/b43/main.c +10 -3
@@ -3619,6 +3619,11 @@ static int b43_wireless_core_attach(stru* that in core_init(), too. */ + err =ssb_bus_powerup (bus,0 ); +if (err) { +bcmerr (wl,"Bus powerup failed\n" ); + goto out; + }/* Get the PHY type. */ if (dev->dev->id.revision >=5 ) {u32 tmshigh;
@@ -3637,7 +3642,7 @@ static int b43_wireless_core_attach(stru/* Initialize LEDs structs. */ err =b43_leds_init (dev);if (err) - goto out; + goto err_powerdown; dev->phy.gmode = (have_gphy || have_bphy); tmp = dev->phy.gmode ?B43_TMSLOW_GMODE :0 ;
@@ -3689,11 +3694,13 @@ static int b43_wireless_core_attach(strussb_device_disable (dev->dev,0 );ssb_bus_may_powerdown (bus); - out: +out:return err; - err_leds_exit: +err_leds_exit:b43_leds_exit (dev); +err_powerdown: +ssb_bus_may_powerdown (bus);return err; }
PATCH 4/9 b43: Check init status in b43_config_interface.
In reply to Michael BueschWe must check for >=INITIALIZED
drivers/net/wireless/b43/main.c +8 -6
@@ -2940,13 +2940,15 @@ static int b43_config_interface(struct iif (conf->type !=IEEE80211_IF_TYPE_MNTR ) {B43_WARN_ON (wl->if_id != if_id); wl->bssid = conf->bssid; -if (b43_is_mode (wl,IEEE80211_IF_TYPE_AP )) { -B43_WARN_ON (conf->type !=IEEE80211_IF_TYPE_AP ); -b43_set_ssid (dev, conf->ssid, conf->ssid_len); -if (conf->beacon) -b43_refresh_templates (dev, conf->beacon); +if (b43_status (dev) >=B43_STAT_INITIALIZED ) { +if (b43_is_mode (wl,IEEE80211_IF_TYPE_AP )) { +B43_WARN_ON (conf->type !=IEEE80211_IF_TYPE_AP ); +b43_set_ssid (dev, conf->ssid, conf->ssid_len); +if (conf->beacon) +b43_refresh_templates (dev, conf->beacon); + } +b43_write_mac_bssid_templates (dev); } -b43_write_mac_bssid_templates (dev); }spin_unlock_irqrestore (&wl->irq_lock, flags);mutex_unlock (&wl->mutex);
PATCH 5/9 b43: Suppress sending of probe responses from firmware
In reply to Michael BueschThe MLME takes care of this.
In future we probably want to change the MLME to support this hardware feature.
drivers/net/wireless/b43/main.c +6 -0
@@ -3328,6 +3328,12 @@ static int b43_wireless_core_init(structb43_shm_write16 (dev,B43_SHM_SHARED ,B43_SHM_SH_SFFBLIM ,3 );b43_shm_write16 (dev,B43_SHM_SHARED ,B43_SHM_SH_LFFBLIM ,2 ); +/* Disable sending probe responses from firmware. +* Setting the MaxTime to one usec will always trigger +* a timeout, so we never send any probe resp. +* A timeout of zero is infinite. */ +b43_shm_write16 (dev,B43_SHM_SHARED ,B43_SHM_SH_PRMAXTIME ,1 ); +b43_rate_memory_init (dev);/* Minimum Contention Window */
PATCH 6/9 b43: debugfs tx_status, Fix endless loop inside of spinlock
In reply to Michael BueschThis fixes an endless loop inside of a spinlock. This triggers if the tx_status file is read before a packet has been transmitted.
drivers/net/wireless/b43/debugfs.c +4 -0
@@ -173,6 +173,10 @@ static ssize_t txstat_read_file(struct f i = log->end +1 ; idx =0 ;while (1 ) { +if (log->end <0 ) { +fappend ("Nothing transmitted, yet\n" ); +break ; + }if (i ==B43_NR_LOGGED_TXSTATUS ) i =0 ; stat = &(log->log[i]);
PATCH 7/9 b43: Fix frame retry count for suppressed frames
In reply to Michael Buesch(u8)0 - 1 == 255
which is wrong. Should be 0.
drivers/net/wireless/b43/dma.c +7 -4
@@ -1276,12 +1276,15 @@ void b43_dma_handle_txstatus(struct b43_if (status->acked) { meta->txstat.flags |=IEEE80211_TX_STATUS_ACK ; }else { -if (! - (meta->txstat.control. - flags &IEEE80211_TXCTL_NO_ACK )) +if (!(meta->txstat.control.flags + &IEEE80211_TXCTL_NO_ACK )) meta->txstat.excessive_retries =1 ; } - meta->txstat.retry_count = status->frame_count -1 ; +if (status->frame_count ==0 ) { +/* The frame was not transmitted at all. */ + meta->txstat.retry_count =0 ; + }else + meta->txstat.retry_count = status->frame_count -1 ;ieee80211_tx_status_irqsafe (dev->wl->hw, meta->skb, &(meta->txstat));/* skb is freed by ieee80211_tx_status_irqsafe() */
drivers/net/wireless/b43/pio.c +5 -1
@@ -469,7 +469,11 @@ void b43_pio_handle_txstatus(struct b43_if (!(packet->txstat.control.flags &IEEE80211_TXCTL_NO_ACK )) packet->txstat.excessive_retries =1 ; } - packet->txstat.retry_count = status->frame_count -1 ; +if (status->frame_count ==0 ) { +/* The frame was not transmitted at all. */ + packet->txstat.retry_count =0 ; + }else + packet->txstat.retry_count = status->frame_count -1 ;ieee80211_tx_status_irqsafe (dev->wl->hw, packet->skb, &(packet->txstat)); packet->skb =NULL ;
PATCH 8/9 b43: Fix controller reset
In reply to Michael BueschDon't check the device status. It's checked and handled later in the workqueue. Use proper locking in the reset callback.
drivers/net/wireless/b43/main.c +10 -13
@@ -2539,14 +2539,16 @@ static int b43_get_stats(struct ieee8021static int b43_dev_reset (struct ieee80211_hw *hw) {struct b43_wl *wl =hw_to_b43_wl (hw); -struct b43_wldev *dev = wl->current_dev; -unsigned long flags; +struct b43_wldev *dev; +int err = -ENODEV ; -if (!dev) -return -ENODEV ; -spin_lock_irqsave (&wl->irq_lock, flags); -b43_controller_restart (dev,"Reset by ieee80211 subsystem" ); -spin_unlock_irqrestore (&wl->irq_lock, flags); +mutex_lock (&wl->mutex); + dev = wl->current_dev; +if (dev) { +b43_controller_restart (dev,"Reset by ieee80211 subsystem" ); + err =0 ; + } +mutex_unlock (&wl->mutex);return 0 ; }
@@ -3911,14 +3913,9 @@ static void b43_remove(struct ssb_device } } -/* Hard-reset the chip. -* This can be called from interrupt or process context. -* dev->irq_lock must be locked. -*/ +/* Perform a hardware reset. This can be called from any context. */ void b43_controller_restart (struct b43_wldev *dev,const char *reason) { -if (b43_status (dev) !=B43_STAT_INITIALIZED ) -return ;bcminfo (dev->wl,"Controller RESET (%s) ...\n" , reason);queue_work (dev->wl->hw->workqueue, &dev->restart_work); }
PATCH 9/9 b43: Rewrite kconfig to get rid of the advice hack.
In reply to Michael BueschThis should properly autoselect the SSB options without introducing a dependency hell.
drivers/net/wireless/b43/Kconfig +15 -33
@@ -1,49 +1,31 @@ -config B43_DEP_HACK - bool - depends on SSB && SSB_PCIHOST && SSB_DRIVER_PCICORE - default y - -config B43_ADVICE_HACK - bool "Broadcom 43xx PCI (mac80211) not available. Read the help text of this option!" - depends on !B43_DEP_HACK - ---help--- - The B43 driver for B43 PCI devices can not be enabled, - because the required dependencies are not selected. - - In order to be able to select the B43-mac80211 driver, you - need to enable the following options first: - - CONFIG_SSB found in menu: - Device Drivers/Sonics Silicon Backplane/Sonics Silicon Backplane support - CONFIG_SSB_PCIHOST found in menu: - Device Drivers/Sonics Silicon Backplane/Support for SSB on PCI-bus host - CONFIG_SSB_DRIVER_PCICORE found in menu: - Device Drivers/Sonics Silicon Backplane/SSB PCI core driver - config B43 tristate "Broadcom 43xx wireless support (mac80211 stack)" - depends on SSB && MAC80211 && WLAN_80211 && EXPERIMENTAL + depends on SSB_POSSIBLE && MAC80211 && WLAN_80211 && EXPERIMENTAL + select SSB select FW_LOADER select HW_RANDOM ---help--- This is an experimental driver for the Broadcom 43xx wireless chip, found in the Apple Airport Extreme and various other devices. -config B43_PCI - bool "Broadcom 43xx PCI device support" - depends on B43 && SSB_PCIHOST && SSB_DRIVER_PCICORE +# Auto-select SSB PCI-HOST support, if possible +config B43_PCI_AUTOSELECT + bool + depends on SSB_PCIHOST_POSSIBLE + select SSB_PCIHOST default y - ---help--- - Broadcom 43xx PCI device support. - Say Y, if you have a B43 device connected through the PCI bus. - Please note that most PC-CARD devices are (to the kernel) PCI devices, - too and not PCMCIA. - It's safe to select Y here, even if you don't have a B43 PCI device. +# Auto-select SSB PCICORE driver, if possible +config B43_PCICORE_AUTOSELECT + bool + depends on SSB_DRIVER_PCICORE_POSSIBLE + select SSB_DRIVER_PCICORE + default y config B43_PCMCIA bool "Broadcom 43xx PCMCIA device support" - depends on B43 && SSB_PCMCIAHOST + depends on B43 && SSB_PCMCIAHOST_POSSIBLE + select SSB_PCMCIAHOST ---help--- Broadcom 43xx PCMCIA device support.