Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754262AbbLDPAq (ORCPT ); Fri, 4 Dec 2015 10:00:46 -0500 Received: from hqemgate15.nvidia.com ([216.228.121.64]:5585 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754110AbbLDPAn (ORCPT ); Fri, 4 Dec 2015 10:00:43 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Fri, 04 Dec 2015 06:47:21 -0800 From: Jon Hunter To: Philipp Zabel , Stephen Warren , Thierry Reding , Alexandre Courbot , Rafael Wysocki , Kevin Hilman , Ulf Hansson , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala CC: Vince Hsu , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, Jon Hunter Subject: [PATCH V4 09/16] soc: tegra: pmc: Ensure partitions can be toggled on/off by PMC Date: Fri, 4 Dec 2015 14:57:10 +0000 Message-ID: <1449241037-22193-10-git-send-email-jonathanh@nvidia.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1449241037-22193-1-git-send-email-jonathanh@nvidia.com> References: <1449241037-22193-1-git-send-email-jonathanh@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2728 Lines: 85 For Tegra124 and Tegra210, the GPU partition cannot be toggled on and off via the APBDEV_PMC_PWRGATE_TOGGLE_0 register. For these devices, the partition is simply powered up and down via an external regulator. Describe in the PMC SoC data in which devices the GPU partition can be controlled via the APBDEV_PMC_PWRGATE_TOGGLE_0 register and ensure that no one can incorrectly try to toggle the GPU partition via the APBDEV_PMC_PWRGATE_TOGGLE_0 register. Signed-off-by: Jon Hunter --- drivers/soc/tegra/pmc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c index 0967bba13947..b412098b8197 100644 --- a/drivers/soc/tegra/pmc.c +++ b/drivers/soc/tegra/pmc.c @@ -113,6 +113,7 @@ struct tegra_pmc_soc { bool has_tsense_reset; bool has_gpu_clamps; + bool has_gpu_toggle; }; /** @@ -190,6 +191,9 @@ static int tegra_powergate_set(int id, bool new_state) u32 status; int err = 0; + if (id == TEGRA_POWERGATE_3D && !pmc->soc->has_gpu_toggle) + return -EINVAL; + mutex_lock(&pmc->powergates_lock); status = tegra_pmc_readl(PWRGATE_STATUS); @@ -246,6 +250,9 @@ int tegra_powergate_is_powered(int id) if (!PMC_PWRGATE_IS_VALID(id)) return -EINVAL; + if (id == TEGRA_POWERGATE_3D && !pmc->soc->has_gpu_toggle) + return -EINVAL; + status = tegra_pmc_readl(PWRGATE_STATUS); return PMC_PWRGATE_STATE(status, id); @@ -929,6 +936,7 @@ static const struct tegra_pmc_soc tegra30_pmc_soc = { .cpu_powergates = tegra30_cpu_powergates, .has_tsense_reset = true, .has_gpu_clamps = false, + .has_gpu_toggle = true, }; static const char * const tegra114_powergates[] = { @@ -966,6 +974,7 @@ static const struct tegra_pmc_soc tegra114_pmc_soc = { .cpu_powergates = tegra114_cpu_powergates, .has_tsense_reset = true, .has_gpu_clamps = false, + .has_gpu_toggle = true, }; static const char * const tegra124_powergates[] = { @@ -1009,6 +1018,7 @@ static const struct tegra_pmc_soc tegra124_pmc_soc = { .cpu_powergates = tegra124_cpu_powergates, .has_tsense_reset = true, .has_gpu_clamps = true, + .has_gpu_toggle = false, }; static const char * const tegra210_powergates[] = { @@ -1052,6 +1062,7 @@ static const struct tegra_pmc_soc tegra210_pmc_soc = { .cpu_powergates = tegra210_cpu_powergates, .has_tsense_reset = true, .has_gpu_clamps = true, + .has_gpu_toggle = false, }; static const struct of_device_id tegra_pmc_match[] = { -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/