/* * OMAP2420 clock data * * Copyright (C) 2005-2012 Texas Instruments, Inc. * Copyright (C) 2004-2011 Nokia Corporation * * Contacts: * Richard Woodruff * Paul Walmsley * Updated to COMMON clk format by 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 #include #include #include #include #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[] = { "apll96_ck", }; DEFINE_STRUCT_CLK_HW_OMAP(func_96m_ck, "wkup_clkdm"); DEFINE_STRUCT_CLK(func_96m_ck, func_96m_ck_parent_names, core_ck_ops); static struct clk cam_fck; static const char *cam_fck_parent_names[] = { "func_96m_ck", }; static struct clk_hw_omap cam_fck_hw = { .hw = { .clk = &cam_fck, }, .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_bit = OMAP24XX_EN_CAM_SHIFT, .clkdm_name = "core_l3_clkdm", }; DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops); static struct clk cam_ick; static struct clk_hw_omap cam_ick_hw = { .hw = { .clk = &cam_ick, }, .ops = &clkhwops_iclk, .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_bit = OMAP24XX_EN_CAM_SHIFT, .clkdm_name = "core_l4_clkdm", }; DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops); static struct clk des_ick; static struct clk_hw_omap des_ick_hw = { .hw = { .clk = &des_ick, }, .ops = &clkhwops_iclk_wait, .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), .enable_bit = OMAP24XX_EN_DES_SHIFT, .clkdm_name = "core_l4_clkdm", }; DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops); static const struct clksel_rate dsp_fck_core_rates[] = { { .div = 1, .val = 1, .flags = RATE_IN_24XX }, { .div = 2, .val = 2, .flags = RATE_IN_24XX }, { .div = 3, .val = 3, .flags = RATE_IN_24XX }, { .div = 4, .val = 4, .flags = RATE_IN_24XX }, { .div = 6, .val = 6, .flags = RATE_IN_242X }, { .div = 8, .val = 8, .flags = RATE_IN_242X }, { .div = 12, .val = 12, .flags = RATE_IN_242X }, { .div = 0 } };