Re: [PATCH 01/11] b43: N-PHY: add some registers and structs definitions

2010-02-09 Thread Michael Buesch
On Tuesday 09 February 2010 21:04:33 Rafał Miłecki wrote:
> +#define B43_MMIO_PSM_PHY_HDR 0x492   /* programmable state machine */

The comment doesn't make a lot of sense.
In case you don't know, the PSM is the part of the hardware
that executes the firmware.

-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH 09/11] b43: N-PHY: isloate 2055 radio setup

2010-02-09 Thread Michael Buesch
On Tuesday 09 February 2010 21:04:41 Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki 
> ---
>  drivers/net/wireless/b43/phy_n.c |   24 ++--
>  1 files changed, 18 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/phy_n.c 
> b/drivers/net/wireless/b43/phy_n.c
> index 835d0da..631e01f 100644
> --- a/drivers/net/wireless/b43/phy_n.c
> +++ b/drivers/net/wireless/b43/phy_n.c
> @@ -155,6 +155,23 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
>   //TODO
>  }
>  
> +
> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
> +static void b43_radio_2055_setup(struct b43_wldev *dev,
> + const struct b43_nphy_channeltab_entry *e)
> +{
> + B43_WARN_ON(dev->phy.rev >= 3);
> +
> + b43_chantab_radio_upload(dev, e);
> + udelay(50);
> + b43_radio_write(dev, B2055_VCO_CAL10, 5);
> + b43_radio_write(dev, B2055_VCO_CAL10, 45);
> + if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
> + b43_read32(dev, B43_MMIO_MACCTL);

Just read MACCTL unconditionally. It obviously is just used for bus posting.
We usually also add a comment.

b43_read32(dev, B43_MMIO_MACCTL); /* flush writes */

-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH 08/11] b43: implement writing to MMIO shared memory

2010-02-09 Thread Michael Buesch
On Tuesday 09 February 2010 21:04:40 Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki 
> ---
>  drivers/net/wireless/b43/phy_common.c |   11 +++
>  drivers/net/wireless/b43/phy_common.h |2 ++
>  2 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/phy_common.c 
> b/drivers/net/wireless/b43/phy_common.c
> index 8f7d7ef..0b0f9df 100644
> --- a/drivers/net/wireless/b43/phy_common.c
> +++ b/drivers/net/wireless/b43/phy_common.c
> @@ -466,3 +466,14 @@ struct b43_c32 b43_cordic(int theta)
>  
>   return ret;
>  }
> +
> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWriteShm */
> +void b43_bmac_write_shm(struct b43_wldev *dev, u32 offset, u16 value)
> +{
> + b43_write32(dev, B43_MMIO_SHM_CONTROL, 0x0001 | (offset >> 2));
> + b43_read32(dev, B43_MMIO_SHM_CONTROL);
> + if (offset & 2)
> + b43_write16(dev, 0x165, value);
> + else
> + b43_write16(dev, B43_MMIO_SHM_DATA, value);
> +}

I'd like to put a bg questionmark on this.
We already have SHM access. Your function does exactly the same, except that it
accesses the bullshit register h165.

-- 
Greetings, Michael.
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: [PATCH 11/11] b43: N-PHY: switch to chanspec ops

