Skip to content

Commit 34217df

Browse files
xdarklightkhilman
authored andcommitted
soc: amlogic: meson-ee-pwrc: add support for Meson8/Meson8b/Meson8m2
This adds support for the power domains on Meson8/Meson8b/Meson8m2. Meson8 doesn't use any reset lines while Meson8b and Meson8m2 use the same set of reset lines (which is different from the newer SoCs). Add dedicated compatible strings for Meson8, Meson8b and Meson8m2 to support these differences. Notable differences between Meson8 and G12A are: - there is no HHI_VPU_MEM_PD_REG2 on the 32-bit SoCs - the Meson8b datasheet describes an "audio DSP memory" power domain which is used for the hardware audio decoder - the "amlogic,ao-sysctrl" only includes the power management related registers on the 32-bit SoCs, meaning the for example the AO_RTI_GEN_PWR_SLEEP0 register is at offset (0x2 << 2) rather than (0x3a << 2). As result of this (0x38 << 2) is subtracted from the register offsets, which is the start of the power management related registers. Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Kevin Hilman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cc9ca02 commit 34217df

File tree

1 file changed

+77
-9
lines changed

1 file changed

+77
-9
lines changed

drivers/soc/amlogic/meson-ee-pwrc.c

Lines changed: 77 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@
1414
#include <linux/reset-controller.h>
1515
#include <linux/reset.h>
1616
#include <linux/clk.h>
17+
#include <dt-bindings/power/meson8-power.h>
1718
#include <dt-bindings/power/meson-g12a-power.h>
1819
#include <dt-bindings/power/meson-sm1-power.h>
1920

2021
/* AO Offsets */
2122

22-
#define AO_RTI_GEN_PWR_SLEEP0 (0x3a << 2)
23-
#define AO_RTI_GEN_PWR_ISO0 (0x3b << 2)
23+
#define GX_AO_RTI_GEN_PWR_SLEEP0 (0x3a << 2)
24+
#define GX_AO_RTI_GEN_PWR_ISO0 (0x3b << 2)
25+
26+
/*
27+
* Meson8/Meson8b/Meson8m2 only expose the power management registers of the
28+
* AO-bus as syscon. 0x3a from GX translates to 0x02, 0x3b translates to 0x03
29+
* and so on.
30+
*/
31+
#define MESON8_AO_RTI_GEN_PWR_SLEEP0 (0x02 << 2)
32+
#define MESON8_AO_RTI_GEN_PWR_ISO0 (0x03 << 2)
2433

2534
/* HHI Offsets */
2635

