Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
clock.c File Reference
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/clk.h>
#include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/list.h>
#include <linux/err.h>
#include <asm/mach-jz4740/clock.h>
#include <asm/mach-jz4740/base.h>
#include "clock.h"

Go to the source code of this file.

Data Structures

struct  main_clk
 
struct  divided_clk
 
struct  static_clk
 

Macros

#define JZ_REG_CLOCK_CTRL   0x00
 
#define JZ_REG_CLOCK_LOW_POWER   0x04
 
#define JZ_REG_CLOCK_PLL   0x10
 
#define JZ_REG_CLOCK_GATE   0x20
 
#define JZ_REG_CLOCK_SLEEP_CTRL   0x24
 
#define JZ_REG_CLOCK_I2S   0x60
 
#define JZ_REG_CLOCK_LCD   0x64
 
#define JZ_REG_CLOCK_MMC   0x68
 
#define JZ_REG_CLOCK_UHC   0x6C
 
#define JZ_REG_CLOCK_SPI   0x74
 
#define JZ_CLOCK_CTRL_I2S_SRC_PLL   BIT(31)
 
#define JZ_CLOCK_CTRL_KO_ENABLE   BIT(30)
 
#define JZ_CLOCK_CTRL_UDC_SRC_PLL   BIT(29)
 
#define JZ_CLOCK_CTRL_UDIV_MASK   0x1f800000
 
#define JZ_CLOCK_CTRL_CHANGE_ENABLE   BIT(22)
 
#define JZ_CLOCK_CTRL_PLL_HALF   BIT(21)
 
#define JZ_CLOCK_CTRL_LDIV_MASK   0x001f0000
 
#define JZ_CLOCK_CTRL_UDIV_OFFSET   23
 
#define JZ_CLOCK_CTRL_LDIV_OFFSET   16
 
#define JZ_CLOCK_CTRL_MDIV_OFFSET   12
 
#define JZ_CLOCK_CTRL_PDIV_OFFSET   8
 
#define JZ_CLOCK_CTRL_HDIV_OFFSET   4
 
#define JZ_CLOCK_CTRL_CDIV_OFFSET   0
 
#define JZ_CLOCK_GATE_UART0   BIT(0)
 
#define JZ_CLOCK_GATE_TCU   BIT(1)
 
#define JZ_CLOCK_GATE_RTC   BIT(2)
 
#define JZ_CLOCK_GATE_I2C   BIT(3)
 
#define JZ_CLOCK_GATE_SPI   BIT(4)
 
#define JZ_CLOCK_GATE_AIC   BIT(5)
 
#define JZ_CLOCK_GATE_I2S   BIT(6)
 
#define JZ_CLOCK_GATE_MMC   BIT(7)
 
#define JZ_CLOCK_GATE_ADC   BIT(8)
 
#define JZ_CLOCK_GATE_CIM   BIT(9)
 
#define JZ_CLOCK_GATE_LCD   BIT(10)
 
#define JZ_CLOCK_GATE_UDC   BIT(11)
 
#define JZ_CLOCK_GATE_DMAC   BIT(12)
 
#define JZ_CLOCK_GATE_IPU   BIT(13)
 
#define JZ_CLOCK_GATE_UHC   BIT(14)
 
#define JZ_CLOCK_GATE_UART1   BIT(15)
 
#define JZ_CLOCK_I2S_DIV_MASK   0x01ff
 
#define JZ_CLOCK_LCD_DIV_MASK   0x01ff
 
#define JZ_CLOCK_MMC_DIV_MASK   0x001f
 
#define JZ_CLOCK_UHC_DIV_MASK   0x000f
 
#define JZ_CLOCK_SPI_SRC_PLL   BIT(31)
 
#define JZ_CLOCK_SPI_DIV_MASK   0x000f
 
#define JZ_CLOCK_PLL_M_MASK   0x01ff
 
#define JZ_CLOCK_PLL_N_MASK   0x001f
 
#define JZ_CLOCK_PLL_OD_MASK   0x0003
 
#define JZ_CLOCK_PLL_STABLE   BIT(10)
 
#define JZ_CLOCK_PLL_BYPASS   BIT(9)
 
#define JZ_CLOCK_PLL_ENABLED   BIT(8)
 
#define JZ_CLOCK_PLL_STABLIZE_MASK   0x000f
 
#define JZ_CLOCK_PLL_M_OFFSET   23
 
#define JZ_CLOCK_PLL_N_OFFSET   18
 
#define JZ_CLOCK_PLL_OD_OFFSET   16
 
#define JZ_CLOCK_LOW_POWER_MODE_DOZE   BIT(2)
 
#define JZ_CLOCK_LOW_POWER_MODE_SLEEP   BIT(0)
 
#define JZ_CLOCK_SLEEP_CTRL_SUSPEND_UHC   BIT(7)
 
#define JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC   BIT(6)
 

Functions

int clk_enable (struct clk *clk)
 
 EXPORT_SYMBOL_GPL (clk_enable)
 
void clk_disable (struct clk *clk)
 
 EXPORT_SYMBOL_GPL (clk_disable)
 