2010-02-09 Thread Larry Finger
On 02/09/2010 02:04 PM, Rafał Miłecki wrote:
> Signed-off-by: Rafał Miłecki 
> ---
>  drivers/net/wireless/b43/phy_n.c |   87 
> +++---
>  drivers/net/wireless/b43/phy_n.h |1 +
>  2 files changed, 63 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/net/wireless/b43/phy_n.c 
> b/drivers/net/wireless/b43/phy_n.c
> index 19d4f11..49256bf 100644
> --- a/drivers/net/wireless/b43/phy_n.c
> +++ b/drivers/net/wireless/b43/phy_n.c
> @@ -72,6 +72,7 @@ static void b43_nphy_rf_control_override(struct b43_wldev 
> *dev, u16 field,
>   u16 value, u8 core, bool off);
>  static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 
> field,
>   u16 value, u8 core);
> +static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel);
>  
>  static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec)
>  {
> @@ -172,31 +173,6 @@ static void b43_radio_2055_setup(struct b43_wldev *dev,
>   udelay(300);
>  }
>  
> -/* Tune the hardware to a new channel. */
> -static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
> -{
> - const struct b43_nphy_channeltab_entry *tabent;
> -
> - tabent = b43_nphy_get_chantabent(dev, channel);
> - if (!tabent)
> - return -ESRCH;
> -
> - //FIXME enable/disable band select upper20 in RXCTL
> - if (0 /*FIXME 5Ghz*/)
> - b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20);
> - else
> - b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50);
> - b43_radio_2055_setup(dev, tabent);
> - if (0 /*FIXME 5Ghz*/)
> - b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
> - else
> - b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
> - b43_chantab_phy_upload(dev, tabent);
> - b43_nphy_tx_power_fix(dev);
> -
> - return 0;
> -}
> -
>  static void b43_radio_init2055_pre(struct b43_wldev *dev)
>  {
>   b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
> @@ -3345,6 +3321,67 @@ static void b43_nphy_chanspec_setup(struct b43_wldev 
> *dev,
>   b43_nphy_spur_workaround(dev);
>  }
>  
> +/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */
> +static int b43_nphy_set_chanspec(struct b43_wldev *dev,
> + struct b43_chanspec chanspec)
> +{
> + struct b43_phy_n *nphy = dev->phy.n;
> +
> + const struct b43_nphy_channeltab_entry *tabent;
> +
> + u8 tmp;
> + u8 channel = chanspec.channel;
> +
> + if (dev->phy.rev >= 3) {
> + /* TODO */
> + }
> +
> + nphy->radio_chanspec = chanspec;
> +
> + if (chanspec.b_width != nphy->b_widht)
> + ; /* TODO: BMAC BW Set (chanspec.b_width) */
> +
> + /* TODO: use defines */
> + if (chanspec.b_width == 3) {
> + if (chanspec.sideband == 2)
> + b43_phy_set(dev, B43_NPHY_RXCTL,
> + B43_NPHY_RXCTL_BSELU20);
> + else
> + b43_phy_mask(dev, B43_NPHY_RXCTL,
> + ~B43_NPHY_RXCTL_BSELU20);
> + }
> +
> + if (dev->phy.rev >= 3) {
> + tmp = (chanspec.b_freq == 1) ? 4 : 0;
> + b43_radio_maskset(dev, 0x08, 0xFFFB, tmp);
> + /* TODO: PHY Radio2056 Setup (chan_info_ptr[i]) */
> + /* TODO: N PHY Chanspec Setup (chan_info_ptr[i]) */
> + } else {
> + tabent = b43_nphy_get_chantabent(dev, channel);
> + if (!tabent)
> + return -ESRCH;
> +
> + tmp = (chanspec.b_freq == 1) ? 0x0020 : 0x0050;
> + b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp);
> + b43_radio_2055_setup(dev, tabent);
> + b43_nphy_chanspec_setup(dev, tabent, chanspec);
> + }
> +
> + return 0;
> +}
> +
> +/* Tune the hardware to a new channel */
> +static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
> +{
> + struct b43_phy_n *nphy = dev->phy.n;
> +
> + struct b43_chanspec chanspec;
> + chanspec = nphy->radio_chanspec;
> + chanspec.channel = channel;
> +
> + return b43_nphy_set_chanspec(dev, chanspec);
> +}
> +
>  static int b43_nphy_op_allocate(struct b43_wldev *dev)
>  {
>   struct b43_phy_n *nphy;
> diff --git a/drivers/net/wireless/b43/phy_n.h 
> b/drivers/net/wireless/b43/phy_n.h
> index e7acae2..26d01fe 100644
> --- a/drivers/net/wireless/b43/phy_n.h
> +++ b/drivers/net/wireless/b43/phy_n.h
> @@ -984,6 +984,7 @@ struct b43_phy_n {
>   u16 papd_epsilon_offset[2];
>   s32 preamble_override;
>   u32 bb_mult_save;
> + u8 b_widht;

Typo here?

>   struct b43_chanspec radio_chanspec;
>  
>   bool gain_boost;

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 11/11] b43: N-PHY: switch to chanspec ops

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   87 +++---
 drivers/net/wireless/b43/phy_n.h |1 +
 2 files changed, 63 insertions(+), 25 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 19d4f11..49256bf 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -72,6 +72,7 @@ static void b43_nphy_rf_control_override(struct b43_wldev 
*dev, u16 field,
u16 value, u8 core, bool off);
 static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
u16 value, u8 core);
+static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel);
 
 static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec)
 {
@@ -172,31 +173,6 @@ static void b43_radio_2055_setup(struct b43_wldev *dev,
udelay(300);
 }
 
-/* Tune the hardware to a new channel. */
-static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
-{
-   const struct b43_nphy_channeltab_entry *tabent;
-
-   tabent = b43_nphy_get_chantabent(dev, channel);
-   if (!tabent)
-   return -ESRCH;
-
-   //FIXME enable/disable band select upper20 in RXCTL
-   if (0 /*FIXME 5Ghz*/)
-   b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20);
-   else
-   b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50);
-   b43_radio_2055_setup(dev, tabent);
-   if (0 /*FIXME 5Ghz*/)
-   b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
-   else
-   b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
-   b43_chantab_phy_upload(dev, tabent);
-   b43_nphy_tx_power_fix(dev);
-
-   return 0;
-}
-
 static void b43_radio_init2055_pre(struct b43_wldev *dev)
 {
b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
@@ -3345,6 +3321,67 @@ static void b43_nphy_chanspec_setup(struct b43_wldev 
*dev,
b43_nphy_spur_workaround(dev);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SetChanspec */
+static int b43_nphy_set_chanspec(struct b43_wldev *dev,
+   struct b43_chanspec chanspec)
+{
+   struct b43_phy_n *nphy = dev->phy.n;
+
+   const struct b43_nphy_channeltab_entry *tabent;
+
+   u8 tmp;
+   u8 channel = chanspec.channel;
+
+   if (dev->phy.rev >= 3) {
+   /* TODO */
+   }
+
+   nphy->radio_chanspec = chanspec;
+
+   if (chanspec.b_width != nphy->b_widht)
+   ; /* TODO: BMAC BW Set (chanspec.b_width) */
+
+   /* TODO: use defines */
+   if (chanspec.b_width == 3) {
+   if (chanspec.sideband == 2)
+   b43_phy_set(dev, B43_NPHY_RXCTL,
+   B43_NPHY_RXCTL_BSELU20);
+   else
+   b43_phy_mask(dev, B43_NPHY_RXCTL,
+   ~B43_NPHY_RXCTL_BSELU20);
+   }
+
+   if (dev->phy.rev >= 3) {
+   tmp = (chanspec.b_freq == 1) ? 4 : 0;
+   b43_radio_maskset(dev, 0x08, 0xFFFB, tmp);
+   /* TODO: PHY Radio2056 Setup (chan_info_ptr[i]) */
+   /* TODO: N PHY Chanspec Setup (chan_info_ptr[i]) */
+   } else {
+   tabent = b43_nphy_get_chantabent(dev, channel);
+   if (!tabent)
+   return -ESRCH;
+
+   tmp = (chanspec.b_freq == 1) ? 0x0020 : 0x0050;
+   b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, tmp);
+   b43_radio_2055_setup(dev, tabent);
+   b43_nphy_chanspec_setup(dev, tabent, chanspec);
+   }
+
+   return 0;
+}
+
+/* Tune the hardware to a new channel */
+static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
+{
+   struct b43_phy_n *nphy = dev->phy.n;
+
+   struct b43_chanspec chanspec;
+   chanspec = nphy->radio_chanspec;
+   chanspec.channel = channel;
+
+   return b43_nphy_set_chanspec(dev, chanspec);
+}
+
 static int b43_nphy_op_allocate(struct b43_wldev *dev)
 {
struct b43_phy_n *nphy;
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index e7acae2..26d01fe 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -984,6 +984,7 @@ struct b43_phy_n {
u16 papd_epsilon_offset[2];
s32 preamble_override;
u32 bb_mult_save;
+   u8 b_widht;
struct b43_chanspec radio_chanspec;
 
bool gain_boost;
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 10/11] b43: N-PHY: implement chanspec setup

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   62 ++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 631e01f..19d4f11 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -3283,6 +3283,68 @@ int b43_phy_initn(struct b43_wldev *dev)
return 0;
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/ChanspecSetup */
+static void b43_nphy_chanspec_setup(struct b43_wldev *dev,
+   const struct b43_nphy_channeltab_entry *e,
+   struct b43_chanspec chanspec)
+{
+   struct b43_phy *phy = &dev->phy;
+   struct b43_phy_n *nphy = dev->phy.n;
+
+   u16 tmp;
+   u32 tmp32;
+
+   tmp = b43_phy_read(dev, B43_NPHY_BANDCTL) & B43_NPHY_BANDCTL_5GHZ;
+   if (chanspec.b_freq == 1 && tmp == 0) {
+   tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR);
+   b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4);
+   b43_phy_set(dev, B43_PHY_B_BBCFG, 0xC000);
+   b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32);
+   b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
+   } else if (chanspec.b_freq == 1) {
+   b43_phy_mask(dev, B43_NPHY_BANDCTL, ~B43_NPHY_BANDCTL_5GHZ);
+   tmp32 = b43_read32(dev, B43_MMIO_PSM_PHY_HDR);
+   b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32 | 4);
+   b43_phy_mask(dev, B43_PHY_B_BBCFG, (u16)~0xC000);
+   b43_write32(dev, B43_MMIO_PSM_PHY_HDR, tmp32);
+   }
+
+   b43_chantab_phy_upload(dev, e);
+
+   tmp = chanspec.channel;
+   if (chanspec.b_freq == 1)
+   tmp |= 0x0100;
+   if (chanspec.b_width == 3)
+   tmp |= 0x0200;
+   b43_bmac_write_shm(dev, 0xA0, tmp);
+
+   if (nphy->radio_chanspec.channel == 14) {
+   b43_nphy_classifier(dev, 2, 0);
+   b43_phy_set(dev, B43_PHY_B_TEST, 0x0800);
+   } else {
+   b43_nphy_classifier(dev, 2, 2);
+   if (chanspec.b_freq == 2)
+   b43_phy_mask(dev, B43_PHY_B_TEST, ~0x840);
+   }
+
+   if (nphy->txpwrctrl)
+   b43_nphy_tx_power_fix(dev);
+
+   if (dev->phy.rev < 3)
+   b43_nphy_adjust_lna_gain_table(dev);
+
+   b43_nphy_tx_lp_fbw(dev);
+
+   if (dev->phy.rev >= 3 && 0) {
+   /* TODO */
+   }
+
+   b43_phy_write(dev, B43_NPHY_NDATAT_DUP40, 0x3830);
+
+   if (phy->rev >= 3)
+   b43_nphy_spur_workaround(dev);
+}
+
 static int b43_nphy_op_allocate(struct b43_wldev *dev)
 {
struct b43_phy_n *nphy;
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 09/11] b43: N-PHY: isloate 2055 radio setup

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   24 ++--
 1 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 835d0da..631e01f 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -155,6 +155,23 @@ static void b43_nphy_tx_power_fix(struct b43_wldev *dev)
