All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/18] brcmsmac: update to get SoCs working
@ 2012-06-05 23:07 Hauke Mehrtens
  2012-06-05 23:07 ` [PATCH 01/18] brcmsmac: remove PCIE() makro Hauke Mehrtens
                   ` (17 more replies)
  0 siblings, 18 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

This series contains some patches needed to get brcmsmac working on 
SoCs like the BCM4718.
The last part which adds core rev 17 (used in the BCM4718) to the list 
of supported cores is missing, because we do not have a firmware 
supporting this core yet, but I extended the b43 fwcutter to generate 
a firmware which brcmsmac accepts. With this firmware my BCM4718 
works. I would appreciate an official firmware release from Broadcom 
adding support for this core.
The final patch adding support for the BCM43224 is missing because 
the PCIe host controller on the BCM4718 still causes problems and I 
have to add some more read after writes into the code, for now it uses 
an ugly hack and sometimes the problems still occur.

The wifi is not stable on the BCM4718, I had no problems connecting to 
my ath9k driven access point but I have problems connecting to my 
BCM47186 based AP running the vendor firmware with the Broadcom 
proprietary driver.
I get 12MBit/s max with the BCM4718 connected to ath9k on the 2.4 GHz 
band and 35 MBit/s max with the BCM43224 on the 5Ghz band connected to 
a Broadcom based AP running the proprietary driver. This seams to be 
CPU bounced as I have over 50% sirq in both cases.

brcmsmac starts on the BCM47186 (id: 0x5357), but it does not tx or rx 
any traffic.

One patch extends the xmtfifo_sz array for more core revs, I just toke 
the values from the other phy-n cores and hope this is correct.

These patches are depending on: "[PATCH 0/8] bcma misc updates" and 
based on wireless-testing.

Hauke Mehrtens (18):
  brcmsmac: remove PCIE() makro
  brcmsmac: remove PCI_FORCEHT() makro
  brcmsmac: remove ai_get_buscore{type,rev}()
  brcmsmac: use container_of instead of cast
  brcmsmac: remove ai_findcore()
  brcmsmac: remove si_pmu_init() and si_pmu_res_init()
  brcmsmac: remove si_pmu_spuravoid_pllupdate()
  brcmsmac: remove some redundant chip common workarounds
  brcmsmac: use core id constants from bcma
  brcmsmac: use chip and package id constants from bcma
  brcmsmac: remove some unnessessacry casts and void pointer
  brcmsmac: add a conditions for core rev 17 again
  brcmsmac: add some workarounds for other chips again
  brcmsmac: extend xmtfifo_sz array
  brcmsmac: fix DMA on SoCs
  brcmsmac: do not call brcms_c_chipmatch() for non PCI
  brcmsmac: fix read in write_phy_reg
  brcmsmac: handle non PCI devices in the phy code

 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c  |  128 ++-------------
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.h  |   16 --
 drivers/net/wireless/brcm80211/brcmsmac/dma.c      |   18 +-
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |   22 ++-
 drivers/net/wireless/brcm80211/brcmsmac/main.c     |   67 ++++++--
 .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c  |   38 +++--
 .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c    |  153 +++++++++++------
 drivers/net/wireless/brcm80211/brcmsmac/pmu.c      |  172 +-------------------
 drivers/net/wireless/brcm80211/brcmsmac/pmu.h      |    3 -
 drivers/net/wireless/brcm80211/include/soc.h       |   62 -------
 10 files changed, 230 insertions(+), 449 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 58+ messages in thread

* [PATCH 01/18] brcmsmac: remove PCIE() makro
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-07 20:05   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 02/18] brcmsmac: remove PCI_FORCEHT() makro Hauke Mehrtens
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

Instead of checking if there is a PCIe core on the bus, better check if
hosttype is PCIe.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index 6d8b721..ce276bd 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -318,9 +318,8 @@
 #define	IS_SIM(chippkg)	\
 	((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID))
 
-#define PCIE(sih)	(ai_get_buscoretype(sih) == PCIE_CORE_ID)
-
-#define PCI_FORCEHT(sih) (PCIE(sih) && (ai_get_chip_id(sih) == BCM4716_CHIP_ID))
+#define PCI_FORCEHT(sih) ((ai_get_buscoretype(sih) == PCIE_CORE_ID) && \
+			  (ai_get_chip_id(sih) == BCM4716_CHIP_ID))
 
 #ifdef DEBUG
 #define	SI_MSG(fmt, ...)	pr_debug(fmt, ##__VA_ARGS__)
@@ -775,7 +774,7 @@ void ai_pci_up(struct si_pub *sih)
 		bcma_core_set_clockmode(cc, BCMA_CLKMODE_FAST);
 	}
 
-	if (PCIE(sih))
+	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
 		bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true);
 }
 
@@ -793,7 +792,7 @@ void ai_pci_down(struct si_pub *sih)
 		bcma_core_set_clockmode(cc, BCMA_CLKMODE_DYNAMIC);
 	}
 
-	if (PCIE(sih))
+	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
 		bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false);
 }
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 02/18] brcmsmac: remove PCI_FORCEHT() makro
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
  2012-06-05 23:07 ` [PATCH 01/18] brcmsmac: remove PCIE() makro Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-07 20:12   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 03/18] brcmsmac: remove ai_get_buscore{type,rev}() Hauke Mehrtens
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

The BCM4716 is a SoC and does not have a PCI client interface, so this
condition is never true.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   19 -------------------
 1 file changed, 19 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index ce276bd..180cdd2 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -318,9 +318,6 @@
 #define	IS_SIM(chippkg)	\
 	((chippkg == HDLSIM_PKG_ID) || (chippkg == HWSIM_PKG_ID))
 
-#define PCI_FORCEHT(sih) ((ai_get_buscoretype(sih) == PCIE_CORE_ID) && \
-			  (ai_get_chip_id(sih) == BCM4716_CHIP_ID))
-
 #ifdef DEBUG
 #define	SI_MSG(fmt, ...)	pr_debug(fmt, ##__VA_ARGS__)
 #else
@@ -754,9 +751,6 @@ bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode)
 
 	sii = (struct si_info *)sih;
 
-	if (PCI_FORCEHT(sih))
-		return mode == BCMA_CLKMODE_FAST;
-
 	cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
 	bcma_core_set_clockmode(cc, mode);
 	return mode == BCMA_CLKMODE_FAST;
@@ -765,15 +759,9 @@ bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode)
 void ai_pci_up(struct si_pub *sih)
 {
 	struct si_info *sii;
-	struct bcma_device *cc;
 
 	sii = (struct si_info *)sih;
 
-	if (PCI_FORCEHT(sih)) {
-		cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
-		bcma_core_set_clockmode(cc, BCMA_CLKMODE_FAST);
-	}
-
 	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
 		bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true);
 }
@@ -782,16 +770,9 @@ void ai_pci_up(struct si_pub *sih)
 void ai_pci_down(struct si_pub *sih)
 {
 	struct si_info *sii;
-	struct bcma_device *cc;
 
 	sii = (struct si_info *)sih;
 
-	/* release FORCEHT since chip is going to "down" state */
-	if (PCI_FORCEHT(sih)) {
-		cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
-		bcma_core_set_clockmode(cc, BCMA_CLKMODE_DYNAMIC);
-	}
-
 	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
 		bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false);
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 03/18] brcmsmac: remove ai_get_buscore{type,rev}()
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
  2012-06-05 23:07 ` [PATCH 01/18] brcmsmac: remove PCIE() makro Hauke Mehrtens
  2012-06-05 23:07 ` [PATCH 02/18] brcmsmac: remove PCI_FORCEHT() makro Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06  9:17   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 04/18] brcmsmac: use container_of instead of cast Hauke Mehrtens
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

These two functions are not used any more.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   15 ---------------
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.h |    4 ----
 2 files changed, 19 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index 180cdd2..98e7bad 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -469,9 +469,6 @@ ai_buscore_setup(struct si_info *sii, struct bcma_device *cc)
 		sii->pub.pmurev = sii->pub.pmucaps & PCAP_REV_MASK;
 	}
 
-	/* figure out buscore */
-	sii->buscore = ai_findcore(&sii->pub, PCIE_CORE_ID, 0);
-
 	return true;
 }
 
@@ -805,15 +802,3 @@ bool ai_deviceremoved(struct si_pub *sih)
 
 	return false;
 }
-
-uint ai_get_buscoretype(struct si_pub *sih)
-{
-	struct si_info *sii = (struct si_info *)sih;
-	return sii->buscore->id.id;
-}
-
-uint ai_get_buscorerev(struct si_pub *sih)
-{
-	struct si_info *sii = (struct si_info *)sih;
-	return sii->buscore->id.rev;
-}
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
index d9f04a6..74beb87 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
@@ -168,7 +168,6 @@ struct si_info {
 	struct si_pub pub;	/* back plane public state (must be first) */
 	struct bcma_bus *icbus;	/* handle to soc interconnect bus */
 	struct pci_dev *pcibus;	/* handle to pci bus */
-	struct bcma_device *buscore;
 
 	u32 chipst;		/* chip status */
 };
@@ -202,9 +201,6 @@ extern void ai_pci_up(struct si_pub *sih);
 /* Enable Ex-PA for 4313 */
 extern void ai_epa_4313war(struct si_pub *sih);
 
-extern uint ai_get_buscoretype(struct si_pub *sih);
-extern uint ai_get_buscorerev(struct si_pub *sih);
-
 static inline u32 ai_get_cccaps(struct si_pub *sih)
 {
 	return sih->cccaps;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 04/18] brcmsmac: use container_of instead of cast
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (2 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 03/18] brcmsmac: remove ai_get_buscore{type,rev}() Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06  9:27   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 05/18] brcmsmac: remove ai_findcore() Hauke Mehrtens
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens


Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index 98e7bad..1e3d9e5 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -582,7 +582,7 @@ void ai_detach(struct si_pub *sih)
 	struct si_pub *si_local = NULL;
 	memcpy(&si_local, &sih, sizeof(struct si_pub **));
 
-	sii = (struct si_info *)sih;
+	sii = container_of(sih, struct si_info, pub);
 
 	if (sii == NULL)
 		return;
@@ -597,7 +597,7 @@ struct bcma_device *ai_findcore(struct si_pub *sih, u16 coreid, u16 coreunit)
 	struct si_info *sii;
 	uint found;
 
-	sii = (struct si_info *)sih;
+	sii = container_of(sih, struct si_info, pub);
 
 	found = 0;
 
@@ -620,7 +620,7 @@ uint ai_cc_reg(struct si_pub *sih, uint regoff, u32 mask, u32 val)
 	u32 w;
 	struct si_info *sii;
 
-	sii = (struct si_info *)sih;
+	sii = container_of(sih, struct si_info, pub);
 	cc = sii->icbus->drv_cc.core;
 
 	/* mask and set */
@@ -714,7 +714,7 @@ u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih)
 	uint slowminfreq;
 	u16 fpdelay;
 
-	sii = (struct si_info *)sih;
+	sii = container_of(sih, struct si_info, pub);
 	if (ai_get_cccaps(sih) & CC_CAP_PMU) {
 		fpdelay = si_pmu_fast_pwrup_delay(sih);
 		return fpdelay;
@@ -746,7 +746,7 @@ bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode)
 	struct si_info *sii;
 	struct bcma_device *cc;
 
-	sii = (struct si_info *)sih;
+	sii = container_of(sih, struct si_info, pub);
 
 	cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
 	bcma_core_set_clockmode(cc, mode);
@@ -757,7 +757,7 @@ void ai_pci_up(struct si_pub *sih)
 {
 	struct si_info *sii;
 
-	sii = (struct si_info *)sih;
+	sii = container_of(sih, struct si_info, pub);
 
 	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
 		bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, true);
@@ -768,7 +768,7 @@ void ai_pci_down(struct si_pub *sih)
 {
 	struct si_info *sii;
 
-	sii = (struct si_info *)sih;
+	sii = container_of(sih, struct si_info, pub);
 
 	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI)
 		bcma_core_pci_extend_L1timer(&sii->icbus->drv_pci, false);
@@ -791,7 +791,7 @@ bool ai_deviceremoved(struct si_pub *sih)
 	u32 w;
 	struct si_info *sii;
 
-	sii = (struct si_info *)sih;
+	sii = container_of(sih, struct si_info, pub);
 
 	if (sii->icbus->hosttype != BCMA_HOSTTYPE_PCI)
 		return false;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 05/18] brcmsmac: remove ai_findcore()
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (3 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 04/18] brcmsmac: use container_of instead of cast Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06  9:28   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 06/18] brcmsmac: remove si_pmu_init() and si_pmu_res_init() Hauke Mehrtens
                   ` (12 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

bcma also stores a pointer to the chipcommon core in its struct,
brcmsmac should use it and not search for the core by its own.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   31 ++++-----------------
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.h |    2 --
 drivers/net/wireless/brcm80211/brcmsmac/pmu.c     |   12 +++++---
 3 files changed, 14 insertions(+), 31 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index 1e3d9e5..ca53522 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -590,27 +590,6 @@ void ai_detach(struct si_pub *sih)
 	kfree(sii);
 }
 
-/* return index of coreid or BADIDX if not found */
-struct bcma_device *ai_findcore(struct si_pub *sih, u16 coreid, u16 coreunit)
-{
-	struct bcma_device *core;
-	struct si_info *sii;
-	uint found;
-
-	sii = container_of(sih, struct si_info, pub);
-
-	found = 0;
-
-	list_for_each_entry(core, &sii->icbus->cores, list)
-		if (core->id.id == coreid) {
-			if (found == coreunit)
-				return core;
-			found++;
-		}
-
-	return NULL;
-}
-
 /*
  * read/modify chipcommon core register.
  */
