aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko@sntech.de>2015-08-04 15:37:01 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-08-07 21:07:52 -0400
commit3fc147e9156f6c176e5543c59d31182252f14933 (patch)
tree3ae696762708c5fac34b256af95cfd05ff7dc1e5
parent28c1f1628ee4b163e615eefe1b6463e3d229a873 (diff)
PM / AVS: rockchip-io: add io selectors and supplies for rk3368
This adds the necessary data for handling io voltage domains on the rk3368. As interesting tidbit, the rk3368 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: Heiko Stuebner <heiko@sntech.de> Acked-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--Documentation/devicetree/bindings/power/rockchip-io-domain.txt14
-rw-r--r--drivers/power/avs/rockchip-io-domain.c59
2 files changed, 73 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
index 8b70db103ca7..b8627e763dba 100644
--- a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
+++ b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
@@ -33,6 +33,8 @@ Required properties:
33- compatible: should be one of: 33- compatible: should be one of:
34 - "rockchip,rk3188-io-voltage-domain" for rk3188 34 - "rockchip,rk3188-io-voltage-domain" for rk3188
35 - "rockchip,rk3288-io-voltage-domain" for rk3288 35 - "rockchip,rk3288-io-voltage-domain" for rk3288
36 - "rockchip,rk3368-io-voltage-domain" for rk3368
37 - "rockchip,rk3368-pmu-io-voltage-domain" for rk3368 pmu-domains
36- rockchip,grf: phandle to the syscon managing the "general register files" 38- rockchip,grf: phandle to the syscon managing the "general register files"
37 39
38 40
@@ -64,6 +66,18 @@ Possible supplies for rk3288:
64- sdcard-supply: The supply connected to SDMMC0_VDD. 66- sdcard-supply: The supply connected to SDMMC0_VDD.
65- wifi-supply: The supply connected to APIO3_VDD. Also known as SDIO0. 67- wifi-supply: The supply connected to APIO3_VDD. Also known as SDIO0.
66 68
69Possible supplies for rk3368:
70- audio-supply: The supply connected to APIO3_VDD.
71- dvp-supply: The supply connected to DVPIO_VDD.
72- flash0-supply: The supply connected to FLASH0_VDD. Typically for eMMC
73- gpio30-supply: The supply connected to APIO1_VDD.
74- gpio1830 The supply connected to APIO4_VDD.
75- sdcard-supply: The supply connected to SDMMC0_VDD.
76- wifi-supply: The supply connected to APIO2_VDD. Also known as SDIO0.
77
78Possible supplies for rk3368 pmu-domains:
79- pmu-supply: The supply connected to PMUIO_VDD.
80- vop-supply: The supply connected to LCDC_VDD.
67 81
68Example: 82Example:
69 83
diff --git a/drivers/power/avs/rockchip-io-domain.c b/drivers/power/avs/rockchip-io-domain.c
index 3ae35d0590d2..2e300028f0f7 100644
--- a/drivers/power/avs/rockchip-io-domain.c
+++ b/drivers/power/avs/rockchip-io-domain.c
@@ -43,6 +43,10 @@
43#define RK3288_SOC_CON2_FLASH0 BIT(7) 43#define RK3288_SOC_CON2_FLASH0 BIT(7)
44#define RK3288_SOC_FLASH_SUPPLY_NUM 2 44#define RK3288_SOC_FLASH_SUPPLY_NUM 2
45 45
46#define RK3368_SOC_CON15 0x43c
47#define RK3368_SOC_CON15_FLASH0 BIT(14)
48#define RK3368_SOC_FLASH_SUPPLY_NUM 2
49
46struct rockchip_iodomain; 50struct rockchip_iodomain;
47 51
48/** 52/**
@@ -158,6 +162,25 @@ static void rk3288_iodomain_init(struct rockchip_iodomain *iod)
158 dev_warn(iod->dev, "couldn't update flash0 ctrl\n"); 162 dev_warn(iod->dev, "couldn't update flash0 ctrl\n");
159} 163}
160 164
165static void rk3368_iodomain_init(struct rockchip_iodomain *iod)
166{
167 int ret;
168 u32 val;
169
170 /* if no flash supply we should leave things alone */
171 if (!iod->supplies[RK3368_SOC_FLASH_SUPPLY_NUM].reg)
172 return;
173
174 /*
175 * set flash0 iodomain to also use this framework
176 * instead of a special gpio.
177 */
178 val = RK3368_SOC_CON15_FLASH0 | (RK3368_SOC_CON15_FLASH0 << 16);
179 ret = regmap_write(iod->grf, RK3368_SOC_CON15, val);
180 if (ret < 0)
181 dev_warn(iod->dev, "couldn't update flash0 ctrl\n");
182}
183
161/* 184/*
162 * On the rk3188 the io-domains are handled by a shared register with the 185 * On the rk3188 the io-domains are handled by a shared register with the
163 * lower 8 bits being still being continuing drive-strength settings. 186 * lower 8 bits being still being continuing drive-strength settings.
@@ -201,6 +224,34 @@ static const struct rockchip_iodomain_soc_data soc_data_rk3288 = {
201 .init = rk3288_iodomain_init, 224 .init = rk3288_iodomain_init,
202}; 225};
203 226
227static const struct rockchip_iodomain_soc_data soc_data_rk3368 = {
228 .grf_offset = 0x900,
229 .supply_names = {
230 NULL, /* reserved */
231 "dvp", /* DVPIO_VDD */
232 "flash0", /* FLASH0_VDD (emmc) */
233 "wifi", /* APIO2_VDD (sdio0) */
234 NULL,
235 "audio", /* APIO3_VDD */
236 "sdcard", /* SDMMC0_VDD (sdmmc) */
237 "gpio30", /* APIO1_VDD */
238 "gpio1830", /* APIO4_VDD (gpujtag) */
239 },
240 .init = rk3368_iodomain_init,
241};
242
243static const struct rockchip_iodomain_soc_data soc_data_rk3368_pmu = {
244 .grf_offset = 0x100,
245 .supply_names = {
246 NULL,
247 NULL,
248 NULL,
249 NULL,
250 "pmu", /*PMU IO domain*/
251 "vop", /*LCDC IO domain*/
252 },
253};
254
204static const struct of_device_id rockchip_iodomain_match[] = { 255static const struct of_device_id rockchip_iodomain_match[] = {
205 { 256 {
206 .compatible = "rockchip,rk3188-io-voltage-domain", 257 .compatible = "rockchip,rk3188-io-voltage-domain",
@@ -210,6 +261,14 @@ static const struct of_device_id rockchip_iodomain_match[] = {
210 .compatible = "rockchip,rk3288-io-voltage-domain", 261 .compatible = "rockchip,rk3288-io-voltage-domain",
211 .data = (void *)&soc_data_rk3288 262 .data = (void *)&soc_data_rk3288
212 }, 263 },
264 {
265 .compatible = "rockchip,rk3368-io-voltage-domain",
266 .data = (void *)&soc_data_rk3368
267 },
268 {
269 .compatible = "rockchip,rk3368-pmu-io-voltage-domain",
270 .data = (void *)&soc_data_rk3368_pmu
271 },
213 { /* sentinel */ }, 272 { /* sentinel */ },
214}; 273};
215 274