Skip to content

Commit 49e6525

Browse files
finley1226rkhuangtao
authored andcommitted
soc: rockchip: pvtm: Add support for PX30 SoCs
This adds the necessary data for handling pvtm on the px30. Change-Id: Ida01e8363f8349c379e10d6a4637eb893591789d Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
1 parent adce2f1 commit 49e6525

2 files changed

Lines changed: 47 additions & 0 deletions

File tree

Documentation/devicetree/bindings/soc/rockchip/rockchip-pvtm.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ performance variance caused by chip process, voltage and temperature.
77

88
Required properties:
99
- compatible: Should be one of the following.
10+
- "rockchip,px30-pvtm" - for PX30 SoCs.
11+
- "rockchip,px30-pmu-pvtm" - for PX30 SoCs.
1012
- "rockchip,rk3288-pvtm" - for RK3288 SoCs.
1113
- "rockchip,rk3366-pvtm" - for RK3366 SoCs.
1214
- "rockchip,rk3366-pmu-pvtm" - for RK3366 SoCs.

drivers/soc/rockchip/rockchip_pvtm.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#include <linux/slab.h>
3030
#include <linux/soc/rockchip/pvtm.h>
3131

32+
#define PX30_PVTM_CORE 0
33+
#define PX30_PVTM_PMU 1
34+
3235
#define RK3288_PVTM_CORE 0
3336
#define RK3288_PVTM_GPU 1
3437

@@ -233,6 +236,15 @@ static void rockchip_pvtm_delay(unsigned int delay)
233236
udelay(us);
234237
}
235238

239+
static void px30_pvtm_set_ring_sel(struct rockchip_pvtm *pvtm,
240+
unsigned int sub_ch)
241+
{
242+
unsigned int ch = pvtm->channel->ch;
243+
244+
regmap_write(pvtm->grf, pvtm->con,
245+
wr_mask_bit(sub_ch, (ch * 0x4 + 0x2), 0x3));
246+
}
247+
236248
static void rk3399_pvtm_set_ring_sel(struct rockchip_pvtm *pvtm,
237249
unsigned int sub_ch)
238250
{
@@ -312,6 +324,31 @@ static u32 rockchip_pvtm_get_value(struct rockchip_pvtm *pvtm,
312324
return val;
313325
}
314326

327+
static const struct rockchip_pvtm_channel px30_pvtm_channels[] = {
328+
PVTM(PX30_PVTM_CORE, "core", 4, 0, 1, 0x4, 0, 0x4),
329+
};
330+
331+
static const struct rockchip_pvtm_info px30_pvtm = {
332+
.con = 0x80,
333+
.sta = 0x88,
334+
.num_channels = ARRAY_SIZE(px30_pvtm_channels),
335+
.channels = px30_pvtm_channels,
336+
.get_value = rockchip_pvtm_get_value,
337+
.set_ring_sel = px30_pvtm_set_ring_sel,
338+
};
339+
340+
static const struct rockchip_pvtm_channel px30_pmupvtm_channels[] = {
341+
PVTM(PX30_PVTM_PMU, "pmu", 1, 0, 1, 0x4, 0, 0x4),
342+
};
343+
344+
static const struct rockchip_pvtm_info px30_pmupvtm = {
345+
.con = 0x180,
346+
.sta = 0x190,
347+
.num_channels = ARRAY_SIZE(px30_pmupvtm_channels),
348+
.channels = px30_pmupvtm_channels,
349+
.get_value = rockchip_pvtm_get_value,
350+
};
351+
315352
static const struct rockchip_pvtm_channel rk3288_pvtm_channels[] = {
316353
PVTM(RK3288_PVTM_CORE, "core", 1, 0, 1, 0x4, 0, 0x4),
317354
PVTM(RK3288_PVTM_GPU, "gpu", 1, 8, 9, 0x8, 1, 0x8),
@@ -379,6 +416,14 @@ static const struct rockchip_pvtm_info rk3399_pmupvtm = {
379416
};
380417

381418
static const struct of_device_id rockchip_pvtm_match[] = {
419+
{
420+
.compatible = "rockchip,px30-pvtm",
421+
.data = (void *)&px30_pvtm,
422+
},
423+
{
424+
.compatible = "rockchip,px30-pmu-pvtm",
425+
.data = (void *)&px30_pmupvtm,
426+
},
382427
{
383428
.compatible = "rockchip,rk3288-pvtm",
384429
.data = (void *)&rk3288_pvtm,

0 commit comments

Comments
 (0)