aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2010-02-03 14:47:20 -0500
committerReinette Chatre <reinette.chatre@intel.com>2010-02-11 13:25:55 -0500
commit04cafd7fa74d5f70efc93bef36f118177057ff74 (patch)
treeed477d1e8d1e6cc0f2e4419b9e00039f91a7d2f0
parenta93e7973d0983d22fcbe5f691244736211639fe7 (diff)
iwlwifi: add debug function to reset/reload radio/firmware
Adding function to force reset radio or reload firmware from debugfs. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index d134301b553c..78298be0bdb6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -2223,6 +2223,32 @@ static ssize_t iwl_dbgfs_plcp_delta_write(struct file *file,
2223 return count; 2223 return count;
2224} 2224}
2225 2225
2226static ssize_t iwl_dbgfs_force_reset_write(struct file *file,
2227 const char __user *user_buf,
2228 size_t count, loff_t *ppos) {
2229
2230 struct iwl_priv *priv = file->private_data;
2231 char buf[8];
2232 int buf_size;
2233 int reset, ret;
2234
2235 memset(buf, 0, sizeof(buf));
2236 buf_size = min(count, sizeof(buf) - 1);
2237 if (copy_from_user(buf, user_buf, buf_size))
2238 return -EFAULT;
2239 if (sscanf(buf, "%d", &reset) != 1)
2240 return -EINVAL;
2241 switch (reset) {
2242 case IWL_RF_RESET:
2243 case IWL_FW_RESET:
2244 ret = iwl_force_reset(priv, reset);
2245 break;
2246 default:
2247 return -EINVAL;
2248 }
2249 return ret ? ret : count;
2250}
2251
2226DEBUGFS_READ_FILE_OPS(rx_statistics); 2252DEBUGFS_READ_FILE_OPS(rx_statistics);
2227DEBUGFS_READ_FILE_OPS(tx_statistics); 2253DEBUGFS_READ_FILE_OPS(tx_statistics);
2228DEBUGFS_READ_WRITE_FILE_OPS(traffic_log); 2254DEBUGFS_READ_WRITE_FILE_OPS(traffic_log);
@@ -2243,6 +2269,7 @@ DEBUGFS_READ_FILE_OPS(fh_reg);
2243DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon); 2269DEBUGFS_READ_WRITE_FILE_OPS(missed_beacon);
2244DEBUGFS_WRITE_FILE_OPS(internal_scan); 2270DEBUGFS_WRITE_FILE_OPS(internal_scan);
2245DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta); 2271DEBUGFS_READ_WRITE_FILE_OPS(plcp_delta);
2272DEBUGFS_WRITE_FILE_OPS(force_reset);
2246 2273
2247/* 2274/*
2248 * Create the debugfs files and directories 2275 * Create the debugfs files and directories
@@ -2296,6 +2323,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
2296 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR); 2323 DEBUGFS_ADD_FILE(missed_beacon, dir_debug, S_IWUSR);
2297 DEBUGFS_ADD_FILE(internal_scan, dir_debug, S_IWUSR); 2324 DEBUGFS_ADD_FILE(internal_scan, dir_debug, S_IWUSR);
2298 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR); 2325 DEBUGFS_ADD_FILE(plcp_delta, dir_debug, S_IWUSR | S_IRUSR);
2326 DEBUGFS_ADD_FILE(force_reset, dir_debug, S_IWUSR);
2299 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) { 2327 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) != CSR_HW_REV_TYPE_3945) {
2300 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR); 2328 DEBUGFS_ADD_FILE(ucode_rx_stats, dir_debug, S_IRUSR);
2301 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR); 2329 DEBUGFS_ADD_FILE(ucode_tx_stats, dir_debug, S_IRUSR);