• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * linux-5.4/drivers/media/platform/sunxi-vin/utility/vin_io.h
3  *
4  * Copyright (c) 2007-2017 Allwinnertech Co., Ltd.
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16 
17 /*
18  ******************************************************************************
19  *
20  * vfe_io.h
21  *
22  * Hawkview ISP - vfe_io.h module
23  *
24  * Copyright (c) 2014 by Allwinnertech Co., Ltd.  http://www.allwinnertech.com
25  *
26  * Version      Author         Date      Description
27  *
28  *   2.0     Yang Feng    2014/07/14    Second Version
29  *
30  ******************************************************************************
31  */
32 
33 #ifndef _VFE_IO_H_
34 #define _VFE_IO_H_
35 
36 #include <linux/io.h>
37 #include <linux/types.h>
vin_reg_readl(volatile void __iomem * addr)38 static inline u32 vin_reg_readl(volatile void __iomem *addr)
39 {
40 	return readl(addr);
41 }
42 
vin_reg_writel(volatile void __iomem * addr,u32 reg_value)43 static inline void vin_reg_writel(volatile void __iomem *addr, u32 reg_value)
44 {
45 	writel(reg_value, addr);
46 }
47 
vin_reg_clr(volatile void __iomem * reg,u32 clr_bits)48 static inline void vin_reg_clr(volatile void __iomem *reg, u32 clr_bits)
49 {
50 	u32 v = vin_reg_readl(reg);
51 
52 	vin_reg_writel(reg, v & ~clr_bits);
53 }
54 
vin_reg_set(volatile void __iomem * reg,u32 set_bits)55 static inline void vin_reg_set(volatile void __iomem *reg, u32 set_bits)
56 {
57 	u32 v = vin_reg_readl(reg);
58 
59 	vin_reg_writel(reg, v | set_bits);
60 }
61 
62 /*
63  * clr_bits for mask
64  */
65 static inline
vin_reg_clr_set(volatile void __iomem * reg,u32 clr_bits,u32 set_bits)66 void vin_reg_clr_set(volatile void __iomem *reg, u32 clr_bits, u32 set_bits)
67 {
68 	u32 v = vin_reg_readl(reg);
69 
70 	vin_reg_writel(reg, (v & ~clr_bits) | (set_bits & clr_bits));
71 }
72 
73 #endif /*_VFE_IO_H_*/
74