aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2010-01-17 18:21:27 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-19 16:46:36 -0500
commitc643a66ef5ccfd4d359327fb8afa9949f1abbfdd (patch)
treef0c787853ed3f0efbc0820c82c3e517c3e257d85 /drivers/net/wireless
parent2581b1434ccba6960e0b671927d87c83b5152c9d (diff)
b43: N-PHY: implement and add reading one element tables
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/b43/phy_n.c18
-rw-r--r--drivers/net/wireless/b43/tables_nphy.c31
-rw-r--r--drivers/net/wireless/b43/tables_nphy.h1
3 files changed, 39 insertions, 11 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 671fbcfdc0ec..7eac0ae2b15e 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -1628,12 +1628,11 @@ static void b43_nphy_tx_cal_phy_setup(struct b43_wldev *dev)
1628 regs[4] = b43_phy_read(dev, B43_NPHY_BBCFG); 1628 regs[4] = b43_phy_read(dev, B43_NPHY_BBCFG);
1629 b43_phy_mask(dev, B43_NPHY_BBCFG, ~B43_NPHY_BBCFG_RSTRX); 1629 b43_phy_mask(dev, B43_NPHY_BBCFG, ~B43_NPHY_BBCFG_RSTRX);
1630 1630
1631 /* TODO: Read an N PHY Table with ID 8, length 1, offset 3, 1631 tmp = b43_ntab_read(dev, B43_NTAB16(8, 3));
1632 width 16, and data pointing to tmp */
1633 regs[5] = tmp; 1632 regs[5] = tmp;
1634 b43_ntab_write(dev, B43_NTAB16(8, 3), 0); 1633 b43_ntab_write(dev, B43_NTAB16(8, 3), 0);
1635 /* TODO: Read an N PHY Table with ID 8, length 1, offset 19, 1634
1636 width 16, and data pointing to tmp */ 1635 tmp = b43_ntab_read(dev, B43_NTAB16(8, 19));
1637 regs[6] = tmp; 1636 regs[6] = tmp;
1638 b43_ntab_write(dev, B43_NTAB16(8, 19), 0); 1637 b43_ntab_write(dev, B43_NTAB16(8, 19), 0);
1639 regs[7] = b43_phy_read(dev, B43_NPHY_RFCTL_INTC1); 1638 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 tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER); 1652 tmp = b43_phy_read(dev, B43_NPHY_AFECTL_OVER);
1654 regs[2] = tmp; 1653 regs[2] = tmp;
1655 b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x3000); 1654 b43_phy_write(dev, B43_NPHY_AFECTL_OVER, tmp | 0x3000);
1656 /* TODO: Read an N PHY Table with ID 8, length 1, offset 2, 1655 tmp = b43_ntab_read(dev, B43_NTAB16(8, 2));
1657 width 16, and data pointing to tmp */
1658 regs[3] = tmp; 1656 regs[3] = tmp;
1659 tmp |= 0x2000; 1657 tmp |= 0x2000;
1660 b43_ntab_write(dev, B43_NTAB16(8, 2), tmp); 1658 b43_ntab_write(dev, B43_NTAB16(8, 2), tmp);
1661 /* TODO: Read an N PHY Table with ID 8, length 1, offset 18, 1659 tmp = b43_ntab_read(dev, B43_NTAB16(8, 18));
1662 width 16, and data pointer tmp */
1663 regs[4] = tmp; 1660 regs[4] = tmp;
1664 tmp |= 0x2000; 1661 tmp |= 0x2000;
1665 b43_ntab_write(dev, B43_NTAB16(8, 18), tmp); 1662 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 b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDNNUM, tmp); 1874 b43_phy_write(dev, B43_NPHY_IQLOCAL_CMDNNUM, tmp);
1878 1875
1879 if (type == 1 || type == 3 || type == 4) { 1876 if (type == 1 || type == 3 || type == 4) {
1880 /* TODO: Read an N PHY Table with ID 15, 1877 buffer[0] = b43_ntab_read(dev,
1881 length 1, offset 69 + core, 1878 B43_NTAB16(15, 69 + core));
1882 width 16, and data pointer buffer */
1883 diq_start = buffer[0]; 1879 diq_start = buffer[0];
1884 buffer[0] = 0; 1880 buffer[0] = 0;
1885 b43_ntab_write(dev, B43_NTAB16(15, 69 + core), 1881 b43_ntab_write(dev, B43_NTAB16(15, 69 + core),
diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index fc08be0b976e..b8aed456da1f 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -2919,6 +2919,37 @@ static inline void assert_ntab_array_sizes(void)
2919#undef check 2919#undef check
2920} 2920}
2921 2921
2922u32 b43_ntab_read(struct b43_wldev *dev, u32 offset)
2923{
2924 u32 type, value;
2925
2926 type = offset & B43_NTAB_TYPEMASK;
2927 offset &= ~B43_NTAB_TYPEMASK;
2928 B43_WARN_ON(offset > 0xFFFF);
2929
2930 switch (type) {
2931 case B43_NTAB_8BIT:
2932 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset);
2933 value = b43_phy_read(dev, B43_NPHY_TABLE_DATALO) & 0xFF;
2934 break;
2935 case B43_NTAB_16BIT:
2936 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset);
2937 value = b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
2938 break;
2939 case B43_NTAB_32BIT:
2940 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset);
2941 value = b43_phy_read(dev, B43_NPHY_TABLE_DATAHI);
2942 value <<= 16;
2943 value |= b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
2944 break;
2945 default:
2946 B43_WARN_ON(1);
2947 value = 0;
2948 }
2949
2950 return value;
2951}
2952
2922void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value) 2953void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value)
2923{ 2954{
2924 u32 type; 2955 u32 type;
diff --git a/drivers/net/wireless/b43/tables_nphy.h b/drivers/net/wireless/b43/tables_nphy.h
index d5605df5d6b8..64e990a14de3 100644
--- a/drivers/net/wireless/b43/tables_nphy.h
+++ b/drivers/net/wireless/b43/tables_nphy.h
@@ -142,6 +142,7 @@ b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel);
142#define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL 10 142#define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL 10
143#define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3 12 143#define B43_NTAB_TX_IQLO_CAL_CMDS_FULLCAL_REV3 12
144 144
145u32 b43_ntab_read(struct b43_wldev *dev, u32 offset);
145void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value); 146void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value);
146void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset, 147void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset,
147 unsigned int nr_elements, const void *_data); 148 unsigned int nr_elements, const void *_data);