1 /****************************************************************************** 2 * 3 * This file is provided under a dual BSD/GPLv2 license. When using or 4 * redistributing this file, you may do so under either license. 5 * 6 * GPL LICENSE SUMMARY 7 * 8 * This program is free software; you can redistribute it and/or modify it 9 * under the terms of version 2 of the GNU General Public License as 10 * published by the Free Software Foundation. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 15 * more details. 16 * 17 * The full GNU General Public License is included in this distribution in the 18 * file called COPYING. 19 * 20 * Contact Information: 21 * Intel Linux Wireless <linuxwifi@intel.com> 22 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 23 * 24 * BSD LICENSE 25 * 26 * All rights reserved. 27 * 28 * Redistribution and use in source and binary forms, with or without 29 * modification, are permitted provided that the following conditions 30 * are met: 31 * 32 * * Redistributions of source code must retain the above copyright 33 * notice, this list of conditions and the following disclaimer. 34 * * Redistributions in binary form must reproduce the above copyright 35 * notice, this list of conditions and the following disclaimer in 36 * the documentation and/or other materials provided with the 37 * distribution. 38 * * Neither the name Intel Corporation nor the names of its 39 * contributors may be used to endorse or promote products derived 40 * from this software without specific prior written permission. 41 * 42 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 43 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 44 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 45 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 46 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 47 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 48 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 49 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 50 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 51 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 53 * 54 *****************************************************************************/ 55 #ifndef __iwl_io_h__ 56 #define __iwl_io_h__ 57 58 #include "iwl-devtrace.h" 59 #include "iwl-trans.h" 60 61 void iwl_write8(struct iwl_trans *trans, u32 ofs, u8 val); 62 void iwl_write32(struct iwl_trans *trans, u32 ofs, u32 val); 63 void iwl_write64(struct iwl_trans *trans, u64 ofs, u64 val); 64 u32 iwl_read32(struct iwl_trans *trans, u32 ofs); 65 66 static inline void iwl_set_bit(struct iwl_trans *trans, u32 reg, u32 mask) 67 { 68 iwl_trans_set_bits_mask(trans, reg, mask, mask); 69 } 70 71 static inline void iwl_clear_bit(struct iwl_trans *trans, u32 reg, u32 mask) 72 { 73 iwl_trans_set_bits_mask(trans, reg, mask, 0); 74 } 75 76 int iwl_poll_bit(struct iwl_trans *trans, u32 addr, 77 u32 bits, u32 mask, int timeout); 78 int iwl_poll_direct_bit(struct iwl_trans *trans, u32 addr, u32 mask, 79 int timeout); 80 81 u32 iwl_read_direct32(struct iwl_trans *trans, u32 reg); 82 void iwl_write_direct32(struct iwl_trans *trans, u32 reg, u32 value); 83 void iwl_write_direct64(struct iwl_trans *trans, u64 reg, u64 value); 84 85 86 u32 iwl_read_prph_no_grab(struct iwl_trans *trans, u32 ofs); 87 u32 iwl_read_prph(struct iwl_trans *trans, u32 ofs); 88 void iwl_write_prph_no_grab(struct iwl_trans *trans, u32 ofs, u32 val); 89 void iwl_write_prph64_no_grab(struct iwl_trans *trans, u64 ofs, u64 val); 90 void iwl_write_prph(struct iwl_trans *trans, u32 ofs, u32 val); 91 int iwl_poll_prph_bit(struct iwl_trans *trans, u32 addr, 92 u32 bits, u32 mask, int timeout); 93 void iwl_set_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); 94 void iwl_set_bits_mask_prph(struct iwl_trans *trans, u32 ofs, 95 u32 bits, u32 mask); 96 void iwl_clear_bits_prph(struct iwl_trans *trans, u32 ofs, u32 mask); 97 void iwl_force_nmi(struct iwl_trans *trans); 98 99 /* Error handling */ 100 int iwl_dump_fh(struct iwl_trans *trans, char **buf); 101 102 #endif 103