//TODO
 }
 
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/Radio/2055Setup */
+static void b43_radio_2055_setup(struct b43_wldev *dev,
+   const struct b43_nphy_channeltab_entry *e)
+{
+   B43_WARN_ON(dev->phy.rev >= 3);
+
+   b43_chantab_radio_upload(dev, e);
+   udelay(50);
+   b43_radio_write(dev, B2055_VCO_CAL10, 5);
+   b43_radio_write(dev, B2055_VCO_CAL10, 45);
+   if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+   b43_read32(dev, B43_MMIO_MACCTL);
+   b43_radio_write(dev, B2055_VCO_CAL10, 65);
+   udelay(300);
+}
+
 /* Tune the hardware to a new channel. */
 static int nphy_channel_switch(struct b43_wldev *dev, unsigned int channel)
 {
@@ -169,12 +186,7 @@ static int nphy_channel_switch(struct b43_wldev *dev, 
unsigned int channel)
b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x20);
else
b43_radio_maskset(dev, B2055_MASTER1, 0xFF8F, 0x50);
-   b43_chantab_radio_upload(dev, tabent);
-   udelay(50);
-   b43_radio_write16(dev, B2055_VCO_CAL10, 5);
-   b43_radio_write16(dev, B2055_VCO_CAL10, 45);
-   b43_radio_write16(dev, B2055_VCO_CAL10, 65);
-   udelay(300);
+   b43_radio_2055_setup(dev, tabent);
if (0 /*FIXME 5Ghz*/)
b43_phy_set(dev, B43_NPHY_BANDCTL, B43_NPHY_BANDCTL_5GHZ);
else
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 08/11] b43: implement writing to MMIO shared memory

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_common.c |   11 +++
 drivers/net/wireless/b43/phy_common.h |2 ++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_common.c 
b/drivers/net/wireless/b43/phy_common.c
index 8f7d7ef..0b0f9df 100644
--- a/drivers/net/wireless/b43/phy_common.c
+++ b/drivers/net/wireless/b43/phy_common.c
@@ -466,3 +466,14 @@ struct b43_c32 b43_cordic(int theta)
 
