aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2011-07-17 05:00:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-07-19 16:49:53 -0400
commiteb1577b7c4b2cdd0e18b0d5d8e940e36329215e5 (patch)
tree0a6134bf849eb48c06692573504ad5f511d6c9cd
parentb473bc176702cb22529632b5c4315bda27e0d979 (diff)
bcma: handle alternative SPROM location
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 <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/bcma/sprom.c12
-rw-r--r--include/linux/bcma/bcma_driver_chipcommon.h3
2 files changed, 11 insertions, 4 deletions
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 @@
20 * R/W ops. 20 * R/W ops.
21 **************************************************/ 21 **************************************************/
22 22
23static void bcma_sprom_read(struct bcma_bus *bus, u16 *sprom) 23static void bcma_sprom_read(struct bcma_bus *bus, u16 offset, u16 *sprom)
24{ 24{
25 int i; 25 int i;
26 for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++) 26 for (i = 0; i < SSB_SPROMSIZE_WORDS_R4; i++)
27 sprom[i] = bcma_read16(bus->drv_cc.core, 27 sprom[i] = bcma_read16(bus->drv_cc.core,
28 BCMA_CC_SPROM + (i * 2)); 28 offset + (i * 2));
29} 29}
30 30
31/************************************************** 31/**************************************************
@@ -137,6 +137,7 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)
137 137
138int bcma_sprom_get(struct bcma_bus *bus) 138int bcma_sprom_get(struct bcma_bus *bus)
139{ 139{
140 u16 offset;
140 u16 *sprom; 141 u16 *sprom;
141 int err = 0; 142 int err = 0;
142 143
@@ -151,7 +152,12 @@ int bcma_sprom_get(struct bcma_bus *bus)
151 if (!sprom) 152 if (!sprom)
152 return -ENOMEM; 153 return -ENOMEM;
153 154
154 bcma_sprom_read(bus, sprom); 155 /* Most cards have SPROM moved by additional offset 0x30 (48 dwords).
156 * According to brcm80211 this applies to cards with PCIe rev >= 6
157 * TODO: understand this condition and use it */
158 offset = (bus->chipinfo.id == 0x4331) ? BCMA_CC_SPROM :
159 BCMA_CC_SPROM_PCIE6;
160 bcma_sprom_read(bus, offset, sprom);
155 161
156 err = bcma_sprom_valid(sprom); 162 err = bcma_sprom_valid(sprom);
157 if (err) 163 if (err)
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h
index 9c5b69fc985a..68c3d941a215 100644
--- a/include/linux/bcma/bcma_driver_chipcommon.h
+++ b/include/linux/bcma/bcma_driver_chipcommon.h
@@ -244,7 +244,8 @@
244#define BCMA_CC_REGCTL_DATA 0x065C 244#define BCMA_CC_REGCTL_DATA 0x065C
245#define BCMA_CC_PLLCTL_ADDR 0x0660 245#define BCMA_CC_PLLCTL_ADDR 0x0660
246#define BCMA_CC_PLLCTL_DATA 0x0664 246#define BCMA_CC_PLLCTL_DATA 0x0664
247#define BCMA_CC_SPROM 0x0830 /* SPROM beginning */ 247#define BCMA_CC_SPROM 0x0800 /* SPROM beginning */
248#define BCMA_CC_SPROM_PCIE6 0x0830 /* SPROM beginning on PCIe rev >= 6 */
248 249
249/* Data for the PMU, if available. 250/* Data for the PMU, if available.
250 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU) 251 * Check availability with ((struct bcma_chipcommon)->capabilities & BCMA_CC_CAP_PMU)