@@ -687,12 +666,13 @@ ai_clkctl_setdelay(struct si_pub *sih, struct bcma_device *cc)
 /* initialize power control delay registers */
 void ai_clkctl_init(struct si_pub *sih)
 {
+	struct si_info *sii = container_of(sih, struct si_info, pub);
 	struct bcma_device *cc;
 
 	if (!(ai_get_cccaps(sih) & CC_CAP_PWR_CTL))
 		return;
 
-	cc = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
+	cc = sii->icbus->drv_cc.core;
 	if (cc == NULL)
 		return;
 
@@ -724,7 +704,7 @@ u16 ai_clkctl_fast_pwrup_delay(struct si_pub *sih)
 		return 0;
 
 	fpdelay = 0;
-	cc = ai_findcore(sih, CC_CORE_ID, 0);
+	cc = sii->icbus->drv_cc.core;
 	if (cc) {
 		slowminfreq = ai_slowclk_freq(sih, false, cc);
 		fpdelay = (((bcma_read32(cc, CHIPCREGOFFS(pll_on_delay)) + 2)
@@ -748,7 +728,7 @@ bool ai_clkctl_cc(struct si_pub *sih, enum bcma_clkmode mode)
 
 	sii = container_of(sih, struct si_info, pub);
 
-	cc = ai_findcore(&sii->pub, BCMA_CORE_CHIPCOMMON, 0);
+	cc = sii->icbus->drv_cc.core;
 	bcma_core_set_clockmode(cc, mode);
 	return mode == BCMA_CLKMODE_FAST;
 }
@@ -777,9 +757,10 @@ void ai_pci_down(struct si_pub *sih)
 /* Enable BT-COEX & Ex-PA for 4313 */
 void ai_epa_4313war(struct si_pub *sih)
 {
+	struct si_info *sii = container_of(sih, struct si_info, pub);
 	struct bcma_device *cc;
 
-	cc = ai_findcore(sih, CC_CORE_ID, 0);
+	cc = sii->icbus->drv_cc.core;
 
 	/* EPA Fix */
 	bcma_set32(cc, CHIPCREGOFFS(gpiocontrol), GPIO_CTRL_EPA_EN_MASK);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
index 74beb87..2c101b2 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
@@ -182,8 +182,6 @@ struct si_info {
 
 
 /* AMBA Interconnect exported externs */
-extern struct bcma_device *ai_findcore(struct si_pub *sih,
-				       u16 coreid, u16 coreunit);
 extern u32 ai_core_cflags(struct bcma_device *core, u32 mask, u32 val);
 
 /* === exported functions === */
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
index 4931d29..0399a86 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
@@ -142,10 +142,11 @@ static void si_pmu_res_masks(struct si_pub *sih, u32 * pmin, u32 * pmax)
 void si_pmu_spuravoid_pllupdate(struct si_pub *sih, u8 spuravoid)
 {
 	u32 tmp = 0;
+	struct si_info *sii = container_of(sih, struct si_info, pub);
 	struct bcma_device *core;
 
 	/* switch to chipc */
-	core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
+	core = sii->icbus->drv_cc.core;
 
 	switch (ai_get_chip_id(sih)) {
 	case BCM43224_CHIP_ID:
@@ -286,10 +287,11 @@ u32 si_pmu_alp_clock(struct si_pub *sih)
 /* initialize PMU */
 void si_pmu_init(struct si_pub *sih)
 {
+	struct si_info *sii = container_of(sih, struct si_info, pub);
 	struct bcma_device *core;
 
 	/* select chipc */
-	core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
+	core = sii->icbus->drv_cc.core;
 
 	if (ai_get_pmurev(sih) == 1)
 		bcma_mask32(core, CHIPCREGOFFS(pmucontrol),
@@ -301,11 +303,12 @@ void si_pmu_init(struct si_pub *sih)
 /* initialize PMU resources */
 void si_pmu_res_init(struct si_pub *sih)
 {
+	struct si_info *sii = container_of(sih, struct si_info, pub);
 	struct bcma_device *core;
 	u32 min_mask = 0, max_mask = 0;
 
 	/* select to chipc */
-	core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
+	core = sii->icbus->drv_cc.core;
 
 	/* Determine min/max rsrc masks */
 	si_pmu_res_masks(sih, &min_mask, &max_mask);
@@ -328,6 +331,7 @@ void si_pmu_res_init(struct si_pub *sih)
 
 u32 si_pmu_measure_alpclk(struct si_pub *sih)
 {
+	struct si_info *sii = container_of(sih, struct si_info, pub);
 	struct bcma_device *core;
 	u32 alp_khz;
 
@@ -335,7 +339,7 @@ u32 si_pmu_measure_alpclk(struct si_pub *sih)
 		return 0;
 
 	/* Remember original core before switch to chipc */
-	core = ai_findcore(sih, BCMA_CORE_CHIPCOMMON, 0);
+	core = sii->icbus->drv_cc.core;
 
 	if (bcma_read32(core, CHIPCREGOFFS(pmustatus)) & PST_EXTLPOAVAIL) {
 		u32 ilp_ctr, alp_hz;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 06/18] brcmsmac: remove si_pmu_init() and si_pmu_res_init()
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (4 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 05/18] brcmsmac: remove ai_findcore() Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06  9:31   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 07/18] brcmsmac: remove si_pmu_spuravoid_pllupdate() Hauke Mehrtens
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

This is already done by bcma_pmu_init() and bcma_pmu_resources_init() in bcma.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |    2 -
 drivers/net/wireless/brcm80211/brcmsmac/pmu.c     |   76 ---------------------
 drivers/net/wireless/brcm80211/brcmsmac/pmu.h     |    2 -
 3 files changed, 80 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index ca53522..01837fb 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -503,9 +503,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 
 	/* PMU specific initializations */
 	if (ai_get_cccaps(sih) & CC_CAP_PMU) {
-		si_pmu_init(sih);
 		(void)si_pmu_measure_alpclk(sih);
-		si_pmu_res_init(sih);
 	}
 
 	/* setup the GPIO based LED powersave register */
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
index 0399a86..045f43a 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
@@ -108,37 +108,6 @@
 #define	RES4313_HT_AVAIL_RSRC		14
 #define	RES4313_MACPHY_CLK_AVAIL_RSRC	15
 
-/* Determine min/max rsrc masks. Value 0 leaves hardware at default. */
-static void si_pmu_res_masks(struct si_pub *sih, u32 * pmin, u32 * pmax)
-{
-	u32 min_mask = 0, max_mask = 0;
-	uint rsrcs;
-
-	/* # resources */
-	rsrcs = (ai_get_pmucaps(sih) & PCAP_RC_MASK) >> PCAP_RC_SHIFT;
-
-	/* determine min/max rsrc masks */
-	switch (ai_get_chip_id(sih)) {
-	case BCM43224_CHIP_ID:
-	case BCM43225_CHIP_ID:
-		/* ??? */
-		break;
-
-	case BCM4313_CHIP_ID:
-		min_mask = PMURES_BIT(RES4313_BB_PU_RSRC) |
-		    PMURES_BIT(RES4313_XTAL_PU_RSRC) |
-		    PMURES_BIT(RES4313_ALP_AVAIL_RSRC) |
-		    PMURES_BIT(RES4313_BB_PLL_PWRSW_RSRC);
-		max_mask = 0xffff;
-		break;
-	default:
-		break;
-	}
-
-	*pmin = min_mask;
-	*pmax = max_mask;
-}
-
 void si_pmu_spuravoid_pllupdate(struct si_pub *sih, u8 spuravoid)
 {
 	u32 tmp = 0;
@@ -284,51 +253,6 @@ u32 si_pmu_alp_clock(struct si_pub *sih)
 	return clock;
 }
 
-/* initialize PMU */
-void si_pmu_init(struct si_pub *sih)
-{
-	struct si_info *sii = container_of(sih, struct si_info, pub);
-	struct bcma_device *core;
-
-	/* select chipc */
-	core = sii->icbus->drv_cc.core;
-
-	if (ai_get_pmurev(sih) == 1)
-		bcma_mask32(core, CHIPCREGOFFS(pmucontrol),
-			    ~PCTL_NOILP_ON_WAIT);
-	else if (ai_get_pmurev(sih) >= 2)
-		bcma_set32(core, CHIPCREGOFFS(pmucontrol), PCTL_NOILP_ON_WAIT);
-}
-
-/* initialize PMU resources */
-void si_pmu_res_init(struct si_pub *sih)
-{
-	struct si_info *sii = container_of(sih, struct si_info, pub);
-	struct bcma_device *core;
-	u32 min_mask = 0, max_mask = 0;
-
-	/* select to chipc */
-	core = sii->icbus->drv_cc.core;
-
-	/* Determine min/max rsrc masks */
-	si_pmu_res_masks(sih, &min_mask, &max_mask);
-
-	/* It is required to program max_mask first and then min_mask */
-
-	/* Program max resource mask */
-
-	if (max_mask)
-		bcma_write32(core, CHIPCREGOFFS(max_res_mask), max_mask);
-
-	/* Program min resource mask */
-
-	if (min_mask)
-		bcma_write32(core, CHIPCREGOFFS(min_res_mask), min_mask);
-
-	/* Add some delay; allow resources to come up and settle. */
-	mdelay(2);
-}
-
 u32 si_pmu_measure_alpclk(struct si_pub *sih)
 {
 	struct si_info *sii = container_of(sih, struct si_info, pub);
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
index 3e39c5e..2f0ad28 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
@@ -28,8 +28,6 @@ extern u32 si_pmu_alp_clock(struct si_pub *sih);
 extern void si_pmu_pllupd(struct si_pub *sih);
 extern void si_pmu_spuravoid_pllupdate(struct si_pub *sih, u8 spuravoid);
 extern u32 si_pmu_pllcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
-extern void si_pmu_init(struct si_pub *sih);
-extern void si_pmu_res_init(struct si_pub *sih);
 extern u32 si_pmu_measure_alpclk(struct si_pub *sih);
 
 #endif /* _BRCM_PMU_H_ */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 07/18] brcmsmac: remove si_pmu_spuravoid_pllupdate()
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (5 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 06/18] brcmsmac: remove si_pmu_init() and si_pmu_res_init() Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06  9:33   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 08/18] brcmsmac: remove some redundant chip common workarounds Hauke Mehrtens
                   ` (10 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

si_pmu_spuravoid_pllupdate() is now replaced by
bcma_pmu_spuravoid_pllupdate() which does the same thing, but supports
more chips.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c    |    3 +-
 drivers/net/wireless/brcm80211/brcmsmac/pmu.c      |   84 --------------------
 drivers/net/wireless/brcm80211/brcmsmac/pmu.h      |    1 -
 3 files changed, 2 insertions(+), 86 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
index 13b2615..2247fef 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
@@ -21106,6 +21106,7 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
 			    const struct nphy_sfo_cfg *ci)
 {
 	u16 val;
+	struct si_info *sii = container_of(pi->sh->sih, struct si_info, pub);
 
 	val = read_phy_reg(pi, 0x09) & NPHY_BandControl_currentBand;
 	if (CHSPEC_IS5G(chanspec) && !val) {
@@ -21189,7 +21190,7 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
 			spuravoid = 1;
 
 		wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false);
-		si_pmu_spuravoid_pllupdate(pi->sh->sih, spuravoid);
+		bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc, spuravoid);
 		wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true);
 
 		if ((pi->sh->chip == BCM43224_CHIP_ID) ||
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
index 045f43a..6b4344f 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
@@ -74,16 +74,6 @@
  * PMU<rev>_PLL<num>_XX where <rev> is PMU corerev and <num> is an arbitrary
  * number to differentiate different PLLs controlled by the same PMU rev.
  */
-/* pllcontrol registers:
- * ndiv_pwrdn, pwrdn_ch<x>, refcomp_pwrdn, dly_ch<x>,
- * p1div, p2div, _bypass_sdmod
- */
-#define PMU1_PLL0_PLLCTL0		0
-#define PMU1_PLL0_PLLCTL1		1
-#define PMU1_PLL0_PLLCTL2		2
-#define PMU1_PLL0_PLLCTL3		3
-#define PMU1_PLL0_PLLCTL4		4
-#define PMU1_PLL0_PLLCTL5		5
 
 /* pmu XtalFreqRatio */
 #define	PMU_XTALFREQ_REG_ILPCTR_MASK	0x00001FFF
@@ -108,80 +98,6 @@
 #define	RES4313_HT_AVAIL_RSRC		14
 #define	RES4313_MACPHY_CLK_AVAIL_RSRC	15
 
-void si_pmu_spuravoid_pllupdate(struct si_pub *sih, u8 spuravoid)
-{
-	u32 tmp = 0;
-	struct si_info *sii = container_of(sih, struct si_info, pub);
-	struct bcma_device *core;
-
-	/* switch to chipc */
-	core = sii->icbus->drv_cc.core;
-
-	switch (ai_get_chip_id(sih)) {
-	case BCM43224_CHIP_ID:
-	case BCM43225_CHIP_ID:
-		if (spuravoid == 1) {
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL0);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x11500010);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL1);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x000C0C06);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL2);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x0F600a08);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL3);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x00000000);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL4);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x2001E920);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL5);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x88888815);
-		} else {
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL0);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x11100010);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL1);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x000c0c06);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL2);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x03000a08);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL3);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x00000000);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL4);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x200005c0);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_addr),
-				     PMU1_PLL0_PLLCTL5);
-			bcma_write32(core, CHIPCREGOFFS(pllcontrol_data),
-				     0x88888815);
-		}
-		tmp = 1 << 10;
-		break;
-
-	default:
-		/* bail out */
-		return;
-	}
-
-	bcma_set32(core, CHIPCREGOFFS(pmucontrol), tmp);
-}
-
 u16 si_pmu_fast_pwrup_delay(struct si_pub *sih)
 {
 	uint delay = PMU_MAX_TRANSITION_DLY;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
index 2f0ad28..f7cff87 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.h
@@ -26,7 +26,6 @@ extern u32 si_pmu_chipcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
 extern u32 si_pmu_regcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
 extern u32 si_pmu_alp_clock(struct si_pub *sih);
 extern void si_pmu_pllupd(struct si_pub *sih);
-extern void si_pmu_spuravoid_pllupdate(struct si_pub *sih, u8 spuravoid);
 extern u32 si_pmu_pllcontrol(struct si_pub *sih, uint reg, u32 mask, u32 val);
 extern u32 si_pmu_measure_alpclk(struct si_pub *sih);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 08/18] brcmsmac: remove some redundant chip common workarounds
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (6 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 07/18] brcmsmac: remove si_pmu_spuravoid_pllupdate() Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06 12:14   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 09/18] brcmsmac: use core id constants from bcma Hauke Mehrtens
                   ` (9 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

The removed workarounds are already performed in bcma_pmu_workarounds()
and bcma_core_chipcommon_init()

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   42 ---------------------
 1 file changed, 42 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
index 01837fb..5997624 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.c
@@ -476,11 +476,7 @@ static struct si_info *ai_doattach(struct si_info *sii,
 				   struct bcma_bus *pbus)
 {
 	struct si_pub *sih = &sii->pub;
-	u32 w, savewin;
 	struct bcma_device *cc;
-	struct ssb_sprom *sprom = &pbus->sprom;
-
-	savewin = 0;
 
 	sii->icbus = pbus;
 	sii->pcibus = pbus->host_pci;
@@ -506,44 +502,6 @@ static struct si_info *ai_doattach(struct si_info *sii,
 		(void)si_pmu_measure_alpclk(sih);
 	}
 
-	/* setup the GPIO based LED powersave register */
-	w = (sprom->leddc_on_time << BCMA_CC_GPIOTIMER_ONTIME_SHIFT) |
-		 (sprom->leddc_off_time << BCMA_CC_GPIOTIMER_OFFTIME_SHIFT);
-	if (w == 0)
-		w = DEFAULT_GPIOTIMERVAL;
-	ai_cc_reg(sih, offsetof(struct chipcregs, gpiotimerval),
-		  ~0, w);
-
-	if (ai_get_chip_id(sih) == BCM43224_CHIP_ID) {
-		/*
-		 * enable 12 mA drive strenth for 43224 and
-		 * set chipControl register bit 15
-		 */
-		if (ai_get_chiprev(sih) == 0) {
-			SI_MSG("Applying 43224A0 WARs\n");
-			ai_cc_reg(sih, offsetof(struct chipcregs, chipcontrol),
-				  CCTRL43224_GPIO_TOGGLE,
-				  CCTRL43224_GPIO_TOGGLE);
-			si_pmu_chipcontrol(sih, 0, CCTRL_43224A0_12MA_LED_DRIVE,
-					   CCTRL_43224A0_12MA_LED_DRIVE);
-		}
-		if (ai_get_chiprev(sih) >= 1) {
-			SI_MSG("Applying 43224B0+ WARs\n");
-			si_pmu_chipcontrol(sih, 0, CCTRL_43224B0_12MA_LED_DRIVE,
-					   CCTRL_43224B0_12MA_LED_DRIVE);
-		}
-	}
-
-	if (ai_get_chip_id(sih) == BCM4313_CHIP_ID) {
-		/*
-		 * enable 12 mA drive strenth for 4313 and
-		 * set chipControl register bit 1
-		 */
-		SI_MSG("Applying 4313 WARs\n");
-		si_pmu_chipcontrol(sih, 0, CCTRL_4313_12MA_LED_DRIVE,
-				   CCTRL_4313_12MA_LED_DRIVE);
-	}
-
 	return sii;
 
  exit:
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 09/18] brcmsmac: use core id constants from bcma
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (7 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 08/18] brcmsmac: remove some redundant chip common workarounds Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06  9:43   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 10/18] brcmsmac: use chip and package " Hauke Mehrtens
                   ` (8 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens


Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/dma.c |    4 +-
 drivers/net/wireless/brcm80211/include/soc.h  |   62 -------------------------
 2 files changed, 2 insertions(+), 64 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index 11054ae..b67b20c 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -639,10 +639,10 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 	di->dataoffsetlow = di->ddoffsetlow;
 	di->dataoffsethigh = di->ddoffsethigh;
 	/* WAR64450 : DMACtl.Addr ext fields are not supported in SDIOD core. */
-	if ((core->id.id == SDIOD_CORE_ID)
+	if ((core->id.id == BCMA_CORE_SDIO_DEV)
 	    && ((rev > 0) && (rev <= 2)))
 		di->addrext = false;
-	else if ((core->id.id == I2S_CORE_ID) &&
+	else if ((core->id.id == BCMA_CORE_I2S) &&
 		 ((rev == 0) || (rev == 1)))
 		di->addrext = false;
 	else
diff --git a/drivers/net/wireless/brcm80211/include/soc.h b/drivers/net/wireless/brcm80211/include/soc.h
index 4e9b7e4..123cfa8 100644
--- a/drivers/net/wireless/brcm80211/include/soc.h
+++ b/drivers/net/wireless/brcm80211/include/soc.h
@@ -19,68 +19,6 @@
 
 #define SI_ENUM_BASE		0x18000000	/* Enumeration space base */
 
-/* core codes */
-#define	NODEV_CORE_ID		0x700	/* Invalid coreid */
-#define	CC_CORE_ID		0x800	/* chipcommon core */
-#define	ILINE20_CORE_ID		0x801	/* iline20 core */
-#define	SRAM_CORE_ID		0x802	/* sram core */
-#define	SDRAM_CORE_ID		0x803	/* sdram core */
-#define	PCI_CORE_ID		0x804	/* pci core */
-#define	MIPS_CORE_ID		0x805	/* mips core */
-#define	ENET_CORE_ID		0x806	/* enet mac core */
-#define	CODEC_CORE_ID		0x807	/* v90 codec core */
-#define	USB_CORE_ID		0x808	/* usb 1.1 host/device core */
-#define	ADSL_CORE_ID		0x809	/* ADSL core */
-#define	ILINE100_CORE_ID	0x80a	/* iline100 core */
-#define	IPSEC_CORE_ID		0x80b	/* ipsec core */
-#define	UTOPIA_CORE_ID		0x80c	/* utopia core */
-#define	PCMCIA_CORE_ID		0x80d	/* pcmcia core */
-#define	SOCRAM_CORE_ID		0x80e	/* internal memory core */
-#define	MEMC_CORE_ID		0x80f	/* memc sdram core */
-#define	OFDM_CORE_ID		0x810	/* OFDM phy core */
-#define	EXTIF_CORE_ID		0x811	/* external interface core */
-#define	D11_CORE_ID		0x812	/* 802.11 MAC core */
-#define	APHY_CORE_ID		0x813	/* 802.11a phy core */
-#define	BPHY_CORE_ID		0x814	/* 802.11b phy core */
-#define	GPHY_CORE_ID		0x815	/* 802.11g phy core */
-#define	MIPS33_CORE_ID		0x816	/* mips3302 core */
-#define	USB11H_CORE_ID		0x817	/* usb 1.1 host core */
-#define	USB11D_CORE_ID		0x818	/* usb 1.1 device core */
-#define	USB20H_CORE_ID		0x819	/* usb 2.0 host core */
-#define	USB20D_CORE_ID		0x81a	/* usb 2.0 device core */
-#define	SDIOH_CORE_ID		0x81b	/* sdio host core */
-#define	ROBO_CORE_ID		0x81c	/* roboswitch core */
-#define	ATA100_CORE_ID		0x81d	/* parallel ATA core */
-#define	SATAXOR_CORE_ID		0x81e	/* serial ATA & XOR DMA core */
-#define	GIGETH_CORE_ID		0x81f	/* gigabit ethernet core */
-#define	PCIE_CORE_ID		0x820	/* pci express core */
-#define	NPHY_CORE_ID		0x821	/* 802.11n 2x2 phy core */
-#define	SRAMC_CORE_ID		0x822	/* SRAM controller core */
-#define	MINIMAC_CORE_ID		0x823	/* MINI MAC/phy core */
-#define	ARM11_CORE_ID		0x824	/* ARM 1176 core */
-#define	ARM7S_CORE_ID		0x825	/* ARM7tdmi-s core */
-#define	LPPHY_CORE_ID		0x826	/* 802.11a/b/g phy core */
-#define	PMU_CORE_ID		0x827	/* PMU core */
-#define	SSNPHY_CORE_ID		0x828	/* 802.11n single-stream phy core */
-#define	SDIOD_CORE_ID		0x829	/* SDIO device core */
-#define	ARMCM3_CORE_ID		0x82a	/* ARM Cortex M3 core */
-#define	HTPHY_CORE_ID		0x82b	/* 802.11n 4x4 phy core */
-#define	MIPS74K_CORE_ID		0x82c	/* mips 74k core */
-#define	GMAC_CORE_ID		0x82d	/* Gigabit MAC core */
-#define	DMEMC_CORE_ID		0x82e	/* DDR1/2 memory controller core */
-#define	PCIERC_CORE_ID		0x82f	/* PCIE Root Complex core */
-#define	OCP_CORE_ID		0x830	/* OCP2OCP bridge core */
-#define	SC_CORE_ID		0x831	/* shared common core */
-#define	AHB_CORE_ID		0x832	/* OCP2AHB bridge core */
-#define	SPIH_CORE_ID		0x833	/* SPI host core */
-#define	I2S_CORE_ID		0x834	/* I2S core */
-#define	DMEMS_CORE_ID		0x835	/* SDR/DDR1 memory controller core */
-#define	DEF_SHIM_COMP		0x837	/* SHIM component in ubus/6362 */
-#define OOB_ROUTER_CORE_ID	0x367	/* OOB router core ID */
-#define	DEF_AI_COMP		0xfff	/* Default component, in ai chips it
-					 * maps all unused address ranges
-					 */
-
 /* Common core control flags */
 #define	SICF_BIST_EN		0x8000
 #define	SICF_PME_EN		0x4000
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 10/18] brcmsmac: use chip and package id constants from bcma
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (8 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 09/18] brcmsmac: use core id constants from bcma Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06  9:44   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 11/18] brcmsmac: remove some unnessessacry casts and void pointer Hauke Mehrtens
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens


Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/aiutils.h  |   10 ----------
 drivers/net/wireless/brcm80211/brcmsmac/main.c     |   12 ++++++------
 .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c  |   10 +++++-----
 .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c    |   20 ++++++++++----------
 drivers/net/wireless/brcm80211/brcmsmac/pmu.c      |   12 ++++++------
 5 files changed, 27 insertions(+), 37 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
index 2c101b2..8a069b6 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
+++ b/drivers/net/wireless/brcm80211/brcmsmac/aiutils.h
@@ -88,16 +88,6 @@
 #define	CLKD_OTP		0x000f0000
 #define	CLKD_OTP_SHIFT		16
 
-/* Package IDs */
-#define	BCM4717_PKG_ID		9	/* 4717 package id */
-#define	BCM4718_PKG_ID		10	/* 4718 package id */
-#define BCM43224_FAB_SMIC	0xa	/* the chip is manufactured by SMIC */
-
-/* these are router chips */
-#define	BCM4716_CHIP_ID		0x4716	/* 4716 chipcommon chipid */
-#define	BCM47162_CHIP_ID	47162	/* 47162 chipcommon chipid */
-#define	BCM4748_CHIP_ID		0x4748	/* 4716 chipcommon chipid (OTP, RBBU) */
-
 /* dynamic clock control defines */
 #define	LPOMINFREQ		25000	/* low power oscillator min */
 #define	LPOMAXFREQ		43000	/* low power oscillator max */
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 19db405..8cfa8bb 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -2125,8 +2125,8 @@ void brcms_b_switch_macfreq(struct brcms_hardware *wlc_hw, u8 spurmode)
 {
 	struct bcma_device *core = wlc_hw->d11core;
 
-	if ((ai_get_chip_id(wlc_hw->sih) == BCM43224_CHIP_ID) ||
-	    (ai_get_chip_id(wlc_hw->sih) == BCM43225_CHIP_ID)) {
+	if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43224) ||
+	    (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225)) {
 		if (spurmode == WL_SPURAVOID_ON2) {	/* 126Mhz */
 			bcma_write16(core, D11REGOFFS(tsf_clk_frac_l), 0x2082);
 			bcma_write16(core, D11REGOFFS(tsf_clk_frac_h), 0x8);
@@ -2790,7 +2790,7 @@ void brcms_b_core_phypll_ctl(struct brcms_hardware *wlc_hw, bool on)
 	tmp = 0;
 
 	if (on) {
-		if ((ai_get_chip_id(wlc_hw->sih) == BCM4313_CHIP_ID)) {
+		if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) {
 			bcma_set32(core, D11REGOFFS(clk_ctl_st),
 				   CCS_ERSRC_REQ_HT |
 				   CCS_ERSRC_REQ_D11PLL |
@@ -4541,7 +4541,7 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
 	else
 		wlc_hw->_nbands = 1;
 
-	if ((ai_get_chip_id(wlc_hw->sih) == BCM43225_CHIP_ID))
+	if ((ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM43225))
 		wlc_hw->_nbands = 1;
 
 	/* BMAC_NOTE: remove init of pub values when brcms_c_attach()
@@ -5049,7 +5049,7 @@ static void brcms_b_hw_up(struct brcms_hardware *wlc_hw)
 	wlc_hw->wlc->pub->hw_up = true;
 
 	if ((wlc_hw->boardflags & BFL_FEM)
-	    && (ai_get_chip_id(wlc_hw->sih) == BCM4313_CHIP_ID)) {
+	    && (ai_get_chip_id(wlc_hw->sih) == BCMA_CHIP_ID_BCM4313)) {
 		if (!
 		    (wlc_hw->boardrev >= 0x1250
 		     && (wlc_hw->boardflags & BFL_FEM_BT)))
@@ -5141,7 +5141,7 @@ int brcms_c_up(struct brcms_c_info *wlc)
 	}
 
 	if ((wlc->pub->boardflags & BFL_FEM)
-	    && (ai_get_chip_id(wlc->hw->sih) == BCM4313_CHIP_ID)) {
+	    && (ai_get_chip_id(wlc->hw->sih) == BCMA_CHIP_ID_BCM4313)) {
 		if (wlc->pub->boardrev >= 0x1250
 		    && (wlc->pub->boardflags & BFL_FEM_BT))
 			brcms_b_mhf(wlc->hw, MHF5, MHF5_4313_GPIOCTRL,
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
index 264f8c4..d16cbec 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -837,7 +837,7 @@ wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,
 	pi->tbl_data_hi = tblDataHi;
 	pi->tbl_data_lo = tblDataLo;
 
-	if (pi->sh->chip == BCM43224_CHIP_ID &&
+	if (pi->sh->chip == BCMA_CHIP_ID_BCM43224 &&
 	    pi->sh->chiprev == 1) {
 		pi->tbl_addr = tblAddr;
 		pi->tbl_save_id = tbl_id;
@@ -847,7 +847,7 @@ wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,
 
 void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val)
 {
-	if ((pi->sh->chip == BCM43224_CHIP_ID) &&
+	if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
 	    (pi->sh->chiprev == 1) &&
 	    (pi->tbl_save_id == NPHY_TBL_ID_ANTSWCTRLLUT)) {
 		read_phy_reg(pi, pi->tbl_data_lo);
@@ -881,7 +881,7 @@ wlc_phy_write_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,
 
 	for (idx = 0; idx < ptbl_info->tbl_len; idx++) {
 
-		if ((pi->sh->chip == BCM43224_CHIP_ID) &&
+		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
 		    (pi->sh->chiprev == 1) &&
 		    (tbl_id == NPHY_TBL_ID_ANTSWCTRLLUT)) {
 			read_phy_reg(pi, tblDataLo);
@@ -918,7 +918,7 @@ wlc_phy_read_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,
 
 	for (idx = 0; idx < ptbl_info->tbl_len; idx++) {
 
-		if ((pi->sh->chip == BCM43224_CHIP_ID) &&
+		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
 		    (pi->sh->chiprev == 1)) {
 			(void)read_phy_reg(pi, tblDataLo);
 
@@ -2894,7 +2894,7 @@ const u8 *wlc_phy_get_ofdm_rate_lookup(void)
 
 void wlc_lcnphy_epa_switch(struct brcms_phy *pi, bool mode)
 {
-	if ((pi->sh->chip == BCM4313_CHIP_ID) &&
+	if ((pi->sh->chip == BCMA_CHIP_ID_BCM4313) &&
 	    (pi->sh->boardflags & BFL_FEM)) {
 		if (mode) {
 			u16 txant = 0;
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
index 2247fef..f0ccac8 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
@@ -19309,8 +19309,8 @@ void wlc_phy_init_nphy(struct brcms_phy *pi)
 		pi->measure_hold |= PHY_HOLD_FOR_NOT_ASSOC;
 
 	if ((ISNPHY(pi)) && (NREV_GE(pi->pubpi.phy_rev, 5)) &&
-	    ((pi->sh->chippkg == BCM4717_PKG_ID) ||
-	     (pi->sh->chippkg == BCM4718_PKG_ID))) {
+	    ((pi->sh->chippkg == BCMA_PKG_ID_BCM4717) ||
+	     (pi->sh->chippkg == BCMA_PKG_ID_BCM4718))) {
 		if ((pi->sh->boardflags & BFL_EXTLNA) &&
 		    (CHSPEC_IS2G(pi->radio_chanspec)))
 			ai_cc_reg(pi->sh->sih,
@@ -20751,11 +20751,11 @@ wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi,
 				cascbias = 0x20;
 
 				if ((pi->sh->chip ==
-				     BCM43224_CHIP_ID)
+				     BCMA_CHIP_ID_BCM43224)
 				    || (pi->sh->chip ==
-					BCM43225_CHIP_ID)) {
+					BCMA_CHIP_ID_BCM43225)) {
 					if (pi->sh->chippkg ==
-					    BCM43224_FAB_SMIC) {
+					    BCMA_PKG_ID_BCM43224_FAB_SMIC) {
 						bias = 0x2a;
 						cascbias = 0x38;
 					}
@@ -20863,9 +20863,9 @@ wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi,
 
 			cascbias = 0x30;
 
-			if ((pi->sh->chip == BCM43224_CHIP_ID) ||
-			    (pi->sh->chip == BCM43225_CHIP_ID)) {
-				if (pi->sh->chippkg == BCM43224_FAB_SMIC)
+			if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) ||
+			    (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) {
+				if (pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC)
 					cascbias = 0x35;
 			}
 
@@ -21193,8 +21193,8 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
 		bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc, spuravoid);
 		wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true);
 
-		if ((pi->sh->chip == BCM43224_CHIP_ID) ||
-		    (pi->sh->chip == BCM43225_CHIP_ID)) {
+		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) ||
+		    (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) {
 			if (spuravoid == 1) {
 				bcma_write16(pi->d11core,
 					     D11REGOFFS(tsf_clk_frac_l),
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
index 6b4344f..7e9df56 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/pmu.c
@@ -103,9 +103,9 @@ u16 si_pmu_fast_pwrup_delay(struct si_pub *sih)
 	uint delay = PMU_MAX_TRANSITION_DLY;
 
 	switch (ai_get_chip_id(sih)) {
-	case BCM43224_CHIP_ID:
-	case BCM43225_CHIP_ID:
-	case BCM4313_CHIP_ID:
+	case BCMA_CHIP_ID_BCM43224:
+	case BCMA_CHIP_ID_BCM43225:
+	case BCMA_CHIP_ID_BCM4313:
 		delay = 3700;
 		break;
 	default:
@@ -156,9 +156,9 @@ u32 si_pmu_alp_clock(struct si_pub *sih)
 		return clock;
 
 	switch (ai_get_chip_id(sih)) {
-	case BCM43224_CHIP_ID:
-	case BCM43225_CHIP_ID:
-	case BCM4313_CHIP_ID:
+	case BCMA_CHIP_ID_BCM43224:
+	case BCMA_CHIP_ID_BCM43225:
+	case BCMA_CHIP_ID_BCM4313:
 		/* always 20Mhz */
 		clock = 20000 * 1000;
 		break;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 11/18] brcmsmac: remove some unnessessacry casts and void pointer
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (9 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 10/18] brcmsmac: use chip and package " Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06  9:46   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 12/18] brcmsmac: add a conditions for core rev 17 again Hauke Mehrtens
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens


Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/main.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 8cfa8bb..a07ff0a 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -4231,9 +4231,8 @@ static void brcms_c_radio_timer(void *arg)
 }
 
 /* common low-level watchdog code */
-static void brcms_b_watchdog(void *arg)
+static void brcms_b_watchdog(struct brcms_c_info *wlc)
 {
-	struct brcms_c_info *wlc = (struct brcms_c_info *) arg;
 	struct brcms_hardware *wlc_hw = wlc->hw;
 
 	BCMMSG(wlc->wiphy, "wl%d\n", wlc_hw->unit);
@@ -4254,10 +4253,8 @@ static void brcms_b_watchdog(void *arg)
 }
 
 /* common watchdog code */
-static void brcms_c_watchdog(void *arg)
+static void brcms_c_watchdog(struct brcms_c_info *wlc)
 {
-	struct brcms_c_info *wlc = (struct brcms_c_info *) arg;
-
 	BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
 
 	if (!wlc->pub->up)
@@ -4297,7 +4294,9 @@ static void brcms_c_watchdog(void *arg)
 
 static void brcms_c_watchdog_by_timer(void *arg)
 {
-	brcms_c_watchdog(arg);
+	struct brcms_c_info *wlc = (struct brcms_c_info *) arg;
+
+	brcms_c_watchdog(wlc);
 }
 
 static bool brcms_c_timers_init(struct brcms_c_info *wlc, int unit)
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 12/18] brcmsmac: add a conditions for core rev 17 again
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (10 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 11/18] brcmsmac: remove some unnessessacry casts and void pointer Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-05 23:07 ` [PATCH 13/18] brcmsmac: add some workarounds for other chips again Hauke Mehrtens
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

This reverts some changes made in this commit:
commit 7234592364e2efe8b4ac1040c99b1d7ef01cf502
Author: Roland Vossen <rvossen@broadcom.com>
Date:   Mon Feb 14 12:16:45 2011 +0100

    staging: brcm80211: removal of inactive d11 code

The bcm4716 has a rev 17 wireless core and this condition is needed.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/main.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index a07ff0a..9aa14e2 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -1941,7 +1941,8 @@ static bool brcms_b_radio_read_hwdisabled(struct brcms_hardware *wlc_hw)
 		 * accesses phyreg throughput mac. This can be skipped since
 		 * only mac reg is accessed below
 		 */
-		flags |= SICF_PCLKE;
+		if (D11REV_GE(wlc_hw->corerev, 18))
+			flags |= SICF_PCLKE;
 
 		/*
 		 * TODO: test suspend/resume
@@ -2022,7 +2023,8 @@ void brcms_b_corereset(struct brcms_hardware *wlc_hw, u32 flags)
 	 * phyreg throughput mac, AND phy_reset is skipped at early stage when
 	 * band->pi is invalid. need to enable PHY CLK
 	 */
-	flags |= SICF_PCLKE;
+	if (D11REV_GE(wlc_hw->corerev, 18))
+		flags |= SICF_PCLKE;
 
 	/*
 	 * reset the core
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 13/18] brcmsmac: add some workarounds for other chips again
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (11 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 12/18] brcmsmac: add a conditions for core rev 17 again Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06 10:03   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 14/18] brcmsmac: extend xmtfifo_sz array Hauke Mehrtens
                   ` (4 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

This adds some workarounds for the BCM4716, BCM47162, BCM43421, BCM5357
and BCM6362 to the phy code again. This patch reverts the following
patch expect the part with the workaround for the BCM43236, which is an
usb chip and will be unsupported by brcmsmac.

commit c2c724977f95135f397fe0cb45f3c041d26b91e1
Author: Arend van Spriel <arend@broadcom.com>
Date:   Wed Jun 29 16:46:35 2011 -0700

    staging: brcm80211: remove unsupported chipset code from brcmsmac phy

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c  |   14 +-
 .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c    |  144 ++++++++++++++------
 2 files changed, 109 insertions(+), 49 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
index d16cbec..5cfbe5c 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -837,8 +837,9 @@ wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,
 	pi->tbl_data_hi = tblDataHi;
 	pi->tbl_data_lo = tblDataLo;
 
-	if (pi->sh->chip == BCMA_CHIP_ID_BCM43224 &&
-	    pi->sh->chiprev == 1) {
+	if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 ||
+	     pi->sh->chip == BCMA_CHIP_ID_BCM43421) &&
+	    (pi->sh->chiprev == 1)) {
 		pi->tbl_addr = tblAddr;
 		pi->tbl_save_id = tbl_id;
 		pi->tbl_save_offset = tbl_offset;
@@ -847,7 +848,8 @@ wlc_phy_table_addr(struct brcms_phy *pi, uint tbl_id, uint tbl_offset,
 
 void wlc_phy_table_data_write(struct brcms_phy *pi, uint width, u32 val)
 {
-	if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
+	if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 ||
+	     pi->sh->chip == BCMA_CHIP_ID_BCM43421) &&
 	    (pi->sh->chiprev == 1) &&
 	    (pi->tbl_save_id == NPHY_TBL_ID_ANTSWCTRLLUT)) {
 		read_phy_reg(pi, pi->tbl_data_lo);
@@ -881,7 +883,8 @@ wlc_phy_write_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,
 
 	for (idx = 0; idx < ptbl_info->tbl_len; idx++) {
 
-		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
+		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 ||
+		     pi->sh->chip == BCMA_CHIP_ID_BCM43421) &&
 		    (pi->sh->chiprev == 1) &&
 		    (tbl_id == NPHY_TBL_ID_ANTSWCTRLLUT)) {
 			read_phy_reg(pi, tblDataLo);
@@ -918,7 +921,8 @@ wlc_phy_read_table(struct brcms_phy *pi, const struct phytbl_info *ptbl_info,
 
 	for (idx = 0; idx < ptbl_info->tbl_len; idx++) {
 
-		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) &&
+		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 ||
+		     pi->sh->chip == BCMA_CHIP_ID_BCM43421) &&
 		    (pi->sh->chiprev == 1)) {
 			(void)read_phy_reg(pi, tblDataLo);
 
diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
index f0ccac8..de1101a 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_n.c
@@ -17893,6 +17893,8 @@ static u32 *wlc_phy_get_ipa_gaintbl_nphy(struct brcms_phy *pi)
 					nphy_tpc_txgain_ipa_2g_2057rev7;
 		} else if (NREV_IS(pi->pubpi.phy_rev, 6)) {
 			tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev6;
+			if (pi->sh->chip == BCMA_CHIP_ID_BCM47162)
+				tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5;
 		} else if (NREV_IS(pi->pubpi.phy_rev, 5)) {
 			tx_pwrctrl_tbl = nphy_tpc_txgain_ipa_rev5;
 		} else {
@@ -19254,8 +19256,14 @@ static void wlc_phy_spurwar_nphy(struct brcms_phy *pi)
 			case 38:
 			case 102:
 			case 118:
-				nphy_adj_tone_id_buf[0] = 0;
-				nphy_adj_noise_var_buf[0] = 0x0;
+				if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) &&
+				    (pi->sh->chippkg == BCMA_PKG_ID_BCM4717)) {
+					nphy_adj_tone_id_buf[0] = 32;
+					nphy_adj_noise_var_buf[0] = 0x21f;
+				} else {
+					nphy_adj_tone_id_buf[0] = 0;
+					nphy_adj_noise_var_buf[0] = 0x0;
+				}
 				break;
 			case 134:
 				nphy_adj_tone_id_buf[0] = 32;
@@ -19318,6 +19326,10 @@ void wlc_phy_init_nphy(struct brcms_phy *pi)
 				  0x40, 0x40);
 	}
 
+	if ((!PHY_IPA(pi)) && (pi->sh->chip == BCMA_CHIP_ID_BCM5357))
+		si_pmu_chipcontrol(pi->sh->sih, 1, CCTRL5357_EXTPA,
+				   CCTRL5357_EXTPA);
+
 	if ((pi->nphy_gband_spurwar2_en) && CHSPEC_IS2G(pi->radio_chanspec) &&
 	    CHSPEC_IS40(pi->radio_chanspec)) {
 
@@ -20060,6 +20072,9 @@ static void wlc_phy_radio_postinit_2057(struct brcms_phy *pi)
 
 	mod_radio_reg(pi, RADIO_2057_XTALPUOVR_PINCTRL, 0x1, 0x1);
 
+	if (pi->sh->chip == !BCMA_CHIP_ID_BCM6362)
+		mod_radio_reg(pi, RADIO_2057_XTALPUOVR_PINCTRL, 0x2, 0x2);
+
 	mod_radio_reg(pi, RADIO_2057_RFPLL_MISC_CAL_RESETN, 0x78, 0x78);
 	mod_radio_reg(pi, RADIO_2057_XTAL_CONFIG2, 0x80, 0x80);
 	mdelay(2);
@@ -20695,12 +20710,22 @@ wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi,
 			write_radio_reg(pi, RADIO_2056_SYN_PLL_LOOPFILTER2 |
 					RADIO_2056_SYN, 0x1f);
 
-			write_radio_reg(pi,
-					RADIO_2056_SYN_PLL_LOOPFILTER4 |
-					RADIO_2056_SYN, 0xb);
-			write_radio_reg(pi,
-					RADIO_2056_SYN_PLL_CP2 |
-					RADIO_2056_SYN, 0x14);
+			if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) ||
+			    (pi->sh->chip == BCMA_CHIP_ID_BCM47162)) {
+				write_radio_reg(pi,
+						RADIO_2056_SYN_PLL_LOOPFILTER4 |
+						RADIO_2056_SYN, 0x14);
+				write_radio_reg(pi,
+						RADIO_2056_SYN_PLL_CP2 |
+						RADIO_2056_SYN, 0x00);
+			} else {
+				write_radio_reg(pi,
+						RADIO_2056_SYN_PLL_LOOPFILTER4 |
+						RADIO_2056_SYN, 0xb);
+				write_radio_reg(pi,
+						RADIO_2056_SYN_PLL_CP2 |
+						RADIO_2056_SYN, 0x14);
+			}
 		}
 	}
 
@@ -20747,24 +20772,31 @@ wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi,
 				WRITE_RADIO_REG2(pi, RADIO_2056, TX, core,
 						 PADG_IDAC, 0xcc);
 
-				bias = 0x25;
-				cascbias = 0x20;
+				if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) ||
+				    (pi->sh->chip == BCMA_CHIP_ID_BCM47162)) {
+					bias = 0x40;
+					cascbias = 0x45;
+					pag_boost_tune = 0x5;
+					pgag_boost_tune = 0x33;
+					padg_boost_tune = 0x77;
+					mixg_boost_tune = 0x55;
+				} else {
+					bias = 0x25;
+					cascbias = 0x20;
 
-				if ((pi->sh->chip ==
-				     BCMA_CHIP_ID_BCM43224)
-				    || (pi->sh->chip ==
-					BCMA_CHIP_ID_BCM43225)) {
-					if (pi->sh->chippkg ==
-					    BCMA_PKG_ID_BCM43224_FAB_SMIC) {
+					if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 ||
+					     pi->sh->chip == BCMA_CHIP_ID_BCM43225 ||
+					     pi->sh->chip == BCMA_CHIP_ID_BCM43421) &&
+					    pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC) {
 						bias = 0x2a;
 						cascbias = 0x38;
 					}
-				}
 
-				pag_boost_tune = 0x4;
-				pgag_boost_tune = 0x03;
-				padg_boost_tune = 0x77;
-				mixg_boost_tune = 0x65;
+					pag_boost_tune = 0x4;
+					pgag_boost_tune = 0x03;
+					padg_boost_tune = 0x77;
+					mixg_boost_tune = 0x65;
+				}
 
 				WRITE_RADIO_REG2(pi, RADIO_2056, TX, core,
 						 INTPAG_IMAIN_STAT, bias);
@@ -20863,11 +20895,11 @@ wlc_phy_chanspec_radio2056_setup(struct brcms_phy *pi,
 
 			cascbias = 0x30;
 
-			if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) ||
-			    (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) {
-				if (pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC)
-					cascbias = 0x35;
-			}
+			if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224 ||
+			     pi->sh->chip == BCMA_CHIP_ID_BCM43225 ||
+			     pi->sh->chip == BCMA_CHIP_ID_BCM43421) &&
+			    pi->sh->chippkg == BCMA_PKG_ID_BCM43224_FAB_SMIC)
+				cascbias = 0x35;
 
 			pabias = (pi->phy_pabias == 0) ? 0x30 : pi->phy_pabias;
 
@@ -21179,19 +21211,30 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
 		} else if (NREV_GE(pi->pubpi.phy_rev, 7)) {
 			if (val == 54)
 				spuravoid = 1;
-		} else {
-			if (pi->nphy_aband_spurwar_en &&
-			    ((val == 38) || (val == 102)
-			     || (val == 118)))
+		} else if (pi->nphy_aband_spurwar_en &&
+		    ((val == 38) || (val == 102) || (val == 118))) {
+			if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716)
+			    && (pi->sh->chippkg == BCMA_PKG_ID_BCM4717)) {
+				spuravoid = 0;
+			} else {
 				spuravoid = 1;
+			}
 		}
 
 		if (pi->phy_spuravoid == SPURAVOID_FORCEON)
 			spuravoid = 1;
 
-		wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false);
-		bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc, spuravoid);
-		wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true);
+		if ((pi->sh->chip == BCMA_CHIP_ID_BCM4716) ||
+		    (pi->sh->chip == BCMA_CHIP_ID_BCM43225) ||
+		    (pi->sh->chip == BCMA_CHIP_ID_BCM43421)) {
+			bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc,
+						     spuravoid);
+		} else {
+			wlapi_bmac_core_phypll_ctl(pi->sh->physhim, false);
+			bcma_pmu_spuravoid_pllupdate(&sii->icbus->drv_cc,
+						     spuravoid);
+			wlapi_bmac_core_phypll_ctl(pi->sh->physhim, true);
+		}
 
 		if ((pi->sh->chip == BCMA_CHIP_ID_BCM43224) ||
 		    (pi->sh->chip == BCMA_CHIP_ID_BCM43225)) {
@@ -21210,7 +21253,9 @@ wlc_phy_chanspec_nphy_setup(struct brcms_phy *pi, u16 chanspec,
 			}
 		}
 
-		wlapi_bmac_core_phypll_reset(pi->sh->physhim);
+		if (!((pi->sh->chip == BCMA_CHIP_ID_BCM4716) ||
+		      (pi->sh->chip == BCMA_CHIP_ID_BCM47162)))
+			wlapi_bmac_core_phypll_reset(pi->sh->physhim);
 
 		mod_phy_reg(pi, 0x01, (0x1 << 15),
 			    ((spuravoid > 0) ? (0x1 << 15) : 0));
@@ -22172,9 +22217,15 @@ s16 wlc_phy_tempsense_nphy(struct brcms_phy *pi)
 		wlc_phy_table_write_nphy(pi, NPHY_TBL_ID_AFECTRL, 1, 0x03, 16,
 					 &auxADC_rssi_ctrlH_save);
 
-		radio_temp[0] = (179 * (radio_temp[1] + radio_temp2[1])
-				 + 82 * (auxADC_Vl) - 28861 +
-				 128) / 256;
+		if (pi->sh->chip == BCMA_CHIP_ID_BCM5357) {
+			radio_temp[0] = (193 * (radio_temp[1] + radio_temp2[1])
+					 + 88 * (auxADC_Vl) - 27111 +
+					 128) / 256;
+		} else {
+			radio_temp[0] = (179 * (radio_temp[1] + radio_temp2[1])
+					 + 82 * (auxADC_Vl) - 28861 +
+					 128) / 256;
+		}
 
 		offset = (s16) pi->phy_tempsense_offset;
 
@@ -24818,8 +24869,11 @@ wlc_phy_a2_nphy(struct brcms_phy *pi, struct nphy_ipa_txcalgains *txgains,
 		phy_a2 = 63;
 
 		if (CHSPEC_IS2G(pi->radio_chanspec)) {
-			if ((pi->pubpi.radiorev == 4)
-			    || (pi->pubpi.radiorev == 6)) {
+			if (pi->sh->chip == BCMA_CHIP_ID_BCM6362) {
+				phy_a1 = 35;
+				phy_a3 = 35;
+			} else if ((pi->pubpi.radiorev == 4)
+				   || (pi->pubpi.radiorev == 6)) {
 				phy_a1 = 30;
 				phy_a3 = 30;
 			} else {
@@ -24924,14 +24978,16 @@ wlc_phy_a2_nphy(struct brcms_phy *pi, struct nphy_ipa_txcalgains *txgains,
 			if (txgains->useindex) {
 				phy_a4 = 15 - ((txgains->index) >> 3);
 				if (CHSPEC_IS2G(pi->radio_chanspec)) {
-					if (NREV_GE(pi->pubpi.phy_rev, 6))
+					if (NREV_GE(pi->pubpi.phy_rev, 6) &&
+					    pi->sh->chip == BCMA_CHIP_ID_BCM47162) {
+						phy_a5 = 0x10f7 | (phy_a4 << 8);
+					} else if (NREV_GE(pi->pubpi.phy_rev, 6)) {
 						phy_a5 = 0x00f7 | (phy_a4 << 8);
-
-					else
-					if (NREV_IS(pi->pubpi.phy_rev, 5))
+					} else if (NREV_IS(pi->pubpi.phy_rev, 5)) {
 						phy_a5 = 0x10f7 | (phy_a4 << 8);
-					else
+					} else {
 						phy_a5 = 0x50f7 | (phy_a4 << 8);
+					}
 				} else {
 					phy_a5 = 0x70f7 | (phy_a4 << 8);
 				}
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 14/18] brcmsmac: extend xmtfifo_sz array
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (12 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 13/18] brcmsmac: add some workarounds for other chips again Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06 10:24   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 15/18] brcmsmac: fix DMA on SoCs Hauke Mehrtens
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

The xmtfifo_sz array contains the queue sizes for the different chip
revs. This array missed the sizes for the core rev 17 and 28. This
patch extends the array to also include these sizes and adds a warning
if no queue size is stored in the array for the given core rev.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/main.c |   38 +++++++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 9aa14e2..35a3db9 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -268,7 +268,7 @@ struct brcms_c_bit_desc {
  */
 
 /* Starting corerev for the fifo size table */
-#define XMTFIFOTBL_STARTREV	20
+#define XMTFIFOTBL_STARTREV	10
 
 struct d11init {
 	__le16 addr;
@@ -332,6 +332,26 @@ const u8 wlc_prio2prec_map[] = {
 };
 
 static const u16 xmtfifo_sz[][NFIFO] = {
+	/* corerev 10: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 11: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 12: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 13: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 14: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 15: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 16: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 17: 5120, 49152, 49152, 5376, 4352, 1280 */
+	{20, 192, 192, 21, 17, 5},
+	/* corerev 18: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 19: */
+	{0, 0, 0, 0, 0, 0},
 	/* corerev 20: 5120, 49152, 49152, 5376, 4352, 1280 */
 	{20, 192, 192, 21, 17, 5},
 	/* corerev 21: 2304, 14848, 5632, 3584, 3584, 1280 */
@@ -342,6 +362,18 @@ static const u16 xmtfifo_sz[][NFIFO] = {
 	{20, 192, 192, 21, 17, 5},
 	/* corerev 24: 2304, 14848, 5632, 3584, 3584, 1280 */
 	{9, 58, 22, 14, 14, 5},
+	/* corerev 25: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 26: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 27: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 28: 5120, 49152, 49152, 5376, 4352, 1280 */
+	{20, 192, 192, 21, 17, 5},
+	/* corerev 29: */
+	{0, 0, 0, 0, 0, 0},
+	/* corerev 30: */
+	{0, 0, 0, 0, 0, 0},
 };
 
 #ifdef DEBUG
@@ -4609,8 +4641,12 @@ static int brcms_b_attach(struct brcms_c_info *wlc, struct bcma_device *core,
 		wlc_hw->machwcap_backup = wlc_hw->machwcap;
 
 		/* init tx fifo size */
+		WARN_ON((wlc_hw->corerev - XMTFIFOTBL_STARTREV) < 0 ||
+			(wlc_hw->corerev - XMTFIFOTBL_STARTREV) >
+				ARRAY_SIZE(xmtfifo_sz));
 		wlc_hw->xmtfifo_sz =
 		    xmtfifo_sz[(wlc_hw->corerev - XMTFIFOTBL_STARTREV)];
+		WARN_ON(!wlc_hw->xmtfifo_sz[0]);
 
 		/* Get a phy for this band */
 		wlc_hw->band->pi =
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 15/18] brcmsmac: fix DMA on SoCs
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (13 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 14/18] brcmsmac: extend xmtfifo_sz array Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06 11:10   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI Hauke Mehrtens
                   ` (2 subsequent siblings)
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

These extra offsets are only needed by PCIe devices and not when
running on an SoC.

This partly reverts commit:
commit 821e4e93172e4f7d5ac1eade04665c3dc5049c4a
Author: Roland Vossen <rvossen@broadcom.com>
Date:   Mon Aug 8 15:58:58 2011 +0200

    staging: brcm80211: removed unused bus code from softmac

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 drivers/net/wireless/brcm80211/brcmsmac/dma.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/dma.c b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
index b67b20c..fcbd2d2 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
@@ -573,6 +573,7 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 	struct dma_info *di;
 	u8 rev = core->id.rev;
 	uint size;
+	struct si_info *sii = container_of(sih, struct si_info, pub);
 
 	/* allocate private info structure */
 	di = kzalloc(sizeof(struct dma_info), GFP_ATOMIC);
@@ -633,11 +634,14 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
 	 */
 	di->ddoffsetlow = 0;
 	di->dataoffsetlow = 0;
-	/* add offset for pcie with DMA64 bus */
-	di->ddoffsetlow = 0;
-	di->ddoffsethigh = SI_PCIE_DMA_H32;
-	di->dataoffsetlow = di->ddoffsetlow;
-	di->dataoffsethigh = di->ddoffsethigh;
+	/* for pci bus, add offset */
+	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) {
+		/* add offset for pcie with DMA64 bus */
+		di->ddoffsetlow = 0;
+		di->ddoffsethigh = SI_PCIE_DMA_H32;
+		di->dataoffsetlow = di->ddoffsetlow;
+		di->dataoffsethigh = di->ddoffsethigh;
+	}
 	/* WAR64450 : DMACtl.Addr ext fields are not supported in SDIOD core. */
 	if ((core->id.id == BCMA_CORE_SDIO_DEV)
 	    && ((rev > 0) && (rev <= 2)))
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (14 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 15/18] brcmsmac: fix DMA on SoCs Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06 11:23   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 17/18] brcmsmac: fix read in write_phy_reg Hauke Mehrtens
  2012-06-05 23:07 ` [PATCH 18/18] brcmsmac: handle non PCI devices in the phy code Hauke Mehrtens
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

brcms_c_chipmatch() just works for PCIe devices and returns false for
non PCIe devices. This stops brcms_ops_stop() from calling it when the
devices is not a PCIe device.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |   22 +++++++++++++-------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
index 50f92a0..241224f 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
@@ -31,6 +31,7 @@
 #include "scb.h"
 #include "pub.h"
 #include "ucode_loader.h"
+#include "aiutils.h"
 #include "mac80211_if.h"
 #include "main.h"
 
@@ -311,6 +312,7 @@ static int brcms_ops_start(struct ieee80211_hw *hw)
 static void brcms_ops_stop(struct ieee80211_hw *hw)
 {
 	struct brcms_info *wl = hw->priv;
+	struct si_info *sii;
 	int status;
 
 	ieee80211_stop_queues(hw);
@@ -318,14 +320,18 @@ static void brcms_ops_stop(struct ieee80211_hw *hw)
 	if (wl->wlc == NULL)
 		return;
 
-	spin_lock_bh(&wl->lock);
-	status = brcms_c_chipmatch(wl->wlc->hw->vendorid,
-				   wl->wlc->hw->deviceid);
-	spin_unlock_bh(&wl->lock);
-	if (!status) {
-		wiphy_err(wl->wiphy,
-			  "wl: brcms_ops_stop: chipmatch failed\n");
-		return;
+	sii = container_of(wl->pub->sih, struct si_info, pub);
+
+	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) {
+		spin_lock_bh(&wl->lock);
+		status = brcms_c_chipmatch(wl->wlc->hw->vendorid,
+					   wl->wlc->hw->deviceid);
+		spin_unlock_bh(&wl->lock);
+		if (!status) {
+			wiphy_err(wl->wiphy,
+				  "wl: brcms_ops_stop: chipmatch failed\n");
+			return;
+		}
 	}
 
 	/* put driver in down state */
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 17/18] brcmsmac: fix read in write_phy_reg
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (15 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06 11:39   ` Arend van Spriel
  2012-06-05 23:07 ` [PATCH 18/18] brcmsmac: handle non PCI devices in the phy code Hauke Mehrtens
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

This reverts a unintended change mad in commit.
commit 4b006b11ca18995677c5f1cd03cc9c42fbe80693
Author: Arend van Spriel <arend@broadcom.com>
Date:   Thu Dec 8 15:06:54 2011 -0800

    brcm80211: smac: use bcma functions for register access in phy code

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c  |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
index 5cfbe5c..25a17eb 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -292,7 +292,7 @@ void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 	bcma_wflush16(pi->d11core, D11REGOFFS(phyregaddr), addr);
 	bcma_write16(pi->d11core, D11REGOFFS(phyregdata), val);
 	if (addr == 0x72)
-		(void)bcma_read16(pi->d11core, D11REGOFFS(phyversion));
+		(void)bcma_read16(pi->d11core, D11REGOFFS(phyregdata));
 #else
 	bcma_write32(pi->d11core, D11REGOFFS(phyregaddr), addr | (val << 16));
 	if (++pi->phy_wreg >= pi->phy_wreg_limit) {
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* [PATCH 18/18] brcmsmac: handle non PCI devices in the phy code
  2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
                   ` (16 preceding siblings ...)
  2012-06-05 23:07 ` [PATCH 17/18] brcmsmac: fix read in write_phy_reg Hauke Mehrtens
@ 2012-06-05 23:07 ` Hauke Mehrtens
  2012-06-06 11:43   ` Arend van Spriel
  17 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-05 23:07 UTC (permalink / raw)
  To: linville, arend, brudley; +Cc: linux-wireless, Hauke Mehrtens

Some code in write_{radio,radio}_reg() should just be run if this is a
pci based device. Add the condition again which was removed in commit:
commit 821e4e93172e4f7d5ac1eade04665c3dc5049c4a
Author: Roland Vossen <rvossen@broadcom.com>
Date:   Mon Aug 8 15:58:58 2011 +0200

    staging: brcm80211: removed unused bus code from softmac

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c  |   20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
index 25a17eb..5f1493c 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
@@ -198,6 +198,8 @@ u16 read_radio_reg(struct brcms_phy *pi, u16 addr)
 
 void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
 {
+	struct si_info *sii = container_of(pi->sh->sih, struct si_info, pub);
+
 	if ((D11REV_GE(pi->sh->corerev, 24)) ||
 	    (D11REV_IS(pi->sh->corerev, 22)
 	     && (pi->pubpi.phy_type != PHY_TYPE_SSN))) {
@@ -209,9 +211,11 @@ void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
 		bcma_write16(pi->d11core, D11REGOFFS(phy4wdatalo), val);
 	}
 
-	if (++pi->phy_wreg >= pi->phy_wreg_limit) {
-		(void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol));
-		pi->phy_wreg = 0;
+	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) {
+		if (++pi->phy_wreg >= pi->phy_wreg_limit) {
+			(void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol));
+			pi->phy_wreg = 0;
+		}
 	}
 }
 
@@ -294,10 +298,14 @@ void write_phy_reg(struct brcms_phy *pi, u16 addr, u16 val)
 	if (addr == 0x72)
 		(void)bcma_read16(pi->d11core, D11REGOFFS(phyregdata));
 #else
+	struct si_info *sii = container_of(pi->sh->sih, struct si_info, pub);
+
 	bcma_write32(pi->d11core, D11REGOFFS(phyregaddr), addr | (val << 16));
-	if (++pi->phy_wreg >= pi->phy_wreg_limit) {
-		pi->phy_wreg = 0;
-		(void)bcma_read16(pi->d11core, D11REGOFFS(phyversion));
+	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) {
+		if (++pi->phy_wreg >= pi->phy_wreg_limit) {
+			pi->phy_wreg = 0;
+			(void)bcma_read16(pi->d11core, D11REGOFFS(phyversion));
+		}
 	}
 #endif
 }
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 58+ messages in thread

* Re: [PATCH 03/18] brcmsmac: remove ai_get_buscore{type,rev}()
  2012-06-05 23:07 ` [PATCH 03/18] brcmsmac: remove ai_get_buscore{type,rev}() Hauke Mehrtens
@ 2012-06-06  9:17   ` Arend van Spriel
  2012-06-07 13:48     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06  9:17 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> These two functions are not used any more.

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   15 ---------------
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.h |    4 ----
>  2 files changed, 19 deletions(-)
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 04/18] brcmsmac: use container_of instead of cast
  2012-06-05 23:07 ` [PATCH 04/18] brcmsmac: use container_of instead of cast Hauke Mehrtens
@ 2012-06-06  9:27   ` Arend van Spriel
  2012-06-07 13:45     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06  9:27 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)

Nice. Could add a description that it gets rid of structure layout
requirement, ie. pub must be first field in struct si_info.

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 05/18] brcmsmac: remove ai_findcore()
  2012-06-05 23:07 ` [PATCH 05/18] brcmsmac: remove ai_findcore() Hauke Mehrtens
@ 2012-06-06  9:28   ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06  9:28 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> bcma also stores a pointer to the chipcommon core in its struct,
> brcmsmac should use it and not search for the core by its own.

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   31 ++++-----------------
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.h |    2 --
>  drivers/net/wireless/brcm80211/brcmsmac/pmu.c     |   12 +++++---
>  3 files changed, 14 insertions(+), 31 deletions(-)
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 06/18] brcmsmac: remove si_pmu_init() and si_pmu_res_init()
  2012-06-05 23:07 ` [PATCH 06/18] brcmsmac: remove si_pmu_init() and si_pmu_res_init() Hauke Mehrtens
@ 2012-06-06  9:31   ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06  9:31 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> This is already done by bcma_pmu_init() and bcma_pmu_resources_init() in bcma.

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |    2 -
>  drivers/net/wireless/brcm80211/brcmsmac/pmu.c     |   76 ---------------------
>  drivers/net/wireless/brcm80211/brcmsmac/pmu.h     |    2 -
>  3 files changed, 80 deletions(-)



^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 07/18] brcmsmac: remove si_pmu_spuravoid_pllupdate()
  2012-06-05 23:07 ` [PATCH 07/18] brcmsmac: remove si_pmu_spuravoid_pllupdate() Hauke Mehrtens
@ 2012-06-06  9:33   ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06  9:33 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> si_pmu_spuravoid_pllupdate() is now replaced by
> bcma_pmu_spuravoid_pllupdate() which does the same thing, but supports
> more chips.

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c    |    3 +-
>  drivers/net/wireless/brcm80211/brcmsmac/pmu.c      |   84 --------------------
>  drivers/net/wireless/brcm80211/brcmsmac/pmu.h      |    1 -
>  3 files changed, 2 insertions(+), 86 deletions(-)



^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 09/18] brcmsmac: use core id constants from bcma
  2012-06-05 23:07 ` [PATCH 09/18] brcmsmac: use core id constants from bcma Hauke Mehrtens
@ 2012-06-06  9:43   ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06  9:43 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:

Acked-by: Arend van Spriel
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/dma.c |    4 +-
>  drivers/net/wireless/brcm80211/include/soc.h  |   62 -------------------------
>  2 files changed, 2 insertions(+), 64 deletions(-)


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 10/18] brcmsmac: use chip and package id constants from bcma
  2012-06-05 23:07 ` [PATCH 10/18] brcmsmac: use chip and package " Hauke Mehrtens
@ 2012-06-06  9:44   ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06  9:44 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.h  |   10 ----------
>  drivers/net/wireless/brcm80211/brcmsmac/main.c     |   12 ++++++------
>  .../net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c  |   10 +++++-----
>  .../net/wireless/brcm80211/brcmsmac/phy/phy_n.c    |   20 ++++++++++----------
>  drivers/net/wireless/brcm80211/brcmsmac/pmu.c      |   12 ++++++------
>  5 files changed, 27 insertions(+), 37 deletions(-)



^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 11/18] brcmsmac: remove some unnessessacry casts and void pointer
  2012-06-05 23:07 ` [PATCH 11/18] brcmsmac: remove some unnessessacry casts and void pointer Hauke Mehrtens
@ 2012-06-06  9:46   ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06  9:46 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/main.c |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)



^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 13/18] brcmsmac: add some workarounds for other chips again
  2012-06-05 23:07 ` [PATCH 13/18] brcmsmac: add some workarounds for other chips again Hauke Mehrtens
@ 2012-06-06 10:03   ` Arend van Spriel
  2012-06-07 13:45     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06 10:03 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> This adds some workarounds for the BCM4716, BCM47162, BCM43421, BCM5357
> and BCM6362 to the phy code again. This patch reverts the following

Has brcmsmac been tested for all these chips? At this moment I do not
have any bandwidth to do that. I am not too comfortable adding this code
without having some testing coverage. It was the reason to remove the
snippets from brcmsmac.

> patch expect the part with the workaround for the BCM43236, which is an
> usb chip and will be unsupported by brcmsmac.

'expect' should be 'except'. Indeed, BCM43236 is a fullmac usb chip and
as such supported by brcmfmac.

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 14/18] brcmsmac: extend xmtfifo_sz array
  2012-06-05 23:07 ` [PATCH 14/18] brcmsmac: extend xmtfifo_sz array Hauke Mehrtens
@ 2012-06-06 10:24   ` Arend van Spriel
  2012-06-07 13:33     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06 10:24 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> The xmtfifo_sz array contains the queue sizes for the different chip
> revs. This array missed the sizes for the core rev 17 and 28. This

Should probably use core revs instead of chip revs and I think we are
talking about the 80211 core rev here.

> --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> @@ -268,7 +268,7 @@ struct brcms_c_bit_desc {
>   */
>  
>  /* Starting corerev for the fifo size table */
> -#define XMTFIFOTBL_STARTREV	20
> +#define XMTFIFOTBL_STARTREV	10

Why not start the table at rev 17? I do not expect any lower revs to get
brcmsmac support.

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 15/18] brcmsmac: fix DMA on SoCs
  2012-06-05 23:07 ` [PATCH 15/18] brcmsmac: fix DMA on SoCs Hauke Mehrtens
@ 2012-06-06 11:10   ` Arend van Spriel
  2012-06-07 13:29     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06 11:10 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
> @@ -633,11 +634,14 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
>  	 */
>  	di->ddoffsetlow = 0;
>  	di->dataoffsetlow = 0;
> -	/* add offset for pcie with DMA64 bus */
> -	di->ddoffsetlow = 0;
> -	di->ddoffsethigh = SI_PCIE_DMA_H32;

> -	di->dataoffsetlow = di->ddoffsetlow;
> -	di->dataoffsethigh = di->ddoffsethigh;

The two statements above can move after the if statement below.

> +	/* for pci bus, add offset */
> +	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) {
> +		/* add offset for pcie with DMA64 bus */
> +		di->ddoffsetlow = 0;
> +		di->ddoffsethigh = SI_PCIE_DMA_H32;
> +	}
> +	di->dataoffsetlow = di->ddoffsetlow;
> +	di->dataoffsethigh = di->ddoffsethigh;
> +
>  	/* WAR64450 : DMACtl.Addr ext fields are not supported in SDIOD core. */
>  	if ((core->id.id == BCMA_CORE_SDIO_DEV)
>  	    && ((rev > 0) && (rev <= 2)))



^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI
  2012-06-05 23:07 ` [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI Hauke Mehrtens
@ 2012-06-06 11:23   ` Arend van Spriel
  2012-06-07 13:19     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06 11:23 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> brcms_c_chipmatch() just works for PCIe devices and returns false for
> non PCIe devices. This stops brcms_ops_stop() from calling it when the
> devices is not a PCIe device.

Although this is true you may want to consider what this function
provides. The intent is to have a more accurate filter to determine
support the device by the driver, ie. more accurate than what is in the
driver device table.

So in brcms_c_chipmatch() we may want a host-type independent filtering
and validate bcma_device_id, bcma_chipinfo, and possibly bcma_boardinfo.

> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |   22 +++++++++++++-------
>  1 file changed, 14 insertions(+), 8 deletions(-)


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 17/18] brcmsmac: fix read in write_phy_reg
  2012-06-05 23:07 ` [PATCH 17/18] brcmsmac: fix read in write_phy_reg Hauke Mehrtens
@ 2012-06-06 11:39   ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06 11:39 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> This reverts a unintended change mad in commit.
> commit 4b006b11ca18995677c5f1cd03cc9c42fbe80693
> Author: Arend van Spriel <arend@broadcom.com>
> Date:   Thu Dec 8 15:06:54 2011 -0800
> 
>     brcm80211: smac: use bcma functions for register access in phy code

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 18/18] brcmsmac: handle non PCI devices in the phy code
  2012-06-05 23:07 ` [PATCH 18/18] brcmsmac: handle non PCI devices in the phy code Hauke Mehrtens
@ 2012-06-06 11:43   ` Arend van Spriel
  2012-06-07 13:00     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06 11:43 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
> @@ -209,9 +211,11 @@ void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
>  		bcma_write16(pi->d11core, D11REGOFFS(phy4wdatalo), val);
>  	}
>  
> -	if (++pi->phy_wreg >= pi->phy_wreg_limit) {
> -		(void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol));
> -		pi->phy_wreg = 0;
> +	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) {
> +		if (++pi->phy_wreg >= pi->phy_wreg_limit) {
> +			(void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol));
> +			pi->phy_wreg = 0;
> +		}
>  	}

You can loose the outer curly braces or combine into one if statement.
Same for the other code fragment in this patch.

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 08/18] brcmsmac: remove some redundant chip common workarounds
  2012-06-05 23:07 ` [PATCH 08/18] brcmsmac: remove some redundant chip common workarounds Hauke Mehrtens
@ 2012-06-06 12:14   ` Arend van Spriel
  2012-06-07 12:59     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-06 12:14 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> The removed workarounds are already performed in bcma_pmu_workarounds()
> and bcma_core_chipcommon_init()

Could refer to "bcma: complete workaround for BCMA43224 and BCM4313"
which it seems to depend on.

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   42 ---------------------
>  1 file changed, 42 deletions(-)


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 08/18] brcmsmac: remove some redundant chip common workarounds
  2012-06-06 12:14   ` Arend van Spriel
@ 2012-06-07 12:59     ` Hauke Mehrtens
  0 siblings, 0 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-07 12:59 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/06/2012 02:14 PM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>> The removed workarounds are already performed in bcma_pmu_workarounds()
>> and bcma_core_chipcommon_init()
> 
> Could refer to "bcma: complete workaround for BCMA43224 and BCM4313"
> which it seems to depend on.
Yes will do that in a v2.
> 
> Acked-by: Arend van Spriel <arend@broadcom.com>
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   42 ---------------------
>>  1 file changed, 42 deletions(-)
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 18/18] brcmsmac: handle non PCI devices in the phy code
  2012-06-06 11:43   ` Arend van Spriel
@ 2012-06-07 13:00     ` Hauke Mehrtens
  0 siblings, 0 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-07 13:00 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:43 PM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>> --- a/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
>> +++ b/drivers/net/wireless/brcm80211/brcmsmac/phy/phy_cmn.c
>> @@ -209,9 +211,11 @@ void write_radio_reg(struct brcms_phy *pi, u16 addr, u16 val)
>>  		bcma_write16(pi->d11core, D11REGOFFS(phy4wdatalo), val);
>>  	}
>>  
>> -	if (++pi->phy_wreg >= pi->phy_wreg_limit) {
>> -		(void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol));
>> -		pi->phy_wreg = 0;
>> +	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) {
>> +		if (++pi->phy_wreg >= pi->phy_wreg_limit) {
>> +			(void)bcma_read32(pi->d11core, D11REGOFFS(maccontrol));
>> +			pi->phy_wreg = 0;
>> +		}
>>  	}
> 
> You can loose the outer curly braces or combine into one if statement.
> Same for the other code fragment in this patch.
Combining them sounds good.
> 
> Gr. AvS
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI
  2012-06-06 11:23   ` Arend van Spriel
@ 2012-06-07 13:19     ` Hauke Mehrtens
  2012-06-07 19:06       ` Arend van Spriel
  0 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-07 13:19 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

Hi Arend,

On 06/06/2012 01:23 PM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>> brcms_c_chipmatch() just works for PCIe devices and returns false for
>> non PCIe devices. This stops brcms_ops_stop() from calling it when the
>> devices is not a PCIe device.
> 
> Although this is true you may want to consider what this function
> provides. The intent is to have a more accurate filter to determine
> support the device by the driver, ie. more accurate than what is in the
> driver device table.
> 
> So in brcms_c_chipmatch() we may want a host-type independent filtering
> and validate bcma_device_id, bcma_chipinfo, and possibly bcma_boardinfo.
I do not like this function at all. ;-)

