| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 | 
							- /*
 
-  * OMAP2420 clock data
 
-  *
 
-  * Copyright (C) 2005-2012 Texas Instruments, Inc.
 
-  * Copyright (C) 2004-2011 Nokia Corporation
 
-  *
 
-  * Contacts:
 
-  * Richard Woodruff <r-woodruff2@ti.com>
 
-  * Paul Walmsley
 
-  * Updated to COMMON clk format by Rajendra Nayak <rnayak@ti.com>
 
-  *
 
-  * 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/io.h>
 
- #include <linux/clk.h>
 
- #include <linux/clk-private.h>
 
- #include <linux/list.h>
 
- #include "soc.h"
 
- #include "iomap.h"
 
- #include "clock.h"
 
- #include "clock2xxx.h"
 
- #include "opp2xxx.h"
 
- #include "cm2xxx.h"
 
- #include "prm2xxx.h"
 
- #include "prm-regbits-24xx.h"
 
- #include "cm-regbits-24xx.h"
 
- #include "sdrc.h"
 
- #include "control.h"
 
- #define OMAP_CM_REGADDR                 OMAP2420_CM_REGADDR
 
- /*
 
-  * 2420 clock tree.
 
-  *
 
-  * NOTE:In many cases here we are assigning a 'default' parent. In
 
-  *	many cases the parent is selectable. The set parent calls will
 
-  *	also switch sources.
 
-  *
 
-  *	Several sources are given initial rates which may be wrong, this will
 
-  *	be fixed up in the init func.
 
-  *
 
-  *	Things are broadly separated below by clock domains. It is
 
-  *	noteworthy that most peripherals have dependencies on multiple clock
 
-  *	domains. Many get their interface clocks from the L4 domain, but get
 
-  *	functional clocks from fixed sources or other core domain derived
 
-  *	clocks.
 
-  */
 
- DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
 
- DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
 
- DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
 
- static struct clk osc_ck;
 
- static const struct clk_ops osc_ck_ops = {
 
- 	.recalc_rate	= &omap2_osc_clk_recalc,
 
- };
 
- static struct clk_hw_omap osc_ck_hw = {
 
- 	.hw = {
 
- 		.clk = &osc_ck,
 
- 	},
 
- };
 
- static struct clk osc_ck = {
 
- 	.name	= "osc_ck",
 
- 	.ops	= &osc_ck_ops,
 
- 	.hw	= &osc_ck_hw.hw,
 
- 	.flags	= CLK_IS_ROOT,
 
- };
 
- DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
 
- static struct clk sys_ck;
 
- static const char *sys_ck_parent_names[] = {
 
- 	"osc_ck",
 
- };
 
- static const struct clk_ops sys_ck_ops = {
 
- 	.init		= &omap2_init_clk_clkdm,
 
- 	.recalc_rate	= &omap2xxx_sys_clk_recalc,
 
- };
 
- DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
 
- DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
 
- static struct dpll_data dpll_dd = {
 
- 	.mult_div1_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
 
- 	.mult_mask	= OMAP24XX_DPLL_MULT_MASK,
 
- 	.div1_mask	= OMAP24XX_DPLL_DIV_MASK,
 
- 	.clk_bypass	= &sys_ck,
 
- 	.clk_ref	= &sys_ck,
 
- 	.control_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
 
- 	.enable_mask	= OMAP24XX_EN_DPLL_MASK,
 
- 	.max_multiplier	= 1023,
 
- 	.min_divider	= 1,
 
- 	.max_divider	= 16,
 
- };
 
- static struct clk dpll_ck;
 
- static const char *dpll_ck_parent_names[] = {
 
- 	"sys_ck",
 
- };
 
- static const struct clk_ops dpll_ck_ops = {
 
- 	.init		= &omap2_init_clk_clkdm,
 
- 	.get_parent	= &omap2_init_dpll_parent,
 
- 	.recalc_rate	= &omap2_dpllcore_recalc,
 
- 	.round_rate	= &omap2_dpll_round_rate,
 
- 	.set_rate	= &omap2_reprogram_dpllcore,
 
- };
 
