Rafał Miłecki | 2 Jan 08:41 2012
Picon

[PATCH 1/3] ssb: SPROM: extract each core power info

We already extract some basic info but it's incomplete, reads info
about the first core only. Used data structure doesn't allow easy
adding of more cores.
This patch adds new struct and array for storing power info. The plan
is to: switch all extractors (including the ones using NVRAM) to new
struct, switch drivers, then deprecate and finally drop old SSB fields.

Signed-off-by: Rafał Miłecki <zajec5@...>
---
 drivers/ssb/pci.c            |   40 +++++++++++++++++++++++++++++++++++++++-
 include/linux/ssb/ssb.h      |    8 ++++++++
 include/linux/ssb/ssb_regs.h |   34 ++++++++++++++++++++++++++++++++++
 3 files changed, 81 insertions(+), 1 deletions(-)

diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index 973223f..befa89e 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
 <at>  <at>  -523,7 +523,13  <at>  <at>  static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
 static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
 {
 	int i;
-	u16 v;
+	u16 v, o;
+	u16 pwr_info_offset[] = {
+		SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1,
+		SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3
+	};
+	BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) !=
+			ARRAY_SIZE(out->core_pwr_info));
(Continue reading)

Rafał Miłecki | 2 Jan 08:41 2012
Picon

[PATCH 2/3] bcma: SPROM: add macro for easier extraction


Signed-off-by: Rafał Miłecki <zajec5@...>
---
 drivers/bcma/sprom.c |  139 +++++++++++++++++++++++++------------------------
 1 files changed, 71 insertions(+), 68 deletions(-)

diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
index 6f230fb..27f62cc 100644
--- a/drivers/bcma/sprom.c
+++ b/drivers/bcma/sprom.c
 <at>  <at>  -14,8 +14,6  <at>  <at> 
 #include <linux/dma-mapping.h>
 #include <linux/slab.h>

-#define SPOFF(offset)	((offset) / sizeof(u16))
-
 /**************************************************
  * R/W ops.
  **************************************************/
 <at>  <at>  -124,6 +122,11  <at>  <at>  static int bcma_sprom_valid(const u16 *sprom)
  * SPROM extraction.
  **************************************************/

+#define SPOFF(offset)	((offset) / sizeof(u16))
+
+#define SPEX(_field, _offset, _mask, _shift)	\
+	bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift))
+
 static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)
 {
(Continue reading)

Rafał Miłecki | 2 Jan 08:41 2012
Picon

[PATCH 3/3] bcma: SPROM: extract power info for cores


Signed-off-by: Rafał Miłecki <zajec5@...>
---
 drivers/bcma/sprom.c |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
index 27f62cc..cb835f0 100644
--- a/drivers/bcma/sprom.c
+++ b/drivers/bcma/sprom.c
 <at>  <at>  -129,8 +129,14  <at>  <at>  static int bcma_sprom_valid(const u16 *sprom)

 static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)
 {
-	u16 v;
+	u16 v, o;
 	int i;
+	u16 pwr_info_offset[] = {
+		SSB_SROM8_PWR_INFO_CORE0, SSB_SROM8_PWR_INFO_CORE1,
+		SSB_SROM8_PWR_INFO_CORE2, SSB_SROM8_PWR_INFO_CORE3
+	};
+	BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) !=
+			ARRAY_SIZE(bus->sprom.core_pwr_info));

 	bus->sprom.revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] &
 		SSB_SPROM_REVISION_REV;
 <at>  <at>  -185,6 +191,38  <at>  <at>  static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)

 	SPEX(country_code, SSB_SPROM8_CCODE, ~0, 0);

(Continue reading)

Peter Stuge | 2 Jan 13:20 2012
Picon

Re: [PATCH 2/3] bcma: SPROM: add macro for easier extraction

Rafał Miłecki wrote:
> +#define SPEX(_field, _offset, _mask, _shift)	\
> +	bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift))

Maybe this should take at least bus as parameter too?

//Peter
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Rafał Miłecki | 2 Jan 13:39 2012
Picon

Re: [PATCH 2/3] bcma: SPROM: add macro for easier extraction

W dniu 2 stycznia 2012 13:20 użytkownik Peter Stuge <peter <at> stuge.se> napisał:
> Rafał Miłecki wrote:
>> +#define SPEX(_field, _offset, _mask, _shift) \
>> +     bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift))
>
> Maybe this should take at least bus as parameter too?

I don't think we will ever want to extract SPROM info to something
else. Can't imageine such a situation right now.

Of course it may happen some new requirement will appear in the
future. But it's hard to predict it right now. And we never know what
macro will handle that future requirement. Oh, and we always can
modify existing macro or add new one :) Fortunately it's not any kind
of API :)

--

-- 
Rafał

_______________________________________________
b43-dev mailing list
b43-dev <at> lists.infradead.org
http://lists.infradead.org/mailman/listinfo/b43-dev
Rafał Miłecki | 2 Jan 13:41 2012
Picon

Re: [PATCH 2/3] bcma: SPROM: add macro for easier extraction

W dniu 2 stycznia 2012 13:20 użytkownik Peter Stuge <peter <at> stuge.se> napisał:
> Rafał Miłecki wrote:
>> +#define SPEX(_field, _offset, _mask, _shift) \
>> +     bus->sprom._field = ((sprom[SPOFF(_offset)] & (_mask)) >> (_shift))
>
> Maybe this should take at least bus as parameter too?

I also like the proposed solution because it let me fit some lines 80
chars length. See all the
SSB_SROM8_*_PA_[0-2]
from the next patch. Most of them are 80 char long ;)

--

-- 
Rafał
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@...
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Rafał Miłecki | 2 Jan 19:31 2012
Picon

