···11-/*22- * OMAP2xxx osc_clk-specific clock code33- *44- * Copyright (C) 2005-2008 Texas Instruments, Inc.55- * Copyright (C) 2004-2010 Nokia Corporation66- *77- * Contacts:88- * Richard Woodruff <r-woodruff2@ti.com>99- * Paul Walmsley1010- *1111- * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,1212- * Gordon McNutt and RidgeRun, Inc.1313- *1414- * This program is free software; you can redistribute it and/or modify1515- * it under the terms of the GNU General Public License version 2 as1616- * published by the Free Software Foundation.1717- */1818-#undef DEBUG1919-2020-#include <linux/module.h>2121-#include <linux/kernel.h>2222-#include <linux/errno.h>2323-#include <linux/clk.h>2424-#include <linux/io.h>2525-2626-#include "clock.h"2727-#include "clock2xxx.h"2828-#include "prm2xxx_3xxx.h"2929-#include "prm-regbits-24xx.h"3030-3131-/*3232- * XXX This does not actually enable the osc_ck, since the osc_ck must3333- * be running for this function to be called. Instead, this function3434- * is used to disable an autoidle mode on the osc_ck. The existing3535- * clk_enable/clk_disable()-based usecounting for osc_ck should be3636- * replaced with autoidle-based usecounting.3737- */3838-int omap2_enable_osc_ck(struct clk_hw *clk)3939-{4040- u32 pcc;4141-4242- pcc = readl_relaxed(prcm_clksrc_ctrl);4343-4444- writel_relaxed(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);4545-4646- return 0;4747-}4848-4949-/*5050- * XXX This does not actually disable the osc_ck, since doing so would5151- * immediately halt the system. Instead, this function is used to5252- * enable an autoidle mode on the osc_ck. The existing5353- * clk_enable/clk_disable()-based usecounting for osc_ck should be5454- * replaced with autoidle-based usecounting.5555- */5656-void omap2_disable_osc_ck(struct clk_hw *clk)5757-{5858- u32 pcc;5959-6060- pcc = readl_relaxed(prcm_clksrc_ctrl);6161-6262- writel_relaxed(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);6363-}6464-6565-unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,6666- unsigned long parent_rate)6767-{6868- return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv();6969-}
-47
arch/arm/mach-omap2/clkt2xxx_sys.c
···11-/*22- * OMAP2xxx sys_clk-specific clock code33- *44- * Copyright (C) 2005-2008 Texas Instruments, Inc.55- * Copyright (C) 2004-2010 Nokia Corporation66- *77- * Contacts:88- * Richard Woodruff <r-woodruff2@ti.com>99- * Paul Walmsley1010- *1111- * Based on earlier work by Tuukka Tikkanen, Tony Lindgren,1212- * Gordon McNutt and RidgeRun, Inc.1313- *1414- * This program is free software; you can redistribute it and/or modify1515- * it under the terms of the GNU General Public License version 2 as1616- * published by the Free Software Foundation.1717- */1818-#undef DEBUG1919-2020-#include <linux/kernel.h>2121-#include <linux/errno.h>2222-#include <linux/clk.h>2323-#include <linux/io.h>2424-2525-#include "clock.h"2626-#include "clock2xxx.h"2727-#include "prm2xxx_3xxx.h"2828-#include "prm-regbits-24xx.h"2929-3030-void __iomem *prcm_clksrc_ctrl;3131-3232-u32 omap2xxx_get_sysclkdiv(void)3333-{3434- u32 div;3535-3636- div = readl_relaxed(prcm_clksrc_ctrl);3737- div &= OMAP_SYSCLKDIV_MASK;3838- div >>= OMAP_SYSCLKDIV_SHIFT;3939-4040- return div;4141-}4242-4343-unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,4444- unsigned long parent_rate)4545-{4646- return parent_rate / omap2xxx_get_sysclkdiv();4747-}
-21
arch/arm/mach-omap2/clock.c
···8282}83838484/*8585- * Used for clocks that have the same value as the parent clock,8686- * divided by some factor8787- */8888-unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,8989- unsigned long parent_rate)9090-{9191- struct clk_hw_omap *oclk;9292-9393- if (!hw) {9494- pr_warn("%s: hw is NULL\n", __func__);9595- return -EINVAL;9696- }9797-9898- oclk = to_clk_hw_omap(hw);9999-100100- WARN_ON(!oclk->fixed_div);101101-102102- return parent_rate / oclk->fixed_div;103103-}104104-105105-/*10685 * OMAP2+ specific clock functions10786 */10887
-3
arch/arm/mach-omap2/clock.h
···178178 const struct clksel_rate *rates;179179};180180181181-unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,182182- unsigned long parent_rate);183183-184181/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */185182#define CORE_CLK_SRC_32K 0x0186183#define CORE_CLK_SRC_DPLL 0x1