Commit 9145834e authored by Rafał Miłecki's avatar Rafał Miłecki Committed by John W. Linville

b43: N-PHY: implement and add multi-dimensional table reading

Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent c643a66e
...@@ -829,8 +829,7 @@ static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev) ...@@ -829,8 +829,7 @@ static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
if (nphy->hang_avoid) if (nphy->hang_avoid)
b43_nphy_stay_in_carrier_search(dev, true); b43_nphy_stay_in_carrier_search(dev, true);
/* TODO: Read an N PHY Table with ID 15, length 7, offset 80, b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer);
width 16, and data pointer buffer */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
tmp = ((buffer[i * 2] & 0x3FF) << 10) | tmp = ((buffer[i * 2] & 0x3FF) << 10) |
...@@ -1507,8 +1506,7 @@ static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev) ...@@ -1507,8 +1506,7 @@ static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
if (nphy->hang_avoid) if (nphy->hang_avoid)
b43_nphy_stay_in_carrier_search(dev, true); b43_nphy_stay_in_carrier_search(dev, true);
/* TODO: Read an N PHY Table with ID 7, length 2, b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, curr_gain);
offset 0x110, width 16, and curr_gain */
if (nphy->hang_avoid) if (nphy->hang_avoid)
b43_nphy_stay_in_carrier_search(dev, false); b43_nphy_stay_in_carrier_search(dev, false);
...@@ -1768,8 +1766,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -1768,8 +1766,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
nphy->hang_avoid = 0; nphy->hang_avoid = 0;
} }
/* TODO: Read an N PHY Table with ID 7, length 2, offset 0x110, b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, save);
width 16, and data pointer save */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
b43_nphy_iq_cal_gain_params(dev, i, target, &params[i]); b43_nphy_iq_cal_gain_params(dev, i, target, &params[i]);
...@@ -1890,9 +1887,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -1890,9 +1887,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
udelay(10); udelay(10);
} }
/* TODO: Read an N PHY Table with ID 15, b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length,
length table_length, offset 96, width 16, buffer);
and data pointer buffer */
b43_ntab_write_bulk(dev, B43_NTAB16(15, 64), length, b43_ntab_write_bulk(dev, B43_NTAB16(15, 64), length,
buffer); buffer);
...@@ -1907,8 +1903,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -1907,8 +1903,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
if (!mphase || nphy->mphase_cal_phase_id == last) { if (!mphase || nphy->mphase_cal_phase_id == last) {
b43_ntab_write_bulk(dev, B43_NTAB16(15, 96), 4, buffer); b43_ntab_write_bulk(dev, B43_NTAB16(15, 96), 4, buffer);
/* TODO: Read an N PHY Table with ID 15, length 4, b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 4, buffer);
offset 80, width 16, and data pointer buffer */
if (dev->phy.rev < 3) { if (dev->phy.rev < 3) {
buffer[0] = 0; buffer[0] = 0;
buffer[1] = 0; buffer[1] = 0;
...@@ -1926,9 +1921,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -1926,9 +1921,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
length = 11; length = 11;
if (dev->phy.rev < 3) if (dev->phy.rev < 3)
length -= 2; length -= 2;
/* TODO: Read an N PHY Table with ID 15, length length, b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length,
offset 96, width 16, and data pointer nphy->txiqlocal_bestc);
nphy->txiqlocal_bestc */
nphy->txiqlocal_coeffsvalid = true; nphy->txiqlocal_coeffsvalid = true;
/* TODO: Set nphy->txiqlocal_chanspec to /* TODO: Set nphy->txiqlocal_chanspec to
the current channel */ the current channel */
...@@ -1936,9 +1930,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -1936,9 +1930,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
length = 11; length = 11;
if (dev->phy.rev < 3) if (dev->phy.rev < 3)
length -= 2; length -= 2;
/* TODO: Read an N PHY Table with ID 5, length length, b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length,
offset 96, width 16, and data pointer nphy->mphase_txcal_bestcoeffs);
nphy->mphase_txcal_bestcoeffs */
} }
b43_nphy_stop_playback(dev); b43_nphy_stop_playback(dev);
...@@ -1990,8 +1983,7 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev, ...@@ -1990,8 +1983,7 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
if (dev->phy.rev < 2) if (dev->phy.rev < 2)
;/* TODO: Call N PHY Reapply TX Cal Coeffs */ ;/* TODO: Call N PHY Reapply TX Cal Coeffs */
/* TODO: Read an N PHY Table with ID 7, length 2, offset 0x110, b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save);
width 16, and data gain_save */
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
b43_nphy_iq_cal_gain_params(dev, i, target, &cal_params[i]); b43_nphy_iq_cal_gain_params(dev, i, target, &cal_params[i]);
cal_gain[i] = cal_params[i].cal_gain; cal_gain[i] = cal_params[i].cal_gain;
......
...@@ -2950,6 +2950,41 @@ u32 b43_ntab_read(struct b43_wldev *dev, u32 offset) ...@@ -2950,6 +2950,41 @@ u32 b43_ntab_read(struct b43_wldev *dev, u32 offset)
return value; return value;
} }
void b43_ntab_read_bulk(struct b43_wldev *dev, u32 offset,
unsigned int nr_elements, void *_data)
{
u32 type;
u8 *data = _data;
unsigned int i;
type = offset & B43_NTAB_TYPEMASK;
offset &= ~B43_NTAB_TYPEMASK;
B43_WARN_ON(offset > 0xFFFF);
b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset);
for (i = 0; i < nr_elements; i++) {
switch (type) {
case B43_NTAB_8BIT:
*data = b43_phy_read(dev, B43_NPHY_TABLE_DATALO) & 0xFF;
data++;
break;
case B43_NTAB_16BIT:
*((u16 *)data) = b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
data += 2;
break;
case B43_NTAB_32BIT:
*((u32 *)data) = b43_phy_read(dev, B43_NPHY_TABLE_DATAHI);
*((u32 *)data) <<= 16;
*((u32 *)data) |= b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
data += 4;
break;
default:
B43_WARN_ON(1);
}
}
}
void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value) void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value)
{ {
u32 type; u32 type;
......
...@@ -143,6 +143,8 @@ b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel); ...@@ -143,6 +143,8 @@ b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel);
#define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3 12 #define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3 12
u32 b43_ntab_read(struct b43_wldev *dev, u32 offset); u32 b43_ntab_read(struct b43_wldev *dev, u32 offset);
void b43_ntab_read_bulk(struct b43_wldev *dev, u32 offset,
unsigned int nr_elements, void *_data);
void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value); void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value);
void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset, void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset,
unsigned int nr_elements, const void *_data); unsigned int nr_elements, const void *_data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment