Linux-ARM-MSM Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH net-next 0/2] net: ipa: allow different firmware names
@ 2021-04-16 13:08 Alex Elder
  2021-04-16 13:08 ` [PATCH net-next 1/2] dt-bindings: net: qcom,ipa: add firmware-name property Alex Elder
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Alex Elder @ 2021-04-16 13:08 UTC (permalink / raw)
  To: davem, kuba
  Cc: robh+dt, bjorn.andersson, agross, elder, linux-arm-msm, netdev,
	devicetree, linux-kernel

Add the ability to define a "firmware-name" property in the IPA DT
node, specifying an alternate name to use for the firmware file.
Used only if the AP (Trust Zone) does early IPA initialization.

					-Alex

Alex Elder (2):
  dt-bindings: net: qcom,ipa: add firmware-name property
  net: ipa: optionally define firmware name via DT

 .../devicetree/bindings/net/qcom,ipa.yaml     | 19 +++++++++++++++
 drivers/net/ipa/ipa_main.c                    | 23 ++++++++++++-------
 2 files changed, 34 insertions(+), 8 deletions(-)

-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 1/2] dt-bindings: net: qcom,ipa: add firmware-name property
  2021-04-16 13:08 [PATCH net-next 0/2] net: ipa: allow different firmware names Alex Elder
@ 2021-04-16 13:08 ` Alex Elder
  2021-04-16 13:08 ` [PATCH net-next 2/2] net: ipa: optionally define firmware name via DT Alex Elder
  2021-04-16 22:50 ` [PATCH net-next 0/2] net: ipa: allow different firmware names patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Elder @ 2021-04-16 13:08 UTC (permalink / raw)
  To: robh+dt, davem, kuba
  Cc: bjorn.andersson, agross, elder, linux-arm-msm, netdev,
	devicetree, linux-kernel

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 <elder@linaro.org>
---
 .../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:
-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net-next 2/2] net: ipa: optionally define firmware name via DT
  2021-04-16 13:08 [PATCH net-next 0/2] net: ipa: allow different firmware names Alex Elder
  2021-04-16 13:08 ` [PATCH net-next 1/2] dt-bindings: net: qcom,ipa: add firmware-name property Alex Elder
@ 2021-04-16 13:08 ` Alex Elder
  2021-04-16 22:50 ` [PATCH net-next 0/2] net: ipa: allow different firmware names patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Alex Elder @ 2021-04-16 13:08 UTC (permalink / raw)
  To: davem, kuba
  Cc: bjorn.andersson, agross, robh+dt, elder, linux-arm-msm, netdev,
	devicetree, linux-kernel

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 <elder@linaro.org>
---
 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:
-- 
2.27.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 0/2] net: ipa: allow different firmware names
  2021-04-16 13:08 [PATCH net-next 0/2] net: ipa: allow different firmware names Alex Elder
  2021-04-16 13:08 ` [PATCH net-next 1/2] dt-bindings: net: qcom,ipa: add firmware-name property Alex Elder
  2021-04-16 13:08 ` [PATCH net-next 2/2] net: ipa: optionally define firmware name via DT Alex Elder
@ 2021-04-16 22:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-16 22:50 UTC (permalink / raw)
  To: Alex Elder
  Cc: davem, kuba, robh+dt, bjorn.andersson, agross, elder,
	linux-arm-msm, netdev, devicetree, linux-kernel

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Fri, 16 Apr 2021 08:08:48 -0500 you wrote:
> Add the ability to define a "firmware-name" property in the IPA DT
> node, specifying an alternate name to use for the firmware file.
> Used only if the AP (Trust Zone) does early IPA initialization.
> 
> 					-Alex
> 
> Alex Elder (2):
>   dt-bindings: net: qcom,ipa: add firmware-name property
>   net: ipa: optionally define firmware name via DT
> 
> [...]

Here is the summary with links:
  - [net-next,1/2] dt-bindings: net: qcom,ipa: add firmware-name property
    https://git.kernel.org/netdev/net-next/c/d8604b209e9b
  - [net-next,2/2] net: ipa: optionally define firmware name via DT
    https://git.kernel.org/netdev/net-next/c/9ce062ba6a8d

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 13:08 [PATCH net-next 0/2] net: ipa: allow different firmware names Alex Elder
2021-04-16 13:08 ` [PATCH net-next 1/2] dt-bindings: net: qcom,ipa: add firmware-name property Alex Elder
2021-04-16 13:08 ` [PATCH net-next 2/2] net: ipa: optionally define firmware name via DT Alex Elder
2021-04-16 22:50 ` [PATCH net-next 0/2] net: ipa: allow different firmware names patchwork-bot+netdevbpf

Linux-ARM-MSM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-arm-msm/0 linux-arm-msm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-arm-msm linux-arm-msm/ https://lore.kernel.org/linux-arm-msm \
		linux-arm-msm@vger.kernel.org
	public-inbox-index linux-arm-msm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-arm-msm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git