From 984e5befbafe2799be28c2209226a82fb3a3be7a Mon Sep 17 00:00:00 2001 From: Rafał Miłecki Date: Thu, 11 Aug 2011 23:46:44 +0200 Subject: bcma: implement BCM4331 workaround for external PA lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to disable ext. PA lines for reading SPROM. It's disabled by default, but this patch allows using bcma after loading wl, which leaves workaround enabled. Cc: Arend van Spriel Signed-off-by: Rafał Miłecki Signed-off-by: John W. Linville --- drivers/bcma/driver_chipcommon_pmu.c | 20 +++++++++++++++++++- drivers/bcma/sprom.c | 6 ++++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'drivers/bcma') diff --git a/drivers/bcma/driver_chipcommon_pmu.c b/drivers/bcma/driver_chipcommon_pmu.c index 5940c81e7e12..4bc10aa57bd4 100644 --- a/drivers/bcma/driver_chipcommon_pmu.c +++ b/drivers/bcma/driver_chipcommon_pmu.c @@ -90,6 +90,24 @@ void bcma_pmu_swreg_init(struct bcma_drv_cc *cc) } } +/* Disable to allow reading SPROM. Don't know the adventages of enabling it. */ +void bcma_chipco_bcm4331_ext_pa_lines_ctl(struct bcma_drv_cc *cc, bool enable) +{ + struct bcma_bus *bus = cc->core->bus; + u32 val; + + val = bcma_cc_read32(cc, BCMA_CC_CHIPCTL); + if (enable) { + val |= BCMA_CHIPCTL_4331_EXTPA_EN; + if (bus->chipinfo.pkg == 9 || bus->chipinfo.pkg == 11) + val |= BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5; + } else { + val &= ~BCMA_CHIPCTL_4331_EXTPA_EN; + val &= ~BCMA_CHIPCTL_4331_EXTPA_ON_GPIO2_5; + } + bcma_cc_write32(cc, BCMA_CC_CHIPCTL, val); +} + void bcma_pmu_workarounds(struct bcma_drv_cc *cc) { struct bcma_bus *bus = cc->core->bus; @@ -99,7 +117,7 @@ void bcma_pmu_workarounds(struct bcma_drv_cc *cc) bcma_chipco_chipctl_maskset(cc, 0, ~0, 0x7); break; case 0x4331: - pr_err("Enabling Ext PA lines not implemented\n"); + /* BCM4331 workaround is SPROM-related, we put it in sprom.c */ break; case 43224: if (bus->chipinfo.rev == 0) { diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index 8b5b7856abe3..166ed13ec066 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c @@ -152,6 +152,9 @@ int bcma_sprom_get(struct bcma_bus *bus) if (!sprom) return -ENOMEM; + if (bus->chipinfo.id == 0x4331) + bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, false); + /* Most cards have SPROM moved by additional offset 0x30 (48 dwords). * According to brcm80211 this applies to cards with PCIe rev >= 6 * TODO: understand this condition and use it */ @@ -159,6 +162,9 @@ int bcma_sprom_get(struct bcma_bus *bus) BCMA_CC_SPROM_PCIE6; bcma_sprom_read(bus, offset, sprom); + if (bus->chipinfo.id == 0x4331) + bcma_chipco_bcm4331_ext_pa_lines_ctl(&bus->drv_cc, true); + err = bcma_sprom_valid(sprom); if (err) goto out; -- cgit v1.2.3-59-g8ed1b