aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-debugfs.c
diff options
context:
space:
mode:
authorWey-Yi Guy <wey-yi.w.guy@intel.com>2009-05-22 14:01:46 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-05-22 14:06:04 -0400
commit0848e297c2107dbc12a91a1709c879c73bd188d8 (patch)
treeeb98eab2c1e4701ac84daf68461c80c03d9016b3 /drivers/net/wireless/iwlwifi/iwl-debugfs.c
parent8a566afea0639fc387add782bc799009512a911b (diff)
iwlwifi: support NVM access (EEPROM/OTP)
Two type of NVM available for devices 1000, 6000 and after, adding support to read OTP lower blocks if OTP is used instead of EEPROM. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-debugfs.c')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-debugfs.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-debugfs.c b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
index ffc4be3842b2..713f9edd055d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-debugfs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-debugfs.c
@@ -292,7 +292,7 @@ static ssize_t iwl_dbgfs_stations_read(struct file *file, char __user *user_buf,
292 return ret; 292 return ret;
293} 293}
294 294
295static ssize_t iwl_dbgfs_eeprom_read(struct file *file, 295static ssize_t iwl_dbgfs_nvm_read(struct file *file,
296 char __user *user_buf, 296 char __user *user_buf,
297 size_t count, 297 size_t count,
298 loff_t *ppos) 298 loff_t *ppos)
@@ -306,7 +306,7 @@ static ssize_t iwl_dbgfs_eeprom_read(struct file *file,
306 buf_size = 4 * eeprom_len + 256; 306 buf_size = 4 * eeprom_len + 256;
307 307
308 if (eeprom_len % 16) { 308 if (eeprom_len % 16) {
309 IWL_ERR(priv, "EEPROM size is not multiple of 16.\n"); 309 IWL_ERR(priv, "NVM size is not multiple of 16.\n");
310 return -ENODATA; 310 return -ENODATA;
311 } 311 }
312 312
@@ -318,6 +318,13 @@ static ssize_t iwl_dbgfs_eeprom_read(struct file *file,
318 } 318 }
319 319
320 ptr = priv->eeprom; 320 ptr = priv->eeprom;
321 if (!ptr) {
322 IWL_ERR(priv, "Invalid EEPROM/OTP memory\n");
323 return -ENOMEM;
324 }
325 pos += scnprintf(buf + pos, buf_size - pos, "NVM Type: %s\n",
326 (priv->nvm_device_type == NVM_DEVICE_TYPE_OTP)
327 ? "OTP" : "EEPROM");
321 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) { 328 for (ofs = 0 ; ofs < eeprom_len ; ofs += 16) {
322 pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs); 329 pos += scnprintf(buf + pos, buf_size - pos, "0x%.4x ", ofs);
323 hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos, 330 hex_dump_to_buffer(ptr + ofs, 16 , 16, 2, buf + pos,
@@ -419,7 +426,6 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
419 channels[i].flags & 426 channels[i].flags &
420 IEEE80211_CHAN_PASSIVE_SCAN ? 427 IEEE80211_CHAN_PASSIVE_SCAN ?
421 "passive only" : "active/passive"); 428 "passive only" : "active/passive");
422
423 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos); 429 ret = simple_read_from_buffer(user_buf, count, ppos, buf, pos);
424 kfree(buf); 430 kfree(buf);
425 return ret; 431 return ret;
@@ -564,7 +570,7 @@ static ssize_t iwl_dbgfs_interrupt_write(struct file *file,
564 570
565DEBUGFS_READ_WRITE_FILE_OPS(sram); 571DEBUGFS_READ_WRITE_FILE_OPS(sram);
566DEBUGFS_WRITE_FILE_OPS(log_event); 572DEBUGFS_WRITE_FILE_OPS(log_event);
567DEBUGFS_READ_FILE_OPS(eeprom); 573DEBUGFS_READ_FILE_OPS(nvm);
568DEBUGFS_READ_FILE_OPS(stations); 574DEBUGFS_READ_FILE_OPS(stations);
569DEBUGFS_READ_FILE_OPS(rx_statistics); 575DEBUGFS_READ_FILE_OPS(rx_statistics);
570DEBUGFS_READ_FILE_OPS(tx_statistics); 576DEBUGFS_READ_FILE_OPS(tx_statistics);
@@ -598,7 +604,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
598 604
599 DEBUGFS_ADD_DIR(data, dbgfs->dir_drv); 605 DEBUGFS_ADD_DIR(data, dbgfs->dir_drv);
600 DEBUGFS_ADD_DIR(rf, dbgfs->dir_drv); 606 DEBUGFS_ADD_DIR(rf, dbgfs->dir_drv);
601 DEBUGFS_ADD_FILE(eeprom, data); 607 DEBUGFS_ADD_FILE(nvm, data);
602 DEBUGFS_ADD_FILE(sram, data); 608 DEBUGFS_ADD_FILE(sram, data);
603 DEBUGFS_ADD_FILE(log_event, data); 609 DEBUGFS_ADD_FILE(log_event, data);
604 DEBUGFS_ADD_FILE(stations, data); 610 DEBUGFS_ADD_FILE(stations, data);
@@ -629,7 +635,7 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv)
629 if (!priv->dbgfs) 635 if (!priv->dbgfs)
630 return; 636 return;
631 637
632 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_eeprom); 638 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_nvm);
633 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_rx_statistics); 639 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_rx_statistics);
634 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_tx_statistics); 640 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_tx_statistics);
635 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram); 641 DEBUGFS_REMOVE(priv->dbgfs->dbgfs_data_files.file_sram);