xref: /linux/drivers/net/wireless/intel/iwlwifi/pcie/utils.h (revision 25489a4f556414445d342951615178368ee45cde)
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
2 /*
3  * Copyright (C) 2025 Intel Corporation
4  */
5 
6 #ifndef __iwl_pcie_utils_h__
7 #define __iwl_pcie_utils_h__
8 
9 void iwl_trans_pcie_dump_regs(struct iwl_trans *trans, struct pci_dev *pdev);
10 
11 static inline void _iwl_trans_set_bits_mask(struct iwl_trans *trans,
12 					    u32 reg, u32 mask, u32 value)
13 {
14 	u32 v;
15 
16 #ifdef CONFIG_IWLWIFI_DEBUG
17 	WARN_ON_ONCE(value & ~mask);
18 #endif
19 
20 	v = iwl_read32(trans, reg);
21 	v &= ~mask;
22 	v |= value;
23 	iwl_write32(trans, reg, v);
24 }
25 
26 static inline void iwl_trans_clear_bit(struct iwl_trans *trans,
27 				       u32 reg, u32 mask)
28 {
29 	_iwl_trans_set_bits_mask(trans, reg, mask, 0);
30 }
31 
32 static inline void iwl_trans_set_bit(struct iwl_trans *trans,
33 				     u32 reg, u32 mask)
34 {
35 	_iwl_trans_set_bits_mask(trans, reg, mask, mask);
36 }
37 
38 #endif /* __iwl_pcie_utils_h__ */
39