aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/b43legacy/phy.c
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2007-11-09 17:57:34 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:04:43 -0500
commit7797aa384870e3bb5bfd3b6a0eae61e7c7a4c993 (patch)
tree9d48b112dc1c973a17860fe39e82554724f7ed4b /drivers/net/wireless/b43legacy/phy.c
parent95de2841aad971867851b59c0c5253ecc2e19832 (diff)
b43legacy: Convert to use of the new SPROM structure
The b43legacy driver is modified to use the new SPROM structure. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/b43legacy/phy.c')
-rw-r--r--drivers/net/wireless/b43legacy/phy.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/drivers/net/wireless/b43legacy/phy.c b/drivers/net/wireless/b43legacy/phy.c
index d121fae53aa0..9d527e6d6ced 100644
--- a/drivers/net/wireless/b43legacy/phy.c
+++ b/drivers/net/wireless/b43legacy/phy.c
@@ -441,7 +441,7 @@ static void b43legacy_phy_inita(struct b43legacy_wldev *dev)
441 might_sleep(); 441 might_sleep();
442 442
443 b43legacy_phy_setupg(dev); 443 b43legacy_phy_setupg(dev);
444 if (dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_PACTRL) 444 if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_PACTRL)
445 b43legacy_phy_write(dev, 0x046E, 0x03CF); 445 b43legacy_phy_write(dev, 0x046E, 0x03CF);
446} 446}
447 447
@@ -543,7 +543,7 @@ static void b43legacy_phy_initb4(struct b43legacy_wldev *dev)
543 if (phy->radio_ver == 0x2050) 543 if (phy->radio_ver == 0x2050)
544 b43legacy_phy_write(dev, 0x002A, 0x88C2); 544 b43legacy_phy_write(dev, 0x002A, 0x88C2);
545 b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF); 545 b43legacy_radio_set_txpower_bg(dev, 0xFFFF, 0xFFFF, 0xFFFF);
546 if (dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_RSSI) { 546 if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI) {
547 b43legacy_calc_nrssi_slope(dev); 547 b43legacy_calc_nrssi_slope(dev);
548 b43legacy_calc_nrssi_threshold(dev); 548 b43legacy_calc_nrssi_threshold(dev);
549 } 549 }
@@ -699,7 +699,7 @@ static void b43legacy_phy_initb6(struct b43legacy_wldev *dev)
699 b43legacy_radio_write16(dev, 0x005A, 0x0088); 699 b43legacy_radio_write16(dev, 0x005A, 0x0088);
700 b43legacy_radio_write16(dev, 0x005B, 0x006B); 700 b43legacy_radio_write16(dev, 0x005B, 0x006B);
701 b43legacy_radio_write16(dev, 0x005C, 0x000F); 701 b43legacy_radio_write16(dev, 0x005C, 0x000F);
702 if (dev->dev->bus->sprom.r1.boardflags_lo & 0x8000) { 702 if (dev->dev->bus->sprom.boardflags_lo & 0x8000) {
703 b43legacy_radio_write16(dev, 0x005D, 0x00FA); 703 b43legacy_radio_write16(dev, 0x005D, 0x00FA);
704 b43legacy_radio_write16(dev, 0x005E, 0x00D8); 704 b43legacy_radio_write16(dev, 0x005E, 0x00D8);
705 } else { 705 } else {
@@ -797,7 +797,7 @@ static void b43legacy_phy_initb6(struct b43legacy_wldev *dev)
797 b43legacy_phy_write(dev, 0x0062, 0x0007); 797 b43legacy_phy_write(dev, 0x0062, 0x0007);
798 b43legacy_radio_init2050(dev); 798 b43legacy_radio_init2050(dev);
799 b43legacy_phy_lo_g_measure(dev); 799 b43legacy_phy_lo_g_measure(dev);
800 if (dev->dev->bus->sprom.r1.boardflags_lo & 800 if (dev->dev->bus->sprom.boardflags_lo &
801 B43legacy_BFL_RSSI) { 801 B43legacy_BFL_RSSI) {
802 b43legacy_calc_nrssi_slope(dev); 802 b43legacy_calc_nrssi_slope(dev);
803 b43legacy_calc_nrssi_threshold(dev); 803 b43legacy_calc_nrssi_threshold(dev);
@@ -921,7 +921,7 @@ static void b43legacy_calc_loopback_gain(struct b43legacy_wldev *dev)
921 b43legacy_phy_read(dev, 0x0811) | 0x0100); 921 b43legacy_phy_read(dev, 0x0811) | 0x0100);
922 b43legacy_phy_write(dev, 0x0812, 922 b43legacy_phy_write(dev, 0x0812,
923 b43legacy_phy_read(dev, 0x0812) & 0xCFFF); 923 b43legacy_phy_read(dev, 0x0812) & 0xCFFF);
924 if (dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_EXTLNA) { 924 if (dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_EXTLNA) {
925 if (phy->rev >= 7) { 925 if (phy->rev >= 7) {
926 b43legacy_phy_write(dev, 0x0811, 926 b43legacy_phy_write(dev, 0x0811,
927 b43legacy_phy_read(dev, 0x0811) 927 b43legacy_phy_read(dev, 0x0811)
@@ -1072,7 +1072,7 @@ static void b43legacy_phy_initg(struct b43legacy_wldev *dev)
1072 b43legacy_phy_write(dev, 0x0036, 1072 b43legacy_phy_write(dev, 0x0036,
1073 (b43legacy_phy_read(dev, 0x0036) 1073 (b43legacy_phy_read(dev, 0x0036)
1074 & 0x0FFF) | (phy->txctl2 << 12)); 1074 & 0x0FFF) | (phy->txctl2 << 12));
1075 if (dev->dev->bus->sprom.r1.boardflags_lo & 1075 if (dev->dev->bus->sprom.boardflags_lo &
1076 B43legacy_BFL_PACTRL) 1076 B43legacy_BFL_PACTRL)
1077 b43legacy_phy_write(dev, 0x002E, 0x8075); 1077 b43legacy_phy_write(dev, 0x002E, 0x8075);
1078 else 1078 else
@@ -1087,7 +1087,7 @@ static void b43legacy_phy_initg(struct b43legacy_wldev *dev)
1087 b43legacy_phy_write(dev, 0x080F, 0x8078); 1087 b43legacy_phy_write(dev, 0x080F, 0x8078);
1088 } 1088 }
1089 1089
1090 if (!(dev->dev->bus->sprom.r1.boardflags_lo & B43legacy_BFL_RSSI)) { 1090 if (!(dev->dev->bus->sprom.boardflags_lo & B43legacy_BFL_RSSI)) {
1091 /* The specs state to update the NRSSI LT with 1091 /* The specs state to update the NRSSI LT with
1092 * the value 0x7FFFFFFF here. I think that is some weird 1092 * the value 0x7FFFFFFF here. I think that is some weird
1093 * compiler optimization in the original driver. 1093 * compiler optimization in the original driver.
@@ -1838,9 +1838,9 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev)
1838 1838
1839 estimated_pwr = b43legacy_phy_estimate_power_out(dev, average); 1839 estimated_pwr = b43legacy_phy_estimate_power_out(dev, average);
1840 1840
1841 max_pwr = dev->dev->bus->sprom.r1.maxpwr_bg; 1841 max_pwr = dev->dev->bus->sprom.maxpwr_bg;
1842 1842
1843 if ((dev->dev->bus->sprom.r1.boardflags_lo 1843 if ((dev->dev->bus->sprom.boardflags_lo
1844 & B43legacy_BFL_PACTRL) && 1844 & B43legacy_BFL_PACTRL) &&
1845 (phy->type == B43legacy_PHYTYPE_G)) 1845 (phy->type == B43legacy_PHYTYPE_G))
1846 max_pwr -= 0x3; 1846 max_pwr -= 0x3;
@@ -1848,7 +1848,7 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev)
1848 b43legacywarn(dev->wl, "Invalid max-TX-power value in SPROM." 1848 b43legacywarn(dev->wl, "Invalid max-TX-power value in SPROM."
1849 "\n"); 1849 "\n");
1850 max_pwr = 74; /* fake it */ 1850 max_pwr = 74; /* fake it */
1851 dev->dev->bus->sprom.r1.maxpwr_bg = max_pwr; 1851 dev->dev->bus->sprom.maxpwr_bg = max_pwr;
1852 } 1852 }
1853 1853
1854 /* Use regulatory information to get the maximum power. 1854 /* Use regulatory information to get the maximum power.
@@ -1858,7 +1858,8 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev)
1858 * and 1.5 dBm (a safety factor??). The result is in Q5.2 format 1858 * and 1.5 dBm (a safety factor??). The result is in Q5.2 format
1859 * which accounts for the factor of 4 */ 1859 * which accounts for the factor of 4 */
1860#define REG_MAX_PWR 20 1860#define REG_MAX_PWR 20
1861 max_pwr = min(REG_MAX_PWR * 4 - dev->dev->bus->sprom.r1.antenna_gain_bg 1861 max_pwr = min(REG_MAX_PWR * 4
1862 - dev->dev->bus->sprom.antenna_gain_bg
1862 - 0x6, max_pwr); 1863 - 0x6, max_pwr);
1863 1864
1864 /* find the desired power in Q5.2 - power_level is in dBm 1865 /* find the desired power in Q5.2 - power_level is in dBm
@@ -1918,7 +1919,7 @@ void b43legacy_phy_xmitpower(struct b43legacy_wldev *dev)
1918 txpower = 3; 1919 txpower = 3;
1919 radio_attenuation += 2; 1920 radio_attenuation += 2;
1920 baseband_attenuation += 2; 1921 baseband_attenuation += 2;
1921 } else if (dev->dev->bus->sprom.r1.boardflags_lo 1922 } else if (dev->dev->bus->sprom.boardflags_lo
1922 & B43legacy_BFL_PACTRL) { 1923 & B43legacy_BFL_PACTRL) {
1923 baseband_attenuation += 4 * 1924 baseband_attenuation += 4 *
1924 (radio_attenuation - 2); 1925 (radio_attenuation - 2);
@@ -2000,9 +2001,9 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev)
2000 2001
2001 B43legacy_WARN_ON(!(phy->type == B43legacy_PHYTYPE_B || 2002 B43legacy_WARN_ON(!(phy->type == B43legacy_PHYTYPE_B ||
2002 phy->type == B43legacy_PHYTYPE_G)); 2003 phy->type == B43legacy_PHYTYPE_G));
2003 pab0 = (s16)(dev->dev->bus->sprom.r1.pa0b0); 2004 pab0 = (s16)(dev->dev->bus->sprom.pa0b0);
2004 pab1 = (s16)(dev->dev->bus->sprom.r1.pa0b1); 2005 pab1 = (s16)(dev->dev->bus->sprom.pa0b1);
2005 pab2 = (s16)(dev->dev->bus->sprom.r1.pa0b2); 2006 pab2 = (s16)(dev->dev->bus->sprom.pa0b2);
2006 2007
2007 if ((dev->dev->bus->chip_id == 0x4301) && (phy->radio_ver != 0x2050)) { 2008 if ((dev->dev->bus->chip_id == 0x4301) && (phy->radio_ver != 0x2050)) {
2008 phy->idle_tssi = 0x34; 2009 phy->idle_tssi = 0x34;
@@ -2013,9 +2014,10 @@ int b43legacy_phy_init_tssi2dbm_table(struct b43legacy_wldev *dev)
2013 if (pab0 != 0 && pab1 != 0 && pab2 != 0 && 2014 if (pab0 != 0 && pab1 != 0 && pab2 != 0 &&
2014 pab0 != -1 && pab1 != -1 && pab2 != -1) { 2015 pab0 != -1 && pab1 != -1 && pab2 != -1) {
2015 /* The pabX values are set in SPROM. Use them. */ 2016 /* The pabX values are set in SPROM. Use them. */
2016 if ((s8)dev->dev->bus->sprom.r1.itssi_bg != 0 && 2017 if ((s8)dev->dev->bus->sprom.itssi_bg != 0 &&
2017 (s8)dev->dev->bus->sprom.r1.itssi_bg != -1) 2018 (s8)dev->dev->bus->sprom.itssi_bg != -1)
2018 phy->idle_tssi = (s8)(dev->dev->bus->sprom.r1.itssi_bg); 2019 phy->idle_tssi = (s8)(dev->dev->bus->sprom.
2020 itssi_bg);
2019 else 2021 else
2020 phy->idle_tssi = 62; 2022 phy->idle_tssi = 62;
2021 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL); 2023 dyn_tssi2dbm = kmalloc(64, GFP_KERNEL);