summaryrefstree
path: root/kernel/drivers/vision/vpu/include/vpu-io.h
blob: b42d22bee04758c11108a885981c093ac92ad66c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * Samsung Exynos SoC series VPU driver
 *
 * Copyright (c) 2016 Samsung Electronics Co., Ltd
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#ifndef __VPU_IO_H__
#define __VPU_IO_H__

#include <linux/io.h>
#include "vpu-config.h"

#define IOR8(port)            readb((const volatile void *)&port)
#define IOR16(port)           readw((const volatile void *)&port)
#define IOR32(port)           readl((const volatile void *)&port)
#define IOR64(port)           readq((const volatile void *)&port)

#ifdef DBG_VERBOSE_IO
#define IOW8(port, val) \
	do { pr_info("ADDR: %p, VAL: 0x%02x\r\n", \
		&port, val); writeb(val, &port);\
	} while (0)
#define IOW16(port, val) \
	do { pr_info("ADDR: %p, VAL: 0x%04x\r\n", \
		&port, val); writew(val, &port);\
	} while (0)
#define IOW32(port, val) \
	do { pr_info("ADDR: %p, VAL: 0x%08x\r\n", \
		&port, val); writel(val, &port);\
	} while (0)
#define IOW64(port, val) \
	do { pr_info("ADDR: %p, VAL: 0x%016llx\r\n", \
		&port, val); writeq(val, &port);\
	} while (0)

#else  /* not VERBOSE_WRITE */
#define IOW8(port, val)      writeb(val, &port)
#define IOW16(port, val)     writew(val, &port)
#define IOW32(port, val)     writel(val, &port)
#define IOW64(port, val)     writeq(val, &port)
#endif /* not VERBOSE_WRITE */

void *mem2iocpy(void *dst,void *src, u32 size);
void *io2memcpy(void *dst,void *src, u32 size);

#endif /* __VPUL_IO_H__ */