* [PATCH 1/4] bcma: implement setting core clock mode to dynamic
2012-04-29 0:18 [PATCH 0/4] bcma: add PCI functions from brcmsmac Hauke Mehrtens
@ 2012-04-29 0:18 ` Hauke Mehrtens
2012-04-29 0:18 ` [PATCH 2/4] bcma: add bcma_core_pci_extend_L1timer Hauke Mehrtens
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Hauke Mehrtens @ 2012-04-29 0:18 UTC (permalink / raw)
To: linville; +Cc: zajec5, b43-dev, linux-wireless, arend, Hauke Mehrtens
This patch is based on code from _ai_clkctl_cc() in brcmsmac.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/bcma/core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bcma/core.c b/drivers/bcma/core.c
index 893f6e0..98e243c 100644
--- a/drivers/bcma/core.c
+++ b/drivers/bcma/core.c
@@ -77,7 +77,7 @@ void bcma_core_set_clockmode(struct bcma_device *core,
pr_err("HT force timeout\n");
break;
case BCMA_CLKMODE_DYNAMIC:
- pr_warn("Dynamic clockmode not supported yet!\n");
+ bcma_set32(core, BCMA_CLKCTLST, ~BCMA_CLKCTLST_FORCEHT);
break;
}
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/4] bcma: add bcma_core_pci_extend_L1timer
2012-04-29 0:18 [PATCH 0/4] bcma: add PCI functions from brcmsmac Hauke Mehrtens
2012-04-29 0:18 ` [PATCH 1/4] bcma: implement setting core clock mode to dynamic Hauke Mehrtens
@ 2012-04-29 0:18 ` Hauke Mehrtens
2012-04-29 0:18 ` [PATCH 3/4] bcma: add bcma_core_pci_fixcfg() Hauke Mehrtens
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Hauke Mehrtens @ 2012-04-29 0:18 UTC (permalink / raw)
To: linville; +Cc: zajec5, b43-dev, linux-wireless, arend, Hauke Mehrtens
This code is based on code from pcie_extendL1timer() in brcmsmac. This
patch is part of the move of pci specific code from brcmsmac to bcma.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/bcma/driver_pci.c | 16 ++++++++++++++--
include/linux/bcma/bcma_driver_pci.h | 2 ++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index 4d38ae1..9492066 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -24,14 +24,12 @@ u32 bcma_pcie_read(struct bcma_drv_pci *pc, u32 address)
return pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_DATA);
}
-#if 0
static void bcma_pcie_write(struct bcma_drv_pci *pc, u32 address, u32 data)
{
pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_ADDR, address);
pcicore_read32(pc, BCMA_CORE_PCI_PCIEIND_ADDR);
pcicore_write32(pc, BCMA_CORE_PCI_PCIEIND_DATA, data);
}
-#endif
static void bcma_pcie_mdio_set_phy(struct bcma_drv_pci *pc, u8 phy)
{
@@ -224,3 +222,17 @@ out:
return err;
}
EXPORT_SYMBOL_GPL(bcma_core_pci_irq_ctl);
+
+void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend)
+{
+ u32 w;
+
+ w = bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
+ if (extend)
+ w |= BCMA_CORE_PCI_ASPMTIMER_EXTEND;
+ else
+ w &= ~BCMA_CORE_PCI_ASPMTIMER_EXTEND;
+ bcma_pcie_write(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG, w);
+ bcma_pcie_read(pc, BCMA_CORE_PCI_DLLP_PMTHRESHREG);
+}
+EXPORT_SYMBOL_GPL(bcma_core_pci_extend_L1timer);
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 46c71e2..20c9f96 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -133,6 +133,7 @@ struct pci_dev;
#define BCMA_CORE_PCI_DLLP_LRREG 0x120 /* Link Replay */
#define BCMA_CORE_PCI_DLLP_LACKTOREG 0x124 /* Link Ack Timeout */
#define BCMA_CORE_PCI_DLLP_PMTHRESHREG 0x128 /* Power Management Threshold */
+#define BCMA_CORE_PCI_ASPMTIMER_EXTEND 0x01000000 /* > rev7: enable extend ASPM timer */
#define BCMA_CORE_PCI_DLLP_RTRYWPREG 0x12C /* Retry buffer write ptr */
#define BCMA_CORE_PCI_DLLP_RTRYRPREG 0x130 /* Retry buffer Read ptr */
#define BCMA_CORE_PCI_DLLP_RTRYPPREG 0x134 /* Retry buffer Purged ptr */
@@ -207,6 +208,7 @@ struct bcma_drv_pci {
extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);
extern int bcma_core_pci_irq_ctl(struct bcma_drv_pci *pc,
struct bcma_device *core, bool enable);
+extern void bcma_core_pci_extend_L1timer(struct bcma_drv_pci *pc, bool extend);
extern int bcma_core_pci_pcibios_map_irq(const struct pci_dev *dev);
extern int bcma_core_pci_plat_dev_init(struct pci_dev *dev);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/4] bcma: add bcma_core_pci_fixcfg()
2012-04-29 0:18 [PATCH 0/4] bcma: add PCI functions from brcmsmac Hauke Mehrtens
2012-04-29 0:18 ` [PATCH 1/4] bcma: implement setting core clock mode to dynamic Hauke Mehrtens
2012-04-29 0:18 ` [PATCH 2/4] bcma: add bcma_core_pci_extend_L1timer Hauke Mehrtens
@ 2012-04-29 0:18 ` Hauke Mehrtens
2012-04-29 0:18 ` [PATCH 4/4] bcma: add bcma_core_pci_config_fixup() Hauke Mehrtens
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Hauke Mehrtens @ 2012-04-29 0:18 UTC (permalink / raw)
To: linville; +Cc: zajec5, b43-dev, linux-wireless, arend, Hauke Mehrtens
This code is based on code from pcicore_fixcfg() in brcmsmac. This
patch is part of the move of pci specific code from brcmsmac to bcma.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/bcma/driver_pci.c | 19 +++++++++++++++++++
include/linux/bcma/bcma_driver_pci.h | 5 +++++
2 files changed, 24 insertions(+)
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index 9492066..472d14f 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -168,12 +168,31 @@ static void bcma_pcicore_serdes_workaround(struct bcma_drv_pci *pc)
tmp & ~BCMA_CORE_PCI_PLL_CTRL_FREQDET_EN);
}
+static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc)
+{
+ struct bcma_device *core = pc->core;
+ u16 val16, core_index;
+ uint regoff;
+
+ regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_PI_OFFSET);
+ core_index = (u16)core->core_index;
+
+ val16 = pcicore_read16(pc, regoff);
+ if (((val16 & BCMA_CORE_PCI_SPROM_PI_MASK) >> BCMA_CORE_PCI_SPROM_PI_SHIFT)
+ != core_index) {
+ val16 = (core_index << BCMA_CORE_PCI_SPROM_PI_SHIFT) |
+ (val16 & ~BCMA_CORE_PCI_SPROM_PI_MASK);
+ pcicore_write16(pc, regoff, val16);
+ }
+}
+
/**************************************************
* Init.
**************************************************/
static void __devinit bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc)
{
+ bcma_core_pci_fixcfg(pc);
bcma_pcicore_serdes_workaround(pc);
}
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 20c9f96..5b0542c 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -87,6 +87,9 @@ struct pci_dev;
#define BCMA_CORE_PCI_PCICFG2 0x0600 /* PCI config space 2 (rev >= 8) */
#define BCMA_CORE_PCI_PCICFG3 0x0700 /* PCI config space 3 (rev >= 8) */
#define BCMA_CORE_PCI_SPROM(wordoffset) (0x0800 + ((wordoffset) * 2)) /* SPROM shadow area (72 bytes) */
+#define BCMA_CORE_PCI_SPROM_PI_OFFSET 0 /* first word */
+#define BCMA_CORE_PCI_SPROM_PI_MASK 0xf000 /* bit 15:12 */
+#define BCMA_CORE_PCI_SPROM_PI_SHIFT 12 /* bit 15:12 */
/* SBtoPCIx */
#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000
@@ -202,7 +205,9 @@ struct bcma_drv_pci {
};
/* Register access */
+#define pcicore_read16(pc, offset) bcma_read16((pc)->core, offset)
#define pcicore_read32(pc, offset) bcma_read32((pc)->core, offset)
+#define pcicore_write16(pc, offset, val) bcma_write16((pc)->core, offset, val)
#define pcicore_write32(pc, offset, val) bcma_write32((pc)->core, offset, val)
extern void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc);
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/4] bcma: add bcma_core_pci_config_fixup()
2012-04-29 0:18 [PATCH 0/4] bcma: add PCI functions from brcmsmac Hauke Mehrtens
` (2 preceding siblings ...)
2012-04-29 0:18 ` [PATCH 3/4] bcma: add bcma_core_pci_fixcfg() Hauke Mehrtens
@ 2012-04-29 0:18 ` Hauke Mehrtens
2012-04-29 8:05 ` [PATCH 0/4] bcma: add PCI functions from brcmsmac Arend van Spriel
2012-05-09 22:17 ` Hauke Mehrtens
5 siblings, 0 replies; 8+ messages in thread
From: Hauke Mehrtens @ 2012-04-29 0:18 UTC (permalink / raw)
To: linville; +Cc: zajec5, b43-dev, linux-wireless, arend, Hauke Mehrtens
This code is based on code from pcie_misc_config_fixup() in brcmsmac.
This patch is part of the move of pci specific code from brcmsmac to
bcma.
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
drivers/bcma/driver_pci.c | 18 ++++++++++++++++++
include/linux/bcma/bcma_driver_pci.h | 4 ++++
2 files changed, 22 insertions(+)
diff --git a/drivers/bcma/driver_pci.c b/drivers/bcma/driver_pci.c
index 472d14f..9a96f14 100644
--- a/drivers/bcma/driver_pci.c
+++ b/drivers/bcma/driver_pci.c
@@ -186,6 +186,23 @@ static void bcma_core_pci_fixcfg(struct bcma_drv_pci *pc)
}
}
+/* Fix MISC config to allow coming out of L2/L3-Ready state w/o PRST */
+/* Needs to happen when coming out of 'standby'/'hibernate' */
+static void bcma_core_pci_config_fixup(struct bcma_drv_pci *pc)
+{
+ u16 val16;
+ uint regoff;
+
+ regoff = BCMA_CORE_PCI_SPROM(BCMA_CORE_PCI_SPROM_MISC_CONFIG);
+
+ val16 = pcicore_read16(pc, regoff);
+
+ if (!(val16 & BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST)) {
+ val16 |= BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST;
+ pcicore_write16(pc, regoff, val16);
+ }
+}
+
/**************************************************
* Init.
**************************************************/
@@ -194,6 +211,7 @@ static void __devinit bcma_core_pci_clientmode_init(struct bcma_drv_pci *pc)
{
bcma_core_pci_fixcfg(pc);
bcma_pcicore_serdes_workaround(pc);
+ bcma_core_pci_config_fixup(pc);
}
void __devinit bcma_core_pci_init(struct bcma_drv_pci *pc)
diff --git a/include/linux/bcma/bcma_driver_pci.h b/include/linux/bcma/bcma_driver_pci.h
index 5b0542c..41da581 100644
--- a/include/linux/bcma/bcma_driver_pci.h
+++ b/include/linux/bcma/bcma_driver_pci.h
@@ -90,6 +90,10 @@ struct pci_dev;
#define BCMA_CORE_PCI_SPROM_PI_OFFSET 0 /* first word */
#define BCMA_CORE_PCI_SPROM_PI_MASK 0xf000 /* bit 15:12 */
#define BCMA_CORE_PCI_SPROM_PI_SHIFT 12 /* bit 15:12 */
+#define BCMA_CORE_PCI_SPROM_MISC_CONFIG 5 /* word 5 */
+#define BCMA_CORE_PCI_SPROM_L23READY_EXIT_NOPERST 0x8000 /* bit 15 */
+#define BCMA_CORE_PCI_SPROM_CLKREQ_OFFSET_REV5 20 /* word 20 for srom rev <= 5 */
+#define BCMA_CORE_PCI_SPROM_CLKREQ_ENB 0x0800 /* bit 11 */
/* SBtoPCIx */
#define BCMA_CORE_PCI_SBTOPCI_MEM 0x00000000
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 0/4] bcma: add PCI functions from brcmsmac
2012-04-29 0:18 [PATCH 0/4] bcma: add PCI functions from brcmsmac Hauke Mehrtens
` (3 preceding siblings ...)
2012-04-29 0:18 ` [PATCH 4/4] bcma: add bcma_core_pci_config_fixup() Hauke Mehrtens
@ 2012-04-29 8:05 ` Arend van Spriel
2012-05-09 22:17 ` Hauke Mehrtens
5 siblings, 0 replies; 8+ messages in thread
From: Arend van Spriel @ 2012-04-29 8:05 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: linville, zajec5, b43-dev, linux-wireless
On 04/29/2012 02:18 AM, Hauke Mehrtens wrote:
> This patch series contains the functions regarding the PCIe core from
> brcmsmac for the supported PCIe core revisions.
>
> Some of these functions have to be called on resume after suspend, but
> I do not know which or if all have to be called. I do not have a PCIe
> based device supported by brcmsmac, so I can not test this. Could
> someone which such a device do some tests and create a patch with the
> functions, which have to be called on resume.
I do have some devices and feel it is my/our responsibility to get this
tested. I let you know the results.
> The goal of theses patches is to remove the PCIe code from brcmsmac to
> get one step ahead in making brcmsmac support non pcie based devices.
>
> This is based on wireless-testing/master.
>
Gr. AvS
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 0/4] bcma: add PCI functions from brcmsmac
2012-04-29 0:18 [PATCH 0/4] bcma: add PCI functions from brcmsmac Hauke Mehrtens
` (4 preceding siblings ...)
2012-04-29 8:05 ` [PATCH 0/4] bcma: add PCI functions from brcmsmac Arend van Spriel
@ 2012-05-09 22:17 ` Hauke Mehrtens
2012-05-15 21:15 ` John W. Linville
5 siblings, 1 reply; 8+ messages in thread
From: Hauke Mehrtens @ 2012-05-09 22:17 UTC (permalink / raw)
To: Hauke Mehrtens, zajec5; +Cc: linville, b43-dev, linux-wireless, arend
On 04/29/2012 02:18 AM, Hauke Mehrtens wrote:
> This patch series contains the functions regarding the PCIe core from
> brcmsmac for the supported PCIe core revisions.
>
> Some of these functions have to be called on resume after suspend, but
> I do not know which or if all have to be called. I do not have a PCIe
> based device supported by brcmsmac, so I can not test this. Could
> someone which such a device do some tests and create a patch with the
> functions, which have to be called on resume.
>
> The goal of theses patches is to remove the PCIe code from brcmsmac to
> get one step ahead in making brcmsmac support non pcie based devices.
>
> This is based on wireless-testing/master.
>
> Hauke Mehrtens (4):
> bcma: implement setting core clock mode to dynamic
> bcma: add bcma_core_pci_extend_L1timer
> bcma: add bcma_core_pci_fixcfg()
> bcma: add bcma_core_pci_config_fixup()
>
> drivers/bcma/core.c | 2 +-
> drivers/bcma/driver_pci.c | 53 ++++++++++++++++++++++++++++++++--
> include/linux/bcma/bcma_driver_pci.h | 11 +++++++
> 3 files changed, 63 insertions(+), 3 deletions(-)
>
Hi Rafa?,
could you give me an ack or a nack about this patch series and the other
(ssb/bcma/bcm47xx: extend boardinfo and sprom).
I have tested them with b43 and brcmsmac on bcma and ssb based SoCs
(bcm4718 + bcm43224, bcm4705 + 2x bcm4322, bcm4704 + bcm4318) and have
not found any problems.
Hauke
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 0/4] bcma: add PCI functions from brcmsmac
2012-05-09 22:17 ` Hauke Mehrtens
@ 2012-05-15 21:15 ` John W. Linville
0 siblings, 0 replies; 8+ messages in thread
From: John W. Linville @ 2012-05-15 21:15 UTC (permalink / raw)
To: Hauke Mehrtens; +Cc: zajec5, b43-dev, linux-wireless, arend
On Thu, May 10, 2012 at 12:17:39AM +0200, Hauke Mehrtens wrote:
> On 04/29/2012 02:18 AM, Hauke Mehrtens wrote:
> > This patch series contains the functions regarding the PCIe core from
> > brcmsmac for the supported PCIe core revisions.
> >
> > Some of these functions have to be called on resume after suspend, but
> > I do not know which or if all have to be called. I do not have a PCIe
> > based device supported by brcmsmac, so I can not test this. Could
> > someone which such a device do some tests and create a patch with the
> > functions, which have to be called on resume.
> >
> > The goal of theses patches is to remove the PCIe code from brcmsmac to
> > get one step ahead in making brcmsmac support non pcie based devices.
> >
> > This is based on wireless-testing/master.
> >
> > Hauke Mehrtens (4):
> > bcma: implement setting core clock mode to dynamic
> > bcma: add bcma_core_pci_extend_L1timer
> > bcma: add bcma_core_pci_fixcfg()
> > bcma: add bcma_core_pci_config_fixup()
> >
> > drivers/bcma/core.c | 2 +-
> > drivers/bcma/driver_pci.c | 53 ++++++++++++++++++++++++++++++++--
> > include/linux/bcma/bcma_driver_pci.h | 11 +++++++
> > 3 files changed, 63 insertions(+), 3 deletions(-)
> >
>
> Hi Rafa?,
>
> could you give me an ack or a nack about this patch series and the other
> (ssb/bcma/bcm47xx: extend boardinfo and sprom).
>
> I have tested them with b43 and brcmsmac on bcma and ssb based SoCs
> (bcm4718 + bcm43224, bcm4705 + 2x bcm4322, bcm4704 + bcm4318) and have
> not found any problems.
>
> Hauke
Rafa?, ping?
--
John W. Linville Someday the world will need a hero, and you
linville at tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 8+ messages in thread