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: 24e705c121SKalle Valo * Intel Linux Wireless <ilw@linux.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); 37e705c121SKalle Valo u32 iwl_read32(struct iwl_trans *trans, u32 ofs); 38e705c121SKalle Valo 39e705c121SKalle Valo static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask) 40e705c121SKalle Valo { 41e705c121SKalle Valo iwl_trans_set_bits_mask(trans, reg, mask, mask); 42e705c121SKalle Valo } 43e705c121SKalle Valo 44e705c121SKalle Valo static inline void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask) 45e705c121SKalle Valo { 46e705c121SKalle Valo iwl_trans_set_bits_mask(trans, reg, mask, 0); 47e705c121SKalle Valo } 48e705c121SKalle Valo 49e705c121SKalle Valo int iwl_poll_bit(struct iwl_trans *trans, u32 addr, 50e705c121SKalle Valo u32 bits, u32 mask, int timeout); 51e705c121SKalle Valo int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, 52e705c121SKalle Valo int timeout); 53e705c121SKalle Valo 54e705c121SKalle Valo u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg); 55e705c121SKalle Valo void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); 56e705c121SKalle Valo 57e705c121SKalle Valo 5814ef1b43SGolan Ben-Ami u32 iwl_read_prph_no_grab(struct iwl_trans *trans, u32 ofs); 59e705c121SKalle Valo u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs); 6014ef1b43SGolan Ben-Ami void iwl_write_prph_no_grab(struct iwl_trans *trans, u32 ofs, u32 val); 61e705c121SKalle Valo void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val); 62e705c121SKalle Valo int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr, 63e705c121SKalle Valo u32 bits, u32 mask, int timeout); 64e705c121SKalle Valo void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); 65e705c121SKalle Valo void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, 66e705c121SKalle Valo u32 bits, u32 mask); 67e705c121SKalle Valo void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); 68e705c121SKalle Valo void iwl_force_nmi(struct iwl_trans *trans); 69e705c121SKalle Valo 70e705c121SKalle Valo /* Error handling */ 71e705c121SKalle Valo int iwl_dump_fh(struct iwl_trans *trans, char **buf); 72e705c121SKalle Valo 73e705c121SKalle Valo #endif 74