int clk_is_enabled (struct clk *clk)
 
unsigned long clk_get_rate (struct clk *clk)
 
 EXPORT_SYMBOL_GPL (clk_get_rate)
 
int clk_set_rate (struct clk *clk, unsigned long rate)
 
 EXPORT_SYMBOL_GPL (clk_set_rate)
 
long clk_round_rate (struct clk *clk, unsigned long rate)
 
 EXPORT_SYMBOL_GPL (clk_round_rate)
 
int clk_set_parent (struct clk *clk, struct clk *parent)
 
 EXPORT_SYMBOL_GPL (clk_set_parent)
 
struct clkclk_get (struct device *dev, const char *name)
 
 EXPORT_SYMBOL_GPL (clk_get)
 
void clk_put (struct clk *clk)
 
 EXPORT_SYMBOL_GPL (clk_put)
 
void jz4740_clock_set_wait_mode (enum jz4740_wait_mode mode)
 
void jz4740_clock_udc_disable_auto_suspend (void)
 
 EXPORT_SYMBOL_GPL (jz4740_clock_udc_disable_auto_suspend)
 
void jz4740_clock_udc_enable_auto_suspend (void)
 
 EXPORT_SYMBOL_GPL (jz4740_clock_udc_enable_auto_suspend)
 
void jz4740_clock_suspend (void)
 
void jz4740_clock_resume (void)
 
 arch_initcall (jz4740_clock_init)
 

Macro Definition Documentation

#define JZ_CLOCK_CTRL_CDIV_OFFSET   0

Definition at line 53 of file clock.c.

#define JZ_CLOCK_CTRL_CHANGE_ENABLE   BIT(22)

Definition at line 45 of file clock.c.

#define JZ_CLOCK_CTRL_HDIV_OFFSET   4

Definition at line 52 of file clock.c.

#define JZ_CLOCK_CTRL_I2S_SRC_PLL   BIT(31)

Definition at line 41 of file clock.c.

#define JZ_CLOCK_CTRL_KO_ENABLE   BIT(30)

Definition at line 42 of file clock.c.

#define JZ_CLOCK_CTRL_LDIV_MASK   0x001f0000

Definition at line 47 of file clock.c.

#define JZ_CLOCK_CTRL_LDIV_OFFSET   16

Definition at line 49 of file clock.c.

#define JZ_CLOCK_CTRL_MDIV_OFFSET   12

Definition at line 50 of file clock.c.

#define JZ_CLOCK_CTRL_PDIV_OFFSET   8

Definition at line 51 of file clock.c.

#define JZ_CLOCK_CTRL_PLL_HALF   BIT(21)

Definition at line 46 of file clock.c.

#define JZ_CLOCK_CTRL_UDC_SRC_PLL   BIT(29)

Definition at line 43 of file clock.c.

#define JZ_CLOCK_CTRL_UDIV_MASK   0x1f800000

Definition at line 44 of file clock.c.

#define JZ_CLOCK_CTRL_UDIV_OFFSET   23

Definition at line 48 of file clock.c.

#define JZ_CLOCK_GATE_ADC   BIT(8)

Definition at line 63 of file clock.c.

#define JZ_CLOCK_GATE_AIC   BIT(5)

Definition at line 60 of file clock.c.

#define JZ_CLOCK_GATE_CIM   BIT(9)

Definition at line 64 of file clock.c.

#define JZ_CLOCK_GATE_DMAC   BIT(12)

Definition at line 67 of file clock.c.

#define JZ_CLOCK_GATE_I2C   BIT(3)

Definition at line 58 of file clock.c.

#define JZ_CLOCK_GATE_I2S   BIT(6)

Definition at line 61 of file clock.c.

#define JZ_CLOCK_GATE_IPU   BIT(13)

Definition at line 68 of file clock.c.

#define JZ_CLOCK_GATE_LCD   BIT(10)

Definition at line 65 of file clock.c.

#define JZ_CLOCK_GATE_MMC   BIT(7)

Definition at line 62 of file clock.c.

#define JZ_CLOCK_GATE_RTC   BIT(2)

Definition at line 57 of file clock.c.

#define JZ_CLOCK_GATE_SPI   BIT(4)

Definition at line 59 of file clock.c.

#define JZ_CLOCK_GATE_TCU   BIT(1)

Definition at line 56 of file clock.c.

#define JZ_CLOCK_GATE_UART0   BIT(0)

Definition at line 55 of file clock.c.

#define JZ_CLOCK_GATE_UART1   BIT(15)

Definition at line 70 of file clock.c.

#define JZ_CLOCK_GATE_UDC   BIT(11)

Definition at line 66 of file clock.c.

#define JZ_CLOCK_GATE_UHC   BIT(14)

Definition at line 69 of file clock.c.

#define JZ_CLOCK_I2S_DIV_MASK   0x01ff

Definition at line 72 of file clock.c.

#define JZ_CLOCK_LCD_DIV_MASK   0x01ff

Definition at line 74 of file clock.c.

#define JZ_CLOCK_LOW_POWER_MODE_DOZE   BIT(2)

Definition at line 94 of file clock.c.

