From patchwork Thu Mar 9 15:24:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 9613553 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 30AC5604D9 for ; Thu, 9 Mar 2017 15:35:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FFE628677 for ; Thu, 9 Mar 2017 15:35:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 04B132867A; Thu, 9 Mar 2017 15:35:47 +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.1 required=2.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_SIGNED,DKIM_VALID autolearn=no 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 8740028677 for ; Thu, 9 Mar 2017 15:35:46 +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=Ua4esEAGVBI3zCb4Nm/X8aecsd5d3dmkrpzD6LD4yCM=; b=PtC Ce9GPyHBGWTRCJSrQjtf7javMT5xc3dKUL2jwVm3+9xiF6Yv4ZWyBUv7bPeJsEnuTplgrZz6n9mbg FF4ayWMbsI/fLPYMB+wMUR0E0sRvubFzU5SD0HFXOjQRJJZMhrNnIZ45SvjdpX3UJ6OrE6h9t2XCf dJvAWyS+fk/upynp2gdT7xoscvVY2UadAe8habhHEtlRAG58EHlTmZK1Oo05dDGjzBtDJQVOMb3LV BZitnFanQPb1MereOqEBHcrSuts+RN9nZBQUAsGFFtC52xqDkFCPVrlGYwqp59L78jPyn63WpTgwL nk2isinrrsyTrXnyER0FxxoP8nJ/4xw==; 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 1cm06M-000703-J9; Thu, 09 Mar 2017 15:35:38 +0000 Received: from narfation.org ([2001:4d88:2000:7::2] helo=v3-1039.vlinux.de) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cm06J-0006n1-9b for ath10k@lists.infradead.org; Thu, 09 Mar 2017 15:35:37 +0000 Received: from sven-desktop.home.narfation.org (p549BD6A9.dip0.t-ipconnect.de [84.155.214.169]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 36F671100D8; Thu, 9 Mar 2017 16:24:24 +0100 (CET) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1489073064; bh=1Odfw3ihDSzSc91jH+JlX9mrCejJCbC6yq3omRN2OkA=; h=From:To:Cc:Subject:Date:From; b=cd8PYOLUbB9eCwZcaJjwdPWM9PQDJsEArmgkorIhiQCKtfqnF+9iMemFLCQmSFLyC Sjn4g9s7QPuJreLejXYBdiOmbjm2Nm9kDXdrD/eFefY9tALPCCb53L4SPRVhWrROvp oP2Xn9JslkjKmVVtemJtmqn/jhpLFlQcb9Knd+A4= From: Sven Eckelmann To: ath10k@lists.infradead.org Subject: [RFC] ath10k: search DT for qcom,ath10k-calibration-variant Date: Thu, 9 Mar 2017 16:24:16 +0100 Message-Id: <20170309152416.4090-1-sven@narfation.org> 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_073535_644226_E312B44E X-CRM114-Status: GOOD ( 10.60 ) 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 From: Sven Eckelmann 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 --- .../bindings/net/wireless/qcom,ath10k.txt | 3 +++ drivers/net/wireless/ath/ath10k/core.c | 31 +++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) 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..6f4c7ccb0dba 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; @@ -2221,7 +2246,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) {