malidp_io.h (1027B)
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * (C) COPYRIGHT 2018 ARM Limited. All rights reserved. 4 * Author: James.Qian.Wang <james.qian.wang@arm.com> 5 * 6 */ 7#ifndef _MALIDP_IO_H_ 8#define _MALIDP_IO_H_ 9 10#include <linux/io.h> 11 12static inline u32 13malidp_read32(u32 __iomem *base, u32 offset) 14{ 15 return readl((base + (offset >> 2))); 16} 17 18static inline void 19malidp_write32(u32 __iomem *base, u32 offset, u32 v) 20{ 21 writel(v, (base + (offset >> 2))); 22} 23 24static inline void 25malidp_write64(u32 __iomem *base, u32 offset, u64 v) 26{ 27 writel(lower_32_bits(v), (base + (offset >> 2))); 28 writel(upper_32_bits(v), (base + (offset >> 2) + 1)); 29} 30 31static inline void 32malidp_write32_mask(u32 __iomem *base, u32 offset, u32 m, u32 v) 33{ 34 u32 tmp = malidp_read32(base, offset); 35 36 tmp &= (~m); 37 malidp_write32(base, offset, v | tmp); 38} 39 40static inline void 41malidp_write_group(u32 __iomem *base, u32 offset, int num, const u32 *values) 42{ 43 int i; 44 45 for (i = 0; i < num; i++) 46 malidp_write32(base, offset + i * 4, values[i]); 47} 48 49#endif /*_MALIDP_IO_H_*/