diff mbox

[v2,17/17] soc/tegra: remove lagacy powergate APIs

Message ID 1426162518-7405-18-git-send-email-vinceh@nvidia.com (mailing list archive)
State New, archived
Headers show

Commit Message

Vince Hsu March 12, 2015, 12:15 p.m. UTC
We switch to generic power domain now. So remove the legacy functions.

Signed-off-by: Vince Hsu <vinceh@nvidia.com>
---
 drivers/soc/tegra/pmc.c | 68 -------------------------------------------------
 include/soc/tegra/pmc.h | 22 ----------------
 2 files changed, 90 deletions(-)

Comments

Thierry Reding March 12, 2015, 12:45 p.m. UTC | #1
On Thu, Mar 12, 2015 at 08:15:18PM +0800, Vince Hsu wrote:
> We switch to generic power domain now. So remove the legacy functions.
> 
> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
> ---
>  drivers/soc/tegra/pmc.c | 68 -------------------------------------------------
>  include/soc/tegra/pmc.h | 22 ----------------
>  2 files changed, 90 deletions(-)

I don't think we can do this. What if somebody updates their kernel but
not the DTB? In that case they'll end up with drivers that don't enable
power partitions but at the same time the powergate driver won't enable
them either because it is missing the corresponding nodes in the DTB.

What we'll have to do is probably keep the code that enables the power
partitions and make it conditional on the power domains somehow. Is
there a way to determine at runtime whether a device has been attached
to a power domain?

Thierry
Vince Hsu March 12, 2015, 1:11 p.m. UTC | #2
Hi,

On 03/12/2015 08:45 PM, Thierry Reding wrote:
> * PGP Signed by an unknown key
>
> On Thu, Mar 12, 2015 at 08:15:18PM +0800, Vince Hsu wrote:
>> We switch to generic power domain now. So remove the legacy functions.
>>
>> Signed-off-by: Vince Hsu <vinceh@nvidia.com>
>> ---
>>   drivers/soc/tegra/pmc.c | 68 -------------------------------------------------
>>   include/soc/tegra/pmc.h | 22 ----------------
>>   2 files changed, 90 deletions(-)
> I don't think we can do this. What if somebody updates their kernel but
> not the DTB? In that case they'll end up with drivers that don't enable
> power partitions but at the same time the powergate driver won't enable
> them either because it is missing the corresponding nodes in the DTB.
You're right.

>
> What we'll have to do is probably keep the code that enables the power
> partitions and make it conditional on the power domains somehow. Is
> there a way to determine at runtime whether a device has been attached
> to a power domain?
>
Yes, we can check if a power domain is bound to the GPD by DT in the 
legacy powergate code.

Thanks,
Vince
Peter De Schrijver March 12, 2015, 4:18 p.m. UTC | #3
On Thu, Mar 12, 2015 at 01:45:02PM +0100, Thierry Reding wrote:
> * PGP Signed by an unknown key
> 
> On Thu, Mar 12, 2015 at 08:15:18PM +0800, Vince Hsu wrote:
> > We switch to generic power domain now. So remove the legacy functions.
> > 
> > Signed-off-by: Vince Hsu <vinceh@nvidia.com>
> > ---
> >  drivers/soc/tegra/pmc.c | 68 -------------------------------------------------
> >  include/soc/tegra/pmc.h | 22 ----------------
> >  2 files changed, 90 deletions(-)
> 
> I don't think we can do this. What if somebody updates their kernel but
> not the DTB? In that case they'll end up with drivers that don't enable
> power partitions but at the same time the powergate driver won't enable
> them either because it is missing the corresponding nodes in the DTB.
> 
> What we'll have to do is probably keep the code that enables the power
> partitions and make it conditional on the power domains somehow. Is
> there a way to determine at runtime whether a device has been attached
> to a power domain?

Or use DT overlays to 'load' a hardcoded overlay for the specific SoC?

Cheers,

Peter.
diff mbox