Are these restrictions in this function really needed? I would more like
to restrict it to something like core revs, which is done in the device
table and the phy types and versions. A restriction by chipid would also
be reasonable as some chips are needing some special workarounds, these
checks could also be done for SoCs.

In my opinion this functions results in preventing users from running
this driver with some device which is working with this driver but which
is not in this list of supported devices, because some board vendor just
changed some id and no developer got such a card to test it and change
the detection code.
It is like with the PCIe card I found connected to my BCM4718, this card
is working expect for some problems with the PCIe host controller on the
BCM4716, but brcms_c_chipmatch() returned false for it.

By the way, why is a call to this function in brcms_ops_stop() in
addition to the call in the init code? In this case the device was
already started.

>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  .../net/wireless/brcm80211/brcmsmac/mac80211_if.c  |   22 +++++++++++++-------
>>  1 file changed, 14 insertions(+), 8 deletions(-)
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 15/18] brcmsmac: fix DMA on SoCs
  2012-06-06 11:10   ` Arend van Spriel
@ 2012-06-07 13:29     ` Hauke Mehrtens
  0 siblings, 0 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-07 13:29 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:10 PM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>> --- a/drivers/net/wireless/brcm80211/brcmsmac/dma.c
>> +++ b/drivers/net/wireless/brcm80211/brcmsmac/dma.c
>> @@ -633,11 +634,14 @@ struct dma_pub *dma_attach(char *name, struct si_pub *sih,
>>  	 */
>>  	di->ddoffsetlow = 0;
>>  	di->dataoffsetlow = 0;
>> -	/* add offset for pcie with DMA64 bus */
>> -	di->ddoffsetlow = 0;
>> -	di->ddoffsethigh = SI_PCIE_DMA_H32;
> 
>> -	di->dataoffsetlow = di->ddoffsetlow;
>> -	di->dataoffsethigh = di->ddoffsethigh;
> 
> The two statements above can move after the if statement below.
I will change that.
> 
>> +	/* for pci bus, add offset */
>> +	if (sii->icbus->hosttype == BCMA_HOSTTYPE_PCI) {
>> +		/* add offset for pcie with DMA64 bus */
>> +		di->ddoffsetlow = 0;
>> +		di->ddoffsethigh = SI_PCIE_DMA_H32;
>> +	}
>> +	di->dataoffsetlow = di->ddoffsetlow;
>> +	di->dataoffsethigh = di->ddoffsethigh;
>> +
>>  	/* WAR64450 : DMACtl.Addr ext fields are not supported in SDIOD core. */
>>  	if ((core->id.id == BCMA_CORE_SDIO_DEV)
>>  	    && ((rev > 0) && (rev <= 2)))
> 
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 14/18] brcmsmac: extend xmtfifo_sz array
  2012-06-06 10:24   ` Arend van Spriel
@ 2012-06-07 13:33     ` Hauke Mehrtens
  2012-06-07 19:21       ` Arend van Spriel
  0 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-07 13:33 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/06/2012 12:24 PM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>> The xmtfifo_sz array contains the queue sizes for the different chip
>> revs. This array missed the sizes for the core rev 17 and 28. This
> 
> Should probably use core revs instead of chip revs and I think we are
> talking about the 80211 core rev here.
Yes I will change this comment.

Are there any devices with the same phy type using different fifo sizes?
If this is not the case I think it is better to do this based on the phy
type.
> 
>> --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
>> +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
>> @@ -268,7 +268,7 @@ struct brcms_c_bit_desc {
>>   */
>>  
>>  /* Starting corerev for the fifo size table */
>> -#define XMTFIFOTBL_STARTREV	20
>> +#define XMTFIFOTBL_STARTREV	10
> 
> Why not start the table at rev 17? I do not expect any lower revs to get
> brcmsmac support.
The 10 is a random number <=17. ;-)
I will change this to 17 then, makes sense.
> 
> Gr. AvS
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 13/18] brcmsmac: add some workarounds for other chips again
  2012-06-06 10:03   ` Arend van Spriel
