aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorDavid Wu <david.wu@rock-chips.com>2016-03-15 14:45:26 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-23 17:10:15 -0400
commitf447671b9e4fa4b0c9faf39455269d62d94218ae (patch)
tree16a6e6129a665e53c3177bbaabe9eed8fd5d50e7 /drivers/power
parent277edbabf6fece057b14fb6db5e3a34e00f42f42 (diff)
PM / AVS: rockchip-io: add io selectors and supplies for rk3399
This adds the necessary data for handling io voltage domains on the rk3399. As interesting tidbit, the rk3399 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> Acked-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/power')
-rwxr-xr-x[-rw-r--r--]drivers/power/avs/rockchip-io-domain.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/drivers/power/avs/rockchip-io-domain.c b/drivers/power/avs/rockchip-io-domain.c
index 80994566a1c8..8986382718dd 100644..100755
--- a/drivers/power/avs/rockchip-io-domain.c
+++ b/drivers/power/avs/rockchip-io-domain.c
@@ -47,6 +47,10 @@
47#define RK3368_SOC_CON15_FLASH0 BIT(14) 47#define RK3368_SOC_CON15_FLASH0 BIT(14)
48#define RK3368_SOC_FLASH_SUPPLY_NUM 2 48#define RK3368_SOC_FLASH_SUPPLY_NUM 2
49 49
50#define RK3399_PMUGRF_CON0 0x180
51#define RK3399_PMUGRF_CON0_VSEL BIT(8)
52#define RK3399_PMUGRF_VSEL_SUPPLY_NUM 9
53
50struct rockchip_iodomain; 54struct rockchip_iodomain;
51 55
52/** 56/**
@@ -181,6 +185,25 @@ static void rk3368_iodomain_init(struct rockchip_iodomain *iod)
181 dev_warn(iod->dev, "couldn't update flash0 ctrl\n"); 185 dev_warn(iod->dev, "couldn't update flash0 ctrl\n");
182} 186}
183 187
188static void rk3399_pmu_iodomain_init(struct rockchip_iodomain *iod)
189{
190 int ret;
191 u32 val;
192
193 /* if no pmu io supply we should leave things alone */
194 if (!iod->supplies[RK3399_PMUGRF_VSEL_SUPPLY_NUM].reg)
195 return;
196
197 /*
198 * set pmu io iodomain to also use this framework
199 * instead of a special gpio.
200 */
201 val = RK3399_PMUGRF_CON0_VSEL | (RK3399_PMUGRF_CON0_VSEL << 16);
202 ret = regmap_write(iod->grf, RK3399_PMUGRF_CON0, val);
203 if (ret < 0)
204 dev_warn(iod->dev, "couldn't update pmu io iodomain ctrl\n");
205}
206
184/* 207/*
185 * On the rk3188 the io-domains are handled by a shared register with the 208 * On the rk3188 the io-domains are handled by a shared register with the
186 * lower 8 bits being still being continuing drive-strength settings. 209 * lower 8 bits being still being continuing drive-strength settings.
@@ -252,6 +275,33 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3368_pmu = {
252 }, 275 },
253}; 276};
254 277
278static const struct rockchip_iodomain_soc_data soc_data_rk3399 = {
279 .grf_offset = 0xe640,
280 .supply_names = {
281 "bt656", /* APIO2_VDD */
282 "audio", /* APIO5_VDD */
283 "sdmmc", /* SDMMC0_VDD */
284 "gpio1830", /* APIO4_VDD */
285 },
286};
287
288static const struct rockchip_iodomain_soc_data soc_data_rk3399_pmu = {
289 .grf_offset = 0x180,
290 .supply_names = {
291 NULL,
292 NULL,
293 NULL,
294 NULL,
295 NULL,
296 NULL,
297 NULL,
298 NULL,
299 NULL,
300 "pmu1830", /* PMUIO2_VDD */
301 },
302 .init = rk3399_pmu_iodomain_init,
303};
304
255static const struct of_device_id rockchip_iodomain_match[] = { 305static const struct of_device_id rockchip_iodomain_match[] = {
256 { 306 {
257 .compatible = "rockchip,rk3188-io-voltage-domain", 307 .compatible = "rockchip,rk3188-io-voltage-domain",
@@ -269,6 +319,14 @@ static const struct of_device_id rockchip_iodomain_match[] = {
269 .compatible = "rockchip,rk3368-pmu-io-voltage-domain", 319 .compatible = "rockchip,rk3368-pmu-io-voltage-domain",
270 .data = (void *)&soc_data_rk3368_pmu 320 .data = (void *)&soc_data_rk3368_pmu
271 }, 321 },
322 {
323 .compatible = "rockchip,rk3399-io-voltage-domain",
324 .data = (void *)&soc_data_rk3399
325 },
326 {
327 .compatible = "rockchip,rk3399-pmu-io-voltage-domain",
328 .data = (void *)&soc_data_rk3399_pmu
329 },
272 { /* sentinel */ }, 330 { /* sentinel */ },
273}; 331};
274MODULE_DEVICE_TABLE(of, rockchip_iodomain_match); 332MODULE_DEVICE_TABLE(of, rockchip_iodomain_match);