msm: msm8660 and msm8960 clock support
Subsystems (4)
cover msm: msm8660 and msm8960 clock support
The MSM8660 and MSM8960 have had out-of-tree clock drivers for quite some time. Since people can now order the Dragonboard with the MSM8660, I thought it would be good to make sure these get sent out. Saravana is actively working on this getting this code into the tree, so this RFC is mostly to make the code available for people who get the hardware before this work is done.
I'll also put these changes on top of a recent version of Linus' master branch and make them available at
git://codeaurora.org/quic/kernel/davidb/linux-msm.git msm-clock-rfc
David
David Brown (2):
ARM: msm: fix names of UART clocks
msm_serial: fix clock rate on DMA-based uarts
Matt Wagantall (8):
msm: clock-local: Add support for 8x60 clock types
msm: clock: Add 8x60 clock support
msm: clock: Add list_rate debugfs nodes for locally-controlled clocks
msm: clock: Add debugfs interface to measure clock rates
msm: clock-8x60: Support measurement of CPU and L2 clocks
msm: clock: Expand CLK_MIN, CLK_MAX and CLK_MINMAX macros
msm: clock: Add EBI1 voter clocks for ADM on SoCs without them
msm: clock-8x60: Add local control of vpe_axi_clk and vpe_axi_clk
Saravana Kannan (1):
msm: clock: Add 7x30 local clock support
Stepan Moskovchenko (1):
msm-8x60: Add serial support
Stephen Boyd (22):
msm: clock-pcom: Mark functions static
msm: clock: Always use an array to iterate over clocks
msm: clock: Pass struct clk to the clk_ops
msm: clock: Support one lock per clock
msm: clock-pcom: Introduce a struct pcom_clk
msm: clock: Support clk_[s|g]et_parent() clk_ops
msm: clock-debug: Use clk_enable()/clk_disable() directly
msm: clock: Enable/disable parent clocks generically
msm: clock: Implement rate voting
msm: clock-pcom: Add pbus specific clock ops
msm: Migrate to clock rate voting
msm: clock: Make most clk_*() operations optional
msm: clock-debug: Implement a default is_enabled()
msm: proc_comm: Add CLKCTL_RPC_SRC_REQUEST
msm: clock: Add local clock control framework
msm: clock-pcom: Expose pc_clk_reset
msm: Unify iomap for clock regions
msm: clock: Support dummy clocks
msm: clock: Add 8960 clock support
msm: 8660: Add FLUID support
msm: clock: Invert CLKFLAG_AUTO_OFF
msm: clock: Remove msm_clk_soc_init()
arch/arm/mach-msm/Kconfig | 6 + arch/arm/mach-msm/Makefile | 5 + arch/arm/mach-msm/board-msm7x30.c | 2 +- arch/arm/mach-msm/board-msm8960.c | 9 +- arch/arm/mach-msm/board-msm8x60.c | 69 + arch/arm/mach-msm/clock-7x30.c | 3001 +++++++++++++++++ arch/arm/mach-msm/clock-7x30.h | 155 - arch/arm/mach-msm/clock-8960.c | 3930 +++++++++++++++++++++++ arch/arm/mach-msm/clock-8x60.c | 3684 +++++++++++++++++++++ arch/arm/mach-msm/clock-8x60.h | 293 ++ arch/arm/mach-msm/clock-debug.c | 83 +- arch/arm/mach-msm/clock-dummy.c | 69 + arch/arm/mach-msm/clock-local.c | 969 ++++++ arch/arm/mach-msm/clock-local.h | 316 ++ arch/arm/mach-msm/clock-pcom-lookup.c | 385 +++ arch/arm/mach-msm/clock-pcom.c | 65 +- arch/arm/mach-msm/clock-pcom.h | 35 +- arch/arm/mach-msm/clock-voter.c | 187 ++ arch/arm/mach-msm/clock-voter.h | 42 + arch/arm/mach-msm/clock.c | 150 +- arch/arm/mach-msm/clock.h | 63 +- arch/arm/mach-msm/devices-msm7x00.c | 124 +- arch/arm/mach-msm/devices-msm7x30.c | 82 - arch/arm/mach-msm/devices-qsd8x50.c | 175 +- arch/arm/mach-msm/devices.h | 4 +- arch/arm/mach-msm/include/mach/board.h | 2 - arch/arm/mach-msm/include/mach/msm_iomap-7x00.h | 5 +- arch/arm/mach-msm/include/mach/msm_iomap-7x30.h | 5 +- arch/arm/mach-msm/include/mach/msm_iomap-8960.h | 9 + arch/arm/mach-msm/include/mach/msm_iomap-8x50.h | 5 +- arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | 9 + arch/arm/mach-msm/include/mach/msm_iomap.h | 3 + arch/arm/mach-msm/io.c | 12 +- arch/arm/mach-msm/proc_comm.h | 1 + drivers/tty/serial/msm_serial.c | 2 +- 35 files changed, 13506 insertions(+), 450 deletions(-) create mode 100644 arch/arm/mach-msm/clock-7x30.c delete mode 100644 arch/arm/mach-msm/clock-7x30.h create mode 100644 arch/arm/mach-msm/clock-8960.c create mode 100644 arch/arm/mach-msm/clock-8x60.c create mode 100644 arch/arm/mach-msm/clock-8x60.h create mode 100644 arch/arm/mach-msm/clock-dummy.c create mode 100644 arch/arm/mach-msm/clock-local.c create mode 100644 arch/arm/mach-msm/clock-local.h create mode 100644 arch/arm/mach-msm/clock-pcom-lookup.c create mode 100644 arch/arm/mach-msm/clock-voter.c create mode 100644 arch/arm/mach-msm/clock-voter.h
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 1/34 msm: clock-pcom: Mark functions static
From: Stephen Boyd <[email protected]>
These functions are only used within clock-pcom.c, therefore mark them as static.
--- arch/arm/mach-msm/clock-pcom.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-)
arch/arm/mach-msm/clock-pcom.c +9 -9
@@ -25,7 +25,7 @@/* * glue for the proc_comm interface */ -int pc_clk_enable (unsigned id) +static int pc_clk_enable (unsigned id) {int rc =msm_proc_comm (PCOM_CLKCTL_RPC_ENABLE , &id,NULL );if (rc <0 )
@@ -34,7 +34,7 @@ int pc_clk_enable(unsigned id)return (int )id <0 ? -EINVAL :0 ; } -void pc_clk_disable (unsigned id) +static void pc_clk_disable (unsigned id) {msm_proc_comm (PCOM_CLKCTL_RPC_DISABLE , &id,NULL ); }
@@ -54,7 +54,7 @@ int pc_clk_reset(unsigned id, enum clk_reset_action action)return (int )id <0 ? -EINVAL :0 ; } -int pc_clk_set_rate (unsigned id,unsigned rate) +static int pc_clk_set_rate (unsigned id,unsigned rate) {/* The rate _might_ be rounded off to the nearest KHz value by the * remote function. So a return value of 0 doesn't necessarily mean
@@ -67,7 +67,7 @@ int pc_clk_set_rate(unsigned id, unsigned rate)return (int )id <0 ? -EINVAL :0 ; } -int pc_clk_set_min_rate (unsigned id,unsigned rate) +static int pc_clk_set_min_rate (unsigned id,unsigned rate) {int rc =msm_proc_comm (PCOM_CLKCTL_RPC_MIN_RATE , &id, &rate);if (rc <0 )
@@ -76,7 +76,7 @@ int pc_clk_set_min_rate(unsigned id, unsigned rate)return (int )id <0 ? -EINVAL :0 ; } -int pc_clk_set_max_rate (unsigned id,unsigned rate) +static int pc_clk_set_max_rate (unsigned id,unsigned rate) {int rc =msm_proc_comm (PCOM_CLKCTL_RPC_MAX_RATE , &id, &rate);if (rc <0 )
@@ -85,7 +85,7 @@ int pc_clk_set_max_rate(unsigned id, unsigned rate)return (int )id <0 ? -EINVAL :0 ; } -int pc_clk_set_flags (unsigned id,unsigned flags) +static int pc_clk_set_flags (unsigned id,unsigned flags) {int rc =msm_proc_comm (PCOM_CLKCTL_RPC_SET_FLAGS , &id, &flags);if (rc <0 )
@@ -94,7 +94,7 @@ int pc_clk_set_flags(unsigned id, unsigned flags)return (int )id <0 ? -EINVAL :0 ; } -unsigned pc_clk_get_rate (unsigned id) +static unsigned pc_clk_get_rate (unsigned id) {if (msm_proc_comm (PCOM_CLKCTL_RPC_RATE , &id,NULL ))return 0 ;
@@ -102,7 +102,7 @@ unsigned pc_clk_get_rate(unsigned id)return id; } -unsigned pc_clk_is_enabled (unsigned id) +static unsigned pc_clk_is_enabled (unsigned id) {if (msm_proc_comm (PCOM_CLKCTL_RPC_ENABLED , &id,NULL ))return 0 ;
@@ -110,7 +110,7 @@ unsigned pc_clk_is_enabled(unsigned id)return id; } -long pc_clk_round_rate (unsigned id,unsigned rate) +static long pc_clk_round_rate (unsigned id,unsigned rate) {/* Not really supported; pc_clk_set_rate() does rounding on it's own. */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 2/34 msm: clock: Always use an array to iterate over clocks
In reply to David BrownFrom: Stephen Boyd <[email protected]>
If the array of clk_lookups contains aliases for the same struct clk, msm_clock_init() will add the clock to the clocks list twice. This would cause list corruption so let's just remove the clocks list and any associated code and iterate over the array instead.
--- arch/arm/mach-msm/clock.c | 27 ++++++++++----------------- arch/arm/mach-msm/clock.h | 1 - arch/arm/mach-msm/include/mach/board.h | 2 +- 3 files changed, 11 insertions(+), 19 deletions(-)
arch/arm/mach-msm/clock.c +10 -17
@@ -15,7 +15,6 @@*/ #include <linux/kernel.h> -#include <linux/list.h> #include <linux/err.h> #include <linux/spinlock.h> #include <linux/pm_qos.h>
@@ -27,9 +26,7 @@#include "clock.h" -static DEFINE_MUTEX (clocks_mutex);static DEFINE_SPINLOCK (clocks_lock); -static LIST_HEAD (clocks);/* * Standard clock functions defined in include/linux/clk.h
@@ -135,21 +132,18 @@ EXPORT_SYMBOL(clk_set_flags);* generic to support different clocks. */ static struct clk *ebi1_clk; +static struct clk_lookup *msm_clocks; +static unsigned msm_num_clocks; -void __init msm_clock_init (struct clk_lookup *clock_tbl,unsigned num_clocks) +void __init msm_clock_init (struct clk_lookup *clock_tbl,size_t num_clocks) { -unsigned n; - -mutex_lock (&clocks_mutex); -for (n =0 ; n < num_clocks; n++) { -clkdev_add (&clock_tbl[n]); -list_add_tail (&clock_tbl[n].clk->list, &clocks); - } -mutex_unlock (&clocks_mutex); +clkdev_add_table (clock_tbl, num_clocks); ebi1_clk =clk_get (NULL ,"ebi1_clk" );BUG_ON (ebi1_clk ==NULL ); + msm_clocks = clock_tbl; + msm_num_clocks = num_clocks; }/* The bootloader and/or AMSS may have left various clocks enabled.
@@ -158,13 +152,13 @@ void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks)*/ static int __init clock_late_init (void ) { +unsigned i, count =0 ;unsigned long flags; -struct clk *clk; -unsigned count =0 ;clock_debug_init (); -mutex_lock (&clocks_mutex); -list_for_each_entry (clk, &clocks, list) { +for (i =0 ; i < msm_num_clocks; i++) { +struct clk *clk = msm_clocks[i].clk; +clock_debug_add (clk);if (clk->flags &CLKFLAG_AUTO_OFF ) {spin_lock_irqsave (&clocks_lock, flags);
@@ -175,7 +169,6 @@ static int __init clock_late_init(void)spin_unlock_irqrestore (&clocks_lock, flags); } } -mutex_unlock (&clocks_mutex);pr_info ("clock_late_init() disabled %d unused clocks\n" , count);return 0 ; }
arch/arm/mach-msm/clock.h +0 -1
@@ -53,7 +53,6 @@ struct clk {uint32_t flags;struct clk_ops *ops;const char *dbg_name; -struct list_head list; };#define OFF CLKFLAG_AUTO_OFF
arch/arm/mach-msm/include/mach/board.h +1 -1
@@ -41,7 +41,7 @@ void __init msm_add_devices(void);void __init msm_map_common_io (void );void __init msm_init_irq (void );void __init msm_init_gpio (void ); -void __init msm_clock_init (struct clk_lookup *clock_tbl,unsigned num_clocks); +void __init msm_clock_init (struct clk_lookup *clock_tbl,size_t num_clocks);void __init msm_acpu_clock_init (struct msm_acpu_clock_platform_data *); int __init msm_add_sdcc(unsigned int controller, struct msm_mmc_platform_data *plat,
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Re: [RFC PATCH 02/34] msm: clock: Always use an array to iterate over clocks
Quoted 5 lines · David Brown
If the array of
clk_lookupscontains aliases for the same struct clk,msm_clock_init()will add the clock to the clocks list twice. This would cause list corruption so let's just remove the clocks list and any associated code and iterate over the array instead.
Hmm...
Quoted 6 lines
arch/arm/mach-msm/clock.c +1
-0@@ -158,13 +152,13 @@ void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks)*/ static int __init clock_late_init (void ) { +unsigned i, count =0 ;unsigned long flags;
arch/arm/mach-msm/clock.c void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks) · line 162
Quoted 10 lines
arch/arm/mach-msm/clock.c +3
-4-struct clk *clk; -unsigned count =0 ;clock_debug_init (); -mutex_lock (&clocks_mutex); -list_for_each_entry (clk, &clocks, list) { +for (i =0 ; i < msm_num_clocks; i++) { +struct clk *clk = msm_clocks[i].clk; +clock_debug_add (clk);
This means you'll end up calling clock_debug_add() twice for the same struct clk - this sounds like a bad idea in itself. It looks like there's no protection within that function against it being called twice with the same struct clk.
Are you sure this is safe?
Re: [RFC PATCH 02/34] msm: clock: Always use an array to iterate over clocks
Quoted 29 lines · Russell King - ARM Linux
Quoted 5 lines · David Brown
If the array of
clk_lookupscontains aliases for the same struct clk,msm_clock_init()will add the clock to the clocks list twice. This would cause list corruption so let's just remove the clocks list and any associated code and iterate over the array instead.Hmm...
Quoted 6 lines
arch/arm/mach-msm/clock.c +1
-0@@ -158,13 +152,13 @@ void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks)*/ static int __init clock_late_init (void ) { +unsigned i, count =0 ;unsigned long flags;arch/arm/mach-msm/clock.c void __init msm_clock_init(struct clk_lookup *clock_tbl, unsigned num_clocks) · line 162
Quoted 10 lines
arch/arm/mach-msm/clock.c +3
-4-struct clk *clk; -unsigned count =0 ;clock_debug_init (); -mutex_lock (&clocks_mutex); -list_for_each_entry (clk, &clocks, list) { +for (i =0 ; i < msm_num_clocks; i++) { +struct clk *clk = msm_clocks[i].clk; +clock_debug_add (clk);This means you'll end up calling
clock_debug_add()twice for the same struct clk - this sounds like a bad idea in itself. It looks like there's no protection within that function against it being called twice with the same struct clk.
Quoted 1 line
Are you sure this is safe?
This hasn't proven to be a problem so far because debugfs returns an error when you create a directory with the same name twice. If we ever do something more in clock_debug_add() we would have a problem.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 3/34 msm: clock: Pass struct clk to the clk_ops
In reply to David BrownFrom: Stephen Boyd <[email protected]>
--- arch/arm/mach-msm/clock-debug.c | 8 ++++---- arch/arm/mach-msm/clock-pcom.c | 31 ++++++++++++++++++++----------- arch/arm/mach-msm/clock-pcom.h | 2 +- arch/arm/mach-msm/clock.c | 24 ++++++++++++------------ arch/arm/mach-msm/clock.h | 24 ++++++++++++------------ 5 files changed, 49 insertions(+), 40 deletions(-)
arch/arm/mach-msm/clock-debug.c +4 -4
@@ -55,9 +55,9 @@ static int clock_debug_enable_set(void *data, u64 val)int rc =0 ;if (val) - rc = clock->ops->enable (clock->id); + rc = clock->ops->enable (clock);else - clock->ops->disable (clock->id); + clock->ops->disable (clock);return rc; }
@@ -66,7 +66,7 @@ static int clock_debug_enable_get(void *data, u64 *val) {struct clk *clock = data; - *val = clock->ops->is_enabled (clock->id); + *val = clock->ops->is_enabled (clock);return 0 ; }
@@ -78,7 +78,7 @@ static int clock_debug_local_get(void *data, u64 *val) {struct clk *clock = data; - *val = clock->ops->is_local (clock->id); + *val = clock->ops->is_local (clock);return 0 ; }
arch/arm/mach-msm/clock-pcom.c +20 -11
@@ -25,8 +25,9 @@/* * glue for the proc_comm interface */ -static int pc_clk_enable (unsigned id) +static int pc_clk_enable (struct clk *clk) { +unsigned id = clk->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_ENABLE , &id,NULL );if (rc <0 )return rc;
@@ -34,14 +35,16 @@ static int pc_clk_enable(unsigned id)return (int )id <0 ? -EINVAL :0 ; } -static void pc_clk_disable (unsigned id) +static void pc_clk_disable (struct clk *clk) { +unsigned id = clk->id;msm_proc_comm (PCOM_CLKCTL_RPC_DISABLE , &id,NULL ); } -int pc_clk_reset (unsigned id,enum clk_reset_action action) +int pc_clk_reset (struct clk *clk,enum clk_reset_action action) {int rc; +unsigned id = clk->id;if (action ==CLK_RESET_ASSERT ) rc =msm_proc_comm (PCOM_CLKCTL_RPC_RESET_ASSERT , &id,NULL );
@@ -54,12 +57,13 @@ int pc_clk_reset(unsigned id, enum clk_reset_action action)return (int )id <0 ? -EINVAL :0 ; } -static int pc_clk_set_rate (unsigned id,unsigned rate) +static int pc_clk_set_rate (struct clk *clk,unsigned rate) {/* The rate _might_ be rounded off to the nearest KHz value by the * remote function. So a return value of 0 doesn't necessarily mean * that the exact rate was set successfully. */ +unsigned id = clk->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_SET_RATE , &id, &rate);if (rc <0 )return rc;
@@ -67,8 +71,9 @@ static int pc_clk_set_rate(unsigned id, unsigned rate)return (int )id <0 ? -EINVAL :0 ; } -static int pc_clk_set_min_rate (unsigned id,unsigned rate) +static int pc_clk_set_min_rate (struct clk *clk,unsigned rate) { +unsigned id = clk->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_MIN_RATE , &id, &rate);if (rc <0 )return rc;
@@ -76,8 +81,9 @@ static int pc_clk_set_min_rate(unsigned id, unsigned rate)return (int )id <0 ? -EINVAL :0 ; } -static int pc_clk_set_max_rate (unsigned id,unsigned rate) +static int pc_clk_set_max_rate (struct clk *clk,unsigned rate) { +unsigned id = clk->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_MAX_RATE , &id, &rate);if (rc <0 )return rc;
@@ -85,8 +91,9 @@ static int pc_clk_set_max_rate(unsigned id, unsigned rate)return (int )id <0 ? -EINVAL :0 ; } -static int pc_clk_set_flags (unsigned id,unsigned flags) +static int pc_clk_set_flags (struct clk *clk,unsigned flags) { +unsigned id = clk->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_SET_FLAGS , &id, &flags);if (rc <0 )return rc;
@@ -94,30 +101,32 @@ static int pc_clk_set_flags(unsigned id, unsigned flags)return (int )id <0 ? -EINVAL :0 ; } -static unsigned pc_clk_get_rate (unsigned id) +static unsigned pc_clk_get_rate (struct clk *clk) { +unsigned id = clk->id;if (msm_proc_comm (PCOM_CLKCTL_RPC_RATE , &id,NULL ))return 0 ;else return id; } -static unsigned pc_clk_is_enabled (unsigned id) +static unsigned pc_clk_is_enabled (struct clk *clk) { +unsigned id = clk->id;if (msm_proc_comm (PCOM_CLKCTL_RPC_ENABLED , &id,NULL ))return 0 ;else return id; } -static long pc_clk_round_rate (unsigned id,unsigned rate) +static long pc_clk_round_rate (struct clk *clk,unsigned rate) {/* Not really supported; pc_clk_set_rate() does rounding on it's own. */ return rate; } -static bool pc_clk_is_local (unsigned id) +static bool pc_clk_is_local (struct clk *clk) {return false; }
arch/arm/mach-msm/clock-pcom.h +1 -1
@@ -123,7 +123,7 @@struct clk_ops ;extern struct clk_ops clk_ops_pcom; -int pc_clk_reset (unsigned id,enum clk_reset_action action); +int pc_clk_reset (struct clk *clk,enum clk_reset_action action);#define CLK_PCOM (clk_name, clk_id, clk_dev, clk_flags) { \ .con_id = clk_name, \
arch/arm/mach-msm/clock.c +12 -12
@@ -37,7 +37,7 @@ int clk_enable(struct clk *clk)spin_lock_irqsave (&clocks_lock, flags); clk->count++;if (clk->count ==1 ) - clk->ops->enable (clk->id); + clk->ops->enable (clk);spin_unlock_irqrestore (&clocks_lock, flags);return 0 ; }
@@ -50,20 +50,20 @@ void clk_disable(struct clk *clk)BUG_ON (clk->count ==0 ); clk->count--;if (clk->count ==0 ) - clk->ops->disable (clk->id); + clk->ops->disable (clk);spin_unlock_irqrestore (&clocks_lock, flags); }EXPORT_SYMBOL (clk_disable);int clk_reset (struct clk *clk,enum clk_reset_action action) { -return clk->ops->reset (clk->remote_id, action); +return clk->ops->reset (clk, action); }EXPORT_SYMBOL (clk_reset);unsigned long clk_get_rate (struct clk *clk) { -return clk->ops->get_rate (clk->id); +return clk->ops->get_rate (clk); }EXPORT_SYMBOL (clk_get_rate);
@@ -71,12 +71,12 @@ int clk_set_rate(struct clk *clk, unsigned long rate) {int ret;if (clk->flags &CLKFLAG_MAX ) { - ret = clk->ops->set_max_rate (clk->id, rate); + ret = clk->ops->set_max_rate (clk, rate);if (ret)return ret; }if (clk->flags &CLKFLAG_MIN ) { - ret = clk->ops->set_min_rate (clk->id, rate); + ret = clk->ops->set_min_rate (clk, rate);if (ret)return ret; }
@@ -84,25 +84,25 @@ int clk_set_rate(struct clk *clk, unsigned long rate)if (clk->flags &CLKFLAG_MAX || clk->flags &CLKFLAG_MIN )return ret; -return clk->ops->set_rate (clk->id, rate); +return clk->ops->set_rate (clk, rate); }EXPORT_SYMBOL (clk_set_rate);long clk_round_rate (struct clk *clk,unsigned long rate) { -return clk->ops->round_rate (clk->id, rate); +return clk->ops->round_rate (clk, rate); }EXPORT_SYMBOL (clk_round_rate);int clk_set_min_rate (struct clk *clk,unsigned long rate) { -return clk->ops->set_min_rate (clk->id, rate); +return clk->ops->set_min_rate (clk, rate); }EXPORT_SYMBOL (clk_set_min_rate);int clk_set_max_rate (struct clk *clk,unsigned long rate) { -return clk->ops->set_max_rate (clk->id, rate); +return clk->ops->set_max_rate (clk, rate); }EXPORT_SYMBOL (clk_set_max_rate);
@@ -122,7 +122,7 @@ int clk_set_flags(struct clk *clk, unsigned long flags) {if (clk ==NULL ||IS_ERR (clk))return -EINVAL ; -return clk->ops->set_flags (clk->id, flags); +return clk->ops->set_flags (clk, flags); }EXPORT_SYMBOL (clk_set_flags);
@@ -164,7 +164,7 @@ static int __init clock_late_init(void)spin_lock_irqsave (&clocks_lock, flags);if (!clk->count) { count++; - clk->ops->auto_off (clk->id); + clk->ops->auto_off (clk); }spin_unlock_irqrestore (&clocks_lock, flags); }
arch/arm/mach-msm/clock.h +12 -12
@@ -32,18 +32,18 @@#define CLKFLAG_MAX 0x00000800struct clk_ops { -int (*enable)(unsigned id); -void (*disable)(unsigned id); -void (*auto_off)(unsigned id); -int (*reset)(unsigned id,enum clk_reset_action action); -int (*set_rate)(unsigned id,unsigned rate); -int (*set_min_rate)(unsigned id,unsigned rate); -int (*set_max_rate)(unsigned id,unsigned rate); -int (*set_flags)(unsigned id,unsigned flags); -unsigned (*get_rate)(unsigned id); -unsigned (*is_enabled)(unsigned id); -long (*round_rate)(unsigned id,unsigned rate); -bool (*is_local)(unsigned id); +int (*enable)(struct clk *clk); +void (*disable)(struct clk *clk); +void (*auto_off)(struct clk *clk); +int (*reset)(struct clk *clk,enum clk_reset_action action); +int (*set_rate)(struct clk *clk,unsigned rate); +int (*set_min_rate)(struct clk *clk,unsigned rate); +int (*set_max_rate)(struct clk *clk,unsigned rate); +int (*set_flags)(struct clk *clk,unsigned flags); +unsigned (*get_rate)(struct clk *clk); +unsigned (*is_enabled)(struct clk *clk); +long (*round_rate)(struct clk *clk,unsigned rate); +bool (*is_local)(struct clk *clk); };struct clk {
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 4/34 msm: clock: Support one lock per clock
In reply to David BrownFrom: Stephen Boyd <[email protected]>
--- arch/arm/mach-msm/clock.c | 19 +++++++++++-------- arch/arm/mach-msm/clock.h | 2 ++ 2 files changed, 13 insertions(+), 8 deletions(-)
arch/arm/mach-msm/clock.c +11 -8
@@ -26,19 +26,17 @@#include "clock.h" -static DEFINE_SPINLOCK (clocks_lock); -/* * Standard clock functions defined in include/linux/clk.h */ int clk_enable (struct clk *clk) {unsigned long flags; -spin_lock_irqsave (&clocks_lock, flags); +spin_lock_irqsave (&clk->lock, flags); clk->count++;if (clk->count ==1 ) clk->ops->enable (clk); -spin_unlock_irqrestore (&clocks_lock, flags); +spin_unlock_irqrestore (&clk->lock, flags);return 0 ; }EXPORT_SYMBOL (clk_enable);
@@ -46,12 +44,12 @@ EXPORT_SYMBOL(clk_enable);void clk_disable (struct clk *clk) {unsigned long flags; -spin_lock_irqsave (&clocks_lock, flags); +spin_lock_irqsave (&clk->lock, flags);BUG_ON (clk->count ==0 ); clk->count--;if (clk->count ==0 ) clk->ops->disable (clk); -spin_unlock_irqrestore (&clocks_lock, flags); +spin_unlock_irqrestore (&clk->lock, flags); }EXPORT_SYMBOL (clk_disable);
@@ -137,8 +135,13 @@ static unsigned msm_num_clocks;void __init msm_clock_init (struct clk_lookup *clock_tbl,size_t num_clocks) { +unsigned n; +clkdev_add_table (clock_tbl, num_clocks); +for (n =0 ; n < num_clocks; n++) +spin_lock_init (&clock_tbl[n].clk->lock); + ebi1_clk =clk_get (NULL ,"ebi1_clk" );BUG_ON (ebi1_clk ==NULL );
@@ -161,12 +164,12 @@ static int __init clock_late_init(void)clock_debug_add (clk);if (clk->flags &CLKFLAG_AUTO_OFF ) { -spin_lock_irqsave (&clocks_lock, flags); +spin_lock_irqsave (&clk->lock, flags);if (!clk->count) { count++; clk->ops->auto_off (clk); } -spin_unlock_irqrestore (&clocks_lock, flags); +spin_unlock_irqrestore (&clk->lock, flags); } }pr_info ("clock_late_init() disabled %d unused clocks\n" , count);
arch/arm/mach-msm/clock.h +2 -0
@@ -19,6 +19,7 @@#include <linux/init.h> #include <linux/list.h> +#include <linux/spinlock.h> #include <mach/clk.h> #define CLKFLAG_INVERT 0x00000001
@@ -53,6 +54,7 @@ struct clk {uint32_t flags;struct clk_ops *ops;const char *dbg_name; +spinlock_t lock; };#define OFF CLKFLAG_AUTO_OFF
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 5/34 msm: clock-pcom: Introduce a struct pcom_clk
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Move the unsigned id member out of struct clk since its only really useful for proc_comm clocks. This means we have to define all the struct clk's before hand, but we actually want to do this so we can point voter clocks at the struct clk directly.
--- arch/arm/mach-msm/clock-7x30.h | 12 -- arch/arm/mach-msm/clock-pcom.c | 18 ++-- arch/arm/mach-msm/clock-pcom.h | 32 ++++-- arch/arm/mach-msm/clock.h | 2 +- arch/arm/mach-msm/devices-msm7x00.c | 124 ++++++++++++++------- arch/arm/mach-msm/devices-msm7x30.c | 213 +++++++++++++++++++++++------------ arch/arm/mach-msm/devices-qsd8x50.c | 154 +++++++++++++++++--------- 7 files changed, 360 insertions(+), 195 deletions(-)
arch/arm/mach-msm/clock-7x30.h +0 -12
@@ -140,16 +140,4 @@ extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable); }, \ } -#define CLK_7X30S (clk_name, l_id, r_id, clk_dev, clk_flags) { \ - .con_id = clk_name, \ - .dev_id = clk_dev, \ - .clk = &(struct clk){ \ - .id = L_7X30_##l_id, \ - .remote_id = P_##r_id, \ - .flags = clk_flags, \ - .dbg_name = #l_id, \ - .ops = &clk_ops_pcom, \ - }, \ - } -#endif
arch/arm/mach-msm/clock-pcom.c +9 -9
@@ -27,7 +27,7 @@*/ static int pc_clk_enable (struct clk *clk) { -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_ENABLE , &id,NULL );if (rc <0 )return rc;
@@ -37,14 +37,14 @@ static int pc_clk_enable(struct clk *clk)static void pc_clk_disable (struct clk *clk) { -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;msm_proc_comm (PCOM_CLKCTL_RPC_DISABLE , &id,NULL ); }int pc_clk_reset (struct clk *clk,enum clk_reset_action action) {int rc; -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;if (action ==CLK_RESET_ASSERT ) rc =msm_proc_comm (PCOM_CLKCTL_RPC_RESET_ASSERT , &id,NULL );
@@ -63,7 +63,7 @@ static int pc_clk_set_rate(struct clk *clk, unsigned rate)* remote function. So a return value of 0 doesn't necessarily mean * that the exact rate was set successfully. */ -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_SET_RATE , &id, &rate);if (rc <0 )return rc;
@@ -73,7 +73,7 @@ static int pc_clk_set_rate(struct clk *clk, unsigned rate)static int pc_clk_set_min_rate (struct clk *clk,unsigned rate) { -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_MIN_RATE , &id, &rate);if (rc <0 )return rc;
@@ -83,7 +83,7 @@ static int pc_clk_set_min_rate(struct clk *clk, unsigned rate)static int pc_clk_set_max_rate (struct clk *clk,unsigned rate) { -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_MAX_RATE , &id, &rate);if (rc <0 )return rc;
@@ -93,7 +93,7 @@ static int pc_clk_set_max_rate(struct clk *clk, unsigned rate)static int pc_clk_set_flags (struct clk *clk,unsigned flags) { -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;int rc =msm_proc_comm (PCOM_CLKCTL_RPC_SET_FLAGS , &id, &flags);if (rc <0 )return rc;
@@ -103,7 +103,7 @@ static int pc_clk_set_flags(struct clk *clk, unsigned flags)static unsigned pc_clk_get_rate (struct clk *clk) { -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;if (msm_proc_comm (PCOM_CLKCTL_RPC_RATE , &id,NULL ))return 0 ;else
@@ -112,7 +112,7 @@ static unsigned pc_clk_get_rate(struct clk *clk)static unsigned pc_clk_is_enabled (struct clk *clk) { -unsigned id = clk->id; +unsigned id =to_pcom_clk (clk)->id;if (msm_proc_comm (PCOM_CLKCTL_RPC_ENABLED , &id,NULL ))return 0 ;else
arch/arm/mach-msm/clock-pcom.h +22 -10
@@ -123,18 +123,30 @@struct clk_ops ;extern struct clk_ops clk_ops_pcom; -int pc_clk_reset (struct clk *clk,enum clk_reset_action action); +/** +* struct pcom_clk - proc_comm controlled clock +* @id: proc_comm identifier +* @c: clk +*/ +struct pcom_clk { +unsigned id; +struct clk c; +}; + +static inline struct pcom_clk *to_pcom_clk (struct clk *clk) +{ + return container_of(clk, struct pcom_clk, c); +} -#define CLK_PCOM (clk_name, clk_id, clk_dev, clk_flags) { \ - .con_id = clk_name, \ - .dev_id = clk_dev, \ - .clk = &(struct clk){ \ +#define DEFINE_CLK_PCOM (clk_name, clk_id, clk_flags) \ + struct pcom_clk clk_name = { \ .id = P_##clk_id, \ - .remote_id = P_##clk_id, \ - .ops = &clk_ops_pcom, \ - .flags = clk_flags, \ - .dbg_name = #clk_id, \ - }, \ + .c = { \ + .ops = &clk_ops_pcom, \ + .flags = clk_flags, \ + .dbg_name = #clk_id, \ + .lock = __SPIN_LOCK_UNLOCKED(clk_name.c), \ + }, \ }#endif
arch/arm/mach-msm/clock.h +1 -1
@@ -48,7 +48,6 @@ struct clk_ops { };struct clk { -uint32_t id;uint32_t remote_id;uint32_t count;uint32_t flags;
@@ -70,4 +69,5 @@ static inline int __init clock_debug_init(void) { return 0; }static inline int __init clock_debug_add (struct clk *clock) {return 0 ; }#endif +#define CLK_LOOKUP (con, c, dev) { .con_id = con, .clk = &c, .dev_id = dev }#endif
arch/arm/mach-msm/devices-msm7x00.c +83 -41
131 lines not on this page · raw message
arch/arm/mach-msm/devices-msm7x30.c +142 -71
222 lines not on this page · raw message
arch/arm/mach-msm/devices-qsd8x50.c +103 -51
161 lines not on this page · raw message
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 6/34 msm: clock: Support clk_[s|g]et_parent() clk_ops
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Voting clocks are linked to the clock they vote on with a parent pointer. Add support for these functions so the upcoming clock voter sub driver can use it to initialize clocks.
--- arch/arm/mach-msm/clock.c | 7 ++++++- arch/arm/mach-msm/clock.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletions(-)
arch/arm/mach-msm/clock.c +6 -1
@@ -106,13 +106,18 @@ EXPORT_SYMBOL(clk_set_max_rate);int clk_set_parent (struct clk *clk,struct clk *parent) { +if (clk->ops->set_parent) +return clk->ops->set_parent (clk, parent);return -ENOSYS ; }EXPORT_SYMBOL (clk_set_parent);struct clk *clk_get_parent (struct clk *clk) { -return ERR_PTR (-ENOSYS ); +if (clk->ops->get_parent) +return clk->ops->get_parent (clk); + +return NULL ; }EXPORT_SYMBOL (clk_get_parent);
arch/arm/mach-msm/clock.h +2 -0
@@ -44,6 +44,8 @@ struct clk_ops {unsigned (*get_rate)(struct clk *clk);unsigned (*is_enabled)(struct clk *clk);long (*round_rate)(struct clk *clk,unsigned rate); +int (*set_parent)(struct clk *clk,struct clk *parent); +struct clk *(*get_parent)(struct clk *clk);bool (*is_local)(struct clk *clk); };
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 7/34 msm: clock-debug: Use clk_enable()/clk_disable() directly
In reply to David BrownFrom: Stephen Boyd <[email protected]>
The debugfs operations currently sidestep the top level enable/disable code and directly call the ops->enable/disable functions. This won't work well when we generically enable parent clocks in the toplevel clock code. Therefore call enable/disable directly from the debugfs code to get proper parent enabling.
--- arch/arm/mach-msm/clock-debug.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-msm/clock-debug.c +2 -2
@@ -55,9 +55,9 @@ static int clock_debug_enable_set(void *data, u64 val)int rc =0 ;if (val) - rc = clock->ops->enable (clock); + rc =clk_enable (clock);else - clock->ops->disable (clock); +clk_disable (clock);return rc; }
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 8/34 msm: clock: Enable/disable parent clocks generically
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Enable the parent clocks whenever a clock is enabled and disable a parent clock whenever a clock is disabled. This simplifies sub-driver code by centralizing the parent enabling in the top-level.
--- arch/arm/mach-msm/clock.c | 33 +++++++++++++++++++++++++++++---- 1 files changed, 29 insertions(+), 4 deletions(-)
arch/arm/mach-msm/clock.c +29 -4
@@ -31,24 +31,49 @@*/ int clk_enable (struct clk *clk) { +int ret =0 ;unsigned long flags; +struct clk *parent; + +if (!clk) +return 0 ; +spin_lock_irqsave (&clk->lock, flags); +if (clk->count ==0 ) { + parent =clk_get_parent (clk); + ret =clk_enable (parent); +if (ret) + goto out; + + ret = clk->ops->enable (clk); +if (ret) { +clk_disable (parent); + goto out; + } + } clk->count++; -if (clk->count ==1 ) - clk->ops->enable (clk); +out:spin_unlock_irqrestore (&clk->lock, flags); -return 0 ; +return ret; }EXPORT_SYMBOL (clk_enable);void clk_disable (struct clk *clk) {unsigned long flags; +struct clk *parent; + +if (!clk) +return ; +spin_lock_irqsave (&clk->lock, flags);BUG_ON (clk->count ==0 ); clk->count--; -if (clk->count ==0 ) +if (clk->count ==0 ) { clk->ops->disable (clk); + parent =clk_get_parent (clk); +clk_disable (parent); + }spin_unlock_irqrestore (&clk->lock, flags); }EXPORT_SYMBOL (clk_disable);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 9/34 msm: clock: Implement rate voting
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Some clocks have multiple consumers where each consumer requires a minimum rate. Implement a sub driver to aggregate clk_set_rate() calls from each consumer and call clk_set_rate() on the parent clock when the minimum requested rate of all the voters changes.
--- arch/arm/mach-msm/Makefile | 1 + arch/arm/mach-msm/clock-pcom.h | 2 +- arch/arm/mach-msm/clock-voter.c | 187 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/clock-voter.h | 41 +++++++++ arch/arm/mach-msm/clock.c | 18 ++--- arch/arm/mach-msm/clock.h | 9 ++ 6 files changed, 245 insertions(+), 13 deletions(-) create mode 100644 arch/arm/mach-msm/clock-voter.c create mode 100644 arch/arm/mach-msm/clock-voter.h
arch/arm/mach-msm/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-y += io.o idle.o timer.o obj-y += clock.o +obj-y += clock-voter.o obj-$(CONFIG_DEBUG_FS) += clock-debug.o obj-$(CONFIG_MSM_VIC) += irq-vic.o
arch/arm/mach-msm/clock-pcom.h +1 -1
@@ -145,7 +145,7 @@ static inline struct pcom_clk *to_pcom_clk(struct clk *clk) .ops = &clk_ops_pcom, \ .flags = clk_flags, \ .dbg_name = #clk_id, \ - .lock = __SPIN_LOCK_UNLOCKED(clk_name.c), \ + CLK_INIT(clk_name.c), \ }, \ }
arch/arm/mach-msm/clock-voter.c new file +187 -0
187 lines not on this page · raw message
arch/arm/mach-msm/clock-voter.h new file +41 -0
41 lines not on this page · raw message
arch/arm/mach-msm/clock.c +6 -12
@@ -154,12 +154,6 @@ int clk_set_flags(struct clk *clk, unsigned long flags) }EXPORT_SYMBOL (clk_set_flags); -/* EBI1 is the only shared clock that several clients want to vote on as of -* this commit. If this changes in the future, then it might be better to -* make clk_min_rate handle the voting or make ebi1_clk_set_min_rate more -* generic to support different clocks. -*/ -static struct clk *ebi1_clk;static struct clk_lookup *msm_clocks;static unsigned msm_num_clocks;
@@ -167,13 +161,13 @@ void __init msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks) {unsigned n; -clkdev_add_table (clock_tbl, num_clocks); - -for (n =0 ; n < num_clocks; n++) -spin_lock_init (&clock_tbl[n].clk->lock); +for (n =0 ; n < num_clocks; n++) { +struct clk *clk = clock_tbl[n].clk; +struct clk *parent =clk_get_parent (clk); +clk_set_parent (clk, parent); + } - ebi1_clk =clk_get (NULL ,"ebi1_clk" ); -BUG_ON (ebi1_clk ==NULL ); +clkdev_add_table (clock_tbl, num_clocks); msm_clocks = clock_tbl; msm_num_clocks = num_clocks;
arch/arm/mach-msm/clock.h +9 -0
@@ -55,9 +55,18 @@ struct clk {uint32_t flags;struct clk_ops *ops;const char *dbg_name; + +struct list_head children; +struct list_head siblings; +spinlock_t lock; }; +#define CLK_INIT (name) \ + .lock = __SPIN_LOCK_UNLOCKED((name).lock), \ + .children = LIST_HEAD_INIT((name).children), \ + .siblings = LIST_HEAD_INIT((name).siblings) +#define OFF CLKFLAG_AUTO_OFF#define CLK_MIN CLKFLAG_MIN#define CLK_MAX CLKFLAG_MAX
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 10/34 msm: clock-pcom: Add pbus specific clock ops
In reply to David BrownFrom: Stephen Boyd <[email protected]>
The pbus clock always runs at half the ebi1 clock frequency. Since ebi1 clock votes are dropped when the application processor is power collapsed, the ebi1 clock is reserved for the acpuclock driver. Other drivers which have ebi1 clock requirements that are independent of application processor power status use the pbus. To keep this change transparent across drivers and SoCs, add new ops that divides the rate by 2 before sending the request to the modem.
--- arch/arm/mach-msm/clock-pcom.c | 29 +++++++++++++++++++++++++++++ arch/arm/mach-msm/clock-pcom.h | 1 + arch/arm/mach-msm/devices-msm7x30.c | 11 ++++++++++- 3 files changed, 40 insertions(+), 1 deletions(-)
arch/arm/mach-msm/clock-pcom.c +29 -0
@@ -145,3 +145,32 @@ struct clk_ops clk_ops_pcom = { .round_rate = pc_clk_round_rate, .is_local = pc_clk_is_local, }; + +int pc_clk_set_rate2 (struct clk *clk,unsigned rate) +{ +return pc_clk_set_rate (clk, rate /2 ); +} + +int pc_clk_set_min_rate2 (struct clk *clk,unsigned rate) +{ +return pc_clk_set_min_rate (clk, rate /2 ); +} + +unsigned pc_clk_get_rate2 (struct clk *clk) +{ +return pc_clk_get_rate (clk) *2 ; +} + +struct clk_ops clk_ops_pcom_div2 = { + .enable = pc_clk_enable, + .disable = pc_clk_disable, + .auto_off = pc_clk_disable, + .reset = pc_clk_reset, + .set_rate = pc_clk_set_rate2, + .set_min_rate = pc_clk_set_min_rate2, + .set_flags = pc_clk_set_flags, + .get_rate = pc_clk_get_rate2, + .is_enabled = pc_clk_is_enabled, + .round_rate = pc_clk_round_rate, + .is_local = pc_clk_is_local, +};
arch/arm/mach-msm/clock-pcom.h +1 -0
@@ -122,6 +122,7 @@struct clk_ops ;extern struct clk_ops clk_ops_pcom; +extern struct clk_ops clk_ops_pcom_div2;/** * struct pcom_clk - proc_comm controlled clock
arch/arm/mach-msm/devices-msm7x30.c +10 -1
@@ -169,7 +169,6 @@ static DEFINE_CLK_PCOM(mi2s_codec_rx_m_clk, MI2S_CODEC_RX_M_CLK, 0); static DEFINE_CLK_PCOM(mi2s_codec_rx_s_clk, MI2S_CODEC_RX_S_CLK, 0); static DEFINE_CLK_PCOM(mi2s_codec_tx_m_clk, MI2S_CODEC_TX_M_CLK, 0); static DEFINE_CLK_PCOM(mi2s_codec_tx_s_clk, MI2S_CODEC_TX_S_CLK, 0); -static DEFINE_CLK_PCOM(pbus_clk, PBUS_CLK, CLK_MIN); static DEFINE_CLK_PCOM(pcm_clk, PCM_CLK, 0); static DEFINE_CLK_PCOM(axi_rotator_clk, AXI_ROTATOR_CLK, 0); static DEFINE_CLK_PCOM(rotator_imem_clk, ROTATOR_IMEM_CLK, OFF);
@@ -201,6 +200,16 @@ static DEFINE_CLK_PCOM(csi0_clk, CSI0_CLK, 0); static DEFINE_CLK_PCOM(csi0_p_clk, CSI0_P_CLK, 0); static DEFINE_CLK_PCOM(csi0_vfe_clk, CSI0_VFE_CLK, 0); +static struct pcom_clk pbus_clk = { + .id =P_PBUS_CLK , + .c = { + .dbg_name ="pbus_clk" , + .ops = &clk_ops_pcom_div2, + .flags =CLK_MIN , +CLK_INIT (pbus_clk.c), + }, +}; +struct clk_lookup msm_clocks_7x30[] = {CLK_LOOKUP ("adm_clk" , adm_clk.c,"msm_dmov" ),CLK_LOOKUP ("adsp_clk" , adsp_clk.c,NULL ),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 11/34 msm: Migrate to clock rate voting
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Add the appropriate clock voters and integrate clock.c with the voting driver so that voting works appropriately.
--- arch/arm/mach-msm/devices-msm7x30.c | 19 +++++++++++++++++++ arch/arm/mach-msm/devices-qsd8x50.c | 17 +++++++++++++++++ 2 files changed, 36 insertions(+), 0 deletions(-)
arch/arm/mach-msm/devices-msm7x30.c +19 -0
@@ -24,6 +24,7 @@#include <mach/board.h> #include "devices.h" +#include "clock-voter.h" #include "smd_private.h" #include <asm/mach/flash.h>
@@ -210,6 +211,15 @@ static struct pcom_clk pbus_clk = { }, }; +static DEFINE_CLK_VOTER(ebi1_dtv_clk, &pbus_clk.c); +static DEFINE_CLK_VOTER(ebi1_kgsl_clk, &pbus_clk.c); +static DEFINE_CLK_VOTER(ebi1_lcdc_clk, &pbus_clk.c); +static DEFINE_CLK_VOTER(ebi1_mddi_clk, &pbus_clk.c); +static DEFINE_CLK_VOTER(ebi1_tv_clk, &pbus_clk.c); +static DEFINE_CLK_VOTER(ebi1_usb_clk, &pbus_clk.c); +static DEFINE_CLK_VOTER(ebi1_vcd_clk, &pbus_clk.c); +static DEFINE_CLK_VOTER(ebi1_vfe_clk, &pbus_clk.c); +struct clk_lookup msm_clocks_7x30[] = {CLK_LOOKUP ("adm_clk" , adm_clk.c,"msm_dmov" ),CLK_LOOKUP ("adsp_clk" , adsp_clk.c,NULL ),
@@ -284,6 +294,15 @@ struct clk_lookup msm_clocks_7x30[] = {CLK_LOOKUP ("csi_clk" , csi0_clk.c,NULL ),CLK_LOOKUP ("csi_pclk" , csi0_p_clk.c,NULL ),CLK_LOOKUP ("csi_vfe_clk" , csi0_vfe_clk.c,NULL ), + +CLK_LOOKUP ("ebi1_clk" , ebi1_dtv_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_kgsl_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_lcdc_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_mddi_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_tv_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_usb_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_vcd_clk.c,NULL ), + CLK_LOOKUP("ebi1_clk", ebi1_vfe_clk.c, NULL), };unsigned msm_num_clocks_7x30 =ARRAY_SIZE (msm_clocks_7x30);
arch/arm/mach-msm/devices-qsd8x50.c +17 -0
@@ -29,6 +29,7 @@#include <mach/mmc.h> #include "clock-pcom.h" +#include "clock-voter.h" static struct resource resources_uart3[] = { {
@@ -343,6 +344,14 @@ static DEFINE_CLK_PCOM(usb_hs3_clk, USB_HS3_CLK, OFF); static DEFINE_CLK_PCOM(usb_hs3_p_clk, USB_HS3_P_CLK, OFF); static DEFINE_CLK_PCOM(usb_phy_clk, USB_PHY_CLK, 0); +static DEFINE_CLK_VOTER(ebi1_acpu_clk, &ebi1_clk.c); +static DEFINE_CLK_VOTER(ebi1_kgsl_clk, &ebi1_clk.c); +static DEFINE_CLK_VOTER(ebi1_lcdc_clk, &ebi1_clk.c); +static DEFINE_CLK_VOTER(ebi1_mddi_clk, &ebi1_clk.c); +static DEFINE_CLK_VOTER(ebi1_tv_clk, &ebi1_clk.c); +static DEFINE_CLK_VOTER(ebi1_usb_clk, &ebi1_clk.c); +static DEFINE_CLK_VOTER(ebi1_vfe_clk, &ebi1_clk.c); +struct clk_lookup msm_clocks_8x50[] = {CLK_LOOKUP ("adm_clk" , adm_clk.c,"msm_dmov" ),CLK_LOOKUP ("ce_clk" , ce_clk.c,NULL ),
@@ -395,6 +404,14 @@ struct clk_lookup msm_clocks_8x50[] = {CLK_LOOKUP ("usb_hs3_clk" , usb_hs3_clk.c,NULL ),CLK_LOOKUP ("usb_hs3_pclk" , usb_hs3_p_clk.c,NULL ),CLK_LOOKUP ("usb_phy_clk" , usb_phy_clk.c,NULL ), + +CLK_LOOKUP ("ebi1_clk" , ebi1_acpu_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_kgsl_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_lcdc_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_mddi_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_tv_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi1_usb_clk.c,NULL ), + CLK_LOOKUP("ebi1_clk", ebi1_vfe_clk.c, NULL), };unsigned msm_num_clocks_8x50 =ARRAY_SIZE (msm_clocks_8x50);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 12/34 msm: clock: Make most clk_*() operations optional
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Not all clock drivers want to implement support for all the clk_*() operations. Since only clk_enable(), clk_disable(), and clk_set_rate() are mandatory, allow the other clk_*() functions to be optionally implemented by subdrivers. Also make clk_enable() and clk_disable() optional so that clocks with no on/off support don't have to define empty clk_enable/disable ops.
--- arch/arm/mach-msm/clock.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 files changed, 34 insertions(+), 9 deletions(-)
arch/arm/mach-msm/clock.c +34 -9
@@ -1,7 +1,7 @@/* arch/arm/mach-msm/clock.c * * Copyright (C) 2007 Google, Inc. -* Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. +* Copyright (c) 2007-2011, Code Aurora Forum. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and
@@ -45,7 +45,8 @@ int clk_enable(struct clk *clk)if (ret) goto out; - ret = clk->ops->enable (clk); +if (clk->ops->enable) + ret = clk->ops->enable (clk);if (ret) {clk_disable (parent); goto out;
@@ -70,7 +71,8 @@ void clk_disable(struct clk *clk)BUG_ON (clk->count ==0 ); clk->count--;if (clk->count ==0 ) { - clk->ops->disable (clk); +if (clk->ops->disable) + clk->ops->disable (clk); parent =clk_get_parent (clk);clk_disable (parent); }
@@ -80,12 +82,18 @@ EXPORT_SYMBOL(clk_disable);int clk_reset (struct clk *clk,enum clk_reset_action action) { +if (!clk->ops->reset) +return -ENOSYS ; +return clk->ops->reset (clk, action); }EXPORT_SYMBOL (clk_reset);unsigned long clk_get_rate (struct clk *clk) { +if (!clk->ops->get_rate) +return 0 ; +return clk->ops->get_rate (clk); }EXPORT_SYMBOL (clk_get_rate);
@@ -93,6 +101,10 @@ EXPORT_SYMBOL(clk_get_rate);int clk_set_rate (struct clk *clk,unsigned long rate) {int ret; + +if (!clk->ops->set_rate) +return -ENOSYS ; +if (clk->flags &CLKFLAG_MAX ) { ret = clk->ops->set_max_rate (clk, rate);if (ret)
@@ -113,36 +125,46 @@ EXPORT_SYMBOL(clk_set_rate);long clk_round_rate (struct clk *clk,unsigned long rate) { +if (!clk->ops->round_rate) +return -ENOSYS ; +return clk->ops->round_rate (clk, rate); }EXPORT_SYMBOL (clk_round_rate);int clk_set_min_rate (struct clk *clk,unsigned long rate) { +if (!clk->ops->set_min_rate) +return -ENOSYS ; +return clk->ops->set_min_rate (clk, rate); }EXPORT_SYMBOL (clk_set_min_rate);int clk_set_max_rate (struct clk *clk,unsigned long rate) { +if (!clk->ops->set_max_rate) +return -ENOSYS ; +return clk->ops->set_max_rate (clk, rate); }EXPORT_SYMBOL (clk_set_max_rate);int clk_set_parent (struct clk *clk,struct clk *parent) { -if (clk->ops->set_parent) -return clk->ops->set_parent (clk, parent); -return -ENOSYS ; +if (!clk->ops->set_parent) +return 0 ; + +return clk->ops->set_parent (clk, parent); }EXPORT_SYMBOL (clk_set_parent);struct clk *clk_get_parent (struct clk *clk) { -if (clk->ops->get_parent) -return clk->ops->get_parent (clk); +if (!clk->ops->get_parent) +return NULL ; -return NULL ; +return clk->ops->get_parent (clk); }EXPORT_SYMBOL (clk_get_parent);
@@ -150,6 +172,9 @@ int clk_set_flags(struct clk *clk, unsigned long flags) {if (clk ==NULL ||IS_ERR (clk))return -EINVAL ; +if (!clk->ops->set_flags) +return -ENOSYS ; +return clk->ops->set_flags (clk, flags); }EXPORT_SYMBOL (clk_set_flags);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 13/34 msm: clock-debug: Implement a default is_enabled()
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Some clocks are simple enough that determining if they are enabled or disabled can be done by reading the 'count' member of struct clk. Implement support for such clocks in clock-debug.c so that these types of clocks don't need to implement the is_enabled() ops.
--- arch/arm/mach-msm/clock-debug.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-)
arch/arm/mach-msm/clock-debug.c +6 -1
@@ -65,9 +65,14 @@ static int clock_debug_enable_set(void *data, u64 val)static int clock_debug_enable_get (void *data,u64 *val) {struct clk *clock = data; +int enabled; - *val = clock->ops->is_enabled (clock); +if (clock->ops->is_enabled) + enabled = clock->ops->is_enabled (clock); +else + enabled = !!(clock->count); + *val = enabled;return 0 ; }
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 14/34 msm: proc_comm: Add CLKCTL_RPC_SRC_REQUEST
In reply to David BrownFrom: Stephen Boyd <[email protected]>
This proc_comm command is used to vote for crystal oscillators on 7x30/8x55 variants.
--- arch/arm/mach-msm/proc_comm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-msm/proc_comm.h +1 -0
@@ -137,6 +137,7 @@ enum {PCOM_CLKCTL_RPC_RAIL_DISABLE ,PCOM_CLKCTL_RPC_RAIL_CONTROL ,PCOM_CLKCTL_RPC_MIN_MSMC1 , +PCOM_CLKCTL_RPC_SRC_REQUEST , PCOM_NUM_CMDS, };
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 15/34 msm: clock: Add local clock control framework
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Based on code originally written by Saravana Kannan, rewritten by Matt Wagantall.
--- arch/arm/mach-msm/clock-local.c | 700 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/clock-local.h | 242 ++++++++++++++ 2 files changed, 942 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-msm/clock-local.c create mode 100644 arch/arm/mach-msm/clock-local.h
arch/arm/mach-msm/clock-local.c new file +700 -0
@@ -0,0 +1,700 @@ +/* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 and +* only version 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that 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. +*/ + +#define pr_fmt (fmt) "%s: " fmt, __func__ + +#include <linux/kernel.h> +#include <linux/init.h> +#include <linux/err.h> +#include <linux/ctype.h> +#include <linux/bitops.h> +#include <linux/io.h> +#include <linux/spinlock.h> +#include <linux/delay.h> +#include <linux/clk.h> + +#include <mach/clk.h> + +#include "clock.h" +#include "clock-local.h" + +/* +* When enabling/disabling a clock, check the halt bit up to this number +* number of times (with a 1 us delay in between) before continuing. +*/ +#define HALT_CHECK_MAX_LOOPS 100 +/* For clock without halt checking, wait this long after enables/disables. */ +#define HALT_CHECK_DELAY_US 10 + +DEFINE_SPINLOCK (local_clock_reg_lock); +struct clk_freq_tbl local_dummy_freq =F_END ; + +unsigned local_sys_vdd_votes[NUM_SYS_VDD_LEVELS ]; +static DEFINE_SPINLOCK (sys_vdd_vote_lock); + +/* +* Common Set-Rate Functions +*/ + +/* For clocks with MND dividers. */ +void set_rate_mnd (struct rcg_clk *clk,struct clk_freq_tbl *nf) +{ +u32 ns_reg_val, ctl_reg_val; + +/* Assert MND reset. */ + ns_reg_val =readl_relaxed (clk->ns_reg); + ns_reg_val |=BIT (7 ); +writel_relaxed (ns_reg_val, clk->ns_reg); + +/* Program M and D values. */ +writel_relaxed (nf->md_val, clk->md_reg); + +/* If the clock has a separate CC register, program it. */ +if (clk->ns_reg != clk->b.ctl_reg) { + ctl_reg_val =readl_relaxed (clk->b.ctl_reg); + ctl_reg_val &= ~(clk->ctl_mask); + ctl_reg_val |= nf->ctl_val; +writel_relaxed (ctl_reg_val, clk->b.ctl_reg); + } + +/* Deassert MND reset. */ + ns_reg_val &= ~BIT (7 ); +writel_relaxed (ns_reg_val, clk->ns_reg); +} + +void set_rate_nop (struct rcg_clk *clk,struct clk_freq_tbl *nf) +{ +/* +* Nothing to do for fixed-rate or integer-divider clocks. Any settings +* in NS registers are applied in the enable path, since power can be +* saved by leaving an un-clocked or slowly-clocked source selected +* until the clock is enabled. +*/ +} + +int (*soc_update_sys_vdd)(enum sys_vdd_level level); +/* +* SYS_VDD voting functions +*/ + +/* Update system voltage level given the current votes. */ +static int local_update_sys_vdd (void ) +{ +static int cur_level =NUM_SYS_VDD_LEVELS ; +int level, rc =0 ; + +if (local_sys_vdd_votes[HIGH ]) + level =HIGH ; +else if (local_sys_vdd_votes[NOMINAL ]) + level =NOMINAL ; +else if (local_sys_vdd_votes[LOW ]) + level =LOW ; +else + level =NONE ; + +if (level == cur_level) +return rc; + + rc =soc_update_sys_vdd (level); +if (!rc) + cur_level = level; + +return rc; +} + +/* Vote for a system voltage level. */ +int local_vote_sys_vdd (unsigned level) +{ +int rc =0 ; +unsigned long flags; + +/* Bounds checking. */ +if (level >=ARRAY_SIZE (local_sys_vdd_votes)) +return -EINVAL ; + +spin_lock_irqsave (&sys_vdd_vote_lock, flags); + local_sys_vdd_votes[level]++; + rc =local_update_sys_vdd (); +if (rc) + local_sys_vdd_votes[level]--; +spin_unlock_irqrestore (&sys_vdd_vote_lock, flags); + +return rc; +} + +/* Remove vote for a system voltage level. */ +int local_unvote_sys_vdd (unsigned level) +{ +int rc =0 ; +unsigned long flags; + +/* Bounds checking. */ +if (level >=ARRAY_SIZE (local_sys_vdd_votes)) +return -EINVAL ; + +spin_lock_irqsave (&sys_vdd_vote_lock, flags); + +if (WARN (!local_sys_vdd_votes[level], +"Reference counts are incorrect for level %d!\n" , level)) + goto out; + + local_sys_vdd_votes[level]--; + rc =local_update_sys_vdd (); +if (rc) + local_sys_vdd_votes[level]++; +out: +spin_unlock_irqrestore (&sys_vdd_vote_lock, flags); +return rc; +} +/* +* Clock enable/disable functions +*/ + +/* Return non-zero if a clock status registers shows the clock is halted. */ +static int branch_clk_is_halted (const struct branch *clk) +{ +int invert = (clk->halt_check ==ENABLE ); +int status_bit =readl_relaxed (clk->halt_reg) &BIT (clk->halt_bit); +return invert ? !status_bit : status_bit; +} + +static void __branch_clk_enable_reg (const struct branch *clk,const char *name) +{ +u32 reg_val; + +if (clk->en_mask) { + reg_val =readl_relaxed (clk->ctl_reg); + reg_val |= clk->en_mask; +writel_relaxed (reg_val, clk->ctl_reg); + } + +/* +* Use a memory barrier since some halt status registers are +* not within the same 1K segment as the branch/root enable +* registers. It's also needed in the udelay() case to ensure +* the delay starts after the branch enable. +*/ +mb (); + +/* Wait for clock to enable before returning. */ +if (clk->halt_check ==DELAY ) +udelay (HALT_CHECK_DELAY_US ); +else if (clk->halt_check ==ENABLE || clk->halt_check ==HALT + || clk->halt_check ==ENABLE_VOTED + || clk->halt_check ==HALT_VOTED ) { +int count; + +/* Wait up to HALT_CHECK_MAX_LOOPS for clock to enable. */ +for (count =HALT_CHECK_MAX_LOOPS ;branch_clk_is_halted (clk) + && count >0 ; count--) +udelay (1 ); +WARN (count ==0 ,"%s status stuck at 'off'" , name); + } +} + +/* Perform any register operations required to enable the clock. */ +static void __rcg_clk_enable_reg (struct rcg_clk *clk) +{ +u32 reg_val; +void __iomem *const reg = clk->b.ctl_reg; + +WARN (clk->current_freq == &local_dummy_freq, +"Attempting to enable %s before setting its rate. " +"Set the rate first!\n" , clk->c.dbg_name); + +/* +* Program the NS register, if applicable. NS registers are not +* set in the set_rate path because power can be saved by deferring +* the selection of a clocked source until the clock is enabled. +*/ +if (clk->ns_mask) { + reg_val =readl_relaxed (clk->ns_reg); + reg_val &= ~(clk->ns_mask); + reg_val |= (clk->current_freq->ns_val & clk->ns_mask); +writel_relaxed (reg_val, clk->ns_reg); + } + +/* Enable MN counter, if applicable. */ + reg_val =readl_relaxed (reg); +if (clk->current_freq->mnd_en_mask) { + reg_val |= clk->current_freq->mnd_en_mask; +writel_relaxed (reg_val, reg); + } +/* Enable root. */ +if (clk->root_en_mask) { + reg_val |= clk->root_en_mask; +writel_relaxed (reg_val, reg); + } +__branch_clk_enable_reg (&clk->b, clk->c.dbg_name); +} + +/* Perform any register operations required to disable the branch. */ +static u32 __branch_clk_disable_reg (const struct branch *clk,const char *name) +{ +u32 reg_val; + + reg_val =readl_relaxed (clk->ctl_reg); +if (clk->en_mask) { + reg_val &= ~(clk->en_mask); +writel_relaxed (reg_val, clk->ctl_reg); + } + +/* +* Use a memory barrier since some halt status registers are +* not within the same K segment as the branch/root enable +* registers. It's also needed in the udelay() case to ensure +* the delay starts after the branch disable. +*/ +mb (); + +/* Wait for clock to disable before continuing. */ +if (clk->halt_check ==DELAY || clk->halt_check ==ENABLE_VOTED + || clk->halt_check ==HALT_VOTED ) +udelay (HALT_CHECK_DELAY_US ); +else if (clk->halt_check ==ENABLE || clk->halt_check ==HALT ) { +int count; + +/* Wait up to HALT_CHECK_MAX_LOOPS for clock to disable. */ +for (count =HALT_CHECK_MAX_LOOPS ; !branch_clk_is_halted (clk) + && count >0 ; count--) +udelay (1 ); +WARN (count ==0 ,"%s status stuck at 'on'" , name); + } + +return reg_val; +} + +/* Perform any register operations required to disable the generator. */ +static void __rcg_clk_disable_reg (struct rcg_clk *clk) +{ +void __iomem *const reg = clk->b.ctl_reg; +u32 reg_val; + + reg_val =__branch_clk_disable_reg (&clk->b, clk->c.dbg_name); +/* Disable root. */ +if (clk->root_en_mask) { + reg_val &= ~(clk->root_en_mask); +writel_relaxed (reg_val, reg); + } +/* Disable MN counter, if applicable. */ +if (clk->current_freq->mnd_en_mask) { + reg_val &= ~(clk->current_freq->mnd_en_mask); +writel_relaxed (reg_val, reg); + } +/* +* Program NS register to low-power value with an un-clocked or +* slowly-clocked source selected. +*/ +if (clk->ns_mask) { + reg_val =readl_relaxed (clk->ns_reg); + reg_val &= ~(clk->ns_mask); + reg_val |= (clk->freq_tbl->ns_val & clk->ns_mask); +writel_relaxed (reg_val, clk->ns_reg); + } +} + +static void _rcg_clk_enable (struct rcg_clk *clk) +{ +unsigned long flags; + +spin_lock_irqsave (&local_clock_reg_lock, flags); +__rcg_clk_enable_reg (clk); + clk->enabled = true; +spin_unlock_irqrestore (&local_clock_reg_lock, flags); +} + +static void _rcg_clk_disable (struct rcg_clk *clk) +{ +unsigned long flags; + +spin_lock_irqsave (&local_clock_reg_lock, flags); +__rcg_clk_disable_reg (clk); + clk->enabled = false; +spin_unlock_irqrestore (&local_clock_reg_lock, flags); +} + +/* Enable a clock and any related power rail. */ +int rcg_clk_enable (struct clk *c) +{ +int rc; +struct rcg_clk *clk =to_rcg_clk (c); + + rc =local_vote_sys_vdd (clk->current_freq->sys_vdd); +if (rc) + goto err_vdd; + rc =clk_enable (clk->depends); +if (rc) + goto err_dep; +_rcg_clk_enable (clk); +return rc; + +err_dep: +local_unvote_sys_vdd (clk->current_freq->sys_vdd); +err_vdd: +return rc; +} + +/* Disable a clock and any related power rail. */ +void rcg_clk_disable (struct clk *c) +{ +struct rcg_clk *clk =to_rcg_clk (c); + +_rcg_clk_disable (clk); +clk_disable (clk->depends); +local_unvote_sys_vdd (clk->current_freq->sys_vdd); +} + +/* Turn off a clock at boot, without checking refcounts or disabling depends. */ +void rcg_clk_auto_off (struct clk *c) +{ +_rcg_clk_disable (to_rcg_clk (c)); +} + +/* +* Frequency-related functions +*/ + +/* Set a clock's frequency. */ +static int _rcg_clk_set_rate (struct rcg_clk *clk,struct clk_freq_tbl *nf) +{ +struct clk_freq_tbl *cf; +int rc =0 ; +struct clk *chld; +unsigned long flags; + +spin_lock_irqsave (&clk->c.lock, flags); + +/* Check if frequency is actually changed. */ + cf = clk->current_freq; +if (nf == cf) + goto unlock; + +if (clk->enabled) { +/* Vote for voltage and source for new freq. */ + rc =local_vote_sys_vdd (nf->sys_vdd); +if (rc) + goto unlock; + rc =clk_enable (nf->src_clk); +if (rc) { +local_unvote_sys_vdd (nf->sys_vdd); + goto unlock; + } + } + +spin_lock (&local_clock_reg_lock); + +/* Disable all branches to prevent glitches. */ +list_for_each_entry (chld, &clk->c.children, siblings) { +struct branch_clk *x =to_branch_clk (chld); +/* Don't bother turning off if it is already off. +* Checking ch->enabled is cheaper (cache) than reading +* and writing to a register (uncached/unbuffered). */ +if (x->enabled) +__branch_clk_disable_reg (&x->b, x->c.dbg_name); + } +if (clk->enabled) +__rcg_clk_disable_reg (clk); + +/* Perform clock-specific frequency switch operations. */ +BUG_ON (!clk->set_rate); + clk->set_rate (clk, nf); + +/* +* Current freq must be updated before __rcg_clk_enable_reg() +* is called to make sure the MNCNTR_EN bit is set correctly. +*/ + clk->current_freq = nf; + +if (clk->enabled) +__rcg_clk_enable_reg (clk); +/* Enable only branches that were ON before. */ +list_for_each_entry (chld, &clk->c.children, siblings) { +struct branch_clk *x =to_branch_clk (chld); +if (x->enabled) +__branch_clk_enable_reg (&x->b, x->c.dbg_name); + } + +spin_unlock (&local_clock_reg_lock); + +/* Release requirements of the old freq. */ +if (clk->enabled) { +clk_disable (cf->src_clk); +local_unvote_sys_vdd (cf->sys_vdd); + } +unlock: +spin_unlock_irqrestore (&clk->c.lock, flags); + +return rc; +} + +/* Set a clock to an exact rate. */ +int rcg_clk_set_rate (struct clk *c,unsigned rate) +{ +struct rcg_clk *clk =to_rcg_clk (c); +struct clk_freq_tbl *nf; + +for (nf = clk->freq_tbl; nf->freq_hz !=FREQ_END + && nf->freq_hz != rate; nf++) + ; + +if (nf->freq_hz ==FREQ_END ) +return -EINVAL ; + +return _rcg_clk_set_rate (clk, nf); +} + +/* Set a clock to a rate greater than some minimum. */ +int rcg_clk_set_min_rate (struct clk *c,unsigned rate) +{ +struct rcg_clk *clk =to_rcg_clk (c); +struct clk_freq_tbl *nf; + +for (nf = clk->freq_tbl; nf->freq_hz !=FREQ_END + && nf->freq_hz < rate; nf++) + ; + +if (nf->freq_hz ==FREQ_END ) +return -EINVAL ; + +return _rcg_clk_set_rate (clk, nf); +} + +/* Set a clock to a maximum rate. */ +int rcg_clk_set_max_rate (struct clk *clk,unsigned rate) +{ +return -EPERM ; +} + +/* Get the currently-set rate of a clock in Hz. */ +unsigned rcg_clk_get_rate (struct clk *c) +{ +struct rcg_clk *clk =to_rcg_clk (c); +unsigned long flags; +unsigned ret =0 ; + +spin_lock_irqsave (&local_clock_reg_lock, flags); + ret = clk->current_freq->freq_hz; +spin_unlock_irqrestore (&local_clock_reg_lock, flags); + +/* +* Return 0 if the rate has never been set. Might not be correct, +* but it's good enough. +*/ +if (ret ==FREQ_END ) + ret =0 ; + +return ret; +} + +/* Check if a clock is currently enabled. */ +unsigned rcg_clk_is_enabled (struct clk *clk) +{ +return to_rcg_clk (clk)->enabled; +} + +/* Return a supported rate that's at least the specified rate. */ +long rcg_clk_round_rate (struct clk *c,unsigned rate) +{ +struct rcg_clk *clk =to_rcg_clk (c); +struct clk_freq_tbl *f; + +for (f = clk->freq_tbl; f->freq_hz !=FREQ_END ; f++) +if (f->freq_hz >= rate) +return f->freq_hz; + +return -EPERM ; +} + +bool local_clk_is_local (struct clk *clk) +{ +return true; +} + +struct clk *rcg_clk_get_parent (struct clk *clk) +{ +return to_rcg_clk (clk)->current_freq->src_clk; +} + +static int pll_vote_clk_enable (struct clk *clk) +{ +u32 ena; +unsigned long flags; +struct pll_vote_clk *pll =to_pll_vote_clk (clk); + +spin_lock_irqsave (&local_clock_reg_lock, flags); + ena =readl_relaxed (pll->en_reg); + ena |= pll->en_mask; +writel_relaxed (ena, pll->en_reg); +spin_unlock_irqrestore (&local_clock_reg_lock, flags); + +/* Wait until PLL is enabled */ +while ((readl_relaxed (pll->status_reg) &BIT (16 )) ==0 ) +cpu_relax (); + +return 0 ; +} + +static void pll_vote_clk_disable (struct clk *clk) +{ +u32 ena; +unsigned long flags; +struct pll_vote_clk *pll =to_pll_vote_clk (clk); + +spin_lock_irqsave (&local_clock_reg_lock, flags); + ena =readl_relaxed (pll->en_reg); + ena &= ~(pll->en_mask); +writel_relaxed (ena, pll->en_reg); +spin_unlock_irqrestore (&local_clock_reg_lock, flags); +} + +static unsigned pll_vote_clk_get_rate (struct clk *clk) +{ +struct pll_vote_clk *pll =to_pll_vote_clk (clk); +return pll->rate; +} + +static struct clk *pll_vote_clk_get_parent (struct clk *clk) +{ +struct pll_vote_clk *pll =to_pll_vote_clk (clk); +return pll->parent; +} + +static unsigned pll_vote_clk_is_enabled (struct clk *clk) +{ +struct pll_vote_clk *pll =to_pll_vote_clk (clk); +return !!(readl_relaxed (pll->status_reg) &BIT (16 )); +} + +struct clk_ops clk_ops_pll_vote = { + .enable = pll_vote_clk_enable, + .disable = pll_vote_clk_disable, + .is_enabled = pll_vote_clk_is_enabled, + .get_rate = pll_vote_clk_get_rate, + .get_parent = pll_vote_clk_get_parent, + .is_local = local_clk_is_local, +}; + +struct clk_ops clk_ops_gnd = { + .get_rate = fixed_clk_get_rate, + .is_local = local_clk_is_local, +}; + +struct fixed_clk gnd_clk = { + .c = { + .dbg_name ="ground_clk" , + .ops = &clk_ops_gnd, +CLK_INIT (gnd_clk.c), + }, +}; + +int branch_clk_enable (struct clk *clk) +{ +int rc; +unsigned long flags; +struct branch_clk *branch =to_branch_clk (clk); + + rc =clk_enable (branch->depends); +if (rc) +return rc; + +spin_lock_irqsave (&local_clock_reg_lock, flags); +__branch_clk_enable_reg (&branch->b, branch->c.dbg_name); + branch->enabled = true; +spin_unlock_irqrestore (&local_clock_reg_lock, flags); + +return 0 ; +} + +void branch_clk_disable (struct clk *clk) +{ +unsigned long flags; +struct branch_clk *branch =to_branch_clk (clk); + +spin_lock_irqsave (&local_clock_reg_lock, flags); +__branch_clk_disable_reg (&branch->b, branch->c.dbg_name); + branch->enabled = false; +spin_unlock_irqrestore (&local_clock_reg_lock, flags); + +clk_disable (branch->depends); +} + +struct clk *branch_clk_get_parent (struct clk *clk) +{ +struct branch_clk *branch =to_branch_clk (clk); +return branch->parent; +} + +int branch_clk_set_parent (struct clk *clk,struct clk *parent) +{ +/* +* We setup the parent pointer at init time in msm_clock_init(). +* This check is to make sure drivers can't change the parent. +*/ +if (parent &&list_empty (&clk->siblings)) { +list_add (&clk->siblings, &parent->children); +return 0 ; + } +return -EINVAL ; +} + +unsigned branch_clk_is_enabled (struct clk *clk) +{ +struct branch_clk *branch =to_branch_clk (clk); +return branch->enabled; +} + +void branch_clk_auto_off (struct clk *clk) +{ +struct branch_clk *branch =to_branch_clk (clk); +unsigned long flags; + +spin_lock_irqsave (&local_clock_reg_lock, flags); +__branch_clk_disable_reg (&branch->b, branch->c.dbg_name); +spin_unlock_irqrestore (&local_clock_reg_lock, flags); +} + +int branch_reset (struct branch *clk,enum clk_reset_action action) +{ +int ret =0 ; +u32 reg_val; +unsigned long flags; + +if (!clk->reset_reg) +return -EPERM ; + +spin_lock_irqsave (&local_clock_reg_lock, flags); + + reg_val =readl_relaxed (clk->reset_reg); +switch (action) { +case CLK_RESET_ASSERT : + reg_val |= clk->reset_mask; +break ; +case CLK_RESET_DEASSERT : + reg_val &= ~(clk->reset_mask); +break ; +default : + ret = -EINVAL ; + } +writel_relaxed (reg_val, clk->reset_reg); + +spin_unlock_irqrestore (&local_clock_reg_lock, flags); + +/* Make sure write is issued before returning. */ +mb (); + +return ret; +} + +int branch_clk_reset (struct clk *clk,enum clk_reset_action action) +{ +return branch_reset (&to_branch_clk (clk)->b, action); +}
arch/arm/mach-msm/clock-local.h new file +242 -0
242 lines not on this page · raw message
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 16/34 msm: clock-pcom: Expose pc_clk_reset
In reply to David BrownFrom: Stephen Boyd <[email protected]>
The 7x30 clock driver needs to perform clock resets and the only way that is possible is through proc_comm. Expose the reset functionality as a new function callable from the 7x30 clock driver.
--- arch/arm/mach-msm/clock-pcom.c | 13 +++++++++---- arch/arm/mach-msm/clock-pcom.h | 2 ++ 2 files changed, 11 insertions(+), 4 deletions(-)
arch/arm/mach-msm/clock-pcom.c +9 -4
@@ -41,10 +41,9 @@ static void pc_clk_disable(struct clk *clk)msm_proc_comm (PCOM_CLKCTL_RPC_DISABLE , &id,NULL ); } -int pc_clk_reset (struct clk *clk,enum clk_reset_action action) +int pc_clk_reset (unsigned id,enum clk_reset_action action) {int rc; -unsigned id =to_pcom_clk (clk)->id;if (action ==CLK_RESET_ASSERT ) rc =msm_proc_comm (PCOM_CLKCTL_RPC_RESET_ASSERT , &id,NULL );
@@ -57,6 +56,12 @@ int pc_clk_reset(struct clk *clk, enum clk_reset_action action)return (int )id <0 ? -EINVAL :0 ; } +static int pc_reset (struct clk *clk,enum clk_reset_action action) +{ +unsigned id =to_pcom_clk (clk)->id; +return pc_clk_reset (id, action); +} +static int pc_clk_set_rate (struct clk *clk,unsigned rate) {/* The rate _might_ be rounded off to the nearest KHz value by the
@@ -135,7 +140,7 @@ struct clk_ops clk_ops_pcom = { .enable = pc_clk_enable, .disable = pc_clk_disable, .auto_off = pc_clk_disable, - .reset = pc_clk_reset, + .reset = pc_reset, .set_rate = pc_clk_set_rate, .set_min_rate = pc_clk_set_min_rate, .set_max_rate = pc_clk_set_max_rate,
@@ -165,7 +170,7 @@ struct clk_ops clk_ops_pcom_div2 = { .enable = pc_clk_enable, .disable = pc_clk_disable, .auto_off = pc_clk_disable, - .reset = pc_clk_reset, + .reset = pc_reset, .set_rate = pc_clk_set_rate2, .set_min_rate = pc_clk_set_min_rate2, .set_flags = pc_clk_set_flags,
arch/arm/mach-msm/clock-pcom.h +2 -0
@@ -120,6 +120,8 @@#define P_NR_CLKS 102 +extern int pc_clk_reset (unsigned id,enum clk_reset_action action); +struct clk_ops ;extern struct clk_ops clk_ops_pcom;extern struct clk_ops clk_ops_pcom_div2;
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 17/34 msm: clock: Add 7x30 local clock support
In reply to David BrownFrom: Saravana Kannan <[email protected]>
Support locally controllable clocks on 7x30.
--- arch/arm/mach-msm/Makefile | 1 + arch/arm/mach-msm/clock-7x30.c | 2784 +++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/clock-7x30.h | 143 -- arch/arm/mach-msm/clock.c | 3 + arch/arm/mach-msm/clock.h | 6 + arch/arm/mach-msm/devices-msm7x30.c | 181 --- 6 files changed, 2794 insertions(+), 324 deletions(-) create mode 100644 arch/arm/mach-msm/clock-7x30.c delete mode 100644 arch/arm/mach-msm/clock-7x30.h
arch/arm/mach-msm/Makefile +1 -0
@@ -2,6 +2,7 @@ obj-y += io.o idle.o timer.o obj-y += clock.o obj-y += clock-voter.o obj-$(CONFIG_DEBUG_FS) += clock-debug.o +obj-$(CONFIG_ARCH_MSM7X30) += clock-local.o clock-7x30.o obj-$(CONFIG_MSM_VIC) += irq-vic.o obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
arch/arm/mach-msm/clock-7x30.c new file +2784 -0
2,784 lines not on this page · raw message
arch/arm/mach-msm/clock-7x30.h deleted +0 -143
143 lines not on this page · raw message
arch/arm/mach-msm/clock.c +3 -0
@@ -186,6 +186,9 @@ void __init msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks) {unsigned n; +/* Do SoC-speficic clock init operations. */ +msm_clk_soc_init (); +for (n =0 ; n < num_clocks; n++) {struct clk *clk = clock_tbl[n].clk;struct clk *parent =clk_get_parent (clk);
arch/arm/mach-msm/clock.h +6 -0
@@ -72,6 +72,12 @@ struct clk {#define CLK_MAX CLKFLAG_MAX#define CLK_MINMAX (CLK_MIN | CLK_MAX) +#if defined(CONFIG_ARCH_MSM7X30 ) +void __init msm_clk_soc_init (void ); +#else +static inline void __init msm_clk_soc_init (void ) { } +#endif +#ifdef CONFIG_DEBUG_FS int __init clock_debug_init (void );int __init clock_debug_add (struct clk *clock);
arch/arm/mach-msm/devices-msm7x30.c +0 -181
45 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Part of the diff is not shown here. View the raw message.
RFC PATCH 18/34 msm: clock-local: Add support for 8x60 clock types
In reply to David BrownFrom: Matt Wagantall <[email protected]>
--- arch/arm/mach-msm/clock-local.c | 290 ++++++++++++++++++++++++++++++++++++--- arch/arm/mach-msm/clock-local.h | 47 ++++++- 2 files changed, 318 insertions(+), 19 deletions(-)
arch/arm/mach-msm/clock-local.c +272 -18
@@ -81,11 +81,185 @@ void set_rate_nop(struct rcg_clk *clk, struct clk_freq_tbl *nf)*/ } -int (*soc_update_sys_vdd)(enum sys_vdd_level level); +void set_rate_mnd_8 (struct rcg_clk *clk,struct clk_freq_tbl *nf) +{ +u32 ctl_reg_val; + +/* Assert MND reset. */ + ctl_reg_val =readl_relaxed (clk->b.ctl_reg); + ctl_reg_val |=BIT (8 ); +writel_relaxed (ctl_reg_val, clk->b.ctl_reg); + +/* Program M and D values. */ +writel_relaxed (nf->md_val, clk->md_reg); + +/* Program MN counter Enable and Mode. */ + ctl_reg_val &= ~(clk->ctl_mask); + ctl_reg_val |= nf->ctl_val; +writel_relaxed (ctl_reg_val, clk->b.ctl_reg); + +/* Deassert MND reset. */ + ctl_reg_val &= ~BIT (8 ); +writel_relaxed (ctl_reg_val, clk->b.ctl_reg); +} + +void set_rate_mnd_banked (struct rcg_clk *clk,struct clk_freq_tbl *nf) +{ +struct bank_masks *banks = clk->bank_masks; +const struct bank_mask_info *new_bank_masks; +const struct bank_mask_info *old_bank_masks; +u32 ns_reg_val, ctl_reg_val; +u32 bank_sel; + +/* +* Determine active bank and program the other one. If the clock is +* off, program the active bank since bank switching won't work if +* both banks aren't running. +*/ + ctl_reg_val =readl_relaxed (clk->b.ctl_reg); + bank_sel = !!(ctl_reg_val & banks->bank_sel_mask); +/* If clock isn't running, don't switch banks. */ + bank_sel ^= (!clk->enabled || clk->current_freq->freq_hz ==0 ); +if (bank_sel ==0 ) { + new_bank_masks = &banks->bank1_mask; + old_bank_masks = &banks->bank0_mask; + }else { + new_bank_masks = &banks->bank0_mask; + old_bank_masks = &banks->bank1_mask; + } + + ns_reg_val =readl_relaxed (clk->ns_reg); + +/* Assert bank MND reset. */ + ns_reg_val |= new_bank_masks->rst_mask; +writel_relaxed (ns_reg_val, clk->ns_reg); + +/* +* Program NS only if the clock is enabled, since the NS will be set +* as part of the enable procedure and should remain with a low-power +* MUX input selected until then. +*/ +if (clk->enabled) { + ns_reg_val &= ~(new_bank_masks->ns_mask); + ns_reg_val |= (nf->ns_val & new_bank_masks->ns_mask); +writel_relaxed (ns_reg_val, clk->ns_reg); + } + +writel_relaxed (nf->md_val, new_bank_masks->md_reg); + +/* Enable counter only if clock is enabled. */ +if (clk->enabled) + ctl_reg_val |= new_bank_masks->mnd_en_mask; +else + ctl_reg_val &= ~(new_bank_masks->mnd_en_mask); + + ctl_reg_val &= ~(new_bank_masks->mode_mask); + ctl_reg_val |= (nf->ctl_val & new_bank_masks->mode_mask); +writel_relaxed (ctl_reg_val, clk->b.ctl_reg); + +/* Deassert bank MND reset. */ + ns_reg_val &= ~(new_bank_masks->rst_mask); +writel_relaxed (ns_reg_val, clk->ns_reg); + +/* +* Switch to the new bank if clock is running. If it isn't, then +* no switch is necessary since we programmed the active bank. +*/ +if (clk->enabled && clk->current_freq->freq_hz) { + ctl_reg_val ^= banks->bank_sel_mask; +writel_relaxed (ctl_reg_val, clk->b.ctl_reg); +/* +* Wait at least 6 cycles of slowest bank's clock +* for the glitch-free MUX to fully switch sources. +*/ +mb (); +udelay (1 ); + +/* Disable old bank's MN counter. */ + ctl_reg_val &= ~(old_bank_masks->mnd_en_mask); +writel_relaxed (ctl_reg_val, clk->b.ctl_reg); + +/* Program old bank to a low-power source and divider. */ + ns_reg_val &= ~(old_bank_masks->ns_mask); + ns_reg_val |= (clk->freq_tbl->ns_val & old_bank_masks->ns_mask); +writel_relaxed (ns_reg_val, clk->ns_reg); + } + +/* +* If this freq requires the MN counter to be enabled, +* update the enable mask to match the current bank. +*/ +if (nf->mnd_en_mask) + nf->mnd_en_mask = new_bank_masks->mnd_en_mask; +/* Update the NS mask to match the current bank. */ + clk->ns_mask = new_bank_masks->ns_mask; +} + +void set_rate_div_banked (struct rcg_clk *clk,struct clk_freq_tbl *nf) +{ +struct bank_masks *banks = clk->bank_masks; +const struct bank_mask_info *new_bank_masks; +const struct bank_mask_info *old_bank_masks; +u32 ns_reg_val, bank_sel; + +/* +* Determine active bank and program the other one. If the clock is +* off, program the active bank since bank switching won't work if +* both banks aren't running. +*/ + ns_reg_val =readl_relaxed (clk->ns_reg); + bank_sel = !!(ns_reg_val & banks->bank_sel_mask); +/* If clock isn't running, don't switch banks. */ + bank_sel ^= (!clk->enabled || clk->current_freq->freq_hz ==0 ); +if (bank_sel ==0 ) { + new_bank_masks = &banks->bank1_mask; + old_bank_masks = &banks->bank0_mask; + }else { + new_bank_masks = &banks->bank0_mask; + old_bank_masks = &banks->bank1_mask; + } + +/* +* Program NS only if the clock is enabled, since the NS will be set +* as part of the enable procedure and should remain with a low-power +* MUX input selected until then. +*/ +if (clk->enabled) { + ns_reg_val &= ~(new_bank_masks->ns_mask); + ns_reg_val |= (nf->ns_val & new_bank_masks->ns_mask); +writel_relaxed (ns_reg_val, clk->ns_reg); + } + +/* +* Switch to the new bank if clock is running. If it isn't, then +* no switch is necessary since we programmed the active bank. +*/ +if (clk->enabled && clk->current_freq->freq_hz) { + ns_reg_val ^= banks->bank_sel_mask; +writel_relaxed (ns_reg_val, clk->ns_reg); +/* +* Wait at least 6 cycles of slowest bank's clock +* for the glitch-free MUX to fully switch sources. +*/ +mb (); +udelay (1 ); + +/* Program old bank to a low-power source and divider. */ + ns_reg_val &= ~(old_bank_masks->ns_mask); + ns_reg_val |= (clk->freq_tbl->ns_val & old_bank_masks->ns_mask); +writel_relaxed (ns_reg_val, clk->ns_reg); + } + +/* Update the NS mask to match the current bank. */ + clk->ns_mask = new_bank_masks->ns_mask; +} +/* * SYS_VDD voting functions */ +int (*soc_update_sys_vdd)(enum sys_vdd_level level); +/* Update system voltage level given the current votes. */ static int local_update_sys_vdd (void ) {
@@ -392,17 +566,22 @@ static int _rcg_clk_set_rate(struct rcg_clk *clk, struct clk_freq_tbl *nf)spin_lock (&local_clock_reg_lock); -/* Disable all branches to prevent glitches. */ -list_for_each_entry (chld, &clk->c.children, siblings) { -struct branch_clk *x =to_branch_clk (chld); -/* Don't bother turning off if it is already off. -* Checking ch->enabled is cheaper (cache) than reading -* and writing to a register (uncached/unbuffered). */ -if (x->enabled) -__branch_clk_disable_reg (&x->b, x->c.dbg_name); +/* Disable branch if clock isn't dual-banked with a glitch-free MUX. */ +if (clk->bank_masks ==NULL ) { +/* Disable all branches to prevent glitches. */ +list_for_each_entry (chld, &clk->c.children, siblings) { +struct branch_clk *x =to_branch_clk (chld); +/* +* We don't need to grab the child's lock because +* we hold the local_clock_reg_lock and 'enabled' is +* only modified within lock. +*/ +if (x->enabled) +__branch_clk_disable_reg (&x->b, x->c.dbg_name); + } +if (clk->enabled) +__rcg_clk_disable_reg (clk); } -if (clk->enabled) -__rcg_clk_disable_reg (clk);/* Perform clock-specific frequency switch operations. */ BUG_ON (!clk->set_rate);
@@ -414,13 +593,16 @@ static int _rcg_clk_set_rate(struct rcg_clk *clk, struct clk_freq_tbl *nf)*/ clk->current_freq = nf; -if (clk->enabled) -__rcg_clk_enable_reg (clk); -/* Enable only branches that were ON before. */ -list_for_each_entry (chld, &clk->c.children, siblings) { -struct branch_clk *x =to_branch_clk (chld); -if (x->enabled) -__branch_clk_enable_reg (&x->b, x->c.dbg_name); +/* Enable any clocks that were disabled. */ +if (clk->bank_masks ==NULL ) { +if (clk->enabled) +__rcg_clk_enable_reg (clk); +/* Enable only branches that were ON before. */ +list_for_each_entry (chld, &clk->c.children, siblings) { +struct branch_clk *x =to_branch_clk (chld); +if (x->enabled) +__branch_clk_enable_reg (&x->b, x->c.dbg_name); + } }spin_unlock (&local_clock_reg_lock);
@@ -583,6 +765,78 @@ struct clk_ops clk_ops_pll_vote = { .is_local = local_clk_is_local, }; +static int pll_clk_enable (struct clk *clk) +{ +u32 mode; +unsigned long flags; +struct pll_clk *pll =to_pll_clk (clk); + +spin_lock_irqsave (&local_clock_reg_lock, flags); + mode =readl_relaxed (pll->mode_reg); +/* Disable PLL bypass mode. */ + mode |=BIT (1 ); +writel_relaxed (mode, pll->mode_reg); + +/* +* H/W requires a 5us delay between disabling the bypass and +* de-asserting the reset. Delay 10us just to be safe. +*/ +mb (); +udelay (10 ); + +/* De-assert active-low PLL reset. */ + mode |=BIT (2 ); +writel_relaxed (mode, pll->mode_reg); + +/* Wait until PLL is locked. */ +mb (); +udelay (50 ); + +/* Enable PLL output. */ + mode |=BIT (0 ); +writel_relaxed (mode, pll->mode_reg); + +spin_unlock_irqrestore (&local_clock_reg_lock, flags); +return 0 ; +} + +static void pll_clk_disable (struct clk *clk) +{ +u32 mode; +unsigned long flags; +struct pll_clk *pll =to_pll_clk (clk); + +/* +* Disable the PLL output, disable test mode, enable +* the bypass mode, and assert the reset. +*/ +spin_lock_irqsave (&local_clock_reg_lock, flags); + mode =readl_relaxed (pll->mode_reg); + mode &= ~BM (3 ,0 ); +writel_relaxed (mode, pll->mode_reg); +spin_unlock_irqrestore (&local_clock_reg_lock, flags); +} + +static unsigned pll_clk_get_rate (struct clk *clk) +{ +struct pll_clk *pll =to_pll_clk (clk); +return pll->rate; +} + +static struct clk *pll_clk_get_parent (struct clk *clk) +{ +struct pll_clk *pll =to_pll_clk (clk); +return pll->parent; +} + +struct clk_ops clk_ops_pll = { + .enable = pll_clk_enable, + .disable = pll_clk_disable, + .get_rate = pll_clk_get_rate, + .get_parent = pll_clk_get_parent, + .is_local = local_clk_is_local, +}; +struct clk_ops clk_ops_gnd = { .get_rate = fixed_clk_get_rate, .is_local = local_clk_is_local,
arch/arm/mach-msm/clock-local.h +46 -1
78 lines not on this page · raw message
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 19/34 msm: clock: Add 8x60 clock support
In reply to David BrownFrom: Matt Wagantall <[email protected]>
Use the clock-local framework to implement the APIs necessary for configuring the msm8x60's peripheral and multimedia clocks.
This includes support for clock gating, managing PLL and XO source requirements, and setting rates. The driver also applies any voltage constraints associated with the frequencies, and provides a means of asserting reset signals for the clock domains.
Tables of discrete frequency levels are used to ensure rates with minimal jitter, power requirements, and interference potential are used whenever possible, though the tables are extensible.
--- arch/arm/mach-msm/Makefile | 1 + arch/arm/mach-msm/board-msm8x60.c | 11 + arch/arm/mach-msm/clock-8x60.c | 3447 +++++++++++++++++++++++ arch/arm/mach-msm/clock-8x60.h | 293 ++ arch/arm/mach-msm/clock.h | 2 +- arch/arm/mach-msm/devices.h | 3 + arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | 12 + arch/arm/mach-msm/io.c | 3 + 8 files changed, 3771 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-msm/clock-8x60.c create mode 100644 arch/arm/mach-msm/clock-8x60.h
arch/arm/mach-msm/Makefile +1 -0
@@ -3,6 +3,7 @@ obj-y += clock.o obj-y += clock-voter.o obj-$(CONFIG_DEBUG_FS) += clock-debug.o obj-$(CONFIG_ARCH_MSM7X30) += clock-local.o clock-7x30.o +obj-$(CONFIG_ARCH_MSM8X60) += clock-local.o clock-8x60.o obj-$(CONFIG_MSM_VIC) += irq-vic.o obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
arch/arm/mach-msm/board-msm8x60.c +11 -0
@@ -30,6 +30,8 @@#include <mach/board.h> #include <mach/msm_iomap.h> +#include "devices.h" +static void __init msm8x60_fixup (struct machine_desc *desc,struct tag *tag,char **cmdline,struct meminfo *mi) {
@@ -51,6 +53,11 @@ static void __init msm8x60_map_io(void)msm_map_msm8x60_io (); } +static void __init msm8x60_init_early (void ) +{ +msm_clock_init (msm_clocks_8x60, msm_num_clocks_8x60); +} +static void __init msm8x60_init_irq (void ) { gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
@@ -74,6 +81,7 @@ MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3") .fixup = msm8x60_fixup, .reserve = msm8x60_reserve, .map_io = msm8x60_map_io, + .init_early = msm8x60_init_early, .init_irq = msm8x60_init_irq, .init_machine = msm8x60_init, .timer = &msm_timer,
@@ -83,6 +91,7 @@ MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF") .fixup = msm8x60_fixup, .reserve = msm8x60_reserve, .map_io = msm8x60_map_io, + .init_early = msm8x60_init_early, .init_irq = msm8x60_init_irq, .init_machine = msm8x60_init, .timer = &msm_timer,
@@ -92,6 +101,7 @@ MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR") .fixup = msm8x60_fixup, .reserve = msm8x60_reserve, .map_io = msm8x60_map_io, + .init_early = msm8x60_init_early, .init_irq = msm8x60_init_irq, .init_machine = msm8x60_init, .timer = &msm_timer,
@@ -101,6 +111,7 @@ MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA") .fixup = msm8x60_fixup, .reserve = msm8x60_reserve, .map_io = msm8x60_map_io, + .init_early = msm8x60_init_early, .init_irq = msm8x60_init_irq, .init_machine = msm8x60_init, .timer = &msm_timer,
arch/arm/mach-msm/clock-8x60.c new file +3447 -0
2,946 lines not on this page · raw message
arch/arm/mach-msm/clock-8x60.h new file +293 -0
293 lines not on this page · raw message
arch/arm/mach-msm/include/mach/msm_iomap-8x60.h +12 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Part of the diff is not shown here. View the raw message.
RFC PATCH 20/34 msm: clock: Add list_rate debugfs nodes for locally-controlled clocks
In reply to David BrownFrom: Matt Wagantall <[email protected]>
Add debugfs nodes to list all of the supported rates for rate-settable locally-controlled clocks. This allows a clock's supported rates to be queried from userspace, and allows more comprehensive userspace clock tests to be developed.
--- arch/arm/mach-msm/clock-7x30.c | 1 + arch/arm/mach-msm/clock-8x60.c | 1 + arch/arm/mach-msm/clock-debug.c | 30 ++++++++++++++++++++++++++++++ arch/arm/mach-msm/clock-local.c | 11 +++++++++++ arch/arm/mach-msm/clock.h | 1 + 5 files changed, 44 insertions(+), 0 deletions(-)
arch/arm/mach-msm/clock-7x30.c +1 -0
@@ -2763,6 +2763,7 @@ static struct clk_ops soc_clk_ops_7x30 = { .set_min_rate = rcg_clk_set_min_rate, .set_max_rate = rcg_clk_set_max_rate, .get_rate = rcg_clk_get_rate, + .list_rate = rcg_clk_list_rate, .is_enabled = rcg_clk_is_enabled, .round_rate = rcg_clk_round_rate, .reset = msm7x30_clk_reset,
arch/arm/mach-msm/clock-8x60.c +1 -0
@@ -462,6 +462,7 @@ static struct clk_ops soc_clk_ops_8x60 = { .set_min_rate = rcg_clk_set_min_rate, .set_max_rate = rcg_clk_set_max_rate, .get_rate = rcg_clk_get_rate, + .list_rate = rcg_clk_list_rate, .is_enabled = rcg_clk_is_enabled, .round_rate = rcg_clk_round_rate, .reset = soc_clk_reset,
arch/arm/mach-msm/clock-debug.c +30 -0
@@ -17,6 +17,7 @@#include <linux/module.h> #include <linux/ctype.h> #include <linux/debugfs.h> +#include <linux/seq_file.h> #include <linux/clk.h> #include "clock.h"
@@ -101,6 +102,29 @@ int __init clock_debug_init(void)return 0 ; } +static int list_rates_show (struct seq_file *m,void *unused) +{ +struct clk *clock = m->private; +int rate, i =0 ; + +while ((rate = clock->ops->list_rate (clock, i++)) >=0 ) +seq_printf (m,"%d\n" , rate); + +return 0 ; +} + +static int list_rates_open (struct inode *inode,struct file *file) +{ +return single_open (file, list_rates_show, inode->i_private); +} + +static const struct file_operations list_rates_fops = { + .open = list_rates_open, + .read = seq_read, + .llseek = seq_lseek, + .release = seq_release, +}; +int __init clock_debug_add (struct clk *clock) {char temp[50 ], *ptr;
@@ -128,6 +152,12 @@ int __init clock_debug_add(struct clk *clock)if (!debugfs_create_file ("is_local" ,S_IRUGO , clk_dir, clock, &clock_local_fops)) goto error; + +if (clock->ops->list_rate) +if (!debugfs_create_file ("list_rates" , +S_IRUGO , clk_dir, clock, &list_rates_fops)) + goto error; +return 0 ; error:debugfs_remove_recursive (clk_dir);
arch/arm/mach-msm/clock-local.c +11 -0
@@ -701,6 +701,17 @@ bool local_clk_is_local(struct clk *clk)return true; } +/* Return the nth supported frequency for a given clock. */ +int rcg_clk_list_rate (struct clk *c,unsigned n) +{ +struct rcg_clk *clk =to_rcg_clk (c); + +if (!clk->freq_tbl || clk->freq_tbl->freq_hz ==FREQ_END ) +return -ENXIO ; + +return (clk->freq_tbl + n)->freq_hz; +} +struct clk *rcg_clk_get_parent (struct clk *clk) {return to_rcg_clk (clk)->current_freq->src_clk;
arch/arm/mach-msm/clock.h +1 -0
@@ -42,6 +42,7 @@ struct clk_ops {int (*set_max_rate)(struct clk *clk,unsigned rate);int (*set_flags)(struct clk *clk,unsigned flags);unsigned (*get_rate)(struct clk *clk); +int (*list_rate)(struct clk *clk,unsigned n);unsigned (*is_enabled)(struct clk *clk);long (*round_rate)(struct clk *clk,unsigned rate);int (*set_parent)(struct clk *clk,struct clk *parent);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 21/34 msm: clock: Add debugfs interface to measure clock rates
In reply to David BrownFrom: Matt Wagantall <[email protected]>
Use the SoC's ring oscillator hardware to measure the clock rate of locally-controlled clocks. This allows for the development of more comprehensive end-to-end clock tests.
A 'measure' debugfs node is created for each clock to perform the measurement and retrieve the result. soc_clk_measure_rate() should *only* be used for debug purposes since it busy-loops while the measurement takes place (~15 ms).
Clock rates are in units of Hz. Clocks that don't support rate measurement will return -1.
--- arch/arm/mach-msm/clock-7x30.c | 239 ++++++++++++++++++++++++++++ arch/arm/mach-msm/clock-8x60.c | 333 ++++++++++++++++++++++++++++++++++++-- arch/arm/mach-msm/clock-debug.c | 36 ++++- arch/arm/mach-msm/clock.h | 2 +- 4 files changed, 589 insertions(+), 21 deletions(-)
arch/arm/mach-msm/clock-7x30.c +239 -0
@@ -2426,6 +2426,244 @@ out:return rc; } +#ifdef CONFIG_DEBUG_FS + +#define CLK_TEST_2 (s) (s) +#define CLK_TEST_HS (s) (0x4000 | ((s) << 8)) +#define CLK_TEST_LS (s) (0x4D40 | (s)) + +struct measure_sel { +u32 test_vector; +struct clk *clk; +}; + +static struct measure_sel measure_mux[] = { + {CLK_TEST_2 (0x03 ), &emdh_p_clk.c }, + {CLK_TEST_2 (0x04 ), &pmdh_p_clk.c }, + {CLK_TEST_2 (0x06 ), &mdp_p_clk.c }, + {CLK_TEST_2 (0x07 ), &lpa_p_clk.c }, + {CLK_TEST_2 (0x08 ), &usb_hs2_p_clk.c }, + {CLK_TEST_2 (0x09 ), &spi_clk.c }, + {CLK_TEST_2 (0x0A ), &midi_clk.c }, + {CLK_TEST_2 (0x0B ), &i2c_2_clk.c }, + {CLK_TEST_2 (0x0D ), &mi2s_m_clk.c }, + {CLK_TEST_2 (0x0E ), &lpa_core_clk.c }, + {CLK_TEST_2 (0x0F ), &lpa_codec_clk.c }, + {CLK_TEST_2 (0x10 ), &usb_hs3_p_clk.c }, + {CLK_TEST_2 (0x11 ), &adm_p_clk.c }, + {CLK_TEST_2 (0x13 ), &hdmi_clk.c }, + {CLK_TEST_2 (0x14 ), &usb_hs_core_clk.c }, + {CLK_TEST_2 (0x15 ), &usb_hs2_core_clk.c }, + {CLK_TEST_2 (0x16 ), &usb_hs3_core_clk.c }, + {CLK_TEST_2 (0x17 ), &mi2s_codec_tx_s_clk.c }, + {CLK_TEST_2 (0x18 ), &spi_p_clk.c }, + {CLK_TEST_2 (0x1A ), &camif_pad_p_clk.c }, + {CLK_TEST_2 (0x1C ), &qup_i2c_clk.c }, + {CLK_TEST_2 (0x1F ), &mfc_div2_clk.c }, + {CLK_TEST_2 (0x38 ), &mfc_clk.c }, + + {CLK_TEST_HS (0x00 ), &adm_clk.c }, + {CLK_TEST_HS (0x01 ), &mdp_lcdc_pad_pclk_clk.c }, + {CLK_TEST_HS (0x02 ), &mdp_lcdc_pclk_clk.c }, + {CLK_TEST_HS (0x03 ), &axi_rotator_clk.c }, + {CLK_TEST_HS (0x07 ), &axi_li_vg_clk.c }, + {CLK_TEST_HS (0x09 ), &axi_li_apps_clk.c }, + {CLK_TEST_HS (0x0E ), &axi_li_jpeg_clk.c }, + {CLK_TEST_HS (0x0F ), &emdh_clk.c }, + {CLK_TEST_HS (0x14 ), &mdp_clk.c }, + {CLK_TEST_HS (0x15 ), &pmdh_clk.c }, + {CLK_TEST_HS (0x19 ), &axi_grp_2d_clk.c }, + {CLK_TEST_HS (0x1A ), &axi_li_grp_clk.c }, + {CLK_TEST_HS (0x1B ), &axi_li_vfe_clk.c }, + {CLK_TEST_HS (0x1C ), &grp_2d_clk.c }, + {CLK_TEST_HS (0x1E ), &grp_3d_clk.c }, + {CLK_TEST_HS (0x1F ), &imem_clk.c }, + {CLK_TEST_HS (0x20 ), &jpeg_clk.c }, + {CLK_TEST_HS (0x24 ), &axi_li_adsp_a_clk.c }, + {CLK_TEST_HS (0x26 ), &rotator_imem_clk.c }, + {CLK_TEST_HS (0x27 ), &axi_vpe_clk.c }, + {CLK_TEST_HS (0x2A ), &axi_mfc_clk.c }, + {CLK_TEST_HS (0x2B ), &axi_mdp_clk.c }, + {CLK_TEST_HS (0x2C ), &vpe_clk.c }, + {CLK_TEST_HS (0x30 ), &vfe_camif_clk.c }, + {CLK_TEST_HS (0x31 ), &csi0_clk.c }, + {CLK_TEST_HS (0x32 ), &csi0_vfe_clk.c }, + {CLK_TEST_HS (0x33 ), &csi0_p_clk.c }, + + {CLK_TEST_LS (0x03 ), &ce_clk.c }, + {CLK_TEST_LS (0x04 ), &cam_m_clk.c }, + {CLK_TEST_LS (0x0C ), &grp_2d_p_clk.c }, + {CLK_TEST_LS (0x0D ), &i2c_clk.c }, + {CLK_TEST_LS (0x0E ), &mi2s_codec_rx_m_clk.c }, + {CLK_TEST_LS (0x0F ), &mi2s_codec_rx_s_clk.c }, + {CLK_TEST_LS (0x10 ), &mi2s_codec_tx_m_clk.c }, + {CLK_TEST_LS (0x13 ), &mdp_vsync_clk.c }, + {CLK_TEST_LS (0x15 ), &vfe_p_clk.c }, + {CLK_TEST_LS (0x16 ), &mdc_clk.c }, + {CLK_TEST_LS (0x17 ), &vfe_mdc_clk.c }, + {CLK_TEST_LS (0x18 ), &usb_hs_p_clk.c }, + {CLK_TEST_LS (0x1C ), &uart1dm_p_clk.c }, + {CLK_TEST_LS (0x1E ), &jpeg_p_clk.c }, + {CLK_TEST_LS (0x20 ), &sdac_clk.c }, + {CLK_TEST_LS (0x21 ), &sdc1_p_clk.c }, + {CLK_TEST_LS (0x22 ), &sdc1_clk.c }, + {CLK_TEST_LS (0x23 ), &sdc2_p_clk.c }, + {CLK_TEST_LS (0x24 ), &sdc2_clk.c }, + {CLK_TEST_LS (0x25 ), &tsif_p_clk.c }, + {CLK_TEST_LS (0x26 ), &sdac_m_clk.c }, + {CLK_TEST_LS (0x27 ), &grp_3d_p_clk.c }, + {CLK_TEST_LS (0x2A ), &tsif_ref_clk.c }, + {CLK_TEST_LS (0x2B ), &tv_enc_clk.c }, + {CLK_TEST_LS (0x2C ), &tv_dac_clk.c }, + {CLK_TEST_LS (0x2D ), &rotator_p_clk.c }, + {CLK_TEST_LS (0x2F ), &uart1_clk.c }, + {CLK_TEST_LS (0x30 ), &uart1dm_clk.c }, + {CLK_TEST_LS (0x31 ), &uart2_clk.c }, + {CLK_TEST_LS (0x33 ), &usb_hs2_clk.c }, + {CLK_TEST_LS (0x34 ), &usb_hs3_clk.c }, + {CLK_TEST_LS (0x35 ), &mfc_p_clk.c }, + {CLK_TEST_LS (0x36 ), &vfe_clk.c }, + {CLK_TEST_LS (0x39 ), &sdc3_p_clk.c }, + {CLK_TEST_LS (0x3A ), &sdc3_clk.c }, + {CLK_TEST_LS (0x3B ), &sdc4_p_clk.c }, + {CLK_TEST_LS (0x3C ), &sdc4_clk.c }, + {CLK_TEST_LS (0x3D ), &uart2dm_clk.c }, + {CLK_TEST_LS (0x3E ), &uart2dm_p_clk.c }, + {CLK_TEST_LS (0x3F ), &usb_hs_clk.c }, +}; + +static struct measure_sel *find_measure_sel (struct clk *clk) +{ +int i; + +for (i =0 ; i <ARRAY_SIZE (measure_mux); i++) +if (measure_mux[i].clk == clk) +return &measure_mux[i]; +return NULL ; +} + +static int measure_clk_set_parent (struct clk *clk,struct clk *parent) +{ +struct measure_sel *p; +unsigned long flags; + +if (!parent) +return -EINVAL ; + + p =find_measure_sel (parent); +if (!p) +return -EINVAL ; + +spin_lock_irqsave (&local_clock_reg_lock, flags); + +/* Program test vector. */ +if (p->test_vector <=0xFF ) { +/* Select CLK_TEST_2 */ +writel_relaxed (0x4D40 ,CLK_TEST_BASE_REG ); +writel_relaxed (p->test_vector,CLK_TEST_2_BASE_REG ); + }else +writel_relaxed (p->test_vector,CLK_TEST_BASE_REG ); + +spin_unlock_irqrestore (&local_clock_reg_lock, flags); + +return 0 ; +} + +/* Sample clock for 'tcxo4_ticks' reference clock ticks. */ +static u32 run_measurement (unsigned tcxo4_ticks) +{ +/* TCXO4_CNT_EN and RINGOSC_CNT_EN register values. */ +u32 reg_val_enable =readl_relaxed (MISC_CLK_CTL_BASE_REG ) |0x3 ; +u32 reg_val_disable = reg_val_enable & ~0x3 ; + +/* Stop counters and set the TCXO4 counter start value. */ +writel_relaxed (reg_val_disable,MISC_CLK_CTL_BASE_REG ); +writel_relaxed (tcxo4_ticks,TCXO_CNT_BASE_REG ); + +/* Run measurement and wait for completion. */ +writel_relaxed (reg_val_enable,MISC_CLK_CTL_BASE_REG ); +while (readl_relaxed (TCXO_CNT_DONE_BASE_REG ) ==0 ) +cpu_relax (); + +/* Stop counters. */ +writel_relaxed (reg_val_disable,MISC_CLK_CTL_BASE_REG ); + +return readl_relaxed (RINGOSC_CNT_BASE_REG ); +} + +/* Perform a hardware rate measurement for a given clock. +FOR DEBUG USE ONLY: Measurements take ~15 ms! */ +static unsigned measure_clk_get_rate (struct clk *clk) +{ +unsigned long flags; +u32 regval, prph_web_reg_old; +u64 raw_count_short, raw_count_full; +unsigned ret; + +clk_enable (&tcxo_clk.c); + +spin_lock_irqsave (&local_clock_reg_lock, flags); + +/* Enable TCXO4 clock branch and root. */ + prph_web_reg_old =readl_relaxed (PRPH_WEB_NS_BASE_REG ); + regval = prph_web_reg_old |BIT (9 ) |BIT (11 ); +writel_relaxed (regval,PRPH_WEB_NS_BASE_REG ); + +/* +* The ring oscillator counter will not reset if the measured clock +* is not running. To detect this, run a short measurement before +* the full measurement. If the raw results of the two are the same +* then the clock must be off. +*/ + +/* Run a short measurement. (~1 ms) */ + raw_count_short =run_measurement (0x1000 ); +/* Run a full measurement. (~14 ms) */ + raw_count_full =run_measurement (0x10000 ); + +/* Disable TCXO4 clock branch and root. */ +writel_relaxed (prph_web_reg_old,PRPH_WEB_NS_BASE_REG ); + +spin_unlock_irqrestore (&local_clock_reg_lock, flags); + +/* Return 0 if the clock is off. */ +if (raw_count_full == raw_count_short) + ret =0 ; +else { +/* Compute rate in Hz. */ + raw_count_full = ((raw_count_full *10 ) +15 ) *4800000 ; +do_div (raw_count_full, ((0x10000 *10 ) +35 )); + ret = raw_count_full; + } + +clk_disable (&tcxo_clk.c); + +return ret; +} +#else /* !CONFIG_DEBUG_FS */ +static int measure_clk_set_parent (struct clk *clk,struct clk *parent) +{ +return -EINVAL ; +} + +static unsigned measure_clk_get_rate (struct clk *clk) +{ +return 0 ; +} +#endif /* CONFIG_DEBUG_FS */ + +static struct clk_ops measure_clk_ops = { + .set_parent = measure_clk_set_parent, + .get_rate = measure_clk_get_rate, + .is_local = local_clk_is_local, +}; + +static struct clk measure_clk = { + .dbg_name ="measure_clk" , + .ops = &measure_clk_ops, +CLK_INIT (measure_clk), +}; +/* Implementation for clk_set_flags(). */ int soc_clk_set_flags (struct clk *clk,unsigned clk_flags) {
@@ -2525,6 +2763,7 @@ static struct clk_local_ownership { { CLK_LOOKUP("pll1_clk", pll1_clk.c, "acpu") }, { CLK_LOOKUP("pll2_clk", pll2_clk.c, "acpu") }, { CLK_LOOKUP("pll3_clk", pll3_clk.c, "acpu") }, + { CLK_LOOKUP("measure", measure_clk, "debug") },/* PCOM */ { CLK_LOOKUP("adsp_clk", adsp_clk.c, NULL) },
arch/arm/mach-msm/clock-8x60.c +315 -18
379 lines not on this page · raw message
arch/arm/mach-msm/clock-debug.c +34 -2
@@ -1,6 +1,6 @@/* * Copyright (C) 2007 Google, Inc. -* Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. +* Copyright (c) 2007-2011, Code Aurora Forum. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and
@@ -50,6 +50,23 @@ static int clock_debug_rate_get(void *data, u64 *val)DEFINE_SIMPLE_ATTRIBUTE (clock_rate_fops, clock_debug_rate_get, clock_debug_rate_set,"%llu\n" ); +static struct clk *measure; + +static int clock_debug_measure_get (void *data,u64 *val) +{ +int ret; +struct clk *clock = data; + + ret =clk_set_parent (measure, clock); +if (!ret) + *val =clk_get_rate (measure); + +return ret; +} + +DEFINE_SIMPLE_ATTRIBUTE (clock_measure_fops, clock_debug_measure_get, +NULL ,"%lld\n" ); +static int clock_debug_enable_set (void *data,u64 val) {struct clk *clock = data;
@@ -96,10 +113,19 @@ static struct dentry *debugfs_base;int __init clock_debug_init (void ) { +int ret =0 ; + debugfs_base =debugfs_create_dir ("clk" ,NULL );if (!debugfs_base)return -ENOMEM ; -return 0 ; + + measure =clk_get_sys ("debug" ,"measure" ); +if (IS_ERR (measure)) { + ret =PTR_ERR (measure); + measure =NULL ; + } + +return ret; }static int list_rates_show (struct seq_file *m,void *unused)
@@ -153,6 +179,12 @@ int __init clock_debug_add(struct clk *clock) &clock_local_fops)) goto error; +if (measure && + !clk_set_parent (measure, clock) && + !debugfs_create_file ("measure" ,S_IRUGO , clk_dir, clock, + &clock_measure_fops)) + goto error; +if (clock->ops->list_rate)if (!debugfs_create_file ("list_rates" ,S_IRUGO , clk_dir, clock, &list_rates_fops))
arch/arm/mach-msm/clock.h +1 -1
@@ -1,7 +1,7 @@/* arch/arm/mach-msm/clock.h * * Copyright (C) 2007 Google, Inc. -* Copyright (c) 2007-2010, Code Aurora Forum. All rights reserved. +* Copyright (c) 2007-2011, Code Aurora Forum. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 22/34 msm: clock-8x60: Support measurement of CPU and L2 clocks
In reply to David BrownFrom: Matt Wagantall <[email protected]>
Users of these debug facilities should keep in mind that these clocks can gate automatically when the CPU or L2 is idle, resulting in a lower-than-expected or 0 Hz measurement in those cases.
Also, because the test points used to measure these clocks are after a hard-wired divide-by-two, the rates of these clocks are multiplied again by two in software to get the actual CPU and L2 rates. When observing these clocks on an oscilloscope, however, the half-rate clocks are what is seen.
CRs-Fixed: 273908
--- arch/arm/mach-msm/clock-8x60.c | 51 ++++++++++++++++++++++++++++++-------- arch/arm/mach-msm/clock-local.c | 4 +++ arch/arm/mach-msm/clock-local.h | 29 ++++++++++++++++++++++ 3 files changed, 73 insertions(+), 11 deletions(-)
arch/arm/mach-msm/clock-8x60.c +40 -11
@@ -219,6 +219,7 @@#define TEST_TYPE_MM_LS 3#define TEST_TYPE_MM_HS 4#define TEST_TYPE_LPA 5 +#define TEST_TYPE_SC 6#define TEST_TYPE_SHIFT 24#define TEST_CLK_SEL_MASK BM(23, 0)#define TEST_VECTOR (s, t) (((t) << TEST_TYPE_SHIFT) | BVAL(23, 0, (s)))
@@ -227,6 +228,7 @@#define TEST_MM_LS (s) TEST_VECTOR((s), TEST_TYPE_MM_LS)#define TEST_MM_HS (s) TEST_VECTOR((s), TEST_TYPE_MM_HS)#define TEST_LPA (s) TEST_VECTOR((s), TEST_TYPE_LPA) +#define TEST_SC (s) TEST_VECTOR((s), TEST_TYPE_SC)struct pll_rate {const uint32_t l_val;
@@ -3126,6 +3128,10 @@ static struct rcg_clk pcm_clk = { }, }; +static DEFINE_CLK_MEASURE (sc0_m_clk); +static DEFINE_CLK_MEASURE (sc1_m_clk); +static DEFINE_CLK_MEASURE (l2_m_clk); + #ifdef CONFIG_DEBUG_FS struct measure_sel { u32 test_vector;
@@ -3271,6 +3277,10 @@ static struct measure_sel measure_mux[] = { { TEST_LPA(0x12), &spare_i2s_spkr_osr_clk.c }, { TEST_LPA(0x13), &spare_i2s_spkr_bit_clk.c }, { TEST_LPA(0x14), &pcm_clk.c }, + + { TEST_SC(0x40), &sc0_m_clk }, + { TEST_SC(0x41), &sc1_m_clk }, + { TEST_SC(0x42), &l2_m_clk }, };static struct measure_sel *find_measure_sel (struct clk *clk)
@@ -3283,11 +3293,12 @@ static struct measure_sel *find_measure_sel(struct clk *clk)return NULL ; } -static int measure_clk_set_parent (struct clk *clk,struct clk *parent) +static int measure_clk_set_parent (struct clk *c,struct clk *parent) {int ret =0 ;u32 clk_sel;struct measure_sel *p; +struct measure_clk *clk =to_measure_clk (c);unsigned long flags;if (!parent)
@@ -3299,8 +3310,13 @@ static int measure_clk_set_parent(struct clk *clk, struct clk *parent)spin_lock_irqsave (&local_clock_reg_lock, flags); -/* Program the test vector. */ +/* +* Program the test vector, measurement period (sample_ticks) +* and scaling factor (multiplier). +*/ clk_sel = p->test_vector &TEST_CLK_SEL_MASK ; + clk->sample_ticks =0x10000 ; + clk->multiplier =1 ;switch (p->test_vector >>TEST_TYPE_SHIFT ) {case TEST_TYPE_PER_LS :writel_relaxed (0x4030D00 |BVAL (7 ,0 , clk_sel),CLK_TEST_REG );
@@ -3321,6 +3337,11 @@ static int measure_clk_set_parent(struct clk *clk, struct clk *parent)writel_relaxed (BVAL (6 ,1 , clk_sel)|BIT (0 ),LCC_CLK_LS_DEBUG_CFG_REG );break ; +case TEST_TYPE_SC : +writel_relaxed (0x5020000 |BVAL (16 ,10 , clk_sel),CLK_TEST_REG ); + clk->sample_ticks =0x4000 ; + clk->multiplier =2 ; +break ;default : ret = -EPERM ; }
@@ -3357,11 +3378,12 @@ static u32 run_measurement(unsigned ticks)/* Perform a hardware rate measurement for a given clock. FOR DEBUG USE ONLY: Measurements take ~15 ms! */ -static unsigned measure_clk_get_rate (struct clk *clk) +static unsigned measure_clk_get_rate (struct clk *c) {unsigned long flags;u32 pdm_reg_backup, ringosc_reg_backup;u64 raw_count_short, raw_count_full; +struct measure_clk *clk =to_measure_clk (c);unsigned ret;spin_lock_irqsave (&local_clock_reg_lock, flags);
@@ -3382,7 +3404,7 @@ static unsigned measure_clk_get_rate(struct clk *clk)/* Run a short measurement. (~1 ms) */ raw_count_short =run_measurement (0x1000 );/* Run a full measurement. (~14 ms) */ - raw_count_full =run_measurement (0x10000 ); + raw_count_full =run_measurement (clk->sample_ticks);writel_relaxed (ringosc_reg_backup,RINGOSC_NS_REG );writel_relaxed (pdm_reg_backup,PDM_CLK_NS_REG );
@@ -3393,8 +3415,8 @@ static unsigned measure_clk_get_rate(struct clk *clk)else {/* Compute rate in Hz. */ raw_count_full = ((raw_count_full *10 ) +15 ) *4800000 ; -do_div (raw_count_full, ((0x10000 *10 ) +35 )); - ret = raw_count_full; +do_div (raw_count_full, ((clk->sample_ticks *10 ) +35 )); + ret = (raw_count_full * clk->multiplier); }/* Route dbg_hs_clk to PLLTEST. 300mV single-ended amplitude. */
@@ -3421,17 +3443,20 @@ static struct clk_ops measure_clk_ops = { .is_local = local_clk_is_local, }; -static struct clk measure_clk = { - .dbg_name ="measure_clk" , - .ops = &measure_clk_ops, -CLK_INIT (measure_clk), +static struct measure_clk measure_clk = { + .c = { + .dbg_name ="measure_clk" , + .ops = &measure_clk_ops, +CLK_INIT (measure_clk.c), + }, + .multiplier =1 , };struct clk_lookup msm_clocks_8x60[] = {CLK_LOOKUP ("cxo" , cxo_clk.c,NULL ),CLK_LOOKUP ("pll4" , pll4_clk.c,NULL ),CLK_LOOKUP ("pll4" , pll4_clk.c,"peripheral-reset" ), -CLK_LOOKUP ("measure" , measure_clk,"debug" ), +CLK_LOOKUP ("measure" , measure_clk.c,"debug" ),CLK_LOOKUP ("gsbi_uart_clk" , gsbi1_uart_clk.c,NULL ),CLK_LOOKUP ("gsbi_uart_clk" , gsbi2_uart_clk.c,NULL ),
@@ -3592,6 +3617,10 @@ struct clk_lookup msm_clocks_8x60[] = {CLK_LOOKUP ("iommu_clk" , gfx3d_clk.c,"msm_iommu.9" ),CLK_LOOKUP ("iommu_clk" , gfx2d0_clk.c,"msm_iommu.10" ),CLK_LOOKUP ("iommu_clk" , gfx2d1_clk.c,"msm_iommu.11" ), + +CLK_LOOKUP ("sc0_mclk" , sc0_m_clk,NULL ), +CLK_LOOKUP ("sc1_mclk" , sc1_m_clk,NULL ), + CLK_LOOKUP("l2_mclk", l2_m_clk, NULL), };unsigned msm_num_clocks_8x60 =ARRAY_SIZE (msm_clocks_8x60);
arch/arm/mach-msm/clock-local.c +4 -0
@@ -861,6 +861,10 @@ struct fixed_clk gnd_clk = { }, }; +struct clk_ops clk_ops_measure = { + .is_local = local_clk_is_local, +}; +int branch_clk_enable (struct clk *clk) {int rc;
arch/arm/mach-msm/clock-local.h +29 -0
@@ -33,6 +33,16 @@#define DELAY 5/* No bit to check, just delay */ /* +* Clock Definition Macros +*/ +#define DEFINE_CLK_MEASURE (name) \ + struct clk name = { \ + .ops = &clk_ops_measure, \ + .dbg_name = #name, \ + CLK_INIT(name), \ + }; \ + +/* * Generic frequency-definition structs and macros */ struct clk_freq_tbl {
@@ -255,6 +265,25 @@ unsigned branch_clk_is_enabled(struct clk *clk);void branch_clk_auto_off (struct clk *clk);int branch_clk_reset (struct clk *c,enum clk_reset_action action); +/** +* struct measure_clk - for rate measurement debug use +* @sample_ticks: sample period in reference clock ticks +* @multiplier: measurement scale-up factor +* @c: clk +*/ +struct measure_clk { +u64 sample_ticks; +u32 multiplier; +struct clk c; +}; + +extern struct clk_ops clk_ops_measure; + +static inline struct measure_clk *to_measure_clk (struct clk *clk) +{ + return container_of(clk, struct measure_clk, c); +} +/* * Variables from clock-local driver */
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 23/34 msm: Unify iomap for clock regions
In reply to David BrownFrom: Stephen Boyd <[email protected]>
8960 requires the iomap to be unified across all versions of the MSM. Unify the io regions to avoid build errors.
--- arch/arm/mach-msm/include/mach/msm_iomap-7x00.h | 5 ++--- arch/arm/mach-msm/include/mach/msm_iomap-7x30.h | 5 ++--- arch/arm/mach-msm/include/mach/msm_iomap-8x50.h | 5 ++--- arch/arm/mach-msm/include/mach/msm_iomap-8x60.h | 15 ++++++--------- arch/arm/mach-msm/include/mach/msm_iomap.h | 3 +++ arch/arm/mach-msm/io.c | 12 ++++++------ 6 files changed, 21 insertions(+), 24 deletions(-)
arch/arm/mach-msm/include/mach/msm_iomap-7x00.h +2 -3
@@ -61,9 +61,8 @@#define MSM7X00_GPIO2_PHYS 0xA9300000#define MSM7X00_GPIO2_SIZE SZ_4K -#define MSM_CLK_CTL_BASE IOMEM(0xE0005000) -#define MSM_CLK_CTL_PHYS 0xA8600000 -#define MSM_CLK_CTL_SIZE SZ_4K +#define MSM7X00_CLK_CTL_PHYS 0xA8600000 +#define MSM7X00_CLK_CTL_SIZE SZ_4K#define MSM_SHARED_RAM_BASE IOMEM(0xE0100000)#define MSM_SHARED_RAM_PHYS 0x01F00000
arch/arm/mach-msm/include/mach/msm_iomap-7x30.h +2 -3
@@ -52,9 +52,8 @@#define MSM7X30_GPIO2_PHYS 0xAC101000#define MSM7X30_GPIO2_SIZE SZ_4K -#define MSM_CLK_CTL_BASE IOMEM(0xE0005000) -#define MSM_CLK_CTL_PHYS 0xAB800000 -#define MSM_CLK_CTL_SIZE SZ_4K +#define MSM7X30_CLK_CTL_PHYS 0xAB800000 +#define MSM7X30_CLK_CTL_SIZE SZ_4K#define MSM_CLK_CTL_SH2_BASE IOMEM(0xE0006000)#define MSM_CLK_CTL_SH2_PHYS 0xABA01000
arch/arm/mach-msm/include/mach/msm_iomap-8x50.h +2 -3
@@ -52,9 +52,8 @@#define QSD8X50_GPIO2_PHYS 0xA9100000#define QSD8X50_GPIO2_SIZE SZ_4K -#define MSM_CLK_CTL_BASE IOMEM(0xE0005000) -#define MSM_CLK_CTL_PHYS 0xA8600000 -#define MSM_CLK_CTL_SIZE SZ_4K +#define QSD8X50_CLK_CTL_PHYS 0xA8600000 +#define QSD8X50_CLK_CTL_SIZE SZ_4K#define MSM_SIRC_BASE IOMEM(0xE1006000)#define MSM_SIRC_PHYS 0xAC200000
arch/arm/mach-msm/include/mach/msm_iomap-8x60.h +6 -9
@@ -53,17 +53,14 @@#define MSM_TLMM_PHYS 0x00800000#define MSM_TLMM_SIZE SZ_16K -#define MSM_CLK_CTL_BASE IOMEM(0xFA010000) -#define MSM_CLK_CTL_PHYS 0x00900000 -#define MSM_CLK_CTL_SIZE SZ_16K +#define MSM8X60_CLK_CTL_PHYS 0x00900000 +#define MSM8X60_CLK_CTL_SIZE SZ_16K -#define MSM_MMSS_CLK_CTL_BASE IOMEM(0xFA014000) -#define MSM_MMSS_CLK_CTL_PHYS 0x04000000 -#define MSM_MMSS_CLK_CTL_SIZE SZ_4K +#define MSM8X60_MMSS_CLK_CTL_PHYS 0x04000000 +#define MSM8X60_MMSS_CLK_CTL_SIZE SZ_4K -#define MSM_LPASS_CLK_CTL_BASE IOMEM(0xFA015000) -#define MSM_LPASS_CLK_CTL_PHYS 0x28000000 -#define MSM_LPASS_CLK_CTL_SIZE SZ_4K +#define MSM8X60_LPASS_CLK_CTL_PHYS 0x28000000 +#define MSM8X60_LPASS_CLK_CTL_SIZE SZ_4K#define MSM_SHARED_RAM_BASE IOMEM(0xF0100000)#define MSM_SHARED_RAM_SIZE SZ_1M
arch/arm/mach-msm/include/mach/msm_iomap.h +3 -0
@@ -63,5 +63,8 @@#define MSM_TMR0_BASE IOMEM(0xF0201000)#define MSM_GPIO1_BASE IOMEM(0xE0003000)#define MSM_GPIO2_BASE IOMEM(0xE0004000) +#define MSM_CLK_CTL_BASE IOMEM(0xF0202000) +#define MSM_MMSS_CLK_CTL_BASE IOMEM(0xF0206000) +#define MSM_LPASS_CLK_CTL_BASE IOMEM(0xF0207000)#endif
arch/arm/mach-msm/io.c +6 -6
@@ -45,7 +45,7 @@ static struct map_desc msm_io_desc[] __initdata = {MSM_DEVICE (DMOV ),MSM_CHIP_DEVICE (GPIO1 ,MSM7X00 ),MSM_CHIP_DEVICE (GPIO2 ,MSM7X00 ), -MSM_DEVICE (CLK_CTL ), +MSM_CHIP_DEVICE (CLK_CTL ,MSM7X00 ), #ifdef CONFIG_MSM_DEBUG_UART MSM_DEVICE(DEBUG_UART), #endif
@@ -78,7 +78,7 @@ static struct map_desc qsd8x50_io_desc[] __initdata = {MSM_DEVICE (DMOV ),MSM_CHIP_DEVICE (GPIO1 ,QSD8X50 ),MSM_CHIP_DEVICE (GPIO2 ,QSD8X50 ), -MSM_DEVICE (CLK_CTL ), +MSM_CHIP_DEVICE (CLK_CTL ,QSD8X50 ),MSM_DEVICE (SIRC ),MSM_DEVICE (SCPLL ), MSM_DEVICE(AD5),
@@ -108,9 +108,9 @@ static struct map_desc msm8x60_io_desc[] __initdata = {MSM_CHIP_DEVICE (TMR0 ,MSM8X60 ),MSM_DEVICE (ACC ),MSM_DEVICE (GCC ), -MSM_DEVICE (CLK_CTL ), -MSM_DEVICE (MMSS_CLK_CTL ), - MSM_DEVICE(LPASS_CLK_CTL), +MSM_CHIP_DEVICE (CLK_CTL ,MSM8X60 ), +MSM_CHIP_DEVICE (MMSS_CLK_CTL ,MSM8X60 ), + MSM_CHIP_DEVICE(LPASS_CLK_CTL, MSM8X60), };void __init msm_map_msm8x60_io (void )
@@ -140,7 +140,7 @@ static struct map_desc msm7x30_io_desc[] __initdata = {MSM_DEVICE (DMOV ),MSM_CHIP_DEVICE (GPIO1 ,MSM7X30 ),MSM_CHIP_DEVICE (GPIO2 ,MSM7X30 ), -MSM_DEVICE (CLK_CTL ), +MSM_CHIP_DEVICE (CLK_CTL ,MSM7X30 ),MSM_DEVICE (CLK_CTL_SH2 ),MSM_DEVICE (AD5 ), MSM_DEVICE(MDC),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 24/34 msm: clock: Support dummy clocks
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Implement a dummy clock driver and macro in the spirit of CLK_PCOM(). This is useful on targets where a pclk doesn't exist and we want to keep drivers sane by providing such clocks.
--- arch/arm/mach-msm/Makefile | 1 + arch/arm/mach-msm/clock-dummy.c | 69 +++++++++++++++++++++++++++++++++++++++ arch/arm/mach-msm/clock.h | 9 +++++ 3 files changed, 79 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-msm/clock-dummy.c
arch/arm/mach-msm/Makefile +1 -0
@@ -1,6 +1,7 @@ obj-y += io.o idle.o timer.o obj-y += clock.o obj-y += clock-voter.o +obj-y += clock-dummy.o obj-$(CONFIG_DEBUG_FS) += clock-debug.o obj-$(CONFIG_ARCH_MSM7X30) += clock-local.o clock-7x30.o obj-$(CONFIG_ARCH_MSM8X60) += clock-local.o clock-8x60.o
arch/arm/mach-msm/clock-dummy.c new file +69 -0
69 lines not on this page · raw message
arch/arm/mach-msm/clock.h +9 -0
@@ -87,5 +87,14 @@ static inline int __init clock_debug_init(void) { return 0; }static inline int __init clock_debug_add (struct clk *clock) {return 0 ; }#endif +extern struct clk dummy_clk; + +#define CLK_DUMMY (clk_name, clk_id, clk_dev) { \ + .con_id = clk_name, \ + .dev_id = clk_dev, \ + .clk = &dummy_clk, \ + } +#define CLK_LOOKUP (con, c, dev) { .con_id = con, .clk = &c, .dev_id = dev } +#endif
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 25/34 msm: clock: Add 8960 clock support
In reply to David BrownFrom: Stephen Boyd <[email protected]>
--- arch/arm/mach-msm/Makefile | 1 + arch/arm/mach-msm/board-msm8960.c | 9 +- arch/arm/mach-msm/clock-8960.c | 4047 +++++++++++++++++++++++ arch/arm/mach-msm/clock.h | 2 +- arch/arm/mach-msm/devices.h | 3 + arch/arm/mach-msm/include/mach/msm_iomap-8960.h | 9 + arch/arm/mach-msm/io.c | 3 + 7 files changed, 4072 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-msm/clock-8960.c
arch/arm/mach-msm/Makefile +1 -0
@@ -5,6 +5,7 @@ obj-y += clock-dummy.o obj-$(CONFIG_DEBUG_FS) += clock-debug.o obj-$(CONFIG_ARCH_MSM7X30) += clock-local.o clock-7x30.o obj-$(CONFIG_ARCH_MSM8X60) += clock-local.o clock-8x60.o +obj-$(CONFIG_ARCH_MSM8960) += clock-local.o clock-8960.o obj-$(CONFIG_MSM_VIC) += irq-vic.o obj-$(CONFIG_MSM_IOMMU) += devices-iommu.o
arch/arm/mach-msm/board-msm8960.c +8 -1
@@ -53,6 +53,11 @@ static void __init msm8960_map_io(void)msm_map_msm8960_io (); } +static void __init msm8960_init_early (void ) +{ +msm_clock_init (msm_clocks_8960, msm_num_clocks_8960); +} +static void __init msm8960_init_irq (void ) {unsigned int i;
@@ -76,7 +81,7 @@ static void __init msm8960_init_irq(void) }static struct platform_device *sim_devices[]__initdata = { - &msm8960_device_uart_gsbi2, + &msm8960_device_uart_gsbi5, };static struct platform_device *rumi3_devices[]__initdata = {
@@ -97,6 +102,7 @@ MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR") .fixup = msm8960_fixup, .reserve = msm8960_reserve, .map_io = msm8960_map_io, + .init_early = msm8960_init_early, .init_irq = msm8960_init_irq, .timer = &msm_timer, .init_machine = msm8960_sim_init,
@@ -106,6 +112,7 @@ MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3") .fixup = msm8960_fixup, .reserve = msm8960_reserve, .map_io = msm8960_map_io, + .init_early = msm8960_init_early, .init_irq = msm8960_init_irq, .timer = &msm_timer, .init_machine = msm8960_rumi3_init,
arch/arm/mach-msm/clock-8960.c new file +4047 -0
2,960 lines not on this page · raw message
arch/arm/mach-msm/include/mach/msm_iomap-8960.h +9 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
Part of the diff is not shown here. View the raw message.
RFC PATCH 26/34 msm: 8660: Add FLUID support
In reply to David BrownFrom: Stephen Boyd <[email protected]>
The machine descriptor for FLUID was missing. Adding it allows us to boot FLUID devices since the basic support for 8660 is the same.
--- arch/arm/mach-msm/Kconfig | 6 ++++++ arch/arm/mach-msm/board-msm8x60.c | 8 ++++++++ 2 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/mach-msm/Kconfig +6 -0
@@ -138,6 +138,12 @@ config MACH_MSM8X60_FFA help Support for the Qualcomm MSM8x60 FFA eval board. +config MACH_MSM8X60_FLUID + depends on ARCH_MSM8X60 + bool "MSM8x60 FLUID" + help + Support for the Qualcomm MSM8x60 FLUID board. + config MACH_MSM8960_SIM depends on ARCH_MSM8960 bool "MSM8960 Simulator"
arch/arm/mach-msm/board-msm8x60.c +8 -0
@@ -116,3 +116,11 @@ MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA") .init_machine = msm8x60_init, .timer = &msm_timer, MACHINE_END + +MACHINE_START (MSM8X60_FLUID ,"QCT MSM8X60 FLUID" ) + .map_io = msm8x60_map_io, + .init_early = msm8x60_init_early, + .init_irq = msm8x60_init_irq, + .init_machine = msm8x60_init, + .timer = &msm_timer, +MACHINE_END
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 27/34 msm-8x60: Add serial support
In reply to David BrownFrom: Stepan Moskovchenko <[email protected]>
Add the platform data to the board file.
--- arch/arm/mach-msm/board-msm8x60.c | 50 +++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-)
arch/arm/mach-msm/board-msm8x60.c +50 -0
@@ -73,8 +73,58 @@ static void __init msm8x60_init_irq(void)writel (0x0000FFFF ,MSM_QGIC_DIST_BASE +GIC_DIST_ENABLE_SET ); } +static struct resource msm_uart12_dm_resources[] = { + { + .start =0x19C40000 , + .end =0x19C40000 +PAGE_SIZE -1 , + .name ="uart_resource" , + .flags =IORESOURCE_MEM , + }, + { + .start =INT_UART12DM_IRQ , + .end =INT_UART12DM_IRQ , + .flags =IORESOURCE_IRQ , + }, + { +/* GSBI 12 is UARTDM2 */ + .start =0x19C00000 , + .end =0x19C00000 +PAGE_SIZE -1 , + .name ="gsbi_resource" , + .flags =IORESOURCE_MEM , + }, +}; + +struct platform_device msm_device_uart_dm12 = { + .name ="msm_serial" , + .id =0 , + .num_resources =ARRAY_SIZE (msm_uart12_dm_resources), + .resource = msm_uart12_dm_resources, +}; + +static struct platform_device *devices[]__initdata = { + &msm_device_uart_dm12, +}; + +static void __init msm8x60_init_uart12dm (void ) +{ +/* 0x1D000000 now belongs to EBI2:CS3 i.e. USB ISP Controller */ +void *fpga_mem =ioremap_nocache (0x1D000000 ,SZ_4K ); +/* Advanced mode */ +writew (0xFFFF , fpga_mem +0x15C ); +/* FPGA_UART_SEL */ +writew (0 , fpga_mem +0x172 ); +/* FPGA_GPIO_CONFIG_117 */ +writew (1 , fpga_mem +0xEA ); +/* FPGA_GPIO_CONFIG_118 */ +writew (1 , fpga_mem +0xEC ); +dmb (); +iounmap (fpga_mem); +} +static void __init msm8x60_init (void ) { +msm8x60_init_uart12dm (); +platform_add_devices (devices,ARRAY_SIZE (devices)); }MACHINE_START (MSM8X60_RUMI3 ,"QCT MSM8X60 RUMI3" )
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 28/34 msm: clock: Invert CLKFLAG_AUTO_OFF
In reply to David BrownFrom: Stephen Boyd <[email protected]>
All locally controlled clocks can participate in the auto off operations. Make the auto off flag default (and 0) to save lines in struct clk definitions. We make the auto_off ops optional to avoid marking PLLs and XOs explicitly.
--- arch/arm/mach-msm/clock-7x30.c | 210 ++++++++---------- arch/arm/mach-msm/clock-8960.c | 116 ---------- arch/arm/mach-msm/clock-8x60.c | 104 --------- arch/arm/mach-msm/clock-pcom-lookup.c | 381 +++++++++++++++++++++++++++++++++ arch/arm/mach-msm/clock-voter.h | 1 + arch/arm/mach-msm/clock.c | 11 +- arch/arm/mach-msm/clock.h | 3 +- arch/arm/mach-msm/devices-msm7x00.c | 82 ++++---- arch/arm/mach-msm/devices-qsd8x50.c | 100 +++++----- 9 files changed, 573 insertions(+), 435 deletions(-) create mode 100644 arch/arm/mach-msm/clock-pcom-lookup.c
arch/arm/mach-msm/clock-7x30.c +92 -118
@@ -553,7 +553,6 @@ static struct branch_clk camif_pad_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "camif_pad_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(camif_pad_p_clk.c), },
@@ -588,7 +587,6 @@ static struct branch_clk emdh_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "emdh_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(emdh_p_clk.c), },
@@ -640,7 +638,6 @@ static struct branch_clk jpeg_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "jpeg_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(jpeg_p_clk.c), },
@@ -726,7 +723,6 @@ static struct branch_clk rotator_imem_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "rotator_imem_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(rotator_imem_clk.c), },
@@ -744,7 +740,6 @@ static struct branch_clk rotator_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "rotator_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(rotator_p_clk.c), },
@@ -762,7 +757,6 @@ static struct branch_clk sdc1_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "sdc1_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(sdc1_p_clk.c), },
@@ -780,7 +774,6 @@ static struct branch_clk sdc2_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "sdc2_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(sdc2_p_clk.c), },
@@ -798,7 +791,6 @@ static struct branch_clk sdc3_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "sdc3_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(sdc3_p_clk.c), },
@@ -816,7 +808,6 @@ static struct branch_clk sdc4_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "sdc4_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(sdc4_p_clk.c), },
@@ -900,7 +891,6 @@ static struct branch_clk usb_hs2_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "usb_hs2_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs2_p_clk.c), },
@@ -918,7 +908,6 @@ static struct branch_clk usb_hs3_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "usb_hs3_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs3_p_clk.c), },
@@ -936,7 +925,6 @@ static struct branch_clk usb_hs_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "usb_hs_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs_p_clk.c), },
@@ -954,7 +942,6 @@ static struct branch_clk vfe_p_clk = { .parent = &glbl_root_clk.c, .c = { .dbg_name = "vfe_p_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(vfe_p_clk.c), },
@@ -1066,7 +1053,6 @@ static struct rcg_clk uart1_clk = { .current_freq = &local_dummy_freq, .c = { .dbg_name = "uart1_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(uart1_clk.c), },
@@ -1124,7 +1110,6 @@ static struct rcg_clk uart1dm_clk = { .set_rate = set_rate_mnd, .c = { .dbg_name = "uart1dm_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(uart1dm_clk.c), },
@@ -1180,7 +1165,7 @@ static struct rcg_clk emdh_clk = { .current_freq = &local_dummy_freq, .c = { .dbg_name = "emdh_clk", - .flags = CLKFLAG_AUTO_OFF | CLKFLAG_MIN | CLKFLAG_MAX, + .flags = CLKFLAG_MIN | CLKFLAG_MAX, .ops = &soc_clk_ops_7x30, CLK_INIT(emdh_clk.c), },
@@ -1201,7 +1186,7 @@ static struct rcg_clk pmdh_clk = { .current_freq = &local_dummy_freq, .c = { .dbg_name = "pmdh_clk", - .flags = CLKFLAG_AUTO_OFF | CLKFLAG_MIN | CLKFLAG_MAX, + .flags = CLKFLAG_MIN | CLKFLAG_MAX, .ops = &soc_clk_ops_7x30, CLK_INIT(pmdh_clk.c), },
@@ -1297,7 +1282,6 @@ static struct branch_clk imem_clk = { .parent = &grp_3d_src_clk.c, .c = { .dbg_name = "imem_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(imem_clk.c), },
@@ -1332,7 +1316,6 @@ static struct rcg_clk sdc1_clk = { .set_rate = set_rate_mnd, .c = { .dbg_name = "sdc1_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(sdc1_clk.c), },
@@ -1355,7 +1338,6 @@ static struct rcg_clk sdc3_clk = { .set_rate = set_rate_mnd, .c = { .dbg_name = "sdc3_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(sdc3_clk.c), },
@@ -1390,7 +1372,6 @@ static struct rcg_clk sdc2_clk = { .set_rate = set_rate_mnd, .c = { .dbg_name = "sdc2_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(sdc2_clk.c), },
@@ -1413,7 +1394,6 @@ static struct rcg_clk sdc4_clk = { .set_rate = set_rate_mnd, .c = { .dbg_name = "sdc4_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(sdc4_clk.c), },
@@ -1449,7 +1429,6 @@ static struct rcg_clk mdp_clk = { .current_freq = &local_dummy_freq, .c = { .dbg_name = "mdp_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(mdp_clk.c), },
@@ -1524,7 +1503,6 @@ static struct rcg_clk mdp_vsync_clk = { .current_freq = &local_dummy_freq, .c = { .dbg_name = "mdp_vsync_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(mdp_vsync_clk.c), },
@@ -1724,7 +1702,6 @@ static struct rcg_clk sdac_clk = { .current_freq = &local_dummy_freq, .c = { .dbg_name = "sdac_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(sdac_clk.c), },
@@ -1741,7 +1718,6 @@ static struct branch_clk sdac_m_clk = { .parent = &sdac_clk.c, .c = { .dbg_name = "sdac_m_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(sdac_m_clk.c), },
@@ -1874,7 +1850,6 @@ static struct branch_clk usb_hs_clk = { }, .c = { .dbg_name = "usb_hs_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs_clk.c), },
@@ -1891,7 +1866,6 @@ static struct branch_clk usb_hs_core_clk = { .parent = &usb_hs_src_clk.c, .c = { .dbg_name = "usb_hs_core_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs_core_clk.c), },
@@ -1908,7 +1882,6 @@ static struct branch_clk usb_hs2_clk = { .parent = &usb_hs_src_clk.c, .c = { .dbg_name = "usb_hs2_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs2_clk.c), },
@@ -1925,7 +1898,6 @@ static struct branch_clk usb_hs2_core_clk = { .parent = &usb_hs_src_clk.c, .c = { .dbg_name = "usb_hs2_core_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs2_core_clk.c), },
@@ -1942,7 +1914,6 @@ static struct branch_clk usb_hs3_clk = { .parent = &usb_hs_src_clk.c, .c = { .dbg_name = "usb_hs3_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs3_clk.c), },
@@ -1959,7 +1930,6 @@ static struct branch_clk usb_hs3_core_clk = { .parent = &usb_hs_src_clk.c, .c = { .dbg_name = "usb_hs3_core_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &clk_ops_branch, CLK_INIT(usb_hs3_core_clk.c), },
@@ -2000,7 +1970,6 @@ static struct rcg_clk jpeg_clk = { .current_freq = &local_dummy_freq, .c = { .dbg_name = "jpeg_clk", - .flags = CLKFLAG_AUTO_OFF, .ops = &soc_clk_ops_7x30, CLK_INIT(jpeg_clk.c), },
@@ -2294,93 +2263,98 @@ static struct branch_clk lpa_core_clk = { }, }; -static DEFINE_CLK_PCOM(adsp_clk, ADSP_CLK, 0); -static DEFINE_CLK_PCOM(codec_ssbi_clk, CODEC_SSBI_CLK, 0); +static DEFINE_CLK_PCOM(adsp_clk, ADSP_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(codec_ssbi_clk, CODEC_SSBI_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, CLK_MIN); -static DEFINE_CLK_PCOM(ecodec_clk, ECODEC_CLK, 0); -static DEFINE_CLK_PCOM(gp_clk, GP_CLK, 0); -static DEFINE_CLK_PCOM(uart3_clk, UART3_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(usb_phy_clk, USB_PHY_CLK, CLKFLAG_AUTO_OFF | CLK_MIN); +static DEFINE_CLK_PCOM(ecodec_clk, ECODEC_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(gp_clk, GP_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(uart3_clk, UART3_CLK, 0); +static DEFINE_CLK_PCOM(usb_phy_clk, USB_PHY_CLK, CLK_MIN); -static DEFINE_CLK_PCOM(p_grp_2d_clk, GRP_2D_CLK, 0); -static DEFINE_CLK_PCOM(p_grp_2d_p_clk, GRP_2D_P_CLK, 0); -static DEFINE_CLK_PCOM(p_hdmi_clk, HDMI_CLK, 0); -static DEFINE_CLK_PCOM(p_jpeg_clk, JPEG_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_jpeg_p_clk, JPEG_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_lpa_codec_clk, LPA_CODEC_CLK, 0); -static DEFINE_CLK_PCOM(p_lpa_core_clk, LPA_CORE_CLK, 0); -static DEFINE_CLK_PCOM(p_lpa_p_clk, LPA_P_CLK, 0); -static DEFINE_CLK_PCOM(p_mi2s_m_clk, MI2S_M_CLK, 0); -static DEFINE_CLK_PCOM(p_mi2s_s_clk, MI2S_S_CLK, 0); -static DEFINE_CLK_PCOM(p_mi2s_codec_rx_m_clk, MI2S_CODEC_RX_M_CLK, 0); -static DEFINE_CLK_PCOM(p_mi2s_codec_rx_s_clk, MI2S_CODEC_RX_S_CLK, 0); -static DEFINE_CLK_PCOM(p_mi2s_codec_tx_m_clk, MI2S_CODEC_TX_M_CLK, 0); -static DEFINE_CLK_PCOM(p_mi2s_codec_tx_s_clk, MI2S_CODEC_TX_S_CLK, 0); -static DEFINE_CLK_PCOM(p_sdac_clk, SDAC_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_sdac_m_clk, SDAC_M_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_vfe_clk, VFE_CLK, 0); -static DEFINE_CLK_PCOM(p_vfe_camif_clk, VFE_CAMIF_CLK, 0); -static DEFINE_CLK_PCOM(p_vfe_mdc_clk, VFE_MDC_CLK, 0); -static DEFINE_CLK_PCOM(p_vfe_p_clk, VFE_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_grp_3d_clk, GRP_3D_CLK, 0); -static DEFINE_CLK_PCOM(p_grp_3d_p_clk, GRP_3D_P_CLK, 0); -static DEFINE_CLK_PCOM(p_imem_clk, IMEM_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_mdp_lcdc_pad_pclk_clk, MDP_LCDC_PAD_PCLK_CLK, 0); -static DEFINE_CLK_PCOM(p_mdp_lcdc_pclk_clk, MDP_LCDC_PCLK_CLK, 0); -static DEFINE_CLK_PCOM(p_mdp_p_clk, MDP_P_CLK, 0); -static DEFINE_CLK_PCOM(p_mdp_vsync_clk, MDP_VSYNC_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_tsif_ref_clk, TSIF_REF_CLK, 0); -static DEFINE_CLK_PCOM(p_tsif_p_clk, TSIF_P_CLK, 0); -static DEFINE_CLK_PCOM(p_tv_dac_clk, TV_DAC_CLK, 0); -static DEFINE_CLK_PCOM(p_tv_enc_clk, TV_ENC_CLK, 0); -static DEFINE_CLK_PCOM(p_emdh_clk, EMDH_CLK, - CLKFLAG_AUTO_OFF | CLKFLAG_MIN | CLKFLAG_MAX); -static DEFINE_CLK_PCOM(p_emdh_p_clk, EMDH_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_i2c_clk, I2C_CLK, 0); -static DEFINE_CLK_PCOM(p_i2c_2_clk, I2C_2_CLK, 0); -static DEFINE_CLK_PCOM(p_mdc_clk, MDC_CLK, 0); -static DEFINE_CLK_PCOM(p_pmdh_clk, PMDH_CLK, - CLKFLAG_AUTO_OFF | CLKFLAG_MIN | CLKFLAG_MAX); -static DEFINE_CLK_PCOM(p_pmdh_p_clk, PMDH_P_CLK, 0); -static DEFINE_CLK_PCOM(p_sdc1_clk, SDC1_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_sdc1_p_clk, SDC1_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_sdc2_clk, SDC2_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_sdc2_p_clk, SDC2_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_sdc3_clk, SDC3_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_sdc3_p_clk, SDC3_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_sdc4_clk, SDC4_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_sdc4_p_clk, SDC4_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_uart2_clk, UART2_CLK, 0); -static DEFINE_CLK_PCOM(p_usb_hs2_clk, USB_HS2_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_usb_hs2_core_clk, USB_HS2_CORE_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_usb_hs2_p_clk, USB_HS2_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_usb_hs3_clk, USB_HS3_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_usb_hs3_core_clk, USB_HS3_CORE_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_usb_hs3_p_clk, USB_HS3_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_qup_i2c_clk, QUP_I2C_CLK, 0); -static DEFINE_CLK_PCOM(p_spi_clk, SPI_CLK, 0); -static DEFINE_CLK_PCOM(p_spi_p_clk, SPI_P_CLK, 0); -static DEFINE_CLK_PCOM(p_uart1_clk, UART1_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_uart1dm_clk, UART1DM_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_uart2dm_clk, UART2DM_CLK, 0); -static DEFINE_CLK_PCOM(p_usb_hs_clk, USB_HS_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_usb_hs_core_clk, USB_HS_CORE_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_usb_hs_p_clk, USB_HS_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_cam_m_clk, CAM_M_CLK, 0); -static DEFINE_CLK_PCOM(p_camif_pad_p_clk, CAMIF_PAD_P_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_csi0_clk, CSI0_CLK, 0); -static DEFINE_CLK_PCOM(p_csi0_vfe_clk, CSI0_VFE_CLK, 0); -static DEFINE_CLK_PCOM(p_csi0_p_clk, CSI0_P_CLK, 0); -static DEFINE_CLK_PCOM(p_mdp_clk, MDP_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_mfc_clk, MFC_CLK, 0); -static DEFINE_CLK_PCOM(p_mfc_div2_clk, MFC_DIV2_CLK, 0); -static DEFINE_CLK_PCOM(p_mfc_p_clk, MFC_P_CLK, 0); -static DEFINE_CLK_PCOM(p_vpe_clk, VPE_CLK, 0); -static DEFINE_CLK_PCOM(p_adm_clk, ADM_CLK, 0); -static DEFINE_CLK_PCOM(p_ce_clk, CE_CLK, 0); -static DEFINE_CLK_PCOM(p_axi_rotator_clk, AXI_ROTATOR_CLK, 0); -static DEFINE_CLK_PCOM(p_rotator_imem_clk, ROTATOR_IMEM_CLK, CLKFLAG_AUTO_OFF); -static DEFINE_CLK_PCOM(p_rotator_p_clk, ROTATOR_P_CLK, CLKFLAG_AUTO_OFF); +static DEFINE_CLK_PCOM(p_grp_2d_clk, GRP_2D_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_grp_2d_p_clk, GRP_2D_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_hdmi_clk, HDMI_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_jpeg_clk, JPEG_CLK, 0); +static DEFINE_CLK_PCOM(p_jpeg_p_clk, JPEG_P_CLK, 0); +static DEFINE_CLK_PCOM(p_lpa_codec_clk, LPA_CODEC_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_lpa_core_clk, LPA_CORE_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_lpa_p_clk, LPA_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mi2s_m_clk, MI2S_M_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mi2s_s_clk, MI2S_S_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mi2s_codec_rx_m_clk, MI2S_CODEC_RX_M_CLK, + CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mi2s_codec_rx_s_clk, MI2S_CODEC_RX_S_CLK, + CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mi2s_codec_tx_m_clk, MI2S_CODEC_TX_M_CLK, + CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mi2s_codec_tx_s_clk, MI2S_CODEC_TX_S_CLK, + CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_sdac_clk, SDAC_CLK, 0); +static DEFINE_CLK_PCOM(p_sdac_m_clk, SDAC_M_CLK, 0); +static DEFINE_CLK_PCOM(p_vfe_clk, VFE_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_vfe_camif_clk, VFE_CAMIF_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_vfe_mdc_clk, VFE_MDC_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_vfe_p_clk, VFE_P_CLK, 0); +static DEFINE_CLK_PCOM(p_grp_3d_clk, GRP_3D_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_grp_3d_p_clk, GRP_3D_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_imem_clk, IMEM_CLK, 0); +static DEFINE_CLK_PCOM(p_mdp_lcdc_pad_pclk_clk, MDP_LCDC_PAD_PCLK_CLK, + CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mdp_lcdc_pclk_clk, MDP_LCDC_PCLK_CLK, + CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mdp_p_clk, MDP_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mdp_vsync_clk, MDP_VSYNC_CLK, 0); +static DEFINE_CLK_PCOM(p_tsif_ref_clk, TSIF_REF_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_tsif_p_clk, TSIF_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_tv_dac_clk, TV_DAC_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_tv_enc_clk, TV_ENC_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_emdh_clk, EMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX); +static DEFINE_CLK_PCOM(p_emdh_p_clk, EMDH_P_CLK, 0); +static DEFINE_CLK_PCOM(p_i2c_clk, I2C_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_i2c_2_clk, I2C_2_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mdc_clk, MDC_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_pmdh_clk, PMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX); +static DEFINE_CLK_PCOM(p_pmdh_p_clk, PMDH_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_sdc1_clk, SDC1_CLK, 0); +static DEFINE_CLK_PCOM(p_sdc1_p_clk, SDC1_P_CLK, 0); +static DEFINE_CLK_PCOM(p_sdc2_clk, SDC2_CLK, 0); +static DEFINE_CLK_PCOM(p_sdc2_p_clk, SDC2_P_CLK, 0); +static DEFINE_CLK_PCOM(p_sdc3_clk, SDC3_CLK, 0); +static DEFINE_CLK_PCOM(p_sdc3_p_clk, SDC3_P_CLK, 0); +static DEFINE_CLK_PCOM(p_sdc4_clk, SDC4_CLK, 0); +static DEFINE_CLK_PCOM(p_sdc4_p_clk, SDC4_P_CLK, 0); +static DEFINE_CLK_PCOM(p_uart2_clk, UART2_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_usb_hs2_clk, USB_HS2_CLK, 0); +static DEFINE_CLK_PCOM(p_usb_hs2_core_clk, USB_HS2_CORE_CLK, 0); +static DEFINE_CLK_PCOM(p_usb_hs2_p_clk, USB_HS2_P_CLK, 0); +static DEFINE_CLK_PCOM(p_usb_hs3_clk, USB_HS3_CLK, 0); +static DEFINE_CLK_PCOM(p_usb_hs3_core_clk, USB_HS3_CORE_CLK, 0); +static DEFINE_CLK_PCOM(p_usb_hs3_p_clk, USB_HS3_P_CLK, 0); +static DEFINE_CLK_PCOM(p_qup_i2c_clk, QUP_I2C_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_spi_clk, SPI_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_spi_p_clk, SPI_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_uart1_clk, UART1_CLK, 0); +static DEFINE_CLK_PCOM(p_uart1dm_clk, UART1DM_CLK, 0); +static DEFINE_CLK_PCOM(p_uart2dm_clk, UART2DM_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_usb_hs_clk, USB_HS_CLK, 0); +static DEFINE_CLK_PCOM(p_usb_hs_core_clk, USB_HS_CORE_CLK, 0); +static DEFINE_CLK_PCOM(p_usb_hs_p_clk, USB_HS_P_CLK, 0); +static DEFINE_CLK_PCOM(p_cam_m_clk, CAM_M_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_camif_pad_p_clk, CAMIF_PAD_P_CLK, 0); +static DEFINE_CLK_PCOM(p_csi0_clk, CSI0_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_csi0_vfe_clk, CSI0_VFE_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_csi0_p_clk, CSI0_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mdp_clk, MDP_CLK, 0); +static DEFINE_CLK_PCOM(p_mfc_clk, MFC_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mfc_div2_clk, MFC_DIV2_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_mfc_p_clk, MFC_P_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_vpe_clk, VPE_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_adm_clk, ADM_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_ce_clk, CE_CLK, CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_axi_rotator_clk, AXI_ROTATOR_CLK, + CLKFLAG_SKIP_AUTO_OFF); +static DEFINE_CLK_PCOM(p_rotator_imem_clk, ROTATOR_IMEM_CLK, 0); +static DEFINE_CLK_PCOM(p_rotator_p_clk, ROTATOR_P_CLK, 0);static struct pcom_clk pbus_clk = { .id =P_PBUS_CLK ,
arch/arm/mach-msm/clock-8960.c +0 -116
812 lines not on this page · raw message
arch/arm/mach-msm/clock-8x60.c +0 -104
728 lines not on this page · raw message
arch/arm/mach-msm/clock-pcom-lookup.c new file +381 -0
381 lines not on this page · raw message
arch/arm/mach-msm/clock-voter.h +1 -0
@@ -34,6 +34,7 @@ static inline struct clk_voter *to_clk_voter(struct clk *clk) .c = { \ .dbg_name = #clk_name, \ .ops = &clk_ops_voter, \ + .flags = CLKFLAG_SKIP_AUTO_OFF, \ CLK_INIT(clk_name.c), \ }, \ }
arch/arm/mach-msm/clock.c +6 -5
@@ -201,9 +201,10 @@ void __init msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks) msm_num_clocks = num_clocks; } -/* The bootloader and/or AMSS may have left various clocks enabled. - * Disable any clocks that belong to us (CLKFLAG_AUTO_OFF) but have - * not been explicitly enabled by a clk_enable() call. +/* + * The bootloader and/or AMSS may have left various clocks enabled. + * Disable any clocks that have not been explicitly enabled by a + * clk_enable() call and don't have the CLKFLAG_SKIP_AUTO_OFF flag. */ static int __init clock_late_init(void) {
@@ -215,9 +216,9 @@ static int __init clock_late_init(void) struct clk *clk = msm_clocks[i].clk; clock_debug_add(clk); - if (clk->flags & CLKFLAG_AUTO_OFF) { + if (!(clk->flags & CLKFLAG_SKIP_AUTO_OFF)) { spin_lock_irqsave(&clk->lock, flags); - if (!clk->count) { + if (!clk->count && clk->ops->auto_off) { count++; clk->ops->auto_off(clk); }
arch/arm/mach-msm/clock.h +1 -2
@@ -28,7 +28,7 @@ #define CLKFLAG_NORESET 0x00000008 #define CLK_FIRST_AVAILABLE_FLAG 0x00000100 -#define CLKFLAG_AUTO_OFF 0x00000200 +#define CLKFLAG_SKIP_AUTO_OFF 0x00000200 #define CLKFLAG_MIN 0x00000400 #define CLKFLAG_MAX 0x00000800
@@ -68,7 +68,6 @@ struct clk { .children = LIST_HEAD_INIT((name).children), \ .siblings = LIST_HEAD_INIT((name).siblings) -#define OFF CLKFLAG_AUTO_OFF #define CLK_MIN CLKFLAG_MIN #define CLK_MAX CLKFLAG_MAX #define CLK_MINMAX (CLK_MIN | CLK_MAX)
arch/arm/mach-msm/devices-msm7x00.c +41 -41
88 lines not on this page · raw message
arch/arm/mach-msm/devices-qsd8x50.c +51 -49
108 lines not on this page · raw message
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 29/34 msm: clock: Expand CLK_MIN, CLK_MAX and CLK_MINMAX macros
In reply to David BrownFrom: Matt Wagantall <[email protected]>
These were just defined to be the same as CLKFLAG_MIN, CLKFLAG_MAX and (CLKFLAG_MIN | CLKFLAG_MAX). Expand them to avoid the unnecessary level of redirection.
--- arch/arm/mach-msm/clock-7x30.c | 4 ++-- arch/arm/mach-msm/clock-debug.c | 6 +++--- arch/arm/mach-msm/clock-pcom-lookup.c | 10 +++++----- arch/arm/mach-msm/clock.h | 7 ++----- arch/arm/mach-msm/devices-msm7x00.c | 2 +- arch/arm/mach-msm/devices-qsd8x50.c | 12 +++++++----- 6 files changed, 20 insertions(+), 21 deletions(-)
arch/arm/mach-msm/clock-7x30.c +2 -2
@@ -2265,11 +2265,11 @@ static struct branch_clk lpa_core_clk = { static DEFINE_CLK_PCOM(adsp_clk, ADSP_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(codec_ssbi_clk, CODEC_SSBI_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, CLK_MIN); +static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN); static DEFINE_CLK_PCOM(ecodec_clk, ECODEC_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(gp_clk, GP_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(uart3_clk, UART3_CLK, 0); -static DEFINE_CLK_PCOM(usb_phy_clk, USB_PHY_CLK, CLK_MIN); +static DEFINE_CLK_PCOM(usb_phy_clk, USB_PHY_CLK, CLKFLAG_MIN); static DEFINE_CLK_PCOM(p_grp_2d_clk, GRP_2D_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(p_grp_2d_p_clk, GRP_2D_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
arch/arm/mach-msm/clock-debug.c +3 -3
@@ -28,15 +28,15 @@ static int clock_debug_rate_set(void *data, u64 val)/* Only increases to max rate will succeed, but that's actually good * for debugging purposes so we don't check for error. */ -if (clock->flags &CLK_MAX ) +if (clock->flags &CLKFLAG_MAX )clk_set_max_rate (clock, val); -if (clock->flags &CLK_MIN ) +if (clock->flags &CLKFLAG_MIN ) ret =clk_set_min_rate (clock, val);else ret =clk_set_rate (clock, val);if (ret !=0 )printk (KERN_ERR "clk_set%s_rate failed (%d)\n" , - (clock->flags &CLK_MIN ) ?"_min" :"" , ret); + (clock->flags &CLKFLAG_MIN ) ?"_min" :"" , ret);return ret; }
arch/arm/mach-msm/clock-pcom-lookup.c +5 -5
@@ -66,10 +66,10 @@ static struct pcom_clk dsi_pixel_clk = { static DEFINE_CLK_PCOM(dsi_ref_clk, DSI_REF_CLK, 0); static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, - CLKFLAG_SKIP_AUTO_OFF | CLK_MIN); + CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN); static DEFINE_CLK_PCOM(ebi2_clk, EBI2_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(ecodec_clk, ECODEC_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(emdh_clk, EMDH_CLK, CLK_MINMAX); +static DEFINE_CLK_PCOM(emdh_clk, EMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX); static DEFINE_CLK_PCOM(gp_clk, GP_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(grp_2d_clk, GRP_2D_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(grp_2d_p_clk, GRP_2D_P_CLK, CLKFLAG_SKIP_AUTO_OFF);
@@ -95,9 +95,9 @@ static DEFINE_CLK_PCOM(mdp_lcdc_pclk_clk, MDP_LCDC_PCLK_CLK, static DEFINE_CLK_PCOM(mdp_vsync_clk, MDP_VSYNC_CLK, 0); static DEFINE_CLK_PCOM(mdp_dsi_p_clk, MDP_DSI_P_CLK, 0); static DEFINE_CLK_PCOM(pbus_clk, PBUS_CLK, - CLKFLAG_SKIP_AUTO_OFF | CLK_MIN); + CLKFLAG_SKIP_AUTO_OFF | CLKFLAG_MIN); static DEFINE_CLK_PCOM(pcm_clk, PCM_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(pmdh_clk, PMDH_CLK, CLK_MINMAX); +static DEFINE_CLK_PCOM(pmdh_clk, PMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX); static DEFINE_CLK_PCOM(sdac_clk, SDAC_CLK, 0); static DEFINE_CLK_PCOM(sdc1_clk, SDC1_CLK, 0); static DEFINE_CLK_PCOM(sdc1_p_clk, SDC1_P_CLK, 0);
@@ -127,7 +127,7 @@ static DEFINE_CLK_PCOM(usb_hs_core_clk, USB_HS_CORE_CLK, 0); static DEFINE_CLK_PCOM(usb_hs_p_clk, USB_HS_P_CLK, 0); static DEFINE_CLK_PCOM(usb_otg_clk, USB_OTG_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(usb_phy_clk, USB_PHY_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(vdc_clk, VDC_CLK, CLK_MIN); +static DEFINE_CLK_PCOM(vdc_clk, VDC_CLK, CLKFLAG_MIN); static DEFINE_CLK_PCOM(vfe_axi_clk, VFE_AXI_CLK, 0); static DEFINE_CLK_PCOM(vfe_clk, VFE_CLK, 0); static DEFINE_CLK_PCOM(vfe_mdc_clk, VFE_MDC_CLK, 0);
arch/arm/mach-msm/clock.h +2 -5
@@ -68,11 +68,8 @@ struct clk { .children = LIST_HEAD_INIT((name).children), \ .siblings = LIST_HEAD_INIT((name).siblings) -#define CLK_MIN CLKFLAG_MIN -#define CLK_MAX CLKFLAG_MAX -#define CLK_MINMAX (CLK_MIN | CLK_MAX) - -#if defined(CONFIG_ARCH_MSM7X30 ) || defined(CONFIG_ARCH_MSM8X60 ) || defined(CONFIG_ARCH_MSM8960 ) +#if defined(CONFIG_ARCH_MSM7X30 ) || defined(CONFIG_ARCH_MSM8X60 ) || \ +defined(CONFIG_ARCH_MSM8960 )void __init msm_clk_soc_init (void );#else static inline void __init msm_clk_soc_init (void ) { }
arch/arm/mach-msm/devices-msm7x00.c +1 -1
@@ -410,7 +410,7 @@ static DEFINE_CLK_PCOM(mdc_clk, MDC_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(mdp_clk, MDP_CLK, 0); static DEFINE_CLK_PCOM(pbus_clk, PBUS_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(pcm_clk, PCM_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(pmdh_clk, PMDH_CLK, CLK_MINMAX); +static DEFINE_CLK_PCOM(pmdh_clk, PMDH_CLK, CLKFLAG_MIN | CLKFLAG_MAX); static DEFINE_CLK_PCOM(sdac_clk, SDAC_CLK, 0); static DEFINE_CLK_PCOM(sdc1_clk, SDC1_CLK, 0); static DEFINE_CLK_PCOM(sdc1_p_clk, SDC1_P_CLK, 0);
arch/arm/mach-msm/devices-qsd8x50.c +7 -5
@@ -294,10 +294,11 @@ int __init msm_add_sdcc(unsigned int controller, static DEFINE_CLK_PCOM(adm_clk, ADM_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(ce_clk, CE_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, CLK_MIN); +static DEFINE_CLK_PCOM(ebi1_clk, EBI1_CLK, CLKFLAG_MIN); static DEFINE_CLK_PCOM(ebi2_clk, EBI2_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(ecodec_clk, ECODEC_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(emdh_clk, EMDH_CLK, CLK_MINMAX); +static DEFINE_CLK_PCOM(emdh_clk, EMDH_CLK, CLKFLAG_MIN | + CLKFLAG_MAX); static DEFINE_CLK_PCOM(gp_clk, GP_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(grp_3d_clk, GRP_3D_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(i2c_clk, I2C_CLK, CLKFLAG_SKIP_AUTO_OFF);
@@ -305,14 +306,15 @@ static DEFINE_CLK_PCOM(icodec_rx_clk, ICODEC_RX_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(icodec_tx_clk, ICODEC_TX_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(imem_clk, IMEM_CLK, 0); static DEFINE_CLK_PCOM(mdc_clk, MDC_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(pmdh_clk, PMDH_CLK, CLK_MINMAX); +static DEFINE_CLK_PCOM(pmdh_clk, PMDH_CLK, CLKFLAG_MIN | + CLKFLAG_MAX); static DEFINE_CLK_PCOM(mdp_clk, MDP_CLK, 0); static DEFINE_CLK_PCOM(mdp_lcdc_pclk_clk, MDP_LCDC_PCLK_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(mdp_lcdc_pad_pclk_clk, MDP_LCDC_PAD_PCLK_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(mdp_vsync_clk, MDP_VSYNC_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(pbus_clk, PBUS_CLK, CLK_MIN); +static DEFINE_CLK_PCOM(pbus_clk, PBUS_CLK, CLKFLAG_MIN); static DEFINE_CLK_PCOM(pcm_clk, PCM_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(sdac_clk, SDAC_CLK, 0); static DEFINE_CLK_PCOM(sdc1_clk, SDC1_CLK, 0);
@@ -336,7 +338,7 @@ static DEFINE_CLK_PCOM(uart2dm_clk, UART2DM_CLK, CLKFLAG_SKIP_AUTO_OFF); static DEFINE_CLK_PCOM(usb_hs_clk, USB_HS_CLK, 0); static DEFINE_CLK_PCOM(usb_hs_p_clk, USB_HS_P_CLK, 0); static DEFINE_CLK_PCOM(usb_otg_clk, USB_OTG_CLK, CLKFLAG_SKIP_AUTO_OFF); -static DEFINE_CLK_PCOM(vdc_clk, VDC_CLK, CLK_MIN); +static DEFINE_CLK_PCOM(vdc_clk, VDC_CLK, CLKFLAG_MIN); static DEFINE_CLK_PCOM(vfe_clk, VFE_CLK, 0); static DEFINE_CLK_PCOM(vfe_mdc_clk, VFE_MDC_CLK, 0); static DEFINE_CLK_PCOM(vfe_axi_clk, VFE_AXI_CLK, 0);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 30/34 msm: clock: Add EBI1 voter clocks for ADM on SoCs without them
In reply to David BrownFrom: Matt Wagantall <[email protected]>
The ADM driver wishes to vote for EBI1 clock rates during ADM transfers. Add voter clocks for this purpose.
On msm8960, this also requires the creation of an EBI voter clock for the msm_bus driver, since it was previously using the clock directly.
--- arch/arm/mach-msm/clock-7x30.c | 2 ++ arch/arm/mach-msm/clock-pcom-lookup.c | 4 ++++ 2 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-msm/clock-7x30.c +2 -0
@@ -2373,6 +2373,7 @@ static DEFINE_CLK_VOTER(ebi_mddi_clk, &pbus_clk.c); static DEFINE_CLK_VOTER(ebi_tv_clk, &pbus_clk.c); static DEFINE_CLK_VOTER(ebi_vcd_clk, &pbus_clk.c); static DEFINE_CLK_VOTER(ebi_vfe_clk, &pbus_clk.c); +static DEFINE_CLK_VOTER(ebi_adm_clk, &pbus_clk.c);/* * SoC-specific functions required by clock-local driver
@@ -2757,6 +2758,7 @@ static struct clk_local_ownership { { CLK_LOOKUP("ebi1_tv_clk", ebi_tv_clk.c, NULL) }, { CLK_LOOKUP("ebi1_vcd_clk", ebi_vcd_clk.c, NULL) }, { CLK_LOOKUP("ebi1_vfe_clk", ebi_vfe_clk.c, NULL) }, + { CLK_LOOKUP("ebi1_clk", ebi_adm_clk.c, "msm_dmov") },/* * This is a many-to-one mapping because we don't know how the remote
arch/arm/mach-msm/clock-pcom-lookup.c +4 -0
@@ -139,6 +139,7 @@ static DEFINE_CLK_VOTER(ebi_mddi_clk, &ebi1_clk.c); static DEFINE_CLK_VOTER(ebi_tv_clk, &ebi1_clk.c); static DEFINE_CLK_VOTER(ebi_usb_clk, &ebi1_clk.c); static DEFINE_CLK_VOTER(ebi_vfe_clk, &ebi1_clk.c); +static DEFINE_CLK_VOTER(ebi_adm_clk, &ebi1_clk.c);struct clk_lookup msm_clocks_7x01a[] = {CLK_LOOKUP ("adm_clk" , adm_clk.c,NULL ),
@@ -236,6 +237,7 @@ struct clk_lookup msm_clocks_7x27[] = {CLK_LOOKUP ("ebi1_mddi_clk" , ebi_mddi_clk.c,NULL ),CLK_LOOKUP ("ebi1_usb_clk" , ebi_usb_clk.c,NULL ),CLK_LOOKUP ("ebi1_vfe_clk" , ebi_vfe_clk.c,NULL ), + CLK_LOOKUP("ebi1_clk", ebi_adm_clk.c, "msm_dmov"), };unsigned msm_num_clocks_7x27 =ARRAY_SIZE (msm_clocks_7x27);
@@ -307,6 +309,7 @@ struct clk_lookup msm_clocks_7x27a[] = {CLK_LOOKUP ("ebi1_mddi_clk" , ebi_mddi_clk.c,NULL ),CLK_LOOKUP ("ebi1_usb_clk" , ebi_usb_clk.c,NULL ),CLK_LOOKUP ("ebi1_vfe_clk" , ebi_vfe_clk.c,NULL ), + CLK_LOOKUP("ebi1_clk", ebi_adm_clk.c, "msm_dmov"), };unsigned msm_num_clocks_7x27a =ARRAY_SIZE (msm_clocks_7x27a);
@@ -371,6 +374,7 @@ struct clk_lookup msm_clocks_8x50[] = {CLK_LOOKUP ("ebi1_tv_clk" , ebi_tv_clk.c,NULL ),CLK_LOOKUP ("ebi1_usb_clk" , ebi_usb_clk.c,NULL ),CLK_LOOKUP ("ebi1_vfe_clk" , ebi_vfe_clk.c,NULL ), +CLK_LOOKUP ("ebi1_clk" , ebi_adm_clk.c,"msm_dmov" ),CLK_LOOKUP ("grp_pclk" , grp_3d_p_clk.c,NULL ), CLK_LOOKUP("grp_2d_clk", grp_2d_clk.c, NULL),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 31/34 msm: clock: Remove msm_clk_soc_init()
In reply to David BrownFrom: Stephen Boyd <[email protected]>
Every board file calls msm_clock_init() to initialize the clocks and msm_clock_init() in turn calls msm_clk_soc_init() to do any SoC specific initialization. Invert the call order so that boards that require SoC specific initialization call the SoC specific function first which then calls the generic msm_clock_init().
This removes one more obstacle in the path of multi-arch kernels in mach-msm.
--- arch/arm/mach-msm/board-msm7x30.c | 2 +- arch/arm/mach-msm/board-msm8960.c | 2 +- arch/arm/mach-msm/board-msm8x60.c | 2 +- arch/arm/mach-msm/clock-7x30.c | 7 ++++--- arch/arm/mach-msm/clock-8960.c | 9 ++++----- arch/arm/mach-msm/clock-8x60.c | 7 ++++--- arch/arm/mach-msm/clock.c | 3 --- arch/arm/mach-msm/clock.h | 11 +++++------ arch/arm/mach-msm/devices.h | 10 +--------- arch/arm/mach-msm/include/mach/board.h | 2 -- 10 files changed, 21 insertions(+), 34 deletions(-)
arch/arm/mach-msm/board-msm7x30.c +1 -1
@@ -117,7 +117,7 @@ static void __init msm7x30_init(void)static void __init msm7x30_map_io (void ) {msm_map_msm7x30_io (); -msm_clock_init (msm_clocks_7x30, msm_num_clocks_7x30); +msm7x30_clock_init (); }MACHINE_START (MSM7X30_SURF ,"QCT MSM7X30 SURF" )
arch/arm/mach-msm/board-msm8960.c +1 -1
@@ -55,7 +55,7 @@ static void __init msm8960_map_io(void)static void __init msm8960_init_early (void ) { -msm_clock_init (msm_clocks_8960, msm_num_clocks_8960); +msm8960_clock_init (); }static void __init msm8960_init_irq (void )
arch/arm/mach-msm/board-msm8x60.c +1 -1
@@ -55,7 +55,7 @@ static void __init msm8x60_map_io(void)static void __init msm8x60_init_early (void ) { -msm_clock_init (msm_clocks_8x60, msm_num_clocks_8x60); +msm8660_clock_init (); }static void __init msm8x60_init_irq (void )
arch/arm/mach-msm/clock-7x30.c +4 -3
@@ -2862,8 +2862,7 @@ static struct clk_local_ownership { O(GLBL), BIT(8) }, }; -struct clk_lookup msm_clocks_7x30[ARRAY_SIZE (ownership_map)]; -unsigned msm_num_clocks_7x30 =ARRAY_SIZE (msm_clocks_7x30); +static struct clk_lookup msm_clocks_7x30[ARRAY_SIZE (ownership_map)];static void __init set_clock_ownership (void ) {
@@ -2927,7 +2926,7 @@ static const struct reg_init { };/* Local clock driver initialization. */ -void __init msm_clk_soc_init (void ) +void __init msm7x30_clock_init (void ) {int i;u32 val;
@@ -2965,6 +2964,8 @@ void __init msm_clk_soc_init(void)clk_set_rate (&lpa_codec_clk.c,1 );/* Sync the GRP2D clock to AXI */ clk_set_rate (&grp_2d_clk.c,1 ); + +msm_clock_init (msm_clocks_7x30,ARRAY_SIZE (msm_clocks_7x30)); }/*
arch/arm/mach-msm/clock-8960.c +4 -5
@@ -3578,7 +3578,7 @@ static struct clk measure_clk = { CLK_INIT(measure_clk), }; -struct clk_lookup msm_clocks_8960[] = { +static struct clk_lookup msm_clocks_8960[] = {CLK_LOOKUP ("cxo" , cxo_clk.c,NULL ),CLK_LOOKUP ("pll2" , pll2_clk.c,NULL ),CLK_LOOKUP ("pll8" , pll8_clk.c,NULL ),
@@ -3752,8 +3752,6 @@ struct clk_lookup msm_clocks_8960[] = { CLK_LOOKUP("iommu_clk", gfx2d1_clk.c, "msm_iommu.11"), }; -unsigned msm_num_clocks_8960 =ARRAY_SIZE (msm_clocks_8960); -/* * Miscellaneous clock register initializations */
@@ -3892,9 +3890,8 @@ static int wr_pll_clk_enable(struct clk *clk)return 0 ; } -/* Local clock driver initialization. */ -void __init msm_clk_soc_init (void ) +void __init msm8960_clock_init (void ) { soc_update_sys_vdd = msm8960_update_sys_vdd;local_vote_sys_vdd (HIGH );
@@ -3922,6 +3919,8 @@ void __init msm_clk_soc_init(void)rcg_clk_disable (&pdm_clk.c);rcg_clk_enable (&tssc_clk.c);rcg_clk_disable (&tssc_clk.c); + +msm_clock_init (msm_clocks_8960,ARRAY_SIZE (msm_clocks_8960)); }static int __init msm_clk_soc_late_init (void )
arch/arm/mach-msm/clock-8x60.c +4 -3
@@ -3348,7 +3348,7 @@ static struct measure_clk measure_clk = { .multiplier = 1, }; -struct clk_lookup msm_clocks_8x60[] = { +static struct clk_lookup msm_clocks_8x60[] = {CLK_LOOKUP ("cxo" , cxo_clk.c,NULL ),CLK_LOOKUP ("pll4" , pll4_clk.c,NULL ),CLK_LOOKUP ("pll4" , pll4_clk.c,"peripheral-reset" ),
@@ -3518,7 +3518,6 @@ struct clk_lookup msm_clocks_8x60[] = {CLK_LOOKUP ("sc1_mclk" , sc1_m_clk,NULL ), CLK_LOOKUP("l2_mclk", l2_m_clk, NULL), }; -unsigned msm_num_clocks_8x60 =ARRAY_SIZE (msm_clocks_8x60);/* * Miscellaneous clock register initializations
@@ -3620,7 +3619,7 @@ static void __init reg_init(void) }/* Local clock driver initialization. */ -void __init msm_clk_soc_init (void ) +void __init msm8660_clock_init (void ) { soc_update_sys_vdd = msm8660_update_sys_vdd;local_vote_sys_vdd (HIGH );
@@ -3643,6 +3642,8 @@ void __init msm_clk_soc_init(void)rcg_clk_disable (&pdm_clk.c);rcg_clk_enable (&tssc_clk.c);rcg_clk_disable (&tssc_clk.c); + +msm_clock_init (msm_clocks_8x60,ARRAY_SIZE (msm_clocks_8x60)); }static int __init msm_clk_soc_late_init (void )
arch/arm/mach-msm/clock.c +0 -3
@@ -186,9 +186,6 @@ void __init msm_clock_init(struct clk_lookup *clock_tbl, size_t num_clocks) {unsigned n; -/* Do SoC-speficic clock init operations. */ -msm_clk_soc_init (); -for (n =0 ; n < num_clocks; n++) {struct clk *clk = clock_tbl[n].clk;struct clk *parent =clk_get_parent (clk);
arch/arm/mach-msm/clock.h +5 -6
@@ -20,6 +20,7 @@#include <linux/init.h> #include <linux/list.h> #include <linux/spinlock.h> +#include <linux/clkdev.h> #include <mach/clk.h> #define CLKFLAG_INVERT 0x00000001
@@ -68,12 +69,10 @@ struct clk { .children = LIST_HEAD_INIT((name).children), \ .siblings = LIST_HEAD_INIT((name).siblings) -#if defined(CONFIG_ARCH_MSM7X30 ) || defined(CONFIG_ARCH_MSM8X60 ) || \ -defined(CONFIG_ARCH_MSM8960 ) -void __init msm_clk_soc_init (void ); -#else -static inline void __init msm_clk_soc_init (void ) { } -#endif +void msm_clock_init (struct clk_lookup *clock_tbl,size_t num_clocks); +void msm7x30_clock_init (void ); +void msm8660_clock_init (void ); +void msm8960_clock_init (void );#ifdef CONFIG_DEBUG_FS int __init clock_debug_init (void );
arch/arm/mach-msm/devices.h +1 -9
@@ -17,6 +17,7 @@#define __ARCH_ARM_MACH_MSM_DEVICES_H#include <linux/clkdev.h> +#include <linux/platform_device.h> #include "clock.h"
@@ -49,16 +50,7 @@ extern struct platform_device msm_device_mdp;extern struct clk_lookup msm_clocks_7x01a[];extern unsigned msm_num_clocks_7x01a; -extern struct clk_lookup msm_clocks_7x30[]; -extern unsigned msm_num_clocks_7x30; -extern struct clk_lookup msm_clocks_8x50[];extern unsigned msm_num_clocks_8x50; -extern struct clk_lookup msm_clocks_8x60[]; -extern unsigned msm_num_clocks_8x60; - -extern struct clk_lookup msm_clocks_8960[]; -extern unsigned msm_num_clocks_8960; -#endif
arch/arm/mach-msm/include/mach/board.h +0 -2
@@ -40,8 +40,6 @@ extern struct sys_timer msm_timer;void __init msm_add_devices (void );void __init msm_map_common_io (void );void __init msm_init_irq (void ); -void __init msm_init_gpio (void ); -void __init msm_clock_init (struct clk_lookup *clock_tbl,size_t num_clocks);void __init msm_acpu_clock_init (struct msm_acpu_clock_platform_data *); int __init msm_add_sdcc(unsigned int controller, struct msm_mmc_platform_data *plat,
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 32/34 msm: clock-8x60: Add local control of vpe_axi_clk and vpe_axi_clk
In reply to David BrownFrom: Matt Wagantall <[email protected]>
The MAXI_EN2 register is no longer owned by the RPM. Add local control of the VPE and Rotator AXI clocks which are in it.
--- arch/arm/mach-msm/clock-8x60.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-)
arch/arm/mach-msm/clock-8x60.c +16 -3
@@ -122,6 +122,7 @@#define JPEGD_CC_REG REG_MM(0x00A4)#define JPEGD_NS_REG REG_MM(0x00AC)#define MAXI_EN_REG REG_MM(0x0018) +#define MAXI_EN2_REG REG_MM(0x0020)#define MAXI_EN3_REG REG_MM(0x002C)#define MDP_CC_REG REG_MM(0x00C0)#define MDP_MD0_REG REG_MM(0x00C4)
@@ -603,24 +604,32 @@ static struct branch_clk vfe_axi_clk = {static struct branch_clk rot_axi_clk = { .b = { + .ctl_reg =MAXI_EN2_REG , + .en_mask =BIT (24 ), .reset_reg =SW_RESET_AXI_REG , .reset_mask =BIT (6 ), + .halt_reg =DBG_BUS_VEC_E_REG , + .halt_bit =2 , }, .c = { .dbg_name ="rot_axi_clk" , - .ops = &clk_ops_reset, + .ops = &clk_ops_branch,CLK_INIT (rot_axi_clk.c), }, };static struct branch_clk vpe_axi_clk = { .b = { + .ctl_reg =MAXI_EN2_REG , + .en_mask =BIT (26 ), .reset_reg =SW_RESET_AXI_REG , .reset_mask =BIT (15 ), + .halt_reg =DBG_BUS_VEC_E_REG , + .halt_bit =1 , }, .c = { .dbg_name ="vpe_axi_clk" , - .ops = &clk_ops_reset, + .ops = &clk_ops_branch,CLK_INIT (vpe_axi_clk.c), }, };
@@ -2545,6 +2554,7 @@ static struct rcg_clk rot_clk = { .set_rate = set_rate_div_banked, .freq_tbl = clk_tbl_rot, .bank_masks = &bdiv_info_rot, + .depends = &rot_axi_clk.c, .current_freq = &local_dummy_freq, .c = { .dbg_name = "rot_clk",
@@ -2767,6 +2777,7 @@ static struct rcg_clk vpe_clk = { .ns_mask = (BM(15, 12) | BM(2, 0)), .set_rate = set_rate_nop, .freq_tbl = clk_tbl_vpe, + .depends = &vpe_axi_clk.c, .current_freq = &local_dummy_freq, .c = { .dbg_name = "vpe_clk",
@@ -3154,8 +3165,10 @@ static struct measure_sel measure_mux[] = { { TEST_MM_HS(0x13), &imem_axi_clk.c }, { TEST_MM_HS(0x14), &jpegd_axi_clk.c }, { TEST_MM_HS(0x15), &mdp_axi_clk.c }, + { TEST_MM_HS(0x16), &rot_axi_clk.c }, { TEST_MM_HS(0x17), &vcodec_axi_clk.c }, { TEST_MM_HS(0x18), &vfe_axi_clk.c }, + { TEST_MM_HS(0x19), &vpe_axi_clk.c }, { TEST_MM_HS(0x1A), &mdp_clk.c }, { TEST_MM_HS(0x1B), &rot_clk.c }, { TEST_MM_HS(0x1C), &vpe_clk.c },
@@ -3566,7 +3579,7 @@ static void __init reg_init(void)* support it. Also set FORCE_CORE_ON bits, and any sleep and wake-up * delays to safe values. */ rmwreg (0x000207F9 ,MAXI_EN_REG ,0x0FFFFFFF ); -/* MAXI_EN2_REG is owned by the RPM. Don't touch it. */ +writel_relaxed (0x7027FCFF ,MAXI_EN2_REG );writel_relaxed (0x3FE7FCFF ,MAXI_EN3_REG );writel_relaxed (0x000001D8 ,SAXI_EN_REG );
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 33/34 ARM: msm: fix names of UART clocks
In reply to David BrownEarlier code for MSM uarts had three separate drivers, one for the old "legacy" hardware, one for the new DMA-based hardware, and a third that used the DMA-based hardware in a legacy-compatible mode.
The current msm_serial driver handles both the older hardware and the DMA-based hardware in non-DMA mode from the same driver. Rename the clocks for this device to support this usage.
--- arch/arm/mach-msm/clock-8x60.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-msm/clock-8x60.c +2 -2
@@ -3378,7 +3378,7 @@ static struct clk_lookup msm_clocks_8x60[] = {CLK_LOOKUP ("gsbi_uart_clk" , gsbi9_uart_clk.c,"msm_serial_hsl.1" ),CLK_LOOKUP ("gsbi_uart_clk" , gsbi10_uart_clk.c,NULL ),CLK_LOOKUP ("gsbi_uart_clk" , gsbi11_uart_clk.c,NULL ), -CLK_LOOKUP ("gsbi_uart_clk" , gsbi12_uart_clk.c,"msm_serial_hsl.0" ), +CLK_LOOKUP ("gsbi_uart_clk" , gsbi12_uart_clk.c,"msm_serial.0" ),CLK_LOOKUP ("spi_clk" , gsbi1_qup_clk.c,"spi_qsd.0" ),CLK_LOOKUP ("gsbi_qup_clk" , gsbi2_qup_clk.c,NULL ), CLK_LOOKUP("gsbi_qup_clk", gsbi3_qup_clk.c, "qup_i2c.0"),
@@ -3425,7 +3425,7 @@ static struct clk_lookup msm_clocks_8x60[] = {CLK_LOOKUP ("spi_pclk" , gsbi10_p_clk.c,"spi_qsd.1" ),CLK_LOOKUP ("gsbi_pclk" , gsbi11_p_clk.c,NULL ),CLK_LOOKUP ("gsbi_pclk" , gsbi12_p_clk.c,"msm_dsps.0" ), -CLK_LOOKUP ("gsbi_pclk" , gsbi12_p_clk.c,"msm_serial_hsl.0" ), +CLK_LOOKUP ("gsbi_pclk" , gsbi12_p_clk.c,"msm_serial.0" ),CLK_LOOKUP ("gsbi_pclk" , gsbi12_p_clk.c,"qup_i2c.5" ),CLK_LOOKUP ("ppss_pclk" , ppss_p_clk.c,NULL ), CLK_LOOKUP("tsif_pclk", tsif_p_clk.c, NULL),
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
RFC PATCH 34/34 msm_serial: fix clock rate on DMA-based uarts
In reply to David BrownThe driver explicitly requests a clock rate for the UART, but it is off by a factor of four from the dividers that it programs into the UART. Fix this by setting the rate to 1/4 of the current value.
--- drivers/tty/serial/msm_serial.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/tty/serial/msm_serial.c +1 -1
@@ -891,7 +891,7 @@ static int __init msm_serial_probe(struct platform_device *pdev)return PTR_ERR (msm_port->clk);if (msm_port->is_uartdm) -clk_set_rate (msm_port->clk,7372800 ); +clk_set_rate (msm_port->clk,1843200 ); port->uartclk =clk_get_rate (msm_port->clk);printk (KERN_INFO "uartclk = %d\n" , port->uartclk);
Signature · 2 lines
Sent by an employee of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.