From 89572c77cdffdf24f8fec50d3e38db6a18c04dbe Mon Sep 17 00:00:00 2001 From: Prashant Gaikwad Date: Fri, 11 Jan 2013 13:16:21 +0530 Subject: ARM: tegra: move tegra_cpu_car.h to linux/clk/tegra.h tegra_cpu_car_ops struct is going to be accessed from drivers/clk/tegra. Move the tegra_cpu_car_ops to include/linux/clk/tegra.h. Signed-off-by: Prashant Gaikwad Signed-off-by: Stephen Warren diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c index 867bf8b..8c0ff06 100644 --- a/arch/arm/mach-tegra/clock.c +++ b/arch/arm/mach-tegra/clock.c @@ -26,10 +26,10 @@ #include #include #include +#include #include "board.h" #include "clock.h" -#include "tegra_cpu_car.h" /* Global data of Tegra CPU CAR ops */ struct tegra_cpu_car_ops *tegra_cpu_car_ops; diff --git a/arch/arm/mach-tegra/cpuidle-tegra30.c b/arch/arm/mach-tegra/cpuidle-tegra30.c index 82530bd..8b50cf4 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra30.c +++ b/arch/arm/mach-tegra/cpuidle-tegra30.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,6 @@ #include "pm.h" #include "sleep.h" -#include "tegra_cpu_car.h" #ifdef CONFIG_PM_SLEEP static int tegra30_idle_lp2(struct cpuidle_device *dev, diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c index 6a27de4..a599f6e 100644 --- a/arch/arm/mach-tegra/hotplug.c +++ b/arch/arm/mach-tegra/hotplug.c @@ -10,12 +10,12 @@ */ #include #include +#include #include #include #include "sleep.h" -#include "tegra_cpu_car.h" static void (*tegra_hotplug_shutdown)(void); diff --git a/arch/arm/mach-tegra/platsmp.c b/arch/arm/mach-tegra/platsmp.c index 6867030..3ec7fc4 100644 --- a/arch/arm/mach-tegra/platsmp.c +++ b/arch/arm/mach-tegra/platsmp.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -30,7 +31,6 @@ #include "fuse.h" #include "flowctrl.h" #include "reset.h" -#include "tegra_cpu_car.h" #include "common.h" #include "iomap.h" diff --git a/arch/arm/mach-tegra/pm.c b/arch/arm/mach-tegra/pm.c index 498d70b..abfe9b9 100644 --- a/arch/arm/mach-tegra/pm.c +++ b/arch/arm/mach-tegra/pm.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -36,7 +37,6 @@ #include "reset.h" #include "flowctrl.h" #include "sleep.h" -#include "tegra_cpu_car.h" #define TEGRA_POWER_CPU_PWRREQ_OE (1 << 16) /* CPU pwr req enable */ diff --git a/arch/arm/mach-tegra/tegra20_clocks.c b/arch/arm/mach-tegra/tegra20_clocks.c index 4eb6bc8..1a80ff6 100644 --- a/arch/arm/mach-tegra/tegra20_clocks.c +++ b/arch/arm/mach-tegra/tegra20_clocks.c @@ -26,12 +26,12 @@ #include #include #include +#include #include "clock.h" #include "fuse.h" #include "iomap.h" #include "tegra2_emc.h" -#include "tegra_cpu_car.h" #define RST_DEVICES 0x004 #define RST_DEVICES_SET 0x300 diff --git a/arch/arm/mach-tegra/tegra20_clocks_data.c b/arch/arm/mach-tegra/tegra20_clocks_data.c index a23a073..022cdae 100644 --- a/arch/arm/mach-tegra/tegra20_clocks_data.c +++ b/arch/arm/mach-tegra/tegra20_clocks_data.c @@ -26,12 +26,12 @@ #include #include #include +#include #include "clock.h" #include "fuse.h" #include "tegra2_emc.h" #include "tegra20_clocks.h" -#include "tegra_cpu_car.h" /* Clock definitions */ diff --git a/arch/arm/mach-tegra/tegra30_clocks.c b/arch/arm/mach-tegra/tegra30_clocks.c index d714777..4330787 100644 --- a/arch/arm/mach-tegra/tegra30_clocks.c +++ b/arch/arm/mach-tegra/tegra30_clocks.c @@ -28,6 +28,7 @@ #include #include #include +#include #include @@ -36,7 +37,6 @@ #include "clock.h" #include "fuse.h" #include "iomap.h" -#include "tegra_cpu_car.h" #define USE_PLL_LOCK_BITS 0 diff --git a/arch/arm/mach-tegra/tegra30_clocks_data.c b/arch/arm/mach-tegra/tegra30_clocks_data.c index 741d264..9bfaa49 100644 --- a/arch/arm/mach-tegra/tegra30_clocks_data.c +++ b/arch/arm/mach-tegra/tegra30_clocks_data.c @@ -28,11 +28,11 @@ #include #include #include +#include #include "clock.h" #include "fuse.h" #include "tegra30_clocks.h" -#include "tegra_cpu_car.h" #define DEFINE_CLK_TEGRA(_name, _rate, _ops, _flags, \ _parent_names, _parents, _parent) \ diff --git a/arch/arm/mach-tegra/tegra_cpu_car.h b/arch/arm/mach-tegra/tegra_cpu_car.h deleted file mode 100644 index 9764d31..0000000 --- a/arch/arm/mach-tegra/tegra_cpu_car.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms and conditions of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * This program is distributed in the hope it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef __MACH_TEGRA_CPU_CAR_H -#define __MACH_TEGRA_CPU_CAR_H - -/* - * Tegra CPU clock and reset control ops - * - * wait_for_reset: - * keep waiting until the CPU in reset state - * put_in_reset: - * put the CPU in reset state - * out_of_reset: - * release the CPU from reset state - * enable_clock: - * CPU clock un-gate - * disable_clock: - * CPU clock gate - * rail_off_ready: - * CPU is ready for rail off - * suspend: - * save the clock settings when CPU go into low-power state - * resume: - * restore the clock settings when CPU exit low-power state - */ -struct tegra_cpu_car_ops { - void (*wait_for_reset)(u32 cpu); - void (*put_in_reset)(u32 cpu); - void (*out_of_reset)(u32 cpu); - void (*enable_clock)(u32 cpu); - void (*disable_clock)(u32 cpu); -#ifdef CONFIG_PM_SLEEP - bool (*rail_off_ready)(void); - void (*suspend)(void); - void (*resume)(void); -#endif -}; - -extern struct tegra_cpu_car_ops *tegra_cpu_car_ops; - -static inline void tegra_wait_cpu_in_reset(u32 cpu) -{ - if (WARN_ON(!tegra_cpu_car_ops->wait_for_reset)) - return; - - tegra_cpu_car_ops->wait_for_reset(cpu); -} - -static inline void tegra_put_cpu_in_reset(u32 cpu) -{ - if (WARN_ON(!tegra_cpu_car_ops->put_in_reset)) - return; - - tegra_cpu_car_ops->put_in_reset(cpu); -} - -static inline void tegra_cpu_out_of_reset(u32 cpu) -{ - if (WARN_ON(!tegra_cpu_car_ops->out_of_reset)) - return; - - tegra_cpu_car_ops->out_of_reset(cpu); -} - -static inline void tegra_enable_cpu_clock(u32 cpu) -{ - if (WARN_ON(!tegra_cpu_car_ops->enable_clock)) - return; - - tegra_cpu_car_ops->enable_clock(cpu); -} - -static inline void tegra_disable_cpu_clock(u32 cpu) -{ - if (WARN_ON(!tegra_cpu_car_ops->disable_clock)) - return; - - tegra_cpu_car_ops->disable_clock(cpu); -} - -#ifdef CONFIG_PM_SLEEP -static inline bool tegra_cpu_rail_off_ready(void) -{ - if (WARN_ON(!tegra_cpu_car_ops->rail_off_ready)) - return false; - - return tegra_cpu_car_ops->rail_off_ready(); -} - -static inline void tegra_cpu_clock_suspend(void) -{ - if (WARN_ON(!tegra_cpu_car_ops->suspend)) - return; - - tegra_cpu_car_ops->suspend(); -} - -static inline void tegra_cpu_clock_resume(void) -{ - if (WARN_ON(!tegra_cpu_car_ops->resume)) - return; - - tegra_cpu_car_ops->resume(); -} -#endif - -void tegra20_cpu_car_ops_init(void); -void tegra30_cpu_car_ops_init(void); - -#endif /* __MACH_TEGRA_CPU_CAR_H */ diff --git a/include/linux/clk/tegra.h b/include/linux/clk/tegra.h new file mode 100644 index 0000000..0977f2a --- /dev/null +++ b/include/linux/clk/tegra.h @@ -0,0 +1,124 @@ +/* + * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef __LINUX_CLK_TEGRA_H_ +#define __LINUX_CLK_TEGRA_H_ + +/* + * Tegra CPU clock and reset control ops + * + * wait_for_reset: + * keep waiting until the CPU in reset state + * put_in_reset: + * put the CPU in reset state + * out_of_reset: + * release the CPU from reset state + * enable_clock: + * CPU clock un-gate + * disable_clock: + * CPU clock gate + * rail_off_ready: + * CPU is ready for rail off + * suspend: + * save the clock settings when CPU go into low-power state + * resume: + * restore the clock settings when CPU exit low-power state + */ +struct tegra_cpu_car_ops { + void (*wait_for_reset)(u32 cpu); + void (*put_in_reset)(u32 cpu); + void (*out_of_reset)(u32 cpu); + void (*enable_clock)(u32 cpu); + void (*disable_clock)(u32 cpu); +#ifdef CONFIG_PM_SLEEP + bool (*rail_off_ready)(void); + void (*suspend)(void); + void (*resume)(void); +#endif +}; + +extern struct tegra_cpu_car_ops *tegra_cpu_car_ops; + +static inline void tegra_wait_cpu_in_reset(u32 cpu) +{ + if (WARN_ON(!tegra_cpu_car_ops->wait_for_reset)) + return; + + tegra_cpu_car_ops->wait_for_reset(cpu); +} + +static inline void tegra_put_cpu_in_reset(u32 cpu) +{ + if (WARN_ON(!tegra_cpu_car_ops->put_in_reset)) + return; + + tegra_cpu_car_ops->put_in_reset(cpu); +} + +static inline void tegra_cpu_out_of_reset(u32 cpu) +{ + if (WARN_ON(!tegra_cpu_car_ops->out_of_reset)) + return; + + tegra_cpu_car_ops->out_of_reset(cpu); +} + +static inline void tegra_enable_cpu_clock(u32 cpu) +{ + if (WARN_ON(!tegra_cpu_car_ops->enable_clock)) + return; + + tegra_cpu_car_ops->enable_clock(cpu); +} + +static inline void tegra_disable_cpu_clock(u32 cpu) +{ + if (WARN_ON(!tegra_cpu_car_ops->disable_clock)) + return; + + tegra_cpu_car_ops->disable_clock(cpu); +} + +#ifdef CONFIG_PM_SLEEP +static inline bool tegra_cpu_rail_off_ready(void) +{ + if (WARN_ON(!tegra_cpu_car_ops->rail_off_ready)) + return false; + + return tegra_cpu_car_ops->rail_off_ready(); +} + +static inline void tegra_cpu_clock_suspend(void) +{ + if (WARN_ON(!tegra_cpu_car_ops->suspend)) + return; + + tegra_cpu_car_ops->suspend(); +} + +static inline void tegra_cpu_clock_resume(void) +{ + if (WARN_ON(!tegra_cpu_car_ops->resume)) + return; + + tegra_cpu_car_ops->resume(); +} +#endif + +void tegra20_cpu_car_ops_init(void); +void tegra30_cpu_car_ops_init(void); + +#endif /* __LINUX_CLK_TEGRA_H_ */ -- cgit v0.10.2