Merge tag 'riscv-for-linus-4.15-rc2_cleanups' of git://git.kernel.org/pub/scm/linux...
[linux/fpc-iii.git] / drivers / soc / zte / zx296718_pm_domains.c
blob4dc5d62ee81b1674088a8df2da3600310c0cd7a0
1 /*
2 * Copyright (C) 2017 ZTE Ltd.
4 * Author: Baoyou Xie <baoyou.xie@linaro.org>
5 * License terms: GNU General Public License (GPL) version 2
6 */
8 #include <dt-bindings/soc/zte,pm_domains.h>
9 #include "zx2967_pm_domains.h"
11 static u16 zx296718_offsets[REG_ARRAY_SIZE] = {
12 [REG_CLKEN] = 0x18,
13 [REG_ISOEN] = 0x1c,
14 [REG_RSTEN] = 0x20,
15 [REG_PWREN] = 0x24,
16 [REG_ACK_SYNC] = 0x28,
19 enum {
20 PCU_DM_VOU = 0,
21 PCU_DM_SAPPU,
22 PCU_DM_VDE,
23 PCU_DM_VCE,
24 PCU_DM_HDE,
25 PCU_DM_VIU,
26 PCU_DM_USB20,
27 PCU_DM_USB21,
28 PCU_DM_USB30,
29 PCU_DM_HSIC,
30 PCU_DM_GMAC,
31 PCU_DM_TS,
34 static struct zx2967_pm_domain vou_domain = {
35 .dm = {
36 .name = "vou_domain",
38 .bit = PCU_DM_VOU,
39 .polarity = PWREN,
40 .reg_offset = zx296718_offsets,
43 static struct zx2967_pm_domain sappu_domain = {
44 .dm = {
45 .name = "sappu_domain",
47 .bit = PCU_DM_SAPPU,
48 .polarity = PWREN,
49 .reg_offset = zx296718_offsets,
52 static struct zx2967_pm_domain vde_domain = {
53 .dm = {
54 .name = "vde_domain",
56 .bit = PCU_DM_VDE,
57 .polarity = PWREN,
58 .reg_offset = zx296718_offsets,
61 static struct zx2967_pm_domain vce_domain = {
62 .dm = {
63 .name = "vce_domain",
65 .bit = PCU_DM_VCE,
66 .polarity = PWREN,
67 .reg_offset = zx296718_offsets,
70 static struct zx2967_pm_domain hde_domain = {
71 .dm = {
72 .name = "hde_domain",
74 .bit = PCU_DM_HDE,
75 .polarity = PWREN,
76 .reg_offset = zx296718_offsets,
79 static struct zx2967_pm_domain viu_domain = {
80 .dm = {
81 .name = "viu_domain",
83 .bit = PCU_DM_VIU,
84 .polarity = PWREN,
85 .reg_offset = zx296718_offsets,
88 static struct zx2967_pm_domain usb20_domain = {
89 .dm = {
90 .name = "usb20_domain",
92 .bit = PCU_DM_USB20,
93 .polarity = PWREN,
94 .reg_offset = zx296718_offsets,
97 static struct zx2967_pm_domain usb21_domain = {
98 .dm = {
99 .name = "usb21_domain",
101 .bit = PCU_DM_USB21,
102 .polarity = PWREN,
103 .reg_offset = zx296718_offsets,
106 static struct zx2967_pm_domain usb30_domain = {
107 .dm = {
108 .name = "usb30_domain",
110 .bit = PCU_DM_USB30,
111 .polarity = PWREN,
112 .reg_offset = zx296718_offsets,
115 static struct zx2967_pm_domain hsic_domain = {
116 .dm = {
117 .name = "hsic_domain",
119 .bit = PCU_DM_HSIC,
120 .polarity = PWREN,
121 .reg_offset = zx296718_offsets,
124 static struct zx2967_pm_domain gmac_domain = {
125 .dm = {
126 .name = "gmac_domain",
128 .bit = PCU_DM_GMAC,
129 .polarity = PWREN,
130 .reg_offset = zx296718_offsets,
133 static struct zx2967_pm_domain ts_domain = {
134 .dm = {
135 .name = "ts_domain",
137 .bit = PCU_DM_TS,
138 .polarity = PWREN,
139 .reg_offset = zx296718_offsets,
142 static struct generic_pm_domain *zx296718_pm_domains[] = {
143 [DM_ZX296718_VOU] = &vou_domain.dm,
144 [DM_ZX296718_SAPPU] = &sappu_domain.dm,
145 [DM_ZX296718_VDE] = &vde_domain.dm,
146 [DM_ZX296718_VCE] = &vce_domain.dm,
147 [DM_ZX296718_HDE] = &hde_domain.dm,
148 [DM_ZX296718_VIU] = &viu_domain.dm,
149 [DM_ZX296718_USB20] = &usb20_domain.dm,
150 [DM_ZX296718_USB21] = &usb21_domain.dm,
151 [DM_ZX296718_USB30] = &usb30_domain.dm,
152 [DM_ZX296718_HSIC] = &hsic_domain.dm,
153 [DM_ZX296718_GMAC] = &gmac_domain.dm,
154 [DM_ZX296718_TS] = &ts_domain.dm,
157 static int zx296718_pd_probe(struct platform_device *pdev)
159 return zx2967_pd_probe(pdev,
160 zx296718_pm_domains,
161 ARRAY_SIZE(zx296718_pm_domains));
164 static const struct of_device_id zx296718_pm_domain_matches[] = {
165 { .compatible = "zte,zx296718-pcu", },
166 { },
169 static struct platform_driver zx296718_pd_driver = {
170 .driver = {
171 .name = "zx296718-powerdomain",
172 .of_match_table = zx296718_pm_domain_matches,
174 .probe = zx296718_pd_probe,
177 static int __init zx296718_pd_init(void)
179 return platform_driver_register(&zx296718_pd_driver);
181 subsys_initcall(zx296718_pd_init);