@ 2012-06-07 13:45     ` Hauke Mehrtens
  2012-06-07 19:34       ` Arend van Spriel
  0 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-07 13:45 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/06/2012 12:03 PM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>> This adds some workarounds for the BCM4716, BCM47162, BCM43421, BCM5357
>> and BCM6362 to the phy code again. This patch reverts the following
> 
> Has brcmsmac been tested for all these chips? At this moment I do not
> have any bandwidth to do that. I am not too comfortable adding this code
> without having some testing coverage. It was the reason to remove the
> snippets from brcmsmac.
I have just tested BCM4716 and BCM5357, BCM5357 is not working. ;-)
I do not have all the devices to test this and for the BCM6362 some
infrastructure code is still missing.
The adding of the BCM5357 is part of my start adding support for that
chip, which is not complete. As the device detection code in brcmsmac
is not changed in this commit, no more devices are detected by brcmsmac
now. I talked to Jonas Gorski about the BCM6362 and he thinks about
adding support for that device to the Linux kernel in some time.

I could reduce the code into adding support for the BCM4716 and BCM5357
if that is fine with you and if someone else wants to add support for
some other chip in the future he has to add the code again.

> 
>> patch expect the part with the workaround for the BCM43236, which is an
>> usb chip and will be unsupported by brcmsmac.
> 
> 'expect' should be 'except'. Indeed, BCM43236 is a fullmac usb chip and
> as such supported by brcmfmac.
Yes that's the reason I removed it here because this will never be
supported by this code.
> 
> Gr. AvS
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 04/18] brcmsmac: use container_of instead of cast
  2012-06-06  9:27   ` Arend van Spriel
@ 2012-06-07 13:45     ` Hauke Mehrtens
  0 siblings, 0 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-07 13:45 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/06/2012 11:27 AM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> 
