aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ssb/pci.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2010-03-31 15:59:21 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-04-26 13:51:08 -0400
commitea2db495f92ad2cf3301623e60cb95b4062bc484 (patch)
tree7cbfbc413f573673fc802fc44919ebbfcb5239ef /drivers/ssb/pci.c
parentd53cdbb94a52a920d5420ed64d986c3523a56743 (diff)
ssb: Look for SPROM at different offset on higher rev CC
Our offset handling becomes even a little more hackish now. For some reason I do not understand all offsets as inrelative. It assumes base offset is 0x1000 but it will work for now as we make offsets relative anyway by removing base 0x1000. Should be cleaner however. Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/pci.c')
-rw-r--r--drivers/ssb/pci.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index a4b2b99f2c80..5bb1278759c1 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -167,7 +167,7 @@ err_pci:
167} 167}
168 168
169/* Get the word-offset for a SSB_SPROM_XXX define. */ 169/* Get the word-offset for a SSB_SPROM_XXX define. */
170#define SPOFF(offset) (((offset) - SSB_SPROM_BASE) / sizeof(u16)) 170#define SPOFF(offset) (((offset) - SSB_SPROM_BASE1) / sizeof(u16))
171/* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */ 171/* Helper to extract some _offset, which is one of the SSB_SPROM_XXX defines. */
172#define SPEX16(_outvar, _offset, _mask, _shift) \ 172#define SPEX16(_outvar, _offset, _mask, _shift) \
173 out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift)) 173 out->_outvar = ((in[SPOFF(_offset)] & (_mask)) >> (_shift))
@@ -253,7 +253,7 @@ static int sprom_do_read(struct ssb_bus *bus, u16 *sprom)
253 int i; 253 int i;
254 254
255 for (i = 0; i < bus->sprom_size; i++) 255 for (i = 0; i < bus->sprom_size; i++)
256 sprom[i] = ioread16(bus->mmio + SSB_SPROM_BASE + (i * 2)); 256 sprom[i] = ioread16(bus->mmio + bus->sprom_offset + (i * 2));
257 257
258 return 0; 258 return 0;
259} 259}
@@ -284,7 +284,7 @@ static int sprom_do_write(struct ssb_bus *bus, const u16 *sprom)
284 ssb_printk("75%%"); 284 ssb_printk("75%%");
285 else if (i % 2) 285 else if (i % 2)
286 ssb_printk("."); 286 ssb_printk(".");
287 writew(sprom[i], bus->mmio + SSB_SPROM_BASE + (i * 2)); 287 writew(sprom[i], bus->mmio + bus->sprom_offset + (i * 2));
288 mmiowb(); 288 mmiowb();
289 msleep(20); 289 msleep(20);
290 } 290 }
@@ -625,6 +625,9 @@ static int ssb_pci_sprom_get(struct ssb_bus *bus,
625 return -ENODEV; 625 return -ENODEV;
626 } 626 }
627 627
628 bus->sprom_offset = (bus->chipco.dev->id.revision < 31) ?
629 SSB_SPROM_BASE1 : SSB_SPROM_BASE31;
630
628 buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL); 631 buf = kcalloc(SSB_SPROMSIZE_WORDS_R123, sizeof(u16), GFP_KERNEL);
629 if (!buf) 632 if (!buf)
630 goto out; 633 goto out;