- static struct clk_hw_omap dpll_ck_hw = {
 
- 	.hw = {
 
- 		.clk = &dpll_ck,
 
- 	},
 
- 	.ops		= &clkhwops_omap2xxx_dpll,
 
- 	.dpll_data	= &dpll_dd,
 
- 	.clkdm_name	= "wkup_clkdm",
 
- };
 
- DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
 
- static struct clk core_ck;
 
- static const char *core_ck_parent_names[] = {
 
- 	"dpll_ck",
 
- };
 
- static const struct clk_ops core_ck_ops = {
 
- 	.init		= &omap2_init_clk_clkdm,
 
- };
 
- DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
 
- DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
 
- DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
 
- 		   OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
 
- 		   OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
 
- 		   CLK_DIVIDER_ONE_BASED, NULL);
 
- DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
 
- 		   OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
 
- 		   OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
 
- 		   CLK_DIVIDER_ONE_BASED, NULL);
 
- static struct clk aes_ick;
 
- static const char *aes_ick_parent_names[] = {
 
- 	"l4_ck",
 
- };
 
- static const struct clk_ops aes_ick_ops = {
 
- 	.init		= &omap2_init_clk_clkdm,
 
- 	.enable		= &omap2_dflt_clk_enable,
 
- 	.disable	= &omap2_dflt_clk_disable,
 
- 	.is_enabled	= &omap2_dflt_clk_is_enabled,
 
- };
 
- static struct clk_hw_omap aes_ick_hw = {
 
- 	.hw = {
 
- 		.clk = &aes_ick,
 
- 	},
 
- 	.ops		= &clkhwops_iclk_wait,
 
- 	.enable_reg	= OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
 
- 	.enable_bit	= OMAP24XX_EN_AES_SHIFT,
 
- 	.clkdm_name	= "core_l4_clkdm",
 
- };
 
- DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
 
- static struct clk apll54_ck;
 
- static const struct clk_ops apll54_ck_ops = {
 
- 	.init		= &omap2_init_clk_clkdm,
 
- 	.enable		= &omap2_clk_apll54_enable,
 
- 	.disable	= &omap2_clk_apll54_disable,
 
- 	.recalc_rate	= &omap2_clk_apll54_recalc,
 
- };
 
- static struct clk_hw_omap apll54_ck_hw = {
 
- 	.hw = {
 
- 		.clk = &apll54_ck,
 
- 	},
 
- 	.ops		= &clkhwops_apll54,
 
- 	.enable_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
 
- 	.enable_bit	= OMAP24XX_EN_54M_PLL_SHIFT,
 
- 	.flags		= ENABLE_ON_INIT,
 
- 	.clkdm_name	= "wkup_clkdm",
 
- };
 
- DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
 
- static struct clk apll96_ck;
 
- static const struct clk_ops apll96_ck_ops = {
 
- 	.init		= &omap2_init_clk_clkdm,
 
- 	.enable		= &omap2_clk_apll96_enable,
 
- 	.disable	= &omap2_clk_apll96_disable,
 
- 	.recalc_rate	= &omap2_clk_apll96_recalc,
 
- };
 
- static struct clk_hw_omap apll96_ck_hw = {
 
- 	.hw = {
 
- 		.clk = &apll96_ck,
 
- 	},
 
- 	.ops		= &clkhwops_apll96,
 
- 	.enable_reg	= OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
 
- 	.enable_bit	= OMAP24XX_EN_96M_PLL_SHIFT,
 
- 	.flags		= ENABLE_ON_INIT,
 
- 	.clkdm_name	= "wkup_clkdm",
 
- };
 
- DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
 
- static struct clk func_96m_ck;
 
- static const char *func_96m_ck_parent_names[] = {
 
 
  |