xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/broadcom/b43/tables_lpphy.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 */
2*4882a593Smuzhiyun #ifndef B43_TABLES_LPPHY_H_
3*4882a593Smuzhiyun #define B43_TABLES_LPPHY_H_
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun 
6*4882a593Smuzhiyun #define B43_LPTAB_TYPEMASK		0xF0000000
7*4882a593Smuzhiyun #define B43_LPTAB_8BIT			0x10000000
8*4882a593Smuzhiyun #define B43_LPTAB_16BIT			0x20000000
9*4882a593Smuzhiyun #define B43_LPTAB_32BIT			0x30000000
10*4882a593Smuzhiyun #define B43_LPTAB8(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_8BIT)
11*4882a593Smuzhiyun #define B43_LPTAB16(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_16BIT)
12*4882a593Smuzhiyun #define B43_LPTAB32(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_32BIT)
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun /* Table definitions */
15*4882a593Smuzhiyun #define B43_LPTAB_TXPWR_R2PLUS		B43_LPTAB32(0x07, 0) /* TX power lookup table (rev >= 2) */
16*4882a593Smuzhiyun #define B43_LPTAB_TXPWR_R0_1		B43_LPTAB32(0xA0, 0) /* TX power lookup table (rev < 2) */
17*4882a593Smuzhiyun 
18*4882a593Smuzhiyun u32 b43_lptab_read(struct b43_wldev *dev, u32 offset);
19*4882a593Smuzhiyun void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value);
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /* Bulk table access. Note that these functions return the bulk data in
22*4882a593Smuzhiyun  * host endianness! The returned data is _not_ a bytearray, but an array
23*4882a593Smuzhiyun  * consisting of nr_elements of the data type. */
24*4882a593Smuzhiyun void b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset,
25*4882a593Smuzhiyun 			 unsigned int nr_elements, void *data);
26*4882a593Smuzhiyun void b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset,
27*4882a593Smuzhiyun 			  unsigned int nr_elements, const void *data);
28*4882a593Smuzhiyun 
29*4882a593Smuzhiyun void b2062_upload_init_table(struct b43_wldev *dev);
30*4882a593Smuzhiyun void b2063_upload_init_table(struct b43_wldev *dev);
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun struct lpphy_tx_gain_table_entry {
33*4882a593Smuzhiyun 	u8 gm,  pga,  pad,  dac,  bb_mult;
34*4882a593Smuzhiyun };
35*4882a593Smuzhiyun 
36*4882a593Smuzhiyun void lpphy_write_gain_table(struct b43_wldev *dev, int offset,
37*4882a593Smuzhiyun 			    struct lpphy_tx_gain_table_entry data);
38*4882a593Smuzhiyun void lpphy_write_gain_table_bulk(struct b43_wldev *dev, int offset, int count,
39*4882a593Smuzhiyun 				 struct lpphy_tx_gain_table_entry *table);
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun void lpphy_rev0_1_table_init(struct b43_wldev *dev);
42*4882a593Smuzhiyun void lpphy_rev2plus_table_init(struct b43_wldev *dev);
43*4882a593Smuzhiyun void lpphy_init_tx_gain_table(struct b43_wldev *dev);
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #endif /* B43_TABLES_LPPHY_H_ */
46