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: 423544 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, USER_AGENT_GIT autolearn=ham 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 89CC0C433B4 for ; Fri, 16 Apr 2021 13:08:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6944F6115B for ; Fri, 16 Apr 2021 13:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243396AbhDPNJV (ORCPT ); Fri, 16 Apr 2021 09:09:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243408AbhDPNJT (ORCPT ); Fri, 16 Apr 2021 09:09:19 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D570EC061761 for ; Fri, 16 Apr 2021 06:08:54 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id x16so27642547iob.1 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=g8LbKx+nnUC5dG+2y+XUBA87E0361gouIqc6kQrzl+yPEXm33ZSSN3Uou9F+Xvc+rC Dmg3t/VHIjFJWVtNHx0UgMIJVRIP3X8gT9zWli9+XQrNz99Kx0Yzgb+++9nIYroIIxOv y850+GLmSPO2qrHdDriJp7MnwjwPfP9rZZV+QB8N920iHc+aRRtzNUxKmrpDBAn9wJCJ 0iqWIAhO3/E9vPO62FFX23HqlSFzPdIpE9le8GIFLAEe7KcO+j4FZ5CxMUYsC6PO7P/c QAoVWvKIvCXkYt3X5NUZZwOnHmXTAg9/4wT8sV8RXL6DEA/0HewUnAxSMzd/H+cXA0vd z9sg== X-Gm-Message-State: AOAM533GVoRX6VWr+dLGBPBIguPYFqqk/jUNQfUcc2zxPJTAAWjpNu4j RVthzd1bP6TzXo2ZMf1HLBBQBw== X-Google-Smtp-Source: ABdhPJztOrBhclUHweIstqEJUhDKuOIXMk19psn/0/YqaPioQbdKqTsy7V6RiHxWudnXn+bE6dsezA== 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: devicetree@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(+) 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: 422495 Delivered-To: patch@linaro.org Received: by 2002:a02:6a6f:0:0:0:0:0 with SMTP id m47csp373775jaf; Fri, 16 Apr 2021 06:09:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAzUW6xjyzvo4oAJL35zebuyBIIL0x82Dcplu/aqu+Jx25PAEqb4jw2czgUBlb/AtNCgu4 X-Received: by 2002:aa7:d916:: with SMTP id a22mr9753103edr.287.1618578540008; Fri, 16 Apr 2021 06:09:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618578540; cv=none; d=google.com; s=arc-20160816; b=IkZ09//VBQ4v3dMBWaM/8cTzLTQF4teNedmUt7WpZQmSRJWIBi2x6AldqoH74VksUc fpJWaY+QCsyJxXS451VDN81g87MW/FB9adOi5kv2/6diA16sCk3EHTh9EICqY2Lrrv1S BcgGYSJ8DlWJrBF9o9G5jx0t9DSKKVkNUy9vGO2s8kIVcdW5vYhMWw/Jgikwemo9Y8yv F2Ua46CzGTXefub70o/nOp9rZOmwPMiPTRiiI8ErG43zKrsDhgfMaMqv5006roPjzM/x IP6aVtkBVip/LVEI6QHWFFsXbQ+g91Usxklbk+oekE4TJHs+OF6spqoP7bso1VSCmkqm nUgQ== 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=uIsY7rTiA+VYMrCL0Fk+IRPmeXg2RKOGnKhn6jk88kE=; b=AnS6uGhOUnBBo2R4xBtgX5GIqxeNVMLenh71+/rynlRFE++0ceke6c0Rr1qon4HdUb KiqE3W9mr0yJvoRi8TjTXk80xo7IVPt9HAaY4+1mEOqyKs4+tz4GMO3FHHch4WqkWOAG W6kHdnD0RcKfZFu6Iow3yj+ysjYXfAtcW47mD+Hj2w6+K35NMuerLv1pYdOz8k56LmD6 h+qyPPsq3CqqD8+GKbOX9/ziAb0lpK7vDyDizzFKRLNGbW+3KETUlICWk81haSg8U8g3 3QZnQH29GLEwkzjohMOWvL7jzHWuSEObpp3C5LYJskQTi2xTOmwBF3UoALt1v3iegEQf JxBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=tFyHUHgd; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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.59; Fri, 16 Apr 2021 06:09:00 -0700 (PDT) Received-SPF: pass (google.com: domain of devicetree-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=tFyHUHgd; spf=pass (google.com: domain of devicetree-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=devicetree-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 S243408AbhDPNJW (ORCPT + 6 others); Fri, 16 Apr 2021 09:09:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243453AbhDPNJU (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 D3482C06138A for ; Fri, 16 Apr 2021 06:08:55 -0700 (PDT) Received: by mail-io1-xd31.google.com with SMTP id d5so18169923iof.3 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=Yg6qBugvXmzRRsziDF4lQkKhcWu0gBEXxsyqZaM16nU7YknIkLHRqKWHb2AZA+kaRv Ckty+MlseltxVzwupOD0XSg80XxbsmadMY7LNVgTmGnVXKbenVE0oULZHohhaQygoinU z3NpMUcv6hVeqCIPjYmCVPYgtHQar9C6+2UGhWCNhOGxsSwbJYi8JqKAMVS/aHkyHIg9 UXYmQXS2G89arGCk7brIE9CuQBgIVEInvS1ipiNfLpaYUfUQrtNdsgmcU/jG1dredfvs BCX/pCcXwkww2Ta9lK39OHYqm6hu92U/fmH3J7ieGM4PahugyFB7ZyF/NLY5FJ509702 AZsA== X-Gm-Message-State: AOAM533IbeGjZ9LdvDXbo5wG4aDJWlpEkzIEL1rB5HFmPWudajpmnEAn 4m10X14/x4AUvjT7lXMjMLThNA== 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: devicetree@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(-) -- 2.27.0 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: