aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2012-06-07 16:39:27 -0400
committerLuciano Coelho <coelho@ti.com>2012-06-08 02:14:08 -0400
commit18b70ac9c7fd640cbd5921b5ca2705db0f8b9d83 (patch)
tree372eb61055aac139e99c3668cc9c52edfcc93ca9 /drivers
parent34bacf73c62cd71542ee12eba5896e1f360faa9b (diff)
wlcore/wl18xx: export conf struct in a debugfs file
Add conf file header structure, magic and version values and export the entire conf struct in debugfs. Signed-off-by: Luciano Coelho <coelho@ti.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/ti/wl18xx/conf.h6
-rw-r--r--drivers/net/wireless/ti/wl18xx/debugfs.c44
-rw-r--r--drivers/net/wireless/ti/wlcore/conf.h22
3 files changed, 72 insertions, 0 deletions
diff --git a/drivers/net/wireless/ti/wl18xx/conf.h b/drivers/net/wireless/ti/wl18xx/conf.h
index b75a6d359712..130546aa970d 100644
--- a/drivers/net/wireless/ti/wl18xx/conf.h
+++ b/drivers/net/wireless/ti/wl18xx/conf.h
@@ -22,6 +22,12 @@
22#ifndef __WL18XX_CONF_H__ 22#ifndef __WL18XX_CONF_H__
23#define __WL18XX_CONF_H__ 23#define __WL18XX_CONF_H__
24 24
25#define WL18XX_CONF_MAGIC 0x10e100ca
26#define WL18XX_CONF_VERSION (WLCORE_CONF_VERSION | 0x0001)
27#define WL18XX_CONF_MASK 0x0000ffff
28#define WL18XX_CONF_SIZE (WLCORE_CONF_SIZE + \
29 sizeof(struct wl18xx_priv_conf))
30
25struct wl18xx_conf_phy { 31struct wl18xx_conf_phy {
26 u8 phy_standalone; 32 u8 phy_standalone;
27 u8 rdl; 33 u8 rdl;
diff --git a/drivers/net/wireless/ti/wl18xx/debugfs.c b/drivers/net/wireless/ti/wl18xx/debugfs.c
index 468651c2f54c..96b149662906 100644
--- a/drivers/net/wireless/ti/wl18xx/debugfs.c
+++ b/drivers/net/wireless/ti/wl18xx/debugfs.c
@@ -158,6 +158,48 @@ WL18XX_DEBUGFS_FWSTATS_FILE(mem, tx_free_mem_blks, "%u");
158WL18XX_DEBUGFS_FWSTATS_FILE(mem, fwlog_free_mem_blks, "%u"); 158WL18XX_DEBUGFS_FWSTATS_FILE(mem, fwlog_free_mem_blks, "%u");
159WL18XX_DEBUGFS_FWSTATS_FILE(mem, fw_gen_free_mem_blks, "%u"); 159WL18XX_DEBUGFS_FWSTATS_FILE(mem, fw_gen_free_mem_blks, "%u");
160 160
161static ssize_t conf_read(struct file *file, char __user *user_buf,
162 size_t count, loff_t *ppos)
163{
164 struct wl1271 *wl = file->private_data;
165 struct wl18xx_priv *priv = wl->priv;
166 struct wlcore_conf_header header;
167 char *buf, *pos;
168 size_t len;
169 int ret;
170
171 len = WL18XX_CONF_SIZE;
172 buf = kmalloc(len, GFP_KERNEL);
173 if (!buf)
174 return -ENOMEM;
175
176 header.magic = cpu_to_le32(WL18XX_CONF_MAGIC);
177 header.version = cpu_to_le32(WL18XX_CONF_VERSION);
178 header.checksum = 0;
179
180 mutex_lock(&wl->mutex);
181
182 pos = buf;
183 memcpy(pos, &header, sizeof(header));
184 pos += sizeof(header);
185 memcpy(pos, &wl->conf, sizeof(wl->conf));
186 pos += sizeof(wl->conf);
187 memcpy(pos, &priv->conf, sizeof(priv->conf));
188
189 mutex_unlock(&wl->mutex);
190
191 ret = simple_read_from_buffer(user_buf, count, ppos, buf, len);
192
193 kfree(buf);
194 return ret;
195}
196
197static const struct file_operations conf_ops = {
198 .read = conf_read,
199 .open = simple_open,
200 .llseek = default_llseek,
201};
202
161static ssize_t clear_fw_stats_write(struct file *file, 203static ssize_t clear_fw_stats_write(struct file *file,
162 const char __user *user_buf, 204 const char __user *user_buf,
163 size_t count, loff_t *ppos) 205 size_t count, loff_t *ppos)
@@ -327,6 +369,8 @@ int wl18xx_debugfs_add_files(struct wl1271 *wl,
327 DEBUGFS_FWSTATS_ADD(mem, fwlog_free_mem_blks); 369 DEBUGFS_FWSTATS_ADD(mem, fwlog_free_mem_blks);
328 DEBUGFS_FWSTATS_ADD(mem, fw_gen_free_mem_blks); 370 DEBUGFS_FWSTATS_ADD(mem, fw_gen_free_mem_blks);
329 371
372 DEBUGFS_ADD(conf, moddir);
373
330 return 0; 374 return 0;
331 375
332err: 376err:
diff --git a/drivers/net/wireless/ti/wlcore/conf.h b/drivers/net/wireless/ti/wlcore/conf.h
index 27d919fa997f..03c635872335 100644
--- a/drivers/net/wireless/ti/wlcore/conf.h
+++ b/drivers/net/wireless/ti/wlcore/conf.h
@@ -1271,6 +1271,22 @@ struct conf_hangover_settings {
1271 u8 window_size; 1271 u8 window_size;
1272} __packed; 1272} __packed;
1273 1273
1274/*
1275 * The conf version consists of 4 bytes. The two MSB are the wlcore
1276 * version, the two LSB are the lower driver's private conf
1277 * version.
1278 */
1279#define WLCORE_CONF_VERSION (0x0001 << 16)
1280#define WLCORE_CONF_MASK 0xffff0000
1281#define WLCORE_CONF_SIZE (sizeof(struct wlcore_conf_header) + \
1282 sizeof(struct wlcore_conf))
1283
1284struct wlcore_conf_header {
1285 __le32 magic;
1286 __le32 version;
1287 __le32 checksum;
1288} __packed;
1289
1274struct wlcore_conf { 1290struct wlcore_conf {
1275 struct conf_sg_settings sg; 1291 struct conf_sg_settings sg;
1276 struct conf_rx_settings rx; 1292 struct conf_rx_settings rx;
@@ -1290,4 +1306,10 @@ struct wlcore_conf {
1290 struct conf_hangover_settings hangover; 1306 struct conf_hangover_settings hangover;
1291} __packed; 1307} __packed;
1292 1308
1309struct wlcore_conf_file {
1310 struct wlcore_conf_header header;
1311 struct wlcore_conf core;
1312 u8 priv[0];
1313} __packed;
1314
1293#endif 1315#endif