aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Wu <david.wu@rock-chips.com>2018-05-15 07:48:19 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-17 06:40:12 -0400
commitb8281fa71de26a64b56259bd04d940b1830639a8 (patch)
treeed47cb817fac980b1b85b53e3f83b09f2b37b0da
parent67b8d5c7081221efa252e111cd52532ec6d4266f (diff)
PM / AVS: rockchip-io: add io selectors and supplies for PX30
This adds the necessary data for handling io voltage domains on 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. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--Documentation/devicetree/bindings/power/rockchip-io-domain.txt15
-rw-r--r--drivers/power/avs/rockchip-io-domain.c68
2 files changed, 83 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
index 4a4766e9c254..e66fd4eab71c 100644
--- a/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
+++ b/Documentation/devicetree/bindings/power/rockchip-io-domain.txt
@@ -31,6 +31,8 @@ SoC is on the same page.
31 31
32Required properties: 32Required properties:
33- compatible: should be one of: 33- compatible: should be one of:
34 - "rockchip,px30-io-voltage-domain" for px30
35 - "rockchip,px30-pmu-io-voltage-domain" for px30 pmu-domains
34 - "rockchip,rk3188-io-voltage-domain" for rk3188 36 - "rockchip,rk3188-io-voltage-domain" for rk3188
35 - "rockchip,rk3228-io-voltage-domain" for rk3228 37 - "rockchip,rk3228-io-voltage-domain" for rk3228
36 - "rockchip,rk3288-io-voltage-domain" for rk3288 38 - "rockchip,rk3288-io-voltage-domain" for rk3288
@@ -51,6 +53,19 @@ a phandle the relevant regulator. All specified supplies must be able
51to report their voltage. The IO Voltage Domain for any non-specified 53to report their voltage. The IO Voltage Domain for any non-specified
52supplies will be not be touched. 54supplies will be not be touched.
53 55
56Possible supplies for PX30:
57- vccio6-supply: The supply connected to VCCIO6.
58- vccio1-supply: The supply connected to VCCIO1.
59- vccio2-supply: The supply connected to VCCIO2.
60- vccio3-supply: The supply connected to VCCIO3.
61- vccio4-supply: The supply connected to VCCIO4.
62- vccio5-supply: The supply connected to VCCIO5.
63- vccio-oscgpi-supply: The supply connected to VCCIO_OSCGPI.
64
65Possible supplies for PX30 pmu-domains:
66- pmuio1-supply: The supply connected to PMUIO1.
67- pmuio2-supply: The supply connected to PMUIO2.
68
54Possible supplies for rk3188: 69Possible supplies for rk3188:
55- ap0-supply: The supply connected to AP0_VCC. 70- ap0-supply: The supply connected to AP0_VCC.
56- ap1-supply: The supply connected to AP1_VCC. 71- ap1-supply: The supply connected to AP1_VCC.
diff --git a/drivers/power/avs/rockchip-io-domain.c b/drivers/power/avs/rockchip-io-domain.c
index ed2b109ae8fc..d6a5e6bf5f12 100644
--- a/drivers/power/avs/rockchip-io-domain.c
+++ b/drivers/power/avs/rockchip-io-domain.c
@@ -39,6 +39,10 @@
39#define MAX_VOLTAGE_1_8 1980000 39#define MAX_VOLTAGE_1_8 1980000
40#define MAX_VOLTAGE_3_3 3600000 40#define MAX_VOLTAGE_3_3 3600000
41 41
42#define PX30_IO_VSEL 0x180
43#define PX30_IO_VSEL_VCCIO6_SRC BIT(0)
44#define PX30_IO_VSEL_VCCIO6_SUPPLY_NUM 1
45
42#define RK3288_SOC_CON2 0x24c 46#define RK3288_SOC_CON2 0x24c
43#define RK3288_SOC_CON2_FLASH0 BIT(7) 47#define RK3288_SOC_CON2_FLASH0 BIT(7)
44#define RK3288_SOC_FLASH_SUPPLY_NUM 2 48#define RK3288_SOC_FLASH_SUPPLY_NUM 2
@@ -151,6 +155,25 @@ static int rockchip_iodomain_notify(struct notifier_block *nb,
151 return NOTIFY_OK; 155 return NOTIFY_OK;
152} 156}
153 157
158static void px30_iodomain_init(struct rockchip_iodomain *iod)
159{
160 int ret;
161 u32 val;
162
163 /* if no VCCIO0 supply we should leave things alone */
164 if (!iod->supplies[PX30_IO_VSEL_VCCIO6_SUPPLY_NUM].reg)
165 return;
166
167 /*
168 * set vccio0 iodomain to also use this framework
169 * instead of a special gpio.
170 */
171 val = PX30_IO_VSEL_VCCIO6_SRC | (PX30_IO_VSEL_VCCIO6_SRC << 16);
172 ret = regmap_write(iod->grf, PX30_IO_VSEL, val);
173 if (ret < 0)
174 dev_warn(iod->dev, "couldn't update vccio0 ctrl\n");
175}
176
154static void rk3288_iodomain_init(struct rockchip_iodomain *iod) 177static void rk3288_iodomain_init(struct rockchip_iodomain *iod)
155{ 178{
156 int ret; 179 int ret;
@@ -227,6 +250,43 @@ static void rk3399_pmu_iodomain_init(struct rockchip_iodomain *iod)
227 dev_warn(iod->dev, "couldn't update pmu io iodomain ctrl\n"); 250 dev_warn(iod->dev, "couldn't update pmu io iodomain ctrl\n");
228} 251}
229 252
253static const struct rockchip_iodomain_soc_data soc_data_px30 = {
254 .grf_offset = 0x180,
255 .supply_names = {
256 NULL,
257 "vccio6",
258 "vccio1",
259 "vccio2",
260 "vccio3",
261 "vccio4",
262 "vccio5",
263 "vccio-oscgpi",
264 },
265 .init = px30_iodomain_init,
266};
267
268static const struct rockchip_iodomain_soc_data soc_data_px30_pmu = {
269 .grf_offset = 0x100,
270 .supply_names = {
271 NULL,
272 NULL,
273 NULL,
274 NULL,
275 NULL,
276 NULL,
277 NULL,
278 NULL,
279 NULL,
280 NULL,
281 NULL,
282 NULL,
283 NULL,
284 NULL,
285 "pmuio1",
286 "pmuio2",
287 },
288};
289
230/* 290/*
231 * On the rk3188 the io-domains are handled by a shared register with the 291 * On the rk3188 the io-domains are handled by a shared register with the
232 * lower 8 bits being still being continuing drive-strength settings. 292 * lower 8 bits being still being continuing drive-strength settings.
@@ -381,6 +441,14 @@ static const struct rockchip_iodomain_soc_data soc_data_rv1108_pmu = {
381 441
382static const struct of_device_id rockchip_iodomain_match[] = { 442static const struct of_device_id rockchip_iodomain_match[] = {
383 { 443 {
444 .compatible = "rockchip,px30-io-voltage-domain",
445 .data = (void *)&soc_data_px30
446 },
447 {
448 .compatible = "rockchip,px30-pmu-io-voltage-domain",
449 .data = (void *)&soc_data_px30_pmu
450 },
451 {
384 .compatible = "rockchip,rk3188-io-voltage-domain", 452 .compatible = "rockchip,rk3188-io-voltage-domain",
385 .data = &soc_data_rk3188 453 .data = &soc_data_rk3188
386 }, 454 },