aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bcma/sprom.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2013-05-13 16:07:53 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-05-22 15:08:44 -0400
commit78e578c5b43c4f274305075c68d055c8d6141fd5 (patch)
tree16510b0968622a2dfcbc0c58a5204eaa43cabebe /drivers/bcma/sprom.c
parent92eb164258cfce173060d3fe7aaffa2afaf735d7 (diff)
bcma: support SPROM rev 10
This is pretty much the same as rev 9, there are just 2 extra fields we know about, but are not used/stored yet anyway. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/bcma/sprom.c')
-rw-r--r--drivers/bcma/sprom.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/bcma/sprom.c b/drivers/bcma/sprom.c
index c96f71c183cd..de15b4f4b237 100644
--- a/drivers/bcma/sprom.c
+++ b/drivers/bcma/sprom.c
@@ -154,7 +154,8 @@ static int bcma_sprom_check_crc(const u16 *sprom, size_t words)
154 return 0; 154 return 0;
155} 155}
156 156
157static int bcma_sprom_valid(const u16 *sprom, size_t words) 157static int bcma_sprom_valid(struct bcma_bus *bus, const u16 *sprom,
158 size_t words)
158{ 159{
159 u16 revision; 160 u16 revision;
160 int err; 161 int err;
@@ -164,11 +165,14 @@ static int bcma_sprom_valid(const u16 *sprom, size_t words)
164 return err; 165 return err;
165 166
166 revision = sprom[words - 1] & SSB_SPROM_REVISION_REV; 167 revision = sprom[words - 1] & SSB_SPROM_REVISION_REV;
167 if (revision != 8 && revision != 9) { 168 if (revision != 8 && revision != 9 && revision != 10) {
168 pr_err("Unsupported SPROM revision: %d\n", revision); 169 pr_err("Unsupported SPROM revision: %d\n", revision);
169 return -ENOENT; 170 return -ENOENT;
170 } 171 }
171 172
173 bus->sprom.revision = revision;
174 bcma_debug(bus, "Found SPROM revision %d\n", revision);
175
172 return 0; 176 return 0;
173} 177}
174 178
@@ -208,9 +212,6 @@ static void bcma_sprom_extract_r8(struct bcma_bus *bus, const u16 *sprom)
208 BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) != 212 BUILD_BUG_ON(ARRAY_SIZE(pwr_info_offset) !=
209 ARRAY_SIZE(bus->sprom.core_pwr_info)); 213 ARRAY_SIZE(bus->sprom.core_pwr_info));
210 214
211 bus->sprom.revision = sprom[SSB_SPROMSIZE_WORDS_R4 - 1] &
212 SSB_SPROM_REVISION_REV;
213
214 for (i = 0; i < 3; i++) { 215 for (i = 0; i < 3; i++) {
215 v = sprom[SPOFF(SSB_SPROM8_IL0MAC) + i]; 216 v = sprom[SPOFF(SSB_SPROM8_IL0MAC) + i];
216 *(((__be16 *)bus->sprom.il0mac) + i) = cpu_to_be16(v); 217 *(((__be16 *)bus->sprom.il0mac) + i) = cpu_to_be16(v);
@@ -549,7 +550,8 @@ int bcma_sprom_get(struct bcma_bus *bus)
549{ 550{
550 u16 offset = BCMA_CC_SPROM; 551 u16 offset = BCMA_CC_SPROM;
551 u16 *sprom; 552 u16 *sprom;
552 size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4, }; 553 size_t sprom_sizes[] = { SSB_SPROMSIZE_WORDS_R4,
554 SSB_SPROMSIZE_WORDS_R10, };
553 int i, err = 0; 555 int i, err = 0;
554 556
555 if (!bus->drv_cc.core) 557 if (!bus->drv_cc.core)
@@ -592,7 +594,7 @@ int bcma_sprom_get(struct bcma_bus *bus)
592 return -ENOMEM; 594 return -ENOMEM;
593 595
594 bcma_sprom_read(bus, offset, sprom, words); 596 bcma_sprom_read(bus, offset, sprom, words);
595 err = bcma_sprom_valid(sprom, words); 597 err = bcma_sprom_valid(bus, sprom, words);
596 if (!err) 598 if (!err)
597 break; 599 break;
598 600