Skip to contentSkip to conversation

drm/msm: a4xx support for msm-drm

PATCH New Ganesan, Aravind 1 participant 1 message Oct 31, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 drm/msm: a4xx support for msm-drm

Added a4xx GPU support.

---
Resend in patch-set format and with [email protected] on the CC.

 drivers/gpu/drm/msm/Makefile               |   1 +
 drivers/gpu/drm/msm/adreno/a4xx_gpu.c      | 620
+++++++++++++++++++++++++++++
 drivers/gpu/drm/msm/adreno/a4xx_gpu.h      |  34 ++
 drivers/gpu/drm/msm/adreno/adreno_device.c |  13 +
 drivers/gpu/drm/msm/adreno/adreno_gpu.c    |   2 +-
 drivers/gpu/drm/msm/adreno/adreno_gpu.h    |  14 +-
 6 files changed, 681 insertions(+), 3 deletions(-)
 create mode 100644 drivers/gpu/drm/msm/adreno/a4xx_gpu.c
 create mode 100644 drivers/gpu/drm/msm/adreno/a4xx_gpu.h
drivers/gpu/drm/msm/Makefile +1 -0
index 20b7eda..21020f9 100644
@@ -7,6 +7,7 @@ msm-y := \
 	adreno/adreno_device.o \
 	adreno/adreno_gpu.o \
 	adreno/a3xx_gpu.o \
+	adreno/a4xx_gpu.o \
 	hdmi/hdmi.o \
 	hdmi/hdmi_audio.o \
 	hdmi/hdmi_bridge.o \
(quoted diff) +0 -0

b/drivers/gpu/drm/msm/adreno/a4xx_gpu.c
new file mode 100644
index 0000000..50cbaf4

drivers/gpu/drm/msm/adreno/a4xx_gpu.c new file +620 -0

620 lines not on this page · raw message

(quoted diff) +0 -0

b/drivers/gpu/drm/msm/adreno/a4xx_gpu.h
new file mode 100644
index 0000000..0124720

drivers/gpu/drm/msm/adreno/a4xx_gpu.h new file +34 -0
@@ -0,0 +1,34 @@
+/* Copyright (c) 2014 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef __A4XX_GPU_H__
+#define __A4XX_GPU_H__
+
+#include "adreno_gpu.h"
+
+/* arrg, somehow fb.h is getting pulled in: */
+#undef ROP_COPY
+#undef ROP_XOR
+
+#include "a4xx.xml.h"
+
+struct a4xx_gpu {
+	struct adreno_gpu base;
+	struct platform_device *pdev;
+
+	/* if OCMEM is used for GMEM: */
+	uint32_t ocmem_base;
+	void *ocmem_hdl;
+};
+#define to_a4xx_gpu(x) container_of(x, struct a4xx_gpu, base)
+
+#endif /* __A4XX_GPU_H__ */
(quoted diff) +0 -0

b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 7ab85af..be83dee 100644

drivers/gpu/drm/msm/adreno/adreno_device.c +2 -0
@@ -2,6 +2,8 @@
  * Copyright (C) 2013-2014 Red Hat
  * Author: Rob Clark <[email protected]>
  *
+ * Copyright (c) 2014 The Linux Foundation. All rights reserved.
+ *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 as

published by
* the Free Software Foundation.
@@ -28,6 +30,7 @@ MODULE_PARM_DESC(hang_debug, "Dump registers when hang is detected (can be slow!
module_param_named(hang_debug, hang_debug, bool, 0600);

struct msm_gpu *a3xx_gpu_init(struct drm_device *dev);
+struct msm_gpu *a4xx_gpu_init(struct drm_device *dev);

static const struct adreno_info gpulist[] = {
{
@@ -54,6 +57,14 @@ static const struct adreno_info gpulist[] = {
.pfpfw = "a330_pfp.fw",
.gmem = SZ_1M,
.init = a3xx_gpu_init,
+ }, {

+		.rev   = ADRENO_REV(4, 2, 0, ANY_ID),
+		.revn  = 420,
+		.name  = "A420",

+ .pm4fw = "a420_pm4.fw",
+ .pfpfw = "a420_pfp.fw",
+ .gmem = (SZ_1M + SZ_512K),
+ .init = a4xx_gpu_init,
},
};

@@ -61,6 +72,8 @@ MODULE_FIRMWARE("a300_pm4.fw");
MODULE_FIRMWARE("a300_pfp.fw");
MODULE_FIRMWARE("a330_pm4.fw");
MODULE_FIRMWARE("a330_pfp.fw");
+MODULE_FIRMWARE("a420_pm4.fw");
+MODULE_FIRMWARE("a420_pfp.fw");

static inline bool _rev_match(uint8_t entry, uint8_t id) {

(quoted diff) +0 -0

b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 82619b1..1fe7c8d 100644

drivers/gpu/drm/msm/adreno/adreno_gpu.c +0 -0
@@ -147,7 +147,7 @@ int adreno_submit(struct msm_gpu *gpu, struct

msm_gem_submit *submit,
OUT_PKT0(ring, REG_AXXX_CP_SCRATCH_REG2, 1); OUT_RING(ring, submit->fence);

- if (adreno_is_a3xx(adreno_gpu)) {
+ if (adreno_is_a3xx(adreno_gpu) || adreno_is_a4xx(adreno_gpu)) {
/* Flush HLSQ lazy updates to make sure there is nothing
* pending for indirect loads after the timestamp has
* passed:

(quoted diff) +0 -0

b/drivers/gpu/drm/msm/adreno/adreno_gpu.h
index ec84d79..3fa06b3 100644

drivers/gpu/drm/msm/adreno/adreno_gpu.h +0 -0
@@ -225,6 +225,16 @@ static inline bool adreno_is_a330v2(struct

adreno_gpu *gpu)
return adreno_is_a330(gpu) && (gpu->rev.patchid > 0);
}

+static inline bool adreno_is_a4xx(struct adreno_gpu *gpu)
+{
+ return (gpu->revn >= 400) && (gpu->revn < 500);
+}
+
+static inline int adreno_is_a420(struct adreno_gpu *gpu)
+{
+ return gpu->revn == 420;
+}
+
int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value); int adreno_hw_init(struct msm_gpu *gpu);
uint32_t adreno_last_fence(struct msm_gpu *gpu);
@@ -289,8 +299,8 @@ static inline u32 adreno_gpu_read(struct adreno_gpu *gpu,
{
u32 reg = gpu->reg_offsets->offsets[offset_name];
u32 val = 0;
- if(adreno_reg_check(gpu,offset_name))
- val = gpu_read(&gpu->base,reg);
+ if(adreno_reg_check(gpu, offset_name))
+ val = gpu_read(&gpu->base, reg);
return val;
}

Signature · 6 lines
1.8.5.2

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project