cnss2: Enhance debugfs support for device boot
Add the debugfs support for full power on sequence to boot device, full power off sequence to shutdown device, PCIe link up/down and powering off device only. It can help to debug device boot issues without WLAN host driver. Change-Id: Ie1e65719eff0918cf64d1f0926ec36cad1c869e6 CRs-fixed: 2059087 Signed-off-by: Yue Ma <yuem@codeaurora.org>
This commit is contained in:
parent
bb7cc76a8f
commit
c876f88cef
3 changed files with 28 additions and 1 deletions
|
@ -98,6 +98,8 @@ static int cnss_stats_show_state(struct seq_file *s,
|
||||||
continue;
|
continue;
|
||||||
case CNSS_DEV_ERR_NOTIFY:
|
case CNSS_DEV_ERR_NOTIFY:
|
||||||
seq_puts(s, "DEV_ERR");
|
seq_puts(s, "DEV_ERR");
|
||||||
|
case CNSS_DRIVER_DEBUG:
|
||||||
|
seq_puts(s, "DRIVER_DEBUG");
|
||||||
}
|
}
|
||||||
|
|
||||||
seq_printf(s, "UNKNOWN-%d", i);
|
seq_printf(s, "UNKNOWN-%d", i);
|
||||||
|
@ -149,10 +151,26 @@ static ssize_t cnss_dev_boot_debug_write(struct file *fp,
|
||||||
|
|
||||||
if (sysfs_streq(cmd, "on")) {
|
if (sysfs_streq(cmd, "on")) {
|
||||||
ret = cnss_power_on_device(plat_priv);
|
ret = cnss_power_on_device(plat_priv);
|
||||||
|
} else if (sysfs_streq(cmd, "off")) {
|
||||||
|
cnss_power_off_device(plat_priv);
|
||||||
} else if (sysfs_streq(cmd, "enumerate")) {
|
} else if (sysfs_streq(cmd, "enumerate")) {
|
||||||
ret = cnss_pci_init(plat_priv);
|
ret = cnss_pci_init(plat_priv);
|
||||||
} else if (sysfs_streq(cmd, "download")) {
|
} else if (sysfs_streq(cmd, "download")) {
|
||||||
ret = cnss_pci_start_mhi(plat_priv->bus_priv);
|
ret = cnss_pci_start_mhi(plat_priv->bus_priv);
|
||||||
|
} else if (sysfs_streq(cmd, "linkup")) {
|
||||||
|
ret = cnss_resume_pci_link(plat_priv->bus_priv);
|
||||||
|
} else if (sysfs_streq(cmd, "linkdown")) {
|
||||||
|
ret = cnss_suspend_pci_link(plat_priv->bus_priv);
|
||||||
|
} else if (sysfs_streq(cmd, "powerup")) {
|
||||||
|
set_bit(CNSS_DRIVER_DEBUG, &plat_priv->driver_state);
|
||||||
|
ret = cnss_driver_event_post(plat_priv,
|
||||||
|
CNSS_DRIVER_EVENT_POWER_UP,
|
||||||
|
true, NULL);
|
||||||
|
} else if (sysfs_streq(cmd, "shutdown")) {
|
||||||
|
ret = cnss_driver_event_post(plat_priv,
|
||||||
|
CNSS_DRIVER_EVENT_POWER_DOWN,
|
||||||
|
true, NULL);
|
||||||
|
clear_bit(CNSS_DRIVER_DEBUG, &plat_priv->driver_state);
|
||||||
} else {
|
} else {
|
||||||
cnss_pr_err("Device boot debugfs command is invalid\n");
|
cnss_pr_err("Device boot debugfs command is invalid\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
@ -169,8 +187,11 @@ static int cnss_dev_boot_debug_show(struct seq_file *s, void *data)
|
||||||
seq_puts(s, "\nUsage: echo <action> > <debugfs_path>/cnss/dev_boot\n");
|
seq_puts(s, "\nUsage: echo <action> > <debugfs_path>/cnss/dev_boot\n");
|
||||||
seq_puts(s, "<action> can be one of below:\n");
|
seq_puts(s, "<action> can be one of below:\n");
|
||||||
seq_puts(s, "on: turn on device power, assert WLAN_EN\n");
|
seq_puts(s, "on: turn on device power, assert WLAN_EN\n");
|
||||||
|
seq_puts(s, "off: de-assert WLAN_EN, turn off device power\n");
|
||||||
seq_puts(s, "enumerate: de-assert PERST, enumerate PCIe\n");
|
seq_puts(s, "enumerate: de-assert PERST, enumerate PCIe\n");
|
||||||
seq_puts(s, "download: download FW and do QMI handshake with FW\n");
|
seq_puts(s, "download: download FW and do QMI handshake with FW\n");
|
||||||
|
seq_puts(s, "powerup: full power on sequence to boot device, download FW and do QMI handshake with FW\n");
|
||||||
|
seq_puts(s, "shutdown: full power off sequence to shutdown device\n");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1060,11 +1060,15 @@ static int cnss_qca6174_shutdown(struct cnss_plat_data *plat_priv)
|
||||||
if (!pci_priv)
|
if (!pci_priv)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
if (test_bit(CNSS_DRIVER_DEBUG, &plat_priv->driver_state))
|
||||||
|
goto skip_driver_remove;
|
||||||
|
|
||||||
if (!plat_priv->driver_ops)
|
if (!plat_priv->driver_ops)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
cnss_driver_call_remove(plat_priv);
|
cnss_driver_call_remove(plat_priv);
|
||||||
|
|
||||||
|
skip_driver_remove:
|
||||||
cnss_request_bus_bandwidth(CNSS_BUS_WIDTH_NONE);
|
cnss_request_bus_bandwidth(CNSS_BUS_WIDTH_NONE);
|
||||||
cnss_pci_set_monitor_wake_intr(pci_priv, false);
|
cnss_pci_set_monitor_wake_intr(pci_priv, false);
|
||||||
cnss_pci_set_auto_suspended(pci_priv, 0);
|
cnss_pci_set_auto_suspended(pci_priv, 0);
|
||||||
|
@ -1162,7 +1166,8 @@ static int cnss_qca6290_shutdown(struct cnss_plat_data *plat_priv)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if (test_bit(CNSS_COLD_BOOT_CAL, &plat_priv->driver_state) ||
|
if (test_bit(CNSS_COLD_BOOT_CAL, &plat_priv->driver_state) ||
|
||||||
test_bit(CNSS_FW_BOOT_RECOVERY, &plat_priv->driver_state))
|
test_bit(CNSS_FW_BOOT_RECOVERY, &plat_priv->driver_state) ||
|
||||||
|
test_bit(CNSS_DRIVER_DEBUG, &plat_priv->driver_state))
|
||||||
goto skip_driver_remove;
|
goto skip_driver_remove;
|
||||||
|
|
||||||
if (!plat_priv->driver_ops)
|
if (!plat_priv->driver_ops)
|
||||||
|
|
|
@ -142,6 +142,7 @@ enum cnss_driver_state {
|
||||||
CNSS_DRIVER_RECOVERY,
|
CNSS_DRIVER_RECOVERY,
|
||||||
CNSS_FW_BOOT_RECOVERY,
|
CNSS_FW_BOOT_RECOVERY,
|
||||||
CNSS_DEV_ERR_NOTIFY,
|
CNSS_DEV_ERR_NOTIFY,
|
||||||
|
CNSS_DRIVER_DEBUG,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cnss_recovery_data {
|
struct cnss_recovery_data {
|
||||||
|
|
Loading…
Add table
Reference in a new issue