2010-01-17 22:37:47

by Rafał Miłecki

[permalink] [raw]
Subject: [PATCH 1/4] b43: N-PHY: add writing one element tables


Signed-off-by: Rafał Miłecki <[email protected]>
---
drivers/net/wireless/b43/phy_n.c | 51 ++++++++++++-------------------------
1 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 141d4ed..31eba7d 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -808,8 +808,7 @@ static void b43_nphy_stop_playback(struct b43_wldev *dev)

if (nphy->bb_mult_save & 0x80000000) {
tmp = nphy->bb_mult_save & 0xFFFF;
- /* TODO: Write an N PHY Table with ID 15, length 1, offset 87,
- width 16 and data from tmp */
+ b43_ntab_write(dev, B43_NTAB16(15, 87), tmp);
nphy->bb_mult_save = 0;
}

@@ -1486,13 +1485,11 @@ static void b43_nphy_update_tx_cal_ladder(struct b43_wldev *dev, u16 core)
for (i = 0; i < 18; i++) {
scale = (ladder_lo[i].percent * tmp) / 100;
entry = ((scale & 0xFF) << 8) | ladder_lo[i].g_env;
- /* TODO: Write an N PHY Table with ID 15, length 1,
- offset i, width 16, and data entry */
+ b43_ntab_write(dev, B43_NTAB16(15, i), entry);

scale = (ladder_iq[i].percent * tmp) / 100;
entry = ((scale & 0xFF) << 8) | ladder_iq[i].g_env;
- /* TODO: Write an N PHY Table with ID 15, length 1,
- offset i + 32, width 16, and data entry */
+ b43_ntab_write(dev, B43_NTAB16(15, i + 32), entry);
}
}

@@ -1590,10 +1587,8 @@ static void b43_nphy_tx_cal_phy_cleanup(struct b43_wldev *dev)
b43_phy_write(dev, B43_NPHY_AFECTL_OVER1, regs[2]);
b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[3]);
b43_phy_write(dev, B43_NPHY_BBCFG, regs[4]);
- /* TODO: Write an N PHY Table with ID 8, length 1, offset 3,
- width 16, and data from regs[5] */
- /* TODO: Write an N PHY Table with ID 8, length 1, offset 19,
- width 16, and data from regs[6] */
+ b43_ntab_write(dev, B43_NTAB16(8, 3), regs[5]);
+ b43_ntab_write(dev, B43_NTAB16(8, 19), regs[6]);
b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[7]);
b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[8]);
b43_phy_write(dev, B43_NPHY_PAPD_EN0, regs[9]);
@@ -1603,10 +1598,8 @@ static void b43_nphy_tx_cal_phy_cleanup(struct b43_wldev *dev)
b43_phy_maskset(dev, B43_NPHY_AFECTL_C1, 0x0FFF, regs[0]);
b43_phy_maskset(dev, B43_NPHY_AFECTL_C2, 0x0FFF, regs[1]);
b43_phy_write(dev, B43_NPHY_AFECTL_OVER, regs[2]);
- /* TODO: Write an N PHY Table with ID 8, length 1, offset 2,
- width 16, and data from regs[3] */
- /* TODO: Write an N PHY Table with ID 8, length 1, offset 18,
- width 16, and data from regs[4] */
+ b43_ntab_write(dev, B43_NTAB16(8, 2), regs[3]);
+ b43_ntab_write(dev, B43_NTAB16(8, 18), regs[4]);
b43_phy_write(dev, B43_NPHY_RFCTL_INTC1, regs[5]);
b43_phy_write(dev, B43_NPHY_RFCTL_INTC2, regs[6]);
}
@@ -1638,15 +1631,10 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
/* TODO: Read an N PHY Table with ID 8, length 1, offset 3,
width 16, and data pointing to tmp */
regs[5] = tmp;
-
- /* TODO: Write an N PHY Table with ID 8, length 1, offset 3,
- width 16, and data 0 */
- /* TODO: Read an N PHY Table with ID 8, length 1, offset 19,
- width 16, and data pointing to tmp */
+ b43_ntab_write(dev, B43_NTAB16(8, 3), 0);
+ b43_ntab_write(dev, B43_NTAB16(8, 19), tmp);
regs[6] = tmp;
-
- /* TODO: Write an N PHY Table with ID 8, length 1, offset 19,
- width 16, and data 0 */
+ b43_ntab_write(dev, B43_NTAB16(8, 19), 0);
regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
regs[8] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);

