msm: clock: Remove references to clk_ops_pcom
Not all devices use proc_comm and determining if a clock is local vs. remote is fragile when done by comparing clk_ops pointers. Instead, implement an is_local() function for all clk_ops to determine if the clock is local. Doing this allows us to remove the last references to clk_ops_pcom from clock.c and compile it for targets with CONFIG_MSM_PROC_COMM=n. We don't need to set the clk_ops at runtime until 7x30 local clock detection comes in. Right now it's just complicating things so just set the ops pointer statically. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: David Brown <davidb@codeaurora.org>
This commit is contained in:
parent
0693a317b6
commit
2a52220c89
|
@ -1,7 +1,6 @@
|
||||||
obj-y += io.o idle.o timer.o
|
obj-y += io.o idle.o timer.o
|
||||||
ifdef CONFIG_MSM_PROC_COMM
|
obj-y += clock.o
|
||||||
obj-$(CONFIG_DEBUG_FS) += clock-debug.o
|
obj-$(CONFIG_DEBUG_FS) += clock-debug.o
|
||||||
endif
|
|
||||||
|
|
||||||
obj-$(CONFIG_MSM_VIC) += irq-vic.o
|
obj-$(CONFIG_MSM_VIC) += irq-vic.o
|
||||||
obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o
|
obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o
|
||||||
|
@ -9,11 +8,8 @@ obj-$(CONFIG_MSM_IOMMU) += iommu.o iommu_dev.o devices-iommu.o
|
||||||
obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o acpuclock-arm11.o
|
obj-$(CONFIG_ARCH_MSM7X00A) += dma.o irq.o acpuclock-arm11.o
|
||||||
obj-$(CONFIG_ARCH_MSM7X30) += dma.o
|
obj-$(CONFIG_ARCH_MSM7X30) += dma.o
|
||||||
obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
|
obj-$(CONFIG_ARCH_QSD8X50) += dma.o sirc.o
|
||||||
obj-$(CONFIG_ARCH_MSM8X60) += clock-dummy.o
|
|
||||||
obj-$(CONFIG_ARCH_MSM8960) += clock-dummy.o
|
|
||||||
|
|
||||||
obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
|
obj-$(CONFIG_MSM_PROC_COMM) += proc_comm.o clock-pcom.o vreg.o
|
||||||
obj-$(CONFIG_MSM_PROC_COMM) += clock.o
|
|
||||||
|
|
||||||
obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
|
obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
|
||||||
obj-$(CONFIG_MSM_SMD) += last_radio_log.o
|
obj-$(CONFIG_MSM_SMD) += last_radio_log.o
|
||||||
|
|
|
@ -145,6 +145,7 @@ extern int internal_pwr_rail_ctl_auto(unsigned rail_id, bool enable);
|
||||||
.flags = clk_flags, \
|
.flags = clk_flags, \
|
||||||
.dev = clk_dev, \
|
.dev = clk_dev, \
|
||||||
.dbg_name = #l_id, \
|
.dbg_name = #l_id, \
|
||||||
|
.ops = &clk_ops_pcom, \
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
#include "clock-pcom.h"
|
|
||||||
|
|
||||||
static int clock_debug_rate_set(void *data, u64 val)
|
static int clock_debug_rate_set(void *data, u64 val)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +78,7 @@ static int clock_debug_local_get(void *data, u64 *val)
|
||||||
{
|
{
|
||||||
struct clk *clock = data;
|
struct clk *clock = data;
|
||||||
|
|
||||||
*val = clock->ops != &clk_ops_pcom;
|
*val = clock->ops->is_local(clock->id);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,54 +0,0 @@
|
||||||
/* Copyright (c) 2010, 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.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301, USA.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#include <linux/clk.h>
|
|
||||||
#include <linux/err.h>
|
|
||||||
#include <linux/module.h>
|
|
||||||
|
|
||||||
struct clk *clk_get(struct device *dev, const char *id)
|
|
||||||
{
|
|
||||||
return ERR_PTR(-ENOENT);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_get);
|
|
||||||
|
|
||||||
int clk_enable(struct clk *clk)
|
|
||||||
{
|
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_enable);
|
|
||||||
|
|
||||||
void clk_disable(struct clk *clk)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_disable);
|
|
||||||
|
|
||||||
unsigned long clk_get_rate(struct clk *clk)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_get_rate);
|
|
||||||
|
|
||||||
int clk_set_rate(struct clk *clk, unsigned long rate)
|
|
||||||
{
|
|
||||||
return -ENOENT;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_set_rate);
|
|
||||||
|
|
||||||
void clk_put(struct clk *clk)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(clk_put);
|
|
|
@ -117,6 +117,11 @@ long pc_clk_round_rate(unsigned id, unsigned rate)
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool pc_clk_is_local(unsigned id)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
struct clk_ops clk_ops_pcom = {
|
struct clk_ops clk_ops_pcom = {
|
||||||
.enable = pc_clk_enable,
|
.enable = pc_clk_enable,
|
||||||
.disable = pc_clk_disable,
|
.disable = pc_clk_disable,
|
||||||
|
@ -129,4 +134,5 @@ struct clk_ops clk_ops_pcom = {
|
||||||
.get_rate = pc_clk_get_rate,
|
.get_rate = pc_clk_get_rate,
|
||||||
.is_enabled = pc_clk_is_enabled,
|
.is_enabled = pc_clk_is_enabled,
|
||||||
.round_rate = pc_clk_round_rate,
|
.round_rate = pc_clk_round_rate,
|
||||||
|
.is_local = pc_clk_is_local,
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,9 +21,6 @@
|
||||||
#include <linux/pm_qos_params.h>
|
#include <linux/pm_qos_params.h>
|
||||||
|
|
||||||
#include "clock.h"
|
#include "clock.h"
|
||||||
#include "proc_comm.h"
|
|
||||||
#include "clock-7x30.h"
|
|
||||||
#include "clock-pcom.h"
|
|
||||||
|
|
||||||
static DEFINE_MUTEX(clocks_mutex);
|
static DEFINE_MUTEX(clocks_mutex);
|
||||||
static DEFINE_SPINLOCK(clocks_lock);
|
static DEFINE_SPINLOCK(clocks_lock);
|
||||||
|
@ -84,8 +81,6 @@ EXPORT_SYMBOL(clk_disable);
|
||||||
|
|
||||||
int clk_reset(struct clk *clk, enum clk_reset_action action)
|
int clk_reset(struct clk *clk, enum clk_reset_action action)
|
||||||
{
|
{
|
||||||
if (!clk->ops->reset)
|
|
||||||
clk->ops->reset = &pc_clk_reset;
|
|
||||||
return clk->ops->reset(clk->remote_id, action);
|
return clk->ops->reset(clk->remote_id, action);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(clk_reset);
|
EXPORT_SYMBOL(clk_reset);
|
||||||
|
@ -162,23 +157,13 @@ EXPORT_SYMBOL(clk_set_flags);
|
||||||
*/
|
*/
|
||||||
static struct clk *ebi1_clk;
|
static struct clk *ebi1_clk;
|
||||||
|
|
||||||
static void __init set_clock_ops(struct clk *clk)
|
|
||||||
{
|
|
||||||
if (!clk->ops) {
|
|
||||||
clk->ops = &clk_ops_pcom;
|
|
||||||
clk->id = clk->remote_id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks)
|
void __init msm_clock_init(struct clk *clock_tbl, unsigned num_clocks)
|
||||||
{
|
{
|
||||||
unsigned n;
|
unsigned n;
|
||||||
|
|
||||||
mutex_lock(&clocks_mutex);
|
mutex_lock(&clocks_mutex);
|
||||||
for (n = 0; n < num_clocks; n++) {
|
for (n = 0; n < num_clocks; n++)
|
||||||
set_clock_ops(&clock_tbl[n]);
|
|
||||||
list_add_tail(&clock_tbl[n].list, &clocks);
|
list_add_tail(&clock_tbl[n].list, &clocks);
|
||||||
}
|
|
||||||
mutex_unlock(&clocks_mutex);
|
mutex_unlock(&clocks_mutex);
|
||||||
|
|
||||||
ebi1_clk = clk_get(NULL, "ebi1_clk");
|
ebi1_clk = clk_get(NULL, "ebi1_clk");
|
||||||
|
|
|
@ -43,6 +43,7 @@ struct clk_ops {
|
||||||
unsigned (*get_rate)(unsigned id);
|
unsigned (*get_rate)(unsigned id);
|
||||||
unsigned (*is_enabled)(unsigned id);
|
unsigned (*is_enabled)(unsigned id);
|
||||||
long (*round_rate)(unsigned id, unsigned rate);
|
long (*round_rate)(unsigned id, unsigned rate);
|
||||||
|
bool (*is_local)(unsigned id);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct clk {
|
struct clk {
|
||||||
|
|
Loading…
Reference in New Issue