power.c is not needed anymore. Move the only function included in power.c into main.c.
Signed-off-by: Michael Buesch <[EMAIL PROTECTED]> Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/Makefile =================================================================== --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/Makefile 2007-08-08 22:09:47.000000000 +0200 +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/Makefile 2007-08-08 22:17:24.000000000 +0200 @@ -10,7 +10,6 @@ bcm43xx-mac80211-obj-$(CONFIG_BCM43XX_MA bcm43xx-mac80211-objs := bcm43xx_main.o \ bcm43xx_tables.o \ bcm43xx_phy.o \ - bcm43xx_power.o \ bcm43xx_sysfs.o \ bcm43xx_leds.o \ bcm43xx_xmit.o \ Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_dma.c =================================================================== --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_dma.c 2007-08-08 22:17:10.000000000 +0200 +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_dma.c 2007-08-08 22:17:24.000000000 +0200 @@ -31,7 +31,6 @@ #include "bcm43xx_dma.h" #include "bcm43xx_main.h" #include "bcm43xx_debugfs.h" -#include "bcm43xx_power.h" #include "bcm43xx_xmit.h" #include <linux/dma-mapping.h> @@ -1499,7 +1498,7 @@ static void bcm43xx_dma_tx_resume_ring(s void bcm43xx_dma_tx_suspend(struct bcm43xx_wldev *dev) { - bcm43xx_power_saving_ctl_bits(dev, -1, 1); + bcm43xx_power_saving_ctl_bits(dev, BCM43xx_PS_AWAKE); bcm43xx_dma_tx_suspend_ring(dev->dma.tx_ring0); bcm43xx_dma_tx_suspend_ring(dev->dma.tx_ring1); bcm43xx_dma_tx_suspend_ring(dev->dma.tx_ring2); @@ -1516,5 +1515,5 @@ void bcm43xx_dma_tx_resume(struct bcm43x bcm43xx_dma_tx_resume_ring(dev->dma.tx_ring2); bcm43xx_dma_tx_resume_ring(dev->dma.tx_ring1); bcm43xx_dma_tx_resume_ring(dev->dma.tx_ring0); - bcm43xx_power_saving_ctl_bits(dev, -1, -1); + bcm43xx_power_saving_ctl_bits(dev, 0); } Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.c =================================================================== --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.c 2007-08-08 22:17:20.000000000 +0200 +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.c 2007-08-08 22:17:24.000000000 +0200 @@ -46,7 +46,6 @@ #include "bcm43xx_phy.h" #include "bcm43xx_dma.h" #include "bcm43xx_pio.h" -#include "bcm43xx_power.h" #include "bcm43xx_sysfs.h" #include "bcm43xx_xmit.h" #include "bcm43xx_sysfs.h" @@ -874,6 +873,66 @@ static void bcm43xx_clear_keys(struct bc } } +void bcm43xx_power_saving_ctl_bits(struct bcm43xx_wldev *dev, + unsigned int ps_flags) +{ + u32 macctl; + u16 ucstat; + bool hwps; + bool awake; + int i; + + BCM43xx_WARN_ON((ps_flags & BCM43xx_PS_ENABLED) && + (ps_flags & BCM43xx_PS_DISABLED)); + BCM43xx_WARN_ON((ps_flags & BCM43xx_PS_AWAKE) && + (ps_flags & BCM43xx_PS_ASLEEP)); + + if (ps_flags & BCM43xx_PS_ENABLED) { + hwps = 1; + } else if (ps_flags & BCM43xx_PS_DISABLED) { + hwps = 0; + } else { + //TODO: If powersave is not off and FIXME is not set and we are not in adhoc + // and thus is not an AP and we are associated, set bit 25 + } + if (ps_flags & BCM43xx_PS_AWAKE) { + awake = 1; + } else if (ps_flags & BCM43xx_PS_ASLEEP) { + awake = 0; + } else { + //TODO: If the device is awake or this is an AP, or we are scanning, or FIXME, + // or we are associated, or FIXME, or the latest PS-Poll packet sent was + // successful, set bit26 + } + +/* FIXME: For now we force awake-on and hwps-off */ +hwps = 0; +awake = 1; + + macctl = bcm43xx_read32(dev, BCM43xx_MMIO_MACCTL); + if (hwps) + macctl |= BCM43xx_MACCTL_HWPS; + else + macctl &= ~BCM43xx_MACCTL_HWPS; + if (awake) + macctl |= BCM43xx_MACCTL_AWAKE; + else + macctl &= ~BCM43xx_MACCTL_AWAKE; + bcm43xx_write32(dev, BCM43xx_MMIO_MACCTL, macctl); + /* Commit write */ + bcm43xx_read32(dev, BCM43xx_MMIO_MACCTL); + if (awake && dev->dev->id.revision >= 5) { + /* Wait for the microcode to wake up. */ + for (i = 0; i < 100; i++) { + ucstat = bcm43xx_shm_read16(dev, BCM43xx_SHM_SHARED, + BCM43xx_SHM_SH_UCODESTAT); + if (ucstat != BCM43xx_SHM_SH_UCODESTAT_SLEEP) + break; + udelay(10); + } + } +} + /* Turn the Analog ON/OFF */ static void bcm43xx_switch_analog(struct bcm43xx_wldev *dev, int on) { @@ -1066,7 +1125,7 @@ static void handle_irq_tbtt_indication(s ///TODO: PS TBTT } else { if (1/*FIXME: the last PSpoll frame was sent successfully */) - bcm43xx_power_saving_ctl_bits(dev, -1, -1); + bcm43xx_power_saving_ctl_bits(dev, 0); } dev->reg124_set_0x4 = 0; if (bcm43xx_is_mode(dev->wl, IEEE80211_IF_TYPE_IBSS)) @@ -1912,7 +1971,7 @@ void bcm43xx_mac_enable(struct bcm43xx_w /* Commit writes */ bcm43xx_read32(dev, BCM43xx_MMIO_MACCTL); bcm43xx_read32(dev, BCM43xx_MMIO_GEN_IRQ_REASON); - bcm43xx_power_saving_ctl_bits(dev, -1, -1); + bcm43xx_power_saving_ctl_bits(dev, 0); } } @@ -1924,7 +1983,7 @@ void bcm43xx_mac_suspend(struct bcm43xx_ BCM43xx_WARN_ON(dev->mac_suspended < 0); if (dev->mac_suspended == 0) { - bcm43xx_power_saving_ctl_bits(dev, -1, 1); + bcm43xx_power_saving_ctl_bits(dev, BCM43xx_PS_AWAKE); bcm43xx_write32(dev, BCM43xx_MMIO_MACCTL, bcm43xx_read32(dev, BCM43xx_MMIO_MACCTL) & ~BCM43xx_MACCTL_ENABLED); Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.h =================================================================== --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.h 2007-08-08 22:09:47.000000000 +0200 +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_main.h 2007-08-08 22:17:24.000000000 +0200 @@ -153,4 +153,11 @@ void bcm43xx_mac_enable(struct bcm43xx_w void bcm43xx_controller_restart(struct bcm43xx_wldev *dev, const char *reason); +#define BCM43xx_PS_ENABLED (1 << 0) /* Force enable hardware power saving */ +#define BCM43xx_PS_DISABLED (1 << 1) /* Force disable hardware power saving */ +#define BCM43xx_PS_AWAKE (1 << 2) /* Force device awake */ +#define BCM43xx_PS_ASLEEP (1 << 3) /* Force device asleep */ +void bcm43xx_power_saving_ctl_bits(struct bcm43xx_wldev *dev, + unsigned int ps_flags); + #endif /* BCM43xx_MAIN_H_ */ Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c =================================================================== --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c 2007-08-08 22:17:20.000000000 +0200 +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_phy.c 2007-08-08 22:17:24.000000000 +0200 @@ -32,7 +32,6 @@ #include "bcm43xx_phy.h" #include "bcm43xx_main.h" #include "bcm43xx_tables.h" -#include "bcm43xx_power.h" #include "bcm43xx_lo.h" @@ -243,7 +242,7 @@ void bcm43xx_raw_phy_lock(struct bcm43xx spin_lock(&phy->lock); } else { if (!bcm43xx_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) - bcm43xx_power_saving_ctl_bits(dev, -1, 1); + bcm43xx_power_saving_ctl_bits(dev, BCM43xx_PS_AWAKE); } phy->locked = 1; } @@ -260,7 +259,7 @@ void bcm43xx_raw_phy_unlock(struct bcm43 } } else { if (!bcm43xx_is_mode(dev->wl, IEEE80211_IF_TYPE_AP)) - bcm43xx_power_saving_ctl_bits(dev, -1, -1); + bcm43xx_power_saving_ctl_bits(dev, 0); } phy->locked = 0; } Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_pio.c =================================================================== --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_pio.c 2007-08-08 22:17:20.000000000 +0200 +++ wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_pio.c 2007-08-08 22:17:24.000000000 +0200 @@ -27,7 +27,6 @@ #include "bcm43xx_pio.h" #include "bcm43xx_main.h" #include "bcm43xx_xmit.h" -#include "bcm43xx_power.h" #include <linux/delay.h> @@ -622,7 +621,7 @@ data_ready: void bcm43xx_pio_tx_suspend(struct bcm43xx_pioqueue *queue) { - bcm43xx_power_saving_ctl_bits(queue->dev, -1, 1); + bcm43xx_power_saving_ctl_bits(queue->dev, BCM43xx_PS_AWAKE); bcm43xx_pio_write(queue, BCM43xx_PIO_TXCTL, bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL) | BCM43xx_PIO_TXCTL_SUSPEND); @@ -633,7 +632,7 @@ void bcm43xx_pio_tx_resume(struct bcm43x bcm43xx_pio_write(queue, BCM43xx_PIO_TXCTL, bcm43xx_pio_read(queue, BCM43xx_PIO_TXCTL) & ~BCM43xx_PIO_TXCTL_SUSPEND); - bcm43xx_power_saving_ctl_bits(queue->dev, -1, -1); + bcm43xx_power_saving_ctl_bits(queue->dev, 0); tasklet_schedule(&queue->txtask); } Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_power.c =================================================================== --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_power.c 2007-08-08 22:17:20.000000000 +0200 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/* - - Broadcom BCM43xx wireless driver - - Copyright (c) 2005 Martin Langer <[EMAIL PROTECTED]>, - Stefano Brivio <[EMAIL PROTECTED]> - Michael Buesch <[EMAIL PROTECTED]> - Danny van Dyk <[EMAIL PROTECTED]> - Andreas Jaggi <[EMAIL PROTECTED]> - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#include <linux/delay.h> - -#include "bcm43xx.h" -#include "bcm43xx_power.h" -#include "bcm43xx_main.h" - - -//TODO Kill this file. - -/* Set the PowerSavingControlBits. - * Bitvalues: - * 0 => unset the bit - * 1 => set the bit - * -1 => calculate the bit - */ -void bcm43xx_power_saving_ctl_bits(struct bcm43xx_wldev *dev, - int bit25, int bit26) -{ - int i; - u32 macctl; - -//FIXME: Force 25 to off and 26 to on for now: -bit25 = 0; -bit26 = 1; - - if (bit25 == -1) { - //TODO: If powersave is not off and FIXME is not set and we are not in adhoc - // and thus is not an AP and we are associated, set bit 25 - } - if (bit26 == -1) { - //TODO: If the device is awake or this is an AP, or we are scanning, or FIXME, - // or we are associated, or FIXME, or the latest PS-Poll packet sent was - // successful, set bit26 - } - macctl = bcm43xx_read32(dev, BCM43xx_MMIO_MACCTL); - if (bit25) - macctl |= BCM43xx_MACCTL_HWPS; - else - macctl &= ~BCM43xx_MACCTL_HWPS; - if (bit26) - macctl |= BCM43xx_MACCTL_AWAKE; - else - macctl &= ~BCM43xx_MACCTL_AWAKE; - bcm43xx_write32(dev, BCM43xx_MMIO_MACCTL, macctl); - if (bit26 && dev->dev->id.revision >= 5) { - for (i = 0; i < 100; i++) { - if (bcm43xx_shm_read32(dev, BCM43xx_SHM_SHARED, 0x0040) != 4) - break; - udelay(10); - } - } -} Index: wireless-dev/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_power.h =================================================================== --- wireless-dev.orig/drivers/net/wireless/bcm43xx-mac80211/bcm43xx_power.h 2007-08-08 22:09:47.000000000 +0200 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -/* - - Broadcom BCM43xx wireless driver - - Copyright (c) 2005 Martin Langer <[EMAIL PROTECTED]>, - Stefano Brivio <[EMAIL PROTECTED]> - Michael Buesch <[EMAIL PROTECTED]> - Danny van Dyk <[EMAIL PROTECTED]> - Andreas Jaggi <[EMAIL PROTECTED]> - - Some parts of the code in this file are derived from the ipw2200 - driver Copyright(c) 2003 - 2004 Intel Corporation. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; see the file COPYING. If not, write to - the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, - Boston, MA 02110-1301, USA. - -*/ - -#ifndef BCM43xx_POWER_H_ -#define BCM43xx_POWER_H_ - -//TODO kill this file - -struct bcm43xx_wldev; - -void bcm43xx_power_saving_ctl_bits(struct bcm43xx_wldev *dev, - int bit25, int bit26); - -#endif /* BCM43xx_POWER_H_ */ -- _______________________________________________ Bcm43xx-dev mailing list Bcm43xx-dev@lists.berlios.de https://lists.berlios.de/mailman/listinfo/bcm43xx-dev