@@ -1668,14 +1656,11 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
width 16, and data pointing to tmp */
regs[3] = tmp;
tmp |= 0x2000;
- /* TODO: Write an N PHY Table with ID 8, length 1, offset 2,
- width 16, and data pointer tmp */
- /* TODO: Read an N PHY Table with ID 8, length 1, offset 18,
- width 16, and data pointer tmp */
+ b43_ntab_write(dev, B43_NTAB16(8, 2), tmp);
+ b43_ntab_write(dev, B43_NTAB16(8, 18), tmp);
regs[4] = tmp;
tmp |= 0x2000;
- /* TODO: Write an N PHY Table with ID 8, length 1, offset 18,
- width 16, and data pointer tmp */
+ b43_ntab_write(dev, B43_NTAB16(8, 18), tmp);
regs[5] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
regs[6] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC2);
if (b43_current_band(dev->wl) == IEEE80211_BAND_5GHZ)
@@ -1895,14 +1880,12 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDNNUM, tmp);

if (type == 1 || type == 3 || type == 4) {
- /* TODO: Read an N PHY Table with ID 15,
- length 1, offset 69 + core,
- width 16, and data pointer buffer */
+ b43_ntab_write(dev, B43_NTAB16(15, 69 + core),
+ buffer[0]);
diq_start = buffer[0];
buffer[0] = 0;
- /* TODO: Write an N PHY Table with ID 15,
- length 1, offset 69 + core, width 16,
- and data of 0 */
+ b43_ntab_write(dev, B43_NTAB16(15, 69 + core),
+ 0);
}

b43_phy_write(dev, B43_NPHY_IQLOCAL_CMD, cmd);
--
1.6.4.2



2010-01-17 22:46:07

by Michael Büsch

[permalink] [raw]
Subject: Re: [PATCH 1/4] b43: N-PHY: add writing one element tables

On Sunday 17 January 2010 23:37:50 Rafał Miłecki wrote:
> @@ -1895,14 +1880,12 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
> b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDNNUM, tmp);
>
> if (type == 1 || type == 3 || type == 4) {
> - /* TODO: Read an N PHY Table with ID 15,
> - length 1, offset 69 + core,
> - width 16, and data pointer buffer */
> + b43_ntab_write(dev, B43_NTAB16(15, 69 + core),
> + buffer[0]);
> diq_start = buffer[0];
> buffer[0] = 0;
> - /* TODO: Write an N PHY Table with ID 15,
> - length 1, offset 69 + core, width 16,
> - and data of 0 */
> + b43_ntab_write(dev, B43_NTAB16(15, 69 + core),
> + 0);
> }
>
> b43_phy_write(dev, B43_NPHY_IQLOCAL_CMD, cmd);

What is this supposed to do? It writes a value to a table entry and immediately
clobbers the entry with 0. This doesn't make any sense.

--
Greetings, Michael.

2010-01-17 22:59:27

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 1/4] b43: N-PHY: add writing one element tables

VyBkbml1IDE3IHN0eWN6bmlhIDIwMTAgMjM6NDUgdcW8eXRrb3duaWsgTWljaGFlbCBCdWVzY2gg
PG1iQGJ1M3NjaC5kZT4gbmFwaXNhxYI6Cj4gT24gU3VuZGF5IDE3IEphbnVhcnkgMjAxMCAyMzoz
Nzo1MCBSYWZhxYIgTWnFgmVja2kgd3JvdGU6Cj4+IEBAIC0xODk1LDE0ICsxODgwLDEyIEBAIHN0
YXRpYyBpbnQgYjQzX25waHlfY2FsX3R4X2lxX2xvKHN0cnVjdCBiNDNfd2xkZXYgKmRldiwKPj4g
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgYjQzX3BoeV93cml0ZShkZXYsIEI0M19O
UEhZX0lRTE9DQUxfQ01ETk5VTSwgdG1wKTsKPj4KPj4gwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgwqAgwqAgaWYgKHR5cGUgPT0gMSB8fCB0eXBlID09IDMgfHwgdHlwZSA9PSA0KSB7Cj4+IC0g
wqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqAgLyogV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