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: 9615185 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 9DA07604DD for ; Fri, 10 Mar 2017 08:07:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8EBBF28700 for ; Fri, 10 Mar 2017 08:07:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 83332286F9; Fri, 10 Mar 2017 08:07:39 +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=unavailable 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 0E37D28700 for ; Fri, 10 Mar 2017 08:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755009AbdCJIG5 (ORCPT ); Fri, 10 Mar 2017 03:06:57 -0500 Received: from mail-wr0-f171.google.com ([209.85.128.171]:35400 "EHLO mail-wr0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754068AbdCJIGz (ORCPT ); Fri, 10 Mar 2017 03:06:55 -0500 Received: by mail-wr0-f171.google.com with SMTP id g10so59840520wrg.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=S96iQ6R8o7qn+61rkZvQEOMT5Q9iwFpe1bTvDOUil76ucmAHtM/ckCXA9lUZ05abpq Hfrplmm67hkqyssmMCXNBK9jAUAM5gSNWsuVCMJ+m87RtF2imIWljRXeLt4PPsu90rvU pHlGtg307rXRjpj2auZilHnIN2XoRJOKID6Bqr1zlf5AIfx7XXVb/c+gd2Ef8HQXnT8O y7hs0r5jAR3oBT+OvaU5gF7sUcgBlzOreuJCT19svpeWjX9OljMiB+ch9sO+Sqc+Td8H e06RUxFBdx/8imWhsxa/odyga9SNNbgOoeUna12gBfZ9McoEV6boDbcuw9a0nLFLsp1u xZQg== X-Gm-Message-State: AMke39lzwrEo4cRZ8ZnRIh486QEdReh+aqD+x9ziOBeX0Bdd8QhlnWHAKeeWqbcrk1YXcWxi 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 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 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> 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 --- 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) {