Skip to content

Commit 1f232f6

Browse files
Caesar-githubrkhuangtao
authored andcommitted
soc/rockchip: support the power domains for rk3036 SoCs
The rk3036 SoCs have some domains with NOC idle function, but it can't turn the power domain off. This patch supports it to handle some devices for needing. Change-Id: I515f2cea07f1af1777bb877a5f396fd21caba3ad Signed-off-by: Caesar Wang <wxt@rock-chips.com>
1 parent 9c51095 commit 1f232f6

2 files changed

Lines changed: 60 additions & 0 deletions

File tree

drivers/soc/rockchip/pm_domains.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/clk.h>
2020
#include <linux/regmap.h>
2121
#include <linux/mfd/syscon.h>
22+
#include <dt-bindings/power/rk3036-power.h>
2223
#include <dt-bindings/power/rk3128-power.h>
2324
#include <dt-bindings/power/rk3288-power.h>
2425
#include <dt-bindings/power/rk3328-power.h>
@@ -109,6 +110,15 @@ static struct rockchip_pmu *dmc_pmu;
109110
.active_wakeup = wakeup, \
110111
}
111112

113+
#define DOMAIN_RK3036(req, ack, idle, wakeup) \
114+
{ \
115+
.req_mask = (req >= 0) ? BIT(req) : 0, \
116+
.req_w_mask = (req >= 0) ? BIT(req + 16) : 0, \
117+
.ack_mask = (ack >= 0) ? BIT(ack) : 0, \
118+
.idle_mask = (idle >= 0) ? BIT(idle) : 0, \
119+
.active_wakeup = wakeup, \
120+
}
121+
112122
#define DOMAIN_RK3288(pwr, status, req, wakeup) \
113123
DOMAIN(pwr, status, req, req, (req) + 16, wakeup)
114124

@@ -754,6 +764,16 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
754764
return error;
755765
}
756766

767+
static const struct rockchip_domain_info rk3036_pm_domains[] = {
768+
[RK3036_PD_MSCH] = DOMAIN_RK3036(14, 23, 30, true),
769+
[RK3036_PD_CORE] = DOMAIN_RK3036(13, 17, 24, false),
770+
[RK3036_PD_PERI] = DOMAIN_RK3036(12, 18, 25, false),
771+
[RK3036_PD_VIO] = DOMAIN_RK3036(11, 19, 26, false),
772+
[RK3036_PD_VPU] = DOMAIN_RK3036(10, 20, 27, false),
773+
[RK3036_PD_GPU] = DOMAIN_RK3036(9, 21, 28, false),
774+
[RK3036_PD_SYS] = DOMAIN_RK3036(8, 22, 29, false),
775+
};
776+
757777
static const struct rockchip_domain_info rk3128_pm_domains[] = {
758778
[RK3128_PD_CORE] = DOMAIN_RK3288(0, 0, 4, false),
759779
[RK3128_PD_MSCH] = DOMAIN_RK3288(-1, -1, 6, true),
@@ -829,6 +849,15 @@ static const struct rockchip_domain_info rk3399_pm_domains[] = {
829849
[RK3399_PD_SDIOAUDIO] = DOMAIN_RK3399(31, 31, 29, true),
830850
};
831851

852+
static const struct rockchip_pmu_info rk3036_pmu = {
853+
.req_offset = 0x148,
854+
.idle_offset = 0x14c,
855+
.ack_offset = 0x14c,
856+
857+
.num_domains = ARRAY_SIZE(rk3036_pm_domains),
858+
.domain_info = rk3036_pm_domains,
859+
};
860+
832861
static const struct rockchip_pmu_info rk3128_pmu = {
833862
.pwr_offset = 0x04,
834863
.status_offset = 0x08,
@@ -918,6 +947,10 @@ static const struct rockchip_pmu_info rk3399_pmu = {
918947
};
919948

920949
static const struct of_device_id rockchip_pm_domain_dt_match[] = {
950+
{
951+
.compatible = "rockchip,rk3036-power-controller",
952+
.data = (void *)&rk3036_pmu,
953+
},
921954
{
922955
.compatible = "rockchip,rk3128-power-controller",
923956
.data = (void *)&rk3128_pmu,
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
* Copyright (c) 2017 Rockchip Electronics Co. Ltd.
3+
* Author: Caesar Wang <wxt@rock-chips.com>
4+
*
5+
* This program is free software; you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation; either version 2 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*/
15+
16+
#ifndef __DT_BINDINGS_POWER_RK3036_POWER_H__
17+
#define __DT_BINDINGS_POWER_RK3036_POWER_H__
18+
19+
#define RK3036_PD_MSCH 0
20+
#define RK3036_PD_CORE 1
21+
#define RK3036_PD_PERI 2
22+
#define RK3036_PD_VIO 3
23+
#define RK3036_PD_VPU 4
24+
#define RK3036_PD_GPU 5
25+
#define RK3036_PD_SYS 6
26+
27+
#endif

0 commit comments

Comments
 (0)