Skip to content

Commit

Permalink
[WiP] drm/panfrost: add support for custom soft-reset on Amlogic GXM
Browse files Browse the repository at this point in the history
  • Loading branch information
superna9999 committed Mar 14, 2019
1 parent 63dc6c3 commit 4ac2531
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/gpu/drm/panfrost/panfrost_gpu.c
Expand Up @@ -5,7 +5,9 @@
#include <linux/bitmap.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/reset.h>
#include <linux/io.h>
#include <linux/of.h>
#include <linux/iopoll.h>
#include <linux/platform_device.h>

Expand Down Expand Up @@ -49,7 +51,16 @@ static int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)

gpu_write(pfdev, GPU_INT_MASK, 0);
gpu_write(pfdev, GPU_INT_CLEAR, GPU_IRQ_RESET_COMPLETED);
gpu_write(pfdev, GPU_CMD, GPU_CMD_SOFT_RESET);

if (of_device_is_compatible(pfdev->dev->of_node, "amlogic,meson-gxm-mali")) {
reset_control_assert(pfdev->rstc);
udelay(10);
reset_control_deassert(pfdev->rstc);

gpu_write(pfdev, GPU_PWR_KEY, 0x2968A819);
gpu_write(pfdev, GPU_PWR_OVERRIDE1, 0xfff | (0x20 << 16));
} else
gpu_write(pfdev, GPU_CMD, GPU_CMD_SOFT_RESET);

ret = readl_relaxed_poll_timeout(pfdev->iomem + GPU_INT_RAWSTAT,
val, val & GPU_IRQ_RESET_COMPLETED, 100, 10000);
Expand Down
3 changes: 3 additions & 0 deletions drivers/gpu/drm/panfrost/panfrost_regs.h
Expand Up @@ -46,6 +46,9 @@
#define GPU_CMD_SOFT_RESET 0x01
#define GPU_STATUS 0x34
#define GPU_LATEST_FLUSH_ID 0x38
#define GPU_PWR_KEY 0x050 /* (WO) Power manager key register */
#define GPU_PWR_OVERRIDE0 0x054 /* (RW) Power manager override settings */
#define GPU_PWR_OVERRIDE1 0x058 /* (RW) Power manager override settings */

#define GPU_THREAD_MAX_THREADS 0x0A0 /* (RO) Maximum number of threads per core */
#define GPU_THREAD_MAX_WORKGROUP_SIZE 0x0A4 /* (RO) Maximum workgroup size */
Expand Down

0 comments on commit 4ac2531

Please sign in to comment.