@@ -67,17 +76,24 @@ struct meson_ee_pwrc_domain_data {
6776
/* TOP Power Domains */
6877

6978
static struct meson_ee_pwrc_top_domain g12a_pwrc_vpu = {
70-
.sleep_reg = AO_RTI_GEN_PWR_SLEEP0,
79+
.sleep_reg = GX_AO_RTI_GEN_PWR_SLEEP0,
80+
.sleep_mask = BIT(8),
81+
.iso_reg = GX_AO_RTI_GEN_PWR_SLEEP0,
82+
.iso_mask = BIT(9),
83+
};
84+
85+
static struct meson_ee_pwrc_top_domain meson8_pwrc_vpu = {
86+
.sleep_reg = MESON8_AO_RTI_GEN_PWR_SLEEP0,
7187
.sleep_mask = BIT(8),
72-
.iso_reg = AO_RTI_GEN_PWR_SLEEP0,
88+
.iso_reg = MESON8_AO_RTI_GEN_PWR_SLEEP0,
7389
.iso_mask = BIT(9),
7490
};
7591

7692
#define SM1_EE_PD(__bit) \
7793
{ \
78-
.sleep_reg = AO_RTI_GEN_PWR_SLEEP0, \
94+
.sleep_reg = GX_AO_RTI_GEN_PWR_SLEEP0, \
7995
.sleep_mask = BIT(__bit), \
80-
.iso_reg = AO_RTI_GEN_PWR_ISO0, \
96+
.iso_reg = GX_AO_RTI_GEN_PWR_ISO0, \
8197
.iso_mask = BIT(__bit), \
8298
}
8399

@@ -124,10 +140,20 @@ static struct meson_ee_pwrc_mem_domain g12a_pwrc_mem_vpu[] = {
124140
VPU_HHI_MEMPD(HHI_MEM_PD_REG0),
125141
};
126142

127-
static struct meson_ee_pwrc_mem_domain g12a_pwrc_mem_eth[] = {
143+
static struct meson_ee_pwrc_mem_domain meson_pwrc_mem_eth[] = {
128144
{ HHI_MEM_PD_REG0, GENMASK(3, 2) },
129145
};
130146

147+
static struct meson_ee_pwrc_mem_domain meson8_pwrc_audio_dsp_mem[] = {
148+
{ HHI_MEM_PD_REG0, GENMASK(1, 0) },
149+
};
150+
151+
static struct meson_ee_pwrc_mem_domain meson8_pwrc_mem_vpu[] = {
152+
VPU_MEMPD(HHI_VPU_MEM_PD_REG0),
153+
VPU_MEMPD(HHI_VPU_MEM_PD_REG1),
154+
VPU_HHI_MEMPD(HHI_MEM_PD_REG0),
155+
};
156+
131157
static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_vpu[] = {
132158
VPU_MEMPD(HHI_VPU_MEM_PD_REG0),
133159
VPU_MEMPD(HHI_VPU_MEM_PD_REG1),
@@ -201,7 +227,27 @@ static bool pwrc_ee_get_power(struct meson_ee_pwrc_domain *pwrc_domain);
201227
static struct meson_ee_pwrc_domain_desc g12a_pwrc_domains[] = {
202228
[PWRC_G12A_VPU_ID] = VPU_PD("VPU", &g12a_pwrc_vpu, g12a_pwrc_mem_vpu,
203229
pwrc_ee_get_power, 11, 2),
204-
[PWRC_G12A_ETH_ID] = MEM_PD("ETH", g12a_pwrc_mem_eth),
230+
[PWRC_G12A_ETH_ID] = MEM_PD("ETH", meson_pwrc_mem_eth),
231+
};
232+
233+
static struct meson_ee_pwrc_domain_desc meson8_pwrc_domains[] = {
234+
[PWRC_MESON8_VPU_ID] = VPU_PD("VPU", &meson8_pwrc_vpu,
235+
meson8_pwrc_mem_vpu, pwrc_ee_get_power,
236+
0, 1),
237+
[PWRC_MESON8_ETHERNET_MEM_ID] = MEM_PD("ETHERNET_MEM",
238+
meson_pwrc_mem_eth),
239+
[PWRC_MESON8_AUDIO_DSP_MEM_ID] = MEM_PD("AUDIO_DSP_MEM",
240+
meson8_pwrc_audio_dsp_mem),
241+
};
242+
243+
static struct meson_ee_pwrc_domain_desc meson8b_pwrc_domains[] = {
244+
[PWRC_MESON8_VPU_ID] = VPU_PD("VPU", &meson8_pwrc_vpu,
245+
meson8_pwrc_mem_vpu, pwrc_ee_get_power,
246+
11, 1),
247+
[PWRC_MESON8_ETHERNET_MEM_ID] = MEM_PD("ETHERNET_MEM",
248+
meson_pwrc_mem_eth),
249+
[PWRC_MESON8_AUDIO_DSP_MEM_ID] = MEM_PD("AUDIO_DSP_MEM",
250+
meson8_pwrc_audio_dsp_mem),
205251
};
206252

207253
static struct meson_ee_pwrc_domain_desc sm1_pwrc_domains[] = {
@@ -216,7 +262,7 @@ static struct meson_ee_pwrc_domain_desc sm1_pwrc_domains[] = {
216262
[PWRC_SM1_GE2D_ID] = TOP_PD("GE2D", &sm1_pwrc_ge2d, sm1_pwrc_mem_ge2d,
217263
pwrc_ee_get_power),
218264
[PWRC_SM1_AUDIO_ID] = MEM_PD("AUDIO", sm1_pwrc_mem_audio),
219-
[PWRC_SM1_ETH_ID] = MEM_PD("ETH", g12a_pwrc_mem_eth),
265+
[PWRC_SM1_ETH_ID] = MEM_PD("ETH", meson_pwrc_mem_eth),
220266
};
221267

222268
struct meson_ee_pwrc_domain {
@@ -470,12 +516,34 @@ static struct meson_ee_pwrc_domain_data meson_ee_g12a_pwrc_data = {
470516
.domains = g12a_pwrc_domains,
471517
};
472518

519+
static struct meson_ee_pwrc_domain_data meson_ee_m8_pwrc_data = {
520+
.count = ARRAY_SIZE(meson8_pwrc_domains),
521+
.domains = meson8_pwrc_domains,
522+
};
523+
524+
static struct meson_ee_pwrc_domain_data meson_ee_m8b_pwrc_data = {
525+
.count = ARRAY_SIZE(meson8b_pwrc_domains),
526+
.domains = meson8b_pwrc_domains,
527+
};
528+
473529
static struct meson_ee_pwrc_domain_data meson_ee_sm1_pwrc_data = {
474530
.count = ARRAY_SIZE(sm1_pwrc_domains),
475531
.domains = sm1_pwrc_domains,
476532
};
477533

478534
static const struct of_device_id meson_ee_pwrc_match_table[] = {
535+
{
536+
.compatible = "amlogic,meson8-pwrc",
537+
.data = &meson_ee_m8_pwrc_data,
538+
},
539+
{
540+
.compatible = "amlogic,meson8b-pwrc",
541+
.data = &meson_ee_m8b_pwrc_data,
542+
},
543+
{
544+
.compatible = "amlogic,meson8m2-pwrc",
545+
.data = &meson_ee_m8b_pwrc_data,
546+
},
479547
{
480548
.compatible = "amlogic,meson-g12a-pwrc",
481549
.data = &meson_ee_g12a_pwrc_data,

0 commit comments

Comments
 (0)