rt2x00: Add debugfs access for rfcsr register
authorAnisse Astier <anisse@astier.eu>
Thu, 19 Apr 2012 13:53:10 +0000 (15:53 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 9 May 2012 01:53:46 +0000 (21:53 -0400)
RFCSR is only used in rt2800. For other chipsets, the debug struct
for rfcsr should be zeroed, which isn't be an issue, since the code
can now cope with that.

Signed-off-by: Anisse Astier <anisse@astier.eu>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/rt2x00/rt2800.h
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2x00debug.c
drivers/net/wireless/rt2x00/rt2x00debug.h

index d91f4f628f655a11268cefe84ac5069f0f8e387e..9348521e083275f6dff971cc5c8283a68cacf1c5 100644 (file)
 #define BBP_SIZE                       0x00ff
 #define RF_BASE                                0x0004
 #define RF_SIZE                                0x0010
+#define RFCSR_BASE                     0x0000
+#define RFCSR_SIZE                     0x0040
 
 /*
  * Number of TX queues.
index 1cd16b416024c1d4b002633f704fd4df931a4d6b..dfc90d34be6d31def8590d85a413a38067de8ed4 100644 (file)
@@ -836,6 +836,13 @@ const struct rt2x00debug rt2800_rt2x00debug = {
                .word_size      = sizeof(u32),
                .word_count     = RF_SIZE / sizeof(u32),
        },
+       .rfcsr  = {
+               .read           = rt2800_rfcsr_read,
+               .write          = rt2800_rfcsr_write,
+               .word_base      = RFCSR_BASE,
+               .word_size      = sizeof(u8),
+               .word_count     = RFCSR_SIZE / sizeof(u8),
+       },
 };
 EXPORT_SYMBOL_GPL(rt2800_rt2x00debug);
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
index 5bb122162b5b4d2acc1a719bb1f83249f8ad1d22..3bb8cafbac593b394c166c0c0f3817a93a9a7a41 100644 (file)
@@ -70,6 +70,7 @@ struct rt2x00debug_intf {
         *     - eeprom offset/value files
         *     - bbp offset/value files
         *     - rf offset/value files
+        *     - rfcsr offset/value files
         *   - queue folder
         *     - frame dump file
         *     - queue stats file
@@ -89,6 +90,8 @@ struct rt2x00debug_intf {
        struct dentry *bbp_val_entry;
        struct dentry *rf_off_entry;
        struct dentry *rf_val_entry;
+       struct dentry *rfcsr_off_entry;
+       struct dentry *rfcsr_val_entry;
        struct dentry *queue_folder;
        struct dentry *queue_frame_dump_entry;
        struct dentry *queue_stats_entry;
@@ -131,6 +134,7 @@ struct rt2x00debug_intf {
        unsigned int offset_eeprom;
        unsigned int offset_bbp;
        unsigned int offset_rf;
+       unsigned int offset_rfcsr;
 };
 
 void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
@@ -525,6 +529,7 @@ RT2X00DEBUGFS_OPS(csr, "0x%.8x\n", u32);
 RT2X00DEBUGFS_OPS(eeprom, "0x%.4x\n", u16);
 RT2X00DEBUGFS_OPS(bbp, "0x%.2x\n", u8);
 RT2X00DEBUGFS_OPS(rf, "0x%.8x\n", u32);
+RT2X00DEBUGFS_OPS(rfcsr, "0x%.2x\n", u8);
 
 static ssize_t rt2x00debug_read_dev_flags(struct file *file,
                                          char __user *buf,
@@ -614,7 +619,7 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name,
        const struct rt2x00debug *debug = intf->debug;
        char *data;
 
-       data = kzalloc(8 * MAX_LINE_LENGTH, GFP_KERNEL);
+       data = kzalloc(9 * MAX_LINE_LENGTH, GFP_KERNEL);
        if (!data)
                return NULL;
 
@@ -637,6 +642,7 @@ static struct dentry *rt2x00debug_create_file_chipset(const char *name,
        RT2X00DEBUGFS_SPRINTF_REGISTER(eeprom);
        RT2X00DEBUGFS_SPRINTF_REGISTER(bbp);
        RT2X00DEBUGFS_SPRINTF_REGISTER(rf);
+       RT2X00DEBUGFS_SPRINTF_REGISTER(rfcsr);
 #undef RT2X00DEBUGFS_SPRINTF_REGISTER
 
        blob->size = strlen(blob->data);
@@ -720,6 +726,7 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
        RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, eeprom);
        RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, bbp);
        RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, rf);
+       RT2X00DEBUGFS_CREATE_REGISTER_ENTRY(intf, rfcsr);
 
 #undef RT2X00DEBUGFS_CREATE_REGISTER_ENTRY
 
@@ -771,6 +778,8 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
        debugfs_remove(intf->queue_stats_entry);
        debugfs_remove(intf->queue_frame_dump_entry);
        debugfs_remove(intf->queue_folder);
+       debugfs_remove(intf->rfcsr_val_entry);
+       debugfs_remove(intf->rfcsr_off_entry);
        debugfs_remove(intf->rf_val_entry);
        debugfs_remove(intf->rf_off_entry);
        debugfs_remove(intf->bbp_val_entry);
index fa11409cb5c61d673353d1e3c6d8f92f753cbd86..e11d39bdfef77000699e3bfa9dbd8506eab32558 100644 (file)
@@ -65,6 +65,7 @@ struct rt2x00debug {
        RT2X00DEBUGFS_REGISTER_ENTRY(eeprom, u16);
        RT2X00DEBUGFS_REGISTER_ENTRY(bbp, u8);
        RT2X00DEBUGFS_REGISTER_ENTRY(rf, u32);
+       RT2X00DEBUGFS_REGISTER_ENTRY(rfcsr, u8);
 };
 
 #endif /* RT2X00DEBUG_H */