> Acked-by: Arend van Spriel <arend@broadcom.com>
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> Nice. Could add a description that it gets rid of structure layout
> requirement, ie. pub must be first field in struct si_info.
Yes will do so, I hope I found all casts.
> 
> Gr. AvS
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 03/18] brcmsmac: remove ai_get_buscore{type,rev}()
  2012-06-06  9:17   ` Arend van Spriel
@ 2012-06-07 13:48     ` Hauke Mehrtens
  2012-06-07 19:36       ` Arend van Spriel
  0 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-07 13:48 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/06/2012 11:17 AM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>> These two functions are not used any more.
> 
> Acked-by: Arend van Spriel <arend@broadcom.com>
This patch depends on the two patches before this in the patch series,
without them this patch will not apply. Is your Acked-by also for these
patches?
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   15 ---------------
>>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.h |    4 ----
>>  2 files changed, 19 deletions(-)
>>
> 

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI
  2012-06-07 13:19     ` Hauke Mehrtens
@ 2012-06-07 19:06       ` Arend van Spriel
  2012-06-10 13:03         ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-07 19:06 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/07/2012 03:19 PM, Hauke Mehrtens wrote:
> Hi Arend,
> 
> On 06/06/2012 01:23 PM, Arend van Spriel wrote:
>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>> brcms_c_chipmatch() just works for PCIe devices and returns false for
>>> non PCIe devices. This stops brcms_ops_stop() from calling it when the
>>> devices is not a PCIe device.
>>
>> Although this is true you may want to consider what this function
>> provides. The intent is to have a more accurate filter to determine
>> support the device by the driver, ie. more accurate than what is in the
>> driver device table.
>>
>> So in brcms_c_chipmatch() we may want a host-type independent filtering
>> and validate bcma_device_id, bcma_chipinfo, and possibly bcma_boardinfo.
> I do not like this function at all. ;-)
> 
> Are these restrictions in this function really needed? I would more like
> to restrict it to something like core revs, which is done in the device
> table and the phy types and versions. A restriction by chipid would also
> be reasonable as some chips are needing some special workarounds, these
> checks could also be done for SoCs.

I look where the function came from and it is called in several places
in our proprietary driver, which has a pretty coarse filter in the
device table.

The BCMA device table in brcmsmac is more finegrained and currently has
entries for the different 80211 core revisions. However, the brcmsmac
may have additional revision requirement for chipcommon and other cores
inside the chip so this function may have it merits for checking that.

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 14/18] brcmsmac: extend xmtfifo_sz array
  2012-06-07 13:33     ` Hauke Mehrtens