return ret;
 }
+
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/BmacWriteShm */
+void b43_bmac_write_shm(struct b43_wldev *dev, u32 offset, u16 value)
+{
+   b43_write32(dev, B43_MMIO_SHM_CONTROL, 0x0001 | (offset >> 2));
+   b43_read32(dev, B43_MMIO_SHM_CONTROL);
+   if (offset & 2)
+   b43_write16(dev, 0x165, value);
+   else
+   b43_write16(dev, B43_MMIO_SHM_DATA, value);
+}
diff --git a/drivers/net/wireless/b43/phy_common.h 
b/drivers/net/wireless/b43/phy_common.h
index bd480b4..484d4d7 100644
--- a/drivers/net/wireless/b43/phy_common.h
+++ b/drivers/net/wireless/b43/phy_common.h
@@ -429,4 +429,6 @@ void b43_phyop_switch_analog_generic(struct b43_wldev *dev, 
bool on);
 
 struct b43_c32 b43_cordic(int theta);
 
+void b43_bmac_write_shm(struct b43_wldev *dev, u32 offset, u16 value);
+
 #endif /* LINUX_B43_PHY_COMMON_H_ */
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 07/11] b43: N-PHY: adjust gain table

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   58 +-
 1 files changed, 57 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 4ff09b8..835d0da 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -837,6 +837,62 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev)
