You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge branch 'sh/clkfwk'
This commit is contained in:
@@ -513,6 +513,13 @@ config SH_PCLK_FREQ
|
||||
This is necessary for determining the reference clock value on
|
||||
platforms lacking an RTC.
|
||||
|
||||
config SH_CLK_CPG
|
||||
def_bool y
|
||||
|
||||
config SH_CLK_CPG_LEGACY
|
||||
depends on SH_CLK_CPG
|
||||
def_bool y if !CPU_SUBTYPE_SH7785
|
||||
|
||||
config SH_CLK_MD
|
||||
int "CPU Mode Pin Setting"
|
||||
depends on CPU_SH2
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
* Renesas Technology Corp. R0P7785LC0011RL Support.
|
||||
*
|
||||
* Copyright (C) 2008 Yoshihiro Shimoda
|
||||
* Copyright (C) 2009 Paul Mundt
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/sm501.h>
|
||||
@@ -19,8 +19,11 @@
|
||||
#include <linux/i2c-pca-platform.h>
|
||||
#include <linux/i2c-algo-pca.h>
|
||||
#include <linux/irq.h>
|
||||
#include <asm/heartbeat.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/errno.h>
|
||||
#include <mach/sh7785lcr.h>
|
||||
#include <asm/heartbeat.h>
|
||||
#include <asm/clock.h>
|
||||
|
||||
/*
|
||||
* NOTE: This board has 2 physical memory maps.
|
||||
@@ -273,6 +276,20 @@ void __init init_sh7785lcr_IRQ(void)
|
||||
plat_irq_setup_pins(IRQ_MODE_IRQ3210);
|
||||
}
|
||||
|
||||
static int sh7785lcr_clk_init(void)
|
||||
{
|
||||
struct clk *clk;
|
||||
int ret;
|
||||
|
||||
clk = clk_get(NULL, "extal");
|
||||
if (!clk || IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
ret = clk_set_rate(clk, 33333333);
|
||||
clk_put(clk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void sh7785lcr_power_off(void)
|
||||
{
|
||||
unsigned char *p;
|
||||
@@ -309,6 +326,7 @@ static void __init sh7785lcr_setup(char **cmdline_p)
|
||||
static struct sh_machine_vector mv_sh7785lcr __initmv = {
|
||||
.mv_name = "SH7785LCR",
|
||||
.mv_setup = sh7785lcr_setup,
|
||||
.mv_clk_init = sh7785lcr_clk_init,
|
||||
.mv_init_irq = init_sh7785lcr_IRQ,
|
||||
};
|
||||
|
||||
|
||||
+45
-24
@@ -10,9 +10,9 @@ struct clk;
|
||||
|
||||
struct clk_ops {
|
||||
void (*init)(struct clk *clk);
|
||||
void (*enable)(struct clk *clk);
|
||||
int (*enable)(struct clk *clk);
|
||||
void (*disable)(struct clk *clk);
|
||||
void (*recalc)(struct clk *clk);
|
||||
unsigned long (*recalc)(struct clk *clk);
|
||||
int (*set_rate)(struct clk *clk, unsigned long rate, int algo_id);
|
||||
int (*set_parent)(struct clk *clk, struct clk *parent);
|
||||
long (*round_rate)(struct clk *clk, unsigned long rate);
|
||||
@@ -27,44 +27,46 @@ struct clk {
|
||||
struct clk *parent;
|
||||
struct clk_ops *ops;
|
||||
|
||||
struct list_head children;
|
||||
struct list_head sibling; /* node for children */
|
||||
|
||||
int usecount;
|
||||
|
||||
unsigned long rate;
|
||||
unsigned long flags;
|
||||
|
||||
void __iomem *enable_reg;
|
||||
unsigned int enable_bit;
|
||||
|
||||
unsigned long arch_flags;
|
||||
void *priv;
|
||||
struct dentry *dentry;
|
||||
};
|
||||
|
||||
#define CLK_ALWAYS_ENABLED (1 << 0)
|
||||
#define CLK_RATE_PROPAGATES (1 << 1)
|
||||
#define CLK_NEEDS_INIT (1 << 2)
|
||||
struct clk_lookup {
|
||||
struct list_head node;
|
||||
const char *dev_id;
|
||||
const char *con_id;
|
||||
struct clk *clk;
|
||||
};
|
||||
|
||||
#define CLK_ENABLE_ON_INIT (1 << 0)
|
||||
|
||||
/* Should be defined by processor-specific code */
|
||||
void arch_init_clk_ops(struct clk_ops **, int type);
|
||||
void __deprecated arch_init_clk_ops(struct clk_ops **, int type);
|
||||
int __init arch_clk_init(void);
|
||||
|
||||
/* arch/sh/kernel/cpu/clock.c */
|
||||
int clk_init(void);
|
||||
|
||||
void clk_recalc_rate(struct clk *);
|
||||
|
||||
unsigned long followparent_recalc(struct clk *);
|
||||
void recalculate_root_clocks(void);
|
||||
void propagate_rate(struct clk *);
|
||||
int clk_reparent(struct clk *child, struct clk *parent);
|
||||
int clk_register(struct clk *);
|
||||
void clk_unregister(struct clk *);
|
||||
|
||||
static inline int clk_always_enable(const char *id)
|
||||
{
|
||||
struct clk *clk;
|
||||
int ret;
|
||||
|
||||
clk = clk_get(NULL, id);
|
||||
if (IS_ERR(clk))
|
||||
return PTR_ERR(clk);
|
||||
|
||||
ret = clk_enable(clk);
|
||||
if (ret)
|
||||
clk_put(clk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
/* arch/sh/kernel/cpu/clock-cpg.c */
|
||||
int __init __deprecated cpg_clk_init(void);
|
||||
|
||||
/* the exported API, in addition to clk_set_rate */
|
||||
/**
|
||||
@@ -96,4 +98,23 @@ enum clk_sh_algo_id {
|
||||
|
||||
IP_N1,
|
||||
};
|
||||
|
||||
struct clk_div_mult_table {
|
||||
unsigned int *divisors;
|
||||
unsigned int nr_divisors;
|
||||
unsigned int *multipliers;
|
||||
unsigned int nr_multipliers;
|
||||
};
|
||||
|
||||
struct cpufreq_frequency_table;
|
||||
void clk_rate_table_build(struct clk *clk,
|
||||
struct cpufreq_frequency_table *freq_table,
|
||||
int nr_freqs,
|
||||
struct clk_div_mult_table *src_table,
|
||||
unsigned long *bitmap);
|
||||
|
||||
long clk_rate_table_round(struct clk *clk,
|
||||
struct cpufreq_frequency_table *freq_table,
|
||||
unsigned long rate);
|
||||
|
||||
#endif /* __ASM_SH_CLOCK_H */
|
||||
|
||||
@@ -46,6 +46,8 @@ struct sh_machine_vector {
|
||||
|
||||
void __iomem *(*mv_ioport_map)(unsigned long port, unsigned int size);
|
||||
void (*mv_ioport_unmap)(void __iomem *);
|
||||
|
||||
int (*mv_clk_init)(void);
|
||||
};
|
||||
|
||||
extern struct sh_machine_vector sh_mv;
|
||||
|
||||
@@ -17,5 +17,6 @@ obj-$(CONFIG_ARCH_SHMOBILE) += shmobile/
|
||||
|
||||
obj-$(CONFIG_UBC_WAKEUP) += ubc.o
|
||||
obj-$(CONFIG_SH_ADC) += adc.o
|
||||
obj-$(CONFIG_SH_CLK_CPG) += clock-cpg.o
|
||||
|
||||
obj-y += irq/ init.o clock.o
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/compiler.h>
|
||||
#include <asm/clock.h>
|
||||
|
||||
#ifdef CONFIG_SH_CLK_CPG_LEGACY
|
||||
static struct clk master_clk = {
|
||||
.name = "master_clk",
|
||||
.flags = CLK_ENABLE_ON_INIT,
|
||||
.rate = CONFIG_SH_PCLK_FREQ,
|
||||
};
|
||||
|
||||
static struct clk peripheral_clk = {
|
||||
.name = "peripheral_clk",
|
||||
.parent = &master_clk,
|
||||
.flags = CLK_ENABLE_ON_INIT,
|
||||
};
|
||||
|
||||
static struct clk bus_clk = {
|
||||
.name = "bus_clk",
|
||||
.parent = &master_clk,
|
||||
.flags = CLK_ENABLE_ON_INIT,
|
||||
};
|
||||
|
||||
static struct clk cpu_clk = {
|
||||
.name = "cpu_clk",
|
||||
.parent = &master_clk,
|
||||
.flags = CLK_ENABLE_ON_INIT,
|
||||
};
|
||||
|
||||
/*
|
||||
* The ordering of these clocks matters, do not change it.
|
||||
*/
|
||||
static struct clk *onchip_clocks[] = {
|
||||
&master_clk,
|
||||
&peripheral_clk,
|
||||
&bus_clk,
|
||||
&cpu_clk,
|
||||
};
|
||||
|
||||
int __init __deprecated cpg_clk_init(void)
|
||||
{
|
||||
int i, ret = 0;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(onchip_clocks); i++) {
|
||||
struct clk *clk = onchip_clocks[i];
|
||||
arch_init_clk_ops(&clk->ops, i);
|
||||
if (clk->ops)
|
||||
ret |= clk_register(clk);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Placeholder for compatability, until the lazy CPUs do this
|
||||
* on their own.
|
||||
*/
|
||||
int __init __weak arch_clk_init(void)
|
||||
{
|
||||
return cpg_clk_init();
|
||||
}
|
||||
#endif /* CONFIG_SH_CPG_CLK_LEGACY */
|
||||
+400
-206
File diff suppressed because it is too large
Load Diff
@@ -38,32 +38,27 @@ static struct clk_ops sh7619_master_clk_ops = {
|
||||
.init = master_clk_init,
|
||||
};
|
||||
|
||||
static void module_clk_recalc(struct clk *clk)
|
||||
static unsigned long module_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FREQCR) & 0x0007);
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7619_module_clk_ops = {
|
||||
.recalc = module_clk_recalc,
|
||||
};
|
||||
|
||||
static void bus_clk_recalc(struct clk *clk)
|
||||
static unsigned long bus_clk_recalc(struct clk *clk)
|
||||
{
|
||||
clk->rate = clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 7];
|
||||
return clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 7];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7619_bus_clk_ops = {
|
||||
.recalc = bus_clk_recalc,
|
||||
};
|
||||
|
||||
static void cpu_clk_recalc(struct clk *clk)
|
||||
{
|
||||
clk->rate = clk->parent->rate;
|
||||
}
|
||||
|
||||
static struct clk_ops sh7619_cpu_clk_ops = {
|
||||
.recalc = cpu_clk_recalc,
|
||||
.recalc = followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk_ops *sh7619_clk_ops[] = {
|
||||
@@ -78,4 +73,3 @@ void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
|
||||
if (idx < ARRAY_SIZE(sh7619_clk_ops))
|
||||
*ops = sh7619_clk_ops[idx];
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,7 @@ static struct sh_timer_config cmt0_platform_data = {
|
||||
.name = "CMT0",
|
||||
.channel_offset = 0x02,
|
||||
.timer_bit = 0,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 125,
|
||||
.clocksource_rating = 0, /* disabled due to code generation issues */
|
||||
};
|
||||
@@ -147,7 +147,7 @@ static struct sh_timer_config cmt1_platform_data = {
|
||||
.name = "CMT1",
|
||||
.channel_offset = 0x08,
|
||||
.timer_bit = 1,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 125,
|
||||
.clocksource_rating = 0, /* disabled due to code generation issues */
|
||||
};
|
||||
|
||||
@@ -34,37 +34,37 @@ static const int pfc_divisors[]={1,2,3,4,6,8,12};
|
||||
|
||||
static void master_clk_init(struct clk *clk)
|
||||
{
|
||||
clk->rate = 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
|
||||
return 10000000 * PLL2 * pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7201_master_clk_ops = {
|
||||
.init = master_clk_init,
|
||||
};
|
||||
|
||||
static void module_clk_recalc(struct clk *clk)
|
||||
static unsigned long module_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FREQCR) & 0x0007);
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7201_module_clk_ops = {
|
||||
.recalc = module_clk_recalc,
|
||||
};
|
||||
|
||||
static void bus_clk_recalc(struct clk *clk)
|
||||
static unsigned long bus_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FREQCR) & 0x0007);
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7201_bus_clk_ops = {
|
||||
.recalc = bus_clk_recalc,
|
||||
};
|
||||
|
||||
static void cpu_clk_recalc(struct clk *clk)
|
||||
static unsigned long cpu_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = ((ctrl_inw(FREQCR) >> 4) & 0x0007);
|
||||
clk->rate = clk->parent->rate / ifc_divisors[idx];
|
||||
return clk->parent->rate / ifc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7201_cpu_clk_ops = {
|
||||
|
||||
@@ -46,33 +46,28 @@ static struct clk_ops sh7203_master_clk_ops = {
|
||||
.init = master_clk_init,
|
||||
};
|
||||
|
||||
static void module_clk_recalc(struct clk *clk)
|
||||
static unsigned long module_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FREQCR) & 0x0007);
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7203_module_clk_ops = {
|
||||
.recalc = module_clk_recalc,
|
||||
};
|
||||
|
||||
static void bus_clk_recalc(struct clk *clk)
|
||||
static unsigned long bus_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FREQCR) & 0x0007);
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx-2];
|
||||
return clk->parent->rate / pfc_divisors[idx-2];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7203_bus_clk_ops = {
|
||||
.recalc = bus_clk_recalc,
|
||||
};
|
||||
|
||||
static void cpu_clk_recalc(struct clk *clk)
|
||||
{
|
||||
clk->rate = clk->parent->rate;
|
||||
}
|
||||
|
||||
static struct clk_ops sh7203_cpu_clk_ops = {
|
||||
.recalc = cpu_clk_recalc,
|
||||
.recalc = followparent_recalc,
|
||||
};
|
||||
|
||||
static struct clk_ops *sh7203_clk_ops[] = {
|
||||
|
||||
@@ -41,29 +41,29 @@ static struct clk_ops sh7206_master_clk_ops = {
|
||||
.init = master_clk_init,
|
||||
};
|
||||
|
||||
static void module_clk_recalc(struct clk *clk)
|
||||
static unsigned long module_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FREQCR) & 0x0007);
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7206_module_clk_ops = {
|
||||
.recalc = module_clk_recalc,
|
||||
};
|
||||
|
||||
static void bus_clk_recalc(struct clk *clk)
|
||||
static unsigned long bus_clk_recalc(struct clk *clk)
|
||||
{
|
||||
clk->rate = clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
|
||||
return clk->parent->rate / pll1rate[(ctrl_inw(FREQCR) >> 8) & 0x0007];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7206_bus_clk_ops = {
|
||||
.recalc = bus_clk_recalc,
|
||||
};
|
||||
|
||||
static void cpu_clk_recalc(struct clk *clk)
|
||||
static unsigned long cpu_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FREQCR) & 0x0007);
|
||||
clk->rate = clk->parent->rate / ifc_divisors[idx];
|
||||
return clk->parent->rate / ifc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7206_cpu_clk_ops = {
|
||||
|
||||
@@ -118,7 +118,7 @@ static struct sh_timer_config mtu2_0_platform_data = {
|
||||
.name = "MTU2_0",
|
||||
.channel_offset = -0x80,
|
||||
.timer_bit = 0,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
@@ -149,7 +149,7 @@ static struct sh_timer_config mtu2_1_platform_data = {
|
||||
.name = "MTU2_1",
|
||||
.channel_offset = -0x100,
|
||||
.timer_bit = 1,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
@@ -180,7 +180,7 @@ static struct sh_timer_config mtu2_2_platform_data = {
|
||||
.name = "MTU2_2",
|
||||
.channel_offset = 0x80,
|
||||
.timer_bit = 2,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
|
||||
@@ -255,7 +255,7 @@ static struct sh_timer_config mtu2_0_platform_data = {
|
||||
.name = "MTU2_0",
|
||||
.channel_offset = -0x80,
|
||||
.timer_bit = 0,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
@@ -286,7 +286,7 @@ static struct sh_timer_config mtu2_1_platform_data = {
|
||||
.name = "MTU2_1",
|
||||
.channel_offset = -0x100,
|
||||
.timer_bit = 1,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
@@ -317,7 +317,7 @@ static struct sh_timer_config mtu2_2_platform_data = {
|
||||
.name = "MTU2_2",
|
||||
.channel_offset = 0x80,
|
||||
.timer_bit = 2,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ static struct sh_timer_config cmt0_platform_data = {
|
||||
.name = "CMT0",
|
||||
.channel_offset = 0x02,
|
||||
.timer_bit = 0,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 125,
|
||||
.clocksource_rating = 0, /* disabled due to code generation issues */
|
||||
};
|
||||
@@ -243,7 +243,7 @@ static struct sh_timer_config cmt1_platform_data = {
|
||||
.name = "CMT1",
|
||||
.channel_offset = 0x08,
|
||||
.timer_bit = 1,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 125,
|
||||
.clocksource_rating = 0, /* disabled due to code generation issues */
|
||||
};
|
||||
@@ -275,7 +275,7 @@ static struct sh_timer_config mtu2_0_platform_data = {
|
||||
.name = "MTU2_0",
|
||||
.channel_offset = -0x80,
|
||||
.timer_bit = 0,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
@@ -306,7 +306,7 @@ static struct sh_timer_config mtu2_1_platform_data = {
|
||||
.name = "MTU2_1",
|
||||
.channel_offset = -0x100,
|
||||
.timer_bit = 1,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ static struct sh_timer_config cmt0_platform_data = {
|
||||
.name = "CMT0",
|
||||
.channel_offset = 0x02,
|
||||
.timer_bit = 0,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 125,
|
||||
.clocksource_rating = 0, /* disabled due to code generation issues */
|
||||
};
|
||||
@@ -203,7 +203,7 @@ static struct sh_timer_config cmt1_platform_data = {
|
||||
.name = "CMT1",
|
||||
.channel_offset = 0x08,
|
||||
.timer_bit = 1,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 125,
|
||||
.clocksource_rating = 0, /* disabled due to code generation issues */
|
||||
};
|
||||
@@ -235,7 +235,7 @@ static struct sh_timer_config mtu2_0_platform_data = {
|
||||
.name = "MTU2_0",
|
||||
.channel_offset = -0x80,
|
||||
.timer_bit = 0,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
@@ -266,7 +266,7 @@ static struct sh_timer_config mtu2_1_platform_data = {
|
||||
.name = "MTU2_1",
|
||||
.channel_offset = -0x100,
|
||||
.timer_bit = 1,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
@@ -297,7 +297,7 @@ static struct sh_timer_config mtu2_2_platform_data = {
|
||||
.name = "MTU2_2",
|
||||
.channel_offset = 0x80,
|
||||
.timer_bit = 2,
|
||||
.clk = "module_clk",
|
||||
.clk = "peripheral_clk",
|
||||
.clockevent_rating = 200,
|
||||
};
|
||||
|
||||
|
||||
@@ -38,36 +38,36 @@ static struct clk_ops sh3_master_clk_ops = {
|
||||
.init = master_clk_init,
|
||||
};
|
||||
|
||||
static void module_clk_recalc(struct clk *clk)
|
||||
static unsigned long module_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
|
||||
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh3_module_clk_ops = {
|
||||
.recalc = module_clk_recalc,
|
||||
};
|
||||
|
||||
static void bus_clk_recalc(struct clk *clk)
|
||||
static unsigned long bus_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
|
||||
|
||||
clk->rate = clk->parent->rate / stc_multipliers[idx];
|
||||
return clk->parent->rate / stc_multipliers[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh3_bus_clk_ops = {
|
||||
.recalc = bus_clk_recalc,
|
||||
};
|
||||
|
||||
static void cpu_clk_recalc(struct clk *clk)
|
||||
static unsigned long cpu_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
|
||||
|
||||
clk->rate = clk->parent->rate / ifc_divisors[idx];
|
||||
return clk->parent->rate / ifc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh3_cpu_clk_ops = {
|
||||
|
||||
@@ -39,30 +39,30 @@ static struct clk_ops sh7705_master_clk_ops = {
|
||||
.init = master_clk_init,
|
||||
};
|
||||
|
||||
static void module_clk_recalc(struct clk *clk)
|
||||
static unsigned long module_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = ctrl_inw(FRQCR) & 0x0003;
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7705_module_clk_ops = {
|
||||
.recalc = module_clk_recalc,
|
||||
};
|
||||
|
||||
static void bus_clk_recalc(struct clk *clk)
|
||||
static unsigned long bus_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FRQCR) & 0x0300) >> 8;
|
||||
clk->rate = clk->parent->rate / stc_multipliers[idx];
|
||||
return clk->parent->rate / stc_multipliers[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7705_bus_clk_ops = {
|
||||
.recalc = bus_clk_recalc,
|
||||
};
|
||||
|
||||
static void cpu_clk_recalc(struct clk *clk)
|
||||
static unsigned long cpu_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int idx = (ctrl_inw(FRQCR) & 0x0030) >> 4;
|
||||
clk->rate = clk->parent->rate / ifc_divisors[idx];
|
||||
return clk->parent->rate / ifc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7705_cpu_clk_ops = {
|
||||
|
||||
@@ -34,36 +34,36 @@ static struct clk_ops sh7706_master_clk_ops = {
|
||||
.init = master_clk_init,
|
||||
};
|
||||
|
||||
static void module_clk_recalc(struct clk *clk)
|
||||
static unsigned long module_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
|
||||
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7706_module_clk_ops = {
|
||||
.recalc = module_clk_recalc,
|
||||
};
|
||||
|
||||
static void bus_clk_recalc(struct clk *clk)
|
||||
static unsigned long bus_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
|
||||
|
||||
clk->rate = clk->parent->rate / stc_multipliers[idx];
|
||||
return clk->parent->rate / stc_multipliers[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7706_bus_clk_ops = {
|
||||
.recalc = bus_clk_recalc,
|
||||
};
|
||||
|
||||
static void cpu_clk_recalc(struct clk *clk)
|
||||
static unsigned long cpu_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
|
||||
|
||||
clk->rate = clk->parent->rate / ifc_divisors[idx];
|
||||
return clk->parent->rate / ifc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7706_cpu_clk_ops = {
|
||||
|
||||
@@ -41,12 +41,12 @@ static struct clk_ops sh7709_master_clk_ops = {
|
||||
.init = master_clk_init,
|
||||
};
|
||||
|
||||
static void module_clk_recalc(struct clk *clk)
|
||||
static unsigned long module_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
|
||||
|
||||
clk->rate = clk->parent->rate / pfc_divisors[idx];
|
||||
return clk->parent->rate / pfc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7709_module_clk_ops = {
|
||||
@@ -56,25 +56,25 @@ static struct clk_ops sh7709_module_clk_ops = {
|
||||
.recalc = module_clk_recalc,
|
||||
};
|
||||
|
||||
static void bus_clk_recalc(struct clk *clk)
|
||||
static unsigned long bus_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = (frqcr & 0x0080) ?
|
||||
((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4) : 1;
|
||||
|
||||
clk->rate = clk->parent->rate * stc_multipliers[idx];
|
||||
return clk->parent->rate * stc_multipliers[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7709_bus_clk_ops = {
|
||||
.recalc = bus_clk_recalc,
|
||||
};
|
||||
|
||||
static void cpu_clk_recalc(struct clk *clk)
|
||||
static unsigned long cpu_clk_recalc(struct clk *clk)
|
||||
{
|
||||
int frqcr = ctrl_inw(FRQCR);
|
||||
int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
|
||||
|
||||
clk->rate = clk->parent->rate / ifc_divisors[idx];
|
||||
return clk->parent->rate / ifc_divisors[idx];
|
||||
}
|
||||
|
||||
static struct clk_ops sh7709_cpu_clk_ops = {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user