xref: /freebsd/sys/dev/iicbus/pmic/rockchip/rk817reg.h (revision 38a52bd3)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBS
3  *
4  * Copyright (c) 2021, 2022 Soren Schmidt <sos@deepcore.dk>
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  *    notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25  * SUCH DAMAGE.
26  *
27  */
28 
29 
30 #ifndef _RK817REG_H_
31 #define	_RK817REG_H_
32 
33 #define	RK817_RTC_SECONDS	0x00
34 #define	 RK817_RTC_SECONDS_MASK	0x7f
35 #define	RK817_RTC_MINUTES	0x01
36 #define	 RK817_RTC_MINUTES_MASK	0x7f
37 #define	RK817_RTC_HOURS		0x02
38 #define	 RK817_RTC_HOURS_MASK	0x3f
39 #define	RK817_RTC_DAYS		0x03
40 #define	 RK817_RTC_DAYS_MASK	0x3f
41 #define	RK817_RTC_MONTHS	0x04
42 #define	 RK817_RTC_MONTHS_MASK	0x1f
43 #define	RK817_RTC_YEARS		0x05
44 #define	RK817_RTC_WEEKS		0x06
45 #define	 RK817_RTC_WEEKS_MASK	0x07
46 #define	RK817_ALARM_SECONDS	0x7
47 #define	RK817_ALARM_MINUTES	0x8
48 #define	RK817_ALARM_HOURS	0x9
49 #define	RK817_ALARM_DAYS	0xA
50 #define	RK817_ALARM_MONTHS	0xB
51 #define	RK817_ALARM_YEARS	0xC
52 #define	RK817_RTC_CTRL		0x0d
53 #define	 RK817_RTC_CTRL_STOP	(1 << 0)
54 #define	 RK817_RTC_AMPM_MODE	(1 << 3)
55 #define	 RK817_RTC_GET_TIME	(1 << 6)
56 #define	 RK817_RTC_READSEL	(1 << 7)
57 #define	RK817_RTC_STATUS	0x0e
58 #define	RK817_RTC_INT		0x0f
59 #define	RK817_RTC_COMP_LSB	0x10
60 #define	RK817_RTC_COMP_MSB	0x11
61 
62 #define	RK817_DCDC_EN		0xb1
63 #define	RK817_LDO_EN1		0xb2
64 #define	RK817_LDO_EN2		0xb3
65 #define	RK817_LDO_EN3		0xb4
66 #define	RK817_DCDC1_ON_VSEL	0xbb
67 #define	RK817_DCDC2_ON_VSEL	0xbe
68 #define	RK817_DCDC3_ON_VSEL	0xc1
69 #define	RK817_DCDC4_ON_VSEL	0xc4
70 #define	RK817_LDO1_ON_VSEL	0xcc
71 #define	RK817_LDO2_ON_VSEL	0xce
72 #define	RK817_LDO3_ON_VSEL	0xd0
73 #define	RK817_LDO4_ON_VSEL	0xd2
74 #define	RK817_LDO5_ON_VSEL	0xd4
75 #define	RK817_LDO6_ON_VSEL	0xd6
76 #define	RK817_LDO7_ON_VSEL	0xd8
77 #define	RK817_LDO8_ON_VSEL	0xda
78 #define	RK817_LDO9_ON_VSEL	0xdc
79 #define	RK817_BOOST_ON_VSEL	0xde
80 #define	RK817_SYS_CFG3		0xf4
81 #define	 RK817_SYS_CFG3_OFF	(1 << 0)
82 #define	 RK817_SYS_CFG3_SLP	(1 << 1)
83 #define	 RK817_SYS_CFG3_RST	(1 << 2)
84 
85 enum rk809_regulator {
86 	RK809_DCDC1 = 0,
87 	RK809_DCDC2,
88 	RK809_DCDC3,
89 	RK809_DCDC4,
90 	RK809_DCDC5,
91 	RK809_LDO1,
92 	RK809_LDO2,
93 	RK809_LDO3,
94 	RK809_LDO4,
95 	RK809_LDO5,
96 	RK809_LDO6,
97 	RK809_LDO7,
98 	RK809_LDO8,
99 	RK809_LDO9,
100 	RK809_SWITCH1,
101 	RK809_SWITCH2,
102 };
103 
104 enum rk817_regulator {
105 	RK817_DCDC1 = 0,
106 	RK817_DCDC2,
107 	RK817_DCDC3,
108 	RK817_DCDC4,
109 	RK817_LDO1,
110 	RK817_LDO2,
111 	RK817_LDO3,
112 	RK817_LDO4,
113 	RK817_LDO5,
114 	RK817_LDO6,
115 	RK817_LDO7,
116 	RK817_LDO8,
117 	RK817_LDO9,
118 	RK817_BOOST,
119 	RK817_OTG_SWITCH,
120 };
121 #endif /* _RK817REG_H_ */
122