b43_nphy_stay_in_carrier_search(dev, 0);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/AdjustLnaGainTbl */
+static void b43_nphy_adjust_lna_gain_table(struct b43_wldev *dev)
+{
+   struct b43_phy_n *nphy = dev->phy.n;
+
+   u8 i;
+   s16 tmp;
+   u16 data[4];
+   s16 gain[2];
+   u16 minmax[2];
+   u16 lna_gain[4] = { -2, 10, 19, 25 };
+
+   if (nphy->hang_avoid)
+   b43_nphy_stay_in_carrier_search(dev, 1);
+
+   if (nphy->gain_boost) {
+   if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+   gain[0] = 6;
+   gain[1] = 6;
+   } else {
+   tmp = 40370 - 315 * nphy->radio_chanspec.channel;
+   gain[0] = ((tmp >> 13) + ((tmp >> 12) & 1));
+   tmp = 23242 - 224 * nphy->radio_chanspec.channel;
+   gain[1] = ((tmp >> 13) + ((tmp >> 12) & 1));
+   }
+   } else {
+   gain[0] = 0;
+   gain[1] = 0;
+   }
+
+   for (i = 0; i < 2; i++) {
+   if (nphy->elna_gain_config) {
+   data[0] = 19 + gain[i];
+   data[1] = 25 + gain[i];
+   data[2] = 25 + gain[i];
+   data[3] = 25 + gain[i];
+   } else {
+   data[0] = lna_gain[0] + gain[i];
+   data[1] = lna_gain[1] + gain[i];
+   data[2] = lna_gain[2] + gain[i];
+   data[3] = lna_gain[3] + gain[i];
+   }
+   b43_ntab_write_bulk(dev, B43_NTAB16(10, 8), 4, data);
+
+   minmax[i] = 23 + gain[i];
+   }
+
+   b43_phy_maskset(dev, B43_NPHY_C1_MINMAX_GAIN, ~B43_NPHY_C1_MINGAIN,
+   minmax[0] << B43_NPHY_C1_MINGAIN_SHIFT);
+   b43_phy_maskset(dev, B43_NPHY_C2_MINMAX_GAIN, ~B43_NPHY_C2_MINGAIN,
+   minmax[1] << B43_NPHY_C2_MINGAIN_SHIFT);
+
+   if (nphy->hang_avoid)
+   b43_nphy_stay_in_carrier_search(dev, 0);
+}
+
 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/WorkaroundsGainCtrl */
 static void b43_nphy_gain_crtl_workarounds(struct b43_wldev *dev)
 {
@@ -921,7 +977,7 @@ static void b43_nphy_gain_crtl_workarounds(struct b43_wldev 
*dev)
b43_phy_write(dev, B43_NPHY_TABLE_DATALO,
(code << 8 | 0x7C));
 
-   /* TODO: b43_nphy_adjust_lna_gain_table(dev); */
+   b43_nphy_adjust_lna_gain_table(dev);
 
if (nphy->elna_gain_config) {
b43_phy_write(dev, B43_NPHY_TABLE_ADDR, 0x0808);
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 06/11] b43: N-PHY: switch to chanspec struct

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   45 +
 drivers/net/wireless/b43/phy_n.h |   11 +
 2 files changed, 36 insertions(+), 20 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 2f45817..4ff09b8 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -73,6 +73,21 @@ static void b43_nphy_rf_control_override(struct b43_wldev 
*dev, u16 field,
 static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
u16 value, u8 core);
 
+static inline bool b43_empty_chanspec(struct b43_chanspec *chanspec)
+{
+   return !chanspec->channel && !chanspec->sideband &&
+   !chanspec->b_width && !chanspec->b_freq;
+}
+
+static inline bool b43_eq_chanspecs(struct b43_chanspec *chanspec1,
+   struct b43_chanspec *chanspec2)
+{
+   return (chanspec1->channel == chanspec2->channel &&
+   chanspec1->sideband == chanspec2->sideband &&
+   chanspec1->b_width == chanspec2->b_width &&
+   chanspec1->b_freq == chanspec2->b_freq);
+}
+
 void b43_nphy_set_rxantenna(struct b43_wldev *dev, int antenna)
 {//TODO
 }
@@ -768,7 +783,7 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev)
 {
struct b43_phy_n *nphy = dev->phy.n;
 
-   unsigned int channel;
+   u8 channel = nphy->radio_chanspec.channel;
int tone[2] = { 57, 58 };
u32 noise[2] = { 0x3FF, 0x3FF };
 
@@ -777,8 +792,6 @@ static void b43_nphy_spur_workaround(struct b43_wldev *dev)
if (nphy->hang_avoid)
b43_nphy_stay_in_carrier_search(dev, 1);
 
-   /* FIXME: channel = radio_chanspec */
-
if (nphy->gband_spurwar_en) {
/* TODO: N PHY Adjust Analog Pfbw (7) */
if (channel == 11 && dev->phy.is_40mhz)
@@ -2015,12 +2028,12 @@ static void b43_nphy_restore_rssi_cal(struct b43_wldev 
*dev)
u16 *rssical_phy_regs = NULL;
 
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
-   if (!nphy->rssical_chanspec_2G)
+   if (b43_empty_chanspec(&nphy->rssical_chanspec_2G))
return;
rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_2G;
rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_2G;
} else {
-   if (!nphy->rssical_chanspec_5G)
+   if (b43_empty_chanspec(&nphy->rssical_chanspec_5G))
return;
rssical_radio_regs = nphy->rssical_cache.rssical_radio_regs_5G;
rssical_phy_regs = nphy->rssical_cache.rssical_phy_regs_5G;
@@ -2440,7 +2453,7 @@ static void b43_nphy_save_cal(struct b43_wldev *dev)
 
struct b43_phy_n_iq_comp *rxcal_coeffs = NULL;
u16 *txcal_radio_regs = NULL;
-   u8 *iqcal_chanspec;
+   struct b43_chanspec *iqcal_chanspec;
u16 *table = NULL;
 
if (nphy->hang_avoid)
@@ -2496,12 +2509,12 @@ static void b43_nphy_restore_cal(struct b43_wldev *dev)
struct b43_phy_n_iq_comp *rxcal_coeffs = NULL;
 
if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
-   if (nphy->iqcal_chanspec_2G == 0)
+   if (b43_empty_chanspec(&nphy->iqcal_chanspec_2G))
return;
table = nphy->cal_cache.txcal_coeffs_2G;
loft = &nphy->cal_cache.txcal_coeffs_2G[5];
} else {
-   if (nphy->iqcal_chanspec_5G == 0)
+   if (b43_empty_chanspec(&nphy->iqcal_chanspec_5G))
return;
table = nphy->cal_cache.txcal_coeffs_5G;
loft = &nphy->cal_cache.txcal_coeffs_5G[5];
@@ -2746,8 +2759,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length,
nphy->txiqlocal_bestc);
nphy->txiqlocal_coeffsvalid = true;
-   /* TODO: Set nphy->txiqlocal_chanspec to
-   the current channel */
+   nphy->txiqlocal_chanspec = nphy->radio_chanspec;
} else {
length = 11;
if (dev->phy.rev < 3)
@@ -2782,7 +2794,8 @@ static void b43_nphy_reapply_tx_cal_coeffs(struct 
b43_wldev *dev)
u16 buffer[7];
bool equal = true;
 
-   if (!nphy->txiqlocal_coeffsvalid || 1 /* FIXME */)
+   if (!nphy->txiqlocal_coeffsvalid ||
+   b43_eq_chanspecs(&nphy->txiqlocal_chanspec, &nphy->radio_chanspec))
return;
 
b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer);
@@ -3137,9 +3150,11 @@ int b43_phy_initn(struct b43_wldev *dev)
do_rssi_cal = false;
if (phy->rev >= 3) {
if (b43_current_band(dev->w

[PATCH 05/11] b43: N-PHY: update post init of 2055 radio

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   61 +
 1 files changed, 35 insertions(+), 26 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index ebb9632..2f45817 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -183,49 +183,58 @@ static void b43_radio_init2055_pre(struct b43_wldev *dev)
 
 static void b43_radio_init2055_post(struct b43_wldev *dev)
 {
+   struct b43_phy_n *nphy = dev->phy.n;
struct ssb_sprom *sprom = &(dev->dev->bus->sprom);
struct ssb_boardinfo *binfo = &(dev->dev->bus->boardinfo);
int i;
u16 val;
+   bool workaround = false;
+
+   if (sprom->revision < 4)
+   workaround = (binfo->vendor != PCI_VENDOR_ID_BROADCOM ||
+   binfo->type != 0x46D ||
+   binfo->rev < 0x41);
+   else
+   workaround = ((sprom->boardflags_hi & B43_BFH_NOPA) == 0);
 
b43_radio_mask(dev, B2055_MASTER1, 0xFFF3);
-   msleep(1);
-   if ((sprom->revision != 4) ||
-  !(sprom->boardflags_hi & B43_BFH_RSSIINV)) {
-   if ((binfo->vendor != PCI_VENDOR_ID_BROADCOM) ||
-   (binfo->type != 0x46D) ||
-   (binfo->rev < 0x41)) {
-   b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
-   b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
-   msleep(1);
-   }
+   if (workaround) {
+   b43_radio_mask(dev, B2055_C1_RX_BB_REG, 0x7F);
+   b43_radio_mask(dev, B2055_C2_RX_BB_REG, 0x7F);
}
-   b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0x3F, 0x2C);
-   msleep(1);
-   b43_radio_write16(dev, B2055_CAL_MISC, 0x3C);
-   msleep(1);
+   b43_radio_maskset(dev, B2055_RRCCAL_NOPTSEL, 0xFFC0, 0x2C);
+   b43_radio_write(dev, B2055_CAL_MISC, 0x3C);
b43_radio_mask(dev, B2055_CAL_MISC, 0xFFBE);
-   msleep(1);
b43_radio_set(dev, B2055_CAL_LPOCTL, 0x80);
-   msleep(1);
b43_radio_set(dev, B2055_CAL_MISC, 0x1);
msleep(1);
b43_radio_set(dev, B2055_CAL_MISC, 0x40);
-   msleep(1);
-   for (i = 0; i < 100; i++) {
-   val = b43_radio_read16(dev, B2055_CAL_COUT2);
-   if (val & 0x80)
+   for (i = 0; i < 200; i++) {
+   val = b43_radio_read(dev, B2055_CAL_COUT2);
+   if (val & 0x80) {
+   i = 0;
break;
+   }
udelay(10);
}
-   msleep(1);
+   if (i)
+   b43err(dev->wl, "radio post init timeout\n");
b43_radio_mask(dev, B2055_CAL_LPOCTL, 0xFF7F);
-   msleep(1);
nphy_channel_switch(dev, dev->phy.channel);
-   b43_radio_write16(dev, B2055_C1_RX_BB_LPF, 0x9);
-   b43_radio_write16(dev, B2055_C2_RX_BB_LPF, 0x9);
-   b43_radio_write16(dev, B2055_C1_RX_BB_MIDACHP, 0x83);
-   b43_radio_write16(dev, B2055_C2_RX_BB_MIDACHP, 0x83);
+   b43_radio_write(dev, B2055_C1_RX_BB_LPF, 0x9);
+   b43_radio_write(dev, B2055_C2_RX_BB_LPF, 0x9);
+   b43_radio_write(dev, B2055_C1_RX_BB_MIDACHP, 0x83);
+   b43_radio_write(dev, B2055_C2_RX_BB_MIDACHP, 0x83);
+   b43_radio_maskset(dev, B2055_C1_LNA_GAINBST, 0xFFF8, 0x6);
+   b43_radio_maskset(dev, B2055_C2_LNA_GAINBST, 0xFFF8, 0x6);
+   if (!nphy->gain_boost) {
+   b43_radio_set(dev, B2055_C1_RX_RFSPC1, 0x2);
+   b43_radio_set(dev, B2055_C2_RX_RFSPC1, 0x2);
+   } else {
+   b43_radio_mask(dev, B2055_C1_RX_RFSPC1, 0xFFFD);
+   b43_radio_mask(dev, B2055_C2_RX_RFSPC1, 0xFFFD);
+   }
+   udelay(2);
 }
 
 /*
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 04/11] b43: N-PHY: update writing channel-specific radio registers

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   54 ++---
 1 files changed, 32 insertions(+), 22 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index dd81e8a..ebb9632 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -90,28 +90,38 @@ static enum b43_txpwr_result 
b43_nphy_op_recalc_txpower(struct b43_wldev *dev,
 static void b43_chantab_radio_upload(struct b43_wldev *dev,
 const struct b43_nphy_channeltab_entry *e)
 {
-   b43_radio_write16(dev, B2055_PLL_REF, e->radio_pll_ref);
-   b43_radio_write16(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0);
-   b43_radio_write16(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1);
-   b43_radio_write16(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail);
-   b43_radio_write16(dev, B2055_VCO_CAL1, e->radio_vco_cal1);
-   b43_radio_write16(dev, B2055_VCO_CAL2, e->radio_vco_cal2);
-   b43_radio_write16(dev, B2055_PLL_LFC1, e->radio_pll_lfc1);
-   b43_radio_write16(dev, B2055_PLL_LFR1, e->radio_pll_lfr1);
-   b43_radio_write16(dev, B2055_PLL_LFC2, e->radio_pll_lfc2);
-   b43_radio_write16(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf);
-   b43_radio_write16(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1);
-   b43_radio_write16(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2);
-   b43_radio_write16(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune);
-   b43_radio_write16(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune);
-   b43_radio_write16(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1);
-   b43_radio_write16(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn);
-   b43_radio_write16(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim);
-   b43_radio_write16(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune);
-   b43_radio_write16(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune);
-   b43_radio_write16(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1);
-   b43_radio_write16(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn);
-   b43_radio_write16(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim);
+   b43_radio_write(dev, B2055_PLL_REF, e->radio_pll_ref);
+   b43_radio_write(dev, B2055_RF_PLLMOD0, e->radio_rf_pllmod0);
+   b43_radio_write(dev, B2055_RF_PLLMOD1, e->radio_rf_pllmod1);
+   b43_radio_write(dev, B2055_VCO_CAPTAIL, e->radio_vco_captail);
+   if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+   b43_read32(dev, B43_MMIO_MACCTL);
+   b43_radio_write(dev, B2055_VCO_CAL1, e->radio_vco_cal1);
+   b43_radio_write(dev, B2055_VCO_CAL2, e->radio_vco_cal2);
+   b43_radio_write(dev, B2055_PLL_LFC1, e->radio_pll_lfc1);
+   b43_radio_write(dev, B2055_PLL_LFR1, e->radio_pll_lfr1);
+   if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+   b43_read32(dev, B43_MMIO_MACCTL);
+   b43_radio_write(dev, B2055_PLL_LFC2, e->radio_pll_lfc2);
+   b43_radio_write(dev, B2055_LGBUF_CENBUF, e->radio_lgbuf_cenbuf);
+   b43_radio_write(dev, B2055_LGEN_TUNE1, e->radio_lgen_tune1);
+   b43_radio_write(dev, B2055_LGEN_TUNE2, e->radio_lgen_tune2);
+   if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+   b43_read32(dev, B43_MMIO_MACCTL);
+   b43_radio_write(dev, B2055_C1_LGBUF_ATUNE, e->radio_c1_lgbuf_atune);
+   b43_radio_write(dev, B2055_C1_LGBUF_GTUNE, e->radio_c1_lgbuf_gtune);
+   b43_radio_write(dev, B2055_C1_RX_RFR1, e->radio_c1_rx_rfr1);
+   b43_radio_write(dev, B2055_C1_TX_PGAPADTN, e->radio_c1_tx_pgapadtn);
+   if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+   b43_read32(dev, B43_MMIO_MACCTL);
+   b43_radio_write(dev, B2055_C1_TX_MXBGTRIM, e->radio_c1_tx_mxbgtrim);
+   b43_radio_write(dev, B2055_C2_LGBUF_ATUNE, e->radio_c2_lgbuf_atune);
+   b43_radio_write(dev, B2055_C2_LGBUF_GTUNE, e->radio_c2_lgbuf_gtune);
+   b43_radio_write(dev, B2055_C2_RX_RFR1, e->radio_c2_rx_rfr1);
+   if (dev->dev->bus->bustype == SSB_BUSTYPE_PCI)
+   b43_read32(dev, B43_MMIO_MACCTL);
+   b43_radio_write(dev, B2055_C2_TX_PGAPADTN, e->radio_c2_tx_pgapadtn);
+   b43_radio_write(dev, B2055_C2_TX_MXBGTRIM, e->radio_c2_tx_mxbgtrim);
 }
 
 static void b43_chantab_phy_upload(struct b43_wldev *dev,
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 03/11] b43: N-PHY: turn radio on/off (rfkill)

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   50 --
 1 files changed, 37 insertions(+), 13 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 2d8eda1..dd81e8a 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -218,7 +218,10 @@ static void b43_radio_init2055_post(struct b43_wldev *dev)
b43_radio_write16(dev, B2055_C2_RX_BB_MIDACHP, 0x83);
 }
 
-/* Initialize a Broadcom 2055 N-radio */
+/*
+ * Initialize a Broadcom 2055 N-radio
+ * http://bcm-v4.sipsolutions.net/802.11/Radio/2055/Init
+ */
 static void b43_radio_init2055(struct b43_wldev *dev)
 {
b43_radio_init2055_pre(dev);
@@ -229,17 +232,6 @@ static void b43_radio_init2055(struct b43_wldev *dev)
b43_radio_init2055_post(dev);
 }
 
-void b43_nphy_radio_turn_on(struct b43_wldev *dev)
-{
-   b43_radio_init2055(dev);
-}
-
-void b43_nphy_radio_turn_off(struct b43_wldev *dev)
-{
-   b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
-~B43_NPHY_RFCTL_CMD_EN);
-}
-
 /*
  * Upload the N-PHY tables.
  * http://bcm-v4.sipsolutions.net/802.11/PHY/N/InitTables
@@ -3277,9 +3269,41 @@ static void b43_nphy_op_radio_write(struct b43_wldev 
*dev, u16 reg, u16 value)
b43_write16(dev, B43_MMIO_RADIO_DATA_LOW, value);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/Radio/Switch%20Radio */
 static void b43_nphy_op_software_rfkill(struct b43_wldev *dev,
bool blocked)
-{//TODO
+{
+   if (b43_read32(dev, B43_MMIO_MACCTL) & B43_MACCTL_ENABLED)
+   b43err(dev->wl, "MAC not suspended\n");
+
+   if (blocked) {
+   b43_phy_mask(dev, B43_NPHY_RFCTL_CMD,
+   ~B43_NPHY_RFCTL_CMD_CHIP0PU);
+   if (dev->phy.rev >= 3) {
+   b43_radio_mask(dev, 0x09, ~0x2);
+
+   b43_radio_write(dev, 0x204D, 0);
+   b43_radio_write(dev, 0x2053, 0);
+   b43_radio_write(dev, 0x2058, 0);
+   b43_radio_write(dev, 0x205E, 0);
+   b43_radio_mask(dev, 0x2062, ~0xF0);
+   b43_radio_write(dev, 0x2064, 0);
+
+   b43_radio_write(dev, 0x304D, 0);
+   b43_radio_write(dev, 0x3053, 0);
+   b43_radio_write(dev, 0x3058, 0);
+   b43_radio_write(dev, 0x305E, 0);
+   b43_radio_mask(dev, 0x3062, ~0xF0);
+   b43_radio_write(dev, 0x3064, 0);
+   }
+   } else {
+   if (dev->phy.rev >= 3) {
+   /* TODO: b43_radio_init2056(dev); */
+   /* TODO: PHY Set Channel Spec (dev, radio_chanspec) */
+   } else {
+   b43_radio_init2055(dev);
+   }
+   }
 }
 
 static void b43_nphy_op_switch_analog(struct b43_wldev *dev, bool on)
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 02/11] b43: N-PHY: initialize super switch

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/phy_n.c |   37 -
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 795bb1e..2d8eda1 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -646,6 +646,41 @@ static void b43_nphy_read_clip_detection(struct b43_wldev 
*dev, u16 *clip_st)
clip_st[1] = b43_phy_read(dev, B43_NPHY_C2_CLIP1THRES);
 }
 
+/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/SuperSwitchInit */
+static void b43_nphy_superswitch_init(struct b43_wldev *dev, bool init)
+{
+   if (dev->phy.rev >= 3) {
+   if (!init)
+   return;
+   if (0 /* FIXME */) {
+   b43_ntab_write(dev, B43_NTAB16(9, 2), 0x211);
+   b43_ntab_write(dev, B43_NTAB16(9, 3), 0x222);
+   b43_ntab_write(dev, B43_NTAB16(9, 8), 0x144);
+   b43_ntab_write(dev, B43_NTAB16(9, 12), 0x188);
+   }
+   } else {
+   b43_phy_write(dev, B43_NPHY_GPIO_LOOEN, 0);
+   b43_phy_write(dev, B43_NPHY_GPIO_HIOEN, 0);
+
+   ssb_chipco_gpio_control(&dev->dev->bus->chipco, 0xFC00,
+   0xFC00);
+   b43_write32(dev, B43_MMIO_MACCTL,
+   b43_read32(dev, B43_MMIO_MACCTL) &
+   ~B43_MACCTL_GPOUTSMSK);
+   b43_write16(dev, B43_MMIO_GPIO_MASK,
+   b43_read16(dev, B43_MMIO_GPIO_MASK) | 0xFC00);
+   b43_write16(dev, B43_MMIO_GPIO_CONTROL,
+   b43_read16(dev, B43_MMIO_GPIO_CONTROL) & ~0xFC00);
+
+   if (init) {
+   b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO1, 0x2D8);
+   b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP1, 0x301);
+   b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_LO2, 0x2D8);
+   b43_phy_write(dev, B43_NPHY_RFCTL_LUT_TRSW_UP2, 0x301);
+   }
+   }
+}
+
 /* http://bcm-v4.sipsolutions.net/802.11/PHY/N/classifier */
 static u16 b43_nphy_classifier(struct b43_wldev *dev, u16 mask, u16 val)
 {
@@ -3116,7 +3151,7 @@ int b43_phy_initn(struct b43_wldev *dev)
target = b43_nphy_get_tx_gains(dev);
 
if (nphy->antsel_type == 2)
-   ;/*TODO NPHY Superswitch Init with argument 1*/
+   b43_nphy_superswitch_init(dev, true);
if (nphy->perical != 2) {
b43_nphy_rssi_cal(dev);
if (phy->rev >= 3) {
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


[PATCH 01/11] b43: N-PHY: add some registers and structs definitions

2010-02-09 Thread Rafał Miłecki
Signed-off-by: Rafał Miłecki 
---
 drivers/net/wireless/b43/b43.h |1 +
 drivers/net/wireless/b43/phy_n.h   |9 +
 drivers/net/wireless/b43/tables_nphy.h |9 +
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 6a6ab0f..bd7c505 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
@@ -104,6 +104,7 @@
 #define B43_MMIO_MACFILTER_CONTROL 0x420
 #define B43_MMIO_MACFILTER_DATA0x422
 #define B43_MMIO_RCMTA_COUNT   0x43C
+#define B43_MMIO_PSM_PHY_HDR   0x492   /* programmable state machine */
 #define B43_MMIO_RADIO_HWENABLED_LO0x49A
 #define B43_MMIO_GPIO_CONTROL  0x49C
 #define B43_MMIO_GPIO_MASK 0x49E
diff --git a/drivers/net/wireless/b43/phy_n.h b/drivers/net/wireless/b43/phy_n.h
index 403aad3..47d20dc 100644
--- a/drivers/net/wireless/b43/phy_n.h
+++ b/drivers/net/wireless/b43/phy_n.h
@@ -711,6 +711,8 @@
 #define B43_NPHY_PAPD_EN1  B43_PHY_N(0x29B) /* PAPD 
Enable1 TBD */
 #define B43_NPHY_EPS_TABLE_ADJ1B43_PHY_N(0x29C) /* EPS 
Table Adj1 TBD */
 
+#define B43_PHY_B_BBCFGB43_PHY_N_BMODE(0x001) 
/* BB config */
+#define B43_PHY_B_TEST B43_PHY_N_BMODE(0x00A)
 
 
 /* Broadcom 2055 radio registers */
@@ -924,6 +926,13 @@
 
 struct b43_wldev;
 
+struct b43_chanspec {
+   u8 channel;
+   u8 sideband;
+   u8 b_width;
+   u8 b_freq;
+};
+
 struct b43_phy_n_iq_comp {
s16 a0;
s16 b0;
diff --git a/drivers/net/wireless/b43/tables_nphy.h 
b/drivers/net/wireless/b43/tables_nphy.h
index 9c1c6ec..b23036f 100644
--- a/drivers/net/wireless/b43/tables_nphy.h
+++ b/drivers/net/wireless/b43/tables_nphy.h
@@ -4,6 +4,15 @@
 #include 
 
 
+struct b43_phy_n_sfo_cfg {
+   u16 phy_bw1a;
+   u16 phy_bw2;
+   u16 phy_bw3;
+   u16 phy_bw4;
+   u16 phy_bw5;
+   u16 phy_bw6;
+};
+
 struct b43_nphy_channeltab_entry {
/* The channel number */
u8 channel;
-- 
1.6.4.2

___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: b43legacy-phy3: Radio hardware status changed to XXX

2010-02-09 Thread Peter Stuge
Larry Finger wrote:
> There could be a bug in the software that processes whatever WMI
> info that your system generates. WMI (Windows Management Interface)
> code handles the functions of the top row of your keyboard that are
> generated by a fn+FX key.

The BIOS is rarely if ever involved in any of this.

As was already explained, the rfkill signal is an electrical input to
the wifi hardware, and the b43 driver can only ever read the state of
this input.

Who drives the signal depends on the unique system design. (Think
mainboard.)

In laptops there is always at least one "embedded controller" AKA EC
which handles some or all of keyboard, GPIO signals, LEDs, Fn keys,
lid switch, power switch, special function keys, fan control, battery
charging and various other bits and pieces of the system.

Bytecode within the ACPI tables in the BIOS may be executed by the
kernel in order to discover e.g. Fn+key combination presses or lid
switch, but the BIOS does not have anything to do with changing the
electrical signal going out from the EC - that is done either by the
EC firmware (in response to some keypress, which will also be
reported via ACPI so the OS can update some status display) or as
ordered by the operating system (in response to some keypress
reported by the EC via ACPI).

There is no standardization at all for these signals and this
behavior. If you can find the schematics for your laptop that
would help.


//Peter
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev


Re: b43/b43legacy driver

2010-02-09 Thread Peter Stuge
Daniel Kuehn wrote:
> There is an option in gmail to tell it to send the mails as
> plain-text too.
> That is what I use,

Good point - important to post plain text.

I think another point which is also really important is to
EXTENSIVELY TRIM messages that you reply to.

It is quite common that Gmail users include the full previous history
of a thread in every reply they create and this is absolute madness!

Please be more aware of how you post, and make sure to trim when
sending replies.

Some particular behavior of Gmail (maybe it hides old parts of the
thread?) is not an excuse for you to waste everyone else's time!


//Peter
___
Bcm43xx-dev mailing list
Bcm43xx-dev@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/bcm43xx-dev