#define JZ_CLOCK_LOW_POWER_MODE_SLEEP   BIT(0)

Definition at line 95 of file clock.c.

#define JZ_CLOCK_MMC_DIV_MASK   0x001f

Definition at line 76 of file clock.c.

#define JZ_CLOCK_PLL_BYPASS   BIT(9)

Definition at line 87 of file clock.c.

#define JZ_CLOCK_PLL_ENABLED   BIT(8)

Definition at line 88 of file clock.c.

#define JZ_CLOCK_PLL_M_MASK   0x01ff

Definition at line 83 of file clock.c.

#define JZ_CLOCK_PLL_M_OFFSET   23

Definition at line 90 of file clock.c.

#define JZ_CLOCK_PLL_N_MASK   0x001f

Definition at line 84 of file clock.c.

#define JZ_CLOCK_PLL_N_OFFSET   18

Definition at line 91 of file clock.c.

#define JZ_CLOCK_PLL_OD_MASK   0x0003

Definition at line 85 of file clock.c.

#define JZ_CLOCK_PLL_OD_OFFSET   16

Definition at line 92 of file clock.c.

#define JZ_CLOCK_PLL_STABLE   BIT(10)

Definition at line 86 of file clock.c.

#define JZ_CLOCK_PLL_STABLIZE_MASK   0x000f

Definition at line 89 of file clock.c.

#define JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC   BIT(6)

Definition at line 98 of file clock.c.

#define JZ_CLOCK_SLEEP_CTRL_SUSPEND_UHC   BIT(7)

Definition at line 97 of file clock.c.

#define JZ_CLOCK_SPI_DIV_MASK   0x000f

Definition at line 81 of file clock.c.

#define JZ_CLOCK_SPI_SRC_PLL   BIT(31)

Definition at line 80 of file clock.c.

#define JZ_CLOCK_UHC_DIV_MASK   0x000f

Definition at line 78 of file clock.c.

#define JZ_REG_CLOCK_CTRL   0x00

Definition at line 30 of file clock.c.

#define JZ_REG_CLOCK_GATE   0x20

Definition at line 33 of file clock.c.

#define JZ_REG_CLOCK_I2S   0x60

Definition at line 35 of file clock.c.

#define JZ_REG_CLOCK_LCD   0x64

Definition at line 36 of file clock.c.

#define JZ_REG_CLOCK_LOW_POWER   0x04

Definition at line 31 of file clock.c.

#define JZ_REG_CLOCK_MMC   0x68

Definition at line 37 of file clock.c.

#define JZ_REG_CLOCK_PLL   0x10

Definition at line 32 of file clock.c.

#define JZ_REG_CLOCK_SLEEP_CTRL   0x24

Definition at line 34 of file clock.c.

#define JZ_REG_CLOCK_SPI   0x74

Definition at line 39 of file clock.c.

#define JZ_REG_CLOCK_UHC   0x6C

Definition at line 38 of file clock.c.

Function Documentation

arch_initcall ( jz4740_clock_init  )
void clk_disable ( struct clk clk)

Definition at line 737 of file clock.c.

int clk_enable ( struct clk clk)

Definition at line 728 of file clock.c.

struct clk* clk_get ( struct device dev,
const char name 
)
read

Definition at line 801 of file clock.c.

unsigned long clk_get_rate ( struct clk clk)

Definition at line 752 of file clock.c.

int clk_is_enabled ( struct clk clk)

Definition at line 744 of file clock.c.

void clk_put ( struct clk clk)

Definition at line 813 of file clock.c.

long clk_round_rate ( struct clk clk,
unsigned long  rate 
)

Definition at line 771 of file clock.c.

int clk_set_parent ( struct clk clk,
struct clk parent 
)

Definition at line 780 of file clock.c.

int clk_set_rate ( struct clk clk,
unsigned long  rate 
)

Definition at line 763 of file clock.c.

EXPORT_SYMBOL_GPL ( clk_enable  )
EXPORT_SYMBOL_GPL ( clk_disable  )
EXPORT_SYMBOL_GPL ( clk_get_rate  )
EXPORT_SYMBOL_GPL ( clk_set_rate  )
EXPORT_SYMBOL_GPL ( clk_round_rate  )
EXPORT_SYMBOL_GPL ( clk_set_parent  )
EXPORT_SYMBOL_GPL ( clk_get  )
EXPORT_SYMBOL_GPL ( clk_put  )
EXPORT_SYMBOL_GPL ( jz4740_clock_udc_disable_auto_suspend  )
EXPORT_SYMBOL_GPL ( jz4740_clock_udc_enable_auto_suspend  )
void jz4740_clock_resume ( void  )

Definition at line 878 of file clock.c.

void jz4740_clock_set_wait_mode ( enum jz4740_wait_mode  mode)

Definition at line 846 of file clock.c.

void jz4740_clock_suspend ( void  )

Definition at line 870 of file clock.c.

void jz4740_clock_udc_disable_auto_suspend ( void  )

Definition at line 858 of file clock.c.

void jz4740_clock_udc_enable_auto_suspend ( void  )

Definition at line 864 of file clock.c.