Patch

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index ed1ce06e3635..2fc32f688493 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -233,31 +233,6 @@  static int tegra_powergate_set(int id, bool new_state)
 }
 
 /**
- * tegra_powergate_power_on() - power on partition
- * @id: partition ID
- */
-int tegra_powergate_power_on(int id)
-{
-	if (!pmc->soc || id < 0 || id >= pmc->soc->num_powergates)
-		return -EINVAL;
-
-	return tegra_powergate_set(id, true);
-}
-
-/**
- * tegra_powergate_power_off() - power off partition
- * @id: partition ID
- */
-int tegra_powergate_power_off(int id)
-{
-	if (!pmc->soc || id < 0 || id >= pmc->soc->num_powergates)
-		return -EINVAL;
-
-	return tegra_powergate_set(id, false);
-}
-EXPORT_SYMBOL(tegra_powergate_power_off);
-
-/**
  * tegra_powergate_is_powered() - check if partition is powered
  * @id: partition ID
  */
@@ -313,49 +288,6 @@  int tegra_powergate_remove_clamping(int id)
 }
 EXPORT_SYMBOL(tegra_powergate_remove_clamping);
 
-/**
- * tegra_powergate_sequence_power_up() - power up partition
- * @id: partition ID
- * @clk: clock for partition
- * @rst: reset for partition
- *
- * Must be called with clk disabled, and returns with clk enabled.
- */
-int tegra_powergate_sequence_power_up(int id, struct clk *clk,
-				      struct reset_control *rst)
-{
-	int ret;
-
-	reset_control_assert(rst);
-
-	ret = tegra_powergate_power_on(id);
-	if (ret)
-		goto err_power;
-
-	ret = clk_prepare_enable(clk);
-	if (ret)
-		goto err_clk;
-
-	usleep_range(10, 20);
-
-	ret = tegra_powergate_remove_clamping(id);
-	if (ret)
-		goto err_clamp;
-
-	usleep_range(10, 20);
-	reset_control_deassert(rst);
-
-	return 0;
-
-err_clamp:
-	clk_disable_unprepare(clk);
-err_clk:
-	tegra_powergate_power_off(id);
-err_power:
-	return ret;
-}
-EXPORT_SYMBOL(tegra_powergate_sequence_power_up);
-
 #ifdef CONFIG_SMP
 /**
  * tegra_get_cpu_powergate_id() - convert from CPU ID to partition ID
diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h
index 65a93273e72f..8a4092d1d818 100644
--- a/include/soc/tegra/pmc.h
+++ b/include/soc/tegra/pmc.h
@@ -106,14 +106,8 @@  int tegra_pmc_cpu_remove_clamping(int cpuid);
 
 #ifdef CONFIG_ARCH_TEGRA
 int tegra_powergate_is_powered(int id);
-int tegra_powergate_power_on(int id);
-int tegra_powergate_power_off(int id);
 int tegra_powergate_remove_clamping(int id);
 
-/* Must be called with clk disabled, and returns with clk enabled */
-int tegra_powergate_sequence_power_up(int id, struct clk *clk,
-				      struct reset_control *rst);
-
 int tegra_io_rail_power_on(int id);
 int tegra_io_rail_power_off(int id);
 #else
@@ -122,27 +116,11 @@  static inline int tegra_powergate_is_powered(int id)
 	return -ENOSYS;
 }
 
-static inline int tegra_powergate_power_on(int id)
-{
-	return -ENOSYS;
-}
-
-static inline int tegra_powergate_power_off(int id)
-{
-	return -ENOSYS;
-}
-
 static inline int tegra_powergate_remove_clamping(int id)
 {
 	return -ENOSYS;
 }
 
-static inline int tegra_powergate_sequence_power_up(int id, struct clk *clk,
-						    struct reset_control *rst)
-{
-	return -ENOSYS;
-}
-
 static inline int tegra_io_rail_power_on(int id)
 {
 	return -ENOSYS;