From patchwork Fri Dec 8 10:37:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 10102255 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 2214D60360 for ; Fri, 8 Dec 2017 10:38:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3ED1328A9B for ; Fri, 8 Dec 2017 10:38:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 334F128A9E; Fri, 8 Dec 2017 10:38:36 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable 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 D93A728A9B for ; Fri, 8 Dec 2017 10:38:35 +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:References: In-Reply-To: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:List-Owner; bh=pgh+Uq7v4spBdmljwRu+78u1Hyld4lLcbsp3g0Jqays=; b=QE7yYQwuCkHF41WGH2EMR0riXr e/XHyzo5uvdybLDX4GxVaOZHRkDlQh0Tkxi4Y1sKGtN0wiK4b3huWcu8Qzv0W7E/fDmmVX3EDkidZ Qo1HNzUhpH7ftN1o47HoSchKZEzbqxDEKp05g+vwVUucK1sKNvdxmU3BcJkgvlVy0FcWnyZo+O7pf +zTOLikW0GMaD/2ct08HRZSSB4bksqQeIRZUu9ITUaB+6hQrkqcKv/otOpSWv5u8H+fkW5R6svtBS hVBto4/W5ZfjQIjG4fC0oC2bmMWQg4UPwEqPEWXTxo67xFzyxE29rOT00lpU4QrlUNdLyL57wafx+ 7hQYfi1Q==; 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 1eNG35-0002jO-KR; Fri, 08 Dec 2017 10:38:31 +0000 Received: from mail-qt0-x242.google.com ([2607:f8b0:400d:c0d::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eNG30-0002aC-MA for ath10k@lists.infradead.org; Fri, 08 Dec 2017 10:38:29 +0000 Received: by mail-qt0-x242.google.com with SMTP id r39so24836446qtr.13 for ; Fri, 08 Dec 2017 02:38:06 -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:in-reply-to:references; bh=jWRxybA5lMFcSnU42oDTwFIZVPrQrBU9L+GEUd6Pxho=; b=ihQe79FnOgsVhDWm8pEIWWAKN7EKRwNKDldbvcJwHAbE39QfHtyCvP/dWOTwh6mJcT fo5h3X6F5WES5vi91W35J5azhpYoa1oBFFF345qbnyOG1eUwYUhrjoWM0nn1qUAdaa2K akOGi+3+2/UUfxfbzHe9g9QUJ8dr/DgmP0VxQ4d7xy7gMsCgs3zeb4tyIxQ6FN4rwcFP c3G+F2cuxVbbrWM3v8UsQ1w4MbJ17dVx0XHV+GJm2A3TXudwq/SFl7E1lp2r4kjW1x3x /dHvXS3xZH90EBGKXjFPZqZ6VaMi6ZusVEp2SdDR5Yt1JBq8quWgCga8pg9pbXelB1/z FXJg== 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:in-reply-to :references; bh=jWRxybA5lMFcSnU42oDTwFIZVPrQrBU9L+GEUd6Pxho=; b=TNvsxl8r6AUDUeqm2fho9ArEiCahNFOZXtWAUyCGuflodOjBKbj7SrxgWa56sSFoIb 89RRy0zz3TptTX+xJAvxcQgqTnzLh4SvPmTM0sHeQ3TwdC4FOQ6qE1hMW5LEvo4Pwf2n I9XSA916E2yFoiCmyd+WfFFdWDHBRur6DSD513YQfDiU/PU9hby0WOy6Dsu69l6+BmI2 jrxIt9545gyIdbPiQj5BjNDSPws9zdTZI1w/zR7We3RZ7eJa+NA08eRF3AmuoxSwwT2T YQ1nW6gq0ZVLxfEvi7iIrwzftut7eXtsRhpL8f0bMHwytCfXdHxGzFlk2OB67qJpcbPu M8Gw== X-Gm-Message-State: AKGB3mKUYnC87WXiZg/iJ7YxGUXNRUDp/wBF0vNDWPxoeRXit/YwG2vF IVcP+2R3B37kr3Qf4T4DVtLtT1pY X-Google-Smtp-Source: AGs4zMaMv6qTEXrj/UKCNxru5uEj+ZGAQx63r6e+axaW6Z8/itIPyI/vMN3t3AoOIc6iDtz3sEHiZw== X-Received: by 10.200.55.185 with SMTP id d54mr15732514qtc.105.1512729485634; Fri, 08 Dec 2017 02:38:05 -0800 (PST) Received: from sven-desktop.home.narfation.org (p2003007C6F5155EE36632B7A6E5F73C2.dip0.t-ipconnect.de. [2003:7c:6f51:55ee:3663:2b7a:6e5f:73c2]) by smtp.gmail.com with ESMTPSA id k7sm4354080qkf.57.2017.12.08.02.38.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Dec 2017 02:38:04 -0800 (PST) From: Sven Eckelmann To: ath10k@lists.infradead.org Subject: [PATCH v2 2/2] ath10k: search DT for qcom, ath10k-calibration-variant Date: Fri, 8 Dec 2017 11:37:42 +0100 Message-Id: <20171208103742.3181-3-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171208103742.3181-1-sven.eckelmann@openmesh.com> References: <20171208103742.3181-1-sven.eckelmann@openmesh.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171208_023826_958833_C02B8F87 X-CRM114-Status: GOOD ( 12.67 ) 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: mark.rutland@arm.com, devicetree@vger.kernel.org, linux-wireless@vger.kernel.org, robh+dt@kernel.org, Sven Eckelmann , ext.waldemar.rymarkiewicz@tieto.com, kvalo@codeaurora.org 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 Signed-off-by: Sven Eckelmann --- drivers/net/wireless/ath/ath10k/core.c | 40 ++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index b29fdbd21ead..6264e2cc4c0d 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -860,6 +860,28 @@ 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 = NULL; + + node = ar->dev->of_node; + if (!node) + return -ENOENT; + + of_property_read_string(node, "qcom,ath10k-calibration-variant", + &variant); + if (!variant) + return -ENODATA; + + if (strscpy(ar->id.bdf_ext, variant, sizeof(ar->id.bdf_ext)) < 0) + ath10k_dbg(ar, ATH10K_DBG_BOOT, + "bdf variant string is longer than the buffer can accommodate (variant: %s)\n", + variant); + + return 0; +} + static int ath10k_download_and_run_otp(struct ath10k *ar) { u32 result, address = ar->hw_params.patch_load_addr; @@ -1231,19 +1253,19 @@ 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), @@ -2343,7 +2365,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) {