@ 2012-06-07 19:21       ` Arend van Spriel
  2012-06-10 13:10         ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-07 19:21 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/07/2012 03:33 PM, Hauke Mehrtens wrote:
> On 06/06/2012 12:24 PM, Arend van Spriel wrote:
>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>> The xmtfifo_sz array contains the queue sizes for the different chip
>>> revs. This array missed the sizes for the core rev 17 and 28. This
>>
>> Should probably use core revs instead of chip revs and I think we are
>> talking about the 80211 core rev here.
> Yes I will change this comment.
> 
> Are there any devices with the same phy type using different fifo sizes?
> If this is not the case I think it is better to do this based on the phy
> type.

I dived into this and basically there is no correlation to the phy type.
There are chips with same 80211 core rev and different phy type as there
are chips with different 80211 core rev and the same phy type.

Gr. AvS



^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 13/18] brcmsmac: add some workarounds for other chips again
  2012-06-07 13:45     ` Hauke Mehrtens
@ 2012-06-07 19:34       ` Arend van Spriel
  2012-06-08 11:31         ` Jonas Gorski
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-07 19:34 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/07/2012 03:45 PM, Hauke Mehrtens wrote:
> On 06/06/2012 12:03 PM, Arend van Spriel wrote:
>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>> This adds some workarounds for the BCM4716, BCM47162, BCM43421, BCM5357
>>> and BCM6362 to the phy code again. This patch reverts the following
>>
>> Has brcmsmac been tested for all these chips? At this moment I do not
>> have any bandwidth to do that. I am not too comfortable adding this code
>> without having some testing coverage. It was the reason to remove the
>> snippets from brcmsmac.
> I have just tested BCM4716 and BCM5357, BCM5357 is not working. ;-)
> I do not have all the devices to test this and for the BCM6362 some
> infrastructure code is still missing.
> The adding of the BCM5357 is part of my start adding support for that
> chip, which is not complete. As the device detection code in brcmsmac
> is not changed in this commit, no more devices are detected by brcmsmac
> now. I talked to Jonas Gorski about the BCM6362 and he thinks about
> adding support for that device to the Linux kernel in some time.

