Lines Matching +full:7268 +full:- +full:v3d

1 // SPDX-License-Identifier: GPL-2.0+
2 /* Copyright (C) 2014-2018 Broadcom */
5 * DOC: Broadcom V3D Graphics Driver
7 * This driver supports the Broadcom V3D 3.3 and 4.1 OpenGL ES GPUs.
8 * For V3D 2.x support, see the VC4 driver.
10 * The V3D GPU includes a tiled render (composed of a bin and render
17 #include <linux/dma-mapping.h>
32 #define DRIVER_NAME "v3d"
33 #define DRIVER_DESC "Broadcom V3D graphics"
42 struct v3d_dev *v3d = to_v3d_dev(dev); in v3d_get_param_ioctl() local
54 if (args->pad != 0) in v3d_get_param_ioctl()
55 return -EINVAL; in v3d_get_param_ioctl()
61 if (args->param < ARRAY_SIZE(reg_map) && in v3d_get_param_ioctl()
62 (reg_map[args->param] || in v3d_get_param_ioctl()
63 args->param == DRM_V3D_PARAM_V3D_CORE0_IDENT0)) { in v3d_get_param_ioctl()
64 u32 offset = reg_map[args->param]; in v3d_get_param_ioctl()
66 if (args->value != 0) in v3d_get_param_ioctl()
67 return -EINVAL; in v3d_get_param_ioctl()
69 if (args->param >= DRM_V3D_PARAM_V3D_CORE0_IDENT0 && in v3d_get_param_ioctl()
70 args->param <= DRM_V3D_PARAM_V3D_CORE0_IDENT2) { in v3d_get_param_ioctl()
71 args->value = V3D_CORE_READ(0, offset); in v3d_get_param_ioctl()
73 args->value = V3D_READ(offset); in v3d_get_param_ioctl()
78 switch (args->param) { in v3d_get_param_ioctl()
80 args->value = 1; in v3d_get_param_ioctl()
83 args->value = v3d_has_csd(v3d); in v3d_get_param_ioctl()
86 args->value = 1; in v3d_get_param_ioctl()
89 args->value = (v3d->ver >= 40); in v3d_get_param_ioctl()
92 args->value = 1; in v3d_get_param_ioctl()
95 args->value = 1; in v3d_get_param_ioctl()
98 args->value = v3d->perfmon_info.max_counters; in v3d_get_param_ioctl()
101 DRM_DEBUG("Unknown parameter %d\n", args->param); in v3d_get_param_ioctl()
102 return -EINVAL; in v3d_get_param_ioctl()
109 struct v3d_dev *v3d = to_v3d_dev(dev); in v3d_open() local
116 return -ENOMEM; in v3d_open()
118 v3d_priv->v3d = v3d; in v3d_open()
121 sched = &v3d->queue[i].sched; in v3d_open()
122 drm_sched_entity_init(&v3d_priv->sched_entity[i], in v3d_open()
126 memset(&v3d_priv->stats[i], 0, sizeof(v3d_priv->stats[i])); in v3d_open()
127 seqcount_init(&v3d_priv->stats[i].lock); in v3d_open()
131 file->driver_priv = v3d_priv; in v3d_open()
139 struct v3d_file_priv *v3d_priv = file->driver_priv; in v3d_postclose()
143 drm_sched_entity_destroy(&v3d_priv->sched_entity[q]); in v3d_postclose()
155 seq = read_seqcount_begin(&stats->lock); in v3d_get_stats()
156 *active_runtime = stats->enabled_ns; in v3d_get_stats()
157 if (stats->start_ns) in v3d_get_stats()
158 *active_runtime += timestamp - stats->start_ns; in v3d_get_stats()
159 *jobs_completed = stats->jobs_completed; in v3d_get_stats()
160 } while (read_seqcount_retry(&stats->lock, seq)); in v3d_get_stats()
165 struct v3d_file_priv *file_priv = file->driver_priv; in v3d_show_fdinfo()
170 struct v3d_stats *stats = &file_priv->stats[queue]; in v3d_show_fdinfo()
178 drm_printf(p, "drm-engine-%s: \t%llu ns\n", in v3d_show_fdinfo()
184 drm_printf(p, "v3d-jobs-%s: \t%llu jobs\n", in v3d_show_fdinfo()
248 { .compatible = "brcm,2711-v3d" },
249 { .compatible = "brcm,2712-v3d" },
250 { .compatible = "brcm,7268-v3d" },
251 { .compatible = "brcm,7278-v3d" },
257 map_regs(struct v3d_dev *v3d, void __iomem **regs, const char *name) in map_regs() argument
259 *regs = devm_platform_ioremap_resource_byname(v3d_to_pdev(v3d), name); in map_regs()
265 struct device *dev = &pdev->dev; in v3d_platform_drm_probe()
267 struct v3d_dev *v3d; in v3d_platform_drm_probe() local
273 v3d = devm_drm_dev_alloc(dev, &v3d_drm_driver, struct v3d_dev, drm); in v3d_platform_drm_probe()
274 if (IS_ERR(v3d)) in v3d_platform_drm_probe()
275 return PTR_ERR(v3d); in v3d_platform_drm_probe()
277 drm = &v3d->drm; in v3d_platform_drm_probe()
281 ret = map_regs(v3d, &v3d->hub_regs, "hub"); in v3d_platform_drm_probe()
285 ret = map_regs(v3d, &v3d->core_regs[0], "core0"); in v3d_platform_drm_probe()
295 v3d->va_width = 30 + V3D_GET_FIELD(mmu_debug, V3D_MMU_VA_WIDTH); in v3d_platform_drm_probe()
298 v3d->ver = (V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_TVER) * 10 + in v3d_platform_drm_probe()
300 v3d->cores = V3D_GET_FIELD(ident1, V3D_HUB_IDENT1_NCORES); in v3d_platform_drm_probe()
301 WARN_ON(v3d->cores > 1); /* multicore not yet implemented */ in v3d_platform_drm_probe()
304 v3d->rev = V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPREV); in v3d_platform_drm_probe()
306 v3d_perfmon_init(v3d); in v3d_platform_drm_probe()
308 v3d->reset = devm_reset_control_get_exclusive(dev, NULL); in v3d_platform_drm_probe()
309 if (IS_ERR(v3d->reset)) { in v3d_platform_drm_probe()
310 ret = PTR_ERR(v3d->reset); in v3d_platform_drm_probe()
312 if (ret == -EPROBE_DEFER) in v3d_platform_drm_probe()
315 v3d->reset = NULL; in v3d_platform_drm_probe()
316 ret = map_regs(v3d, &v3d->bridge_regs, "bridge"); in v3d_platform_drm_probe()
324 if (v3d->ver < 41) { in v3d_platform_drm_probe()
325 ret = map_regs(v3d, &v3d->gca_regs, "gca"); in v3d_platform_drm_probe()
330 v3d->mmu_scratch = dma_alloc_wc(dev, 4096, &v3d->mmu_scratch_paddr, in v3d_platform_drm_probe()
332 if (!v3d->mmu_scratch) { in v3d_platform_drm_probe()
334 return -ENOMEM; in v3d_platform_drm_probe()
341 ret = v3d_irq_init(v3d); in v3d_platform_drm_probe()
358 v3d_irq_disable(v3d); in v3d_platform_drm_probe()
362 dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr); in v3d_platform_drm_probe()
369 struct v3d_dev *v3d = to_v3d_dev(drm); in v3d_platform_drm_remove() local
370 struct device *dev = &pdev->dev; in v3d_platform_drm_remove()
378 dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch, in v3d_platform_drm_remove()
379 v3d->mmu_scratch_paddr); in v3d_platform_drm_remove()
386 .name = "v3d",
393 MODULE_ALIAS("platform:v3d-drm");
394 MODULE_DESCRIPTION("Broadcom V3D DRM Driver");