| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2015-2017 Pengutronix, Lucas Stach <kernel@pengutronix.de> |
|---|
| 3 | 4 | * Copyright 2011-2013 Freescale Semiconductor, Inc. |
|---|
| 4 | | - * |
|---|
| 5 | | - * The code contained herein is licensed under the GNU General Public |
|---|
| 6 | | - * License. You may obtain a copy of the GNU General Public License |
|---|
| 7 | | - * Version 2 or later at the following locations: |
|---|
| 8 | | - * |
|---|
| 9 | | - * http://www.opensource.org/licenses/gpl-license.html |
|---|
| 10 | | - * http://www.gnu.org/copyleft/gpl.html |
|---|
| 11 | 5 | */ |
|---|
| 12 | 6 | |
|---|
| 13 | 7 | #include <linux/clk.h> |
|---|
| .. | .. |
|---|
| 41 | 35 | #define GPU_VPU_PUP_REQ BIT(1) |
|---|
| 42 | 36 | #define GPU_VPU_PDN_REQ BIT(0) |
|---|
| 43 | 37 | |
|---|
| 44 | | -#define GPC_CLK_MAX 6 |
|---|
| 38 | +#define GPC_CLK_MAX 7 |
|---|
| 45 | 39 | |
|---|
| 46 | 40 | #define PGC_DOMAIN_FLAG_NO_PD BIT(0) |
|---|
| 47 | 41 | |
|---|
| .. | .. |
|---|
| 248 | 242 | #define GPC_PGC_DOMAIN_ARM 0 |
|---|
| 249 | 243 | #define GPC_PGC_DOMAIN_PU 1 |
|---|
| 250 | 244 | #define GPC_PGC_DOMAIN_DISPLAY 2 |
|---|
| 245 | +#define GPC_PGC_DOMAIN_PCI 3 |
|---|
| 251 | 246 | |
|---|
| 252 | 247 | static struct genpd_power_state imx6_pm_domain_pu_state = { |
|---|
| 253 | 248 | .power_off_latency_ns = 25000, |
|---|
| .. | .. |
|---|
| 255 | 250 | }; |
|---|
| 256 | 251 | |
|---|
| 257 | 252 | static struct imx_pm_domain imx_gpc_domains[] = { |
|---|
| 258 | | - { |
|---|
| 253 | + [GPC_PGC_DOMAIN_ARM] = { |
|---|
| 259 | 254 | .base = { |
|---|
| 260 | 255 | .name = "ARM", |
|---|
| 261 | 256 | .flags = GENPD_FLAG_ALWAYS_ON, |
|---|
| 262 | 257 | }, |
|---|
| 263 | | - }, { |
|---|
| 258 | + }, |
|---|
| 259 | + [GPC_PGC_DOMAIN_PU] = { |
|---|
| 264 | 260 | .base = { |
|---|
| 265 | 261 | .name = "PU", |
|---|
| 266 | 262 | .power_off = imx6_pm_domain_power_off, |
|---|
| .. | .. |
|---|
| 270 | 266 | }, |
|---|
| 271 | 267 | .reg_offs = 0x260, |
|---|
| 272 | 268 | .cntr_pdn_bit = 0, |
|---|
| 273 | | - }, { |
|---|
| 269 | + }, |
|---|
| 270 | + [GPC_PGC_DOMAIN_DISPLAY] = { |
|---|
| 274 | 271 | .base = { |
|---|
| 275 | 272 | .name = "DISPLAY", |
|---|
| 276 | 273 | .power_off = imx6_pm_domain_power_off, |
|---|
| .. | .. |
|---|
| 278 | 275 | }, |
|---|
| 279 | 276 | .reg_offs = 0x240, |
|---|
| 280 | 277 | .cntr_pdn_bit = 4, |
|---|
| 281 | | - }, { |
|---|
| 278 | + }, |
|---|
| 279 | + [GPC_PGC_DOMAIN_PCI] = { |
|---|
| 282 | 280 | .base = { |
|---|
| 283 | 281 | .name = "PCI", |
|---|
| 284 | 282 | .power_off = imx6_pm_domain_power_off, |
|---|
| .. | .. |
|---|
| 350 | 348 | }; |
|---|
| 351 | 349 | |
|---|
| 352 | 350 | static struct generic_pm_domain *imx_gpc_onecell_domains[] = { |
|---|
| 353 | | - &imx_gpc_domains[0].base, |
|---|
| 354 | | - &imx_gpc_domains[1].base, |
|---|
| 351 | + &imx_gpc_domains[GPC_PGC_DOMAIN_ARM].base, |
|---|
| 352 | + &imx_gpc_domains[GPC_PGC_DOMAIN_PU].base, |
|---|
| 355 | 353 | }; |
|---|
| 356 | 354 | |
|---|
| 357 | 355 | static struct genpd_onecell_data imx_gpc_onecell_data = { |
|---|
| .. | .. |
|---|
| 410 | 408 | const struct imx_gpc_dt_data *of_id_data = of_id->data; |
|---|
| 411 | 409 | struct device_node *pgc_node; |
|---|
| 412 | 410 | struct regmap *regmap; |
|---|
| 413 | | - struct resource *res; |
|---|
| 414 | 411 | void __iomem *base; |
|---|
| 415 | 412 | int ret; |
|---|
| 416 | 413 | |
|---|
| .. | .. |
|---|
| 421 | 418 | !pgc_node) |
|---|
| 422 | 419 | return 0; |
|---|
| 423 | 420 | |
|---|
| 424 | | - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
|---|
| 425 | | - base = devm_ioremap_resource(&pdev->dev, res); |
|---|
| 421 | + base = devm_platform_ioremap_resource(pdev, 0); |
|---|
| 426 | 422 | if (IS_ERR(base)) |
|---|
| 427 | 423 | return PTR_ERR(base); |
|---|
| 428 | 424 | |
|---|
| .. | .. |
|---|
| 435 | 431 | return ret; |
|---|
| 436 | 432 | } |
|---|
| 437 | 433 | |
|---|
| 438 | | - /* Disable PU power down in normal operation if ERR009619 is present */ |
|---|
| 434 | + /* |
|---|
| 435 | + * Disable PU power down by runtime PM if ERR009619 is present. |
|---|
| 436 | + * |
|---|
| 437 | + * The PRE clock will be paused for several cycles when turning on the |
|---|
| 438 | + * PU domain LDO from power down state. If PRE is in use at that time, |
|---|
| 439 | + * the IPU/PRG cannot get the correct display data from the PRE. |
|---|
| 440 | + * |
|---|
| 441 | + * This is not a concern when the whole system enters suspend state, so |
|---|
| 442 | + * it's safe to power down PU in this case. |
|---|
| 443 | + */ |
|---|
| 439 | 444 | if (of_id_data->err009619_present) |
|---|
| 440 | 445 | imx_gpc_domains[GPC_PGC_DOMAIN_PU].base.flags |= |
|---|
| 441 | | - GENPD_FLAG_ALWAYS_ON; |
|---|
| 446 | + GENPD_FLAG_RPM_ALWAYS_ON; |
|---|
| 442 | 447 | |
|---|
| 443 | 448 | /* Keep DISP always on if ERR006287 is present */ |
|---|
| 444 | 449 | if (of_id_data->err006287_present) |
|---|