diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/wireless/iwlwifi/iwl-io.h | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-io.h')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-io.h | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-io.h b/drivers/net/wireless/iwlwifi/iwl-io.h index d30cb0275d19..16eb3ced9b30 100644 --- a/drivers/net/wireless/iwlwifi/iwl-io.h +++ b/drivers/net/wireless/iwlwifi/iwl-io.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2003 - 2010 Intel Corporation. All rights reserved. |
4 | * | 4 | * |
5 | * Portions of this file are derived from the ipw3945 project. | 5 | * Portions of this file are derived from the ipw3945 project. |
6 | * | 6 | * |
@@ -31,7 +31,9 @@ | |||
31 | 31 | ||
32 | #include <linux/io.h> | 32 | #include <linux/io.h> |
33 | 33 | ||
34 | #include "iwl-dev.h" | ||
34 | #include "iwl-debug.h" | 35 | #include "iwl-debug.h" |
36 | #include "iwl-devtrace.h" | ||
35 | 37 | ||
36 | /* | 38 | /* |
37 | * IO, register, and NIC memory access functions | 39 | * IO, register, and NIC memory access functions |
@@ -61,7 +63,32 @@ | |||
61 | * | 63 | * |
62 | */ | 64 | */ |
63 | 65 | ||
64 | #define _iwl_write32(priv, ofs, val) iowrite32((val), (priv)->hw_base + (ofs)) | 66 | static inline void _iwl_write8(struct iwl_priv *priv, u32 ofs, u8 val) |
67 | { | ||
68 | trace_iwlwifi_dev_iowrite8(priv, ofs, val); | ||
69 | iowrite8(val, priv->hw_base + ofs); | ||
70 | } | ||
71 | |||
72 | #ifdef CONFIG_IWLWIFI_DEBUG | ||
73 | static inline void __iwl_write8(const char *f, u32 l, struct iwl_priv *priv, | ||
74 | u32 ofs, u8 val) | ||
75 | { | ||
76 | IWL_DEBUG_IO(priv, "write8(0x%08X, 0x%02X) - %s %d\n", ofs, val, f, l); | ||
77 | _iwl_write8(priv, ofs, val); | ||
78 | } | ||
79 | #define iwl_write8(priv, ofs, val) \ | ||
80 | __iwl_write8(__FILE__, __LINE__, priv, ofs, val) | ||
81 | #else | ||
82 | #define iwl_write8(priv, ofs, val) _iwl_write8(priv, ofs, val) | ||
83 | #endif | ||
84 | |||
85 | |||
86 | static inline void _iwl_write32(struct iwl_priv *priv, u32 ofs, u32 val) | ||
87 | { | ||
88 | trace_iwlwifi_dev_iowrite32(priv, ofs, val); | ||
89 | iowrite32(val, priv->hw_base + ofs); | ||
90 | } | ||
91 | |||
65 | #ifdef CONFIG_IWLWIFI_DEBUG | 92 | #ifdef CONFIG_IWLWIFI_DEBUG |
66 | static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv, | 93 | static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv, |
67 | u32 ofs, u32 val) | 94 | u32 ofs, u32 val) |
@@ -75,7 +102,13 @@ static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv, | |||
75 | #define iwl_write32(priv, ofs, val) _iwl_write32(priv, ofs, val) | 102 | #define iwl_write32(priv, ofs, val) _iwl_write32(priv, ofs, val) |
76 | #endif | 103 | #endif |
77 | 104 | ||
78 | #define _iwl_read32(priv, ofs) ioread32((priv)->hw_base + (ofs)) | 105 | static inline u32 _iwl_read32(struct iwl_priv *priv, u32 ofs) |
106 | { | ||
107 | u32 val = ioread32(priv->hw_base + ofs); | ||
108 | trace_iwlwifi_dev_ioread32(priv, ofs, val); | ||
109 | return val; | ||
110 | } | ||
111 | |||
79 | #ifdef CONFIG_IWLWIFI_DEBUG | 112 | #ifdef CONFIG_IWLWIFI_DEBUG |
80 | static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs) | 113 | static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs) |
81 | { | 114 | { |
@@ -188,6 +221,26 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv) | |||
188 | 221 | ||
189 | /* this bit wakes up the NIC */ | 222 | /* this bit wakes up the NIC */ |
190 | _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); | 223 | _iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); |
224 | |||
225 | /* | ||
226 | * These bits say the device is running, and should keep running for | ||
227 | * at least a short while (at least as long as MAC_ACCESS_REQ stays 1), | ||
228 | * but they do not indicate that embedded SRAM is restored yet; | ||
229 | * 3945 and 4965 have volatile SRAM, and must save/restore contents | ||
230 | * to/from host DRAM when sleeping/waking for power-saving. | ||
231 | * Each direction takes approximately 1/4 millisecond; with this | ||
232 | * overhead, it's a good idea to grab and hold MAC_ACCESS_REQUEST if a | ||
233 | * series of register accesses are expected (e.g. reading Event Log), | ||
234 | * to keep device from sleeping. | ||
235 | * | ||
236 | * CSR_UCODE_DRV_GP1 register bit MAC_SLEEP == 0 indicates that | ||
237 | * SRAM is okay/restored. We don't check that here because this call | ||
238 | * is just for hardware register access; but GP1 MAC_SLEEP check is a | ||
239 | * good idea before accessing 3945/4965 SRAM (e.g. reading Event Log). | ||
240 | * | ||
241 | * 5000 series and later (including 1000 series) have non-volatile SRAM, | ||
242 | * and do not save/restore SRAM when power cycling. | ||
243 | */ | ||
191 | ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, | 244 | ret = _iwl_poll_bit(priv, CSR_GP_CNTRL, |
192 | CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, | 245 | CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN, |
193 | (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | | 246 | (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY | |