14
14
#include <linux/reset-controller.h>
15
15
#include <linux/reset.h>
16
16
#include <linux/clk.h>
17
+ #include <dt-bindings/power/meson8-power.h>
17
18
#include <dt-bindings/power/meson-g12a-power.h>
19
+ #include <dt-bindings/power/meson-gxbb-power.h>
18
20
#include <dt-bindings/power/meson-sm1-power.h>
19
21
20
22
/* AO Offsets */
21
23
22
- #define AO_RTI_GEN_PWR_SLEEP0 (0x3a << 2)
23
- #define AO_RTI_GEN_PWR_ISO0 (0x3b << 2)
24
+ #define GX_AO_RTI_GEN_PWR_SLEEP0 (0x3a << 2)
25
+ #define GX_AO_RTI_GEN_PWR_ISO0 (0x3b << 2)
26
+
27
+ /*
28
+ * Meson8/Meson8b/Meson8m2 only expose the power management registers of the
29
+ * AO-bus as syscon. 0x3a from GX translates to 0x02, 0x3b translates to 0x03
30
+ * and so on.
31
+ */
32
+ #define MESON8_AO_RTI_GEN_PWR_SLEEP0 (0x02 << 2)
33
+ #define MESON8_AO_RTI_GEN_PWR_ISO0 (0x03 << 2)
24
34
25
35
/* HHI Offsets */
26
36
@@ -66,18 +76,25 @@ struct meson_ee_pwrc_domain_data {
66
76
67
77
/* TOP Power Domains */
68
78
69
- static struct meson_ee_pwrc_top_domain g12a_pwrc_vpu = {
70
- .sleep_reg = AO_RTI_GEN_PWR_SLEEP0 ,
79
+ static struct meson_ee_pwrc_top_domain gx_pwrc_vpu = {
80
+ .sleep_reg = GX_AO_RTI_GEN_PWR_SLEEP0 ,
81
+ .sleep_mask = BIT (8 ),
82
+ .iso_reg = GX_AO_RTI_GEN_PWR_SLEEP0 ,
83
+ .iso_mask = BIT (9 ),
84
+ };
85
+
86
+ static struct meson_ee_pwrc_top_domain meson8_pwrc_vpu = {
87
+ .sleep_reg = MESON8_AO_RTI_GEN_PWR_SLEEP0 ,
71
88
.sleep_mask = BIT (8 ),
72
- .iso_reg = AO_RTI_GEN_PWR_SLEEP0 ,
89
+ .iso_reg = MESON8_AO_RTI_GEN_PWR_SLEEP0 ,
73
90
.iso_mask = BIT (9 ),
74
91
};
75
92
76
93
#define SM1_EE_PD (__bit ) \
77
94
{ \
78
- .sleep_reg = AO_RTI_GEN_PWR_SLEEP0 , \
95
+ .sleep_reg = GX_AO_RTI_GEN_PWR_SLEEP0 , \
79
96
.sleep_mask = BIT(__bit), \
80
- .iso_reg = AO_RTI_GEN_PWR_ISO0 , \
97
+ .iso_reg = GX_AO_RTI_GEN_PWR_ISO0 , \
81
98
.iso_mask = BIT(__bit), \
82
99
}
83
100
@@ -124,10 +141,26 @@ static struct meson_ee_pwrc_mem_domain g12a_pwrc_mem_vpu[] = {
124
141
VPU_HHI_MEMPD (HHI_MEM_PD_REG0 ),
125
142
};
126
143
127
- static struct meson_ee_pwrc_mem_domain g12a_pwrc_mem_eth [] = {
144
+ static struct meson_ee_pwrc_mem_domain gxbb_pwrc_mem_vpu [] = {
145
+ VPU_MEMPD (HHI_VPU_MEM_PD_REG0 ),
146
+ VPU_MEMPD (HHI_VPU_MEM_PD_REG1 ),
147
+ VPU_HHI_MEMPD (HHI_MEM_PD_REG0 ),
148
+ };
149
+
150
+ static struct meson_ee_pwrc_mem_domain meson_pwrc_mem_eth [] = {
128
151
{ HHI_MEM_PD_REG0 , GENMASK (3 , 2 ) },
129
152
};
130
153
154
+ static struct meson_ee_pwrc_mem_domain meson8_pwrc_audio_dsp_mem [] = {
155
+ { HHI_MEM_PD_REG0 , GENMASK (1 , 0 ) },
156
+ };
157
+
158
+ static struct meson_ee_pwrc_mem_domain meson8_pwrc_mem_vpu [] = {
159
+ VPU_MEMPD (HHI_VPU_MEM_PD_REG0 ),
160
+ VPU_MEMPD (HHI_VPU_MEM_PD_REG1 ),
161
+ VPU_HHI_MEMPD (HHI_MEM_PD_REG0 ),
162
+ };
163
+
131
164
static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_vpu [] = {
132
165
VPU_MEMPD (HHI_VPU_MEM_PD_REG0 ),
133
166
VPU_MEMPD (HHI_VPU_MEM_PD_REG1 ),
@@ -199,9 +232,35 @@ static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_audio[] = {
199
232
static bool pwrc_ee_get_power (struct meson_ee_pwrc_domain * pwrc_domain );
200
233
201
234
static struct meson_ee_pwrc_domain_desc g12a_pwrc_domains [] = {
202
- [PWRC_G12A_VPU_ID ] = VPU_PD ("VPU" , & g12a_pwrc_vpu , g12a_pwrc_mem_vpu ,
235
+ [PWRC_G12A_VPU_ID ] = VPU_PD ("VPU" , & gx_pwrc_vpu , g12a_pwrc_mem_vpu ,
203
236
pwrc_ee_get_power , 11 , 2 ),
204
- [PWRC_G12A_ETH_ID ] = MEM_PD ("ETH" , g12a_pwrc_mem_eth ),
237
+ [PWRC_G12A_ETH_ID ] = MEM_PD ("ETH" , meson_pwrc_mem_eth ),
238
+ };
239
+
240
+ static struct meson_ee_pwrc_domain_desc gxbb_pwrc_domains [] = {
241
+ [PWRC_GXBB_VPU_ID ] = VPU_PD ("VPU" , & gx_pwrc_vpu , gxbb_pwrc_mem_vpu ,
242
+ pwrc_ee_get_power , 12 , 2 ),
243
+ [PWRC_GXBB_ETHERNET_MEM_ID ] = MEM_PD ("ETH" , meson_pwrc_mem_eth ),
244
+ };
245
+
246
+ static struct meson_ee_pwrc_domain_desc meson8_pwrc_domains [] = {
247
+ [PWRC_MESON8_VPU_ID ] = VPU_PD ("VPU" , & meson8_pwrc_vpu ,
248
+ meson8_pwrc_mem_vpu , pwrc_ee_get_power ,
249
+ 0 , 1 ),
250
+ [PWRC_MESON8_ETHERNET_MEM_ID ] = MEM_PD ("ETHERNET_MEM" ,
251
+ meson_pwrc_mem_eth ),
252
+ [PWRC_MESON8_AUDIO_DSP_MEM_ID ] = MEM_PD ("AUDIO_DSP_MEM" ,
253
+ meson8_pwrc_audio_dsp_mem ),
254
+ };
255
+
256
+ static struct meson_ee_pwrc_domain_desc meson8b_pwrc_domains [] = {
257
+ [PWRC_MESON8_VPU_ID ] = VPU_PD ("VPU" , & meson8_pwrc_vpu ,
258
+ meson8_pwrc_mem_vpu , pwrc_ee_get_power ,
259
+ 11 , 1 ),
260
+ [PWRC_MESON8_ETHERNET_MEM_ID ] = MEM_PD ("ETHERNET_MEM" ,
261
+ meson_pwrc_mem_eth ),
262
+ [PWRC_MESON8_AUDIO_DSP_MEM_ID ] = MEM_PD ("AUDIO_DSP_MEM" ,
263
+ meson8_pwrc_audio_dsp_mem ),
205
264
};
206
265
207
266
static struct meson_ee_pwrc_domain_desc sm1_pwrc_domains [] = {
@@ -216,7 +275,7 @@ static struct meson_ee_pwrc_domain_desc sm1_pwrc_domains[] = {
216
275
[PWRC_SM1_GE2D_ID ] = TOP_PD ("GE2D" , & sm1_pwrc_ge2d , sm1_pwrc_mem_ge2d ,
217
276
pwrc_ee_get_power ),
218
277
[PWRC_SM1_AUDIO_ID ] = MEM_PD ("AUDIO" , sm1_pwrc_mem_audio ),
219
- [PWRC_SM1_ETH_ID ] = MEM_PD ("ETH" , g12a_pwrc_mem_eth ),
278
+ [PWRC_SM1_ETH_ID ] = MEM_PD ("ETH" , meson_pwrc_mem_eth ),
220
279
};
221
280
222
281
struct meson_ee_pwrc_domain {
@@ -470,12 +529,43 @@ static struct meson_ee_pwrc_domain_data meson_ee_g12a_pwrc_data = {
470
529
.domains = g12a_pwrc_domains ,
471
530
};
472
531
532
+ static struct meson_ee_pwrc_domain_data meson_ee_gxbb_pwrc_data = {
533
+ .count = ARRAY_SIZE (gxbb_pwrc_domains ),
534
+ .domains = gxbb_pwrc_domains ,
535
+ };
536
+
537
+ static struct meson_ee_pwrc_domain_data meson_ee_m8_pwrc_data = {
538
+ .count = ARRAY_SIZE (meson8_pwrc_domains ),
539
+ .domains = meson8_pwrc_domains ,
540
+ };
541
+
542
+ static struct meson_ee_pwrc_domain_data meson_ee_m8b_pwrc_data = {
543
+ .count = ARRAY_SIZE (meson8b_pwrc_domains ),
544
+ .domains = meson8b_pwrc_domains ,
545
+ };
546
+
473
547
static struct meson_ee_pwrc_domain_data meson_ee_sm1_pwrc_data = {
474
548
.count = ARRAY_SIZE (sm1_pwrc_domains ),
475
549
.domains = sm1_pwrc_domains ,
476
550
};
477
551
478
552
static const struct of_device_id meson_ee_pwrc_match_table [] = {
553
+ {
554
+ .compatible = "amlogic,meson8-pwrc" ,
555
+ .data = & meson_ee_m8_pwrc_data ,
556
+ },
557
+ {
558
+ .compatible = "amlogic,meson8b-pwrc" ,
559
+ .data = & meson_ee_m8b_pwrc_data ,
560
+ },
561
+ {
562
+ .compatible = "amlogic,meson8m2-pwrc" ,
563
+ .data = & meson_ee_m8b_pwrc_data ,
564
+ },
565
+ {
566
+ .compatible = "amlogic,meson-gxbb-pwrc" ,
567
+ .data = & meson_ee_gxbb_pwrc_data ,
568
+ },
479
569
{
480
570
.compatible = "amlogic,meson-g12a-pwrc" ,
481
571
.data = & meson_ee_g12a_pwrc_data ,
0 commit comments