Skip to content

Commit

Permalink
HACK: panfrost: add support for custom soft-reset on Amlogic G12
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
  • Loading branch information
superna9999 authored and chewitt committed Mar 13, 2020
1 parent 8b9d182 commit e34cd04
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 12 additions & 1 deletion drivers/gpu/drm/panfrost/panfrost_gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/reset.h>

#include "panfrost_device.h"
#include "panfrost_features.h"
Expand Down Expand Up @@ -59,7 +61,16 @@ 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-g12a-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
4 changes: 4 additions & 0 deletions drivers/gpu/drm/panfrost/panfrost_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
#define GPU_STATUS 0x34
#define GPU_STATUS_PRFCNT_ACTIVE BIT(2)
#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_FAULT_STATUS 0x3C
#define GPU_FAULT_ADDRESS_LO 0x40
#define GPU_FAULT_ADDRESS_HI 0x44
Expand Down

0 comments on commit e34cd04

Please sign in to comment.