From patchwork Fri Apr 16 13:08:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 422493 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp373729jaf; Fri, 16 Apr 2021 06:08:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzGXO6XmU7aLRolM0NBkiABihetq5qm6u12g/9lMiclNaj3hE7atq2Ru1WOSZoIUNjYlshJ X-Received: by 2002:a17:907:9485:: with SMTP id dm5mr8273804ejc.194.1618578538603; Fri, 16 Apr 2021 06:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618578538; cv=none; d=google.com; s=arc-20160816; b=KDfLjkaGHb3lG/+sTPWg3GmVWS4kCFb/Pmm6vNfDuJlEgZCUEor4xk/h3PR9SV7wtU 7g21/JWtlaB6PJ9bzSZOrpcALxOrg8+w49kPeW2Br6bFT91xX3yisqHZ863zSDoM+h6r 9pg/VgHi93Odp65PY3Xa3h21E4AKCl3IpTi1XHLnEd3f91GWEp93XqCop5S3UDj7B9bd LSIc360ge+iAihk6CDHjMOpYBKA7C2FST5l44/SE3hDTBXjKGh9iQSvkLsRnPgYVHFwl iAATfWjTOXpnImp7ZsKZ9nxhPil+km7+58id3RWjW39FXOQMoLu4O0BzU9xTQwdZAh85 4wKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uzuVeA7UOjLvARkWMLDj1PjrCLOzAsZxspZjd3hjcw0=; b=O2Of14MPx+onaMqwpKwmO3QxiRdLtoIO2EV/ow2XAtKUg4lbF5skPM6IJfCcVLzeUO q2PilTCoCgFXkHuiziAdzcaiW2XHmTDKge1QsY10xXmmNEbKQ599xN6AxJ7aF0lZYVya DHAqSWaA50BTCfZjFE6jitx8/ijlbEJEZNs49QIFO4bJeW18jwQNEdteNncZTByJ4pk8 sqLsqgMmovAZ9cZSvLl3D30eieuXKW/sXa7K6KZlAMwZmgyiRQzHmFeJ5dGpyhlsUaIM Uzk0nH8KR9Br2EWOMUU38YdS/xAQIBBPuYBa9ke77GQYV3ZMKr8cewrq++3r5OfO+S+3 pjIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IEmy8LPf; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lr6si979358ejb.153.2021.04.16.06.08.58; Fri, 16 Apr 2021 06:08:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IEmy8LPf; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243474AbhDPNJV (ORCPT + 16 others); Fri, 16 Apr 2021 09:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243404AbhDPNJT (ORCPT ); Fri, 16 Apr 2021 09:09:19 -0400 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1351C061574 for ; Fri, 16 Apr 2021 06:08:54 -0700 (PDT) Received: by mail-io1-xd36.google.com with SMTP id k25so27623015iob.6 for ; Fri, 16 Apr 2021 06:08:54 -0700 (PDT) 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=uzuVeA7UOjLvARkWMLDj1PjrCLOzAsZxspZjd3hjcw0=; b=IEmy8LPfhkY9f321KC+qGy9HWYXwqu2p1dnJum84JDQGmtwwm19qZHs7SQe/z+AsBu tfpDRF4K4v/W/9bXrMHa5dy3JM3YdOMUreZ9pb4VqOi47s64hhbVKFVw4Goh51rJjCGB aY6C8unsrYklxGZhdk0BVWFfzZJKbLqnMTnL5f1GRFsyUr5QKCP09JVGRFZeI+ykjr76 ST0pBz7JOJlafBWuipSLvYd+4FcB8HHyvCNwaBp6R2iP40d1AmT7yzxd4wxquf5OWcjc 507gikiI4MFmuU2q8T62awNIA/DG+WUMJpSp47n1Y0r04ZeUpM0SSrCi6+yMoRxlyVAs Igkg== 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=uzuVeA7UOjLvARkWMLDj1PjrCLOzAsZxspZjd3hjcw0=; b=AB3BXaFp4nkKVKxszjIBEaS4CTUrCrxhVODvlYMT2dMAHB9TO8AHs7MKbuOaGXiDYC RDNv/Hpvv5L/HdvgGUSGmYsTVk5SBIMtXwhxLcbnWdyn9osVaOgYdS0vb89VwTXqBHFl 43YKoBg2R/hBzTXgllw5gdQPcx7rybddCtnIS7vUjM1BjbG6Mm5eEf7kpypyMj6DZSMv 4azpdwMuAAzyeDxN9M2uUzIM+kX5HLVUmyX1al3H++EeJF7sKyuZ5dLI7yMOQUBHal6x mLm3iNmgQes512ylkVq+SyrSatAUm7ydDrAzKOIJSYB2ozU0qbtiWcjPqJV/NypA7J9e e1/w== X-Gm-Message-State: AOAM531A3YgLSC0e2WBeLKkuO84Xv6zcG/gaexGBniwsfuKjdTKtpVqj lTOAa3udL8v5cO9fK5K1+nScNw== X-Received: by 2002:a02:9389:: with SMTP id z9mr3896926jah.60.1618578534295; Fri, 16 Apr 2021 06:08:54 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id e6sm2713535ilr.81.2021.04.16.06.08.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 06:08:53 -0700 (PDT) From: Alex Elder To: robh+dt@kernel.org, davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, elder@kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/2] dt-bindings: net: qcom, ipa: add firmware-name property Date: Fri, 16 Apr 2021 08:08:49 -0500 Message-Id: <20210416130850.1970247-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210416130850.1970247-1-elder@linaro.org> References: <20210416130850.1970247-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Add a new optional firmware-name property to the IPA DT node. It is used only if the modem is not doing early initialization (i.e., if the modem-init property is not present). Its value is the name of the firmware file to use; if it's not specified, a default name ("ipa_fws.mdt") is used. Signed-off-by: Alex Elder --- .../devicetree/bindings/net/qcom,ipa.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.27.0 diff --git a/Documentation/devicetree/bindings/net/qcom,ipa.yaml b/Documentation/devicetree/bindings/net/qcom,ipa.yaml index da5212e693e91..7443490d4cc6d 100644 --- a/Documentation/devicetree/bindings/net/qcom,ipa.yaml +++ b/Documentation/devicetree/bindings/net/qcom,ipa.yaml @@ -125,6 +125,14 @@ properties: the firmware passed to Trust Zone for authentication. Required when Trust Zone (not the modem) performs early initialization. + firmware-name: + $ref: /schemas/types.yaml#/definitions/string + description: + If present, name (or relative path) of the file within the + firmware search path containing the firmware image used when + initializing IPA hardware. Optional, and only used when + Trust Zone performs early initialization. + required: - compatible - iommus @@ -134,12 +142,23 @@ required: - interconnects - qcom,smem-states +# Either modem-init is present, or memory-region must be present. oneOf: - required: - modem-init - required: - memory-region +# If memory-region is present, firmware-name may optionally be present. +# But if modem-init is present, firmware-name must not be present. +if: + required: + - modem-init +then: + not: + required: + - firmware-name + additionalProperties: false examples: From patchwork Fri Apr 16 13:08:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 423469 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.7 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 4F505C43603 for ; Fri, 16 Apr 2021 13:09:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2A7E9610CB for ; Fri, 16 Apr 2021 13:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243487AbhDPNJW (ORCPT ); Fri, 16 Apr 2021 09:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243441AbhDPNJU (ORCPT ); Fri, 16 Apr 2021 09:09:20 -0400 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDE95C061574 for ; Fri, 16 Apr 2021 06:08:55 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id e186so27612785iof.7 for ; Fri, 16 Apr 2021 06:08:55 -0700 (PDT) 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=uIsY7rTiA+VYMrCL0Fk+IRPmeXg2RKOGnKhn6jk88kE=; b=tFyHUHgdMoZuhKobVdbX2vg8qAX7TnojQWkhHz9Ak0pCsoCpXT12YGpXihZIDn6cHY 76bIRnoSoxcU9vlHDlv5LO540YctIM9vnF6ehSra3UAiJmV5/oMtoxD+vAeJFwUi8A76 SieIzgCha1dTrT/oBzi2Vn86SFQY/icxVndiVcjkFmrhOwtNSxX0pLZsM+BRHFjZFutl 32e4NvSs9rrSOSTP1eM5EFP32EMV3WDZybHcWen/vCsFxcDqF050TA1b86DwzrFjkRBQ SEzn9j6xvzV+k0hKCinhT9DGl33HAOY7VAQY7jHee5JnmEkKYsuA/hLHRs9H3bFv/eTf MylA== 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=uIsY7rTiA+VYMrCL0Fk+IRPmeXg2RKOGnKhn6jk88kE=; b=n7UtNyDbqcS8TGqnMYELVOCW/Y6aRSeaLY5SodDybmHXlzgXP7us3pvR0AZrITKPBt flnAWVWE31n6DoYgGHeoz5KIQyrs49r9QMMeHQ3pwq05/SCrQRPwzbZN4D4X8OMVZwnZ BS6cAs5Ff8RiviA4AiSL5y4KlM7XvY4ifH9WD/VmKKb5LUbY+pKBduQsFHPdy3Op89nG F1Ehn8TKstYkdR8zSkh+ItMqH9Xmp0LLnJCCgQS7Hv1pOiEv4uh54Z9qLYMHfF29L3Sk ndBOjHKRcECkx+zb4w4QFuRQj19hU7r2EWPAS7PhF51ZQCDYoCo5DMw6nTzW3KuAGad/ CxzQ== X-Gm-Message-State: AOAM533ul5eKs59Digs77DygHwOqk9Ep2YZl0x6lhD2O1iVKyf2TXJrR zJ3i5C7+tx4bxlL2BlWmxcPKF3WtgqjsvQ== X-Google-Smtp-Source: ABdhPJyO/6DXTD88pvOp8rSOlXVJJ35Xta+9suI4ouLqEEhZDpNAUjVHC5RN3PwkZ+QI33qsrrtoOw== X-Received: by 2002:a6b:7601:: with SMTP id g1mr2792815iom.37.1618578535272; Fri, 16 Apr 2021 06:08:55 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id e6sm2713535ilr.81.2021.04.16.06.08.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Apr 2021 06:08:55 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, agross@kernel.org, robh+dt@kernel.org, elder@kernel.org, linux-arm-msm@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/2] net: ipa: optionally define firmware name via DT Date: Fri, 16 Apr 2021 08:08:50 -0500 Message-Id: <20210416130850.1970247-3-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210416130850.1970247-1-elder@linaro.org> References: <20210416130850.1970247-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org IPA initialization includes loading some firmware. This step is done either by the modem or by the AP under Trust Zone. If the AP loads firmware, the name of the firmware file is currently hard-coded ("ipa_fws.mdt"). Add the ability to specify the relative path of the firmware file to use in a property in the Device Tree IPA node. If the property is not found (or if any other error occurs attempting to get it), fall back to using a default relative path. Use the "old" fixed name as the default. Rename the symbol that represents this default to emphasize its purpose. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index aad915e2ce523..9915603ed10ba 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -67,7 +67,7 @@ */ /* The name of the GSI firmware file relative to /lib/firmware */ -#define IPA_FWS_PATH "ipa_fws.mdt" +#define IPA_FW_PATH_DEFAULT "ipa_fws.mdt" #define IPA_PAS_ID 15 /* Shift of 19.2 MHz timestamp to achieve lower resolution timestamps */ @@ -517,6 +517,7 @@ static int ipa_firmware_load(struct device *dev) struct device_node *node; struct resource res; phys_addr_t phys; + const char *path; ssize_t size; void *virt; int ret; @@ -534,9 +535,17 @@ static int ipa_firmware_load(struct device *dev) return ret; } - ret = request_firmware(&fw, IPA_FWS_PATH, dev); + /* Use name from DTB if specified; use default for *any* error */ + ret = of_property_read_string(dev->of_node, "firmware-name", &path); if (ret) { - dev_err(dev, "error %d requesting \"%s\"\n", ret, IPA_FWS_PATH); + dev_dbg(dev, "error %d getting \"firmware-name\" resource\n", + ret); + path = IPA_FW_PATH_DEFAULT; + } + + ret = request_firmware(&fw, path, dev); + if (ret) { + dev_err(dev, "error %d requesting \"%s\"\n", ret, path); return ret; } @@ -549,13 +558,11 @@ static int ipa_firmware_load(struct device *dev) goto out_release_firmware; } - ret = qcom_mdt_load(dev, fw, IPA_FWS_PATH, IPA_PAS_ID, - virt, phys, size, NULL); + ret = qcom_mdt_load(dev, fw, path, IPA_PAS_ID, virt, phys, size, NULL); if (ret) - dev_err(dev, "error %d loading \"%s\"\n", ret, IPA_FWS_PATH); + dev_err(dev, "error %d loading \"%s\"\n", ret, path); else if ((ret = qcom_scm_pas_auth_and_reset(IPA_PAS_ID))) - dev_err(dev, "error %d authenticating \"%s\"\n", ret, - IPA_FWS_PATH); + dev_err(dev, "error %d authenticating \"%s\"\n", ret, path); memunmap(virt); out_release_firmware: