diff options
Diffstat (limited to 'drivers/ssb/pci.c')
-rw-r--r-- | drivers/ssb/pci.c | 75 |
1 files changed, 15 insertions, 60 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c index 8f600fcd2430..9777dcb5bfe5 100644 --- a/drivers/ssb/pci.c +++ b/drivers/ssb/pci.c | |||
@@ -297,62 +297,6 @@ err_ctlreg: | |||
297 | return err; | 297 | return err; |
298 | } | 298 | } |
299 | 299 | ||
300 | static void sprom_extract_r1(struct ssb_sprom_r1 *out, const u16 *in) | ||
301 | { | ||
302 | int i; | ||
303 | u16 v; | ||
304 | |||
305 | SPEX(pci_spid, SSB_SPROM1_SPID, 0xFFFF, 0); | ||
306 | SPEX(pci_svid, SSB_SPROM1_SVID, 0xFFFF, 0); | ||
307 | SPEX(pci_pid, SSB_SPROM1_PID, 0xFFFF, 0); | ||
308 | for (i = 0; i < 3; i++) { | ||
309 | v = in[SPOFF(SSB_SPROM1_IL0MAC) + i]; | ||
310 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); | ||
311 | } | ||
312 | for (i = 0; i < 3; i++) { | ||
313 | v = in[SPOFF(SSB_SPROM1_ET0MAC) + i]; | ||
314 | *(((__be16 *)out->et0mac) + i) = cpu_to_be16(v); | ||
315 | } | ||
316 | for (i = 0; i < 3; i++) { | ||
317 | v = in[SPOFF(SSB_SPROM1_ET1MAC) + i]; | ||
318 | *(((__be16 *)out->et1mac) + i) = cpu_to_be16(v); | ||
319 | } | ||
320 | SPEX(et0phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0A, 0); | ||
321 | SPEX(et1phyaddr, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1A, | ||
322 | SSB_SPROM1_ETHPHY_ET1A_SHIFT); | ||
323 | SPEX(et0mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET0M, 14); | ||
324 | SPEX(et1mdcport, SSB_SPROM1_ETHPHY, SSB_SPROM1_ETHPHY_ET1M, 15); | ||
325 | SPEX(board_rev, SSB_SPROM1_BINF, SSB_SPROM1_BINF_BREV, 0); | ||
326 | SPEX(country_code, SSB_SPROM1_BINF, SSB_SPROM1_BINF_CCODE, | ||
327 | SSB_SPROM1_BINF_CCODE_SHIFT); | ||
328 | SPEX(antenna_a, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTA, | ||
329 | SSB_SPROM1_BINF_ANTA_SHIFT); | ||
330 | SPEX(antenna_bg, SSB_SPROM1_BINF, SSB_SPROM1_BINF_ANTBG, | ||
331 | SSB_SPROM1_BINF_ANTBG_SHIFT); | ||
332 | SPEX(pa0b0, SSB_SPROM1_PA0B0, 0xFFFF, 0); | ||
333 | SPEX(pa0b1, SSB_SPROM1_PA0B1, 0xFFFF, 0); | ||
334 | SPEX(pa0b2, SSB_SPROM1_PA0B2, 0xFFFF, 0); | ||
335 | SPEX(pa1b0, SSB_SPROM1_PA1B0, 0xFFFF, 0); | ||
336 | SPEX(pa1b1, SSB_SPROM1_PA1B1, 0xFFFF, 0); | ||
337 | SPEX(pa1b2, SSB_SPROM1_PA1B2, 0xFFFF, 0); | ||
338 | SPEX(gpio0, SSB_SPROM1_GPIOA, SSB_SPROM1_GPIOA_P0, 0); | ||
339 | SPEX(gpio1, SSB_SPROM1_GPIOA, SSB_SPROM1_GPIOA_P1, | ||
340 | SSB_SPROM1_GPIOA_P1_SHIFT); | ||
341 | SPEX(gpio2, SSB_SPROM1_GPIOB, SSB_SPROM1_GPIOB_P2, 0); | ||
342 | SPEX(gpio3, SSB_SPROM1_GPIOB, SSB_SPROM1_GPIOB_P3, | ||
343 | SSB_SPROM1_GPIOB_P3_SHIFT); | ||
344 | SPEX(maxpwr_a, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_A, | ||
345 | SSB_SPROM1_MAXPWR_A_SHIFT); | ||
346 | SPEX(maxpwr_bg, SSB_SPROM1_MAXPWR, SSB_SPROM1_MAXPWR_BG, 0); | ||
347 | SPEX(itssi_a, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_A, | ||
348 | SSB_SPROM1_ITSSI_A_SHIFT); | ||
349 | SPEX(itssi_bg, SSB_SPROM1_ITSSI, SSB_SPROM1_ITSSI_BG, 0); | ||
350 | SPEX(boardflags_lo, SSB_SPROM1_BFLLO, 0xFFFF, 0); | ||
351 | SPEX(antenna_gain_a, SSB_SPROM1_AGAIN, SSB_SPROM1_AGAIN_A, 0); | ||
352 | SPEX(antenna_gain_bg, SSB_SPROM1_AGAIN, SSB_SPROM1_AGAIN_BG, | ||
353 | SSB_SPROM1_AGAIN_BG_SHIFT); | ||
354 | } | ||
355 | |||
356 | static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) | 300 | static void sprom_extract_r123(struct ssb_sprom *out, const u16 *in) |
357 | { | 301 | { |
358 | int i; | 302 | int i; |
@@ -414,7 +358,7 @@ static void sprom_extract_r4(struct ssb_sprom *out, const u16 *in) | |||
414 | int i; | 358 | int i; |
415 | u16 v; | 359 | u16 v; |
416 | 360 | ||
417 | /* extract the r1 variables */ | 361 | /* extract the equivalent of the r1 variables */ |
418 | for (i = 0; i < 3; i++) { | 362 | for (i = 0; i < 3; i++) { |
419 | v = in[SPOFF(SSB_SPROM4_IL0MAC) + i]; | 363 | v = in[SPOFF(SSB_SPROM4_IL0MAC) + i]; |
420 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); | 364 | *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v); |
@@ -435,6 +379,18 @@ static void sprom_extract_r4(struct ssb_sprom *out, const u16 *in) | |||
435 | SPEX(antenna_gain_a, SSB_SPROM4_AGAIN, SSB_SPROM4_AGAIN_0, 0); | 379 | SPEX(antenna_gain_a, SSB_SPROM4_AGAIN, SSB_SPROM4_AGAIN_0, 0); |
436 | SPEX(antenna_gain_bg, SSB_SPROM4_AGAIN, SSB_SPROM4_AGAIN_1, | 380 | SPEX(antenna_gain_bg, SSB_SPROM4_AGAIN, SSB_SPROM4_AGAIN_1, |
437 | SSB_SPROM4_AGAIN_1_SHIFT); | 381 | SSB_SPROM4_AGAIN_1_SHIFT); |
382 | SPEX(maxpwr_bg, SSB_SPROM4_MAXP_BG, SSB_SPROM4_MAXP_BG_MASK, 0); | ||
383 | SPEX(itssi_bg, SSB_SPROM4_MAXP_BG, SSB_SPROM4_ITSSI_BG, | ||
384 | SSB_SPROM4_ITSSI_BG_SHIFT); | ||
385 | SPEX(maxpwr_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_MAXP_A_MASK, 0); | ||
386 | SPEX(itssi_a, SSB_SPROM4_MAXP_A, SSB_SPROM4_ITSSI_A, | ||
387 | SSB_SPROM4_ITSSI_A_SHIFT); | ||
388 | SPEX(gpio0, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P0, 0); | ||
389 | SPEX(gpio1, SSB_SPROM4_GPIOA, SSB_SPROM4_GPIOA_P1, | ||
390 | SSB_SPROM4_GPIOA_P1_SHIFT); | ||
391 | SPEX(gpio2, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P2, 0); | ||
392 | SPEX(gpio3, SSB_SPROM4_GPIOB, SSB_SPROM4_GPIOB_P3, | ||
393 | SSB_SPROM4_GPIOB_P3_SHIFT); | ||
438 | /* TODO - get remaining rev 4 stuff needed */ | 394 | /* TODO - get remaining rev 4 stuff needed */ |
439 | } | 395 | } |
440 | 396 | ||
@@ -444,13 +400,13 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, | |||
444 | memset(out, 0, sizeof(*out)); | 400 | memset(out, 0, sizeof(*out)); |
445 | 401 | ||
446 | out->revision = in[size - 1] & 0x00FF; | 402 | out->revision = in[size - 1] & 0x00FF; |
403 | ssb_printk(KERN_INFO PFX "SPROM revision %d detected.\n", out->revision); | ||
447 | if ((bus->chip_id & 0xFF00) == 0x4400) { | 404 | if ((bus->chip_id & 0xFF00) == 0x4400) { |
448 | /* Workaround: The BCM44XX chip has a stupid revision | 405 | /* Workaround: The BCM44XX chip has a stupid revision |
449 | * number stored in the SPROM. | 406 | * number stored in the SPROM. |
450 | * Always extract r1. */ | 407 | * Always extract r1. */ |
451 | out->revision = 1; | 408 | out->revision = 1; |
452 | sprom_extract_r123(out, in); | 409 | sprom_extract_r123(out, in); |
453 | sprom_extract_r1(&out->r1, in); | ||
454 | } else if (bus->chip_id == 0x4321) { | 410 | } else if (bus->chip_id == 0x4321) { |
455 | /* the BCM4328 has a chipid == 0x4321 and a rev 4 SPROM */ | 411 | /* the BCM4328 has a chipid == 0x4321 and a rev 4 SPROM */ |
456 | out->revision = 4; | 412 | out->revision = 4; |
@@ -460,7 +416,6 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, | |||
460 | goto unsupported; | 416 | goto unsupported; |
461 | if (out->revision >= 1 && out->revision <= 3) { | 417 | if (out->revision >= 1 && out->revision <= 3) { |
462 | sprom_extract_r123(out, in); | 418 | sprom_extract_r123(out, in); |
463 | sprom_extract_r1(&out->r1, in); | ||
464 | } | 419 | } |
465 | if (out->revision == 4) | 420 | if (out->revision == 4) |
466 | sprom_extract_r4(out, in); | 421 | sprom_extract_r4(out, in); |
@@ -472,7 +427,7 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out, | |||
472 | unsupported: | 427 | unsupported: |
473 | ssb_printk(KERN_WARNING PFX "Unsupported SPROM revision %d " | 428 | ssb_printk(KERN_WARNING PFX "Unsupported SPROM revision %d " |
474 | "detected. Will extract v1\n", out->revision); | 429 | "detected. Will extract v1\n", out->revision); |
475 | sprom_extract_r1(&out->r1, in); | 430 | sprom_extract_r123(out, in); |
476 | return 0; | 431 | return 0; |
477 | } | 432 | } |
478 | 433 | ||