2011/2/9 George Kashperko <george@xxxxxxxxxxx>: > From: George Kashperko <george@xxxxxxxxxxx> > > Major differences between AI/SB from drivers' perespective is control > and state flags handling. These long term used to be TMSLOW/TMSHIGH ones > and in order to be handled transparently should be masked under some > indirect access handlers. This patch forces use of ssb_core_ctl_flags > and ssb_core_state_flags introduced early. TMSLOW/TMSHIGH defines outside > ssb code (b43, ssb gige and ohci drivers) were renamed to reflect actual > meaning, flags' definitions moved to low two bytes. Common TMSLOW/TMSHIGH > defines moved to ssb_private.h in order to limit their use by internal > SB-specic code only. > Signed-off-by: George Kashperko <george@xxxxxxxxxxx> > --- > Âdrivers/net/b44.c             Â|  Â2 > Âdrivers/net/wireless/b43/b43.h       |  32 ++++----- > Âdrivers/net/wireless/b43/dma.c       |  Â4 - > Âdrivers/net/wireless/b43/main.c      Â|  61 +++++++------------ > Âdrivers/net/wireless/b43/phy_g.c      |  Â2 > Âdrivers/net/wireless/b43/phy_n.c      |  18 +---- > Âdrivers/net/wireless/b43legacy/b43legacy.h |  20 +++--- > Âdrivers/net/wireless/b43legacy/dma.c    |  Â4 - > Âdrivers/net/wireless/b43legacy/main.c   Â|  52 +++++----------- > Âdrivers/net/wireless/b43legacy/phy.c    |  Â2 > Âdrivers/ssb/driver_gige.c         Â|  19 ++--- > Âdrivers/ssb/main.c             |  20 ++++-- > Âdrivers/ssb/ssb_private.h         Â|  24 +++++++ > Âdrivers/usb/host/ohci-ssb.c        Â|  Â4 - > Âinclude/linux/ssb/ssb.h          Â|  Â4 - > Âinclude/linux/ssb/ssb_driver_gige.h    Â|  12 +-- > Âinclude/linux/ssb/ssb_regs.h        |  42 ++++++------- > Â17 files changed, 160 insertions(+), 162 deletions(-) > --- linux-next-20110203.orig/drivers/net/b44.c Â2011-02-01 05:05:49.000000000 +0200 > +++ linux-next-20110203/drivers/net/b44.c    2011-02-08 12:17:03.000000000 +0200 > @@ -1568,7 +1568,7 @@ static void b44_setup_wol_pci(struct b44 >    Âu16 val; > >    Âif (bp->sdev->bus->bustype != SSB_BUSTYPE_SSB) { > -        bw32(bp, SSB_TMSLOW, br32(bp, SSB_TMSLOW) | SSB_TMSLOW_PE); > +        ssb_core_ctl_flags(bp->sdev, 0, SSB_CORECTL_PE, NULL); >        Âpci_read_config_word(bp->sdev->bus->host_pci, SSB_PMCSR, &val); >        Âpci_write_config_word(bp->sdev->bus->host_pci, SSB_PMCSR, val | SSB_PE); >    Â} > --- linux-next-20110203.orig/drivers/net/wireless/b43/b43.h   2011-02-01 05:05:49.000000000 +0200 > +++ linux-next-20110203/drivers/net/wireless/b43/b43.h Â2011-02-08 12:17:03.000000000 +0200 > @@ -414,22 +414,22 @@ enum { > Â#define B43_MACCMD_CCA         0x00000008   Â/* Clear channel assessment */ > Â#define B43_MACCMD_BGNOISE       0x00000010   Â/* Background noise */ > > -/* 802.11 core specific TM State Low (SSB_TMSLOW) flags */ > -#define B43_TMSLOW_GMODE        0x20000000   Â/* G Mode Enable */ > -#define B43_TMSLOW_PHY_BANDWIDTH    0x00C00000   Â/* PHY band width and clock speed mask (N-PHY only) */ > -#define ÂB43_TMSLOW_PHY_BANDWIDTH_10MHZ    Â0x00000000   Â/* 10 MHz bandwidth, 40 MHz PHY */ > -#define ÂB43_TMSLOW_PHY_BANDWIDTH_20MHZ    Â0x00400000   Â/* 20 MHz bandwidth, 80 MHz PHY */ > -#define ÂB43_TMSLOW_PHY_BANDWIDTH_40MHZ    Â0x00800000   Â/* 40 MHz bandwidth, 160 MHz PHY */ > -#define B43_TMSLOW_PLLREFSEL      0x00200000   Â/* PLL Frequency Reference Select (rev >= 5) */ > -#define B43_TMSLOW_MACPHYCLKEN     0x00100000   Â/* MAC PHY Clock Control Enable (rev >= 5) */ > -#define B43_TMSLOW_PHYRESET      Â0x00080000   Â/* PHY Reset */ > -#define B43_TMSLOW_PHYCLKEN      Â0x00040000   Â/* PHY Clock Enable */ > - > -/* 802.11 core specific TM State High (SSB_TMSHIGH) flags */ > -#define B43_TMSHIGH_DUALBAND_PHY    0x00080000   Â/* Dualband PHY available */ > -#define B43_TMSHIGH_FCLOCK       0x00040000   Â/* Fast Clock Available (rev >= 5) */ > -#define B43_TMSHIGH_HAVE_5GHZ_PHY   Â0x00020000   Â/* 5 GHz PHY available (rev >= 5) */ > -#define B43_TMSHIGH_HAVE_2GHZ_PHY   Â0x00010000   Â/* 2.4 GHz PHY available (rev >= 5) */ > +/* 802.11 core specific control flags */ > +#define B43_CORECTL_GMODE           Â0x2000 Â/* G Mode Enable */ > +#define B43_CORECTL_PHY_BANDWIDTH       Â0x00C0 Â/* PHY band width and clock speed mask (N-PHY only) */ > +#define ÂB43_CORECTL_PHY_BANDWIDTH_10MHZ    0x0000 Â/* 10 MHz bandwidth, 40 MHz PHY */ > +#define ÂB43_CORECTL_PHY_BANDWIDTH_20MHZ    0x0040 Â/* 20 MHz bandwidth, 80 MHz PHY */ > +#define ÂB43_CORECTL_PHY_BANDWIDTH_40MHZ    0x0080 Â/* 40 MHz bandwidth, 160 MHz PHY */ > +#define B43_CORECTL_PLLREFSEL         Â0x0020 Â/* PLL Frequency Reference Select (rev >= 5) */ > +#define B43_CORECTL_MACPHYCLKEN            Â0x0010 Â/* MAC PHY Clock Control Enable (rev >= 5) */ > +#define B43_CORECTL_PHYRESET          0x0008 Â/* PHY Reset */ > +#define B43_CORECTL_PHYCLKEN          0x0004 Â/* PHY Clock Enable */ > + > +/* 802.11 core specific state flags */ > +#define B43_CORESTAT_DUALBAND_PHY       Â0x0008 Â/* Dualband PHY available */ > +#define B43_CORESTAT_FCLOCK          Â0x0004 Â/* Fast Clock Available (rev >= 5) */ > +#define B43_CORESTAT_HAVE_5GHZ_PHY       0x0002 Â/* 5 GHz PHY available (rev >= 5) */ > +#define B43_CORESTAT_HAVE_2GHZ_PHY       0x0001 Â/* 2.4 GHz PHY available (rev >= 5) */ I don't know, I've doubts about it :/ That flags are quite messy, mask for them is 0x3FFC0000. Ideally we should shift it by 14 bits, but that would make writing code harder. Maaaaybe... Michael what do you think about this? > @@ -1213,6 +1214,9 @@ static void ssb_device_disable_sb(struct >    Âif (ssb_read32(dev, SSB_TMSLOW) & SSB_TMSLOW_RESET) >        Âreturn; > > +    SSB_WARN_ON(core_specific_flags & 0xFFFF0000); Make it ~0x00003FFC, value 0x1 is not valid flag. Why don't you go ahead and make core flags u16? -- RafaÅ -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html