Jory A. Pratt wrote:
It would be nice if this would apply against 2.6.19.1 :) not too many of
us are ready to jump all the way out to 2.6.20_rc1 as we know just how
buggy it is with the new changes to workqueue

Thanks For your work your doing an awsome job.

Wireless-2.6 is a 2.6.19 kernel. The difference that broke the patch is that wireless-2.6 has a patch that gets rid of the "badness" calculation, whereas 2.6.19 still has it.

The revised patch for 2.6.19.1 is attached.

Incidentally, except for the patch for ieee80211softmac that has been recently discussed here, I'm having no problems with 2.6.20-rc1.

Larry
Index: linux-2.6.19.1/drivers/net/wireless/bcm43xx/bcm43xx_main.c
===================================================================
--- linux-2.6.19.1.orig/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ linux-2.6.19.1/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -2437,6 +2437,9 @@ static int bcm43xx_chip_init(struct bcm4
        if (err)
                goto err_gpio_cleanup;
        bcm43xx_radio_turn_on(bcm);
+       bcm->radio_hw_enable = bcm43xx_is_hw_radio_enabled(bcm);
+       printk(KERN_INFO PFX "Radio %s by hardware\n",
+               (bcm->radio_hw_enable == 0) ? "disabled" : "enabled");
 
        bcm43xx_write16(bcm, 0x03E6, 0x0000);
        err = bcm43xx_phy_init(bcm);
@@ -3108,9 +3111,24 @@ static void bcm43xx_periodic_every30sec(
 
 static void bcm43xx_periodic_every15sec(struct bcm43xx_private *bcm)
 {
+       bcm43xx_phy_xmitpower(bcm); //FIXME: unless scanning?
+       //TODO for APHY (temperature?)
+}
+
+static void bcm43xx_periodic_every1sec(struct bcm43xx_private *bcm)
+{
        struct bcm43xx_phyinfo *phy = bcm43xx_current_phy(bcm);
        struct bcm43xx_radioinfo *radio = bcm43xx_current_radio(bcm);
+       int radio_hw_enable;
+
+       /* check if radio hardware enabled status changed */
+       radio_hw_enable = bcm43xx_is_hw_radio_enabled(bcm);
+       if (unlikely(bcm->radio_hw_enable != radio_hw_enable)) {
+               bcm->radio_hw_enable = radio_hw_enable;
+               printk(KERN_INFO PFX "Radio hardware status changed to %s\n",
+                      (radio_hw_enable == 0) ? "disabled" : "enabled");
 
+       }
        if (phy->type == BCM43xx_PHYTYPE_G) {
                //TODO: update_aci_moving_average
                if (radio->aci_enable && radio->aci_wlan_automatic) {
@@ -3134,8 +3152,14 @@ static void bcm43xx_periodic_every15sec(
                        //TODO: implement rev1 workaround
                }
        }
-       bcm43xx_phy_xmitpower(bcm); //FIXME: unless scanning?
-       //TODO for APHY (temperature?)
+       /* check if radio hardware enabled status changed */
+       radio_hw_enable = bcm43xx_is_hw_radio_enabled(bcm);
+       if (unlikely(bcm->radio_hw_enable != radio_hw_enable)) {
+               bcm->radio_hw_enable = radio_hw_enable;
+               printk(KERN_INFO PFX "Radio hardware status changed to %s\n",
+                      (radio_hw_enable == 0) ? "disabled" : "enabled");
+
+       }
 }
 
 static void do_periodic_work(struct bcm43xx_private *bcm)
@@ -3143,17 +3167,19 @@ static void do_periodic_work(struct bcm4
        unsigned int state;
 
        state = bcm->periodic_state;
-       if (state % 8 == 0)
+       if (state % 120 == 0)
                bcm43xx_periodic_every120sec(bcm);
-       if (state % 4 == 0)
+       if (state % 60 == 0)
                bcm43xx_periodic_every60sec(bcm);
-       if (state % 2 == 0)
+       if (state % 30 == 0)
                bcm43xx_periodic_every30sec(bcm);
-       if (state % 1 == 0)
+       if (state % 15 == 0)
                bcm43xx_periodic_every15sec(bcm);
+       bcm43xx_periodic_every1sec(bcm);
+
        bcm->periodic_state = state + 1;
 
-       schedule_delayed_work(&bcm->periodic_work, HZ * 15);
+       schedule_delayed_work(&bcm->periodic_work, HZ);
 }
 
 /* Estimate a "Badness" value based on the periodic work
@@ -3164,13 +3190,13 @@ static int estimate_periodic_work_badnes
 {
        int badness = 0;
 
-       if (state % 8 == 0) /* every 120 sec */
+       if (state % 120 == 0) /* every 120 sec */
                badness += 10;
-       if (state % 4 == 0) /* every 60 sec */
+       if (state % 60 == 0) /* every 60 sec */
                badness += 5;
-       if (state % 2 == 0) /* every 30 sec */
+       if (state % 30 == 0) /* every 30 sec */
                badness += 1;
-       if (state % 1 == 0) /* every 15 sec */
+       if (state % 15 == 0) /* every 15 sec */
                badness += 1;
 
 #define BADNESS_LIMIT  4
Index: linux-2.6.19.1/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
===================================================================
--- linux-2.6.19.1.orig/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
+++ linux-2.6.19.1/drivers/net/wireless/bcm43xx/bcm43xx_radio.h
@@ -65,6 +65,22 @@ void bcm43xx_radio_init2060(struct bcm43
 void bcm43xx_radio_turn_on(struct bcm43xx_private *bcm);
 void bcm43xx_radio_turn_off(struct bcm43xx_private *bcm);
 
+static inline
+int bcm43xx_is_hw_radio_enabled(struct bcm43xx_private *bcm)
+{
+       /* function to return state of hardware enable of radio
+        * returns 0 if radio disabled, 1 if radio enabled
+        */
+       if (likely(bcm->current_core->rev >= 3))
+               return ((bcm43xx_read32(bcm, BCM43xx_MMIO_RADIO_HWENABLED_HI)
+                                       & BCM43xx_MMIO_RADIO_HWENABLED_HI_MASK)
+                                       == 0) ? 1 : 0;
+       else
+               return ((bcm43xx_read16(bcm, BCM43xx_MMIO_RADIO_HWENABLED_LO)
+                                       & BCM43xx_MMIO_RADIO_HWENABLED_LO_MASK)
+                                       == 0) ? 0 : 1;
+}
+
 int bcm43xx_radio_selectchannel(struct bcm43xx_private *bcm, u8 channel,
                                int synthetic_pu_workaround);
 
Index: linux-2.6.19.1/drivers/net/wireless/bcm43xx/bcm43xx.h
===================================================================
--- linux-2.6.19.1.orig/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ linux-2.6.19.1/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -323,6 +323,10 @@
 #define BCM43xx_UCODEFLAG_UNKPACTRL    0x0040
 #define BCM43xx_UCODEFLAG_JAPAN                0x0080
 
+/* Hardware Radio Enable masks */
+#define BCM43xx_MMIO_RADIO_HWENABLED_HI_MASK (1 << 16)
+#define BCM43xx_MMIO_RADIO_HWENABLED_LO_MASK (1 << 4)
+
 /* Generic-Interrupt reasons. */
 #define BCM43xx_IRQ_READY              (1 << 0)
 #define BCM43xx_IRQ_BEACON             (1 << 1)
@@ -726,7 +730,8 @@ struct bcm43xx_private {
            bad_frames_preempt:1,       /* Use "Bad Frames Preemption" (default 
off) */
            reg124_set_0x4:1,           /* Some variable to keep track of IRQ 
stuff. */
            short_preamble:1,           /* TRUE, if short preamble is enabled. 
*/
-           firmware_norelease:1;       /* Do not release the firmware. Used on 
suspend. */
+           firmware_norelease:1,       /* Do not release the firmware. Used on 
suspend. */
+           radio_hw_enable:1;          /* TRUE if radio is hardware enabled */
 
        struct bcm43xx_stats stats;
 
Index: linux-2.6.19.1/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
===================================================================
--- linux-2.6.19.1.orig/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
+++ linux-2.6.19.1/drivers/net/wireless/bcm43xx/bcm43xx_leds.c
@@ -108,6 +108,7 @@ static void bcm43xx_led_init_hardcoded(s
        switch (led_index) {
        case 0:
                led->behaviour = BCM43xx_LED_ACTIVITY;
+               led->activelow = 1;
                if (bcm->board_vendor == PCI_VENDOR_ID_COMPAQ)
                        led->behaviour = BCM43xx_LED_RADIO_ALL;
                break;
_______________________________________________
Bcm43xx-dev mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev

Reply via email to