aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2010-01-17 18:21:35 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-19 16:47:46 -0500
commit9145834e84805f5efcca4706edfd641047af1d55 (patch)
tree3d06a690a42148d76200516484fa4eecf675f531 /drivers
parentc643a66ef5ccfd4d359327fb8afa9949f1abbfdd (diff)
b43: N-PHY: implement and add multi-dimensional table reading
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/b43/phy_n.c30
-rw-r--r--drivers/net/wireless/b43/tables_nphy.c35
-rw-r--r--drivers/net/wireless/b43/tables_nphy.h2
3 files changed, 48 insertions, 19 deletions
diff --git a/drivers/net/wireless/b43/phy_n.c b/drivers/net/wireless/b43/phy_n.c
index 7eac0ae2b15e..1359267a35ff 100644
--- a/drivers/net/wireless/b43/phy_n.c
+++ b/drivers/net/wireless/b43/phy_n.c
@@ -829,8 +829,7 @@ static void b43_nphy_tx_pwr_ctrl_coef_setup(struct b43_wldev *dev)
829 if (nphy->hang_avoid) 829 if (nphy->hang_avoid)
830 b43_nphy_stay_in_carrier_search(dev, true); 830 b43_nphy_stay_in_carrier_search(dev, true);
831 831
832 /* TODO: Read an N PHY Table with ID 15, length 7, offset 80, 832 b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 7, buffer);
833 width 16, and data pointer buffer */
834 833
835 for (i = 0; i < 2; i++) { 834 for (i = 0; i < 2; i++) {
836 tmp = ((buffer[i * 2] & 0x3FF) << 10) | 835 tmp = ((buffer[i * 2] & 0x3FF) << 10) |
@@ -1507,8 +1506,7 @@ static struct nphy_txgains b43_nphy_get_tx_gains(struct b43_wldev *dev)
1507 1506
1508 if (nphy->hang_avoid) 1507 if (nphy->hang_avoid)
1509 b43_nphy_stay_in_carrier_search(dev, true); 1508 b43_nphy_stay_in_carrier_search(dev, true);
1510 /* TODO: Read an N PHY Table with ID 7, length 2, 1509 b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, curr_gain);
1511 offset 0x110, width 16, and curr_gain */
1512 if (nphy->hang_avoid) 1510 if (nphy->hang_avoid)
1513 b43_nphy_stay_in_carrier_search(dev, false); 1511 b43_nphy_stay_in_carrier_search(dev, false);
1514 1512
@@ -1768,8 +1766,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
1768 nphy->hang_avoid = 0; 1766 nphy->hang_avoid = 0;
1769 } 1767 }
1770 1768
1771 /* TODO: Read an N PHY Table with ID 7, length 2, offset 0x110, 1769 b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, save);
1772 width 16, and data pointer save */
1773 1770
1774 for (i = 0; i < 2; i++) { 1771 for (i = 0; i < 2; i++) {
1775 b43_nphy_iq_cal_gain_params(dev, i, target, &params[i]); 1772 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 udelay(10); 1887 udelay(10);
1891 } 1888 }
1892 1889
1893 /* TODO: Read an N PHY Table with ID 15, 1890 b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length,
1894 length table_length, offset 96, width 16, 1891 buffer);
1895 and data pointer buffer */
1896 b43_ntab_write_bulk(dev, B43_NTAB16(15, 64), length, 1892 b43_ntab_write_bulk(dev, B43_NTAB16(15, 64), length,
1897 buffer); 1893 buffer);
1898 1894
@@ -1907,8 +1903,7 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
1907 1903
1908 if (!mphase || nphy->mphase_cal_phase_id == last) { 1904 if (!mphase || nphy->mphase_cal_phase_id == last) {
1909 b43_ntab_write_bulk(dev, B43_NTAB16(15, 96), 4, buffer); 1905 b43_ntab_write_bulk(dev, B43_NTAB16(15, 96), 4, buffer);
1910 /* TODO: Read an N PHY Table with ID 15, length 4, 1906 b43_ntab_read_bulk(dev, B43_NTAB16(15, 80), 4, buffer);
1911 offset 80, width 16, and data pointer buffer */
1912 if (dev->phy.rev < 3) { 1907 if (dev->phy.rev < 3) {
1913 buffer[0] = 0; 1908 buffer[0] = 0;
1914 buffer[1] = 0; 1909 buffer[1] = 0;
@@ -1926,9 +1921,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
1926 length = 11; 1921 length = 11;
1927 if (dev->phy.rev < 3) 1922 if (dev->phy.rev < 3)
1928 length -= 2; 1923 length -= 2;
1929 /* TODO: Read an N PHY Table with ID 15, length length, 1924 b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length,
1930 offset 96, width 16, and data pointer 1925 nphy->txiqlocal_bestc);
1931 nphy->txiqlocal_bestc */
1932 nphy->txiqlocal_coeffsvalid = true; 1926 nphy->txiqlocal_coeffsvalid = true;
1933 /* TODO: Set nphy->txiqlocal_chanspec to 1927 /* TODO: Set nphy->txiqlocal_chanspec to
1934 the current channel */ 1928 the current channel */
@@ -1936,9 +1930,8 @@ static int b43_nphy_cal_tx_iq_lo(struct b43_wldev *dev,
1936 length = 11; 1930 length = 11;
1937 if (dev->phy.rev < 3) 1931 if (dev->phy.rev < 3)
1938 length -= 2; 1932 length -= 2;
1939 /* TODO: Read an N PHY Table with ID 5, length length, 1933 b43_ntab_read_bulk(dev, B43_NTAB16(15, 96), length,
1940 offset 96, width 16, and data pointer 1934 nphy->mphase_txcal_bestcoeffs);
1941 nphy->mphase_txcal_bestcoeffs */
1942 } 1935 }
1943 1936
1944 b43_nphy_stop_playback(dev); 1937 b43_nphy_stop_playback(dev);
@@ -1990,8 +1983,7 @@ static int b43_nphy_rev2_cal_rx_iq(struct b43_wldev *dev,
1990 1983
1991 if (dev->phy.rev < 2) 1984 if (dev->phy.rev < 2)
1992 ;/* TODO: Call N PHY Reapply TX Cal Coeffs */ 1985 ;/* TODO: Call N PHY Reapply TX Cal Coeffs */
1993 /* TODO: Read an N PHY Table with ID 7, length 2, offset 0x110, 1986 b43_ntab_read_bulk(dev, B43_NTAB16(7, 0x110), 2, gain_save);
1994 width 16, and data gain_save */
1995 for (i = 0; i < 2; i++) { 1987 for (i = 0; i < 2; i++) {
1996 b43_nphy_iq_cal_gain_params(dev, i, target, &cal_params[i]); 1988 b43_nphy_iq_cal_gain_params(dev, i, target, &cal_params[i]);
1997 cal_gain[i] = cal_params[i].cal_gain; 1989 cal_gain[i] = cal_params[i].cal_gain;
diff --git a/drivers/net/wireless/b43/tables_nphy.c b/drivers/net/wireless/b43/tables_nphy.c
index b8aed456da1f..b8c9fc619ab1 100644
--- a/drivers/net/wireless/b43/tables_nphy.c
+++ b/drivers/net/wireless/b43/tables_nphy.c
@@ -2950,6 +2950,41 @@ u32 b43_ntab_read(struct b43_wldev *dev, u32 offset)
2950 return value; 2950 return value;
2951} 2951}
2952 2952
2953void b43_ntab_read_bulk(struct b43_wldev *dev, u32 offset,
2954 unsigned int nr_elements, void *_data)
2955{
2956 u32 type;
2957 u8 *data = _data;
2958 unsigned int i;
2959
2960 type = offset & B43_NTAB_TYPEMASK;
2961 offset &= ~B43_NTAB_TYPEMASK;
2962 B43_WARN_ON(offset > 0xFFFF);
2963
2964 b43_phy_write(dev, B43_NPHY_TABLE_ADDR, offset);
2965
2966 for (i = 0; i < nr_elements; i++) {
2967 switch (type) {
2968 case B43_NTAB_8BIT:
2969 *data = b43_phy_read(dev, B43_NPHY_TABLE_DATALO) & 0xFF;
2970 data++;
2971 break;
2972 case B43_NTAB_16BIT:
2973 *((u16 *)data) = b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
2974 data += 2;
2975 break;
2976 case B43_NTAB_32BIT:
2977 *((u32 *)data) = b43_phy_read(dev, B43_NPHY_TABLE_DATAHI);
2978 *((u32 *)data) <<= 16;
2979 *((u32 *)data) |= b43_phy_read(dev, B43_NPHY_TABLE_DATALO);
2980 data += 4;
2981 break;
2982 default:
2983 B43_WARN_ON(1);
2984 }
2985 }
2986}
2987
2953void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value) 2988void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value)
2954{ 2989{
2955 u32 type; 2990 u32 type;
diff --git a/drivers/net/wireless/b43/tables_nphy.h b/drivers/net/wireless/b43/tables_nphy.h
index 64e990a14de3..6bbef894010c 100644
--- a/drivers/net/wireless/b43/tables_nphy.h
+++ b/drivers/net/wireless/b43/tables_nphy.h
@@ -143,6 +143,8 @@ b43_nphy_get_chantabent(struct b43_wldev *dev, u8 channel);
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); 145u32 b43_ntab_read(struct b43_wldev *dev, u32 offset);
146void b43_ntab_read_bulk(struct b43_wldev *dev, u32 offset,
147 unsigned int nr_elements, void *_data);
146void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value); 148void b43_ntab_write(struct b43_wldev *dev, u32 offset, u32 value);
147void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset, 149void b43_ntab_write_bulk(struct b43_wldev *dev, u32 offset,
148 unsigned int nr_elements, const void *_data); 150 unsigned int nr_elements, const void *_data);