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 12 static inline u32 13 malidp_read32(u32 __iomem *base, u32 offset) 14 { 15 return readl((base + (offset >> 2))); 16 } 17 18 static inline void 19 malidp_write32(u32 __iomem *base, u32 offset, u32 v) 20 { 21 writel(v, (base + (offset >> 2))); 22 } 23 24 static inline void 25 malidp_write32_mask(u32 __iomem *base, u32 offset, u32 m, u32 v) 26 { 27 u32 tmp = malidp_read32(base, offset); 28 29 tmp &= (~m); 30 malidp_write32(base, offset, v | tmp); 31 } 32 33 static inline void 34 malidp_write_group(u32 __iomem *base, u32 offset, int num, const u32 *values) 35 { 36 int i; 37 38 for (i = 0; i < num; i++) 39 malidp_write32(base, offset + i * 4, values[i]); 40 } 41 42 #endif /*_MALIDP_IO_H_*/ 43