brintos

brintos / linux-shallow public Read only

0
0
Text · 803 B · c451808 Raw
36 lines · c
1/* SPDX-License-Identifier: GPL-2.0-only */2/*3 * Copyright (C) 2021-2022 Digiteq Automotive4 *     author: Martin Tuma <martin.tuma@digiteqautomotive.com>5 */6 7#ifndef __MGB4_REGS_H__8#define __MGB4_REGS_H__9 10#include <linux/io.h>11 12struct mgb4_regs {13	resource_size_t mapbase;14	resource_size_t mapsize;15	void __iomem *membase;16};17 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))22 23static inline void mgb4_mask_reg(struct mgb4_regs *regs, u32 reg, u32 mask,24				 u32 val)25{26	u32 ret = mgb4_read_reg(regs, reg);27 28	val |= ret & ~mask;29	mgb4_write_reg(regs, reg, val);30}31 32int mgb4_regs_map(struct resource *res, struct mgb4_regs *regs);33void mgb4_regs_free(struct mgb4_regs *regs);34 35#endif36