diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-05-17 20:06:41 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-06-01 15:10:57 -0400 |
commit | c244e08c7aa30abea3c29ff17a40f4b0a58a7913 (patch) | |
tree | 96fc5fc9cca78d2aecf204e7ecc13f05e0702eb0 /drivers/net | |
parent | a18c715e63505850edd2b69ded5373d6d464cd80 (diff) |
b43: bus: abstract chip info
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/b43/bus.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/b43/bus.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/b43/main.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_g.c | 8 | ||||
-rw-r--r-- | drivers/net/wireless/b43/phy_lp.c | 22 | ||||
-rw-r--r-- | drivers/net/wireless/b43/tables_lpphy.c | 3 |
6 files changed, 28 insertions, 25 deletions
diff --git a/drivers/net/wireless/b43/bus.c b/drivers/net/wireless/b43/bus.c index ec59a129bae7..8d0e7584eafd 100644 --- a/drivers/net/wireless/b43/bus.c +++ b/drivers/net/wireless/b43/bus.c | |||
@@ -74,6 +74,10 @@ struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) | |||
74 | dev->dma_dev = sdev->dma_dev; | 74 | dev->dma_dev = sdev->dma_dev; |
75 | dev->irq = sdev->irq; | 75 | dev->irq = sdev->irq; |
76 | 76 | ||
77 | dev->chip_id = sdev->bus->chip_id; | ||
78 | dev->chip_rev = sdev->bus->chip_rev; | ||
79 | dev->chip_pkg = sdev->bus->chip_package; | ||
80 | |||
77 | dev->bus_sprom = &sdev->bus->sprom; | 81 | dev->bus_sprom = &sdev->bus->sprom; |
78 | 82 | ||
79 | dev->core_id = sdev->id.coreid; | 83 | dev->core_id = sdev->id.coreid; |
diff --git a/drivers/net/wireless/b43/bus.h b/drivers/net/wireless/b43/bus.h index d432f5ceecb9..14942fb605d9 100644 --- a/drivers/net/wireless/b43/bus.h +++ b/drivers/net/wireless/b43/bus.h | |||
@@ -24,6 +24,10 @@ struct b43_bus_dev { | |||
24 | struct device *dma_dev; | 24 | struct device *dma_dev; |
25 | unsigned int irq; | 25 | unsigned int irq; |
26 | 26 | ||
27 | u16 chip_id; | ||
28 | u8 chip_rev; | ||
29 | u8 chip_pkg; | ||
30 | |||
27 | struct ssb_sprom *bus_sprom; | 31 | struct ssb_sprom *bus_sprom; |
28 | 32 | ||
29 | u16 core_id; | 33 | u16 core_id; |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index fd1e74ce0c3f..e80aaef63180 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -2588,7 +2588,7 @@ static int b43_gpio_init(struct b43_wldev *dev) | |||
2588 | 2588 | ||
2589 | mask = 0x0000001F; | 2589 | mask = 0x0000001F; |
2590 | set = 0x0000000F; | 2590 | set = 0x0000000F; |
2591 | if (dev->sdev->bus->chip_id == 0x4301) { | 2591 | if (dev->dev->chip_id == 0x4301) { |
2592 | mask |= 0x0060; | 2592 | mask |= 0x0060; |
2593 | set |= 0x0060; | 2593 | set |= 0x0060; |
2594 | } | 2594 | } |
@@ -2748,8 +2748,8 @@ static void b43_adjust_opmode(struct b43_wldev *dev) | |||
2748 | 2748 | ||
2749 | cfp_pretbtt = 2; | 2749 | cfp_pretbtt = 2; |
2750 | if ((ctl & B43_MACCTL_INFRA) && !(ctl & B43_MACCTL_AP)) { | 2750 | if ((ctl & B43_MACCTL_INFRA) && !(ctl & B43_MACCTL_AP)) { |
2751 | if (dev->sdev->bus->chip_id == 0x4306 && | 2751 | if (dev->dev->chip_id == 0x4306 && |
2752 | dev->sdev->bus->chip_rev == 3) | 2752 | dev->dev->chip_rev == 3) |
2753 | cfp_pretbtt = 100; | 2753 | cfp_pretbtt = 100; |
2754 | else | 2754 | else |
2755 | cfp_pretbtt = 50; | 2755 | cfp_pretbtt = 50; |
@@ -4096,10 +4096,10 @@ static int b43_phy_versioning(struct b43_wldev *dev) | |||
4096 | analog_type, phy_type, phy_rev); | 4096 | analog_type, phy_type, phy_rev); |
4097 | 4097 | ||
4098 | /* Get RADIO versioning */ | 4098 | /* Get RADIO versioning */ |
4099 | if (dev->sdev->bus->chip_id == 0x4317) { | 4099 | if (dev->dev->chip_id == 0x4317) { |
4100 | if (dev->sdev->bus->chip_rev == 0) | 4100 | if (dev->dev->chip_rev == 0) |
4101 | tmp = 0x3205017F; | 4101 | tmp = 0x3205017F; |
4102 | else if (dev->sdev->bus->chip_rev == 1) | 4102 | else if (dev->dev->chip_rev == 1) |
4103 | tmp = 0x4205017F; | 4103 | tmp = 0x4205017F; |
4104 | else | 4104 | else |
4105 | tmp = 0x5205017F; | 4105 | tmp = 0x5205017F; |
diff --git a/drivers/net/wireless/b43/phy_g.c b/drivers/net/wireless/b43/phy_g.c index ccb02afca62e..40ce9e6d104e 100644 --- a/drivers/net/wireless/b43/phy_g.c +++ b/drivers/net/wireless/b43/phy_g.c | |||
@@ -2088,8 +2088,8 @@ static void b43_phy_initg(struct b43_wldev *dev) | |||
2088 | /* FIXME: The spec says in the following if, the 0 should be replaced | 2088 | /* FIXME: The spec says in the following if, the 0 should be replaced |
2089 | 'if OFDM may not be used in the current locale' | 2089 | 'if OFDM may not be used in the current locale' |
2090 | but OFDM is legal everywhere */ | 2090 | but OFDM is legal everywhere */ |
2091 | if ((dev->sdev->bus->chip_id == 0x4306 | 2091 | if ((dev->dev->chip_id == 0x4306 |
2092 | && dev->sdev->bus->chip_package == 2) || 0) { | 2092 | && dev->dev->chip_pkg == 2) || 0) { |
2093 | b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF); | 2093 | b43_phy_mask(dev, B43_PHY_CRS0, 0xBFFF); |
2094 | b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF); | 2094 | b43_phy_mask(dev, B43_PHY_OFDM(0xC3), 0x7FFF); |
2095 | } | 2095 | } |
@@ -2203,7 +2203,7 @@ static void default_radio_attenuation(struct b43_wldev *dev, | |||
2203 | && bus->boardinfo.type == | 2203 | && bus->boardinfo.type == |
2204 | SSB_BOARD_BU4306) | 2204 | SSB_BOARD_BU4306) |
2205 | rf->att = 5; | 2205 | rf->att = 5; |
2206 | else if (bus->chip_id == 0x4320) | 2206 | else if (dev->dev->chip_id == 0x4320) |
2207 | rf->att = 4; | 2207 | rf->att = 4; |
2208 | else | 2208 | else |
2209 | rf->att = 3; | 2209 | rf->att = 3; |
@@ -2388,7 +2388,7 @@ static int b43_gphy_init_tssi2dbm_table(struct b43_wldev *dev) | |||
2388 | pab1 = (s16) (dev->dev->bus_sprom->pa0b1); | 2388 | pab1 = (s16) (dev->dev->bus_sprom->pa0b1); |
2389 | pab2 = (s16) (dev->dev->bus_sprom->pa0b2); | 2389 | pab2 = (s16) (dev->dev->bus_sprom->pa0b2); |
2390 | 2390 | ||
2391 | B43_WARN_ON((dev->sdev->bus->chip_id == 0x4301) && | 2391 | B43_WARN_ON((dev->dev->chip_id == 0x4301) && |
2392 | (phy->radio_ver != 0x2050)); /* Not supported anymore */ | 2392 | (phy->radio_ver != 0x2050)); /* Not supported anymore */ |
2393 | 2393 | ||
2394 | gphy->dyn_tssi_tbl = 0; | 2394 | gphy->dyn_tssi_tbl = 0; |
diff --git a/drivers/net/wireless/b43/phy_lp.c b/drivers/net/wireless/b43/phy_lp.c index 41d02810d6d2..bb78be319bd3 100644 --- a/drivers/net/wireless/b43/phy_lp.c +++ b/drivers/net/wireless/b43/phy_lp.c | |||
@@ -324,8 +324,8 @@ static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev) | |||
324 | b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_8, B43_LPPHY_TR_LOOKUP_4); | 324 | b43_phy_copy(dev, B43_LPPHY_TR_LOOKUP_8, B43_LPPHY_TR_LOOKUP_4); |
325 | } | 325 | } |
326 | if ((sprom->boardflags_hi & B43_BFH_FEM_BT) && | 326 | if ((sprom->boardflags_hi & B43_BFH_FEM_BT) && |
327 | (bus->chip_id == 0x5354) && | 327 | (dev->dev->chip_id == 0x5354) && |
328 | (bus->chip_package == SSB_CHIPPACK_BCM4712S)) { | 328 | (dev->dev->chip_pkg == SSB_CHIPPACK_BCM4712S)) { |
329 | b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006); | 329 | b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x0006); |
330 | b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005); | 330 | b43_phy_write(dev, B43_LPPHY_GPIO_SELECT, 0x0005); |
331 | b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0xFFFF); | 331 | b43_phy_write(dev, B43_LPPHY_GPIO_OUTEN, 0xFFFF); |
@@ -450,7 +450,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) | |||
450 | b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC1F, 0xA0); | 450 | b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFC1F, 0xA0); |
451 | b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300); | 451 | b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300); |
452 | b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00); | 452 | b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00); |
453 | if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { | 453 | if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { |
454 | b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100); | 454 | b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100); |
455 | b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xA); | 455 | b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xA); |
456 | } else { | 456 | } else { |
@@ -468,7 +468,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) | |||
468 | b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12); | 468 | b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12); |
469 | b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000); | 469 | b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000); |
470 | 470 | ||
471 | if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { | 471 | if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { |
472 | b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0); | 472 | b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0); |
473 | b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40); | 473 | b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40); |
474 | } | 474 | } |
@@ -493,7 +493,7 @@ static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev) | |||
493 | 0x2000 | ((u16)lpphy->rssi_gs << 10) | | 493 | 0x2000 | ((u16)lpphy->rssi_gs << 10) | |
494 | ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf); | 494 | ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf); |
495 | 495 | ||
496 | if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { | 496 | if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { |
497 | b43_phy_set(dev, B43_LPPHY_AFE_ADC_CTL_0, 0x1C); | 497 | b43_phy_set(dev, B43_LPPHY_AFE_ADC_CTL_0, 0x1C); |
498 | b43_phy_maskset(dev, B43_LPPHY_AFE_CTL, 0x00FF, 0x8800); | 498 | b43_phy_maskset(dev, B43_LPPHY_AFE_CTL, 0x00FF, 0x8800); |
499 | b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_1, 0xFC3C, 0x0400); | 499 | b43_phy_maskset(dev, B43_LPPHY_AFE_ADC_CTL_1, 0xFC3C, 0x0400); |
@@ -698,7 +698,7 @@ static void lpphy_radio_init(struct b43_wldev *dev) | |||
698 | lpphy_sync_stx(dev); | 698 | lpphy_sync_stx(dev); |
699 | b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80); | 699 | b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80); |
700 | b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0); | 700 | b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0); |
701 | if (dev->sdev->bus->chip_id == 0x4325) { | 701 | if (dev->dev->chip_id == 0x4325) { |
702 | // TODO SSB PMU recalibration | 702 | // TODO SSB PMU recalibration |
703 | } | 703 | } |
704 | } | 704 | } |
@@ -1841,7 +1841,6 @@ static void lpphy_papd_cal(struct b43_wldev *dev, struct lpphy_tx_gains gains, | |||
1841 | static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) | 1841 | static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) |
1842 | { | 1842 | { |
1843 | struct b43_phy_lp *lpphy = dev->phy.lp; | 1843 | struct b43_phy_lp *lpphy = dev->phy.lp; |
1844 | struct ssb_bus *bus = dev->sdev->bus; | ||
1845 | struct lpphy_tx_gains gains, oldgains; | 1844 | struct lpphy_tx_gains gains, oldgains; |
1846 | int old_txpctl, old_afe_ovr, old_rf, old_bbmult; | 1845 | int old_txpctl, old_afe_ovr, old_rf, old_bbmult; |
1847 | 1846 | ||
@@ -1855,7 +1854,7 @@ static void lpphy_papd_cal_txpwr(struct b43_wldev *dev) | |||
1855 | 1854 | ||
1856 | lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); | 1855 | lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF); |
1857 | 1856 | ||
1858 | if (bus->chip_id == 0x4325 && bus->chip_rev == 0) | 1857 | if (dev->dev->chip_id == 0x4325 && dev->dev->chip_rev == 0) |
1859 | lpphy_papd_cal(dev, gains, 0, 1, 30); | 1858 | lpphy_papd_cal(dev, gains, 0, 1, 30); |
1860 | else | 1859 | else |
1861 | lpphy_papd_cal(dev, gains, 0, 1, 65); | 1860 | lpphy_papd_cal(dev, gains, 0, 1, 65); |
@@ -1871,7 +1870,6 @@ static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx, | |||
1871 | bool rx, bool pa, struct lpphy_tx_gains *gains) | 1870 | bool rx, bool pa, struct lpphy_tx_gains *gains) |
1872 | { | 1871 | { |
1873 | struct b43_phy_lp *lpphy = dev->phy.lp; | 1872 | struct b43_phy_lp *lpphy = dev->phy.lp; |
1874 | struct ssb_bus *bus = dev->sdev->bus; | ||
1875 | const struct lpphy_rx_iq_comp *iqcomp = NULL; | 1873 | const struct lpphy_rx_iq_comp *iqcomp = NULL; |
1876 | struct lpphy_tx_gains nogains, oldgains; | 1874 | struct lpphy_tx_gains nogains, oldgains; |
1877 | u16 tmp; | 1875 | u16 tmp; |
@@ -1880,7 +1878,7 @@ static int lpphy_rx_iq_cal(struct b43_wldev *dev, bool noise, bool tx, | |||
1880 | memset(&nogains, 0, sizeof(nogains)); | 1878 | memset(&nogains, 0, sizeof(nogains)); |
1881 | memset(&oldgains, 0, sizeof(oldgains)); | 1879 | memset(&oldgains, 0, sizeof(oldgains)); |
1882 | 1880 | ||
1883 | if (bus->chip_id == 0x5354) { | 1881 | if (dev->dev->chip_id == 0x5354) { |
1884 | for (i = 0; i < ARRAY_SIZE(lpphy_5354_iq_table); i++) { | 1882 | for (i = 0; i < ARRAY_SIZE(lpphy_5354_iq_table); i++) { |
1885 | if (lpphy_5354_iq_table[i].chan == lpphy->channel) { | 1883 | if (lpphy_5354_iq_table[i].chan == lpphy->channel) { |
1886 | iqcomp = &lpphy_5354_iq_table[i]; | 1884 | iqcomp = &lpphy_5354_iq_table[i]; |
@@ -2409,11 +2407,9 @@ static const struct b206x_channel b2063_chantbl[] = { | |||
2409 | 2407 | ||
2410 | static void lpphy_b2062_reset_pll_bias(struct b43_wldev *dev) | 2408 | static void lpphy_b2062_reset_pll_bias(struct b43_wldev *dev) |
2411 | { | 2409 | { |
2412 | struct ssb_bus *bus = dev->sdev->bus; | ||
2413 | |||
2414 | b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0xFF); | 2410 | b43_radio_write(dev, B2062_S_RFPLL_CTL2, 0xFF); |
2415 | udelay(20); | 2411 | udelay(20); |
2416 | if (bus->chip_id == 0x5354) { | 2412 | if (dev->dev->chip_id == 0x5354) { |
2417 | b43_radio_write(dev, B2062_N_COMM1, 4); | 2413 | b43_radio_write(dev, B2062_N_COMM1, 4); |
2418 | b43_radio_write(dev, B2062_S_RFPLL_CTL2, 4); | 2414 | b43_radio_write(dev, B2062_S_RFPLL_CTL2, 4); |
2419 | } else { | 2415 | } else { |
diff --git a/drivers/net/wireless/b43/tables_lpphy.c b/drivers/net/wireless/b43/tables_lpphy.c index aa117550e6c0..6748c5a196e9 100644 --- a/drivers/net/wireless/b43/tables_lpphy.c +++ b/drivers/net/wireless/b43/tables_lpphy.c | |||
@@ -2304,7 +2304,6 @@ void lpphy_rev0_1_table_init(struct b43_wldev *dev) | |||
2304 | 2304 | ||
2305 | void lpphy_rev2plus_table_init(struct b43_wldev *dev) | 2305 | void lpphy_rev2plus_table_init(struct b43_wldev *dev) |
2306 | { | 2306 | { |
2307 | struct ssb_bus *bus = dev->sdev->bus; | ||
2308 | int i; | 2307 | int i; |
2309 | 2308 | ||
2310 | B43_WARN_ON(dev->phy.rev < 2); | 2309 | B43_WARN_ON(dev->phy.rev < 2); |
@@ -2341,7 +2340,7 @@ void lpphy_rev2plus_table_init(struct b43_wldev *dev) | |||
2341 | b43_lptab_write_bulk(dev, B43_LPTAB32(10, 0), | 2340 | b43_lptab_write_bulk(dev, B43_LPTAB32(10, 0), |
2342 | ARRAY_SIZE(lpphy_papd_mult_table), lpphy_papd_mult_table); | 2341 | ARRAY_SIZE(lpphy_papd_mult_table), lpphy_papd_mult_table); |
2343 | 2342 | ||
2344 | if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) { | 2343 | if ((dev->dev->chip_id == 0x4325) && (dev->dev->chip_rev == 0)) { |
2345 | b43_lptab_write_bulk(dev, B43_LPTAB32(13, 0), | 2344 | b43_lptab_write_bulk(dev, B43_LPTAB32(13, 0), |
2346 | ARRAY_SIZE(lpphy_a0_gain_idx_table), lpphy_a0_gain_idx_table); | 2345 | ARRAY_SIZE(lpphy_a0_gain_idx_table), lpphy_a0_gain_idx_table); |
2347 | b43_lptab_write_bulk(dev, B43_LPTAB16(14, 0), | 2346 | b43_lptab_write_bulk(dev, B43_LPTAB16(14, 0), |