Path: blob/master/arch/arm/mach-omap2/clkt2xxx_osc.c
10817 views
/*1* OMAP2xxx osc_clk-specific clock code2*3* Copyright (C) 2005-2008 Texas Instruments, Inc.4* Copyright (C) 2004-2010 Nokia Corporation5*6* Contacts:7* Richard Woodruff <[email protected]>8* Paul Walmsley9*10* Based on earlier work by Tuukka Tikkanen, Tony Lindgren,11* Gordon McNutt and RidgeRun, Inc.12*13* This program is free software; you can redistribute it and/or modify14* it under the terms of the GNU General Public License version 2 as15* published by the Free Software Foundation.16*/17#undef DEBUG1819#include <linux/module.h>20#include <linux/kernel.h>21#include <linux/errno.h>22#include <linux/clk.h>23#include <linux/io.h>2425#include <plat/clock.h>2627#include "clock.h"28#include "clock2xxx.h"29#include "prm2xxx_3xxx.h"30#include "prm-regbits-24xx.h"3132/*33* XXX This does not actually enable the osc_ck, since the osc_ck must34* be running for this function to be called. Instead, this function35* is used to disable an autoidle mode on the osc_ck. The existing36* clk_enable/clk_disable()-based usecounting for osc_ck should be37* replaced with autoidle-based usecounting.38*/39static int omap2_enable_osc_ck(struct clk *clk)40{41u32 pcc;4243pcc = __raw_readl(prcm_clksrc_ctrl);4445__raw_writel(pcc & ~OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);4647return 0;48}4950/*51* XXX This does not actually disable the osc_ck, since doing so would52* immediately halt the system. Instead, this function is used to53* enable an autoidle mode on the osc_ck. The existing54* clk_enable/clk_disable()-based usecounting for osc_ck should be55* replaced with autoidle-based usecounting.56*/57static void omap2_disable_osc_ck(struct clk *clk)58{59u32 pcc;6061pcc = __raw_readl(prcm_clksrc_ctrl);6263__raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);64}6566const struct clkops clkops_oscck = {67.enable = omap2_enable_osc_ck,68.disable = omap2_disable_osc_ck,69};7071unsigned long omap2_osc_clk_recalc(struct clk *clk)72{73return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv();74}75767778