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

Commit a351f2f5 authored by Lazar Alexei's avatar Lazar Alexei Committed by Kalle Valo
Browse files

wil6210: support loading dedicated image for sparrow-plus devices



Driver may be used in platforms where some use sparrow cards while
other use sparrow-plus cards, where different FW image is needed.
Add the capability to load dedicated FW image in case sparrow-plus
card is detected and fallback to default image if such does not exist.

Signed-off-by: default avatarLazar Alexei <qca_ailizaro@qca.qualcomm.com>
Signed-off-by: default avatarMaya Erez <qca_merez@qca.qualcomm.com>
Signed-off-by: default avatarKalle Valo <kvalo@qca.qualcomm.com>
parent 849a564b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2016 Qualcomm Atheros, Inc.
 * Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
@@ -1699,6 +1699,7 @@ static const struct dbg_off dbg_wil_off[] = {
	WIL_FIELD(recovery_count, S_IRUGO,		doff_u32),
	WIL_FIELD(ap_isolate,	S_IRUGO,		doff_u32),
	WIL_FIELD(discovery_mode, S_IRUGO | S_IWUSR,	doff_u8),
	WIL_FIELD(chip_revision, S_IRUGO,		doff_u8),
	{},
};

+4 −3
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2015 Qualcomm Atheros, Inc.
 * Copyright (c) 2014-2015,2017 Qualcomm Atheros, Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
@@ -19,8 +19,9 @@
#include "wil6210.h"
#include "fw.h"

MODULE_FIRMWARE(WIL_FW_NAME);
MODULE_FIRMWARE(WIL_FW2_NAME);
MODULE_FIRMWARE(WIL_FW_NAME_DEFAULT);
MODULE_FIRMWARE(WIL_FW_NAME_SPARROW_PLUS);
MODULE_FIRMWARE(WIL_BOARD_FILE_NAME);

static
void wil_memset_toio_32(volatile void __iomem *dst, u32 val,
+20 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2014-2016 Qualcomm Atheros, Inc.
 * Copyright (c) 2014-2017 Qualcomm Atheros, Inc.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
@@ -537,3 +537,22 @@ int wil_request_firmware(struct wil6210_priv *wil, const char *name,
	release_firmware(fw);
	return rc;
}

/**
 * wil_fw_verify_file_exists - checks if firmware file exist
 *
 * @wil: driver context
 * @name: firmware file name
 *
 * return value - boolean, true for success, false for failure
 */
bool wil_fw_verify_file_exists(struct wil6210_priv *wil, const char *name)
{
	const struct firmware *fw;
	int rc;

	rc = request_firmware(&fw, name, wil_to_dev(wil));
	if (!rc)
		release_firmware(fw);
	return rc != -ENOENT;
}
+4 −4
Original line number Diff line number Diff line
@@ -934,16 +934,16 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)

	wil_set_oob_mode(wil, oob_mode);
	if (load_fw) {
		wil_info(wil, "Use firmware <%s> + board <%s>\n", WIL_FW_NAME,
			 WIL_FW2_NAME);
		wil_info(wil, "Use firmware <%s> + board <%s>\n",
			 wil->wil_fw_name, WIL_BOARD_FILE_NAME);

		wil_halt_cpu(wil);
		memset(wil->fw_version, 0, sizeof(wil->fw_version));
		/* Loading f/w from the file */
		rc = wil_request_firmware(wil, WIL_FW_NAME, true);
		rc = wil_request_firmware(wil, wil->wil_fw_name, true);
		if (rc)
			return rc;
		rc = wil_request_firmware(wil, WIL_FW2_NAME, true);
		rc = wil_request_firmware(wil, WIL_BOARD_FILE_NAME, true);
		if (rc)
			return rc;

+28 −8
Original line number Diff line number Diff line
@@ -36,18 +36,38 @@ static int wil6210_pm_notify(struct notifier_block *notify_block,
static
void wil_set_capabilities(struct wil6210_priv *wil)
{
	u32 rev_id = wil_r(wil, RGF_USER_JTAG_DEV_ID);
	u32 jtag_id = wil_r(wil, RGF_USER_JTAG_DEV_ID);
	u8 chip_revision = (wil_r(wil, RGF_USER_REVISION_ID) &
			    RGF_USER_REVISION_ID_MASK);

	bitmap_zero(wil->hw_capabilities, hw_capability_last);
	bitmap_zero(wil->fw_capabilities, WMI_FW_CAPABILITY_MAX);

	switch (rev_id) {
	case JTAG_DEV_ID_SPARROW_B0:
	wil->wil_fw_name = WIL_FW_NAME_DEFAULT;
	wil->chip_revision = chip_revision;

	switch (jtag_id) {
	case JTAG_DEV_ID_SPARROW:
		switch (chip_revision) {
		case REVISION_ID_SPARROW_D0:
			wil->hw_name = "Sparrow D0";
			wil->hw_version = HW_VER_SPARROW_D0;
			if (wil_fw_verify_file_exists(wil,
						      WIL_FW_NAME_SPARROW_PLUS))
				wil->wil_fw_name = WIL_FW_NAME_SPARROW_PLUS;
			break;
		case REVISION_ID_SPARROW_B0:
			wil->hw_name = "Sparrow B0";
			wil->hw_version = HW_VER_SPARROW_B0;
			break;
		default:
		wil_err(wil, "Unknown board hardware 0x%08x\n", rev_id);
			wil->hw_name = "Unknown";
			wil->hw_version = HW_VER_UNKNOWN;
			break;
		}
		break;
	default:
		wil_err(wil, "Unknown board hardware, chip_id 0x%08x, chip_revision 0x%08x\n",
			jtag_id, chip_revision);
		wil->hw_name = "Unknown";
		wil->hw_version = HW_VER_UNKNOWN;
	}
@@ -55,7 +75,7 @@ void wil_set_capabilities(struct wil6210_priv *wil)
	wil_info(wil, "Board hardware is %s\n", wil->hw_name);

	/* extract FW capabilities from file without loading the FW */
	wil_request_firmware(wil, WIL_FW_NAME, false);
	wil_request_firmware(wil, wil->wil_fw_name, false);
}

void wil_disable_irq(struct wil6210_priv *wil)
Loading