xref: /openbmc/linux/drivers/net/wireless/broadcom/b43/tables_lpphy.h (revision 498495dba268b20e8eadd7fe93c140c68b6cc9d2)
1*b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
258619b14SKalle Valo #ifndef B43_TABLES_LPPHY_H_
358619b14SKalle Valo #define B43_TABLES_LPPHY_H_
458619b14SKalle Valo 
558619b14SKalle Valo 
658619b14SKalle Valo #define B43_LPTAB_TYPEMASK		0xF0000000
758619b14SKalle Valo #define B43_LPTAB_8BIT			0x10000000
858619b14SKalle Valo #define B43_LPTAB_16BIT			0x20000000
958619b14SKalle Valo #define B43_LPTAB_32BIT			0x30000000
1058619b14SKalle Valo #define B43_LPTAB8(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_8BIT)
1158619b14SKalle Valo #define B43_LPTAB16(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_16BIT)
1258619b14SKalle Valo #define B43_LPTAB32(table, offset)	(((table) << 10) | (offset) | B43_LPTAB_32BIT)
1358619b14SKalle Valo 
1458619b14SKalle Valo /* Table definitions */
1558619b14SKalle Valo #define B43_LPTAB_TXPWR_R2PLUS		B43_LPTAB32(0x07, 0) /* TX power lookup table (rev >= 2) */
1658619b14SKalle Valo #define B43_LPTAB_TXPWR_R0_1		B43_LPTAB32(0xA0, 0) /* TX power lookup table (rev < 2) */
1758619b14SKalle Valo 
1858619b14SKalle Valo u32 b43_lptab_read(struct b43_wldev *dev, u32 offset);
1958619b14SKalle Valo void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value);
2058619b14SKalle Valo 
2158619b14SKalle Valo /* Bulk table access. Note that these functions return the bulk data in
2258619b14SKalle Valo  * host endianness! The returned data is _not_ a bytearray, but an array
2358619b14SKalle Valo  * consisting of nr_elements of the data type. */
2458619b14SKalle Valo void b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset,
2558619b14SKalle Valo 			 unsigned int nr_elements, void *data);
2658619b14SKalle Valo void b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset,
2758619b14SKalle Valo 			  unsigned int nr_elements, const void *data);
2858619b14SKalle Valo 
2958619b14SKalle Valo void b2062_upload_init_table(struct b43_wldev *dev);
3058619b14SKalle Valo void b2063_upload_init_table(struct b43_wldev *dev);
3158619b14SKalle Valo 
3258619b14SKalle Valo struct lpphy_tx_gain_table_entry {
3358619b14SKalle Valo 	u8 gm,  pga,  pad,  dac,  bb_mult;
3458619b14SKalle Valo };
3558619b14SKalle Valo 
3658619b14SKalle Valo void lpphy_write_gain_table(struct b43_wldev *dev, int offset,
3758619b14SKalle Valo 			    struct lpphy_tx_gain_table_entry data);
3858619b14SKalle Valo void lpphy_write_gain_table_bulk(struct b43_wldev *dev, int offset, int count,
3958619b14SKalle Valo 				 struct lpphy_tx_gain_table_entry *table);
4058619b14SKalle Valo 
4158619b14SKalle Valo void lpphy_rev0_1_table_init(struct b43_wldev *dev);
4258619b14SKalle Valo void lpphy_rev2plus_table_init(struct b43_wldev *dev);
4358619b14SKalle Valo void lpphy_init_tx_gain_table(struct b43_wldev *dev);
4458619b14SKalle Valo 
4558619b14SKalle Valo #endif /* B43_TABLES_LPPHY_H_ */
46