[PATCH 4/3] b43: add maskset helpers


Signed-off-by: Rafał Miłecki <zajec5@...>
---
 drivers/net/wireless/b43/b43.h   |   12 +++++++
 drivers/net/wireless/b43/main.c  |   67 +++++++++++---------------------------
 drivers/net/wireless/b43/phy_n.c |   14 +++-----
 3 files changed, 36 insertions(+), 57 deletions(-)

diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h
index 16e8f80..835462d 100644
--- a/drivers/net/wireless/b43/b43.h
+++ b/drivers/net/wireless/b43/b43.h
 <at>  <at>  -999,6 +999,12  <at>  <at>  static inline void b43_write16(struct b43_wldev *dev, u16 offset, u16 value)
 	dev->dev->write16(dev->dev, offset, value);
 }

+static inline void b43_maskset16(struct b43_wldev *dev, u16 offset, u16 mask,
+				 u16 set)
+{
+	b43_write16(dev, offset, (b43_read16(dev, offset) & mask) | set);
+}
+
 static inline u32 b43_read32(struct b43_wldev *dev, u16 offset)
 {
 	return dev->dev->read32(dev->dev, offset);
 <at>  <at>  -1009,6 +1015,12  <at>  <at>  static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value)
 	dev->dev->write32(dev->dev, offset, value);
 }

+static inline void b43_maskset32(struct b43_wldev *dev, u16 offset, u32 mask,
(Continue reading)

Rafał Miłecki | 2 Jan 19:31 2012
Picon

[PATCH 5/3] b43: N-PHY: implement TX power control setup


Signed-off-by: Rafał Miłecki <zajec5@...>
---
 drivers/net/wireless/b43/phy_n.c |  217 +++++++++++++++++++++++++++++++++++++-
 drivers/net/wireless/b43/phy_n.h |    1 +
 2 files changed, 217 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index c5cb0f4..15a0b79 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
 <at>  <at>  -2420,6 +2420,221  <at>  <at>  static void b43_nphy_tx_power_ctl_idle_tssi(struct b43_wldev *dev)
 	nphy->pwr_ctl_info[1].idle_tssi_2g = (tmp >> 8) & 0xFF;
 }

+/* http://bcm-v4.sipsolutions.net/PHY/N/TxPwrLimitToTbl */
+static void b43_nphy_tx_prepare_adjusted_power_table(struct b43_wldev *dev)
+{
+	struct b43_phy_n *nphy = dev->phy.n;
+
+	u8 idx, delta;
+	u8 i, stf_mode;
+
+	for (i = 0; i < 4; i++)
+		nphy->adj_pwr_tbl[i] = nphy->tx_power_offset[i];
+
+	for (stf_mode = 0; stf_mode < 4; stf_mode++) {
+		delta = 0;
+		switch (stf_mode) {
+		case 0:
(Continue reading)

Rafał Miłecki | 3 Jan 22:49 2012
Picon

[PATCH 1/5] b43: N-PHY: add helper for getting gain table

Also move the code to tables file.

Signed-off-by: Rafał Miłecki <zajec5@...>
---
 drivers/net/wireless/b43/phy_n.c       |   81 ++-----------------------------
 drivers/net/wireless/b43/tables_nphy.c |   65 ++++++++++++++++++++++----
 drivers/net/wireless/b43/tables_nphy.h |   12 +----
 3 files changed, 64 insertions(+), 94 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index ea7cc86..20394d8 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
 <at>  <at>  -85,24 +85,6  <at>  <at>  static inline bool b43_nphy_ipa(struct b43_wldev *dev)
 		(dev->phy.n->ipa5g_on && band == IEEE80211_BAND_5GHZ));
 }

-/* http://bcm-v4.sipsolutions.net/802.11/PHY/N/GetIpaGainTbl */
-static const u32 *b43_nphy_get_ipa_gain_table(struct b43_wldev *dev)
-{
-	if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
-		if (dev->phy.rev >= 6) {
-			if (dev->dev->chip_id == 47162)
-				return txpwrctrl_tx_gain_ipa_rev5;
-			return txpwrctrl_tx_gain_ipa_rev6;
-		} else if (dev->phy.rev >= 5) {
-			return txpwrctrl_tx_gain_ipa_rev5;
-		} else {
-			return txpwrctrl_tx_gain_ipa;
-		}
(Continue reading)

Rafał Miłecki | 3 Jan 22:49 2012
Picon

[PATCH 2/5] b43: N-PHY: fix typos in RF control


Signed-off-by: Rafał Miłecki <zajec5@...>
---
 drivers/net/wireless/b43/phy_n.c       |    6 +++---
 drivers/net/wireless/b43/tables_nphy.c |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 20394d8..1e499f0 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
 <at>  <at>  -211,7 +211,7  <at>  <at>  static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,

 		reg = (i == 0) ?
 			B43_NPHY_RFCTL_INTC1 : B43_NPHY_RFCTL_INTC2;
-		b43_phy_mask(dev, reg, 0xFBFF);
+		b43_phy_set(dev, reg, 0x400);

 		switch (field) {
 		case 0:
 <at>  <at>  -227,7 +227,7  <at>  <at>  static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
 				b43_phy_set(dev, B43_NPHY_RFCTL_CMD,
 						B43_NPHY_RFCTL_CMD_START);
 				for (j = 0; j < 100; j++) {
-					if (b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_START) {
+					if (!(b43_phy_read(dev, B43_NPHY_RFCTL_CMD) & B43_NPHY_RFCTL_CMD_START)) {
 						j = 0;
 						break;
 					}
 <at>  <at>  -246,7 +246,7  <at>  <at>  static void b43_nphy_rf_control_intc_override(struct b43_wldev *dev, u8 field,
(Continue reading)


Gmane