Yes. Jonas tested brcmsmac on bcm6362 host during our mainlining days.

> I could reduce the code into adding support for the BCM4716 and BCM5357
> if that is fine with you and if someone else wants to add support for
> some other chip in the future he has to add the code again.

I prefer that over adding the code untested even if it is not yet active
code so please do.

>>
>>> patch expect the part with the workaround for the BCM43236, which is an
>>> usb chip and will be unsupported by brcmsmac.
>>
>> 'expect' should be 'except'. Indeed, BCM43236 is a fullmac usb chip and
>> as such supported by brcmfmac.
> Yes that's the reason I removed it here because this will never be
> supported by this code.

Agree.

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 03/18] brcmsmac: remove ai_get_buscore{type,rev}()
  2012-06-07 13:48     ` Hauke Mehrtens
@ 2012-06-07 19:36       ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-07 19:36 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/07/2012 03:48 PM, Hauke Mehrtens wrote:
> On 06/06/2012 11:17 AM, Arend van Spriel wrote:
>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>> These two functions are not used any more.
>>
>> Acked-by: Arend van Spriel <arend@broadcom.com>
> This patch depends on the two patches before this in the patch series,
> without them this patch will not apply. Is your Acked-by also for these
> patches?

I was looking a bit more carefully to the first two so let me get to
that. Thanks for reminding me ;-)

Gr. AvS



^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 01/18] brcmsmac: remove PCIE() makro
  2012-06-05 23:07 ` [PATCH 01/18] brcmsmac: remove PCIE() makro Hauke Mehrtens
@ 2012-06-07 20:05   ` Arend van Spriel
  2012-06-10 13:28     ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-07 20:05 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> Instead of checking if there is a PCIe core on the bus, better check if
> hosttype is PCIe.

I was under the impression that the macro was used for code needed when
the chip has a PCIe core instead of a PCI core. Maybe BCMA only supports
chips with PCIe core and in the respect checking the hosttype is
essentially the same, but I would not necessarily call it better.

> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 02/18] brcmsmac: remove PCI_FORCEHT() makro
  2012-06-05 23:07 ` [PATCH 02/18] brcmsmac: remove PCI_FORCEHT() makro Hauke Mehrtens
@ 2012-06-07 20:12   ` Arend van Spriel
  0 siblings, 0 replies; 58+ messages in thread
From: Arend van Spriel @ 2012-06-07 20:12 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
> The BCM4716 is a SoC and does not have a PCI client interface, so this
> condition is never true.

This patch and the first one in the series use the word 'makro' instead
of 'macro'. Probably your native language seeping through ;-)

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |   19 -------------------
>  1 file changed, 19 deletions(-)

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 13/18] brcmsmac: add some workarounds for other chips again
  2012-06-07 19:34       ` Arend van Spriel
@ 2012-06-08 11:31         ` Jonas Gorski
  2012-06-08 16:54           ` Arend van Spriel
  0 siblings, 1 reply; 58+ messages in thread
From: Jonas Gorski @ 2012-06-08 11:31 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: Hauke Mehrtens, linville, brudley, linux-wireless

On 7 June 2012 21:34, Arend van Spriel <arend@broadcom.com> wrote:
> On 06/07/2012 03:45 PM, Hauke Mehrtens wrote:
>> On 06/06/2012 12:03 PM, Arend van Spriel wrote:
>>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>>> This adds some workarounds for the BCM4716, BCM47162, BCM43421, BCM5357
>>>> and BCM6362 to the phy code again. This patch reverts the following
>>>
>>> Has brcmsmac been tested for all these chips? At this moment I do not
>>> have any bandwidth to do that. I am not too comfortable adding this code
>>> without having some testing coverage. It was the reason to remove the
>>> snippets from brcmsmac.
>> I have just tested BCM4716 and BCM5357, BCM5357 is not working. ;-)
>> I do not have all the devices to test this and for the BCM6362 some
>> infrastructure code is still missing.
>> The adding of the BCM5357 is part of my start adding support for that
>> chip, which is not complete. As the device detection code in brcmsmac
>> is not changed in this commit, no more devices are detected by brcmsmac
>> now. I talked to Jonas Gorski about the BCM6362 and he thinks about
>> adding support for that device to the Linux kernel in some time.
>
> Yes. Jonas tested brcmsmac on bcm6362 host during our mainlining days.

Wait, no, I didn't. It was bcm6328 with an external pcie connected
bcm4313, so not really anything special there.

BCM6362 (and BCM63168) is a totally different beast; its wifi is
integrated into the SoC connected through its internal UBUS. It has an
hardwired erom which is almost parsable through the bcma erom parsing
routines, but it lacks the AMBA extended registers present in real
bcma devices, and all cores are controlled through the wlan shim core.
Also it is completely big endian (as bcm63xx is big endian).

I hacked bcma to properly parse the erom and translate the amba
register accesses to the appropriate wlan shim registers (which was
rather easy, since the register layout is very similar, and there are
only three amba registers actually used), which made bcma successfully
detect three cores (chipcommon, ieee80211 and wlan shim). I "tested"
it with b43, but it supports neither the core rev nor the radio (iirc
0x2057). I did not try brcmsmac, since it didn't even use bcma at that
time. It probably needs some more special handling, as there is an OTP
core present, and my gut feeling says the wifi driver needs/uses it,
but since I don't have sources for the proprietary driver I can't
really check this ;).

TL;DR: BCM6362 isn't real bcma, so it's unlikely the bcma code will
ever see it (unless the translation hacks get accepted ;). Feel free
to drop any BCM6362 handling here.

@Arend: Which probably also means that brcm{s,f]mac will likely never
support it, right? :-/


Jonas

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 13/18] brcmsmac: add some workarounds for other chips again
  2012-06-08 11:31         ` Jonas Gorski
@ 2012-06-08 16:54           ` Arend van Spriel
  2012-06-08 17:49             ` Jonas Gorski
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-08 16:54 UTC (permalink / raw)
  To: Jonas Gorski; +Cc: Hauke Mehrtens, linville, brudley, linux-wireless

On 06/08/2012 01:31 PM, Jonas Gorski wrote:
> On 7 June 2012 21:34, Arend van Spriel <arend@broadcom.com> wrote:
>> On 06/07/2012 03:45 PM, Hauke Mehrtens wrote:
>>> On 06/06/2012 12:03 PM, Arend van Spriel wrote:
>>>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>>>> This adds some workarounds for the BCM4716, BCM47162, BCM43421, BCM5357
>>>>> and BCM6362 to the phy code again. This patch reverts the following
>>>>
>>>> Has brcmsmac been tested for all these chips? At this moment I do not
>>>> have any bandwidth to do that. I am not too comfortable adding this code
>>>> without having some testing coverage. It was the reason to remove the
>>>> snippets from brcmsmac.
>>> I have just tested BCM4716 and BCM5357, BCM5357 is not working. ;-)
>>> I do not have all the devices to test this and for the BCM6362 some
>>> infrastructure code is still missing.
>>> The adding of the BCM5357 is part of my start adding support for that
>>> chip, which is not complete. As the device detection code in brcmsmac
>>> is not changed in this commit, no more devices are detected by brcmsmac
>>> now. I talked to Jonas Gorski about the BCM6362 and he thinks about
>>> adding support for that device to the Linux kernel in some time.
>>
>> Yes. Jonas tested brcmsmac on bcm6362 host during our mainlining days.
> 
> Wait, no, I didn't. It was bcm6328 with an external pcie connected
> bcm4313, so not really anything special there.

Yes. I know it was with external card connected through PCIe. Did not
recall exactly which BCM63xx you used for big-endian mips test.

> 0x2057). I did not try brcmsmac, since it didn't even use bcma at that
> time. It probably needs some more special handling, as there is an OTP
> core present, and my gut feeling says the wifi driver needs/uses it,
> but since I don't have sources for the proprietary driver I can't
> really check this ;).

brcmsmac had OTP code, but I added OTP processing to BCMA. It is daily
tested on powerpc64 so that should work.

> TL;DR: BCM6362 isn't real bcma, so it's unlikely the bcma code will
> ever see it (unless the translation hacks get accepted ;). Feel free
> to drop any BCM6362 handling here.
> 
> @Arend: Which probably also means that brcm{s,f]mac will likely never
> support it, right? :-/

What silicon backplane does it have? Sonics? I tried to look it up, but
did not find the info.

Do you know the chip revision of your bcm6362?

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 13/18] brcmsmac: add some workarounds for other chips again
  2012-06-08 16:54           ` Arend van Spriel
@ 2012-06-08 17:49             ` Jonas Gorski
  0 siblings, 0 replies; 58+ messages in thread
From: Jonas Gorski @ 2012-06-08 17:49 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: Hauke Mehrtens, linville, brudley, linux-wireless

On 8 June 2012 18:54, Arend van Spriel <arend@broadcom.com> wrote:
> On 06/08/2012 01:31 PM, Jonas Gorski wrote:
>> 0x2057). I did not try brcmsmac, since it didn't even use bcma at that
>> time. It probably needs some more special handling, as there is an OTP
>> core present, and my gut feeling says the wifi driver needs/uses it,
>> but since I don't have sources for the proprietary driver I can't
>> really check this ;).
>
> brcmsmac had OTP code, but I added OTP processing to BCMA. It is daily
> tested on powerpc64 so that should work.

Maybe it isn't needed by the wifi, though it has a bit that says
whether wifi is available. The wifi driver itself seems to include an
sprom for bcm6362 though, so it's likely a red herring.

>> TL;DR: BCM6362 isn't real bcma, so it's unlikely the bcma code will
>> ever see it (unless the translation hacks get accepted ;). Feel free
>> to drop any BCM6362 handling here.
>>
>> @Arend: Which probably also means that brcm{s,f]mac will likely never
>> support it, right? :-/
>
> What silicon backplane does it have? Sonics? I tried to look it up, but
> did not find the info.

It's neither bcma nor ssb, but ubus, the bcm63xx silicon backplane.
You should find the appropriate ub_scan, ub_flag, etc functions in the
proprietary driver as the third backplane type supported by it. The
public parts only have them as empty functions, but still reference
them.

> Do you know the chip revision of your bcm6362?

IIRC b0 (haven't booted it in the last few weeks, currently busy with
bcm6328 stuff - one chip at a time ;). Since recent bcm63xx LDKs
removed the a0 register layouts it looks like the a0 revision never
actually made it into a product.


Jonas

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI
  2012-06-07 19:06       ` Arend van Spriel
