Skip to content

Commit 6a8aaf5

Browse files
committed
PM / AVS: rockchip-io: add io selectors and supplies for px30
This adds the necessary data for handling io voltage domains on the 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. Change-Id: Icff058b310e8ffaa4e03b8090443b3a7dba35f1f Signed-off-by: David Wu <david.wu@rock-chips.com>
1 parent 921a4f7 commit 6a8aaf5

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

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

Lines changed: 2 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,rk322x-io-voltage-domain" for rk3228
3638
- "rockchip,rk3288-io-voltage-domain" for rk3288

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_VCCIO0_SRC BIT(0)
44+
#define PX30_IO_VSEL_VCCIO0_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
@@ -155,6 +159,25 @@ static int rockchip_iodomain_notify(struct notifier_block *nb,
155159
return NOTIFY_OK;
156160
}
157161

162+
static void px30_iodomain_init(struct rockchip_iodomain *iod)
163+
{
164+
int ret;
165+
u32 val;
166+
167+
/* if no VCCIO0 supply we should leave things alone */
168+
if (!iod->supplies[PX30_IO_VSEL_VCCIO0_SUPPLY_NUM].reg)
169+
return;
170+
171+
/*
172+
* set vccio0 iodomain to also use this framework
173+
* instead of a special gpio.
174+
*/
175+
val = PX30_IO_VSEL_VCCIO0_SRC | (PX30_IO_VSEL_VCCIO0_SRC << 16);
176+
ret = regmap_write(iod->grf, PX30_IO_VSEL, val);
177+
if (ret < 0)
178+
dev_warn(iod->dev, "couldn't update vccio0 ctrl\n");
179+
}
180+
158181
static void rk3288_iodomain_init(struct rockchip_iodomain *iod)
159182
{
160183
int ret;
@@ -250,6 +273,43 @@ static void rk3399_pmu_iodomain_init(struct rockchip_iodomain *iod)
250273
dev_warn(iod->dev, "couldn't update pmu io iodomain ctrl\n");
251274
}
252275

276+
static const struct rockchip_iodomain_soc_data soc_data_px30 = {
277+
.grf_offset = 0x180,
278+
.supply_names = {
279+
NULL,
280+
"vccio0",
281+
"vccio1",
282+
"vccio2",
283+
"vccio3",
284+
"vccio4",
285+
"vccio5",
286+
"vccio_oscgpi",
287+
},
288+
.init = px30_iodomain_init,
289+
};
290+
291+
static const struct rockchip_iodomain_soc_data soc_data_px30_pmu = {
292+
.grf_offset = 0x100,
293+
.supply_names = {
294+
NULL,
295+
NULL,
296+
NULL,
297+
NULL,
298+
NULL,
299+
NULL,
300+
NULL,
301+
NULL,
302+
NULL,
303+
NULL,
304+
NULL,
305+
NULL,
306+
NULL,
307+
NULL,
308+
"pmuio1",
309+
"pmuio2",
310+
},
311+
};
312+
253313
/*
254314
* On the rk3188 the io-domains are handled by a shared register with the
255315
* lower 8 bits being still being continuing drive-strength settings.
@@ -388,6 +448,14 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = {
388448
};
389449

390450
static const struct of_device_id rockchip_iodomain_match[] = {
451+
{
452+
.compatible = "rockchip,px30-io-voltage-domain",
453+
.data = (void *)&soc_data_px30
454+
},
455+
{
456+
.compatible = "rockchip,px30-pmu-io-voltage-domain",
457+
.data = (void *)&soc_data_px30_pmu
458+
},
391459
{
392460
.compatible = "rockchip,rk3188-io-voltage-domain",
393461
.data = (void *)&soc_data_rk3188

0 commit comments

Comments
 (0)