From patchwork Fri Mar 10 08:06:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 9615181 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 6BA1D60417 for ; Fri, 10 Mar 2017 08:07:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D3272855E for ; Fri, 10 Mar 2017 08:07:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51BC82862D; Fri, 10 Mar 2017 08:07:07 +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 E64EF28606 for ; Fri, 10 Mar 2017 08:07:05 +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=/AqlKWilwcwC3tJyCgqE+CTgWoSzRwUMx8jk0r7PSIk=; b=b3B157Q1tWLZpYlPi8dnK8fHoL LrbKgo7jfhfUBCr9FcZEADcxGLAbCaQaAxhsrz+OLOkEFBQUXcWYOuPmJXpna/WL8DtLO+PnIbhEe aZvNNeI9E8/BVD7NuQNxw2DVz5o7Fp+S3wM3T0lxZ2zfWAomdk28eXGmA2QQO7/z/Dp0nRY28W7VY +85vGcCeCeptQE0AlX4ZQr1aePOg00aFEojpkSXNpao236ZjfARiKmFpOhO6EKTKOsyfMaAKupl6B eWsd3vwSygvF1G7jkxGvTFZKbFOK9oycRxNE5kVK+wgTFcr8kBzivrH5DDFI2cr7segER+uMUDu9c UUyK96wA==; 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 1cmFZk-0003Lp-5Z; Fri, 10 Mar 2017 08:07:00 +0000 Received: from mail-wr0-x236.google.com ([2a00:1450:400c:c0c::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cmFZf-0003IF-9z for ath10k@lists.infradead.org; Fri, 10 Mar 2017 08:06:58 +0000 Received: by mail-wr0-x236.google.com with SMTP id g10so59840477wrg.2 for ; Fri, 10 Mar 2017 00:06:34 -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=ursC4du3LgXhtVUP3FWa0EiKliw2uuyC5PUisCCQbGM=; b=OCyunDIjmLG9QOtW8/1s6cpMYopl9dD8My4R4An9fRmxxMR3IG4rF+Xg1mpdJI1wCW wwWHuvwzfAA+GIGCj0tXaJc+9MB8M7PvzpnXX5Q9yZM4tnLDGOHcZkpPSkraIvjax6Vj M8PZNvKiC4CT5EHeJgAije4v37bysSSMxtS5+aFuHaMKeKaDhkD9lLyIFSF/oYRQpluk 5KJH792NksDDLDJJjzISuUeJspc0sXBoMC0bTAy61Mmxazh7xAfKAa7VPZtG3YIQ0x5p O503oOPh2YU0m5cZ8szfi35mxTBy7plU4xq1t9kDO+K1o4oIjXsli/m7Z8b2iQZ/9c0k p2kA== 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=ursC4du3LgXhtVUP3FWa0EiKliw2uuyC5PUisCCQbGM=; b=BC5/OcJy9LN5W9oNd7EiT5ybh5WLZyhASBweCDA2acBeWzgKOem3hufa5mpReHc9+J R8Mb/GCqa4a/tFNbflnJ/wYIdCRqwz4XVTA/YKAig6CV0LQf8gaCl696ed3J6pVDUUS2 jup9+Sm4fcm1Yxn1eSUzeQ+LVEKBDZo6CZme270KGguScaSMRJWHguNZR82gly6IpZI8 eo1ozFbIRqpJmFVp3f5aYZAOU+1d0Wpc/shSfdXDa1ZhKWW0IEP+BDstyBERK8v2uEoF d2n56ZC+YhfCLDgy+kdb0vsokvJ/f6rH0QHt1z61S3zU2Xh5Meew7Q/hKGLBR3ethy6C mBMQ== X-Gm-Message-State: AMke39l/kg2XN/I3TeH0Uo+LAzW6fIA3qFPzHi2+6gkWxmCY8rYH81rVNhHxqaB/q1qJhOTs X-Received: by 10.223.136.33 with SMTP id d30mr15504263wrd.117.1489133193535; Fri, 10 Mar 2017 00:06:33 -0800 (PST) Received: from sven-desktop.home.narfation.org (p2003007C6F5694FE527B9DFFFECE2683.dip0.t-ipconnect.de. [2003:7c:6f56:94fe:527b:9dff:fece:2683]) by smtp.gmail.com with ESMTPSA id x193sm2115315wme.23.2017.03.10.00.06.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 10 Mar 2017 00:06:32 -0800 (PST) From: Sven Eckelmann To: ath10k@lists.infradead.org Subject: [PATCH 2/2] ath10k: search DT for qcom,ath10k-calibration-variant Date: Fri, 10 Mar 2017 09:06:15 +0100 Message-Id: <20170310080615.22958-2-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170310080615.22958-1-sven.eckelmann@openmesh.com> References: <20170310080615.22958-1-sven.eckelmann@openmesh.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170310_000655_619874_8839C493 X-CRM114-Status: GOOD ( 12.91 ) 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 --- Since RFC: - initialize variant pointer to have it initialized to NULL when of_property_read_string fails (thanks Christian Lamparter) - Only print warning that DT doesn't contain string ones (thanks Christian Lamparter) - Split patch in DT doc and ath10k part (thanks Christian Lamparter) - Allow to overwrite the variant string via DT and ignore that SMBIOS had written anything to it --- drivers/net/wireless/ath/ath10k/core.c | 37 +++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index 0a8e29e9a0eb..e459e84afe9f 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -779,6 +779,25 @@ 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; + + 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 +1164,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), @@ -2221,7 +2240,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) {