mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-18 06:50:08 +00:00
OMAP2xxx clock: move sys_clk code into mach-omap2/clkt2xxx_sys.c
Move the sys_clk clock functions from clock2xxx.c to mach-omap2/clkt2xxx_sys.c. This is intended to make the clock code easier to understand, since all of the functions needed to manage the sys_clk are now located in their own file, rather than being mixed with other, unrelated functions. Clock debugging is also now more finely-grained, since the DEBUG macro can now be defined for the sys_clk clock alone. This should reduce unnecessary console noise when debugging. Also, if at some future point the mach-omap2/ directory is split into OMAP2/3/4 variants, this clkt file can be placed in the mach-omap2xxx/ directory, rather than shared with other chip types that don't use this clock type. Thanks to Alexander Shishkin <virtuoso@slind.org> for his comments to improve the patch description. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Alexander Shishkin <virtuoso@slind.org>
This commit is contained in:
parent
87a1b26c2d
commit
44da0a5103
@ -13,7 +13,8 @@ clock-common = clock.o clock_common_data.o \
|
||||
clkt_clksel.o
|
||||
clock-omap2xxx = clkt2xxx_dpllcore.o \
|
||||
clkt2xxx_virt_prcm_set.o \
|
||||
clkt2xxx_apll.o clkt2xxx_osc.o
|
||||
clkt2xxx_apll.o clkt2xxx_osc.o \
|
||||
clkt2xxx_sys.o
|
||||
|
||||
obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(prcm-common) $(clock-common) \
|
||||
$(clock-omap2xxx)
|
||||
|
50
arch/arm/mach-omap2/clkt2xxx_sys.c
Normal file
50
arch/arm/mach-omap2/clkt2xxx_sys.c
Normal file
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* OMAP2xxx sys_clk-specific clock code
|
||||
*
|
||||
* Copyright (C) 2005-2008 Texas Instruments, Inc.
|
||||
* Copyright (C) 2004-2010 Nokia Corporation
|
||||
*
|
||||
* Contacts:
|
||||
* Richard Woodruff <r-woodruff2@ti.com>
|
||||
* Paul Walmsley
|
||||
*
|
||||
* Based on earlier work by Tuukka Tikkanen, Tony Lindgren,
|
||||
* Gordon McNutt and RidgeRun, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#undef DEBUG
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/io.h>
|
||||
|
||||
#include <plat/clock.h>
|
||||
|
||||
#include "clock.h"
|
||||
#include "clock2xxx.h"
|
||||
#include "prm.h"
|
||||
#include "prm-regbits-24xx.h"
|
||||
|
||||
void __iomem *prcm_clksrc_ctrl;
|
||||
|
||||
u32 omap2xxx_get_sysclkdiv(void)
|
||||
{
|
||||
u32 div;
|
||||
|
||||
div = __raw_readl(prcm_clksrc_ctrl);
|
||||
div &= OMAP_SYSCLKDIV_MASK;
|
||||
div >>= OMAP_SYSCLKDIV_SHIFT;
|
||||
|
||||
return div;
|
||||
}
|
||||
|
||||
unsigned long omap2xxx_sys_clk_recalc(struct clk *clk)
|
||||
{
|
||||
return clk->parent->rate / omap2xxx_get_sysclkdiv();
|
||||
}
|
||||
|
||||
|
@ -46,8 +46,6 @@
|
||||
|
||||
struct clk *vclk, *sclk, *dclk;
|
||||
|
||||
void __iomem *prcm_clksrc_ctrl;
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Omap24xx specific clock functions
|
||||
*-------------------------------------------------------------------------*/
|
||||
@ -79,34 +77,6 @@ const struct clkops clkops_omap2430_i2chs_wait = {
|
||||
.find_companion = omap2_clk_dflt_find_companion,
|
||||
};
|
||||
|
||||
#ifdef OLD_CK
|
||||
/* Recalculate SYST_CLK */
|
||||
static void omap2_sys_clk_recalc(struct clk *clk)
|
||||
{
|
||||
u32 div = PRCM_CLKSRC_CTRL;
|
||||
div &= (1 << 7) | (1 << 6); /* Test if ext clk divided by 1 or 2 */
|
||||
div >>= clk->rate_offset;
|
||||
clk->rate = (clk->parent->rate / div);
|
||||
propagate_rate(clk);
|
||||
}
|
||||
#endif /* OLD_CK */
|
||||
|
||||
u32 omap2xxx_get_sysclkdiv(void)
|
||||
{
|
||||
u32 div;
|
||||
|
||||
div = __raw_readl(prcm_clksrc_ctrl);
|
||||
div &= OMAP_SYSCLKDIV_MASK;
|
||||
div >>= OMAP_SYSCLKDIV_SHIFT;
|
||||
|
||||
return div;
|
||||
}
|
||||
|
||||
unsigned long omap2_sys_clk_recalc(struct clk *clk)
|
||||
{
|
||||
return clk->parent->rate / omap2xxx_get_sysclkdiv();
|
||||
}
|
||||
|
||||
/*
|
||||
* Set clocks for bypass mode for reboot to work.
|
||||
*/
|
||||
|
@ -11,9 +11,8 @@
|
||||
unsigned long omap2_table_mpu_recalc(struct clk *clk);
|
||||
int omap2_select_table_rate(struct clk *clk, unsigned long rate);
|
||||
long omap2_round_to_table_rate(struct clk *clk, unsigned long rate);
|
||||
unsigned long omap2_sys_clk_recalc(struct clk *clk);
|
||||
unsigned long omap2xxx_sys_clk_recalc(struct clk *clk);
|
||||
unsigned long omap2_osc_clk_recalc(struct clk *clk);
|
||||
unsigned long omap2_sys_clk_recalc(struct clk *clk);
|
||||
unsigned long omap2_dpllcore_recalc(struct clk *clk);
|
||||
int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);
|
||||
unsigned long omap2xxx_clk_get_core_rate(struct clk *clk);
|
||||
|
@ -79,7 +79,7 @@ static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
|
||||
.ops = &clkops_null,
|
||||
.parent = &osc_ck,
|
||||
.clkdm_name = "wkup_clkdm",
|
||||
.recalc = &omap2_sys_clk_recalc,
|
||||
.recalc = &omap2xxx_sys_clk_recalc,
|
||||
};
|
||||
|
||||
static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
|
||||
@ -2264,7 +2264,7 @@ int __init omap2_clk_init(void)
|
||||
|
||||
osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
|
||||
propagate_rate(&osc_ck);
|
||||
sys_ck.rate = omap2_sys_clk_recalc(&sys_ck);
|
||||
sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
|
||||
propagate_rate(&sys_ck);
|
||||
|
||||
for (c = omap24xx_clks; c < omap24xx_clks + ARRAY_SIZE(omap24xx_clks); c++)
|
||||
|
Loading…
Reference in New Issue
Block a user