Skip to content

Commit b8281fa

Browse files
SuperDavidWurafaeljw
authored andcommitted
PM / AVS: rockchip-io: add io selectors and supplies for PX30
This adds the necessary data for handling io voltage domains on PX30. As interesting tidbit, the PX30 contains two separate iodomain areas. One in the regular General Register Files (GRF) and one in PMUGRF in the pmu power domain. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 67b8d5c commit b8281fa

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

Documentation/devicetree/bindings/power/rockchip-io-domain.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ SoC is on the same page.
3131

3232
Required properties:
3333
- compatible: should be one of:
34+
- "rockchip,px30-io-voltage-domain" for px30
35+
- "rockchip,px30-pmu-io-voltage-domain" for px30 pmu-domains
3436
- "rockchip,rk3188-io-voltage-domain" for rk3188
3537
- "rockchip,rk3228-io-voltage-domain" for rk3228
3638
- "rockchip,rk3288-io-voltage-domain" for rk3288
@@ -51,6 +53,19 @@ a phandle the relevant regulator. All specified supplies must be able
5153
to report their voltage. The IO Voltage Domain for any non-specified
5254
supplies will be not be touched.
5355

56+
Possible supplies for PX30:
57+
- vccio6-supply: The supply connected to VCCIO6.
58+
- vccio1-supply: The supply connected to VCCIO1.
59+
- vccio2-supply: The supply connected to VCCIO2.
60+
- vccio3-supply: The supply connected to VCCIO3.
61+
- vccio4-supply: The supply connected to VCCIO4.
62+
- vccio5-supply: The supply connected to VCCIO5.
63+
- vccio-oscgpi-supply: The supply connected to VCCIO_OSCGPI.
64+
65+
Possible supplies for PX30 pmu-domains:
66+
- pmuio1-supply: The supply connected to PMUIO1.
67+
- pmuio2-supply: The supply connected to PMUIO2.
68+
5469
Possible supplies for rk3188:
5570
- ap0-supply: The supply connected to AP0_VCC.
5671
- ap1-supply: The supply connected to AP1_VCC.

drivers/power/avs/rockchip-io-domain.c

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
#define MAX_VOLTAGE_1_8 1980000
4040
#define MAX_VOLTAGE_3_3 3600000
4141

42+
#define PX30_IO_VSEL 0x180
43+
#define PX30_IO_VSEL_VCCIO6_SRC BIT(0)
44+
#define PX30_IO_VSEL_VCCIO6_SUPPLY_NUM 1
45+
4246
#define RK3288_SOC_CON2 0x24c
4347
#define RK3288_SOC_CON2_FLASH0 BIT(7)
4448
#define RK3288_SOC_FLASH_SUPPLY_NUM 2
@@ -151,6 +155,25 @@ static int rockchip_iodomain_notify(struct notifier_block *nb,
151155
return NOTIFY_OK;
152156
}
153157

158+
static void px30_iodomain_init(struct rockchip_iodomain *iod)
159+
{
160+
int ret;
161+
u32 val;
162+
163+
/* if no VCCIO0 supply we should leave things alone */
164+
if (!iod->supplies[PX30_IO_VSEL_VCCIO6_SUPPLY_NUM].reg)
165+
return;
166+
167+
/*
168+
* set vccio0 iodomain to also use this framework
169+
* instead of a special gpio.
170+
*/
171+
val = PX30_IO_VSEL_VCCIO6_SRC | (PX30_IO_VSEL_VCCIO6_SRC << 16);
172+
ret = regmap_write(iod->grf, PX30_IO_VSEL, val);
173+
if (ret < 0)
174+
dev_warn(iod->dev, "couldn't update vccio0 ctrl\n");
175+
}
176+
154177
static void rk3288_iodomain_init(struct rockchip_iodomain *iod)
155178
{
156179
int ret;
@@ -227,6 +250,43 @@ static void rk3399_pmu_iodomain_init(struct rockchip_iodomain *iod)
227250
dev_warn(iod->dev, "couldn't update pmu io iodomain ctrl\n");
228251
}
229252

253+
static const struct rockchip_iodomain_soc_data soc_data_px30 = {
254+
.grf_offset = 0x180,
255+
.supply_names = {
256+
NULL,
257+
"vccio6",
258+
"vccio1",
259+
"vccio2",
260+
"vccio3",
261+
"vccio4",
262+
"vccio5",
263+
"vccio-oscgpi",
264+
},
265+
.init = px30_iodomain_init,
266+
};
267+
268+
static const struct rockchip_iodomain_soc_data soc_data_px30_pmu = {
269+
.grf_offset = 0x100,
270+
.supply_names = {
271+
NULL,
272+
NULL,
273+
NULL,
274+
NULL,
275+
NULL,
276+
NULL,
277+
NULL,
278+
NULL,
279+
NULL,
280+
NULL,
281+
NULL,
282+
NULL,
283+
NULL,
284+
NULL,
285+
"pmuio1",
286+
"pmuio2",
287+
},
288+
};
289+
230290
/*
231291
* On the rk3188 the io-domains are handled by a shared register with the
232292
* lower 8 bits being still being continuing drive-strength settings.
@@ -380,6 +440,14 @@ static const struct rockchip_iodomain_soc_data soc_data_rv1108_pmu = {
380440
};
381441

382442
static const struct of_device_id rockchip_iodomain_match[] = {
443+
{
444+
.compatible = "rockchip,px30-io-voltage-domain",
445+
.data = (void *)&soc_data_px30
446+
},
447+
{
448+
.compatible = "rockchip,px30-pmu-io-voltage-domain",
449+
.data = (void *)&soc_data_px30_pmu
450+
},
383451
{
384452
.compatible = "rockchip,rk3188-io-voltage-domain",
385453
.data = &soc_data_rk3188

0 commit comments

Comments
 (0)