Lines Matching +full:mali +full:- +full:t760

1 // SPDX-License-Identifier: GPL-2.0
8 #include <linux/dma-mapping.h>
35 dev_warn(pfdev->dev, "GPU Fault 0x%08x (%s) at 0x%016llx\n", in panfrost_gpu_irq_handler()
40 dev_warn(pfdev->dev, "There were multiple GPU faults - some have not been reported\n"); in panfrost_gpu_irq_handler()
65 ret = readl_relaxed_poll_timeout(pfdev->iomem + GPU_INT_RAWSTAT, in panfrost_gpu_soft_reset()
69 dev_err(pfdev->dev, "gpu soft reset timed out\n"); in panfrost_gpu_soft_reset()
82 * The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs in panfrost_gpu_amlogic_quirk()
132 pfdev->features.revision >= 0x2000) in panfrost_gpu_init_quirks()
135 pfdev->features.coherency_features == COHERENCY_ACE) in panfrost_gpu_init_quirks()
146 if (pfdev->comp->vendor_quirk) in panfrost_gpu_init_quirks()
147 pfdev->comp->vendor_quirk(pfdev); in panfrost_gpu_init_quirks()
187 GPU_MODEL(t760, 0x750,
188 GPU_REV(t760, 0, 0), GPU_REV(t760, 0, 1),
189 GPU_REV_EXT(t760, 0, 1, 0, _50rel0),
190 GPU_REV(t760, 0, 2), GPU_REV(t760, 0, 3)),
218 pfdev->features.l2_features = gpu_read(pfdev, GPU_L2_FEATURES); in panfrost_gpu_init_features()
219 pfdev->features.core_features = gpu_read(pfdev, GPU_CORE_FEATURES); in panfrost_gpu_init_features()
220 pfdev->features.tiler_features = gpu_read(pfdev, GPU_TILER_FEATURES); in panfrost_gpu_init_features()
221 pfdev->features.mem_features = gpu_read(pfdev, GPU_MEM_FEATURES); in panfrost_gpu_init_features()
222 pfdev->features.mmu_features = gpu_read(pfdev, GPU_MMU_FEATURES); in panfrost_gpu_init_features()
223 pfdev->features.thread_features = gpu_read(pfdev, GPU_THREAD_FEATURES); in panfrost_gpu_init_features()
224 pfdev->features.max_threads = gpu_read(pfdev, GPU_THREAD_MAX_THREADS); in panfrost_gpu_init_features()
225 pfdev->features.thread_max_workgroup_sz = gpu_read(pfdev, GPU_THREAD_MAX_WORKGROUP_SIZE); in panfrost_gpu_init_features()
226 pfdev->features.thread_max_barrier_sz = gpu_read(pfdev, GPU_THREAD_MAX_BARRIER_SIZE); in panfrost_gpu_init_features()
227 pfdev->features.coherency_features = gpu_read(pfdev, GPU_COHERENCY_FEATURES); in panfrost_gpu_init_features()
228 pfdev->features.afbc_features = gpu_read(pfdev, GPU_AFBC_FEATURES); in panfrost_gpu_init_features()
230 pfdev->features.texture_features[i] = gpu_read(pfdev, GPU_TEXTURE_FEATURES(i)); in panfrost_gpu_init_features()
232 pfdev->features.as_present = gpu_read(pfdev, GPU_AS_PRESENT); in panfrost_gpu_init_features()
234 pfdev->features.js_present = gpu_read(pfdev, GPU_JS_PRESENT); in panfrost_gpu_init_features()
235 num_js = hweight32(pfdev->features.js_present); in panfrost_gpu_init_features()
237 pfdev->features.js_features[i] = gpu_read(pfdev, GPU_JS_FEATURES(i)); in panfrost_gpu_init_features()
239 pfdev->features.shader_present = gpu_read(pfdev, GPU_SHADER_PRESENT_LO); in panfrost_gpu_init_features()
240 pfdev->features.shader_present |= (u64)gpu_read(pfdev, GPU_SHADER_PRESENT_HI) << 32; in panfrost_gpu_init_features()
242 pfdev->features.tiler_present = gpu_read(pfdev, GPU_TILER_PRESENT_LO); in panfrost_gpu_init_features()
243 pfdev->features.tiler_present |= (u64)gpu_read(pfdev, GPU_TILER_PRESENT_HI) << 32; in panfrost_gpu_init_features()
245 pfdev->features.l2_present = gpu_read(pfdev, GPU_L2_PRESENT_LO); in panfrost_gpu_init_features()
246 pfdev->features.l2_present |= (u64)gpu_read(pfdev, GPU_L2_PRESENT_HI) << 32; in panfrost_gpu_init_features()
247 pfdev->features.nr_core_groups = hweight64(pfdev->features.l2_present); in panfrost_gpu_init_features()
249 pfdev->features.stack_present = gpu_read(pfdev, GPU_STACK_PRESENT_LO); in panfrost_gpu_init_features()
250 pfdev->features.stack_present |= (u64)gpu_read(pfdev, GPU_STACK_PRESENT_HI) << 32; in panfrost_gpu_init_features()
252 pfdev->features.thread_tls_alloc = gpu_read(pfdev, GPU_THREAD_TLS_ALLOC); in panfrost_gpu_init_features()
255 pfdev->features.revision = gpu_id & 0xffff; in panfrost_gpu_init_features()
256 pfdev->features.id = gpu_id >> 16; in panfrost_gpu_init_features()
261 if (pfdev->features.id == 0x6956) in panfrost_gpu_init_features()
262 pfdev->features.id = 0x0600; in panfrost_gpu_init_features()
264 major = (pfdev->features.revision >> 12) & 0xf; in panfrost_gpu_init_features()
265 minor = (pfdev->features.revision >> 4) & 0xff; in panfrost_gpu_init_features()
266 status = pfdev->features.revision & 0xf; in panfrost_gpu_init_features()
267 rev = pfdev->features.revision; in panfrost_gpu_init_features()
269 gpu_id = pfdev->features.id; in panfrost_gpu_init_features()
271 for (model = gpu_models; model->name; model++) { in panfrost_gpu_init_features()
272 int best = -1; in panfrost_gpu_init_features()
274 if (!panfrost_model_eq(pfdev, model->id)) in panfrost_gpu_init_features()
277 name = model->name; in panfrost_gpu_init_features()
278 hw_feat = model->features; in panfrost_gpu_init_features()
279 hw_issues |= model->issues; in panfrost_gpu_init_features()
281 if (model->revs[i].revision == rev) { in panfrost_gpu_init_features()
284 } else if (model->revs[i].revision == (rev & ~0xf)) in panfrost_gpu_init_features()
289 hw_issues |= model->revs[best].issues; in panfrost_gpu_init_features()
294 bitmap_from_u64(pfdev->features.hw_features, hw_feat); in panfrost_gpu_init_features()
295 bitmap_from_u64(pfdev->features.hw_issues, hw_issues); in panfrost_gpu_init_features()
297 dev_info(pfdev->dev, "mali-%s id 0x%x major 0x%x minor 0x%x status 0x%x", in panfrost_gpu_init_features()
299 dev_info(pfdev->dev, "features: %64pb, issues: %64pb", in panfrost_gpu_init_features()
300 pfdev->features.hw_features, in panfrost_gpu_init_features()
301 pfdev->features.hw_issues); in panfrost_gpu_init_features()
303 …dev_info(pfdev->dev, "Features: L2:0x%08x Shader:0x%08x Tiler:0x%08x Mem:0x%0x MMU:0x%08x AS:0x%x … in panfrost_gpu_init_features()
304 pfdev->features.l2_features, in panfrost_gpu_init_features()
305 pfdev->features.core_features, in panfrost_gpu_init_features()
306 pfdev->features.tiler_features, in panfrost_gpu_init_features()
307 pfdev->features.mem_features, in panfrost_gpu_init_features()
308 pfdev->features.mmu_features, in panfrost_gpu_init_features()
309 pfdev->features.as_present, in panfrost_gpu_init_features()
310 pfdev->features.js_present); in panfrost_gpu_init_features()
312 dev_info(pfdev->dev, "shader_present=0x%0llx l2_present=0x%0llx", in panfrost_gpu_init_features()
313 pfdev->features.shader_present, pfdev->features.l2_present); in panfrost_gpu_init_features()
324 if (pfdev->features.l2_present != 1) { in panfrost_gpu_power_on()
327 * ~(l2_present - 1) unsets all bits in l2_present except in panfrost_gpu_power_on()
328 * the bottom bit. (l2_present - 2) has all the bits in in panfrost_gpu_power_on()
332 core_mask = ~(pfdev->features.l2_present - 1) & in panfrost_gpu_power_on()
333 (pfdev->features.l2_present - 2); in panfrost_gpu_power_on()
334 dev_info_once(pfdev->dev, "using only 1st core group (%lu cores from %lu)\n", in panfrost_gpu_power_on()
336 hweight64(pfdev->features.shader_present)); in panfrost_gpu_power_on()
338 gpu_write(pfdev, L2_PWRON_LO, pfdev->features.l2_present & core_mask); in panfrost_gpu_power_on()
339 ret = readl_relaxed_poll_timeout(pfdev->iomem + L2_READY_LO, in panfrost_gpu_power_on()
340 val, val == (pfdev->features.l2_present & core_mask), in panfrost_gpu_power_on()
343 dev_err(pfdev->dev, "error powering up gpu L2"); in panfrost_gpu_power_on()
346 pfdev->features.shader_present & core_mask); in panfrost_gpu_power_on()
347 ret = readl_relaxed_poll_timeout(pfdev->iomem + SHADER_READY_LO, in panfrost_gpu_power_on()
348 val, val == (pfdev->features.shader_present & core_mask), in panfrost_gpu_power_on()
351 dev_err(pfdev->dev, "error powering up gpu shader"); in panfrost_gpu_power_on()
353 gpu_write(pfdev, TILER_PWRON_LO, pfdev->features.tiler_present); in panfrost_gpu_power_on()
354 ret = readl_relaxed_poll_timeout(pfdev->iomem + TILER_READY_LO, in panfrost_gpu_power_on()
355 val, val == pfdev->features.tiler_present, 100, 1000); in panfrost_gpu_power_on()
357 dev_err(pfdev->dev, "error powering up gpu tiler"); in panfrost_gpu_power_on()
377 err = dma_set_mask_and_coherent(pfdev->dev, in panfrost_gpu_init()
378 DMA_BIT_MASK(FIELD_GET(0xff00, pfdev->features.mmu_features))); in panfrost_gpu_init()
382 dma_set_max_seg_size(pfdev->dev, UINT_MAX); in panfrost_gpu_init()
384 irq = platform_get_irq_byname(to_platform_device(pfdev->dev), "gpu"); in panfrost_gpu_init()
386 return -ENODEV; in panfrost_gpu_init()
388 err = devm_request_irq(pfdev->dev, irq, panfrost_gpu_irq_handler, in panfrost_gpu_init()
389 IRQF_SHARED, KBUILD_MODNAME "-gpu", pfdev); in panfrost_gpu_init()
391 dev_err(pfdev->dev, "failed to request gpu irq"); in panfrost_gpu_init()
411 if (pm_runtime_get_if_in_use(pfdev->dev)) { in panfrost_gpu_get_latest_flush_id()
413 pm_runtime_put(pfdev->dev); in panfrost_gpu_get_latest_flush_id()