@ 2012-06-10 13:03         ` Hauke Mehrtens
  0 siblings, 0 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-10 13:03 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/07/2012 09:06 PM, Arend van Spriel wrote:
> On 06/07/2012 03:19 PM, Hauke Mehrtens wrote:
>> Hi Arend,
>>
>> On 06/06/2012 01:23 PM, Arend van Spriel wrote:
>>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>>> brcms_c_chipmatch() just works for PCIe devices and returns false for
>>>> non PCIe devices. This stops brcms_ops_stop() from calling it when the
>>>> devices is not a PCIe device.
>>>
>>> Although this is true you may want to consider what this function
>>> provides. The intent is to have a more accurate filter to determine
>>> support the device by the driver, ie. more accurate than what is in the
>>> driver device table.
>>>
>>> So in brcms_c_chipmatch() we may want a host-type independent filtering
>>> and validate bcma_device_id, bcma_chipinfo, and possibly bcma_boardinfo.
>> I do not like this function at all. ;-)
>>
>> Are these restrictions in this function really needed? I would more like
>> to restrict it to something like core revs, which is done in the device
>> table and the phy types and versions. A restriction by chipid would also
>> be reasonable as some chips are needing some special workarounds, these
>> checks could also be done for SoCs.
> 
> I look where the function came from and it is called in several places
> in our proprietary driver, which has a pretty coarse filter in the
> device table.
> 
> The BCMA device table in brcmsmac is more finegrained and currently has
> entries for the different 80211 core revisions. However, the brcmsmac
> may have additional revision requirement for chipcommon and other cores
> inside the chip so this function may have it merits for checking that.
> 
> Gr. AvS
> 
Hi Arend,

ok, then I will extend it somehow to also handle the SoCs based on the
chip id and rev in that function.

Hauke

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 14/18] brcmsmac: extend xmtfifo_sz array
  2012-06-07 19:21       ` Arend van Spriel
@ 2012-06-10 13:10         ` Hauke Mehrtens
  2012-06-11  7:59           ` Arend van Spriel
  0 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-10 13:10 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/07/2012 09:21 PM, Arend van Spriel wrote:
> On 06/07/2012 03:33 PM, Hauke Mehrtens wrote:
>> On 06/06/2012 12:24 PM, Arend van Spriel wrote:
>>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>>> The xmtfifo_sz array contains the queue sizes for the different chip
>>>> revs. This array missed the sizes for the core rev 17 and 28. This
>>>
>>> Should probably use core revs instead of chip revs and I think we are
>>> talking about the 80211 core rev here.
>> Yes I will change this comment.
>>
>> Are there any devices with the same phy type using different fifo sizes?
>> If this is not the case I think it is better to do this based on the phy
>> type.
> 
> I dived into this and basically there is no correlation to the phy type.
> There are chips with same 80211 core rev and different phy type as there
> are chips with different 80211 core rev and the same phy type.
> 
> Gr. AvS

Hi Arend,

Ok, then I will leave it based on the core rev like it is now. Are the
values I added there for core rev 17 and 28 correct? They are just
copied from the other phy-n device which has the same values set after
powering up and before they are explicitly set. The core rev 17 device
is working for me, but the core rev 28 is not, but I do not know why. I
was unable to find these values in b43 or the spec b43 is based on.

Hauke

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 01/18] brcmsmac: remove PCIE() makro
  2012-06-07 20:05   ` Arend van Spriel
@ 2012-06-10 13:28     ` Hauke Mehrtens
  2012-06-11  7:51       ` Arend van Spriel
  0 siblings, 1 reply; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-10 13:28 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/07/2012 10:05 PM, Arend van Spriel wrote:
> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>> Instead of checking if there is a PCIe core on the bus, better check if
>> hosttype is PCIe.
> 
> I was under the impression that the macro was used for code needed when
> the chip has a PCIe core instead of a PCI core. Maybe BCMA only supports
> chips with PCIe core and in the respect checking the hosttype is
> essentially the same, but I would not necessarily call it better.
> 

The code from the initial submission to staging looked like this:

#define PCIE(si) ((BUSTYPE((si)->pub.bustype) == PCI_BUS) &&	\
		  ((si)->pub.buscoretype == PCIE_CORE_ID))

I have never seen a device using the AI bus (bcma) and a PCI core and
not a PCIe core and I do not think bcma will work with a PCI device or
core. The bustype in your old code is the same as the hosttype in bcma,
so under the assumption that all device are using PCIe that are coming
to this code the code now does the same as in the initial submission to
staging.

buscore in brcmsmac contained a reference to a PCIe core on the bus, if
there was any. On a SoC with a PCIe core in host mode this also
contained this PCIe core, but it was not the buscore and the hosttype
was not PCIE, nor the bustype when using your SDK would be PCI_BUS, but
SI_BUS.

So this patch is also more or less a bugfix for brcmsmac when you are
not on a PCIe connected device, like a SoC. The old code also caused a
null pointer in ai_get_buscoretype() and ai_get_buscorerev() if buscore
was not set because there was no PCIe core on the bus.

>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> ---
>>  drivers/net/wireless/brcm80211/brcmsmac/aiutils.c |    9 ++++-----
>>  1 file changed, 4 insertions(+), 5 deletions(-)
>>
> 
> Gr. AvS
> 


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 01/18] brcmsmac: remove PCIE() makro
  2012-06-10 13:28     ` Hauke Mehrtens
@ 2012-06-11  7:51       ` Arend van Spriel
  2012-06-11 21:36         ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-11  7:51 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/10/2012 03:28 PM, Hauke Mehrtens wrote:
> On 06/07/2012 10:05 PM, Arend van Spriel wrote:
>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>> Instead of checking if there is a PCIe core on the bus, better check if
>>> hosttype is PCIe.
>>
>> I was under the impression that the macro was used for code needed when
>> the chip has a PCIe core instead of a PCI core. Maybe BCMA only supports
>> chips with PCIe core and in the respect checking the hosttype is
>> essentially the same, but I would not necessarily call it better.
>>
> 
> The code from the initial submission to staging looked like this:
> 
> #define PCIE(si) ((BUSTYPE((si)->pub.bustype) == PCI_BUS) &&	\
> 		  ((si)->pub.buscoretype == PCIE_CORE_ID))
> 
> I have never seen a device using the AI bus (bcma) and a PCI core and
> not a PCIe core and I do not think bcma will work with a PCI device or
> core. The bustype in your old code is the same as the hosttype in bcma,
> so under the assumption that all device are using PCIe that are coming
> to this code the code now does the same as in the initial submission to
> staging.

If bcma does not work with a PCI core, maybe we could/should add a
WARN_ON() in host_pci.c when it has no PCIe core.

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 14/18] brcmsmac: extend xmtfifo_sz array
  2012-06-10 13:10         ` Hauke Mehrtens
@ 2012-06-11  7:59           ` Arend van Spriel
  2012-06-11 21:44             ` Hauke Mehrtens
  0 siblings, 1 reply; 58+ messages in thread
From: Arend van Spriel @ 2012-06-11  7:59 UTC (permalink / raw)
  To: Hauke Mehrtens; +Cc: linville, brudley, linux-wireless

On 06/10/2012 03:10 PM, Hauke Mehrtens wrote:
> On 06/07/2012 09:21 PM, Arend van Spriel wrote:
>> I dived into this and basically there is no correlation to the phy type.
>> There are chips with same 80211 core rev and different phy type as there
>> are chips with different 80211 core rev and the same phy type.
>>
>> Gr. AvS
> 
> Hi Arend,
> 
> Ok, then I will leave it based on the core rev like it is now. Are the
> values I added there for core rev 17 and 28 correct? They are just
> copied from the other phy-n device which has the same values set after
> powering up and before they are explicitly set. The core rev 17 device
> is working for me, but the core rev 28 is not, but I do not know why. I
> was unable to find these values in b43 or the spec b43 is based on.
> 
> Hauke
> 

Dug up the values and for corerev 17 they are fine, but corerev 28 has
different values:

{ 9, 58, 22, 14, 14, 5 },       /* corerev 28 */

Gr. AvS


^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 01/18] brcmsmac: remove PCIE() makro
  2012-06-11  7:51       ` Arend van Spriel
@ 2012-06-11 21:36         ` Hauke Mehrtens
  0 siblings, 0 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-11 21:36 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/11/2012 09:51 AM, Arend van Spriel wrote:
> On 06/10/2012 03:28 PM, Hauke Mehrtens wrote:
>> On 06/07/2012 10:05 PM, Arend van Spriel wrote:
>>> On 06/06/2012 01:07 AM, Hauke Mehrtens wrote:
>>>> Instead of checking if there is a PCIe core on the bus, better check if
>>>> hosttype is PCIe.
>>>
>>> I was under the impression that the macro was used for code needed when
>>> the chip has a PCIe core instead of a PCI core. Maybe BCMA only supports
>>> chips with PCIe core and in the respect checking the hosttype is
>>> essentially the same, but I would not necessarily call it better.
>>>
>>
>> The code from the initial submission to staging looked like this:
>>
>> #define PCIE(si) ((BUSTYPE((si)->pub.bustype) == PCI_BUS) &&	\
>> 		  ((si)->pub.buscoretype == PCIE_CORE_ID))
>>
>> I have never seen a device using the AI bus (bcma) and a PCI core and
>> not a PCIe core and I do not think bcma will work with a PCI device or
>> core. The bustype in your old code is the same as the hosttype in bcma,
>> so under the assumption that all device are using PCIe that are coming
>> to this code the code now does the same as in the initial submission to
>> staging.
> 
> If bcma does not work with a PCI core, maybe we could/should add a
> WARN_ON() in host_pci.c when it has no PCIe core.
> 
> Gr. AvS
> 
That sounds good, for now bcma displays this warning if it detects a PCI
and not a PCIe card: "PCI card detected, report problems." adding a
warning looks better to me. bcma_core_pci_init() is just run for PCIE
cores and not for PCI cores, so I do not think PCI cores will work with
the current code.

Hauke

^ permalink raw reply	[flat|nested] 58+ messages in thread

* Re: [PATCH 14/18] brcmsmac: extend xmtfifo_sz array
  2012-06-11  7:59           ` Arend van Spriel
@ 2012-06-11 21:44             ` Hauke Mehrtens
  0 siblings, 0 replies; 58+ messages in thread
From: Hauke Mehrtens @ 2012-06-11 21:44 UTC (permalink / raw)
  To: Arend van Spriel; +Cc: linville, brudley, linux-wireless

On 06/11/2012 09:59 AM, Arend van Spriel wrote:
> On 06/10/2012 03:10 PM, Hauke Mehrtens wrote:
>> On 06/07/2012 09:21 PM, Arend van Spriel wrote:
>>> I dived into this and basically there is no correlation to the phy type.
>>> There are chips with same 80211 core rev and different phy type as there
>>> are chips with different 80211 core rev and the same phy type.
>>>
>>> Gr. AvS
>>
>> Hi Arend,
>>
>> Ok, then I will leave it based on the core rev like it is now. Are the
>> values I added there for core rev 17 and 28 correct? They are just
>> copied from the other phy-n device which has the same values set after
>> powering up and before they are explicitly set. The core rev 17 device
>> is working for me, but the core rev 28 is not, but I do not know why. I
>> was unable to find these values in b43 or the spec b43 is based on.
>>
>> Hauke
>>
> 
> Dug up the values and for corerev 17 they are fine, but corerev 28 has
> different values:
> 
> { 9, 58, 22, 14, 14, 5 },       /* corerev 28 */
> 
> Gr. AvS
> 
Thanks for the values, I will change them.

Hauke

^ permalink raw reply	[flat|nested] 58+ messages in thread

end of thread, other threads:[~2012-06-11 21:44 UTC | newest]

Thread overview: 58+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-05 23:07 [PATCH 00/18] brcmsmac: update to get SoCs working Hauke Mehrtens
2012-06-05 23:07 ` [PATCH 01/18] brcmsmac: remove PCIE() makro Hauke Mehrtens
2012-06-07 20:05   ` Arend van Spriel
2012-06-10 13:28     ` Hauke Mehrtens
2012-06-11  7:51       ` Arend van Spriel
2012-06-11 21:36         ` Hauke Mehrtens
2012-06-05 23:07 ` [PATCH 02/18] brcmsmac: remove PCI_FORCEHT() makro Hauke Mehrtens
2012-06-07 20:12   ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 03/18] brcmsmac: remove ai_get_buscore{type,rev}() Hauke Mehrtens
2012-06-06  9:17   ` Arend van Spriel
2012-06-07 13:48     ` Hauke Mehrtens
2012-06-07 19:36       ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 04/18] brcmsmac: use container_of instead of cast Hauke Mehrtens
2012-06-06  9:27   ` Arend van Spriel
2012-06-07 13:45     ` Hauke Mehrtens
2012-06-05 23:07 ` [PATCH 05/18] brcmsmac: remove ai_findcore() Hauke Mehrtens
2012-06-06  9:28   ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 06/18] brcmsmac: remove si_pmu_init() and si_pmu_res_init() Hauke Mehrtens
2012-06-06  9:31   ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 07/18] brcmsmac: remove si_pmu_spuravoid_pllupdate() Hauke Mehrtens
2012-06-06  9:33   ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 08/18] brcmsmac: remove some redundant chip common workarounds Hauke Mehrtens
2012-06-06 12:14   ` Arend van Spriel
2012-06-07 12:59     ` Hauke Mehrtens
2012-06-05 23:07 ` [PATCH 09/18] brcmsmac: use core id constants from bcma Hauke Mehrtens
2012-06-06  9:43   ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 10/18] brcmsmac: use chip and package " Hauke Mehrtens
2012-06-06  9:44   ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 11/18] brcmsmac: remove some unnessessacry casts and void pointer Hauke Mehrtens
2012-06-06  9:46   ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 12/18] brcmsmac: add a conditions for core rev 17 again Hauke Mehrtens
2012-06-05 23:07 ` [PATCH 13/18] brcmsmac: add some workarounds for other chips again Hauke Mehrtens
2012-06-06 10:03   ` Arend van Spriel
2012-06-07 13:45     ` Hauke Mehrtens
2012-06-07 19:34       ` Arend van Spriel
2012-06-08 11:31         ` Jonas Gorski
2012-06-08 16:54           ` Arend van Spriel
2012-06-08 17:49             ` Jonas Gorski
2012-06-05 23:07 ` [PATCH 14/18] brcmsmac: extend xmtfifo_sz array Hauke Mehrtens
2012-06-06 10:24   ` Arend van Spriel
2012-06-07 13:33     ` Hauke Mehrtens
2012-06-07 19:21       ` Arend van Spriel
2012-06-10 13:10         ` Hauke Mehrtens
2012-06-11  7:59           ` Arend van Spriel
2012-06-11 21:44             ` Hauke Mehrtens
2012-06-05 23:07 ` [PATCH 15/18] brcmsmac: fix DMA on SoCs Hauke Mehrtens
2012-06-06 11:10   ` Arend van Spriel
2012-06-07 13:29     ` Hauke Mehrtens
2012-06-05 23:07 ` [PATCH 16/18] brcmsmac: do not call brcms_c_chipmatch() for non PCI Hauke Mehrtens
2012-06-06 11:23   ` Arend van Spriel
2012-06-07 13:19     ` Hauke Mehrtens
2012-06-07 19:06       ` Arend van Spriel
2012-06-10 13:03         ` Hauke Mehrtens
2012-06-05 23:07 ` [PATCH 17/18] brcmsmac: fix read in write_phy_reg Hauke Mehrtens
2012-06-06 11:39   ` Arend van Spriel
2012-06-05 23:07 ` [PATCH 18/18] brcmsmac: handle non PCI devices in the phy code Hauke Mehrtens
2012-06-06 11:43   ` Arend van Spriel
2012-06-07 13:00     ` Hauke Mehrtens

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.