From patchwork Thu Mar 9 15:58:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 9613613 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 156FE602B4 for ; Thu, 9 Mar 2017 15:58:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0424628686 for ; Thu, 9 Mar 2017 15:58:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC67228688; Thu, 9 Mar 2017 15:58:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D0C4228686 for ; Thu, 9 Mar 2017 15:58:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=MVEgr3tIcj9Q3vYnzF2ydnzUID1EjgC0V6jXiwiroBQ=; b=mKF 4+HmULQZxqJ+GIy3dE8/oAJByYoPOXIOVJXSwx2Vjx7gkqBXsSzkyOmOpVsy2xlDBcAF7yiONS9B9 w8o0dQoD9Afit870EmwGMFNPW8XA9TEBrPPxSdJsQiLwQqTwWNRAHvpkXvPypBEwmMjpo5cdDEdc7 ZwKEe8CGY8KEkhy8WnVVoso8Qg1V7V+SsXi21I6vq9RQ9Oko/JBd1vMNwSwhHQGHPhft+P5Q7IIvl hfMxrIk7cGtw/jsRKZulGT0eqxHEmhupfOhrOU2CZyFrPMbFl2tZxw2X/ua4FZ8ozlgF9wN0ZUaRo eRyEpcGMdtHkg7LZvjD1G6iBdvQRycw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cm0Sp-0003vt-Ky; Thu, 09 Mar 2017 15:58:51 +0000 Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cm0Sl-0003sP-5O for ath10k@lists.infradead.org; Thu, 09 Mar 2017 15:58:49 +0000 Received: by mail-wr0-x235.google.com with SMTP id l37so48019141wrc.1 for ; Thu, 09 Mar 2017 07:58:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openmesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=EbfGMudAUNrp69FBRuzZzmOiDuci1SacGDgZ5MQyR/0=; b=Xn98Eukg3DxD08GbFeEC/X80Oe/8KSx0cyA8QKSKK70ewTNXmOKkhWQTs446rKC17J ucdMB2/6E6bHzilx7U2jkKLCBVj1JhQXblf7wZwTohSzP/E8qN18S66cUc4h0cDv2N4I EwaA2Q+VyCwpsh3rSj5Ym5VbPRRiJB4j2AhxUbi/FH2DY/v5t8T4eKYQD9AGemMkk1wi ZZUDluEwqPkZHhn4pK09qTYTKYrmUOSqbe0XezFOd/InT7v+14I7iPTIoLxBAKC7zRdk BHWnvE1z8QAFAI4OBipi5XdLDMDBFO4bmLvGgMeO6eIRzP331/8JEZ+GRDbNfaZS25y3 g0uQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EbfGMudAUNrp69FBRuzZzmOiDuci1SacGDgZ5MQyR/0=; b=QWx+q5OCyrpiZLkYUcZaoQj2zQD7iW0bYKLrRAHUpc9Y9VwIxGg7jBDmVGnLlsIYZO od3yPEQQzBJKryvc4jZG249IVtT7iSxl/ViUpvJyFuCQepqn90wTe9qdCHshkOlF4QWc /Rk+/pwO05QBmQVhBbD6qt89dmWQeLNpYk2g2sA+v5gP75FntG64LzzoZgmxnftwB07U RmXLio+dA2OlA/l7N0rxoqE9rjYLAyjacydqnx4Su82Tv9Fd7KAt99Rl3oNMuFPh/fPj 140RSerxluyYLTOhtA2LctUhr8X7Rm4TDe0fOfCiD58wZCbpBk1vQJrV6+7Kwn1XZYAt m92g== X-Gm-Message-State: AMke39kMt2Oq1ewUcJVMhNARqMF3PYz6/quzus7uY70uvpECcrJ4Oaa7Mk3COrTqS4SX/VQc X-Received: by 10.223.155.211 with SMTP id e19mr10917448wrc.74.1489075104829; Thu, 09 Mar 2017 07:58:24 -0800 (PST) Received: from sven-desktop.home.narfation.org (p2003007C6F5577FE527B9DFFFECE2683.dip0.t-ipconnect.de. [2003:7c:6f55:77fe:527b:9dff:fece:2683]) by smtp.gmail.com with ESMTPSA id x193sm9286864wme.23.2017.03.09.07.58.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Mar 2017 07:58:24 -0800 (PST) From: Sven Eckelmann To: ath10k@lists.infradead.org Subject: [RFC v2] ath10k: search DT for qcom,ath10k-calibration-variant Date: Thu, 9 Mar 2017 16:58:11 +0100 Message-Id: <20170309155811.18705-1-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170309_075847_364058_ABE38F00 X-CRM114-Status: GOOD ( 13.87 ) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sven Eckelmann , linux-wireless@vger.kernel.org, John Crispin , Christian Lamparter , Waldemar Rymarkiewicz , Simon Wunderlich MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Board Data File (BDF) is loaded upon driver boot-up procedure. The right board data file is identified on QCA4019 using bus, bmi-chip-id and bmi-board-id. The problem, however, can occur when the (default) board data file cannot fulfill with the vendor requirements and it is necessary to use a different board data file. This problem was solved for SMBIOS by adding a special SMBIOS type 0xF8. Something similar has to be provided for systems without SMBIOS but with device trees. No solution was specified by QCA and therefore a new one has to be found for ath10k. The device tree requires addition strings to define the variant name wifi@a000000 { status = "okay"; qcom,ath10k-calibration-variant = "RT-AC58U"; }; wifi@a800000 { status = "okay"; qcom,ath10k-calibration-variant = "RT-AC58U"; }; This would create the boarddata identifiers for the board-2.bin search * bus=ahb,bmi-chip-id=0,bmi-board-id=16,variant=RT-AC58U * bus=ahb,bmi-chip-id=0,bmi-board-id=17,variant=RT-AC58U Cc: Waldemar Rymarkiewicz Signed-off-by: Sven Eckelmann --- Cc: Christian Lamparter Cc: John Crispin Cc: Simon Wunderlich v2: - re-added missing chunk for ath10k_core_create_board_name again --- .../bindings/net/wireless/qcom,ath10k.txt | 3 ++ drivers/net/wireless/ath/ath10k/core.c | 44 ++++++++++++++++++---- 2 files changed, 40 insertions(+), 7 deletions(-) diff --git a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt index 74d7f0af209c..60f87439308e 100644 --- a/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt +++ b/Documentation/devicetree/bindings/net/wireless/qcom,ath10k.txt @@ -41,6 +41,9 @@ Optional properties: - qcom,msi_addr: MSI interrupt address. - qcom,msi_base: Base value to add before writing MSI data into MSI address register. +- qcom,ath10k-calibration-variant: string to search for in the board-2.bin + variant list with the same bus bmi-chip-id, + and bmi-board-id - qcom,ath10k-calibration-data : calibration data + board specific data as an array, the length can vary between hw versions. diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 0a8e29e9a0eb..8b5f8f22f89e 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -779,6 +779,31 @@ static int ath10k_core_check_smbios(struct ath10k *ar) return 0; } +static int ath10k_core_check_dt(struct ath10k *ar) +{ + struct device_node *node; + const char *variant; + + /* don't overwrite the smbios entry */ + if (ar->id.bdf_ext[0] != '\0') + return 0; + + node = ar->dev->of_node; + if (!node) + return -ENOENT; + + of_property_read_string(node, "qcom,ath10k-calibration-variant", + &variant); + if (!variant) { + ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not found.\n"); + return -ENODATA; + } + + strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext)); + + return 0; +} + static int ath10k_download_and_run_otp(struct ath10k *ar) { u32 result, address = ar->hw_params.patch_load_addr; @@ -1145,19 +1170,20 @@ static int ath10k_core_create_board_name(struct ath10k *ar, char *name, /* strlen(',variant=') + strlen(ar->id.bdf_ext) */ char variant[9 + ATH10K_SMBIOS_BDF_EXT_STR_LENGTH] = { 0 }; + + if (ar->id.bdf_ext[0] != '\0') + scnprintf(variant, sizeof(variant), ",variant=%s", + ar->id.bdf_ext); + if (ar->id.bmi_ids_valid) { scnprintf(name, name_len, - "bus=%s,bmi-chip-id=%d,bmi-board-id=%d", + "bus=%s,bmi-chip-id=%d,bmi-board-id=%d%s", ath10k_bus_str(ar->hif.bus), ar->id.bmi_chip_id, - ar->id.bmi_board_id); + ar->id.bmi_board_id, variant); goto out; } - if (ar->id.bdf_ext[0] != '\0') - scnprintf(variant, sizeof(variant), ",variant=%s", - ar->id.bdf_ext); - scnprintf(name, name_len, "bus=%s,vendor=%04x,device=%04x,subsystem-vendor=%04x,subsystem-device=%04x%s", ath10k_bus_str(ar->hif.bus), @@ -2221,7 +2247,11 @@ static int ath10k_core_probe_fw(struct ath10k *ar) ret = ath10k_core_check_smbios(ar); if (ret) - ath10k_dbg(ar, ATH10K_DBG_BOOT, "bdf variant name not set.\n"); + ath10k_dbg(ar, ATH10K_DBG_BOOT, "SMBIOS bdf variant name not set.\n"); + + ret = ath10k_core_check_dt(ar); + if (ret) + ath10k_dbg(ar, ATH10K_DBG_BOOT, "DT bdf variant name not set.\n"); ret = ath10k_core_fetch_board_file(ar); if (ret) {