mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-19 12:03:56 -04:00
drm/panthor: Explicitly set the coherency mode
This commit fixes the potential misalignment between the value of device tree property "dma-coherent" and default value of COHERENCY_ENABLE register. Panthor driver didn't explicitly program the COHERENCY_ENABLE register with the desired coherency mode. The default value of COHERENCY_ENABLE register is implementation defined, so it may not be always aligned with the "dma-coherent" property value. The commit also checks the COHERENCY_FEATURES register to confirm that the coherency protocol is actually supported or not. v2: - Added R-b tags Signed-off-by: Akash Goel <akash.goel@arm.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> Reviewed-by: Steven Price <steven.price@arm.com> Link: https://lore.kernel.org/r/20241030225407.4077513-3-akash.goel@arm.com Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
This commit is contained in:
@@ -22,6 +22,24 @@
|
||||
#include "panthor_regs.h"
|
||||
#include "panthor_sched.h"
|
||||
|
||||
static int panthor_gpu_coherency_init(struct panthor_device *ptdev)
|
||||
{
|
||||
ptdev->coherent = device_get_dma_attr(ptdev->base.dev) == DEV_DMA_COHERENT;
|
||||
|
||||
if (!ptdev->coherent)
|
||||
return 0;
|
||||
|
||||
/* Check if the ACE-Lite coherency protocol is actually supported by the GPU.
|
||||
* ACE protocol has never been supported for command stream frontend GPUs.
|
||||
*/
|
||||
if ((gpu_read(ptdev, GPU_COHERENCY_FEATURES) &
|
||||
GPU_COHERENCY_PROT_BIT(ACE_LITE)))
|
||||
return 0;
|
||||
|
||||
drm_err(&ptdev->base, "Coherency not supported by the device");
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
|
||||
static int panthor_clk_init(struct panthor_device *ptdev)
|
||||
{
|
||||
ptdev->clks.core = devm_clk_get(ptdev->base.dev, NULL);
|
||||
@@ -156,7 +174,9 @@ int panthor_device_init(struct panthor_device *ptdev)
|
||||
struct page *p;
|
||||
int ret;
|
||||
|
||||
ptdev->coherent = device_get_dma_attr(ptdev->base.dev) == DEV_DMA_COHERENT;
|
||||
ret = panthor_gpu_coherency_init(ptdev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
init_completion(&ptdev->unplug.done);
|
||||
ret = drmm_mutex_init(&ptdev->base, &ptdev->unplug.lock);
|
||||
|
||||
Reference in New Issue
Block a user