1e705c121SKalle Valo /******************************************************************************
2e705c121SKalle Valo  *
3e705c121SKalle Valo  * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
4e705c121SKalle Valo  *
5e705c121SKalle Valo  * Portions of this file are derived from the ipw3945 project.
6e705c121SKalle Valo  *
7e705c121SKalle Valo  * This program is free software; you can redistribute it and/or modify it
8e705c121SKalle Valo  * under the terms of version 2 of the GNU General Public License as
9e705c121SKalle Valo  * published by the Free Software Foundation.
10e705c121SKalle Valo  *
11e705c121SKalle Valo  * This program is distributed in the hope that it will be useful, but WITHOUT
12e705c121SKalle Valo  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13e705c121SKalle Valo  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
14e705c121SKalle Valo  * more details.
15e705c121SKalle Valo  *
16e705c121SKalle Valo  * You should have received a copy of the GNU General Public License along with
17e705c121SKalle Valo  * this program; if not, write to the Free Software Foundation, Inc.,
18e705c121SKalle Valo  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19e705c121SKalle Valo  *
20e705c121SKalle Valo  * The full GNU General Public License is included in this distribution in the
21e705c121SKalle Valo  * file called LICENSE.
22e705c121SKalle Valo  *
23e705c121SKalle Valo  * Contact Information:
24d01c5366SEmmanuel Grumbach  *  Intel Linux Wireless <linuxwifi@intel.com>
25e705c121SKalle Valo  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
26e705c121SKalle Valo  *
27e705c121SKalle Valo  *****************************************************************************/
28e705c121SKalle Valo 
29e705c121SKalle Valo #ifndef __iwl_io_h__
30e705c121SKalle Valo #define __iwl_io_h__
31e705c121SKalle Valo 
32e705c121SKalle Valo #include "iwl-devtrace.h"
33e705c121SKalle Valo #include "iwl-trans.h"
34e705c121SKalle Valo 
35e705c121SKalle Valo void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val);
36e705c121SKalle Valo void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val);
3712a17458SSara Sharon void iwl_write64(struct iwl_trans *trans, u64 ofs, u64 val);
38e705c121SKalle Valo u32 iwl_read32(struct iwl_trans *trans, u32 ofs);
39e705c121SKalle Valo 
40e705c121SKalle Valo static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask)
41e705c121SKalle Valo {
42e705c121SKalle Valo 	iwl_trans_set_bits_mask(trans, reg, mask, mask);
43e705c121SKalle Valo }
44e705c121SKalle Valo 
45e705c121SKalle Valo static inline void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask)
46e705c121SKalle Valo {
47e705c121SKalle Valo 	iwl_trans_set_bits_mask(trans, reg, mask, 0);
48e705c121SKalle Valo }
49e705c121SKalle Valo 
50e705c121SKalle Valo int iwl_poll_bit(struct iwl_trans *trans, u32 addr,
51e705c121SKalle Valo 		 u32 bits, u32 mask, int timeout);
52e705c121SKalle Valo int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask,
53e705c121SKalle Valo 			int timeout);
54e705c121SKalle Valo 
55e705c121SKalle Valo u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg);
56e705c121SKalle Valo void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value);
5712a17458SSara Sharon void iwl_write_direct64(struct iwl_trans *trans, u64 reg, u64 value);
58e705c121SKalle Valo 
59e705c121SKalle Valo 
6014ef1b43SGolan Ben-Ami u32 iwl_read_prph_no_grab(struct iwl_trans *trans, u32 ofs);
61e705c121SKalle Valo u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs);
6214ef1b43SGolan Ben-Ami void iwl_write_prph_no_grab(struct iwl_trans *trans, u32 ofs, u32 val);
6312a17458SSara Sharon void iwl_write_prph64_no_grab(struct iwl_trans *trans, u64 ofs, u64 val);
64e705c121SKalle Valo void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val);
65e705c121SKalle Valo int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr,
66e705c121SKalle Valo 		      u32 bits, u32 mask, int timeout);
67e705c121SKalle Valo void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
68e705c121SKalle Valo void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs,
69e705c121SKalle Valo 			    u32 bits, u32 mask);
70e705c121SKalle Valo void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask);
71e705c121SKalle Valo void iwl_force_nmi(struct iwl_trans *trans);
72e705c121SKalle Valo 
73e705c121SKalle Valo /* Error handling */
74e705c121SKalle Valo int iwl_dump_fh(struct iwl_trans *trans, char **buf);
75e705c121SKalle Valo 
76e705c121SKalle Valo #endif
77