Skip to content

Commit 93f9fb1

Browse files
committed
Merge tag 'amlogic-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic into arm/drivers
soc: amlogic: driver updates for v5.8 - support GX SoCs in the EE power-controller driver * tag 'amlogic-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/khilman/linux-amlogic: soc: amlogic: meson-ee-pwrc: add support for the Meson GX SoCs soc: amlogic: meson-ee-pwrc: add support for Meson8/Meson8b/Meson8m2 dt-bindings: power: meson-ee-pwrc: add support for the Meson GX SoCs dt-bindings: power: meson-ee-pwrc: add support for Meson8/8b/8m2 Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 6d83d80 + 53773f2 commit 93f9fb1

File tree

4 files changed

+214
-26
lines changed

4 files changed

+214
-26
lines changed

Documentation/devicetree/bindings/power/amlogic,meson-ee-pwrc.yaml

Lines changed: 87 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,31 @@ description: |+
2323
properties:
2424
compatible:
2525
enum:
26+
- amlogic,meson8-pwrc
27+
- amlogic,meson8b-pwrc
28+
- amlogic,meson8m2-pwrc
29+
- amlogic,meson-gxbb-pwrc
2630
- amlogic,meson-g12a-pwrc
2731
- amlogic,meson-sm1-pwrc
2832

2933
clocks:
30-
minItems: 2
34+
minItems: 1
35+
maxItems: 2
3136

3237
clock-names:
38+
minItems: 1
39+
maxItems: 2
3340
items:
3441
- const: vpu
3542
- const: vapb
3643

3744
resets:
3845
minItems: 11
46+
maxItems: 12
3947

4048
reset-names:
41-
items:
42-
- const: viu
43-
- const: venc
44-
- const: vcbus
45-
- const: bt656
46-
- const: rdma
47-
- const: venci
48-
- const: vencp
49-
- const: vdac
50-
- const: vdi6
51-
- const: vencl
52-
- const: vid_lock
49+
minItems: 11
50+
maxItems: 12
5351

5452
"#power-domain-cells":
5553
const: 1
@@ -59,12 +57,86 @@ properties:
5957
allOf:
6058
- $ref: /schemas/types.yaml#/definitions/phandle
6159

60+
allOf:
61+
- if:
62+
properties:
63+
compatible:
64+
enum:
65+
- amlogic,meson8b-pwrc
66+
- amlogic,meson8m2-pwrc
67+
then:
68+
properties:
69+
reset-names:
70+
items:
71+
- const: dblk
72+
- const: pic_dc
73+
- const: hdmi_apb
74+
- const: hdmi_system
75+
- const: venci
76+
- const: vencp
77+
- const: vdac
78+
- const: vencl
79+
- const: viu
80+
- const: venc
81+
- const: rdma
82+
required:
83+
- resets
84+
- reset-names
85+
86+
- if:
87+
properties:
88+
compatible:
89+
enum:
90+
- amlogic,meson-gxbb-pwrc
91+
then:
92+
properties:
93+
reset-names:
94+
items:
95+
- const: viu
96+
- const: venc
97+
- const: vcbus
98+
- const: bt656
99+
- const: dvin
100+
- const: rdma
101+
- const: venci
102+
- const: vencp
103+
- const: vdac
104+
- const: vdi6
105+
- const: vencl
106+
- const: vid_lock
107+
required:
108+
- resets
109+
- reset-names
110+
111+
- if:
112+
properties:
113+
compatible:
114+
enum:
115+
- amlogic,meson-g12a-pwrc
116+
- amlogic,meson-sm1-pwrc
117+
then:
118+
properties:
119+
reset-names:
120+
items:
121+
- const: viu
122+
- const: venc
123+
- const: vcbus
124+
- const: bt656
125+
- const: rdma
126+
- const: venci
127+
- const: vencp
128+
- const: vdac
129+
- const: vdi6
130+
- const: vencl
131+
- const: vid_lock
132+
required:
133+
- resets
134+
- reset-names
135+
62136
required:
63137
- compatible
64138
- clocks
65139
- clock-names
66-
- resets
67-
- reset-names
68140
- "#power-domain-cells"
69141
- amlogic,ao-sysctrl
70142

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

Lines changed: 101 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,23 @@
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>
19+
#include <dt-bindings/power/meson-gxbb-power.h>
1820
#include <dt-bindings/power/meson-sm1-power.h>
1921

