diff options
author | Eliad Peller <eliad@wizery.com> | 2014-01-09 06:12:54 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2014-02-13 06:45:11 -0500 |
commit | f3c221f6ea17f4fea250ac17c7f27ecb71e62465 (patch) | |
tree | 1ca1af4508bcc14d79ad807dfba5a4016347cab9 | |
parent | 63f7535d6eb80a465d353c414d14560367c34fb2 (diff) |
iwlwifi: mvm: add debugfs for prph reg read/write
Allow reading/writing prph registers.
The address is set in the first argument
of the write operation. second argument
is optional and can be used for writing.
e.g.
echo '0xA01234 0x99' > /sys/kernel/debug/ieee80211/phy0/iwlwifi/iwlmvm/prph_reg
will write 0x99 into reg 0xA01234
cat /sys/kernel/debug/ieee80211/phy0/iwlwifi/iwlmvm/prph_reg
will show its current value (probably 0x99)
Signed-off-by: Eliad Peller <eliadx.peller@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/debugfs.c | 44 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/mvm/mvm.h | 1 |
2 files changed, 45 insertions, 0 deletions
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c index 6853e5efe522..9b9833720a24 100644 --- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c +++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c | |||
@@ -907,6 +907,49 @@ static ssize_t iwl_dbgfs_d0i3_refs_write(struct iwl_mvm *mvm, char *buf, | |||
907 | #define MVM_DEBUGFS_ADD_FILE(name, parent, mode) \ | 907 | #define MVM_DEBUGFS_ADD_FILE(name, parent, mode) \ |
908 | MVM_DEBUGFS_ADD_FILE_ALIAS(#name, name, parent, mode) | 908 | MVM_DEBUGFS_ADD_FILE_ALIAS(#name, name, parent, mode) |
909 | 909 | ||
910 | static ssize_t | ||
911 | iwl_dbgfs_prph_reg_read(struct file *file, | ||
912 | char __user *user_buf, | ||
913 | size_t count, loff_t *ppos) | ||
914 | { | ||
915 | struct iwl_mvm *mvm = file->private_data; | ||
916 | int pos = 0; | ||
917 | char buf[32]; | ||
918 | const size_t bufsz = sizeof(buf); | ||
919 | |||
920 | if (!mvm->dbgfs_prph_reg_addr) | ||
921 | return -EINVAL; | ||
922 | |||
923 | pos += scnprintf(buf + pos, bufsz - pos, "Reg 0x%x: (0x%x)\n", | ||
924 | mvm->dbgfs_prph_reg_addr, | ||
925 | iwl_read_prph(mvm->trans, mvm->dbgfs_prph_reg_addr)); | ||
926 | |||
927 | return simple_read_from_buffer(user_buf, count, ppos, buf, pos); | ||
928 | } | ||
929 | |||
930 | static ssize_t | ||
931 | iwl_dbgfs_prph_reg_write(struct iwl_mvm *mvm, char *buf, | ||
932 | size_t count, loff_t *ppos) | ||
933 | { | ||
934 | u8 args; | ||
935 | u32 value; | ||
936 | |||
937 | args = sscanf(buf, "%i %i", &mvm->dbgfs_prph_reg_addr, &value); | ||
938 | /* if we only want to set the reg address - nothing more to do */ | ||
939 | if (args == 1) | ||
940 | goto out; | ||
941 | |||
942 | /* otherwise, make sure we have both address and value */ | ||
943 | if (args != 2) | ||
944 | return -EINVAL; | ||
945 | |||
946 | iwl_write_prph(mvm->trans, mvm->dbgfs_prph_reg_addr, value); | ||
947 | out: | ||
948 | return count; | ||
949 | } | ||
950 | |||
951 | MVM_DEBUGFS_READ_WRITE_FILE_OPS(prph_reg, 64); | ||
952 | |||
910 | /* Device wide debugfs entries */ | 953 | /* Device wide debugfs entries */ |
911 | MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16); | 954 | MVM_DEBUGFS_WRITE_FILE_OPS(tx_flush, 16); |
912 | MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8); | 955 | MVM_DEBUGFS_WRITE_FILE_OPS(sta_drain, 8); |
@@ -951,6 +994,7 @@ int iwl_mvm_dbgfs_register(struct iwl_mvm *mvm, struct dentry *dbgfs_dir) | |||
951 | MVM_DEBUGFS_ADD_FILE(fw_nmi, mvm->debugfs_dir, S_IWUSR); | 994 | MVM_DEBUGFS_ADD_FILE(fw_nmi, mvm->debugfs_dir, S_IWUSR); |
952 | MVM_DEBUGFS_ADD_FILE(scan_ant_rxchain, mvm->debugfs_dir, | 995 | MVM_DEBUGFS_ADD_FILE(scan_ant_rxchain, mvm->debugfs_dir, |
953 | S_IWUSR | S_IRUSR); | 996 | S_IWUSR | S_IRUSR); |
997 | MVM_DEBUGFS_ADD_FILE(prph_reg, mvm->debugfs_dir, S_IWUSR | S_IRUSR); | ||
954 | MVM_DEBUGFS_ADD_FILE(d0i3_refs, mvm->debugfs_dir, S_IRUSR | S_IWUSR); | 998 | MVM_DEBUGFS_ADD_FILE(d0i3_refs, mvm->debugfs_dir, S_IRUSR | S_IWUSR); |
955 | 999 | ||
956 | #ifdef CONFIG_IWLWIFI_BCAST_FILTERING | 1000 | #ifdef CONFIG_IWLWIFI_BCAST_FILTERING |
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h index bde8190bb6c4..29d11d93441d 100644 --- a/drivers/net/wireless/iwlwifi/mvm/mvm.h +++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h | |||
@@ -518,6 +518,7 @@ struct iwl_mvm { | |||
518 | #ifdef CONFIG_IWLWIFI_DEBUGFS | 518 | #ifdef CONFIG_IWLWIFI_DEBUGFS |
519 | struct dentry *debugfs_dir; | 519 | struct dentry *debugfs_dir; |
520 | u32 dbgfs_sram_offset, dbgfs_sram_len; | 520 | u32 dbgfs_sram_offset, dbgfs_sram_len; |
521 | u32 dbgfs_prph_reg_addr; | ||
521 | bool disable_power_off; | 522 | bool disable_power_off; |
522 | bool disable_power_off_d3; | 523 | bool disable_power_off_d3; |
523 | 524 | ||