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

b43: N-PHY: implement and add reading one element tables

Signed-off-by: default avatarRafał Miłecki <zajec5@gmail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2581b143
...@@ -1628,12 +1628,11 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev) ...@@ -1628,12 +1628,11 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
regs[4] = b43_phy_read(dev, B43_NPHY_BBCFG); regs[4] = b43_phy_read(dev, B43_NPHY_BBCFG);
b43_phy_mask(dev, B43_NPHY_BBCFG, ~B43_NPHY_BBCFG_RSTRX); b43_phy_mask(dev, B43_NPHY_BBCFG, ~B43_NPHY_BBCFG_RSTRX);
/* TODO: Read an N PHY Table with ID 8, length 1, offset 3, tmp = b43_ntab_read(dev, B43_NTAB16(8, 3));
width 16, and data pointing to tmp */
regs[5] = tmp; regs[5] = tmp;
b43_ntab_write(dev, B43_NTAB16(8, 3), 0); b43_ntab_write(dev, B43_NTAB16(8, 3), 0);
/* TODO: Read an N PHY Table with ID 8, length 1, offset 19,
width 16, and data pointing to tmp */ tmp = b43_ntab_read(dev, B43_NTAB16(8, 19));
regs[6] = tmp; regs[6] = tmp;
b43_ntab_write(dev, B43_NTAB16(8, 19), 0); b43_ntab_write(dev, B43_NTAB16(8, 19), 0);
regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1);
...@@ -1653,13 +1652,11 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev) ...@@ -1653,13 +1652,11 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
regs[2] = tmp; regs[2] = tmp;
b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x3000); b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x3000);
/* TODO: Read an N PHY Table with ID 8, length 1, offset 2, tmp = b43_ntab_read(dev, B43_NTAB16(8, 2));
width 16, and data pointing to tmp */
regs[3] = tmp; regs[3] = tmp;
tmp |= 0x2000; tmp |= 0x2000;
b43_ntab_write(dev, B43_NTAB16(8, 2), tmp); b43_ntab_write(dev, B43_NTAB16(8, 2), tmp);
/* TODO: Read an N PHY Table with ID 8, length 1, offset 18, tmp = b43_ntab_read(dev, B43_NTAB16(8, 18));
width 16, and data pointer tmp */
regs[4] = tmp; regs[4] = tmp;
tmp |= 0x2000; tmp |= 0x2000;
b43_ntab_write(dev, B43_NTAB16(8, 18), tmp); b43_ntab_write(dev, B43_NTAB16(8, 18), tmp);
...@@ -1877,9 +1874,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev, ...@@ -1877,9 +1874,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDNNUM, tmp); b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDNNUM, tmp);
if (type == 1 || type == 3 || type == 4) { if (type == 1 || type == 3 || type == 4) {
/* TODO: Read an N PHY Table with ID 15, buffer[0] = b43_ntab_read(dev,
length 1, offset 69 + core, B43_NTAB16(15, 69 + core));
width 16, and data pointer buffer */
diq_start = buffer[0]; diq_start = buffer[0];
buffer[0] = 0; buffer[0] = 0;
b43_ntab_write(dev, B43_NTAB16(15, 69 + core), b43_ntab_write(dev, B43_NTAB16(15, 69 + core),
......
...@@ -2919,6 +2919,37 @@ static inline void assert_ntab_array_sizes(void) ...@@ -2919,6 +2919,37 @@ static inline void assert_ntab_array_sizes(void)
#undef check #undef check
} }
u32 b43_ntab_read(struct b43_wldev *dev, u32 offset)
{
u32 type, value;
type = offset & B43_NTAB_TYPEMASK;
offset &= ~B43_NTAB_TYPEMASK;
B43_WARN_ON(offset > 0xFFFF);
switch (type) {
case B43_NTAB_8BIT:
b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset);
value = b43_phy_read(dev, B43_NPHY_TABLE_DATALO) & 0xFF;
break;
case B43_NTAB_16BIT:
b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset);
value = b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
break;
case B43_NTAB_32BIT:
b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset);
value = b43_phy_read(dev, B43_NPHY_TABLE_DATAHI);
value <<= 16;
value |= b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
break;
default:
B43_WARN_ON(1);
value = 0;
}
return value;
}
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;
......
...@@ -142,6 +142,7 @@ b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel); ...@@ -142,6 +142,7 @@ b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel);
#define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL 10 #define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL 10
#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);
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