mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-25 05:34:00 +08:00
79 lines
1.6 KiB
C
79 lines
1.6 KiB
C
|
/*
|
||
|
* OMAP4-specific DPLL control functions
|
||
|
*
|
||
|
* Copyright (C) 2011 Texas Instruments, Inc.
|
||
|
* Rajendra Nayak
|
||
|
*
|
||
|
* 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.
|
||
|
*/
|
||
|
|
||
|
#include <linux/kernel.h>
|
||
|
#include <linux/errno.h>
|
||
|
#include <linux/clk.h>
|
||
|
#include <linux/io.h>
|
||
|
#include <linux/bitops.h>
|
||
|
|
||
|
#include <plat/cpu.h>
|
||
|
#include <plat/clock.h>
|
||
|
|
||
|
#include "clock.h"
|
||
|
#include "cm-regbits-44xx.h"
|
||
|
|
||
|
/* Supported only on OMAP4 */
|
||
|
int omap4_dpllmx_gatectrl_read(struct clk *clk)
|
||
|
{
|
||
|
u32 v;
|
||
|
u32 mask;
|
||
|
|
||
|
if (!clk || !clk->clksel_reg || !cpu_is_omap44xx())
|
||
|
return -EINVAL;
|
||
|
|
||
|
mask = clk->flags & CLOCK_CLKOUTX2 ?
|
||
|
OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK :
|
||
|
OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK;
|
||
|
|
||
|
v = __raw_readl(clk->clksel_reg);
|
||
|
v &= mask;
|
||
|
v >>= __ffs(mask);
|
||
|
|
||
|
return v;
|
||
|
}
|
||
|
|
||
|
void omap4_dpllmx_allow_gatectrl(struct clk *clk)
|
||
|
{
|
||
|
u32 v;
|
||
|
u32 mask;
|
||
|
|
||
|
if (!clk || !clk->clksel_reg || !cpu_is_omap44xx())
|
||
|
return;
|
||
|
|
||
|
mask = clk->flags & CLOCK_CLKOUTX2 ?
|
||
|
OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK :
|
||
|
OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK;
|
||
|
|
||
|
v = __raw_readl(clk->clksel_reg);
|
||
|
/* Clear the bit to allow gatectrl */
|
||
|
v &= ~mask;
|
||
|
__raw_writel(v, clk->clksel_reg);
|
||
|
}
|
||
|
|
||
|
void omap4_dpllmx_deny_gatectrl(struct clk *clk)
|
||
|
{
|
||
|
u32 v;
|
||
|
u32 mask;
|
||
|
|
||
|
if (!clk || !clk->clksel_reg || !cpu_is_omap44xx())
|
||
|
return;
|
||
|
|
||
|
mask = clk->flags & CLOCK_CLKOUTX2 ?
|
||
|
OMAP4430_DPLL_CLKOUTX2_GATE_CTRL_MASK :
|
||
|
OMAP4430_DPLL_CLKOUT_GATE_CTRL_MASK;
|
||
|
|
||
|
v = __raw_readl(clk->clksel_reg);
|
||
|
/* Set the bit to deny gatectrl */
|
||
|
v |= mask;
|
||
|
__raw_writel(v, clk->clksel_reg);
|
||
|
}
|