2022
/* AO Offsets */
2123

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)
2434

2535
/* HHI Offsets */
2636

@@ -66,18 +76,25 @@ struct meson_ee_pwrc_domain_data {
6676

6777
/* TOP Power Domains */
6878

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,
7188
.sleep_mask = BIT(8),
72-
.iso_reg = AO_RTI_GEN_PWR_SLEEP0,
89+
.iso_reg = MESON8_AO_RTI_GEN_PWR_SLEEP0,
7390
.iso_mask = BIT(9),
7491
};
7592

7693
#define SM1_EE_PD(__bit) \
7794
{ \
78-
.sleep_reg = AO_RTI_GEN_PWR_SLEEP0, \
95+
.sleep_reg = GX_AO_RTI_GEN_PWR_SLEEP0, \
7996
.sleep_mask = BIT(__bit), \
80-
.iso_reg = AO_RTI_GEN_PWR_ISO0, \
97+
.iso_reg = GX_AO_RTI_GEN_PWR_ISO0, \
8198
.iso_mask = BIT(__bit), \
8299
}
83100

@@ -124,10 +141,26 @@ static struct meson_ee_pwrc_mem_domain g12a_pwrc_mem_vpu[] = {
124141
VPU_HHI_MEMPD(HHI_MEM_PD_REG0),
125142
};
126143

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[] = {
128151
{ HHI_MEM_PD_REG0, GENMASK(3, 2) },
129152
};
130153

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+
131164
static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_vpu[] = {
132165
VPU_MEMPD(HHI_VPU_MEM_PD_REG0),
133166
VPU_MEMPD(HHI_VPU_MEM_PD_REG1),
@@ -199,9 +232,35 @@ static struct meson_ee_pwrc_mem_domain sm1_pwrc_mem_audio[] = {
199232
static bool pwrc_ee_get_power(struct meson_ee_pwrc_domain *pwrc_domain);
200233

201234
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,
203236
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),
205264
};
206265

207266
static struct meson_ee_pwrc_domain_desc sm1_pwrc_domains[] = {
@@ -216,7 +275,7 @@ static struct meson_ee_pwrc_domain_desc sm1_pwrc_domains[] = {
216275
[PWRC_SM1_GE2D_ID] = TOP_PD("GE2D", &sm1_pwrc_ge2d, sm1_pwrc_mem_ge2d,
217276
pwrc_ee_get_power),
218277
[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),
220279
};
221280

222281
struct meson_ee_pwrc_domain {
@@ -470,12 +529,43 @@ static struct meson_ee_pwrc_domain_data meson_ee_g12a_pwrc_data = {
470529
.domains = g12a_pwrc_domains,
471530
};
472531

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+
473547
static struct meson_ee_pwrc_domain_data meson_ee_sm1_pwrc_data = {
474548
.count = ARRAY_SIZE(sm1_pwrc_domains),
475549
.domains = sm1_pwrc_domains,
476550
};
477551

478552
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+
},
479569
{
480570
.compatible = "amlogic,meson-g12a-pwrc",
481571
.data = &meson_ee_g12a_pwrc_data,
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */
2+
/*
3+
* Copyright (c) 2019 BayLibre, SAS
4+
* Author: Neil Armstrong <[email protected]>
5+
*/
6+
7+
#ifndef _DT_BINDINGS_MESON_GXBB_POWER_H
8+
#define _DT_BINDINGS_MESON_GXBB_POWER_H
9+
10+
#define PWRC_GXBB_VPU_ID 0
11+
#define PWRC_GXBB_ETHERNET_MEM_ID 1
12+
13+
#endif
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/* SPDX-License-Identifier: (GPL-2.0+ or MIT) */
2+
/*
3+
* Copyright (c) 2019 Martin Blumenstingl <[email protected]>
4+
*/
5+
6+
#ifndef _DT_BINDINGS_MESON8_POWER_H
7+
#define _DT_BINDINGS_MESON8_POWER_H
8+
9+
#define PWRC_MESON8_VPU_ID 0
10+
#define PWRC_MESON8_ETHERNET_MEM_ID 1
11+
#define PWRC_MESON8_AUDIO_DSP_MEM_ID 2
12+
13+
#endif /* _DT_BINDINGS_MESON8_POWER_H */

0 commit comments

Comments
 (0)