Commit 680e35ea authored by hanetzer's avatar hanetzer

drm/panfrost: add mmu init code

Signed-off-by: hanetzer's avatarMarty E. Plummer <hanetzer@startmail.com>
parent 74d86f6b
......@@ -6,6 +6,7 @@
#include "panfrost_device.h"
#include "panfrost_gpu.h"
#include "panfrost_mmu.h"
struct panfrost_ip_desc {
char *name;
......
......@@ -55,9 +55,6 @@ void panfrost_device_fini(struct panfrost_device *pfdev);
int panfrost_job_init(struct panfrost_ip *ip);
void panfrost_job_fini(struct panfrost_ip *ip);
int panfrost_mmu_init(struct panfrost_ip *ip);
void panfrost_mmu_fini(struct panfrost_ip *ip);
const char *panfrost_ip_name(struct panfrost_ip *ip);
#endif
......@@ -2,9 +2,36 @@
/* Copyright 2018 Panfrost Team */
#include "panfrost_device.h"
#include "panfrost_mmu.h"
#include "panfrost_regs.h"
#define mmu_write(reg, data) writel(data, ip->iomem + PAN_MMU_##reg)
#define mmu_read(reg) readl(ip->iomem + PAN_MMU_##reg)
static irqreturn_t panfrost_mmu_irq_handler(int irq, void *data)
{
struct panfrost_ip *ip = data;
struct panfrost_device *pfdev = ip->pfdev;
u32 status = mmu_read(INT_STAT);
if (!status)
return IRQ_NONE;
return IRQ_HANDLED;
};
int panfrost_mmu_init(struct panfrost_ip *ip)
{
struct panfrost_device *pfdev = ip->pfdev;
int err;
err = devm_request_irq(pfdev->dev, ip->irq, panfrost_mmu_irq_handler,
IRQF_SHARED, panfrost_ip_name(ip), ip);
if (err) {
dev_err(pfdev->dev, "mmu %s failed to request irq\n", panfrost_ip_name(ip));
return err;
}
return 0;
}
......
// SPDX-License-Identifier: GPL-2.0
/* Copyright 2018 Panfrost Team */
#ifndef __PANFROST_MMU_H__
#define __PANFROST_MMU_H__
struct panfrost_ip;
int panfrost_mmu_init(struct panfrost_ip *ip);
void panfrost_mmu_fini(struct panfrost_ip *ip);
#endif
......@@ -39,4 +39,11 @@
#define PAN_GPU_CMD 0x30
#define PAN_GPU_CMD_SOFT_RESET 0x01
#define PAN_GPU_STATUS 0x34
/* MMU regs */
#define PAN_MMU_INT_RAWSTAT 0x00
#define PAN_MMU_INT_CLEAR 0x04
#define PAN_MMU_INT_MASK 0x08
#define PAN_MMU_INT_STAT 0x0c
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment