From patchwork Tue Dec 23 07:47:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Kondratiev X-Patchwork-Id: 5531041 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3ED82BEEA8 for ; Tue, 23 Dec 2014 07:48:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 62C3C2010C for ; Tue, 23 Dec 2014 07:48:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E4D720121 for ; Tue, 23 Dec 2014 07:48:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755246AbaLWHsf (ORCPT ); Tue, 23 Dec 2014 02:48:35 -0500 Received: from wolverine02.qualcomm.com ([199.106.114.251]:21161 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755140AbaLWHsd (ORCPT ); Tue, 23 Dec 2014 02:48:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qca.qualcomm.com; i=@qca.qualcomm.com; q=dns/txt; s=qcdkim; t=1419320913; x=1450856913; h=from:cc:to:subject:date:message-id:in-reply-to: references; bh=E6d8zcYM/mKI03EDxYWK2MsFL9Gwwa55/ykQN+it01o=; b=l8g+rNYQMKDUVTETXFtX5EJu1rcsUzLo1f93xEB4ZODGccilZmKaSDbz ACiBErF/XEL7M8Cl3SZf8yRpqZTSVlTrjBL9Tt4YAqcnA4I7koIbBRd9d 9+NIqxDemwzPtiAUMM2w7PMoyI5zVFN7907qNBHHoe7H9JVAZu8OBmre/ Y=; X-IronPort-AV: E=McAfee;i="5600,1067,7660"; a="186726554" Received: from ironmsg03-r.qualcomm.com ([172.30.46.17]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 22 Dec 2014 23:48:23 -0800 From: Vladimir Kondratiev Cc: Vladimir Kondratiev , linux-wireless@vger.kernel.org, wil6210@qca.qualcomm.com X-IronPort-AV: E=Sophos;i="5.07,630,1413270000"; d="scan'208";a="817199494" Received: from lx-wigig-72.mea.qualcomm.com ([10.18.164.37]) by Ironmsg03-R.qualcomm.com with ESMTP; 22 Dec 2014 23:48:22 -0800 To: Kalle Valo Subject: [PATCH 15/22] wil6210: detect HW capabilities Date: Tue, 23 Dec 2014 09:47:17 +0200 Message-Id: <1419320844-23989-16-git-send-email-qca_vkondrat@qca.qualcomm.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1419320844-23989-1-git-send-email-qca_vkondrat@qca.qualcomm.com> References: <1419320844-23989-1-git-send-email-qca_vkondrat@qca.qualcomm.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Read relevant information (HW ID for now) once on init and set capabilities accordingly. Signed-off-by: Vladimir Kondratiev --- drivers/net/wireless/ath/wil6210/pcie_bus.c | 32 ++++++++++++++++++++++++++++- drivers/net/wireless/ath/wil6210/wil6210.h | 20 ++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/wil6210/pcie_bus.c b/drivers/net/wireless/ath/wil6210/pcie_bus.c index 66626a8..371809d 100644 --- a/drivers/net/wireless/ath/wil6210/pcie_bus.c +++ b/drivers/net/wireless/ath/wil6210/pcie_bus.c @@ -31,6 +31,36 @@ static bool debug_fw; /* = false; */ module_param(debug_fw, bool, S_IRUGO); MODULE_PARM_DESC(debug_fw, " load driver if FW not ready. For FW debug"); +static +void wil_set_capabilities(struct wil6210_priv *wil) +{ + u32 rev_id = ioread32(wil->csr + HOSTADDR(RGF_USER_JTAG_DEV_ID)); + + bitmap_zero(wil->hw_capabilities, hw_capability_last); + + switch (rev_id) { + case JTAG_DEV_ID_MARLON_B0: + wil_info(wil, "Board hardware is Marlon B0\n"); + wil->hw_version = HW_VER_MARLON_B0; + break; + case JTAG_DEV_ID_SPARROW_A0: + wil_info(wil, "Board hardware is Sparrow A0\n"); + wil->hw_version = HW_VER_SPARROW_A0; + break; + case JTAG_DEV_ID_SPARROW_A1: + wil_info(wil, "Board hardware is Sparrow A1\n"); + wil->hw_version = HW_VER_SPARROW_A1; + break; + case JTAG_DEV_ID_SPARROW_B0: + wil_info(wil, "Board hardware is Sparrow B0\n"); + wil->hw_version = HW_VER_SPARROW_B0; + break; + default: + wil_err(wil, "Unknown board hardware 0x%08x\n", rev_id); + wil->hw_version = HW_VER_UNKNOWN; + } +} + void wil_disable_irq(struct wil6210_priv *wil) { int irq = wil->pdev->irq; @@ -205,7 +235,7 @@ static int wil_pcie_probe(struct pci_dev *pdev, const struct pci_device_id *id) pci_set_drvdata(pdev, wil); wil->pdev = pdev; wil->board = board; - + wil_set_capabilities(wil); wil6210_clear_irq(wil); wil->platform_handle = diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h index 64a6d49..d296f2e 100644 --- a/drivers/net/wireless/ath/wil6210/wil6210.h +++ b/drivers/net/wireless/ath/wil6210/wil6210.h @@ -188,6 +188,20 @@ struct RGF_ICR { #define RGF_CAF_PLL_LOCK_STATUS (0x88afec) #define BIT_CAF_OSC_DIG_XTAL_STABLE BIT(0) +#define RGF_USER_JTAG_DEV_ID (0x880b34) /* device ID */ + #define JTAG_DEV_ID_MARLON_B0 (0x0612072f) + #define JTAG_DEV_ID_SPARROW_A0 (0x0632072f) + #define JTAG_DEV_ID_SPARROW_A1 (0x1632072f) + #define JTAG_DEV_ID_SPARROW_B0 (0x2632072f) + +enum { + HW_VER_UNKNOWN, + HW_VER_MARLON_B0, /* JTAG_DEV_ID_MARLON_B0 */ + HW_VER_SPARROW_A0, /* JTAG_DEV_ID_SPARROW_A0 */ + HW_VER_SPARROW_A1, /* JTAG_DEV_ID_SPARROW_A1 */ + HW_VER_SPARROW_B0, /* JTAG_DEV_ID_SPARROW_B0 */ +}; + /* popular locations */ #define HOST_MBOX HOSTADDR(RGF_USER_USER_SCRATCH_PAD) #define HOST_SW_INT (HOSTADDR(RGF_USER_USER_ICR) + \ @@ -426,6 +440,11 @@ enum { fw_recovery_running = 2, }; +enum { + hw_capability_dummy, /* to avoid zero array */ + hw_capability_last +}; + struct wil_back_rx { struct list_head list; /* request params, converted to CPU byte order - what we asked for */ @@ -452,6 +471,7 @@ struct wil6210_priv { DECLARE_BITMAP(status, wil_status_last); u32 fw_version; u32 hw_version; + DECLARE_BITMAP(hw_capabilities, hw_capability_last); struct wil_board *board; u8 n_mids; /* number of additional MIDs as reported by FW */ u32 recovery_count; /* num of FW recovery attempts in a short time */