Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / media / pci / mgb4 / mgb4_regs.h
blobc451808907308d3d86d468ba5929abd9dcc21889
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2021-2022 Digiteq Automotive
4 * author: Martin Tuma <martin.tuma@digiteqautomotive.com>
5 */
7 #ifndef __MGB4_REGS_H__
8 #define __MGB4_REGS_H__
10 #include <linux/io.h>
12 struct mgb4_regs {
13 resource_size_t mapbase;
14 resource_size_t mapsize;
15 void __iomem *membase;
18 #define mgb4_write_reg(regs, offset, val) \
19 iowrite32(val, (regs)->membase + (offset))
20 #define mgb4_read_reg(regs, offset) \
21 ioread32((regs)->membase + (offset))
23 static inline void mgb4_mask_reg(struct mgb4_regs *regs, u32 reg, u32 mask,
24 u32 val)
26 u32 ret = mgb4_read_reg(regs, reg);
28 val |= ret & ~mask;
29 mgb4_write_reg(regs, reg, val);
32 int mgb4_regs_map(struct resource *res, struct mgb4_regs *regs);
33 void mgb4_regs_free(struct mgb4_regs *regs);
35 #endif