Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 391e771c authored by Lior David's avatar Lior David Committed by Maya Erez
Browse files

wil6210: support for platform specific crash recovery



Added a simple interface for platform to perform crash
recovery.
When firmware crashes, wil driver can notify the platform
which can trigger a crash recovery process. During
the process the platform can request a ram dump
from the wil driver as well as control when firmware
recovery will start. This interface allows the platform
to implement a more advanced crash recovery, for
example to reset dependent subsystems in proper order, or
to provide its own notifications during the recovery process.

Change-Id: I2545d220b779c24931b6263249449f37bcad75a4
Signed-off-by: default avatarLior David <qca_liord@qca.qualcomm.com>
Signed-off-by: default avatarMaya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
Git-commit: ea3ade75db690dc47c78a77d71dfd7c2df3bb15d
Git-repo: https://github.com/kvalo/ath.git


Signed-off-by: default avatarMaya Erez <merez@codeaurora.org>
parent 0eb91c32
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -394,9 +394,13 @@ static irqreturn_t wil6210_irq_misc_thread(int irq, void *cookie)
		wil_fw_core_dump(wil);
		wil_fw_core_dump(wil);
		wil_notify_fw_error(wil);
		wil_notify_fw_error(wil);
		isr &= ~ISR_MISC_FW_ERROR;
		isr &= ~ISR_MISC_FW_ERROR;
		if (wil->platform_ops.notify_crash) {
			wil_err(wil, "notify platform driver about FW crash");
			wil->platform_ops.notify_crash(wil->platform_handle);
		} else {
			wil_fw_error_recovery(wil);
			wil_fw_error_recovery(wil);
		}
		}

	}
	if (isr & ISR_MISC_MBOX_EVT) {
	if (isr & ISR_MISC_MBOX_EVT) {
		wil_dbg_irq(wil, "MBOX event\n");
		wil_dbg_irq(wil, "MBOX event\n");
		wmi_recv_cmd(wil);
		wmi_recv_cmd(wil);
+28 −2
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (c) 2012-2014 Qualcomm Atheros, Inc.
 * Copyright (c) 2012-2015 Qualcomm Atheros, Inc.
 *
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * purpose with or without fee is hereby granted, provided that the above
@@ -125,11 +125,37 @@ static int wil_if_pcie_disable(struct wil6210_priv *wil)
	return 0;
	return 0;
}
}


static int wil_platform_rop_ramdump(void *wil_handle, void *buf, uint32_t size)
{
	struct wil6210_priv *wil = wil_handle;

	if (!wil)
		return -EINVAL;

	return wil_fw_copy_crash_dump(wil, buf, size);
}

static int wil_platform_rop_fw_recovery(void *wil_handle)
{
	struct wil6210_priv *wil = wil_handle;

	if (!wil)
		return -EINVAL;

	wil_fw_error_recovery(wil);

	return 0;
}

static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
{
	struct wil6210_priv *wil;
	struct wil6210_priv *wil;
	struct device *dev = &pdev->dev;
	struct device *dev = &pdev->dev;
	int rc;
	int rc;
	const struct wil_platform_rops rops = {
		.ramdump = wil_platform_rop_ramdump,
		.fw_recovery = wil_platform_rop_fw_recovery,
	};


	/* check HW */
	/* check HW */
	dev_info(&pdev->dev, WIL_NAME
	dev_info(&pdev->dev, WIL_NAME
@@ -154,7 +180,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id)
	/* rollback to if_free */
	/* rollback to if_free */


	wil->platform_handle =
	wil->platform_handle =
			wil_platform_init(&pdev->dev, &wil->platform_ops);
		wil_platform_init(&pdev->dev, &wil->platform_ops, &rops, wil);
	if (!wil->platform_handle) {
	if (!wil->platform_handle) {
		rc = -ENODEV;
		rc = -ENODEV;
		wil_err(wil, "wil_platform_init failed\n");
		wil_err(wil, "wil_platform_init failed\n");
+1 −0
Original line number Original line Diff line number Diff line
@@ -824,6 +824,7 @@ int wil_can_suspend(struct wil6210_priv *wil, bool is_runtime);
int wil_suspend(struct wil6210_priv *wil, bool is_runtime);
int wil_suspend(struct wil6210_priv *wil, bool is_runtime);
int wil_resume(struct wil6210_priv *wil, bool is_runtime);
int wil_resume(struct wil6210_priv *wil, bool is_runtime);


int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size);
void wil_fw_core_dump(struct wil6210_priv *wil);
void wil_fw_core_dump(struct wil6210_priv *wil);


#endif /* __WIL6210_H__ */
#endif /* __WIL6210_H__ */
+1 −2
Original line number Original line Diff line number Diff line
@@ -51,8 +51,7 @@ static int wil_fw_get_crash_dump_bounds(struct wil6210_priv *wil,
	return 0;
	return 0;
}
}


static int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest,
int wil_fw_copy_crash_dump(struct wil6210_priv *wil, void *dest, u32 size)
				  u32 size)
{
{
	int i;
	int i;
	const struct fw_map *map;
	const struct fw_map *map;
+2 −1
Original line number Original line Diff line number Diff line
@@ -35,7 +35,8 @@ void wil_platform_modexit(void)
 * It returns a handle which is used with the rest of the API
 * It returns a handle which is used with the rest of the API
 *
 *
 */
 */
void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops)
void *wil_platform_init(struct device *dev, struct wil_platform_ops *ops,
			const struct wil_platform_rops *rops, void *wil_handle)
{
{
	void *handle;
	void *handle;


Loading