linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jordan Crouse <jcrouse@codeaurora.org>
To: freedreno@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	bjorn.andersson@linaro.org
Cc: linux-arm-msm@vger.kernel.org
Subject: [PATCH 5/6] drm/msm: Move zap shader firmware name to the device table
Date: Wed, 12 Apr 2017 15:15:17 -0600	[thread overview]
Message-ID: <1492031718-28477-6-git-send-email-jcrouse@codeaurora.org> (raw)
In-Reply-To: <1492031718-28477-1-git-send-email-jcrouse@codeaurora.org>

The zap shader firmware name is not platform specific. Move it
to the device table instead.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c      | 24 ++++++++++++------------
 drivers/gpu/drm/msm/adreno/adreno_device.c |  1 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.h    |  1 +
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 8678bce..fc9a81a 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -82,10 +82,9 @@ static int zap_load_segments(struct device *dev,
 	return ret;
 }
 
-static int zap_load_mdt(struct device *dev)
+static int zap_load_mdt(struct device *dev, const char *fwname)
 {
 	char filename[64];
-	const char *fwname;
 	const struct elf32_hdr *ehdr;
 	const struct elf32_phdr *phdrs;
 	const struct firmware *mdt;
@@ -101,13 +100,6 @@ static int zap_load_mdt(struct device *dev)
 		return ret;
 	}
 
-	/* Get the firmware and PAS id from the device node */
-	if (of_property_read_string(dev->of_node, "qcom,firmware",
-		&fwname)) {
-		DRM_DEV_ERROR(dev, "Could not read a firmware name\n");
-		return -EINVAL;
-	}
-
 	snprintf(filename, sizeof(filename), "%s.mdt", fwname);
 
 	/* Request the MDT file for the firmware */
@@ -491,16 +483,24 @@ static int a5xx_zap_shader_init(struct msm_gpu *gpu)
 	if (loaded)
 		return a5xx_zap_shader_resume(gpu);
 
+	/* We need SCM to be able to load the firmware */
 	if (!qcom_scm_is_available()) {
 		DRM_DEV_ERROR(&pdev->dev, "SCM is not available\n");
 		return -EPROBE_DEFER;
 	}
 
+	/* Each GPU has a target specific zap shader firmware name to use */
+	if (!adreno_gpu->info->zapfw) {
+		DRM_DEV_ERROR(&pdev->dev,
+			"Zap shader firmware file not specified for this target\n");
+		return -ENODEV;
+	}
+
 	/* Find the sub-node for the zap shader */
 	node = of_get_child_by_name(pdev->dev.of_node, "zap-shader");
 	if (!node) {
-		DRM_ERROR("%s: zap-shader not found in device tree\n",
-			gpu->name);
+		DRM_DEV_ERROR(&pdev->dev,
+			"zap-shader not found in device tree\n");
 		return -ENODEV;
 	}
 
@@ -520,7 +520,7 @@ static int a5xx_zap_shader_init(struct msm_gpu *gpu)
 		}
 	}
 
-	ret = zap_load_mdt(&a5xx_gpu->zap_dev);
+	ret = zap_load_mdt(&a5xx_gpu->zap_dev, adreno_gpu->info->zapfw);
 
 	loaded = !ret;
 
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c b/drivers/gpu/drm/msm/adreno/adreno_device.c
index c0fa5d1..6118b10 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -86,6 +86,7 @@
 			ADRENO_QUIRK_FAULT_DETECT_MASK,
 		.init = a5xx_gpu_init,
 		.gpmufw = "a530v3_gpmu.fw2",
+		.zapfw = "a530_zap",
 	},
 };
 
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.h b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index fb4831f..12b1483 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.h
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
@@ -77,6 +77,7 @@ struct adreno_info {
 	uint32_t gmem;
 	enum adreno_quirks quirks;
 	struct msm_gpu *(*init)(struct drm_device *dev);
+	const char *zapfw;
 };
 
 const struct adreno_info *adreno_info(struct adreno_rev rev);
-- 
1.9.1

  parent reply	other threads:[~2017-04-12 21:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12 21:15 [PATCH 0/6] drm: msm: A5XX zap shader Jordan Crouse
2017-04-12 21:15 ` [PATCH 1/6] drm/msm: Add a quick and dirty PIL loader Jordan Crouse
     [not found]   ` <1492031718-28477-2-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-04-17 19:57     ` Bjorn Andersson
2017-04-12 21:15 ` [PATCH 3/6] drm/msm: Improve the zap shader Jordan Crouse
2017-04-17 19:58   ` Bjorn Andersson
2017-04-12 21:15 ` [PATCH 4/6] drm/msm: Create a child device for " Jordan Crouse
2017-04-12 21:15 ` Jordan Crouse [this message]
2017-04-17 19:58   ` [PATCH 5/6] drm/msm: Move zap shader firmware name to the device table Bjorn Andersson
     [not found] ` <1492031718-28477-1-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-04-12 21:15   ` [PATCH 2/6] drm/msm: gpu: Use the zap shader on 5XX if we can Jordan Crouse
     [not found]     ` <1492031718-28477-3-git-send-email-jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-04-17 19:58       ` Bjorn Andersson
     [not found]         ` <20170417195807.GB12022-iTMlPVAvTYNoL7IsjepNBwq4bfNCki47rNQQ6b5fDX0@public.gmane.org>
2017-04-17 21:51           ` Jordan Crouse
     [not found]             ` <20170417215124.GA415-9PYrDHPZ2Orvke4nUoYGnHL1okKdlPRT@public.gmane.org>
2017-04-17 23:53               ` Bjorn Andersson
2017-04-12 21:15   ` [PATCH 6/6] drm/msm: Document the zap-shader subnode for the GPU Jordan Crouse
2017-04-17 19:57     ` Bjorn Andersson
2017-04-17 19:57 ` [PATCH 0/6] drm: msm: A5XX zap shader Bjorn Andersson
2017-04-20  3:46 ` Archit Taneja

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1492031718-28477-6-git-send-email-jcrouse@codeaurora.org \
    --to=jcrouse@codeaurora.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).