From patchwork Fri Mar 12 00:33:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 398980 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92A7AC41620 for ; Fri, 12 Mar 2021 00:33:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6E87F64F92 for ; Fri, 12 Mar 2021 00:33:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231406AbhCLAcg (ORCPT ); Thu, 11 Mar 2021 19:32:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbhCLAcR (ORCPT ); Thu, 11 Mar 2021 19:32:17 -0500 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F922C061574 for ; Thu, 11 Mar 2021 16:32:17 -0800 (PST) Received: by mail-oi1-x233.google.com with SMTP id u198so20163741oia.4 for ; Thu, 11 Mar 2021 16:32:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/wnT9KFtjE2dj5B3TvenbW5A0O1A3p6LBzIrAp2VB50=; b=nQ/PHelfe6p0xzxLiT/y3D0LTRCKSdnNbhzgJmtQ6Seq6IB8FN4cNbEJOu6ewRcqqL LVs49uIf89GWT58FnaQckw3dVUxx2zJYIPAJW0Csqv5mcXPI5kGoeR9jUZ5vAu+0+uMZ BYui7+TEEdHWCANjaULtA02QMUr5XxawJzugVmlKBCnv8Bnwg4HjPQpyD5r0w7tWuLZc jTRdxusyQZ0nSoIzDA3rt5wK7llfTQBpD+oUJbhCIbaMVXFa4x55VkMkyZdWbZwVTFIT BmGNcA+RugSuylJhfmBLObGxuwcKkKPdEq1RbULeRfkdDlioMsnmmxG8ixXydVYVoFsH 7faQ== 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:mime-version:content-transfer-encoding; bh=/wnT9KFtjE2dj5B3TvenbW5A0O1A3p6LBzIrAp2VB50=; b=ANsuJA/ce4kOrNto9N6P0aUzdmRrCWfiB23YHAoH4FxYLFuf79u8gVPxv7IWpwH8v+ bXWffPuweZH1GT0yufol9+7NGZ1/tklO1O7BCpqLtr5Z+WDDwit+QEmOiXF1uhqAuoJ2 irDyC1gMM/aYOIdmBiz2WTbLyma7u3qwdL4Smh78o8e/Qeo/3Kg+wTybdAvIYEJRD0uQ 2pBQiIpuI18dfB3gA8HXYR9OooJ/j4t+lIW6GOjQuzTqp4mJrUYpShCl26ljkl4UZ85V NZSjeJa7FeP5w1HsYK74Sob6td2eckXwaWwWiwENuMVz7nOjhyswOegP6vkIs1xNY9eX pAWg== X-Gm-Message-State: AOAM531+l25xZ5PRt2t9kACZJ+8UupzyNeDMl0GPtiqrERpOBs2378FG 3AyZGoPC7J3L/srWtxApFzMCmw== X-Google-Smtp-Source: ABdhPJzwqufzHfZoLzOmD5jMfbWGNnlySFjzLTTO1fCcGhtliPRoFuEmoE+ER6cVwwNeAAYMLcXIOg== X-Received: by 2002:a05:6808:130a:: with SMTP id y10mr8294467oiv.138.1615509136575; Thu, 11 Mar 2021 16:32:16 -0800 (PST) Received: from localhost.localdomain (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id l190sm670835oig.39.2021.03.11.16.32.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Mar 2021 16:32:16 -0800 (PST) From: Bjorn Andersson To: Andy Gross , Bjorn Andersson , Rob Herring , Kalle Valo , "David S. Miller" , Jakub Kicinski , Bryan O'Donoghue Cc: linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, wcn36xx@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH 2/5] wcn36xx: Allow firmware name to be overridden by DT Date: Thu, 11 Mar 2021 16:33:15 -0800 Message-Id: <20210312003318.3273536-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210312003318.3273536-1-bjorn.andersson@linaro.org> References: <20210312003318.3273536-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The WLAN NV firmware blob differs between platforms, and possibly devices, so add support in the wcn36xx driver for reading the path of this file from DT in order to allow these files to live in a generic file system (or linux-firmware). For some reason the parent (wcnss_ctrl) also needs to upload this blob, so rather than specifying the same information in both nodes wcn36xx reads the string from the parent's of_node. Signed-off-by: Bjorn Andersson Tested-by: Bryan O'Donoghue --- This patch can be applied independently of the others, but relates to the acceptance of the addition to the DT binding (in patch 1/5). So my suggestion is that this one goes through the ath tree and the others through the Qualcomm SoC tree. drivers/net/wireless/ath/wcn36xx/main.c | 7 +++++++ drivers/net/wireless/ath/wcn36xx/smd.c | 4 ++-- drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c index afb4877eaad8..87b5c0ff16c0 100644 --- a/drivers/net/wireless/ath/wcn36xx/main.c +++ b/drivers/net/wireless/ath/wcn36xx/main.c @@ -1407,6 +1407,13 @@ static int wcn36xx_probe(struct platform_device *pdev) goto out_wq; } + wcn->nv_file = WLAN_NV_FILE; + ret = of_property_read_string(wcn->dev->parent->of_node, "firmware-name", &wcn->nv_file); + if (ret < 0 && ret != -EINVAL) { + wcn36xx_err("failed to read \"firmware-name\" property\n"); + goto out_wq; + } + wcn->smd_channel = qcom_wcnss_open_channel(wcnss, "WLAN_CTRL", wcn36xx_smd_rsp_process, hw); if (IS_ERR(wcn->smd_channel)) { wcn36xx_err("failed to open WLAN_CTRL channel\n"); diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index d0c3a1557e8d..7b928f988068 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -514,10 +514,10 @@ int wcn36xx_smd_load_nv(struct wcn36xx *wcn) u16 fm_offset = 0; if (!wcn->nv) { - ret = request_firmware(&wcn->nv, WLAN_NV_FILE, wcn->dev); + ret = request_firmware(&wcn->nv, wcn->nv_file, wcn->dev); if (ret) { wcn36xx_err("Failed to load nv file %s: %d\n", - WLAN_NV_FILE, ret); + wcn->nv_file, ret); goto out; } } diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index 71fa9992b118..5977af2116e3 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -185,6 +185,7 @@ struct wcn36xx { struct device *dev; struct list_head vif_list; + const char *nv_file; const struct firmware *nv; u8 fw_revision;