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: 10102251 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 C904360360 for ; Fri, 8 Dec 2017 10:38:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E674728A9B for ; Fri, 8 Dec 2017 10:38:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB58528A9E; Fri, 8 Dec 2017 10:38:14 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 552FC28A9B for ; Fri, 8 Dec 2017 10:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753373AbdLHKiM (ORCPT ); Fri, 8 Dec 2017 05:38:12 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:44402 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753341AbdLHKiG (ORCPT ); Fri, 8 Dec 2017 05:38:06 -0500 Received: by mail-qt0-f196.google.com with SMTP id m59so24843618qte.11 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=KMAjFEnZupho/6gtfWgXU2IOgAkzrnqFvpXQhYyTfPt9FWa9DxUvfWaGK9dcK7aq8B o1XIFl+DF00bXOkbTahoTt2Ek9DcOcbKLOlnNC9P1J3/9mGHDznIOllHsWMOXcYimzaK lQ8jhmMvgPVO+qc9VIB5rHUShcaMti/t2kEve5smZv2d8/JHPHlVy+gA4dpgRxEww+bC NqLrT+4WpaKqy5Chg7P4jxh1VF2/YAxOFwL3a5UCJvwcUmqkkx12gvqi8u8Y1AX2lm4d gezY0dSzBN2jRPzk/YdCOw/mttN2BhGLwdHrzBOqgmIH2r+Ghsk4bb5HI6rWz/sIiMct FrPw== X-Gm-Message-State: AKGB3mI9nS81CPCDhh68sYwS6TNavP10m7e47AiRf6upMbeeLEUvmxob vdbdSf69clNpFFIpCX3GwE6PLk5E 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 Cc: linux-wireless@vger.kernel.org, devicetree@vger.kernel.org, robh+dt@kernel.org, mark.rutland@arm.com, ext.waldemar.rymarkiewicz@tieto.com, kvalo@codeaurora.org, Sven Eckelmann 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> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.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) {