提交 e403fa31 编写于 作者: S Stanislaw Gruszka 提交者: Kalle Valo

rt2x00: add restart hw

Add ieee80211_restart_hw() to watchdog and debugfs file for testing
if restart works as expected.
Signed-off-by: NStanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: NKalle Valo <kvalo@codeaurora.org>
上级 710e6cc1
...@@ -1263,6 +1263,9 @@ void rt2800_watchdog(struct rt2x00_dev *rt2x00dev) ...@@ -1263,6 +1263,9 @@ void rt2800_watchdog(struct rt2x00_dev *rt2x00dev)
if (hung_rx) if (hung_rx)
rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n"); rt2x00_warn(rt2x00dev, "Watchdog RX hung detected\n");
if (hung_tx || hung_rx)
ieee80211_restart_hw(rt2x00dev->hw);
} }
EXPORT_SYMBOL_GPL(rt2800_watchdog); EXPORT_SYMBOL_GPL(rt2800_watchdog);
...@@ -10283,6 +10286,7 @@ int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev) ...@@ -10283,6 +10286,7 @@ int rt2800_probe_hw(struct rt2x00_dev *rt2x00dev)
__set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags); __set_bit(REQUIRE_TASKLET_CONTEXT, &rt2x00dev->cap_flags);
} }
__set_bit(CAPABILITY_RESTART_HW, &rt2x00dev->cap_flags);
rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100); rt2x00dev->link.watchdog_interval = msecs_to_jiffies(100);
/* /*
......
...@@ -712,6 +712,7 @@ enum rt2x00_capability_flags { ...@@ -712,6 +712,7 @@ enum rt2x00_capability_flags {
CAPABILITY_VCO_RECALIBRATION, CAPABILITY_VCO_RECALIBRATION,
CAPABILITY_EXTERNAL_PA_TX0, CAPABILITY_EXTERNAL_PA_TX0,
CAPABILITY_EXTERNAL_PA_TX1, CAPABILITY_EXTERNAL_PA_TX1,
CAPABILITY_RESTART_HW,
}; };
/* /*
...@@ -1268,6 +1269,12 @@ rt2x00_has_cap_vco_recalibration(struct rt2x00_dev *rt2x00dev) ...@@ -1268,6 +1269,12 @@ rt2x00_has_cap_vco_recalibration(struct rt2x00_dev *rt2x00dev)
return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_VCO_RECALIBRATION); return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_VCO_RECALIBRATION);
} }
static inline bool
rt2x00_has_cap_restart_hw(struct rt2x00_dev *rt2x00dev)
{
return rt2x00_has_cap_flag(rt2x00dev, CAPABILITY_RESTART_HW);
}
/** /**
* rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes.
* @entry: Pointer to &struct queue_entry * @entry: Pointer to &struct queue_entry
......
...@@ -52,6 +52,7 @@ struct rt2x00debug_intf { ...@@ -52,6 +52,7 @@ struct rt2x00debug_intf {
* - chipset file * - chipset file
* - device state flags file * - device state flags file
* - device capability flags file * - device capability flags file
* - hardware restart file
* - register folder * - register folder
* - csr offset/value files * - csr offset/value files
* - eeprom offset/value files * - eeprom offset/value files
...@@ -68,6 +69,7 @@ struct rt2x00debug_intf { ...@@ -68,6 +69,7 @@ struct rt2x00debug_intf {
struct dentry *chipset_entry; struct dentry *chipset_entry;
struct dentry *dev_flags; struct dentry *dev_flags;
struct dentry *cap_flags; struct dentry *cap_flags;
struct dentry *restart_hw;
struct dentry *register_folder; struct dentry *register_folder;
struct dentry *csr_off_entry; struct dentry *csr_off_entry;
struct dentry *csr_val_entry; struct dentry *csr_val_entry;
...@@ -566,6 +568,34 @@ static const struct file_operations rt2x00debug_fop_cap_flags = { ...@@ -566,6 +568,34 @@ static const struct file_operations rt2x00debug_fop_cap_flags = {
.llseek = default_llseek, .llseek = default_llseek,
}; };
static ssize_t rt2x00debug_write_restart_hw(struct file *file,
const char __user *buf,
size_t length,
loff_t *offset)
{
struct rt2x00debug_intf *intf = file->private_data;
struct rt2x00_dev *rt2x00dev = intf->rt2x00dev;
static unsigned long last_reset;
if (!rt2x00_has_cap_restart_hw(rt2x00dev))
return -EOPNOTSUPP;
if (time_before(jiffies, last_reset + msecs_to_jiffies(2000)))
return -EBUSY;
last_reset = jiffies;
ieee80211_restart_hw(rt2x00dev->hw);
return length;
}
static const struct file_operations rt2x00debug_restart_hw = {
.owner = THIS_MODULE,
.write = rt2x00debug_write_restart_hw,
.open = simple_open,
.llseek = generic_file_llseek,
};
static struct dentry *rt2x00debug_create_file_driver(const char *name, static struct dentry *rt2x00debug_create_file_driver(const char *name,
struct rt2x00debug_intf struct rt2x00debug_intf
*intf, *intf,
...@@ -661,6 +691,10 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev) ...@@ -661,6 +691,10 @@ void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
intf->driver_folder, intf, intf->driver_folder, intf,
&rt2x00debug_fop_cap_flags); &rt2x00debug_fop_cap_flags);
intf->restart_hw = debugfs_create_file("restart_hw", 0200,
intf->driver_folder, intf,
&rt2x00debug_restart_hw);
intf->register_folder = intf->register_folder =
debugfs_create_dir("register", intf->driver_folder); debugfs_create_dir("register", intf->driver_folder);
...@@ -742,6 +776,7 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev) ...@@ -742,6 +776,7 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev)
debugfs_remove(intf->csr_off_entry); debugfs_remove(intf->csr_off_entry);
debugfs_remove(intf->register_folder); debugfs_remove(intf->register_folder);
debugfs_remove(intf->dev_flags); debugfs_remove(intf->dev_flags);
debugfs_remove(intf->restart_hw);
debugfs_remove(intf->cap_flags); debugfs_remove(intf->cap_flags);
debugfs_remove(intf->chipset_entry); debugfs_remove(intf->chipset_entry);
debugfs_remove(intf->driver_entry); debugfs_remove(intf->driver_entry);
......
...@@ -1258,8 +1258,14 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) ...@@ -1258,8 +1258,14 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev)
{ {
int retval; int retval;
if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) {
return 0; /*
* This is special case for ieee80211_restart_hw(), otherwise
* mac80211 never call start() two times in row without stop();
*/
rt2x00dev->ops->lib->pre_reset_hw(rt2x00dev);
rt2x00lib_stop(rt2x00dev);
}
/* /*
* If this is the first interface which is added, * If this is the first interface which is added,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册