From eb1577b7c4b2cdd0e18b0d5d8e940e36329215e5 Mon Sep 17 00:00:00 2001 From: Rafał Miłecki Date: Sun, 17 Jul 2011 11:00:59 +0200 Subject: bcma: handle alternative SPROM location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some cards do not use additional 0x30 offset for SPROM location. We do not know the real condition for it yet, make it BCM4331 specific for now. Signed-off-by: Rafał Miłecki Signed-off-by: John W. Linville --- drivers/bcma/sprom.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'drivers/bcma/sprom.c') diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c index 52917e5bb892..8b5b7856abe3 100644 --- a/drivers/bcma/sprom.c +++ b/drivers/bcma/sprom.c @@ -20,12 +20,12 @@ * R/W ops. **************************************************/ -static void bcma_sprom_read(struct bcma_bus *bus, u16 *sprom) +static void bcma_sprom_read(struct bcma_bus *bus, u16 offset, u16 *sprom) { int i; for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++) sprom[i] = bcma_read16(bus->drv_cc.core, - BCMA_CC_SPROM + (i * 2)); + offset + (i * 2)); } /************************************************** @@ -137,6 +137,7 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom) int bcma_sprom_get(struct bcma_bus *bus) { + u16 offset; u16 *sprom; int err = 0; @@ -151,7 +152,12 @@ int bcma_sprom_get(struct bcma_bus *bus) if (!sprom) return -ENOMEM; - bcma_sprom_read(bus, sprom); + /* 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 */ + offset = (bus->chipinfo.id == 0x4331) ? BCMA_CC_SPROM : + BCMA_CC_SPROM_PCIE6; + bcma_sprom_read(bus, offset, sprom); err = bcma_sprom_valid(sprom); if (err) -- cgit v1.2.3