Commit fb6842a7 authored by Arnd Bergmann's avatar Arnd Bergmann

Merge tag 'omap-for-v3.8/clock-signed' of...

Merge tag 'omap-for-v3.8/clock-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/clk

From Tony Lindgren <tony@atomide.com>:

Common clock framework for omap2+ via Paul Walmsley <paul@pwsan.com>:

Convert the OMAP2+ clock code and data to rely on the common
clock framework for internal bookkeeping and the driver API.

Basic test logs for this branch on top of Tony's cleanup-prcm branch
at commit c9d501e5 are here:

http://www.pwsan.com/omap/testlogs/common_clk_devel_3.8_rebase/20121112192516/

However, cleanup-prcm at c9d501e5 does not include some fixes
that are needed for a successful test.  With several reverts,
fixes, and workarounds applied, the following test logs were
obtained:

http://www.pwsan.com/omap/testlogs/TEST_common_clk_devel_3.8_rebase/20121112192300/

which indicate that the series tests cleanly.

N.B. The common clock data addition patches result in many
checkpatch warnings of the form "WARNING: static const char *
array should probably be static const char * const".  However, it
appears that resolving these would require changes to the CCF
itself.  So the resolution of these warnings is being postponed
until that can be coordinated.

These patches result in a ~55KiB increase in runtime kernel memory
usage when booting omap2plus_defconfig kernels.

Conflicts:
	arch/arm/mach-omap2/clock33xx_data.c
	arch/arm/mach-omap2/clock3xxx_data.c
	arch/arm/mach-omap2/clock44xx_data.c

Note that this is based on a merge of the omap-for-v3.8/cleanup-prcm
and omap-for-v3.8/pm as otherwise merged in with the pm changes it
would automatically resolve into a non-booting merge for omap3 as
the smartreflex clock names were changed in the pm branch.

* tag 'omap-for-v3.8/clock-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: (27 commits)
  ARM: OMAP2+: clock: Cleanup !CONFIG_COMMON_CLK parts
  ARM: OMAP2xxx: clock: drop obsolete clock data
  ARM: OMAP2: clock: Cleanup !CONFIG_COMMON_CLK parts
  ARM: OMAP3+: DPLL: drop !CONFIG_COMMON_CLK sections
  ARM: AM33xx: clock: drop obsolete clock data
  ARM: OMAP3xxx: clk: drop obsolete clock data
  ARM: OMAP3: clock: Cleanup !CONFIG_COMMON_CLK parts
  ARM: OMAP44xx: clock: drop obsolete clock data
  ARM: OMAP4: clock: Cleanup !CONFIG_COMMON_CLK parts
  ARM: OMAP: hwmod: Cleanup !CONFIG_COMMON_CLK parts
  ARM: OMAP: clock: Switch to COMMON clk
  ARM: OMAP2: clock: Add 24xx data using common struct clk
  ARM: OMAP3: clock: Add 3xxx data using common struct clk
  ARM: AM33XX: clock: add clock data in common clock format
  ARM: OMAP4: clock: Add 44xx data using common struct clk
  ARM: OMAP2+: clock: add OMAP CCF convenience macros to mach-omap2/clock.h
  ARM: OMAP: clock: Get rid of some clkdm assocations within clks
  ARM: OMAP2+: clockdomain: bypass clockdomain handling when disabling unused clks
  ARM: OMAP2+: hwmod: Invoke init_clkdm before other init functions
  ARM: OMAP: clock: Define a function to enable clocks at init
  ...
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 89ab216b 558a0780
...@@ -34,6 +34,7 @@ config ARCH_OMAP2 ...@@ -34,6 +34,7 @@ config ARCH_OMAP2
select CPU_V6 select CPU_V6
select MULTI_IRQ_HANDLER select MULTI_IRQ_HANDLER
select SOC_HAS_OMAP2_SDRC select SOC_HAS_OMAP2_SDRC
select COMMON_CLK
config ARCH_OMAP3 config ARCH_OMAP3
bool "TI OMAP3" bool "TI OMAP3"
...@@ -47,6 +48,7 @@ config ARCH_OMAP3 ...@@ -47,6 +48,7 @@ config ARCH_OMAP3
select PM_OPP if PM select PM_OPP if PM
select PM_RUNTIME if CPU_IDLE select PM_RUNTIME if CPU_IDLE
select SOC_HAS_OMAP2_SDRC select SOC_HAS_OMAP2_SDRC
select COMMON_CLK
select USB_ARCH_HAS_EHCI if USB_SUPPORT select USB_ARCH_HAS_EHCI if USB_SUPPORT
config ARCH_OMAP4 config ARCH_OMAP4
...@@ -68,6 +70,7 @@ config ARCH_OMAP4 ...@@ -68,6 +70,7 @@ config ARCH_OMAP4
select PM_OPP if PM select PM_OPP if PM
select PM_RUNTIME if CPU_IDLE select PM_RUNTIME if CPU_IDLE
select USB_ARCH_HAS_EHCI if USB_SUPPORT select USB_ARCH_HAS_EHCI if USB_SUPPORT
select COMMON_CLK
config SOC_OMAP5 config SOC_OMAP5
bool "TI OMAP5" bool "TI OMAP5"
...@@ -77,6 +80,7 @@ config SOC_OMAP5 ...@@ -77,6 +80,7 @@ config SOC_OMAP5
select CPU_V7 select CPU_V7
select HAVE_SMP select HAVE_SMP
select SOC_HAS_REALTIME_COUNTER select SOC_HAS_REALTIME_COUNTER
select COMMON_CLK
comment "OMAP Core Type" comment "OMAP Core Type"
depends on ARCH_OMAP2 depends on ARCH_OMAP2
...@@ -111,6 +115,7 @@ config SOC_AM33XX ...@@ -111,6 +115,7 @@ config SOC_AM33XX
select ARM_CPU_SUSPEND if PM select ARM_CPU_SUSPEND if PM
select CPU_V7 select CPU_V7
select MULTI_IRQ_HANDLER select MULTI_IRQ_HANDLER
select COMMON_CLK
config OMAP_PACKAGE_ZAF config OMAP_PACKAGE_ZAF
bool bool
......
...@@ -158,17 +158,17 @@ obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o ...@@ -158,17 +158,17 @@ obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o
obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o
obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o obj-$(CONFIG_SOC_OMAP2420) += cclock2420_data.o
obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o obj-$(CONFIG_SOC_OMAP2430) += clock2430.o cclock2430_data.o
obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o
obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o
obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o
obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o clock3xxx_data.o obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o cclock3xxx_data.o
obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o
obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) cclock44xx_data.o
obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o
obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o
obj-$(CONFIG_SOC_AM33XX) += clock33xx_data.o obj-$(CONFIG_SOC_AM33XX) += cclock33xx_data.o
obj-$(CONFIG_SOC_OMAP5) += $(clock-common) obj-$(CONFIG_SOC_OMAP5) += $(clock-common)
obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o
......
/* /*
* OMAP2420 clock data * OMAP2420 clock data
* *
* Copyright (C) 2005-2009, 2012 Texas Instruments, Inc. * Copyright (C) 2005-2012 Texas Instruments, Inc.
* Copyright (C) 2004-2011 Nokia Corporation * Copyright (C) 2004-2011 Nokia Corporation
* *
* Contacts: * Contacts:
* Richard Woodruff <r-woodruff2@ti.com> * Richard Woodruff <r-woodruff2@ti.com>
* Paul Walmsley * 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 * 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 * it under the terms of the GNU General Public License version 2 as
...@@ -16,6 +17,7 @@ ...@@ -16,6 +17,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clk-private.h>
#include <linux/list.h> #include <linux/list.h>
#include "soc.h" #include "soc.h"
...@@ -24,7 +26,7 @@ ...@@ -24,7 +26,7 @@
#include "clock2xxx.h" #include "clock2xxx.h"
#include "opp2xxx.h" #include "opp2xxx.h"
#include "cm2xxx.h" #include "cm2xxx.h"
#include "prm2xxx_3xxx.h" #include "prm2xxx.h"
#include "prm-regbits-24xx.h" #include "prm-regbits-24xx.h"
#include "cm-regbits-24xx.h" #include "cm-regbits-24xx.h"
#include "sdrc.h" #include "sdrc.h"
...@@ -49,59 +51,46 @@ ...@@ -49,59 +51,46 @@
* clocks. * clocks.
*/ */
/* Base external input clocks */ DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
static struct clk func_32k_ck = {
.name = "func_32k_ck", DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
.ops = &clkops_null,
.rate = 32768, DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
.clkdm_name = "wkup_clkdm",
static struct clk osc_ck;
static const struct clk_ops osc_ck_ops = {
.recalc_rate = &omap2_osc_clk_recalc,
}; };
static struct clk secure_32k_ck = { static struct clk_hw_omap osc_ck_hw = {
.name = "secure_32k_ck", .hw = {
.ops = &clkops_null, .clk = &osc_ck,
.rate = 32768, },
.clkdm_name = "wkup_clkdm",
}; };
/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ static struct clk osc_ck = {
static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
.name = "osc_ck", .name = "osc_ck",
.ops = &clkops_oscck, .ops = &osc_ck_ops,
.clkdm_name = "wkup_clkdm", .hw = &osc_ck_hw.hw,
.recalc = &omap2_osc_clk_recalc, .flags = CLK_IS_ROOT,
}; };
/* Without modem likely 12MHz, with modem likely 13MHz */ DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
.name = "sys_ck", /* ~ ref_clk also */
.ops = &clkops_null,
.parent = &osc_ck,
.clkdm_name = "wkup_clkdm",
.recalc = &omap2xxx_sys_clk_recalc,
};
static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ static struct clk sys_ck;
.name = "alt_ck",
.ops = &clkops_null,
.rate = 54000000,
.clkdm_name = "wkup_clkdm",
};
/* Optional external clock input for McBSP CLKS */ static const char *sys_ck_parent_names[] = {
static struct clk mcbsp_clks = { "osc_ck",
.name = "mcbsp_clks",
.ops = &clkops_null,
}; };
/* static const struct clk_ops sys_ck_ops = {
* Analog domain root source clocks .init = &omap2_init_clk_clkdm,
*/ .recalc_rate = &omap2xxx_sys_clk_recalc,
};
/* dpll_ck, is broken out in to special cases through clksel */ DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
/* REVISIT: Rate changes on dpll_ck trigger a full set change. ... DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
* deal with this
*/
static struct dpll_data dpll_dd = { static struct dpll_data dpll_dd = {
.mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
...@@ -116,610 +105,229 @@ static struct dpll_data dpll_dd = { ...@@ -116,610 +105,229 @@ static struct dpll_data dpll_dd = {
.max_divider = 16, .max_divider = 16,
}; };
/* static struct clk dpll_ck;
* XXX Cannot add round_rate here yet, as this is still a composite clock,
* not just a DPLL
*/
static struct clk dpll_ck = {
.name = "dpll_ck",
.ops = &clkops_omap2xxx_dpll_ops,
.parent = &sys_ck, /* Can be func_32k also */
.init = &omap2xxx_clkt_dpllcore_init,
.dpll_data = &dpll_dd,
.clkdm_name = "wkup_clkdm",
.recalc = &omap2_dpllcore_recalc,
.set_rate = &omap2_reprogram_dpllcore,
};
static struct clk apll96_ck = {
.name = "apll96_ck",
.ops = &clkops_apll96,
.parent = &sys_ck,
.rate = 96000000,
.flags = ENABLE_ON_INIT,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
.enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
};
static struct clk apll54_ck = {
.name = "apll54_ck",
.ops = &clkops_apll54,
.parent = &sys_ck,
.rate = 54000000,
.flags = ENABLE_ON_INIT,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
.enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
};
/*
* PRCM digital base sources
*/
/* func_54m_ck */
static const struct clksel_rate func_54m_apll54_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel_rate func_54m_alt_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel func_54m_clksel[] = {
{ .parent = &apll54_ck, .rates = func_54m_apll54_rates, },
{ .parent = &alt_ck, .rates = func_54m_alt_rates, },
{ .parent = NULL },
};
static struct clk func_54m_ck = { static const char *dpll_ck_parent_names[] = {
.name = "func_54m_ck", "sys_ck",
.ops = &clkops_null,
.parent = &apll54_ck, /* can also be alt_clk */
.clkdm_name = "wkup_clkdm",
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_54M_SOURCE_MASK,
.clksel = func_54m_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk core_ck = { static const struct clk_ops dpll_ck_ops = {
.name = "core_ck", .init = &omap2_init_clk_clkdm,
.ops = &clkops_null, .get_parent = &omap2_init_dpll_parent,
.parent = &dpll_ck, /* can also be 32k */ .recalc_rate = &omap2_dpllcore_recalc,
.clkdm_name = "wkup_clkdm", .round_rate = &omap2_dpll_round_rate,
.recalc = &followparent_recalc, .set_rate = &omap2_reprogram_dpllcore,
}; };
static struct clk func_96m_ck = { static struct clk_hw_omap dpll_ck_hw = {
.name = "func_96m_ck", .hw = {
.ops = &clkops_null, .clk = &dpll_ck,
.parent = &apll96_ck, },
.ops = &clkhwops_omap2xxx_dpll,
.dpll_data = &dpll_dd,
.clkdm_name = "wkup_clkdm", .clkdm_name = "wkup_clkdm",
.recalc = &followparent_recalc,
}; };
/* func_48m_ck */ DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
static const struct clksel_rate func_48m_apll96_rates[] = {
{ .div = 2, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel_rate func_48m_alt_rates[] = { static struct clk core_ck;
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel func_48m_clksel[] = { static const char *core_ck_parent_names[] = {
{ .parent = &apll96_ck, .rates = func_48m_apll96_rates }, "dpll_ck",
{ .parent = &alt_ck, .rates = func_48m_alt_rates },
{ .parent = NULL }
}; };
static struct clk func_48m_ck = { static const struct clk_ops core_ck_ops = {
.name = "func_48m_ck", .init = &omap2_init_clk_clkdm,
.ops = &clkops_null,
.parent = &apll96_ck, /* 96M or Alt */
.clkdm_name = "wkup_clkdm",
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_48M_SOURCE_MASK,
.clksel = func_48m_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
}; };
static struct clk func_12m_ck = { DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
.name = "func_12m_ck", DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
.ops = &clkops_null,
.parent = &func_48m_ck,
.fixed_div = 4,
.clkdm_name = "wkup_clkdm",
.recalc = &omap_fixed_divisor_recalc,
};
/* Secure timer, only available in secure mode */ DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
static struct clk wdt1_osc_ck = { OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.name = "ck_wdt1_osc", OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
.ops = &clkops_null, /* RMK: missing? */ CLK_DIVIDER_ONE_BASED, NULL);
.parent = &osc_ck,
.recalc = &followparent_recalc,
};
/* DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
* The common_clkout* clksel_rate structs are common to OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
* sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src. OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
* sys_clkout2_* are 2420-only, so the CLK_DIVIDER_ONE_BASED, NULL);
* clksel_rate flags fields are inaccurate for those clocks. This is
* harmless since access to those clocks are gated by the struct clk
* flags fields, which mark them as 2420-only.
*/
static const struct clksel_rate common_clkout_src_core_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 }
};
static const struct clksel_rate common_clkout_src_sys_rates[] = { static struct clk aes_ick;
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 0 }
};
static const struct clksel_rate common_clkout_src_96m_rates[] = { static const char *aes_ick_parent_names[] = {
{ .div = 1, .val = 2, .flags = RATE_IN_24XX }, "l4_ck",
{ .div = 0 }
}; };
static const struct clksel_rate common_clkout_src_54m_rates[] = { static const struct clk_ops aes_ick_ops = {
{ .div = 1, .val = 3, .flags = RATE_IN_24XX }, .init = &omap2_init_clk_clkdm,
{ .div = 0 } .enable = &omap2_dflt_clk_enable,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
}; };
static const struct clksel common_clkout_src_clksel[] = { static struct clk_hw_omap aes_ick_hw = {
{ .parent = &core_ck, .rates = common_clkout_src_core_rates }, .hw = {
{ .parent = &sys_ck, .rates = common_clkout_src_sys_rates }, .clk = &aes_ick,
{ .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates }, },
{ .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates }, .ops = &clkhwops_iclk_wait,
{ .parent = NULL } .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_AES_SHIFT,
.clkdm_name = "core_l4_clkdm",
}; };
static struct clk sys_clkout_src = { DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
.name = "sys_clkout_src",
.ops = &clkops_omap2_dflt,
.parent = &func_54m_ck,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP2420_PRCM_CLKOUT_CTRL,
.enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
.clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK,
.clksel = common_clkout_src_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
};
static const struct clksel_rate common_clkout_rates[] = { static struct clk apll54_ck;
{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 2, .val = 1, .flags = RATE_IN_24XX },
{ .div = 4, .val = 2, .flags = RATE_IN_24XX },
{ .div = 8, .val = 3, .flags = RATE_IN_24XX },
{ .div = 16, .val = 4, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel sys_clkout_clksel[] = { static const struct clk_ops apll54_ck_ops = {
{ .parent = &sys_clkout_src, .rates = common_clkout_rates }, .init = &omap2_init_clk_clkdm,
{ .parent = NULL } .enable = &omap2_clk_apll54_enable,
.disable = &omap2_clk_apll54_disable,
.recalc_rate = &omap2_clk_apll54_recalc,
}; };
static struct clk sys_clkout = { static struct clk_hw_omap apll54_ck_hw = {
.name = "sys_clkout", .hw = {
.ops = &clkops_null, .clk = &apll54_ck,
.parent = &sys_clkout_src, },
.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", .clkdm_name = "wkup_clkdm",
.clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
.clksel_mask = OMAP24XX_CLKOUT_DIV_MASK,
.clksel = sys_clkout_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
}; };
/* In 2430, new in 2420 ES2 */ DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
static struct clk sys_clkout2_src = {
.name = "sys_clkout2_src",
.ops = &clkops_omap2_dflt,
.parent = &func_54m_ck,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP2420_PRCM_CLKOUT_CTRL,
.enable_bit = OMAP2420_CLKOUT2_EN_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
.clksel_mask = OMAP2420_CLKOUT2_SOURCE_MASK,
.clksel = common_clkout_src_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
};
static const struct clksel sys_clkout2_clksel[] = { static struct clk apll96_ck;
{ .parent = &sys_clkout2_src, .rates = common_clkout_rates },
{ .parent = NULL }
};
/* In 2430, new in 2420 ES2 */ static const struct clk_ops apll96_ck_ops = {
static struct clk sys_clkout2 = { .init = &omap2_init_clk_clkdm,
.name = "sys_clkout2", .enable = &omap2_clk_apll96_enable,
.ops = &clkops_null, .disable = &omap2_clk_apll96_disable,
.parent = &sys_clkout2_src, .recalc_rate = &omap2_clk_apll96_recalc,
.clkdm_name = "wkup_clkdm",
.clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
.clksel_mask = OMAP2420_CLKOUT2_DIV_MASK,
.clksel = sys_clkout2_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
}; };
static struct clk emul_ck = { static struct clk_hw_omap apll96_ck_hw = {
.name = "emul_ck", .hw = {
.ops = &clkops_omap2_dflt, .clk = &apll96_ck,
.parent = &func_54m_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", .clkdm_name = "wkup_clkdm",
.enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
.enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
.recalc = &followparent_recalc,
};
/*
* MPU clock domain
* Clocks:
* MPU_FCLK, MPU_ICLK
* INT_M_FCLK, INT_M_I_CLK
*
* - Individual clocks are hardware managed.
* - Base divider comes from: CM_CLKSEL_MPU
*
*/
static const struct clksel_rate mpu_core_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
{ .div = 4, .val = 4, .flags = RATE_IN_242X },
{ .div = 6, .val = 6, .flags = RATE_IN_242X },
{ .div = 8, .val = 8, .flags = RATE_IN_242X },
{ .div = 0 },
};
static const struct clksel mpu_clksel[] = {
{ .parent = &core_ck, .rates = mpu_core_rates },
{ .parent = NULL }
};
static struct clk mpu_ck = { /* Control cpu */
.name = "mpu_ck",
.ops = &clkops_null,
.parent = &core_ck,
.clkdm_name = "mpu_clkdm",
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
.clksel_mask = OMAP24XX_CLKSEL_MPU_MASK,
.clksel = mpu_clksel,
.recalc = &omap2_clksel_recalc,
};
/*
* DSP (2420-UMA+IVA1) clock domain
* Clocks:
* 2420: UMA_FCLK, UMA_ICLK, IVA_MPU, IVA_COP
*
* Won't be too specific here. The core clock comes into this block
* it is divided then tee'ed. One branch goes directly to xyz enable
* controls. The other branch gets further divided by 2 then possibly
* routed into a synchronizer and out of clocks abc.
*/
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 },
};
static const struct clksel dsp_fck_clksel[] = {
{ .parent = &core_ck, .rates = dsp_fck_core_rates },
{ .parent = NULL }
}; };
static struct clk dsp_fck = { DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
.name = "dsp_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &core_ck,
.clkdm_name = "dsp_clkdm",
.enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
.clksel_mask = OMAP24XX_CLKSEL_DSP_MASK,
.clksel = dsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
};
static const struct clksel dsp_ick_clksel[] = { static struct clk func_96m_ck;
{ .parent = &dsp_fck, .rates = dsp_ick_rates },
{ .parent = NULL }
};
static struct clk dsp_ick = { static const char *func_96m_ck_parent_names[] = {
.name = "dsp_ick", /* apparently ipi and isp */ "apll96_ck",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &dsp_fck,
.clkdm_name = "dsp_clkdm",
.enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
.enable_bit = OMAP2420_EN_DSP_IPI_SHIFT, /* for ipi */
.clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
.clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
.clksel = dsp_ick_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* DEFINE_STRUCT_CLK_HW_OMAP(func_96m_ck, "wkup_clkdm");
* The IVA1 is an ARM7 core on the 2420 that has nothing to do with DEFINE_STRUCT_CLK(func_96m_ck, func_96m_ck_parent_names, core_ck_ops);
* the C54x, but which is contained in the DSP powerdomain. Does not
* exist on later OMAPs.
*/
static struct clk iva1_ifck = {
.name = "iva1_ifck",
.ops = &clkops_omap2_dflt_wait,
.parent = &core_ck,
.clkdm_name = "iva1_clkdm",
.enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
.enable_bit = OMAP2420_EN_IVA_COP_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
.clksel_mask = OMAP2420_CLKSEL_IVA_MASK,
.clksel = dsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
};
/* IVA1 mpu/int/i/f clocks are /2 of parent */
static struct clk iva1_mpu_int_ifck = {
.name = "iva1_mpu_int_ifck",
.ops = &clkops_omap2_dflt_wait,
.parent = &iva1_ifck,
.clkdm_name = "iva1_clkdm",
.enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
.enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
.fixed_div = 2,
.recalc = &omap_fixed_divisor_recalc,
};
/* static struct clk cam_fck;
* L3 clock domain
* L3 clocks are used for both interface and functional clocks to
* multiple entities. Some of these clocks are completely managed
* by hardware, and some others allow software control. Hardware
* managed ones general are based on directly CLK_REQ signals and
* various auto idle settings. The functional spec sets many of these
* as 'tie-high' for their enables.
*
* I-CLOCKS:
* L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
* CAM, HS-USB.
* F-CLOCK
* SSI.
*
* GPMC memories and SDRC have timing and clock sensitive registers which
* may very well need notification when the clock changes. Currently for low
* operating points, these are taken care of in sleep.S.
*/
static const struct clksel_rate core_l3_core_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_242X },
{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
{ .div = 6, .val = 6, .flags = RATE_IN_24XX },
{ .div = 8, .val = 8, .flags = RATE_IN_242X },
{ .div = 12, .val = 12, .flags = RATE_IN_242X },
{ .div = 16, .val = 16, .flags = RATE_IN_242X },
{ .div = 0 }
};
static const struct clksel core_l3_clksel[] = { static const char *cam_fck_parent_names[] = {
{ .parent = &core_ck, .rates = core_l3_core_rates }, "func_96m_ck",
{ .parent = NULL }
}; };
static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */ static struct clk_hw_omap cam_fck_hw = {
.name = "core_l3_ck", .hw = {
.ops = &clkops_null, .clk = &cam_fck,
.parent = &core_ck, },
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_CAM_SHIFT,
.clkdm_name = "core_l3_clkdm", .clkdm_name = "core_l3_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
.clksel = core_l3_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* usb_l4_ick */ DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
{ .div = 4, .val = 4, .flags = RATE_IN_24XX },
{ .div = 0 }
};
static const struct clksel usb_l4_ick_clksel[] = { static struct clk cam_ick;
{ .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
{ .parent = NULL },
};
/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */ static struct clk_hw_omap cam_ick_hw = {
static struct clk usb_l4_ick = { /* FS-USB interface clock */ .hw = {
.name = "usb_l4_ick", .clk = &cam_ick,
.ops = &clkops_omap2_iclk_dflt_wait, },
.parent = &core_l3_ck, .ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_CAM_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_USB_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_USB_MASK,
.clksel = usb_l4_ick_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
* L4 clock management domain
*
* This domain contains lots of interface clocks from the L4 interface, some
* functional clocks. Fixed APLL functional source clocks are managed in
* this domain.
*/
static const struct clksel_rate l4_core_l3_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
{ .div = 0 }
};
static const struct clksel l4_clksel[] = { static struct clk des_ick;
{ .parent = &core_l3_ck, .rates = l4_core_l3_rates },
{ .parent = NULL }
};
static struct clk l4_ck = { /* used both as an ick and fck */ static struct clk_hw_omap des_ick_hw = {
.name = "l4_ck", .hw = {
.ops = &clkops_null, .clk = &des_ick,
.parent = &core_l3_ck, },
.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", .clkdm_name = "core_l4_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
.clksel = l4_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
* SSI is in L3 management domain, its direct parent is core not l3,
* many core power domain entities are grouped into the L3 clock static const struct clksel_rate dsp_fck_core_rates[] = {
* domain.
* SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
*
* ssr = core/1/2/3/4/5, sst = 1/2 ssr.
*/
static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, { .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_24XX }, { .div = 2, .val = 2, .flags = RATE_IN_24XX },
{ .div = 3, .val = 3, .flags = RATE_IN_24XX }, { .div = 3, .val = 3, .flags = RATE_IN_24XX },
{ .div = 4, .val = 4, .flags = RATE_IN_24XX }, { .div = 4, .val = 4, .flags = RATE_IN_24XX },
{ .div = 6, .val = 6, .flags = RATE_IN_242X }, { .div = 6, .val = 6, .flags = RATE_IN_242X },
{ .div = 8, .val = 8, .flags = RATE_IN_242X }, { .div = 8, .val = 8, .flags = RATE_IN_242X },
{ .div = 12, .val = 12, .flags = RATE_IN_242X },
{ .div = 0 } { .div = 0 }
}; };
static const struct clksel ssi_ssr_sst_fck_clksel[] = { static const struct clksel dsp_fck_clksel[] = {
{ .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates }, { .parent = &core_ck, .rates = dsp_fck_core_rates },
{ .parent = NULL } { .parent = NULL },
}; };
static struct clk ssi_ssr_sst_fck = { static const char *dsp_fck_parent_names[] = {
.name = "ssi_fck", "core_ck",
.ops = &clkops_omap2_dflt_wait,
.parent = &core_ck,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_SSI_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_SSI_MASK,
.clksel = ssi_ssr_sst_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* static const struct clk_ops dsp_fck_ops = {
* Presumably this is the same as SSI_ICLK. .init = &omap2_init_clk_clkdm,
* TRM contradicts itself on what clockdomain SSI_ICLK is in .enable = &omap2_dflt_clk_enable,
*/ .disable = &omap2_dflt_clk_disable,
static struct clk ssi_l4_ick = { .is_enabled = &omap2_dflt_clk_is_enabled,
.name = "ssi_l4_ick", .recalc_rate = &omap2_clksel_recalc,
.ops = &clkops_omap2_iclk_dflt_wait, .set_rate = &omap2_clksel_set_rate,
.parent = &l4_ck, .round_rate = &omap2_clksel_round_rate,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_SSI_SHIFT,
.recalc = &followparent_recalc,
}; };
DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
OMAP24XX_CLKSEL_DSP_MASK,
OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
dsp_fck_parent_names, dsp_fck_ops);
/* static const struct clksel dsp_ick_clksel[] = {
* GFX clock domain { .parent = &dsp_fck, .rates = dsp_ick_rates },
* Clocks:
* GFX_FCLK, GFX_ICLK
* GFX_CG1(2d), GFX_CG2(3d)
*
* GFX_FCLK runs from L3, and is divided by (1,2,3,4)
* The 2d and 3d clocks run at a hardware determined
* divided value of fclk.
*
*/
/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */
static const struct clksel gfx_fck_clksel[] = {
{ .parent = &core_l3_ck, .rates = gfx_l3_rates },
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk gfx_3d_fck = { static const char *dsp_ick_parent_names[] = {
.name = "gfx_3d_fck", "dsp_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &core_l3_ck,
.clkdm_name = "gfx_clkdm",
.enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_3D_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
.clksel_mask = OMAP_CLKSEL_GFX_MASK,
.clksel = gfx_fck_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
};
static struct clk gfx_2d_fck = {
.name = "gfx_2d_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &core_l3_ck,
.clkdm_name = "gfx_clkdm",
.enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_2D_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
.clksel_mask = OMAP_CLKSEL_GFX_MASK,
.clksel = gfx_fck_clksel,
.recalc = &omap2_clksel_recalc,
};
/* This interface clock does not have a CM_AUTOIDLE bit */
static struct clk gfx_ick = {
.name = "gfx_ick", /* From l3 */
.ops = &clkops_omap2_dflt_wait,
.parent = &core_l3_ck,
.clkdm_name = "gfx_clkdm",
.enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
.enable_bit = OMAP_EN_GFX_SHIFT,
.recalc = &followparent_recalc,
}; };
/* DEFINE_CLK_OMAP_MUX_GATE(dsp_ick, "dsp_clkdm", dsp_ick_clksel,
* DSS clock domain OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
* CLOCKs: OMAP24XX_CLKSEL_DSP_IF_MASK,
* DSS_L4_ICLK, DSS_L3_ICLK, OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
* DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK OMAP2420_EN_DSP_IPI_SHIFT, &clkhwops_iclk_wait,
* dsp_ick_parent_names, dsp_fck_ops);
* DSS is both initiator and target.
*/
/* XXX Add RATE_NOT_VALIDATED */
static const struct clksel_rate dss1_fck_sys_rates[] = { static const struct clksel_rate dss1_fck_sys_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX }, { .div = 1, .val = 0, .flags = RATE_IN_24XX },
...@@ -746,30 +354,29 @@ static const struct clksel dss1_fck_clksel[] = { ...@@ -746,30 +354,29 @@ static const struct clksel dss1_fck_clksel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */ static const char *dss1_fck_parent_names[] = {
.name = "dss_ick", "sys_ck", "core_ck",
.ops = &clkops_omap2_iclk_dflt,
.parent = &l4_ck, /* really both l3 and l4 */
.clkdm_name = "dss_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_DSS1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk dss1_fck = { static struct clk dss1_fck;
.name = "dss1_fck",
.ops = &clkops_omap2_dflt, static const struct clk_ops dss1_fck_ops = {
.parent = &core_ck, /* Core or sys */ .init = &omap2_init_clk_clkdm,
.clkdm_name = "dss_clkdm", .enable = &omap2_dflt_clk_enable,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .disable = &omap2_dflt_clk_disable,
.enable_bit = OMAP24XX_EN_DSS1_SHIFT, .is_enabled = &omap2_dflt_clk_is_enabled,
.init = &omap2_init_clksel_parent, .recalc_rate = &omap2_clksel_recalc,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), .get_parent = &omap2_clksel_find_parent_index,
.clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK, .set_parent = &omap2_clksel_set_parent,
.clksel = dss1_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
OMAP24XX_CLKSEL_DSS1_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_DSS1_SHIFT, NULL,
dss1_fck_parent_names, dss1_fck_ops);
static const struct clksel_rate dss2_fck_sys_rates[] = { static const struct clksel_rate dss2_fck_sys_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX }, { .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 } { .div = 0 }
...@@ -780,50 +387,279 @@ static const struct clksel_rate dss2_fck_48m_rates[] = { ...@@ -780,50 +387,279 @@ static const struct clksel_rate dss2_fck_48m_rates[] = {
{ .div = 0 } { .div = 0 }
}; };
static const struct clksel dss2_fck_clksel[] = { static const struct clksel_rate func_48m_apll96_rates[] = {
{ .parent = &sys_ck, .rates = dss2_fck_sys_rates }, { .div = 2, .val = 0, .flags = RATE_IN_24XX },
{ .parent = &func_48m_ck, .rates = dss2_fck_48m_rates }, { .div = 0 }
{ .parent = NULL }
}; };
static struct clk dss2_fck = { /* Alt clk used in power management */ static const struct clksel_rate func_48m_alt_rates[] = {
.name = "dss2_fck", { .div = 1, .val = 1, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_dflt, { .div = 0 }
.parent = &sys_ck, /* fixed at sys_ck or 48MHz */ };
.clkdm_name = "dss_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), static const struct clksel func_48m_clksel[] = {
.enable_bit = OMAP24XX_EN_DSS2_SHIFT, { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
.init = &omap2_init_clksel_parent, { .parent = &alt_ck, .rates = func_48m_alt_rates },
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), { .parent = NULL },
.clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK, };
.clksel = dss2_fck_clksel,
.recalc = &omap2_clksel_recalc, static const char *func_48m_ck_parent_names[] = {
}; "apll96_ck", "alt_ck",
};
static struct clk dss_54m_fck = { /* Alt clk used in power management */
.name = "dss_54m_fck", /* 54m tv clk */ static struct clk func_48m_ck;
.ops = &clkops_omap2_dflt_wait,
.parent = &func_54m_ck, static const struct clk_ops func_48m_ck_ops = {
.clkdm_name = "dss_clkdm", .init = &omap2_init_clk_clkdm,
.recalc_rate = &omap2_clksel_recalc,
.set_rate = &omap2_clksel_set_rate,
.round_rate = &omap2_clksel_round_rate,
.get_parent = &omap2_clksel_find_parent_index,
.set_parent = &omap2_clksel_set_parent,
};
static struct clk_hw_omap func_48m_ck_hw = {
.hw = {
.clk = &func_48m_ck,
},
.clksel = func_48m_clksel,
.clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_48M_SOURCE_MASK,
.clkdm_name = "wkup_clkdm",
};
DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
static const struct clksel dss2_fck_clksel[] = {
{ .parent = &sys_ck, .rates = dss2_fck_sys_rates },
{ .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
{ .parent = NULL },
};
static const char *dss2_fck_parent_names[] = {
"sys_ck", "func_48m_ck",
};
DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
OMAP24XX_CLKSEL_DSS2_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_DSS2_SHIFT, NULL,
dss2_fck_parent_names, dss1_fck_ops);
static const char *func_54m_ck_parent_names[] = {
"apll54_ck", "alt_ck",
};
DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH,
0x0, NULL);
static struct clk dss_54m_fck;
static const char *dss_54m_fck_parent_names[] = {
"func_54m_ck",
};
static struct clk_hw_omap dss_54m_fck_hw = {
.hw = {
.clk = &dss_54m_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_TV_SHIFT, .enable_bit = OMAP24XX_EN_TV_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "dss_clkdm",
};
DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
static struct clk dss_ick;
static struct clk_hw_omap dss_ick_hw = {
.hw = {
.clk = &dss_ick,
},
.ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_DSS1_SHIFT,
.clkdm_name = "dss_clkdm",
};
DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
static struct clk eac_fck;
static struct clk_hw_omap eac_fck_hw = {
.hw = {
.clk = &eac_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2420_EN_EAC_SHIFT,
.clkdm_name = "core_l4_clkdm",
}; };
static struct clk wu_l4_ick = { DEFINE_STRUCT_CLK(eac_fck, cam_fck_parent_names, aes_ick_ops);
.name = "wu_l4_ick",
.ops = &clkops_null, static struct clk eac_ick;
.parent = &sys_ck,
static struct clk_hw_omap eac_ick_hw = {
.hw = {
.clk = &eac_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_EAC_SHIFT,
.clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(eac_ick, aes_ick_parent_names, aes_ick_ops);
static struct clk emul_ck;
static struct clk_hw_omap emul_ck_hw = {
.hw = {
.clk = &emul_ck,
},
.enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
.enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
.clkdm_name = "wkup_clkdm", .clkdm_name = "wkup_clkdm",
.recalc = &followparent_recalc,
}; };
/* DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
* CORE power domain ICLK & FCLK defines.
* Many of the these can have more than one possible parent. Entries DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
* here will likely have an L4 interface parent, and may have multiple
* functional clock parents. static struct clk fac_fck;
*/
static const char *fac_fck_parent_names[] = {
"func_12m_ck",
};
static struct clk_hw_omap fac_fck_hw = {
.hw = {
.clk = &fac_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_FAC_SHIFT,
.clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
static struct clk fac_ick;
static struct clk_hw_omap fac_ick_hw = {
.hw = {
.clk = &fac_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_FAC_SHIFT,
.clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
static const struct clksel gfx_fck_clksel[] = {
{ .parent = &core_l3_ck, .rates = gfx_l3_rates },
{ .parent = NULL },
};
static const char *gfx_2d_fck_parent_names[] = {
"core_l3_ck",
};
DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
OMAP_CLKSEL_GFX_MASK,
OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
gfx_2d_fck_parent_names, dsp_fck_ops);
DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
OMAP_CLKSEL_GFX_MASK,
OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
gfx_2d_fck_parent_names, dsp_fck_ops);
static struct clk gfx_ick;
static const char *gfx_ick_parent_names[] = {
"core_l3_ck",
};
static struct clk_hw_omap gfx_ick_hw = {
.hw = {
.clk = &gfx_ick,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
.enable_bit = OMAP_EN_GFX_SHIFT,
.clkdm_name = "gfx_clkdm",
};
DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
static struct clk gpios_fck;
static const char *gpios_fck_parent_names[] = {
"func_32k_ck",
};
static struct clk_hw_omap gpios_fck_hw = {
.hw = {
.clk = &gpios_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
.clkdm_name = "wkup_clkdm",
};
DEFINE_STRUCT_CLK(gpios_fck, gpios_fck_parent_names, aes_ick_ops);
static struct clk wu_l4_ick;
DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
static struct clk gpios_ick;
static const char *gpios_ick_parent_names[] = {
"wu_l4_ick",
};
static struct clk_hw_omap gpios_ick_hw = {
.hw = {
.clk = &gpios_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
.clkdm_name = "wkup_clkdm",
};
DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
static struct clk gpmc_fck;
static struct clk_hw_omap gpmc_fck_hw = {
.hw = {
.clk = &gpmc_fck,
},
.ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
.flags = ENABLE_ON_INIT,
.clkdm_name = "core_l3_clkdm",
};
DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
static const struct clksel_rate gpt_alt_rates[] = { static const struct clksel_rate gpt_alt_rates[] = {
{ .div = 1, .val = 2, .flags = RATE_IN_24XX }, { .div = 1, .val = 2, .flags = RATE_IN_24XX },
{ .div = 0 } { .div = 0 }
...@@ -836,306 +672,407 @@ static const struct clksel omap24xx_gpt_clksel[] = { ...@@ -836,306 +672,407 @@ static const struct clksel omap24xx_gpt_clksel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk gpt1_ick = { static const char *gpt10_fck_parent_names[] = {
.name = "gpt1_ick", "func_32k_ck", "sys_ck", "alt_ck",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_GPT1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk gpt1_fck = { DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.name = "gpt1_fck", OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.ops = &clkops_omap2_dflt_wait, OMAP24XX_CLKSEL_GPT10_MASK,
.parent = &func_32k_ck, OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt10_ick;
static struct clk_hw_omap gpt10_ick_hw = {
.hw = {
.clk = &gpt10_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT10_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_GPT1_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
}; };
static struct clk gpt2_ick = { DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt2_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT11_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt11_ick;
static struct clk_hw_omap gpt11_ick_hw = {
.hw = {
.clk = &gpt11_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT2_SHIFT, .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt2_fck = { DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt2_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &func_32k_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
OMAP24XX_CLKSEL_GPT12_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt12_ick;
static struct clk_hw_omap gpt12_ick_hw = {
.hw = {
.clk = &gpt12_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT12_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT2_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt3_ick = { DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt3_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static const struct clk_ops gpt1_fck_ops = {
.parent = &l4_ck, .init = &omap2_init_clk_clkdm,
.clkdm_name = "core_l4_clkdm", .enable = &omap2_dflt_clk_enable,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .disable = &omap2_dflt_clk_disable,
.enable_bit = OMAP24XX_EN_GPT3_SHIFT, .is_enabled = &omap2_dflt_clk_is_enabled,
.recalc = &followparent_recalc, .recalc_rate = &omap2_clksel_recalc,
.set_rate = &omap2_clksel_set_rate,
.round_rate = &omap2_clksel_round_rate,
.get_parent = &omap2_clksel_find_parent_index,
.set_parent = &omap2_clksel_set_parent,
}; };
static struct clk gpt3_fck = { DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.name = "gpt3_fck", OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
.ops = &clkops_omap2_dflt_wait, OMAP24XX_CLKSEL_GPT1_MASK,
.parent = &func_32k_ck, OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.clkdm_name = "core_l4_clkdm", OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), gpt10_fck_parent_names, gpt1_fck_ops);
.enable_bit = OMAP24XX_EN_GPT3_SHIFT,
.init = &omap2_init_clksel_parent, static struct clk gpt1_ick;
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK, static struct clk_hw_omap gpt1_ick_hw = {
.clksel = omap24xx_gpt_clksel, .hw = {
.recalc = &omap2_clksel_recalc, .clk = &gpt1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_GPT1_SHIFT,
.clkdm_name = "wkup_clkdm",
}; };
static struct clk gpt4_ick = { DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "gpt4_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT2_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt2_ick;
static struct clk_hw_omap gpt2_ick_hw = {
.hw = {
.clk = &gpt2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT4_SHIFT, .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt4_fck = { DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt4_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &func_32k_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
OMAP24XX_CLKSEL_GPT3_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt3_ick;
static struct clk_hw_omap gpt3_ick_hw = {
.hw = {
.clk = &gpt3_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT4_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt5_ick = { DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt5_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT4_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt4_ick;
static struct clk_hw_omap gpt4_ick_hw = {
.hw = {
.clk = &gpt4_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT5_SHIFT, .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt5_fck = { DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt5_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &func_32k_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT5_MASK,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt5_ick;
static struct clk_hw_omap gpt5_ick_hw = {
.hw = {
.clk = &gpt5_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT5_SHIFT, .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
.init = &omap2_init_clksel_parent, .clkdm_name = "core_l4_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt6_ick = { DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt6_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT6_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt6_ick;
static struct clk_hw_omap gpt6_ick_hw = {
.hw = {
.clk = &gpt6_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT6_SHIFT, .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk gpt6_fck = {
.name = "gpt6_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT6_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt7_ick = { DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt7_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT7_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt7_ick;
static struct clk_hw_omap gpt7_ick_hw = {
.hw = {
.clk = &gpt7_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT7_SHIFT, .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk gpt7_fck = {
.name = "gpt7_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT7_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt8_ick = { DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt8_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT8_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt8_ick;
static struct clk_hw_omap gpt8_ick_hw = {
.hw = {
.clk = &gpt8_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT8_SHIFT, .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk gpt8_fck = {
.name = "gpt8_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT8_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt9_ick = { DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt9_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT9_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt9_ick;
static struct clk_hw_omap gpt9_ick_hw = {
.hw = {
.clk = &gpt9_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT9_SHIFT, .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt9_fck = { DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt9_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk hdq_fck;
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap hdq_fck_hw = {
.hw = {
.clk = &hdq_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT9_SHIFT, .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
.init = &omap2_init_clksel_parent, .clkdm_name = "core_l4_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt10_ick = { DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
.name = "gpt10_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk hdq_ick;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap hdq_ick_hw = {
.hw = {
.clk = &hdq_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT10_SHIFT, .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt10_fck = { DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt10_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk i2c1_fck;
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap i2c1_fck_hw = {
.hw = {
.clk = &i2c1_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT10_SHIFT, .enable_bit = OMAP2420_EN_I2C1_SHIFT,
.init = &omap2_init_clksel_parent, .clkdm_name = "core_l4_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt11_ick = { DEFINE_STRUCT_CLK(i2c1_fck, fac_fck_parent_names, aes_ick_ops);
.name = "gpt11_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk i2c1_ick;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap i2c1_ick_hw = {
.hw = {
.clk = &i2c1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT11_SHIFT, .enable_bit = OMAP2420_EN_I2C1_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt11_fck = { DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt11_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk i2c2_fck;
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap i2c2_fck_hw = {
.hw = {
.clk = &i2c2_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT11_SHIFT, .enable_bit = OMAP2420_EN_I2C2_SHIFT,
.init = &omap2_init_clksel_parent, .clkdm_name = "core_l4_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt12_ick = { DEFINE_STRUCT_CLK(i2c2_fck, fac_fck_parent_names, aes_ick_ops);
.name = "gpt12_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk i2c2_ick;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap i2c2_ick_hw = {
.hw = {
.clk = &i2c2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT12_SHIFT, .enable_bit = OMAP2420_EN_I2C2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt12_fck = { DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt12_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(iva1_ifck, "iva1_clkdm", dsp_fck_clksel,
.parent = &secure_32k_ck, OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
.clkdm_name = "core_l4_clkdm", OMAP2420_CLKSEL_IVA_MASK,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_GPT12_SHIFT, OMAP2420_EN_IVA_COP_SHIFT, &clkhwops_wait,
.init = &omap2_init_clksel_parent, dsp_fck_parent_names, dsp_fck_ops);
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK, static struct clk iva1_mpu_int_ifck;
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc, static const char *iva1_mpu_int_ifck_parent_names[] = {
"iva1_ifck",
}; };
static struct clk mcbsp1_ick = { static const struct clk_ops iva1_mpu_int_ifck_ops = {
.name = "mcbsp1_ick", .init = &omap2_init_clk_clkdm,
.ops = &clkops_omap2_iclk_dflt_wait, .enable = &omap2_dflt_clk_enable,
.parent = &l4_ck, .disable = &omap2_dflt_clk_disable,
.clkdm_name = "core_l4_clkdm", .is_enabled = &omap2_dflt_clk_is_enabled,
.recalc_rate = &omap_fixed_divisor_recalc,
};
static struct clk_hw_omap iva1_mpu_int_ifck_hw = {
.hw = {
.clk = &iva1_mpu_int_ifck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
.enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
.clkdm_name = "iva1_clkdm",
.fixed_div = 2,
};
DEFINE_STRUCT_CLK(iva1_mpu_int_ifck, iva1_mpu_int_ifck_parent_names,
iva1_mpu_int_ifck_ops);
static struct clk mailboxes_ick;
static struct clk_hw_omap mailboxes_ick_hw = {
.hw = {
.clk = &mailboxes_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP1_SHIFT, .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
static const struct clksel_rate common_mcbsp_96m_rates[] = { static const struct clksel_rate common_mcbsp_96m_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX }, { .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 } { .div = 0 }
...@@ -1149,496 +1086,538 @@ static const struct clksel_rate common_mcbsp_mcbsp_rates[] = { ...@@ -1149,496 +1086,538 @@ static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
static const struct clksel mcbsp_fck_clksel[] = { static const struct clksel mcbsp_fck_clksel[] = {
{ .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates }, { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
{ .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
{ .parent = NULL } { .parent = NULL },
}; };
static struct clk mcbsp1_fck = { static const char *mcbsp1_fck_parent_names[] = {
.name = "mcbsp1_fck", "func_96m_ck", "mcbsp_clks",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
.init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
.clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
.clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
.clksel = mcbsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk mcbsp2_ick = { DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
.name = "mcbsp2_ick", OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
.ops = &clkops_omap2_iclk_dflt_wait, OMAP2_MCBSP1_CLKS_MASK,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
mcbsp1_fck_parent_names, dss1_fck_ops);
static struct clk mcbsp1_ick;
static struct clk_hw_omap mcbsp1_ick_hw = {
.hw = {
.clk = &mcbsp1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
OMAP2_MCBSP2_CLKS_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
mcbsp1_fck_parent_names, dss1_fck_ops);
static struct clk mcbsp2_ick;
static struct clk_hw_omap mcbsp2_ick_hw = {
.hw = {
.clk = &mcbsp2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP2_SHIFT, .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk mcbsp2_fck = { DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcbsp2_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk mcspi1_fck;
.parent = &func_96m_ck,
.init = &omap2_init_clksel_parent, static const char *mcspi1_fck_parent_names[] = {
.clkdm_name = "core_l4_clkdm", "func_48m_ck",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
.clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
.clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
.clksel = mcbsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk mcspi1_ick = { static struct clk_hw_omap mcspi1_fck_hw = {
.name = "mcspi1_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt_wait, .clk = &mcspi1_fck,
.parent = &l4_ck, },
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
static struct clk mcspi1_ick;
static struct clk_hw_omap mcspi1_ick_hw = {
.hw = {
.clk = &mcspi1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI1_SHIFT, .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk mcspi1_fck = { DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcspi1_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk mcspi2_fck;
.parent = &func_48m_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap mcspi2_fck_hw = {
.hw = {
.clk = &mcspi2_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI1_SHIFT, .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk mcspi2_ick = { DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "mcspi2_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mcspi2_ick;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap mcspi2_ick_hw = {
.hw = {
.clk = &mcspi2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI2_SHIFT, .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk mcspi2_fck = { DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcspi2_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk mmc_fck;
.parent = &func_48m_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap mmc_fck_hw = {
.hw = {
.clk = &mmc_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI2_SHIFT, .enable_bit = OMAP2420_EN_MMC_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk uart1_ick = { DEFINE_STRUCT_CLK(mmc_fck, cam_fck_parent_names, aes_ick_ops);
.name = "uart1_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mmc_ick;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap mmc_ick_hw = {
.hw = {
.clk = &mmc_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_UART1_SHIFT, .enable_bit = OMAP2420_EN_MMC_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk uart1_fck = { DEFINE_STRUCT_CLK(mmc_ick, aes_ick_parent_names, aes_ick_ops);
.name = "uart1_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
.parent = &func_48m_ck, OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), CLK_DIVIDER_ONE_BASED, NULL);
.enable_bit = OMAP24XX_EN_UART1_SHIFT,
.recalc = &followparent_recalc, static struct clk mpu_wdt_fck;
static struct clk_hw_omap mpu_wdt_fck_hw = {
.hw = {
.clk = &mpu_wdt_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
.clkdm_name = "wkup_clkdm",
};
DEFINE_STRUCT_CLK(mpu_wdt_fck, gpios_fck_parent_names, aes_ick_ops);
static struct clk mpu_wdt_ick;
static struct clk_hw_omap mpu_wdt_ick_hw = {
.hw = {
.clk = &mpu_wdt_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
.clkdm_name = "wkup_clkdm",
}; };
static struct clk uart2_ick = { DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "uart2_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mspro_fck;
.parent = &l4_ck,
static struct clk_hw_omap mspro_fck_hw = {
.hw = {
.clk = &mspro_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
static struct clk mspro_ick;
static struct clk_hw_omap mspro_ick_hw = {
.hw = {
.clk = &mspro_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_UART2_SHIFT, .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk uart2_fck = { DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
.name = "uart2_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk omapctrl_ick;
.parent = &func_48m_ck,
static struct clk_hw_omap omapctrl_ick_hw = {
.hw = {
.clk = &omapctrl_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
.flags = ENABLE_ON_INIT,
.clkdm_name = "wkup_clkdm",
};
DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
static struct clk pka_ick;
static struct clk_hw_omap pka_ick_hw = {
.hw = {
.clk = &pka_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_PKA_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_UART2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk uart3_ick = { DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
.name = "uart3_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk rng_ick;
.parent = &l4_ck,
static struct clk_hw_omap rng_ick_hw = {
.hw = {
.clk = &rng_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_RNG_SHIFT,
.clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
static struct clk sdma_fck;
DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
static struct clk sdma_ick;
static struct clk_hw_omap sdma_ick_hw = {
.hw = {
.clk = &sdma_ick,
},
.ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
.clkdm_name = "core_l3_clkdm",
};
DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
static struct clk sdrc_ick;
static struct clk_hw_omap sdrc_ick_hw = {
.hw = {
.clk = &sdrc_ick,
},
.ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
.flags = ENABLE_ON_INIT,
.clkdm_name = "core_l3_clkdm",
};
DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
static struct clk sha_ick;
static struct clk_hw_omap sha_ick_hw = {
.hw = {
.clk = &sha_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_SHA_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_UART3_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk uart3_fck = { DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
.name = "uart3_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk ssi_l4_ick;
.parent = &func_48m_ck,
static struct clk_hw_omap ssi_l4_ick_hw = {
.hw = {
.clk = &ssi_l4_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_SSI_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_UART3_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk gpios_ick = { DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpios_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk gpios_fck = { static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
.name = "gpios_fck", { .div = 1, .val = 1, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_dflt_wait, { .div = 2, .val = 2, .flags = RATE_IN_24XX },
.parent = &func_32k_ck, { .div = 3, .val = 3, .flags = RATE_IN_24XX },
.clkdm_name = "wkup_clkdm", { .div = 4, .val = 4, .flags = RATE_IN_24XX },
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), { .div = 6, .val = 6, .flags = RATE_IN_242X },
.enable_bit = OMAP24XX_EN_GPIOS_SHIFT, { .div = 8, .val = 8, .flags = RATE_IN_242X },
.recalc = &followparent_recalc, { .div = 0 }
}; };
static struct clk mpu_wdt_ick = { static const struct clksel ssi_ssr_sst_fck_clksel[] = {
.name = "mpu_wdt_ick", { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
.ops = &clkops_omap2_iclk_dflt_wait, { .parent = NULL },
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mpu_wdt_fck = { static const char *ssi_ssr_sst_fck_parent_names[] = {
.name = "mpu_wdt_fck", "core_ck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk sync_32k_ick = { DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
.name = "sync_32k_ick", ssi_ssr_sst_fck_clksel,
.ops = &clkops_omap2_iclk_dflt_wait, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.parent = &wu_l4_ick, OMAP24XX_CLKSEL_SSI_MASK,
.clkdm_name = "wkup_clkdm", OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.flags = ENABLE_ON_INIT, OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
static struct clk sync_32k_ick;
static struct clk_hw_omap sync_32k_ick_hw = {
.hw = {
.clk = &sync_32k_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_32KSYNC_SHIFT, .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
.recalc = &followparent_recalc, .flags = ENABLE_ON_INIT,
};
static struct clk wdt1_ick = {
.name = "wdt1_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm", .clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_WDT1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk omapctrl_ick = { DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "omapctrl_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.flags = ENABLE_ON_INIT,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk cam_ick = { static const struct clksel_rate common_clkout_src_core_rates[] = {
.name = "cam_ick", { .div = 1, .val = 0, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_iclk_dflt, { .div = 0 }
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_CAM_SHIFT,
.recalc = &followparent_recalc,
}; };
/* static const struct clksel_rate common_clkout_src_sys_rates[] = {
* cam_fck controls both CAM_MCLK and CAM_FCLK. It should probably be { .div = 1, .val = 1, .flags = RATE_IN_24XX },
* split into two separate clocks, since the parent clocks are different { .div = 0 }
* and the clockdomains are also different.
*/
static struct clk cam_fck = {
.name = "cam_fck",
.ops = &clkops_omap2_dflt,
.parent = &func_96m_ck,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_CAM_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mailboxes_ick = { static const struct clksel_rate common_clkout_src_96m_rates[] = {
.name = "mailboxes_ick", { .div = 1, .val = 2, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_iclk_dflt_wait, { .div = 0 }
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk wdt4_ick = { static const struct clksel_rate common_clkout_src_54m_rates[] = {
.name = "wdt4_ick", { .div = 1, .val = 3, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_iclk_dflt_wait, { .div = 0 }
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_WDT4_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk wdt4_fck = { static const struct clksel common_clkout_src_clksel[] = {
.name = "wdt4_fck", { .parent = &core_ck, .rates = common_clkout_src_core_rates },
.ops = &clkops_omap2_dflt_wait, { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
.parent = &func_32k_ck, { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
.clkdm_name = "core_l4_clkdm", { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), { .parent = NULL },
.enable_bit = OMAP24XX_EN_WDT4_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk wdt3_ick = { static const char *sys_clkout_src_parent_names[] = {
.name = "wdt3_ick", "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_WDT3_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk wdt3_fck = { DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
.name = "wdt3_fck", OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
.ops = &clkops_omap2_dflt_wait, OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
.parent = &func_32k_ck, NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2420_EN_WDT3_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk mspro_ick = { DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
.name = "mspro_ick", OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
.ops = &clkops_omap2_iclk_dflt_wait, OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk mspro_fck = { DEFINE_CLK_OMAP_MUX_GATE(sys_clkout2_src, "wkup_clkdm",
.name = "mspro_fck", common_clkout_src_clksel, OMAP2420_PRCM_CLKOUT_CTRL,
.ops = &clkops_omap2_dflt_wait, OMAP2420_CLKOUT2_SOURCE_MASK,
.parent = &func_96m_ck, OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_EN_SHIFT,
.clkdm_name = "core_l4_clkdm", NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk mmc_ick = { DEFINE_CLK_DIVIDER(sys_clkout2, "sys_clkout2_src", &sys_clkout2_src, 0x0,
.name = "mmc_ick", OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_DIV_SHIFT,
.ops = &clkops_omap2_iclk_dflt_wait, OMAP2420_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_MMC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk mmc_fck = { static struct clk uart1_fck;
.name = "mmc_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2420_EN_MMC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk fac_ick = { static struct clk_hw_omap uart1_fck_hw = {
.name = "fac_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt_wait, .clk = &uart1_fck,
.parent = &l4_ck, },
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_UART1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_FAC_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk fac_fck = { DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "fac_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_12m_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_FAC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk eac_ick = { static struct clk uart1_ick;
.name = "eac_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_EAC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk eac_fck = { static struct clk_hw_omap uart1_ick_hw = {
.name = "eac_fck", .hw = {
.ops = &clkops_omap2_dflt_wait, .clk = &uart1_ick,
.parent = &func_96m_ck, },
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_UART1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2420_EN_EAC_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk hdq_ick = { DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
.name = "hdq_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_HDQ_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk hdq_fck = { static struct clk uart2_fck;
.name = "hdq_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_12m_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_HDQ_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk i2c2_ick = { static struct clk_hw_omap uart2_fck_hw = {
.name = "i2c2_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt_wait, .clk = &uart2_fck,
.parent = &l4_ck, },
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_UART2_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_I2C2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk i2c2_fck = { DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "i2c2_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk uart2_ick;
.parent = &func_12m_ck,
static struct clk_hw_omap uart2_ick_hw = {
.hw = {
.clk = &uart2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_UART2_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2420_EN_I2C2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk i2c1_ick = { DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "i2c1_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk uart3_fck;
.parent = &l4_ck,
static struct clk_hw_omap uart3_fck_hw = {
.hw = {
.clk = &uart3_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_UART3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_I2C1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk i2c1_fck = { DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "i2c1_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk uart3_ick;
.parent = &func_12m_ck,
static struct clk_hw_omap uart3_ick_hw = {
.hw = {
.clk = &uart3_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_UART3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2420_EN_I2C1_SHIFT,
.recalc = &followparent_recalc,
}; };
/* DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
* The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
* accesses derived from this data. static struct clk usb_fck;
*/
static struct clk gpmc_fck = { static struct clk_hw_omap usb_fck_hw = {
.name = "gpmc_fck", .hw = {
.ops = &clkops_omap2_iclk_idle_only, .clk = &usb_fck,
.parent = &core_l3_ck, },
.flags = ENABLE_ON_INIT, .ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_USB_SHIFT,
.clkdm_name = "core_l3_clkdm", .clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk sdma_fck = { DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "sdma_fck",
.ops = &clkops_null, /* RMK: missing? */ static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
.parent = &core_l3_ck, { .div = 1, .val = 1, .flags = RATE_IN_24XX },
.clkdm_name = "core_l3_clkdm", { .div = 2, .val = 2, .flags = RATE_IN_24XX },
.recalc = &followparent_recalc, { .div = 4, .val = 4, .flags = RATE_IN_24XX },
{ .div = 0 }
}; };
/* static const struct clksel usb_l4_ick_clksel[] = {
* The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
* accesses derived from this data. { .parent = NULL },
*/
static struct clk sdma_ick = {
.name = "sdma_ick",
.ops = &clkops_omap2_iclk_idle_only,
.parent = &core_l3_ck,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
.recalc = &followparent_recalc,
}; };
/* static const char *usb_l4_ick_parent_names[] = {
* The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE "core_l3_ck",
* accesses derived from this data.
*/
static struct clk sdrc_ick = {
.name = "sdrc_ick",
.ops = &clkops_omap2_iclk_idle_only,
.parent = &core_l3_ck,
.flags = ENABLE_ON_INIT,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk vlynq_ick = { DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
.name = "vlynq_ick", OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.ops = &clkops_omap2_iclk_dflt_wait, OMAP24XX_CLKSEL_USB_MASK,
.parent = &core_l3_ck, OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.clkdm_name = "core_l3_clkdm", OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), usb_l4_ick_parent_names, dsp_fck_ops);
.enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
.recalc = &followparent_recalc, static struct clk virt_prcm_set;
static const char *virt_prcm_set_parent_names[] = {
"mpu_ck",
};
static const struct clk_ops virt_prcm_set_ops = {
.recalc_rate = &omap2_table_mpu_recalc,
.set_rate = &omap2_select_table_rate,
.round_rate = &omap2_round_to_table_rate,
}; };
DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
static const struct clksel_rate vlynq_fck_96m_rates[] = { static const struct clksel_rate vlynq_fck_96m_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_242X }, { .div = 1, .val = 0, .flags = RATE_IN_242X },
{ .div = 0 } { .div = 0 }
...@@ -1661,106 +1640,110 @@ static const struct clksel_rate vlynq_fck_core_rates[] = { ...@@ -1661,106 +1640,110 @@ static const struct clksel_rate vlynq_fck_core_rates[] = {
static const struct clksel vlynq_fck_clksel[] = { static const struct clksel vlynq_fck_clksel[] = {
{ .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates }, { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
{ .parent = &core_ck, .rates = vlynq_fck_core_rates }, { .parent = &core_ck, .rates = vlynq_fck_core_rates },
{ .parent = NULL } { .parent = NULL },
}; };
static struct clk vlynq_fck = { static const char *vlynq_fck_parent_names[] = {
.name = "vlynq_fck", "func_96m_ck", "core_ck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP2420_CLKSEL_VLYNQ_MASK,
.clksel = vlynq_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk des_ick = { DEFINE_CLK_OMAP_MUX_GATE(vlynq_fck, "core_l3_clkdm", vlynq_fck_clksel,
.name = "des_ick", OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.ops = &clkops_omap2_iclk_dflt_wait, OMAP2420_CLKSEL_VLYNQ_MASK,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.clkdm_name = "core_l4_clkdm", OMAP2420_EN_VLYNQ_SHIFT, &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), vlynq_fck_parent_names, dss1_fck_ops);
.enable_bit = OMAP24XX_EN_DES_SHIFT,
.recalc = &followparent_recalc, static struct clk vlynq_ick;
static struct clk_hw_omap vlynq_ick_hw = {
.hw = {
.clk = &vlynq_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
.clkdm_name = "core_l3_clkdm",
}; };
static struct clk sha_ick = { DEFINE_STRUCT_CLK(vlynq_ick, gfx_ick_parent_names, aes_ick_ops);
.name = "sha_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk wdt1_ick;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap wdt1_ick_hw = {
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4), .hw = {
.enable_bit = OMAP24XX_EN_SHA_SHIFT, .clk = &wdt1_ick,
.recalc = &followparent_recalc, },
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_WDT1_SHIFT,
.clkdm_name = "wkup_clkdm",
}; };
static struct clk rng_ick = { DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "rng_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk wdt1_osc_ck;
.parent = &l4_ck,
static const struct clk_ops wdt1_osc_ck_ops = {};
DEFINE_STRUCT_CLK_HW_OMAP(wdt1_osc_ck, NULL);
DEFINE_STRUCT_CLK(wdt1_osc_ck, sys_ck_parent_names, wdt1_osc_ck_ops);
static struct clk wdt3_fck;
static struct clk_hw_omap wdt3_fck_hw = {
.hw = {
.clk = &wdt3_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2420_EN_WDT3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_RNG_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk aes_ick = { DEFINE_STRUCT_CLK(wdt3_fck, gpios_fck_parent_names, aes_ick_ops);
.name = "aes_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk wdt3_ick;
.parent = &l4_ck,
static struct clk_hw_omap wdt3_ick_hw = {
.hw = {
.clk = &wdt3_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_WDT3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_AES_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk pka_ick = { DEFINE_STRUCT_CLK(wdt3_ick, aes_ick_parent_names, aes_ick_ops);
.name = "pka_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk wdt4_fck;
.parent = &l4_ck,
static struct clk_hw_omap wdt4_fck_hw = {
.hw = {
.clk = &wdt4_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_WDT4_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_PKA_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk usb_fck = { DEFINE_STRUCT_CLK(wdt4_fck, gpios_fck_parent_names, aes_ick_ops);
.name = "usb_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_48m_ck,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_USB_SHIFT,
.recalc = &followparent_recalc,
};
/* static struct clk wdt4_ick;
* This clock is a composite clock which does entire set changes then
* forces a rebalance. It keys on the MPU speed, but it really could static struct clk_hw_omap wdt4_ick_hw = {
* be any key speed part of a set in the rate table. .hw = {
* .clk = &wdt4_ick,
* to really change a set, you need memory table sets which get changed },
* in sram, pre-notifiers & post notifiers, changing the top set, without .ops = &clkhwops_iclk_wait,
* having low level display recalc's won't work... this is why dpm notifiers .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
* work, isr's off, walk a list of clocks already _off_ and not messing with .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
* the bus. .clkdm_name = "core_l4_clkdm",
*
* This clock should have no parent. It embodies the entire upper level
* active set. A parent will mess up some of the init also.
*/
static struct clk virt_prcm_set = {
.name = "virt_prcm_set",
.ops = &clkops_null,
.parent = &mpu_ck, /* Indexed by mpu speed, no parent */
.recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */
.set_rate = &omap2_select_table_rate,
.round_rate = &omap2_round_to_table_rate,
}; };
DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
/* /*
* clkdev integration * clkdev integration
...@@ -1919,6 +1902,16 @@ static struct omap_clk omap2420_clks[] = { ...@@ -1919,6 +1902,16 @@ static struct omap_clk omap2420_clks[] = {
CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X), CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X),
}; };
static const char *enable_init_clks[] = {
"apll96_ck",
"apll54_ck",
"sync_32k_ick",
"omapctrl_ick",
"gpmc_fck",
"sdrc_ick",
};
/* /*
* init code * init code
*/ */
...@@ -1931,42 +1924,27 @@ int __init omap2420_clk_init(void) ...@@ -1931,42 +1924,27 @@ int __init omap2420_clk_init(void)
cpu_mask = RATE_IN_242X; cpu_mask = RATE_IN_242X;
rate_table = omap2420_rate_table; rate_table = omap2420_rate_table;
for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks); omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
c++)
clk_preinit(c->lk.clk);
osc_ck.rate = omap2_osc_clk_recalc(&osc_ck); omap2xxx_clkt_vps_check_bootloader_rates();
propagate_rate(&osc_ck);
sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
propagate_rate(&sys_ck);
for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks); for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
c++) { c++) {
clkdev_add(&c->lk); clkdev_add(&c->lk);
clk_register(c->lk.clk); if (!__clk_init(NULL, c->lk.clk))
omap2_init_clk_clkdm(c->lk.clk); omap2_init_clk_hw_omap_clocks(c->lk.clk);
} }
omap2xxx_clkt_vps_late_init(); omap2_clk_disable_autoidle_all();
/* Disable autoidle on all clocks; let the PM code enable it later */
omap_clk_disable_autoidle_all();
/* XXX Can this be done from the virt_prcm_set clk init function? */
omap2xxx_clkt_vps_check_bootloader_rates();
recalculate_root_clocks(); omap2_clk_enable_init_clocks(enable_init_clks,
ARRAY_SIZE(enable_init_clks));
pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n", pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
(sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10, (clk_get_rate(&sys_ck) / 1000000),
(dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ; (clk_get_rate(&sys_ck) / 100000) % 10,
(clk_get_rate(&dpll_ck) / 1000000),
/* (clk_get_rate(&mpu_ck) / 1000000));
* Only enable those clocks we will need, let the drivers
* enable other clocks as necessary
*/
clk_enable_init_clocks();
return 0; return 0;
} }
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/clk-private.h>
#include <linux/list.h> #include <linux/list.h>
#include "soc.h" #include "soc.h"
...@@ -23,7 +24,7 @@ ...@@ -23,7 +24,7 @@
#include "clock2xxx.h" #include "clock2xxx.h"
#include "opp2xxx.h" #include "opp2xxx.h"
#include "cm2xxx.h" #include "cm2xxx.h"
#include "prm2xxx_3xxx.h" #include "prm2xxx.h"
#include "prm-regbits-24xx.h" #include "prm-regbits-24xx.h"
#include "cm-regbits-24xx.h" #include "cm-regbits-24xx.h"
#include "sdrc.h" #include "sdrc.h"
...@@ -48,59 +49,48 @@ ...@@ -48,59 +49,48 @@
* clocks. * clocks.
*/ */
/* Base external input clocks */ DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
static struct clk func_32k_ck = {
.name = "func_32k_ck", DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
.ops = &clkops_null,
.rate = 32768, DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
.clkdm_name = "wkup_clkdm",
static struct clk osc_ck;
static const struct clk_ops osc_ck_ops = {
.enable = &omap2_enable_osc_ck,
.disable = omap2_disable_osc_ck,
.recalc_rate = &omap2_osc_clk_recalc,
}; };
static struct clk secure_32k_ck = { static struct clk_hw_omap osc_ck_hw = {
.name = "secure_32k_ck", .hw = {
.ops = &clkops_null, .clk = &osc_ck,
.rate = 32768, },
.clkdm_name = "wkup_clkdm",
}; };
/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */ static struct clk osc_ck = {
static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
.name = "osc_ck", .name = "osc_ck",
.ops = &clkops_oscck, .ops = &osc_ck_ops,
.clkdm_name = "wkup_clkdm", .hw = &osc_ck_hw.hw,
.recalc = &omap2_osc_clk_recalc, .flags = CLK_IS_ROOT,
}; };
/* Without modem likely 12MHz, with modem likely 13MHz */ DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
.name = "sys_ck", /* ~ ref_clk also */
.ops = &clkops_null,
.parent = &osc_ck,
.clkdm_name = "wkup_clkdm",
.recalc = &omap2xxx_sys_clk_recalc,
};
static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */ static struct clk sys_ck;
.name = "alt_ck",
.ops = &clkops_null,
.rate = 54000000,
.clkdm_name = "wkup_clkdm",
};
/* Optional external clock input for McBSP CLKS */ static const char *sys_ck_parent_names[] = {
static struct clk mcbsp_clks = { "osc_ck",
.name = "mcbsp_clks",
.ops = &clkops_null,
}; };
/* static const struct clk_ops sys_ck_ops = {
* Analog domain root source clocks .init = &omap2_init_clk_clkdm,
*/ .recalc_rate = &omap2xxx_sys_clk_recalc,
};
/* dpll_ck, is broken out in to special cases through clksel */ DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
/* REVISIT: Rate changes on dpll_ck trigger a full set change. ... DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
* deal with this
*/
static struct dpll_data dpll_dd = { static struct dpll_data dpll_dd = {
.mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
...@@ -115,702 +105,540 @@ static struct dpll_data dpll_dd = { ...@@ -115,702 +105,540 @@ static struct dpll_data dpll_dd = {
.max_divider = 16, .max_divider = 16,
}; };
/* static struct clk dpll_ck;
* XXX Cannot add round_rate here yet, as this is still a composite clock,
* not just a DPLL static const char *dpll_ck_parent_names[] = {
*/ "sys_ck",
static struct clk dpll_ck = {
.name = "dpll_ck",
.ops = &clkops_omap2xxx_dpll_ops,
.parent = &sys_ck, /* Can be func_32k also */
.init = &omap2xxx_clkt_dpllcore_init,
.dpll_data = &dpll_dd,
.clkdm_name = "wkup_clkdm",
.recalc = &omap2_dpllcore_recalc,
.set_rate = &omap2_reprogram_dpllcore,
}; };
static struct clk apll96_ck = { static const struct clk_ops dpll_ck_ops = {
.name = "apll96_ck", .init = &omap2_init_clk_clkdm,
.ops = &clkops_apll96, .get_parent = &omap2_init_dpll_parent,
.parent = &sys_ck, .recalc_rate = &omap2_dpllcore_recalc,
.rate = 96000000, .round_rate = &omap2_dpll_round_rate,
.flags = ENABLE_ON_INIT, .set_rate = &omap2_reprogram_dpllcore,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
.enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
}; };
static struct clk apll54_ck = { static struct clk_hw_omap dpll_ck_hw = {
.name = "apll54_ck", .hw = {
.ops = &clkops_apll54, .clk = &dpll_ck,
.parent = &sys_ck, },
.rate = 54000000, .ops = &clkhwops_omap2xxx_dpll,
.flags = ENABLE_ON_INIT, .dpll_data = &dpll_dd,
.clkdm_name = "wkup_clkdm", .clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
.enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
}; };
/* DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
* PRCM digital base sources
*/
/* func_54m_ck */ static struct clk core_ck;
static const struct clksel_rate func_54m_apll54_rates[] = { static const char *core_ck_parent_names[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX }, "dpll_ck",
{ .div = 0 },
}; };
static const struct clksel_rate func_54m_alt_rates[] = { static const struct clk_ops core_ck_ops = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, .init = &omap2_init_clk_clkdm,
{ .div = 0 },
}; };
static const struct clksel func_54m_clksel[] = { DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
{ .parent = &apll54_ck, .rates = func_54m_apll54_rates, }, DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
{ .parent = &alt_ck, .rates = func_54m_alt_rates, },
{ .parent = NULL },
};
static struct clk func_54m_ck = { DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
.name = "func_54m_ck", OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.ops = &clkops_null, OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
.parent = &apll54_ck, /* can also be alt_clk */ CLK_DIVIDER_ONE_BASED, NULL);
.clkdm_name = "wkup_clkdm",
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_54M_SOURCE_MASK,
.clksel = func_54m_clksel,
.recalc = &omap2_clksel_recalc,
};
static struct clk core_ck = { DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
.name = "core_ck", OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.ops = &clkops_null, OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
.parent = &dpll_ck, /* can also be 32k */ CLK_DIVIDER_ONE_BASED, NULL);
.clkdm_name = "wkup_clkdm",
.recalc = &followparent_recalc,
};
/* func_96m_ck */ static struct clk aes_ick;
static const struct clksel_rate func_96m_apll96_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel_rate func_96m_alt_rates[] = { static const char *aes_ick_parent_names[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_243X }, "l4_ck",
{ .div = 0 },
}; };
static const struct clksel func_96m_clksel[] = { static const struct clk_ops aes_ick_ops = {
{ .parent = &apll96_ck, .rates = func_96m_apll96_rates }, .init = &omap2_init_clk_clkdm,
{ .parent = &alt_ck, .rates = func_96m_alt_rates }, .enable = &omap2_dflt_clk_enable,
{ .parent = NULL } .disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
}; };
static struct clk func_96m_ck = { static struct clk_hw_omap aes_ick_hw = {
.name = "func_96m_ck", .hw = {
.ops = &clkops_null, .clk = &aes_ick,
.parent = &apll96_ck, },
.clkdm_name = "wkup_clkdm", .ops = &clkhwops_iclk_wait,
.init = &omap2_init_clksel_parent, .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), .enable_bit = OMAP24XX_EN_AES_SHIFT,
.clksel_mask = OMAP2430_96M_SOURCE_MASK, .clkdm_name = "core_l4_clkdm",
.clksel = func_96m_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* func_48m_ck */ DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
static const struct clksel_rate func_48m_apll96_rates[] = {
{ .div = 2, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel_rate func_48m_alt_rates[] = { static struct clk apll54_ck;
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel func_48m_clksel[] = { static const struct clk_ops apll54_ck_ops = {
{ .parent = &apll96_ck, .rates = func_48m_apll96_rates }, .init = &omap2_init_clk_clkdm,
{ .parent = &alt_ck, .rates = func_48m_alt_rates }, .enable = &omap2_clk_apll54_enable,
{ .parent = NULL } .disable = &omap2_clk_apll54_disable,
.recalc_rate = &omap2_clk_apll54_recalc,
}; };
static struct clk func_48m_ck = { static struct clk_hw_omap apll54_ck_hw = {
.name = "func_48m_ck", .hw = {
.ops = &clkops_null, .clk = &apll54_ck,
.parent = &apll96_ck, /* 96M or Alt */ },
.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", .clkdm_name = "wkup_clkdm",
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_48M_SOURCE_MASK,
.clksel = func_48m_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
}; };
static struct clk func_12m_ck = { DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
.name = "func_12m_ck",
.ops = &clkops_null,
.parent = &func_48m_ck,
.fixed_div = 4,
.clkdm_name = "wkup_clkdm",
.recalc = &omap_fixed_divisor_recalc,
};
/* Secure timer, only available in secure mode */ static struct clk apll96_ck;
static struct clk wdt1_osc_ck = {
.name = "ck_wdt1_osc",
.ops = &clkops_null, /* RMK: missing? */
.parent = &osc_ck,
.recalc = &followparent_recalc,
};
/* static const struct clk_ops apll96_ck_ops = {
* The common_clkout* clksel_rate structs are common to .init = &omap2_init_clk_clkdm,
* sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src. .enable = &omap2_clk_apll96_enable,
* sys_clkout2_* are 2420-only, so the .disable = &omap2_clk_apll96_disable,
* clksel_rate flags fields are inaccurate for those clocks. This is .recalc_rate = &omap2_clk_apll96_recalc,
* harmless since access to those clocks are gated by the struct clk
* flags fields, which mark them as 2420-only.
*/
static const struct clksel_rate common_clkout_src_core_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 }
}; };
static const struct clksel_rate common_clkout_src_sys_rates[] = { static struct clk_hw_omap apll96_ck_hw = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, .hw = {
{ .div = 0 } .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",
}; };
static const struct clksel_rate common_clkout_src_96m_rates[] = { DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
{ .div = 1, .val = 2, .flags = RATE_IN_24XX },
{ .div = 0 }
};
static const struct clksel_rate common_clkout_src_54m_rates[] = { static const char *func_96m_ck_parent_names[] = {
{ .div = 1, .val = 3, .flags = RATE_IN_24XX }, "apll96_ck", "alt_ck",
{ .div = 0 }
}; };
static const struct clksel common_clkout_src_clksel[] = { DEFINE_CLK_MUX(func_96m_ck, func_96m_ck_parent_names, NULL, 0x0,
{ .parent = &core_ck, .rates = common_clkout_src_core_rates }, OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP2430_96M_SOURCE_SHIFT,
{ .parent = &sys_ck, .rates = common_clkout_src_sys_rates }, OMAP2430_96M_SOURCE_WIDTH, 0x0, NULL);
{ .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
{ .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
{ .parent = NULL }
};
static struct clk sys_clkout_src = { static struct clk cam_fck;
.name = "sys_clkout_src",
.ops = &clkops_omap2_dflt,
.parent = &func_54m_ck,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP2430_PRCM_CLKOUT_CTRL,
.enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP2430_PRCM_CLKOUT_CTRL,
.clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK,
.clksel = common_clkout_src_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
};
static const struct clksel_rate common_clkout_rates[] = { static const char *cam_fck_parent_names[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX }, "func_96m_ck",
{ .div = 2, .val = 1, .flags = RATE_IN_24XX },
{ .div = 4, .val = 2, .flags = RATE_IN_24XX },
{ .div = 8, .val = 3, .flags = RATE_IN_24XX },
{ .div = 16, .val = 4, .flags = RATE_IN_24XX },
{ .div = 0 },
}; };
static const struct clksel sys_clkout_clksel[] = { static struct clk_hw_omap cam_fck_hw = {
{ .parent = &sys_clkout_src, .rates = common_clkout_rates }, .hw = {
{ .parent = NULL } .clk = &cam_fck,
},
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_CAM_SHIFT,
.clkdm_name = "core_l3_clkdm",
}; };
static struct clk sys_clkout = { DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
.name = "sys_clkout",
.ops = &clkops_null,
.parent = &sys_clkout_src,
.clkdm_name = "wkup_clkdm",
.clksel_reg = OMAP2430_PRCM_CLKOUT_CTRL,
.clksel_mask = OMAP24XX_CLKOUT_DIV_MASK,
.clksel = sys_clkout_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
};
static struct clk emul_ck = { static struct clk cam_ick;
.name = "emul_ck",
.ops = &clkops_omap2_dflt,
.parent = &func_54m_ck,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
.enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
.recalc = &followparent_recalc,
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);
* MPU clock domain
* Clocks:
* MPU_FCLK, MPU_ICLK
* INT_M_FCLK, INT_M_I_CLK
*
* - Individual clocks are hardware managed.
* - Base divider comes from: CM_CLKSEL_MPU
*
*/
static const struct clksel_rate mpu_core_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
{ .div = 0 },
};
static const struct clksel mpu_clksel[] = { static struct clk des_ick;
{ .parent = &core_ck, .rates = mpu_core_rates },
{ .parent = NULL }
};
static struct clk mpu_ck = { /* Control cpu */ static struct clk_hw_omap des_ick_hw = {
.name = "mpu_ck", .hw = {
.ops = &clkops_null, .clk = &des_ick,
.parent = &core_ck, },
.clkdm_name = "mpu_clkdm", .ops = &clkhwops_iclk_wait,
.init = &omap2_init_clksel_parent, .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL), .enable_bit = OMAP24XX_EN_DES_SHIFT,
.clksel_mask = OMAP24XX_CLKSEL_MPU_MASK, .clkdm_name = "core_l4_clkdm",
.clksel = mpu_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
* DSP (2430-IVA2.1) clock domain
* Clocks:
* 2430: IVA2.1_FCLK (really just DSP_FCLK), IVA2.1_ICLK
*
* Won't be too specific here. The core clock comes into this block
* it is divided then tee'ed. One branch goes directly to xyz enable
* controls. The other branch gets further divided by 2 then possibly
* routed into a synchronizer and out of clocks abc.
*/
static const struct clksel_rate dsp_fck_core_rates[] = { static const struct clksel_rate dsp_fck_core_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, { .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_24XX }, { .div = 2, .val = 2, .flags = RATE_IN_24XX },
{ .div = 3, .val = 3, .flags = RATE_IN_24XX }, { .div = 3, .val = 3, .flags = RATE_IN_24XX },
{ .div = 4, .val = 4, .flags = RATE_IN_24XX }, { .div = 4, .val = 4, .flags = RATE_IN_24XX },
{ .div = 0 }, { .div = 0 }
}; };
static const struct clksel dsp_fck_clksel[] = { static const struct clksel dsp_fck_clksel[] = {
{ .parent = &core_ck, .rates = dsp_fck_core_rates }, { .parent = &core_ck, .rates = dsp_fck_core_rates },
{ .parent = NULL } { .parent = NULL },
}; };
static struct clk dsp_fck = { static const char *dsp_fck_parent_names[] = {
.name = "dsp_fck", "core_ck",
.ops = &clkops_omap2_dflt_wait,
.parent = &core_ck,
.clkdm_name = "dsp_clkdm",
.enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
.clksel_mask = OMAP24XX_CLKSEL_DSP_MASK,
.clksel = dsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static const struct clksel dsp_ick_clksel[] = { static struct clk dsp_fck;
{ .parent = &dsp_fck, .rates = dsp_ick_rates },
{ .parent = NULL } static const struct clk_ops dsp_fck_ops = {
.init = &omap2_init_clk_clkdm,
.enable = &omap2_dflt_clk_enable,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
.recalc_rate = &omap2_clksel_recalc,
.set_rate = &omap2_clksel_set_rate,
.round_rate = &omap2_clksel_round_rate,
}; };
/* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */ DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
static struct clk iva2_1_ick = { OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
.name = "iva2_1_ick", OMAP24XX_CLKSEL_DSP_MASK,
.ops = &clkops_omap2_dflt_wait, OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
.parent = &dsp_fck, OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
.clkdm_name = "dsp_clkdm", dsp_fck_parent_names, dsp_fck_ops);
.enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, static const struct clksel_rate dss1_fck_sys_rates[] = {
.clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL), { .div = 1, .val = 0, .flags = RATE_IN_24XX },
.clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK, { .div = 0 }
.clksel = dsp_ick_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* static const struct clksel_rate dss1_fck_core_rates[] = {
* L3 clock domain
* L3 clocks are used for both interface and functional clocks to
* multiple entities. Some of these clocks are completely managed
* by hardware, and some others allow software control. Hardware
* managed ones general are based on directly CLK_REQ signals and
* various auto idle settings. The functional spec sets many of these
* as 'tie-high' for their enables.
*
* I-CLOCKS:
* L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
* CAM, HS-USB.
* F-CLOCK
* SSI.
*
* GPMC memories and SDRC have timing and clock sensitive registers which
* may very well need notification when the clock changes. Currently for low
* operating points, these are taken care of in sleep.S.
*/
static const struct clksel_rate core_l3_core_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, { .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 = 4, .val = 4, .flags = RATE_IN_24XX },
{ .div = 5, .val = 5, .flags = RATE_IN_24XX },
{ .div = 6, .val = 6, .flags = RATE_IN_24XX }, { .div = 6, .val = 6, .flags = RATE_IN_24XX },
{ .div = 8, .val = 8, .flags = RATE_IN_24XX },
{ .div = 9, .val = 9, .flags = RATE_IN_24XX },
{ .div = 12, .val = 12, .flags = RATE_IN_24XX },
{ .div = 16, .val = 16, .flags = RATE_IN_24XX },
{ .div = 0 } { .div = 0 }
}; };
static const struct clksel core_l3_clksel[] = { static const struct clksel dss1_fck_clksel[] = {
{ .parent = &core_ck, .rates = core_l3_core_rates }, { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
{ .parent = NULL } { .parent = &core_ck, .rates = dss1_fck_core_rates },
{ .parent = NULL },
}; };
static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */ static const char *dss1_fck_parent_names[] = {
.name = "core_l3_ck", "sys_ck", "core_ck",
.ops = &clkops_null,
.parent = &core_ck,
.clkdm_name = "core_l3_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
.clksel = core_l3_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* usb_l4_ick */ static const struct clk_ops dss1_fck_ops = {
static const struct clksel_rate usb_l4_ick_core_l3_rates[] = { .init = &omap2_init_clk_clkdm,
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, .enable = &omap2_dflt_clk_enable,
{ .div = 2, .val = 2, .flags = RATE_IN_24XX }, .disable = &omap2_dflt_clk_disable,
{ .div = 4, .val = 4, .flags = RATE_IN_24XX }, .is_enabled = &omap2_dflt_clk_is_enabled,
{ .div = 0 } .recalc_rate = &omap2_clksel_recalc,
.get_parent = &omap2_clksel_find_parent_index,
.set_parent = &omap2_clksel_set_parent,
}; };
static const struct clksel usb_l4_ick_clksel[] = { DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
{ .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates }, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
{ .parent = NULL }, OMAP24XX_CLKSEL_DSS1_MASK,
}; OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_DSS1_SHIFT, NULL,
dss1_fck_parent_names, dss1_fck_ops);
/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */ static const struct clksel_rate dss2_fck_sys_rates[] = {
static struct clk usb_l4_ick = { /* FS-USB interface clock */ { .div = 1, .val = 0, .flags = RATE_IN_24XX },
.name = "usb_l4_ick", { .div = 0 }
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &core_l3_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_USB_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_USB_MASK,
.clksel = usb_l4_ick_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* static const struct clksel_rate dss2_fck_48m_rates[] = {
* L4 clock management domain
*
* This domain contains lots of interface clocks from the L4 interface, some
* functional clocks. Fixed APLL functional source clocks are managed in
* this domain.
*/
static const struct clksel_rate l4_core_l3_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, { .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_24XX },
{ .div = 0 } { .div = 0 }
}; };
static const struct clksel l4_clksel[] = { static const struct clksel_rate func_48m_apll96_rates[] = {
{ .parent = &core_l3_ck, .rates = l4_core_l3_rates }, { .div = 2, .val = 0, .flags = RATE_IN_24XX },
{ .parent = NULL } { .div = 0 }
};
static struct clk l4_ck = { /* used both as an ick and fck */
.name = "l4_ck",
.ops = &clkops_null,
.parent = &core_l3_ck,
.clkdm_name = "core_l4_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
.clksel = l4_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* static const struct clksel_rate func_48m_alt_rates[] = {
* SSI is in L3 management domain, its direct parent is core not l3,
* many core power domain entities are grouped into the L3 clock
* domain.
* SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
*
* ssr = core/1/2/3/4/5, sst = 1/2 ssr.
*/
static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, { .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 = 5, .val = 5, .flags = RATE_IN_243X },
{ .div = 0 } { .div = 0 }
}; };
static const struct clksel ssi_ssr_sst_fck_clksel[] = { static const struct clksel func_48m_clksel[] = {
{ .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates }, { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
{ .parent = NULL } { .parent = &alt_ck, .rates = func_48m_alt_rates },
{ .parent = NULL },
}; };
static struct clk ssi_ssr_sst_fck = { static const char *func_48m_ck_parent_names[] = {
.name = "ssi_fck", "apll96_ck", "alt_ck",
.ops = &clkops_omap2_dflt_wait,
.parent = &core_ck,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_SSI_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_SSI_MASK,
.clksel = ssi_ssr_sst_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
/* static struct clk func_48m_ck;
* Presumably this is the same as SSI_ICLK.
* TRM contradicts itself on what clockdomain SSI_ICLK is in static const struct clk_ops func_48m_ck_ops = {
*/ .init = &omap2_init_clk_clkdm,
static struct clk ssi_l4_ick = { .recalc_rate = &omap2_clksel_recalc,
.name = "ssi_l4_ick", .set_rate = &omap2_clksel_set_rate,
.ops = &clkops_omap2_iclk_dflt_wait, .round_rate = &omap2_clksel_round_rate,
.parent = &l4_ck, .get_parent = &omap2_clksel_find_parent_index,
.clkdm_name = "core_l4_clkdm", .set_parent = &omap2_clksel_set_parent,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_SSI_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk_hw_omap func_48m_ck_hw = {
.hw = {
.clk = &func_48m_ck,
},
.clksel = func_48m_clksel,
.clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_48M_SOURCE_MASK,
.clkdm_name = "wkup_clkdm",
};
/* DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
* GFX clock domain
* Clocks:
* GFX_FCLK, GFX_ICLK
* GFX_CG1(2d), GFX_CG2(3d)
*
* GFX_FCLK runs from L3, and is divided by (1,2,3,4)
* The 2d and 3d clocks run at a hardware determined
* divided value of fclk.
*
*/
/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */ static const struct clksel dss2_fck_clksel[] = {
static const struct clksel gfx_fck_clksel[] = { { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
{ .parent = &core_l3_ck, .rates = gfx_l3_rates }, { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk gfx_3d_fck = { static const char *dss2_fck_parent_names[] = {
.name = "gfx_3d_fck", "sys_ck", "func_48m_ck",
.ops = &clkops_omap2_dflt_wait,
.parent = &core_l3_ck,
.clkdm_name = "gfx_clkdm",
.enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_3D_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
.clksel_mask = OMAP_CLKSEL_GFX_MASK,
.clksel = gfx_fck_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
}; };
static struct clk gfx_2d_fck = { DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
.name = "gfx_2d_fck", OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.ops = &clkops_omap2_dflt_wait, OMAP24XX_CLKSEL_DSS2_MASK,
.parent = &core_l3_ck, OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.clkdm_name = "gfx_clkdm", OMAP24XX_EN_DSS2_SHIFT, NULL,
.enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN), dss2_fck_parent_names, dss1_fck_ops);
.enable_bit = OMAP24XX_EN_2D_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
.clksel_mask = OMAP_CLKSEL_GFX_MASK,
.clksel = gfx_fck_clksel,
.recalc = &omap2_clksel_recalc,
};
/* This interface clock does not have a CM_AUTOIDLE bit */
static struct clk gfx_ick = {
.name = "gfx_ick", /* From l3 */
.ops = &clkops_omap2_dflt_wait,
.parent = &core_l3_ck,
.clkdm_name = "gfx_clkdm",
.enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
.enable_bit = OMAP_EN_GFX_SHIFT,
.recalc = &followparent_recalc,
};
/* static const char *func_54m_ck_parent_names[] = {
* Modem clock domain (2430) "apll54_ck", "alt_ck",
* CLOCKS:
* MDM_OSC_CLK
* MDM_ICLK
* These clocks are usable in chassis mode only.
*/
static const struct clksel_rate mdm_ick_core_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_243X },
{ .div = 4, .val = 4, .flags = RATE_IN_243X },
{ .div = 6, .val = 6, .flags = RATE_IN_243X },
{ .div = 9, .val = 9, .flags = RATE_IN_243X },
{ .div = 0 }
}; };
static const struct clksel mdm_ick_clksel[] = { DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
{ .parent = &core_ck, .rates = mdm_ick_core_rates }, OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
{ .parent = NULL } OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH, 0x0, NULL);
static struct clk dss_54m_fck;
static const char *dss_54m_fck_parent_names[] = {
"func_54m_ck",
}; };
static struct clk mdm_ick = { /* used both as a ick and fck */ static struct clk_hw_omap dss_54m_fck_hw = {
.name = "mdm_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt_wait, .clk = &dss_54m_fck,
.parent = &core_ck, },
.clkdm_name = "mdm_clkdm", .ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT, .enable_bit = OMAP24XX_EN_TV_SHIFT,
.clksel_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL), .clkdm_name = "dss_clkdm",
.clksel_mask = OMAP2430_CLKSEL_MDM_MASK,
.clksel = mdm_ick_clksel,
.recalc = &omap2_clksel_recalc,
};
static struct clk mdm_osc_ck = {
.name = "mdm_osc_ck",
.ops = &clkops_omap2_mdmclk_dflt_wait,
.parent = &osc_ck,
.clkdm_name = "mdm_clkdm",
.enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
.enable_bit = OMAP2430_EN_OSC_SHIFT,
.recalc = &followparent_recalc,
}; };
/* DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
* DSS clock domain
* CLOCKs:
* DSS_L4_ICLK, DSS_L3_ICLK,
* DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
*
* DSS is both initiator and target.
*/
/* XXX Add RATE_NOT_VALIDATED */
static const struct clksel_rate dss1_fck_sys_rates[] = { static struct clk dss_ick;
{ .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 } static struct clk_hw_omap dss_ick_hw = {
.hw = {
.clk = &dss_ick,
},
.ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_DSS1_SHIFT,
.clkdm_name = "dss_clkdm",
}; };
static const struct clksel_rate dss1_fck_core_rates[] = { DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
{ .div = 1, .val = 1, .flags = RATE_IN_24XX },
{ .div = 2, .val = 2, .flags = RATE_IN_24XX }, static struct clk emul_ck;
{ .div = 3, .val = 3, .flags = RATE_IN_24XX },
{ .div = 4, .val = 4, .flags = RATE_IN_24XX }, static struct clk_hw_omap emul_ck_hw = {
{ .div = 5, .val = 5, .flags = RATE_IN_24XX }, .hw = {
{ .div = 6, .val = 6, .flags = RATE_IN_24XX }, .clk = &emul_ck,
{ .div = 8, .val = 8, .flags = RATE_IN_24XX }, },
{ .div = 9, .val = 9, .flags = RATE_IN_24XX }, .enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
{ .div = 12, .val = 12, .flags = RATE_IN_24XX }, .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
{ .div = 16, .val = 16, .flags = RATE_IN_24XX }, .clkdm_name = "wkup_clkdm",
{ .div = 0 }
}; };
static const struct clksel dss1_fck_clksel[] = { DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
{ .parent = &sys_ck, .rates = dss1_fck_sys_rates },
{ .parent = &core_ck, .rates = dss1_fck_core_rates }, DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
{ .parent = NULL },
static struct clk fac_fck;
static const char *fac_fck_parent_names[] = {
"func_12m_ck",
}; };
static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */ static struct clk_hw_omap fac_fck_hw = {
.name = "dss_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt, .clk = &fac_fck,
.parent = &l4_ck, /* really both l3 and l4 */ },
.clkdm_name = "dss_clkdm", .ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_FAC_SHIFT,
.clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
static struct clk fac_ick;
static struct clk_hw_omap fac_ick_hw = {
.hw = {
.clk = &fac_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_DSS1_SHIFT, .enable_bit = OMAP24XX_EN_FAC_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk dss1_fck = { DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
.name = "dss1_fck",
.ops = &clkops_omap2_dflt, static const struct clksel gfx_fck_clksel[] = {
.parent = &core_ck, /* Core or sys */ { .parent = &core_l3_ck, .rates = gfx_l3_rates },
.clkdm_name = "dss_clkdm", { .parent = NULL },
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_DSS1_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK,
.clksel = dss1_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static const struct clksel_rate dss2_fck_sys_rates[] = { static const char *gfx_2d_fck_parent_names[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX }, "core_l3_ck",
{ .div = 0 }
}; };
static const struct clksel_rate dss2_fck_48m_rates[] = { DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
{ .div = 1, .val = 1, .flags = RATE_IN_24XX }, OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
{ .div = 0 } OMAP_CLKSEL_GFX_MASK,
OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
gfx_2d_fck_parent_names, dsp_fck_ops);
DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
OMAP_CLKSEL_GFX_MASK,
OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
gfx_2d_fck_parent_names, dsp_fck_ops);
static struct clk gfx_ick;
static const char *gfx_ick_parent_names[] = {
"core_l3_ck",
}; };
static const struct clksel dss2_fck_clksel[] = { static struct clk_hw_omap gfx_ick_hw = {
{ .parent = &sys_ck, .rates = dss2_fck_sys_rates }, .hw = {
{ .parent = &func_48m_ck, .rates = dss2_fck_48m_rates }, .clk = &gfx_ick,
{ .parent = NULL } },
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
.enable_bit = OMAP_EN_GFX_SHIFT,
.clkdm_name = "gfx_clkdm",
}; };
static struct clk dss2_fck = { /* Alt clk used in power management */ DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
.name = "dss2_fck",
.ops = &clkops_omap2_dflt, static struct clk gpio5_fck;
.parent = &sys_ck, /* fixed at sys_ck or 48MHz */
.clkdm_name = "dss_clkdm", static const char *gpio5_fck_parent_names[] = {
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), "func_32k_ck",
.enable_bit = OMAP24XX_EN_DSS2_SHIFT, };
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1), static struct clk_hw_omap gpio5_fck_hw = {
.clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK, .hw = {
.clksel = dss2_fck_clksel, .clk = &gpio5_fck,
.recalc = &omap2_clksel_recalc, },
}; .ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
static struct clk dss_54m_fck = { /* Alt clk used in power management */ .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
.name = "dss_54m_fck", /* 54m tv clk */ .clkdm_name = "core_l4_clkdm",
.ops = &clkops_omap2_dflt_wait, };
.parent = &func_54m_ck,
.clkdm_name = "dss_clkdm", DEFINE_STRUCT_CLK(gpio5_fck, gpio5_fck_parent_names, aes_ick_ops);
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_TV_SHIFT, static struct clk gpio5_ick;
.recalc = &followparent_recalc,
static struct clk_hw_omap gpio5_ick_hw = {
.hw = {
.clk = &gpio5_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_GPIO5_SHIFT,
.clkdm_name = "core_l4_clkdm",
}; };
static struct clk wu_l4_ick = { DEFINE_STRUCT_CLK(gpio5_ick, aes_ick_parent_names, aes_ick_ops);
.name = "wu_l4_ick",
.ops = &clkops_null, static struct clk gpios_fck;
.parent = &sys_ck,
static struct clk_hw_omap gpios_fck_hw = {
.hw = {
.clk = &gpios_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
.clkdm_name = "wkup_clkdm", .clkdm_name = "wkup_clkdm",
.recalc = &followparent_recalc,
}; };
/* DEFINE_STRUCT_CLK(gpios_fck, gpio5_fck_parent_names, aes_ick_ops);
* CORE power domain ICLK & FCLK defines.
* Many of the these can have more than one possible parent. Entries static struct clk wu_l4_ick;
* here will likely have an L4 interface parent, and may have multiple
* functional clock parents. DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
*/ DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
static struct clk gpios_ick;
static const char *gpios_ick_parent_names[] = {
"wu_l4_ick",
};
static struct clk_hw_omap gpios_ick_hw = {
.hw = {
.clk = &gpios_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
.clkdm_name = "wkup_clkdm",
};
DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
static struct clk gpmc_fck;
static struct clk_hw_omap gpmc_fck_hw = {
.hw = {
.clk = &gpmc_fck,
},
.ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
.flags = ENABLE_ON_INIT,
.clkdm_name = "core_l3_clkdm",
};
DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
static const struct clksel_rate gpt_alt_rates[] = { static const struct clksel_rate gpt_alt_rates[] = {
{ .div = 1, .val = 2, .flags = RATE_IN_24XX }, { .div = 1, .val = 2, .flags = RATE_IN_24XX },
{ .div = 0 } { .div = 0 }
...@@ -823,306 +651,404 @@ static const struct clksel omap24xx_gpt_clksel[] = { ...@@ -823,306 +651,404 @@ static const struct clksel omap24xx_gpt_clksel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk gpt1_ick = { static const char *gpt10_fck_parent_names[] = {
.name = "gpt1_ick", "func_32k_ck", "sys_ck", "alt_ck",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_GPT1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk gpt1_fck = { DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.name = "gpt1_fck", OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.ops = &clkops_omap2_dflt_wait, OMAP24XX_CLKSEL_GPT10_MASK,
.parent = &func_32k_ck, OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt10_ick;
static struct clk_hw_omap gpt10_ick_hw = {
.hw = {
.clk = &gpt10_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT10_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_GPT1_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
.clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate
}; };
static struct clk gpt2_ick = { DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt2_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT11_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt11_ick;
static struct clk_hw_omap gpt11_ick_hw = {
.hw = {
.clk = &gpt11_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT2_SHIFT, .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt2_fck = { DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt2_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &func_32k_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
OMAP24XX_CLKSEL_GPT12_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt12_ick;
static struct clk_hw_omap gpt12_ick_hw = {
.hw = {
.clk = &gpt12_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT12_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT2_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt3_ick = { DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt3_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static const struct clk_ops gpt1_fck_ops = {
.parent = &l4_ck, .init = &omap2_init_clk_clkdm,
.clkdm_name = "core_l4_clkdm", .enable = &omap2_dflt_clk_enable,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .disable = &omap2_dflt_clk_disable,
.enable_bit = OMAP24XX_EN_GPT3_SHIFT, .is_enabled = &omap2_dflt_clk_is_enabled,
.recalc = &followparent_recalc, .recalc_rate = &omap2_clksel_recalc,
.set_rate = &omap2_clksel_set_rate,
.round_rate = &omap2_clksel_round_rate,
.get_parent = &omap2_clksel_find_parent_index,
.set_parent = &omap2_clksel_set_parent,
}; };
static struct clk gpt3_fck = { DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.name = "gpt3_fck", OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
.ops = &clkops_omap2_dflt_wait, OMAP24XX_CLKSEL_GPT1_MASK,
.parent = &func_32k_ck, OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.clkdm_name = "core_l4_clkdm", OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), gpt10_fck_parent_names, gpt1_fck_ops);
.enable_bit = OMAP24XX_EN_GPT3_SHIFT,
.init = &omap2_init_clksel_parent, static struct clk gpt1_ick;
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK, static struct clk_hw_omap gpt1_ick_hw = {
.clksel = omap24xx_gpt_clksel, .hw = {
.recalc = &omap2_clksel_recalc, .clk = &gpt1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_GPT1_SHIFT,
.clkdm_name = "wkup_clkdm",
}; };
static struct clk gpt4_ick = { DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "gpt4_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT2_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt2_ick;
static struct clk_hw_omap gpt2_ick_hw = {
.hw = {
.clk = &gpt2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT4_SHIFT, .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt4_fck = { DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt4_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &func_32k_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
OMAP24XX_CLKSEL_GPT3_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt3_ick;
static struct clk_hw_omap gpt3_ick_hw = {
.hw = {
.clk = &gpt3_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT4_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt5_ick = { DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt5_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT4_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt4_ick;
static struct clk_hw_omap gpt4_ick_hw = {
.hw = {
.clk = &gpt4_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT5_SHIFT, .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt5_fck = { DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt5_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &func_32k_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT5_MASK,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt5_ick;
static struct clk_hw_omap gpt5_ick_hw = {
.hw = {
.clk = &gpt5_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT5_SHIFT, .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
.init = &omap2_init_clksel_parent, .clkdm_name = "core_l4_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt6_ick = { DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt6_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT6_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt6_ick;
static struct clk_hw_omap gpt6_ick_hw = {
.hw = {
.clk = &gpt6_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT6_SHIFT, .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk gpt6_fck = {
.name = "gpt6_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT6_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt7_ick = { DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt7_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT7_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt7_ick;
static struct clk_hw_omap gpt7_ick_hw = {
.hw = {
.clk = &gpt7_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT7_SHIFT, .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk gpt7_fck = {
.name = "gpt7_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT7_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt8_ick = { DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt8_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk gpt8_fck;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
OMAP24XX_CLKSEL_GPT8_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt8_ick;
static struct clk_hw_omap gpt8_ick_hw = {
.hw = {
.clk = &gpt8_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT8_SHIFT, .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk gpt8_fck = {
.name = "gpt8_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT8_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt9_ick = { DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt9_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_CLKSEL_GPT9_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
gpt10_fck_parent_names, dss1_fck_ops);
static struct clk gpt9_ick;
static struct clk_hw_omap gpt9_ick_hw = {
.hw = {
.clk = &gpt9_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT9_SHIFT, .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt9_fck = { DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt9_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk hdq_fck;
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap hdq_fck_hw = {
.hw = {
.clk = &hdq_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT9_SHIFT, .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
.init = &omap2_init_clksel_parent, .clkdm_name = "core_l4_clkdm",
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt10_ick = { DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
.name = "gpt10_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk hdq_ick;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap hdq_ick_hw = {
.hw = {
.clk = &hdq_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT10_SHIFT, .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt10_fck = { DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt10_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk i2c1_ick;
.parent = &func_32k_ck,
static struct clk_hw_omap i2c1_ick_hw = {
.hw = {
.clk = &i2c1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_I2C1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT10_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt11_ick = { DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt11_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk i2c2_ick;
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap i2c2_ick_hw = {
.hw = {
.clk = &i2c2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT11_SHIFT, .enable_bit = OMAP2420_EN_I2C2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk gpt11_fck = { DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpt11_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk i2chs1_fck;
.parent = &func_32k_ck,
static struct clk_hw_omap i2chs1_fck_hw = {
.hw = {
.clk = &i2chs1_fck,
},
.ops = &clkhwops_omap2430_i2chs_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_GPT11_SHIFT,
.init = &omap2_init_clksel_parent,
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
.clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK,
.clksel = omap24xx_gpt_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpt12_ick = { DEFINE_STRUCT_CLK(i2chs1_fck, cam_fck_parent_names, aes_ick_ops);
.name = "gpt12_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk i2chs2_fck;
.parent = &l4_ck,
static struct clk_hw_omap i2chs2_fck_hw = {
.hw = {
.clk = &i2chs2_fck,
},
.ops = &clkhwops_omap2430_i2chs_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_GPT12_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk gpt12_fck = { DEFINE_STRUCT_CLK(i2chs2_fck, cam_fck_parent_names, aes_ick_ops);
.name = "gpt12_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk icr_ick;
.parent = &secure_32k_ck,
.clkdm_name = "core_l4_clkdm", static struct clk_hw_omap icr_ick_hw = {
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), .hw = {
.enable_bit = OMAP24XX_EN_GPT12_SHIFT, .clk = &icr_ick,
.init = &omap2_init_clksel_parent, },
.clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2), .ops = &clkhwops_iclk_wait,
.clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK, .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.clksel = omap24xx_gpt_clksel, .enable_bit = OMAP2430_EN_ICR_SHIFT,
.recalc = &omap2_clksel_recalc, .clkdm_name = "wkup_clkdm",
}; };
static struct clk mcbsp1_ick = { DEFINE_STRUCT_CLK(icr_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "mcbsp1_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static const struct clksel dsp_ick_clksel[] = {
.parent = &l4_ck, { .parent = &dsp_fck, .rates = dsp_ick_rates },
.clkdm_name = "core_l4_clkdm", { .parent = NULL },
};
static const char *iva2_1_ick_parent_names[] = {
"dsp_fck",
};
DEFINE_CLK_OMAP_MUX_GATE(iva2_1_ick, "dsp_clkdm", dsp_ick_clksel,
OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
OMAP24XX_CLKSEL_DSP_IF_MASK,
OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
iva2_1_ick_parent_names, dsp_fck_ops);
static struct clk mailboxes_ick;
static struct clk_hw_omap mailboxes_ick_hw = {
.hw = {
.clk = &mailboxes_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP1_SHIFT, .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
static const struct clksel_rate common_mcbsp_96m_rates[] = { static const struct clksel_rate common_mcbsp_96m_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_24XX }, { .div = 1, .val = 0, .flags = RATE_IN_24XX },
{ .div = 0 } { .div = 0 }
...@@ -1136,715 +1062,789 @@ static const struct clksel_rate common_mcbsp_mcbsp_rates[] = { ...@@ -1136,715 +1062,789 @@ static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
static const struct clksel mcbsp_fck_clksel[] = { static const struct clksel mcbsp_fck_clksel[] = {
{ .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates }, { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
{ .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates }, { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
{ .parent = NULL } { .parent = NULL },
}; };
static struct clk mcbsp1_fck = { static const char *mcbsp1_fck_parent_names[] = {
.name = "mcbsp1_fck", "func_96m_ck", "mcbsp_clks",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
.init = &omap2_init_clksel_parent,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
.clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
.clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
.clksel = mcbsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk mcbsp2_ick = { DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
.name = "mcbsp2_ick", OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
.ops = &clkops_omap2_iclk_dflt_wait, OMAP2_MCBSP1_CLKS_MASK,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
mcbsp1_fck_parent_names, dss1_fck_ops);
static struct clk mcbsp1_ick;
static struct clk_hw_omap mcbsp1_ick_hw = {
.hw = {
.clk = &mcbsp1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
OMAP2_MCBSP2_CLKS_MASK,
OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
mcbsp1_fck_parent_names, dss1_fck_ops);
static struct clk mcbsp2_ick;
static struct clk_hw_omap mcbsp2_ick_hw = {
.hw = {
.clk = &mcbsp2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP2_SHIFT, .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk mcbsp2_fck = { DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcbsp2_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "core_l4_clkdm", mcbsp_fck_clksel,
.parent = &func_96m_ck, OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
.init = &omap2_init_clksel_parent, OMAP2_MCBSP3_CLKS_MASK,
OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
OMAP2430_EN_MCBSP3_SHIFT, &clkhwops_wait,
mcbsp1_fck_parent_names, dss1_fck_ops);
static struct clk mcbsp3_ick;
static struct clk_hw_omap mcbsp3_ick_hw = {
.hw = {
.clk = &mcbsp3_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
.clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
.clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
.clksel = mcbsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk mcbsp3_ick = { DEFINE_STRUCT_CLK(mcbsp3_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcbsp3_ick",
.ops = &clkops_omap2_iclk_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "core_l4_clkdm", mcbsp_fck_clksel,
.parent = &l4_ck, OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
.clkdm_name = "core_l4_clkdm", OMAP2_MCBSP4_CLKS_MASK,
OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
OMAP2430_EN_MCBSP4_SHIFT, &clkhwops_wait,
mcbsp1_fck_parent_names, dss1_fck_ops);
static struct clk mcbsp4_ick;
static struct clk_hw_omap mcbsp4_ick_hw = {
.hw = {
.clk = &mcbsp4_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MCBSP3_SHIFT, .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk mcbsp3_fck = { DEFINE_STRUCT_CLK(mcbsp4_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcbsp3_fck",
.ops = &clkops_omap2_dflt_wait, DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_fck_clksel,
.parent = &func_96m_ck, OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
.init = &omap2_init_clksel_parent, OMAP2_MCBSP5_CLKS_MASK,
OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
OMAP2430_EN_MCBSP5_SHIFT, &clkhwops_wait,
mcbsp1_fck_parent_names, dss1_fck_ops);
static struct clk mcbsp5_ick;
static struct clk_hw_omap mcbsp5_ick_hw = {
.hw = {
.clk = &mcbsp5_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
.clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
.clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
.clksel = mcbsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk mcbsp4_ick = { DEFINE_STRUCT_CLK(mcbsp5_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcbsp4_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mcspi1_fck;
.parent = &l4_ck,
static const char *mcspi1_fck_parent_names[] = {
"func_48m_ck",
};
static struct clk_hw_omap mcspi1_fck_hw = {
.hw = {
.clk = &mcspi1_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mcbsp4_fck = { DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "mcbsp4_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk mcspi1_ick;
.parent = &func_96m_ck,
.init = &omap2_init_clksel_parent, static struct clk_hw_omap mcspi1_ick_hw = {
.hw = {
.clk = &mcspi1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
.clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
.clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
.clksel = mcbsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk mcbsp5_ick = { DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcbsp5_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mcspi2_fck;
.parent = &l4_ck,
static struct clk_hw_omap mcspi2_fck_hw = {
.hw = {
.clk = &mcspi2_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mcbsp5_fck = { DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "mcbsp5_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk mcspi2_ick;
.parent = &func_96m_ck,
.init = &omap2_init_clksel_parent, static struct clk_hw_omap mcspi2_ick_hw = {
.hw = {
.clk = &mcspi2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
static struct clk mcspi3_fck;
static struct clk_hw_omap mcspi3_fck_hw = {
.hw = {
.clk = &mcspi3_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MCBSP5_SHIFT, .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
.clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1), .clkdm_name = "core_l4_clkdm",
.clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
.clksel = mcbsp_fck_clksel,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk mcspi1_ick = { DEFINE_STRUCT_CLK(mcspi3_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "mcspi1_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mcspi3_ick;
.parent = &l4_ck,
static struct clk_hw_omap mcspi3_ick_hw = {
.hw = {
.clk = &mcspi3_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mcspi1_fck = { DEFINE_STRUCT_CLK(mcspi3_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcspi1_fck",
.ops = &clkops_omap2_dflt_wait, static const struct clksel_rate mdm_ick_core_rates[] = {
.parent = &func_48m_ck, { .div = 1, .val = 1, .flags = RATE_IN_243X },
{ .div = 4, .val = 4, .flags = RATE_IN_243X },
{ .div = 6, .val = 6, .flags = RATE_IN_243X },
{ .div = 9, .val = 9, .flags = RATE_IN_243X },
{ .div = 0 }
};
static const struct clksel mdm_ick_clksel[] = {
{ .parent = &core_ck, .rates = mdm_ick_core_rates },
{ .parent = NULL },
};
static const char *mdm_ick_parent_names[] = {
"core_ck",
};
DEFINE_CLK_OMAP_MUX_GATE(mdm_ick, "mdm_clkdm", mdm_ick_clksel,
OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
OMAP2430_CLKSEL_MDM_MASK,
OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
&clkhwops_iclk_wait, mdm_ick_parent_names,
dsp_fck_ops);
static struct clk mdm_intc_ick;
static struct clk_hw_omap mdm_intc_ick_hw = {
.hw = {
.clk = &mdm_intc_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mcspi2_ick = { DEFINE_STRUCT_CLK(mdm_intc_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcspi2_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mdm_osc_ck;
.parent = &l4_ck,
static struct clk_hw_omap mdm_osc_ck_hw = {
.hw = {
.clk = &mdm_osc_ck,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
.enable_bit = OMAP2430_EN_OSC_SHIFT,
.clkdm_name = "mdm_clkdm",
};
DEFINE_STRUCT_CLK(mdm_osc_ck, sys_ck_parent_names, aes_ick_ops);
static struct clk mmchs1_fck;
static struct clk_hw_omap mmchs1_fck_hw = {
.hw = {
.clk = &mmchs1_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mcspi2_fck = { DEFINE_STRUCT_CLK(mmchs1_fck, cam_fck_parent_names, aes_ick_ops);
.name = "mcspi2_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk mmchs1_ick;
.parent = &func_48m_ck,
static struct clk_hw_omap mmchs1_ick_hw = {
.hw = {
.clk = &mmchs1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mcspi3_ick = { DEFINE_STRUCT_CLK(mmchs1_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcspi3_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mmchs2_fck;
.parent = &l4_ck,
static struct clk_hw_omap mmchs2_fck_hw = {
.hw = {
.clk = &mmchs2_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(mmchs2_fck, cam_fck_parent_names, aes_ick_ops);
static struct clk mmchs2_ick;
static struct clk_hw_omap mmchs2_ick_hw = {
.hw = {
.clk = &mmchs2_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MCSPI3_SHIFT, .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
}; };
static struct clk mcspi3_fck = { DEFINE_STRUCT_CLK(mmchs2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "mcspi3_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk mmchsdb1_fck;
.parent = &func_48m_ck,
static struct clk_hw_omap mmchsdb1_fck_hw = {
.hw = {
.clk = &mmchsdb1_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(mmchsdb1_fck, gpio5_fck_parent_names, aes_ick_ops);
static struct clk mmchsdb2_fck;
static struct clk_hw_omap mmchsdb2_fck_hw = {
.hw = {
.clk = &mmchsdb2_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MCSPI3_SHIFT, .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l4_clkdm",
};
DEFINE_STRUCT_CLK(mmchsdb2_fck, gpio5_fck_parent_names, aes_ick_ops);
DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
CLK_DIVIDER_ONE_BASED, NULL);
static struct clk mpu_wdt_fck;
static struct clk_hw_omap mpu_wdt_fck_hw = {
.hw = {
.clk = &mpu_wdt_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
.clkdm_name = "wkup_clkdm",
};
DEFINE_STRUCT_CLK(mpu_wdt_fck, gpio5_fck_parent_names, aes_ick_ops);
static struct clk mpu_wdt_ick;
static struct clk_hw_omap mpu_wdt_ick_hw = {
.hw = {
.clk = &mpu_wdt_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
.clkdm_name = "wkup_clkdm",
}; };
static struct clk uart1_ick = { DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "uart1_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk mspro_fck;
.parent = &l4_ck,
static struct clk_hw_omap mspro_fck_hw = {
.hw = {
.clk = &mspro_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_UART1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk uart1_fck = { DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
.name = "uart1_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk mspro_ick;
.parent = &func_48m_ck,
static struct clk_hw_omap mspro_ick_hw = {
.hw = {
.clk = &mspro_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_UART1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk uart2_ick = { DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
.name = "uart2_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk omapctrl_ick;
.parent = &l4_ck,
static struct clk_hw_omap omapctrl_ick_hw = {
.hw = {
.clk = &omapctrl_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
.flags = ENABLE_ON_INIT,
.clkdm_name = "wkup_clkdm",
};
DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
static struct clk pka_ick;
static struct clk_hw_omap pka_ick_hw = {
.hw = {
.clk = &pka_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_PKA_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_UART2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk uart2_fck = { DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
.name = "uart2_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk rng_ick;
.parent = &func_48m_ck,
static struct clk_hw_omap rng_ick_hw = {
.hw = {
.clk = &rng_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_RNG_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_UART2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk uart3_ick = { DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
.name = "uart3_ick",
.ops = &clkops_omap2_iclk_dflt_wait, static struct clk sdma_fck;
.parent = &l4_ck,
DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
static struct clk sdma_ick;
static struct clk_hw_omap sdma_ick_hw = {
.hw = {
.clk = &sdma_ick,
},
.ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
.clkdm_name = "core_l3_clkdm",
};
DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
static struct clk sdrc_ick;
static struct clk_hw_omap sdrc_ick_hw = {
.hw = {
.clk = &sdrc_ick,
},
.ops = &clkhwops_iclk,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP2430_EN_SDRC_SHIFT,
.flags = ENABLE_ON_INIT,
.clkdm_name = "core_l3_clkdm",
};
DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
static struct clk sha_ick;
static struct clk_hw_omap sha_ick_hw = {
.hw = {
.clk = &sha_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_SHA_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_UART3_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk uart3_fck = { DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
.name = "uart3_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk ssi_l4_ick;
.parent = &func_48m_ck,
static struct clk_hw_omap ssi_l4_ick_hw = {
.hw = {
.clk = &ssi_l4_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_SSI_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_UART3_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk gpios_ick = { DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
.name = "gpios_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk gpios_fck = { static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
.name = "gpios_fck", { .div = 1, .val = 1, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_dflt_wait, { .div = 2, .val = 2, .flags = RATE_IN_24XX },
.parent = &func_32k_ck, { .div = 3, .val = 3, .flags = RATE_IN_24XX },
.clkdm_name = "wkup_clkdm", { .div = 4, .val = 4, .flags = RATE_IN_24XX },
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN), { .div = 5, .val = 5, .flags = RATE_IN_243X },
.enable_bit = OMAP24XX_EN_GPIOS_SHIFT, { .div = 0 }
.recalc = &followparent_recalc,
}; };
static struct clk mpu_wdt_ick = { static const struct clksel ssi_ssr_sst_fck_clksel[] = {
.name = "mpu_wdt_ick", { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
.ops = &clkops_omap2_iclk_dflt_wait, { .parent = NULL },
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mpu_wdt_fck = { static const char *ssi_ssr_sst_fck_parent_names[] = {
.name = "mpu_wdt_fck", "core_ck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
.enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk sync_32k_ick = { DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
.name = "sync_32k_ick", ssi_ssr_sst_fck_clksel,
.ops = &clkops_omap2_iclk_dflt_wait, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.flags = ENABLE_ON_INIT, OMAP24XX_CLKSEL_SSI_MASK,
.parent = &wu_l4_ick, OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.clkdm_name = "wkup_clkdm", OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN), ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
.enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk wdt1_ick = { static struct clk sync_32k_ick;
.name = "wdt1_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_WDT1_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk omapctrl_ick = { static struct clk_hw_omap sync_32k_ick_hw = {
.name = "omapctrl_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt_wait, .clk = &sync_32k_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
.flags = ENABLE_ON_INIT, .flags = ENABLE_ON_INIT,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm", .clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk icr_ick = { DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "icr_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &wu_l4_ick,
.clkdm_name = "wkup_clkdm",
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP2430_EN_ICR_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk cam_ick = { static const struct clksel_rate common_clkout_src_core_rates[] = {
.name = "cam_ick", { .div = 1, .val = 0, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_iclk_dflt, { .div = 0 }
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_CAM_SHIFT,
.recalc = &followparent_recalc,
}; };
/* static const struct clksel_rate common_clkout_src_sys_rates[] = {
* cam_fck controls both CAM_MCLK and CAM_FCLK. It should probably be { .div = 1, .val = 1, .flags = RATE_IN_24XX },
* split into two separate clocks, since the parent clocks are different { .div = 0 }
* and the clockdomains are also different.
*/
static struct clk cam_fck = {
.name = "cam_fck",
.ops = &clkops_omap2_dflt,
.parent = &func_96m_ck,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_CAM_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mailboxes_ick = { static const struct clksel_rate common_clkout_src_96m_rates[] = {
.name = "mailboxes_ick", { .div = 1, .val = 2, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_iclk_dflt_wait, { .div = 0 }
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk wdt4_ick = { static const struct clksel_rate common_clkout_src_54m_rates[] = {
.name = "wdt4_ick", { .div = 1, .val = 3, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_iclk_dflt_wait, { .div = 0 }
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_WDT4_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk wdt4_fck = { static const struct clksel common_clkout_src_clksel[] = {
.name = "wdt4_fck", { .parent = &core_ck, .rates = common_clkout_src_core_rates },
.ops = &clkops_omap2_dflt_wait, { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
.parent = &func_32k_ck, { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
.clkdm_name = "core_l4_clkdm", { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1), { .parent = NULL },
.enable_bit = OMAP24XX_EN_WDT4_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mspro_ick = { static const char *sys_clkout_src_parent_names[] = {
.name = "mspro_ick", "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mspro_fck = { DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
.name = "mspro_fck", OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
.ops = &clkops_omap2_dflt_wait, OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
.parent = &func_96m_ck, NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk fac_ick = { DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
.name = "fac_ick", OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
.ops = &clkops_omap2_iclk_dflt_wait, OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_FAC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk fac_fck = { static struct clk uart1_fck;
.name = "fac_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_12m_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_FAC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk hdq_ick = { static struct clk_hw_omap uart1_fck_hw = {
.name = "hdq_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt_wait, .clk = &uart1_fck,
.parent = &l4_ck, },
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_UART1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_HDQ_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk hdq_fck = { DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "hdq_fck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_12m_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_HDQ_SHIFT,
.recalc = &followparent_recalc,
};
/* static struct clk uart1_ick;
* XXX This is marked as a 2420-only define, but it claims to be present
* on 2430 also. Double-check.
*/
static struct clk i2c2_ick = {
.name = "i2c2_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_I2C2_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk i2chs2_fck = { static struct clk_hw_omap uart1_ick_hw = {
.name = "i2chs2_fck", .hw = {
.ops = &clkops_omap2430_i2chs_wait, .clk = &uart1_ick,
.parent = &func_96m_ck, },
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP24XX_EN_UART1_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
.recalc = &followparent_recalc,
}; };
/* DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
* XXX This is marked as a 2420-only define, but it claims to be present
* on 2430 also. Double-check. static struct clk uart2_fck;
*/
static struct clk i2c1_ick = {
.name = "i2c1_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.enable_bit = OMAP2420_EN_I2C1_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk i2chs1_fck = { static struct clk_hw_omap uart2_fck_hw = {
.name = "i2chs1_fck", .hw = {
.ops = &clkops_omap2430_i2chs_wait, .clk = &uart2_fck,
.parent = &func_96m_ck, },
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_UART2_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
.recalc = &followparent_recalc,
}; };
/* DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
* The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
* accesses derived from this data.
*/
static struct clk gpmc_fck = {
.name = "gpmc_fck",
.ops = &clkops_omap2_iclk_idle_only,
.parent = &core_l3_ck,
.flags = ENABLE_ON_INIT,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk sdma_fck = { static struct clk uart2_ick;
.name = "sdma_fck",
.ops = &clkops_null, /* RMK: missing? */
.parent = &core_l3_ck,
.clkdm_name = "core_l3_clkdm",
.recalc = &followparent_recalc,
};
/* static struct clk_hw_omap uart2_ick_hw = {
* The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE .hw = {
* accesses derived from this data. .clk = &uart2_ick,
*/ },
static struct clk sdma_ick = { .ops = &clkhwops_iclk_wait,
.name = "sdma_ick", .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
.ops = &clkops_omap2_iclk_idle_only, .enable_bit = OMAP24XX_EN_UART2_SHIFT,
.parent = &core_l3_ck, .clkdm_name = "core_l4_clkdm",
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk sdrc_ick = { DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
.name = "sdrc_ick",
.ops = &clkops_omap2_iclk_idle_only,
.parent = &core_l3_ck,
.flags = ENABLE_ON_INIT,
.clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
.enable_bit = OMAP2430_EN_SDRC_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk des_ick = { static struct clk uart3_fck;
.name = "des_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_DES_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk sha_ick = { static struct clk_hw_omap uart3_fck_hw = {
.name = "sha_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt_wait, .clk = &uart3_fck,
.parent = &l4_ck, },
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_UART3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_SHA_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk rng_ick = { DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "rng_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_RNG_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk aes_ick = { static struct clk uart3_ick;
.name = "aes_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_AES_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk pka_ick = { static struct clk_hw_omap uart3_ick_hw = {
.name = "pka_ick", .hw = {
.ops = &clkops_omap2_iclk_dflt_wait, .clk = &uart3_ick,
.parent = &l4_ck, },
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP24XX_EN_UART3_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
.enable_bit = OMAP24XX_EN_PKA_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk usb_fck = { DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
.name = "usb_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk usb_fck;
.parent = &func_48m_ck,
.clkdm_name = "core_l3_clkdm", static struct clk_hw_omap usb_fck_hw = {
.hw = {
.clk = &usb_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP24XX_EN_USB_SHIFT, .enable_bit = OMAP24XX_EN_USB_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk usbhs_ick = {
.name = "usbhs_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &core_l3_ck,
.clkdm_name = "core_l3_clkdm", .clkdm_name = "core_l3_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_USBHS_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mmchs1_ick = { DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
.name = "mmchs1_ick",
.ops = &clkops_omap2_iclk_dflt_wait,
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
.recalc = &followparent_recalc,
};
static struct clk mmchs1_fck = { static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
.name = "mmchs1_fck", { .div = 1, .val = 1, .flags = RATE_IN_24XX },
.ops = &clkops_omap2_dflt_wait, { .div = 2, .val = 2, .flags = RATE_IN_24XX },
.parent = &func_96m_ck, { .div = 4, .val = 4, .flags = RATE_IN_24XX },
.clkdm_name = "core_l4_clkdm", { .div = 0 }
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mmchs2_ick = { static const struct clksel usb_l4_ick_clksel[] = {
.name = "mmchs2_ick", { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
.ops = &clkops_omap2_iclk_dflt_wait, { .parent = NULL },
.parent = &l4_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mmchs2_fck = { static const char *usb_l4_ick_parent_names[] = {
.name = "mmchs2_fck", "core_l3_ck",
.ops = &clkops_omap2_dflt_wait,
.parent = &func_96m_ck,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk gpio5_ick = { DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
.name = "gpio5_ick", OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
.ops = &clkops_omap2_iclk_dflt_wait, OMAP24XX_CLKSEL_USB_MASK,
.parent = &l4_ck, OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.clkdm_name = "core_l4_clkdm", OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
usb_l4_ick_parent_names, dsp_fck_ops);
static struct clk usbhs_ick;
static struct clk_hw_omap usbhs_ick_hw = {
.hw = {
.clk = &usbhs_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2), .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_GPIO5_SHIFT, .enable_bit = OMAP2430_EN_USBHS_SHIFT,
.recalc = &followparent_recalc, .clkdm_name = "core_l3_clkdm",
}; };
static struct clk gpio5_fck = { DEFINE_STRUCT_CLK(usbhs_ick, gfx_ick_parent_names, aes_ick_ops);
.name = "gpio5_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk virt_prcm_set;
.parent = &func_32k_ck,
.clkdm_name = "core_l4_clkdm", static const char *virt_prcm_set_parent_names[] = {
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), "mpu_ck",
.enable_bit = OMAP2430_EN_GPIO5_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mdm_intc_ick = { static const struct clk_ops virt_prcm_set_ops = {
.name = "mdm_intc_ick", .recalc_rate = &omap2_table_mpu_recalc,
.ops = &clkops_omap2_iclk_dflt_wait, .set_rate = &omap2_select_table_rate,
.parent = &l4_ck, .round_rate = &omap2_round_to_table_rate,
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
.enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
.recalc = &followparent_recalc,
}; };
static struct clk mmchsdb1_fck = { DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
.name = "mmchsdb1_fck", DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
.ops = &clkops_omap2_dflt_wait,
.parent = &func_32k_ck, static struct clk wdt1_ick;
.clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2), static struct clk_hw_omap wdt1_ick_hw = {
.enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT, .hw = {
.recalc = &followparent_recalc, .clk = &wdt1_ick,
},
.ops = &clkhwops_iclk_wait,
.enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
.enable_bit = OMAP24XX_EN_WDT1_SHIFT,
.clkdm_name = "wkup_clkdm",
}; };
static struct clk mmchsdb2_fck = { DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
.name = "mmchsdb2_fck",
.ops = &clkops_omap2_dflt_wait, static struct clk wdt1_osc_ck;
.parent = &func_32k_ck,
static const struct clk_ops wdt1_osc_ck_ops = {};
DEFINE_STRUCT_CLK_HW_OMAP(wdt1_osc_ck, NULL);
DEFINE_STRUCT_CLK(wdt1_osc_ck, sys_ck_parent_names, wdt1_osc_ck_ops);
static struct clk wdt4_fck;
static struct clk_hw_omap wdt4_fck_hw = {
.hw = {
.clk = &wdt4_fck,
},
.ops = &clkhwops_wait,
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
.enable_bit = OMAP24XX_EN_WDT4_SHIFT,
.clkdm_name = "core_l4_clkdm", .clkdm_name = "core_l4_clkdm",
.enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
.enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
.recalc = &followparent_recalc,
}; };
/* DEFINE_STRUCT_CLK(wdt4_fck, gpio5_fck_parent_names, aes_ick_ops);
* This clock is a composite clock which does entire set changes then
* forces a rebalance. It keys on the MPU speed, but it really could static struct clk wdt4_ick;
* be any key speed part of a set in the rate table.
* static struct clk_hw_omap wdt4_ick_hw = {
* to really change a set, you need memory table sets which get changed .hw = {
* in sram, pre-notifiers & post notifiers, changing the top set, without .clk = &wdt4_ick,
* having low level display recalc's won't work... this is why dpm notifiers },
* work, isr's off, walk a list of clocks already _off_ and not messing with .ops = &clkhwops_iclk_wait,
* the bus. .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
* .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
* This clock should have no parent. It embodies the entire upper level .clkdm_name = "core_l4_clkdm",
* active set. A parent will mess up some of the init also.
*/
static struct clk virt_prcm_set = {
.name = "virt_prcm_set",
.ops = &clkops_null,
.parent = &mpu_ck, /* Indexed by mpu speed, no parent */
.recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */
.set_rate = &omap2_select_table_rate,
.round_rate = &omap2_round_to_table_rate,
}; };
DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
/* /*
* clkdev integration * clkdev integration
...@@ -2018,6 +2018,15 @@ static struct omap_clk omap2430_clks[] = { ...@@ -2018,6 +2018,15 @@ static struct omap_clk omap2430_clks[] = {
CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X), CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X),
}; };
static const char *enable_init_clks[] = {
"apll96_ck",
"apll54_ck",
"sync_32k_ick",
"omapctrl_ick",
"gpmc_fck",
"sdrc_ick",
};
/* /*
* init code * init code
*/ */
...@@ -2030,42 +2039,27 @@ int __init omap2430_clk_init(void) ...@@ -2030,42 +2039,27 @@ int __init omap2430_clk_init(void)
cpu_mask = RATE_IN_243X; cpu_mask = RATE_IN_243X;
rate_table = omap2430_rate_table; rate_table = omap2430_rate_table;
for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks); omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
c++)
clk_preinit(c->lk.clk);
osc_ck.rate = omap2_osc_clk_recalc(&osc_ck); omap2xxx_clkt_vps_check_bootloader_rates();
propagate_rate(&osc_ck);
sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
propagate_rate(&sys_ck);
for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks); for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
c++) { c++) {
clkdev_add(&c->lk); clkdev_add(&c->lk);
clk_register(c->lk.clk); if (!__clk_init(NULL, c->lk.clk))
omap2_init_clk_clkdm(c->lk.clk); omap2_init_clk_hw_omap_clocks(c->lk.clk);
} }
omap2xxx_clkt_vps_late_init(); omap2_clk_disable_autoidle_all();
/* Disable autoidle on all clocks; let the PM code enable it later */
omap_clk_disable_autoidle_all();
/* XXX Can this be done from the virt_prcm_set clk init function? */
omap2xxx_clkt_vps_check_bootloader_rates();
recalculate_root_clocks(); omap2_clk_enable_init_clocks(enable_init_clks,
ARRAY_SIZE(enable_init_clks));
pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n", pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
(sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10, (clk_get_rate(&sys_ck) / 1000000),
(dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ; (clk_get_rate(&sys_ck) / 100000) % 10,
(clk_get_rate(&dpll_ck) / 1000000),
/* (clk_get_rate(&mpu_ck) / 1000000));
* Only enable those clocks we will need, let the drivers
* enable other clocks as necessary
*/
clk_enable_init_clocks();
return 0; return 0;
} }
...@@ -16,83 +16,48 @@ ...@@ -16,83 +16,48 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/clk.h> #include <linux/clk-private.h>
#include <linux/clkdev.h>
#include <linux/io.h>
#include "am33xx.h"
#include "soc.h" #include "soc.h"
#include "iomap.h" #include "iomap.h"
#include "control.h"
#include "clock.h" #include "clock.h"
#include "control.h"
#include "cm.h" #include "cm.h"
#include "cm33xx.h" #include "cm33xx.h"
#include "cm-regbits-33xx.h" #include "cm-regbits-33xx.h"
#include "prm.h" #include "prm.h"
/* Maximum DPLL multiplier, divider values for AM33XX */
#define AM33XX_MAX_DPLL_MULT 2047
#define AM33XX_MAX_DPLL_DIV 128
/* Modulemode control */ /* Modulemode control */
#define AM33XX_MODULEMODE_HWCTRL 0 #define AM33XX_MODULEMODE_HWCTRL_SHIFT 0
#define AM33XX_MODULEMODE_SWCTRL 1 #define AM33XX_MODULEMODE_SWCTRL_SHIFT 1
/* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always /*LIST_HEAD(clocks);*/
* physically present, in such a case HWMOD enabling of
* clock would be failure with default parent. And timer
* probe thinks clock is already enabled, this leads to
* crash upon accessing timer 3 & 6 registers in probe.
* Fix by setting parent of both these timers to master
* oscillator clock.
*/
static inline void am33xx_init_timer_parent(struct clk *clk)
{
omap2_clksel_set_parent(clk, clk->parent);
}
/* Root clocks */ /* Root clocks */
/* RTC 32k */ /* RTC 32k */
static struct clk clk_32768_ck = { DEFINE_CLK_FIXED_RATE(clk_32768_ck, CLK_IS_ROOT, 32768, 0x0);
.name = "clk_32768_ck",
.clkdm_name = "l4_rtc_clkdm",
.rate = 32768,
.ops = &clkops_null,
};
/* On-Chip 32KHz RC OSC */ /* On-Chip 32KHz RC OSC */
static struct clk clk_rc32k_ck = { DEFINE_CLK_FIXED_RATE(clk_rc32k_ck, CLK_IS_ROOT, 32000, 0x0);
.name = "clk_rc32k_ck",
.rate = 32000,
.ops = &clkops_null,
};
/* Crystal input clks */ /* Crystal input clks */
static struct clk virt_24000000_ck = { DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
.name = "virt_24000000_ck",
.rate = 24000000,
.ops = &clkops_null,
};
static struct clk virt_25000000_ck = { DEFINE_CLK_FIXED_RATE(virt_24000000_ck, CLK_IS_ROOT, 24000000, 0x0);
.name = "virt_25000000_ck",
.rate = 25000000, DEFINE_CLK_FIXED_RATE(virt_25000000_ck, CLK_IS_ROOT, 25000000, 0x0);
.ops = &clkops_null,
}; DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
/* Oscillator clock */ /* Oscillator clock */
/* 19.2, 24, 25 or 26 MHz */ /* 19.2, 24, 25 or 26 MHz */
static const struct clksel sys_clkin_sel[] = { static const char *sys_clkin_ck_parents[] = {
{ .parent = &virt_19200000_ck, .rates = div_1_0_rates }, "virt_19200000_ck", "virt_24000000_ck", "virt_25000000_ck",
{ .parent = &virt_24000000_ck, .rates = div_1_1_rates }, "virt_26000000_ck",
{ .parent = &virt_25000000_ck, .rates = div_1_2_rates },
{ .parent = &virt_26000000_ck, .rates = div_1_3_rates },
{ .parent = NULL },
};
/* External clock - 12 MHz */
static struct clk tclkin_ck = {
.name = "tclkin_ck",
.rate = 12000000,
.ops = &clkops_null,
}; };
/* /*
...@@ -100,16 +65,16 @@ static struct clk tclkin_ck = { ...@@ -100,16 +65,16 @@ static struct clk tclkin_ck = {
* adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse * adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse
* *
*/ */
static struct clk sys_clkin_ck = { DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
.name = "sys_clkin_ck", AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS),
.parent = &virt_24000000_ck, AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT,
.init = &omap2_init_clksel_parent, AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH,
.clksel_reg = AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS), 0, NULL);
.clksel_mask = AM33XX_CONTROL_STATUS_SYSBOOT1_MASK,
.clksel = sys_clkin_sel, /* External clock - 12 MHz */
.ops = &clkops_null, DEFINE_CLK_FIXED_RATE(tclkin_ck, CLK_IS_ROOT, 12000000, 0x0);
.recalc = &omap2_clksel_recalc,
}; /* Module clocks and DPLL outputs */
/* DPLL_CORE */ /* DPLL_CORE */
static struct dpll_data dpll_core_dd = { static struct dpll_data dpll_core_dd = {
...@@ -123,84 +88,71 @@ static struct dpll_data dpll_core_dd = { ...@@ -123,84 +88,71 @@ static struct dpll_data dpll_core_dd = {
.div1_mask = AM33XX_DPLL_DIV_MASK, .div1_mask = AM33XX_DPLL_DIV_MASK,
.enable_mask = AM33XX_DPLL_EN_MASK, .enable_mask = AM33XX_DPLL_EN_MASK,
.idlest_mask = AM33XX_ST_DPLL_CLK_MASK, .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
.max_multiplier = AM33XX_MAX_DPLL_MULT, .max_multiplier = 2047,
.max_divider = AM33XX_MAX_DPLL_DIV, .max_divider = 128,
.min_divider = 1, .min_divider = 1,
}; };
/* CLKDCOLDO output */ /* CLKDCOLDO output */
static struct clk dpll_core_ck = { static const char *dpll_core_ck_parents[] = {
.name = "dpll_core_ck", "sys_clkin_ck",
.parent = &sys_clkin_ck,
.dpll_data = &dpll_core_dd,
.init = &omap2_init_dpll_parent,
.ops = &clkops_omap3_core_dpll_ops,
.recalc = &omap3_dpll_recalc,
};
static struct clk dpll_core_x2_ck = {
.name = "dpll_core_x2_ck",
.parent = &dpll_core_ck,
.flags = CLOCK_CLKOUTX2,
.ops = &clkops_null,
.recalc = &omap3_clkoutx2_recalc,
}; };
static struct clk dpll_core_ck;
static const struct clksel dpll_core_m4_div[] = { static const struct clk_ops dpll_core_ck_ops = {
{ .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates }, .recalc_rate = &omap3_dpll_recalc,
{ .parent = NULL }, .get_parent = &omap2_init_dpll_parent,
}; };
static struct clk dpll_core_m4_ck = { static struct clk_hw_omap dpll_core_ck_hw = {
.name = "dpll_core_m4_ck", .hw = {
.parent = &dpll_core_x2_ck, .clk = &dpll_core_ck,
.init = &omap2_init_clksel_parent, },
.clksel = dpll_core_m4_div, .dpll_data = &dpll_core_dd,
.clksel_reg = AM33XX_CM_DIV_M4_DPLL_CORE, .ops = &clkhwops_omap3_dpll,
.clksel_mask = AM33XX_HSDIVIDER_CLKOUT1_DIV_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
}; };
static const struct clksel dpll_core_m5_div[] = { DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
{ .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
{ .parent = NULL },
};
static struct clk dpll_core_m5_ck = { static const char *dpll_core_x2_ck_parents[] = {
.name = "dpll_core_m5_ck", "dpll_core_ck",
.parent = &dpll_core_x2_ck,
.init = &omap2_init_clksel_parent,
.clksel = dpll_core_m5_div,
.clksel_reg = AM33XX_CM_DIV_M5_DPLL_CORE,
.clksel_mask = AM33XX_HSDIVIDER_CLKOUT2_DIV_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
}; };
static const struct clksel dpll_core_m6_div[] = { static struct clk dpll_core_x2_ck;
{ .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
{ .parent = NULL }, static const struct clk_ops dpll_x2_ck_ops = {
.recalc_rate = &omap3_clkoutx2_recalc,
}; };
static struct clk dpll_core_m6_ck = { static struct clk_hw_omap dpll_core_x2_ck_hw = {
.name = "dpll_core_m6_ck", .hw = {
.parent = &dpll_core_x2_ck, .clk = &dpll_core_x2_ck,
.init = &omap2_init_clksel_parent, },
.clksel = dpll_core_m6_div, .flags = CLOCK_CLKOUTX2,
.clksel_reg = AM33XX_CM_DIV_M6_DPLL_CORE,
.clksel_mask = AM33XX_HSDIVIDER_CLKOUT3_DIV_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
}; };
DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_x2_ck_ops);
DEFINE_CLK_DIVIDER(dpll_core_m4_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
0x0, AM33XX_CM_DIV_M4_DPLL_CORE,
AM33XX_HSDIVIDER_CLKOUT1_DIV_SHIFT,
AM33XX_HSDIVIDER_CLKOUT1_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
NULL);
DEFINE_CLK_DIVIDER(dpll_core_m5_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
0x0, AM33XX_CM_DIV_M5_DPLL_CORE,
AM33XX_HSDIVIDER_CLKOUT2_DIV_SHIFT,
AM33XX_HSDIVIDER_CLKOUT2_DIV_WIDTH,
CLK_DIVIDER_ONE_BASED, NULL);
DEFINE_CLK_DIVIDER(dpll_core_m6_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
0x0, AM33XX_CM_DIV_M6_DPLL_CORE,
AM33XX_HSDIVIDER_CLKOUT3_DIV_SHIFT,
AM33XX_HSDIVIDER_CLKOUT3_DIV_WIDTH,
CLK_DIVIDER_ONE_BASED, NULL);
/* DPLL_MPU */ /* DPLL_MPU */
static struct dpll_data dpll_mpu_dd = { static struct dpll_data dpll_mpu_dd = {
.mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU, .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU,
...@@ -213,44 +165,40 @@ static struct dpll_data dpll_mpu_dd = { ...@@ -213,44 +165,40 @@ static struct dpll_data dpll_mpu_dd = {
.div1_mask = AM33XX_DPLL_DIV_MASK, .div1_mask = AM33XX_DPLL_DIV_MASK,
.enable_mask = AM33XX_DPLL_EN_MASK, .enable_mask = AM33XX_DPLL_EN_MASK,
.idlest_mask = AM33XX_ST_DPLL_CLK_MASK, .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
.max_multiplier = AM33XX_MAX_DPLL_MULT, .max_multiplier = 2047,
.max_divider = AM33XX_MAX_DPLL_DIV, .max_divider = 128,
.min_divider = 1, .min_divider = 1,
}; };
/* CLKOUT: fdpll/M2 */ /* CLKOUT: fdpll/M2 */
static struct clk dpll_mpu_ck = { static struct clk dpll_mpu_ck;
.name = "dpll_mpu_ck",
.parent = &sys_clkin_ck, static const struct clk_ops dpll_mpu_ck_ops = {
.dpll_data = &dpll_mpu_dd, .enable = &omap3_noncore_dpll_enable,
.init = &omap2_init_dpll_parent, .disable = &omap3_noncore_dpll_disable,
.ops = &clkops_omap3_noncore_dpll_ops, .recalc_rate = &omap3_dpll_recalc,
.recalc = &omap3_dpll_recalc,
.round_rate = &omap2_dpll_round_rate, .round_rate = &omap2_dpll_round_rate,
.set_rate = &omap3_noncore_dpll_set_rate, .set_rate = &omap3_noncore_dpll_set_rate,
.get_parent = &omap2_init_dpll_parent,
};
static struct clk_hw_omap dpll_mpu_ck_hw = {
.hw = {
.clk = &dpll_mpu_ck,
},
.dpll_data = &dpll_mpu_dd,
.ops = &clkhwops_omap3_dpll,
}; };
DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_mpu_ck_ops);
/* /*
* TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
* and ALT_CLK1/2) * and ALT_CLK1/2)
*/ */
static const struct clksel dpll_mpu_m2_div[] = { DEFINE_CLK_DIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck,
{ .parent = &dpll_mpu_ck, .rates = div31_1to31_rates }, 0x0, AM33XX_CM_DIV_M2_DPLL_MPU, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
{ .parent = NULL }, AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
};
static struct clk dpll_mpu_m2_ck = {
.name = "dpll_mpu_m2_ck",
.clkdm_name = "mpu_clkdm",
.parent = &dpll_mpu_ck,
.clksel = dpll_mpu_m2_div,
.clksel_reg = AM33XX_CM_DIV_M2_DPLL_MPU,
.clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
};
/* DPLL_DDR */ /* DPLL_DDR */
static struct dpll_data dpll_ddr_dd = { static struct dpll_data dpll_ddr_dd = {
...@@ -264,51 +212,43 @@ static struct dpll_data dpll_ddr_dd = { ...@@ -264,51 +212,43 @@ static struct dpll_data dpll_ddr_dd = {
.div1_mask = AM33XX_DPLL_DIV_MASK, .div1_mask = AM33XX_DPLL_DIV_MASK,
.enable_mask = AM33XX_DPLL_EN_MASK, .enable_mask = AM33XX_DPLL_EN_MASK,
.idlest_mask = AM33XX_ST_DPLL_CLK_MASK, .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
.max_multiplier = AM33XX_MAX_DPLL_MULT, .max_multiplier = 2047,
.max_divider = AM33XX_MAX_DPLL_DIV, .max_divider = 128,
.min_divider = 1, .min_divider = 1,
}; };
/* CLKOUT: fdpll/M2 */ /* CLKOUT: fdpll/M2 */
static struct clk dpll_ddr_ck = { static struct clk dpll_ddr_ck;
.name = "dpll_ddr_ck",
.parent = &sys_clkin_ck, static const struct clk_ops dpll_ddr_ck_ops = {
.recalc_rate = &omap3_dpll_recalc,
.get_parent = &omap2_init_dpll_parent,
.round_rate = &omap2_dpll_round_rate,
.set_rate = &omap3_noncore_dpll_set_rate,
};
static struct clk_hw_omap dpll_ddr_ck_hw = {
.hw = {
.clk = &dpll_ddr_ck,
},
.dpll_data = &dpll_ddr_dd, .dpll_data = &dpll_ddr_dd,
.init = &omap2_init_dpll_parent, .ops = &clkhwops_omap3_dpll,
.ops = &clkops_null,
.recalc = &omap3_dpll_recalc,
}; };
DEFINE_STRUCT_CLK(dpll_ddr_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
/* /*
* TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
* and ALT_CLK1/2) * and ALT_CLK1/2)
*/ */
static const struct clksel dpll_ddr_m2_div[] = { DEFINE_CLK_DIVIDER(dpll_ddr_m2_ck, "dpll_ddr_ck", &dpll_ddr_ck,
{ .parent = &dpll_ddr_ck, .rates = div31_1to31_rates }, 0x0, AM33XX_CM_DIV_M2_DPLL_DDR,
{ .parent = NULL }, AM33XX_DPLL_CLKOUT_DIV_SHIFT, AM33XX_DPLL_CLKOUT_DIV_WIDTH,
}; CLK_DIVIDER_ONE_BASED, NULL);
static struct clk dpll_ddr_m2_ck = {
.name = "dpll_ddr_m2_ck",
.parent = &dpll_ddr_ck,
.clksel = dpll_ddr_m2_div,
.clksel_reg = AM33XX_CM_DIV_M2_DPLL_DDR,
.clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
};
/* emif_fck functional clock */ /* emif_fck functional clock */
static struct clk dpll_ddr_m2_div2_ck = { DEFINE_CLK_FIXED_FACTOR(dpll_ddr_m2_div2_ck, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck,
.name = "dpll_ddr_m2_div2_ck", 0x0, 1, 2);
.clkdm_name = "l3_clkdm",
.parent = &dpll_ddr_m2_ck,
.ops = &clkops_null,
.fixed_div = 2,
.recalc = &omap_fixed_divisor_recalc,
};
/* DPLL_DISP */ /* DPLL_DISP */
static struct dpll_data dpll_disp_dd = { static struct dpll_data dpll_disp_dd = {
...@@ -322,43 +262,31 @@ static struct dpll_data dpll_disp_dd = { ...@@ -322,43 +262,31 @@ static struct dpll_data dpll_disp_dd = {
.div1_mask = AM33XX_DPLL_DIV_MASK, .div1_mask = AM33XX_DPLL_DIV_MASK,
.enable_mask = AM33XX_DPLL_EN_MASK, .enable_mask = AM33XX_DPLL_EN_MASK,
.idlest_mask = AM33XX_ST_DPLL_CLK_MASK, .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
.max_multiplier = AM33XX_MAX_DPLL_MULT, .max_multiplier = 2047,
.max_divider = AM33XX_MAX_DPLL_DIV, .max_divider = 128,
.min_divider = 1, .min_divider = 1,
}; };
/* CLKOUT: fdpll/M2 */ /* CLKOUT: fdpll/M2 */
static struct clk dpll_disp_ck = { static struct clk dpll_disp_ck;
.name = "dpll_disp_ck",
.parent = &sys_clkin_ck, static struct clk_hw_omap dpll_disp_ck_hw = {
.hw = {
.clk = &dpll_disp_ck,
},
.dpll_data = &dpll_disp_dd, .dpll_data = &dpll_disp_dd,
.init = &omap2_init_dpll_parent, .ops = &clkhwops_omap3_dpll,
.ops = &clkops_null,
.recalc = &omap3_dpll_recalc,
.round_rate = &omap2_dpll_round_rate,
.set_rate = &omap3_noncore_dpll_set_rate,
}; };
DEFINE_STRUCT_CLK(dpll_disp_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
/* /*
* TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
* and ALT_CLK1/2) * and ALT_CLK1/2)
*/ */
static const struct clksel dpll_disp_m2_div[] = { DEFINE_CLK_DIVIDER(dpll_disp_m2_ck, "dpll_disp_ck", &dpll_disp_ck, 0x0,
{ .parent = &dpll_disp_ck, .rates = div31_1to31_rates }, AM33XX_CM_DIV_M2_DPLL_DISP, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
{ .parent = NULL }, AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
};
static struct clk dpll_disp_m2_ck = {
.name = "dpll_disp_m2_ck",
.parent = &dpll_disp_ck,
.clksel = dpll_disp_m2_div,
.clksel_reg = AM33XX_CM_DIV_M2_DPLL_DISP,
.clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
};
/* DPLL_PER */ /* DPLL_PER */
static struct dpll_data dpll_per_dd = { static struct dpll_data dpll_per_dd = {
...@@ -372,196 +300,117 @@ static struct dpll_data dpll_per_dd = { ...@@ -372,196 +300,117 @@ static struct dpll_data dpll_per_dd = {
.div1_mask = AM33XX_DPLL_PER_DIV_MASK, .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
.enable_mask = AM33XX_DPLL_EN_MASK, .enable_mask = AM33XX_DPLL_EN_MASK,
.idlest_mask = AM33XX_ST_DPLL_CLK_MASK, .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
.max_multiplier = AM33XX_MAX_DPLL_MULT, .max_multiplier = 2047,
.max_divider = AM33XX_MAX_DPLL_DIV, .max_divider = 128,
.min_divider = 1, .min_divider = 1,
.flags = DPLL_J_TYPE, .flags = DPLL_J_TYPE,
}; };
/* CLKDCOLDO */ /* CLKDCOLDO */
static struct clk dpll_per_ck = { static struct clk dpll_per_ck;
.name = "dpll_per_ck",
.parent = &sys_clkin_ck,
.dpll_data = &dpll_per_dd,
.init = &omap2_init_dpll_parent,
.ops = &clkops_null,
.recalc = &omap3_dpll_recalc,
.round_rate = &omap2_dpll_round_rate,
.set_rate = &omap3_noncore_dpll_set_rate,
};
/* CLKOUT: fdpll/M2 */ static struct clk_hw_omap dpll_per_ck_hw = {
static const struct clksel dpll_per_m2_div[] = { .hw = {
{ .parent = &dpll_per_ck, .rates = div31_1to31_rates }, .clk = &dpll_per_ck,
{ .parent = NULL }, },
.dpll_data = &dpll_per_dd,
.ops = &clkhwops_omap3_dpll,
}; };
static struct clk dpll_per_m2_ck = { DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
.name = "dpll_per_m2_ck",
.parent = &dpll_per_ck,
.clksel = dpll_per_m2_div,
.clksel_reg = AM33XX_CM_DIV_M2_DPLL_PER,
.clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
};
static struct clk dpll_per_m2_div4_wkupdm_ck = { /* CLKOUT: fdpll/M2 */
.name = "dpll_per_m2_div4_wkupdm_ck", DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
.clkdm_name = "l4_wkup_clkdm", AM33XX_CM_DIV_M2_DPLL_PER, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
.parent = &dpll_per_m2_ck, AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
.fixed_div = 4, NULL);
.ops = &clkops_null,
.recalc = &omap_fixed_divisor_recalc,
};
static struct clk dpll_per_m2_div4_ck = { DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_wkupdm_ck, "dpll_per_m2_ck",
.name = "dpll_per_m2_div4_ck", &dpll_per_m2_ck, 0x0, 1, 4);
.clkdm_name = "l4ls_clkdm",
.parent = &dpll_per_m2_ck,
.fixed_div = 4,
.ops = &clkops_null,
.recalc = &omap_fixed_divisor_recalc,
};
static struct clk l3_gclk = { DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_ck, "dpll_per_m2_ck",
.name = "l3_gclk", &dpll_per_m2_ck, 0x0, 1, 4);
.clkdm_name = "l3_clkdm",
.parent = &dpll_core_m4_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk dpll_core_m4_div2_ck = { DEFINE_CLK_FIXED_FACTOR(dpll_core_m4_div2_ck, "dpll_core_m4_ck",
.name = "dpll_core_m4_div2_ck", &dpll_core_m4_ck, 0x0, 1, 2);
.clkdm_name = "l4_wkup_clkdm",
.parent = &dpll_core_m4_ck,
.ops = &clkops_null,
.fixed_div = 2,
.recalc = &omap_fixed_divisor_recalc,
};
static struct clk l4_rtc_gclk = { DEFINE_CLK_FIXED_FACTOR(l4_rtc_gclk, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
.name = "l4_rtc_gclk", 1, 2);
.parent = &dpll_core_m4_ck,
.ops = &clkops_null,
.fixed_div = 2,
.recalc = &omap_fixed_divisor_recalc,
};
static struct clk clk_24mhz = { DEFINE_CLK_FIXED_FACTOR(clk_24mhz, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1,
.name = "clk_24mhz", 8);
.parent = &dpll_per_m2_ck,
.fixed_div = 8,
.ops = &clkops_null,
.recalc = &omap_fixed_divisor_recalc,
};
/* /*
* Below clock nodes describes clockdomains derived out * Below clock nodes describes clockdomains derived out
* of core clock. * of core clock.
*/ */
static struct clk l4hs_gclk = { static const struct clk_ops clk_ops_null = {
.name = "l4hs_gclk",
.clkdm_name = "l4hs_clkdm",
.parent = &dpll_core_m4_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
}; };
static struct clk l3s_gclk = { static const char *l3_gclk_parents[] = {
.name = "l3s_gclk", "dpll_core_m4_ck"
.clkdm_name = "l3s_clkdm",
.parent = &dpll_core_m4_div2_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
}; };
static struct clk l4fw_gclk = { static struct clk l3_gclk;
.name = "l4fw_gclk", DEFINE_STRUCT_CLK_HW_OMAP(l3_gclk, NULL);
.clkdm_name = "l4fw_clkdm", DEFINE_STRUCT_CLK(l3_gclk, l3_gclk_parents, clk_ops_null);
.parent = &dpll_core_m4_div2_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk l4ls_gclk = { static struct clk l4hs_gclk;
.name = "l4ls_gclk", DEFINE_STRUCT_CLK_HW_OMAP(l4hs_gclk, NULL);
.clkdm_name = "l4ls_clkdm", DEFINE_STRUCT_CLK(l4hs_gclk, l3_gclk_parents, clk_ops_null);
.parent = &dpll_core_m4_div2_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk sysclk_div_ck = { static const char *l3s_gclk_parents[] = {
.name = "sysclk_div_ck", "dpll_core_m4_div2_ck"
.parent = &dpll_core_m4_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
}; };
static struct clk l3s_gclk;
DEFINE_STRUCT_CLK_HW_OMAP(l3s_gclk, NULL);
DEFINE_STRUCT_CLK(l3s_gclk, l3s_gclk_parents, clk_ops_null);
static struct clk l4fw_gclk;
DEFINE_STRUCT_CLK_HW_OMAP(l4fw_gclk, NULL);
DEFINE_STRUCT_CLK(l4fw_gclk, l3s_gclk_parents, clk_ops_null);
static struct clk l4ls_gclk;
DEFINE_STRUCT_CLK_HW_OMAP(l4ls_gclk, NULL);
DEFINE_STRUCT_CLK(l4ls_gclk, l3s_gclk_parents, clk_ops_null);
static struct clk sysclk_div_ck;
DEFINE_STRUCT_CLK_HW_OMAP(sysclk_div_ck, NULL);
DEFINE_STRUCT_CLK(sysclk_div_ck, l3_gclk_parents, clk_ops_null);
/* /*
* In order to match the clock domain with hwmod clockdomain entry, * In order to match the clock domain with hwmod clockdomain entry,
* separate clock nodes is required for the modules which are * separate clock nodes is required for the modules which are
* directly getting their funtioncal clock from sys_clkin. * directly getting their funtioncal clock from sys_clkin.
*/ */
static struct clk adc_tsc_fck = { static struct clk adc_tsc_fck;
.name = "adc_tsc_fck", DEFINE_STRUCT_CLK_HW_OMAP(adc_tsc_fck, NULL);
.clkdm_name = "l4_wkup_clkdm", DEFINE_STRUCT_CLK(adc_tsc_fck, dpll_core_ck_parents, clk_ops_null);
.parent = &sys_clkin_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk dcan0_fck = { static struct clk dcan0_fck;
.name = "dcan0_fck", DEFINE_STRUCT_CLK_HW_OMAP(dcan0_fck, NULL);
.clkdm_name = "l4ls_clkdm", DEFINE_STRUCT_CLK(dcan0_fck, dpll_core_ck_parents, clk_ops_null);
.parent = &sys_clkin_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk dcan1_fck = { static struct clk dcan1_fck;
.name = "dcan1_fck", DEFINE_STRUCT_CLK_HW_OMAP(dcan1_fck, NULL);
.clkdm_name = "l4ls_clkdm", DEFINE_STRUCT_CLK(dcan1_fck, dpll_core_ck_parents, clk_ops_null);
.parent = &sys_clkin_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk mcasp0_fck = { static struct clk mcasp0_fck;
.name = "mcasp0_fck", DEFINE_STRUCT_CLK_HW_OMAP(mcasp0_fck, NULL);
.clkdm_name = "l3s_clkdm", DEFINE_STRUCT_CLK(mcasp0_fck, dpll_core_ck_parents, clk_ops_null);
.parent = &sys_clkin_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk mcasp1_fck = { static struct clk mcasp1_fck;
.name = "mcasp1_fck", DEFINE_STRUCT_CLK_HW_OMAP(mcasp1_fck, NULL);
.clkdm_name = "l3s_clkdm", DEFINE_STRUCT_CLK(mcasp1_fck, dpll_core_ck_parents, clk_ops_null);
.parent = &sys_clkin_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk smartreflex_mpu_fck = { static struct clk smartreflex0_fck;
.name = "smartreflex_mpu_fck", DEFINE_STRUCT_CLK_HW_OMAP(smartreflex0_fck, NULL);
.clkdm_name = "l4_wkup_clkdm", DEFINE_STRUCT_CLK(smartreflex0_fck, dpll_core_ck_parents, clk_ops_null);
.parent = &sys_clkin_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
static struct clk smartreflex_core_fck = { static struct clk smartreflex1_fck;
.name = "smartreflex_core_fck", DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL);
.clkdm_name = "l4_wkup_clkdm", DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null);
.parent = &sys_clkin_ck,
.ops = &clkops_null,
.recalc = &followparent_recalc,
};
/* /*
* Modules clock nodes * Modules clock nodes
...@@ -579,68 +428,35 @@ static struct clk smartreflex_core_fck = { ...@@ -579,68 +428,35 @@ static struct clk smartreflex_core_fck = {
* - usbotg_fck (its additional clock and not really a modulemode) * - usbotg_fck (its additional clock and not really a modulemode)
* - ieee5000 * - ieee5000
*/ */
static struct clk debugss_ick = { DEFINE_CLK_GATE(debugss_ick, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
.name = "debugss_ick", AM33XX_CM_WKUP_DEBUGSS_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
.clkdm_name = "l3_aon_clkdm", 0x0, NULL);
.parent = &dpll_core_m4_ck,
.ops = &clkops_omap2_dflt,
.enable_reg = AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
.enable_bit = AM33XX_MODULEMODE_SWCTRL,
.recalc = &followparent_recalc,
};
static struct clk mmu_fck = { DEFINE_CLK_GATE(mmu_fck, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
.name = "mmu_fck", AM33XX_CM_GFX_MMUDATA_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
.clkdm_name = "gfx_l3_clkdm", 0x0, NULL);
.parent = &dpll_core_m4_ck,
.ops = &clkops_omap2_dflt,
.enable_reg = AM33XX_CM_GFX_MMUDATA_CLKCTRL,
.enable_bit = AM33XX_MODULEMODE_SWCTRL,
.recalc = &followparent_recalc,
};
static struct clk cefuse_fck = { DEFINE_CLK_GATE(cefuse_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
.name = "cefuse_fck", AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
.clkdm_name = "l4_cefuse_clkdm", 0x0, NULL);
.parent = &sys_clkin_ck,
.enable_reg = AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL,
.enable_bit = AM33XX_MODULEMODE_SWCTRL,
.ops = &clkops_omap2_dflt,
.recalc = &followparent_recalc,
};
/* /*
* clkdiv32 is generated from fixed division of 732.4219 * clkdiv32 is generated from fixed division of 732.4219
*/ */
static struct clk clkdiv32k_ick = { DEFINE_CLK_FIXED_FACTOR(clkdiv32k_ck, "clk_24mhz", &clk_24mhz, 0x0, 1, 732);
.name = "clkdiv32k_ick",
.clkdm_name = "clk_24mhz_clkdm",
.rate = 32768,
.parent = &clk_24mhz,
.enable_reg = AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
.enable_bit = AM33XX_MODULEMODE_SWCTRL,
.ops = &clkops_omap2_dflt,
};
static struct clk usbotg_fck = { DEFINE_CLK_GATE(clkdiv32k_ick, "clkdiv32k_ck", &clkdiv32k_ck, 0x0,
.name = "usbotg_fck", AM33XX_CM_PER_CLKDIV32K_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
.clkdm_name = "l3s_clkdm", 0x0, NULL);
.parent = &dpll_per_ck,
.enable_reg = AM33XX_CM_CLKDCOLDO_DPLL_PER,
.enable_bit = AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
.ops = &clkops_omap2_dflt,
.recalc = &followparent_recalc,
};
static struct clk ieee5000_fck = { /* "usbotg_fck" is an additional clock and not really a modulemode */
.name = "ieee5000_fck", DEFINE_CLK_GATE(usbotg_fck, "dpll_per_ck", &dpll_per_ck, 0x0,
.clkdm_name = "l3s_clkdm", AM33XX_CM_CLKDCOLDO_DPLL_PER, AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
.parent = &dpll_core_m4_div2_ck, 0x0, NULL);
.enable_reg = AM33XX_CM_PER_IEEE5000_CLKCTRL,
.enable_bit = AM33XX_MODULEMODE_SWCTRL, DEFINE_CLK_GATE(ieee5000_fck, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck,
.ops = &clkops_omap2_dflt, 0x0, AM33XX_CM_PER_IEEE5000_CLKCTRL,
.recalc = &followparent_recalc, AM33XX_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
};
/* Timers */ /* Timers */
static const struct clksel timer1_clkmux_sel[] = { static const struct clksel timer1_clkmux_sel[] = {
...@@ -652,18 +468,32 @@ static const struct clksel timer1_clkmux_sel[] = { ...@@ -652,18 +468,32 @@ static const struct clksel timer1_clkmux_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk timer1_fck = { static const char *timer1_ck_parents[] = {
.name = "timer1_fck", "sys_clkin_ck", "clkdiv32k_ick", "tclkin_ck", "clk_rc32k_ck",
"clk_32768_ck",
};
static struct clk timer1_fck;
static const struct clk_ops timer1_fck_ops = {
.recalc_rate = &omap2_clksel_recalc,
.get_parent = &omap2_clksel_find_parent_index,
.set_parent = &omap2_clksel_set_parent,
.init = &omap2_init_clk_clkdm,
};
static struct clk_hw_omap timer1_fck_hw = {
.hw = {
.clk = &timer1_fck,
},
.clkdm_name = "l4ls_clkdm", .clkdm_name = "l4ls_clkdm",
.parent = &sys_clkin_ck,
.init = &omap2_init_clksel_parent,
.clksel = timer1_clkmux_sel, .clksel = timer1_clkmux_sel,
.clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK, .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
.clksel_mask = AM33XX_CLKSEL_0_2_MASK, .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
DEFINE_STRUCT_CLK(timer1_fck, timer1_ck_parents, timer1_fck_ops);
static const struct clksel timer2_to_7_clk_sel[] = { static const struct clksel timer2_to_7_clk_sel[] = {
{ .parent = &tclkin_ck, .rates = div_1_0_rates }, { .parent = &tclkin_ck, .rates = div_1_0_rates },
{ .parent = &sys_clkin_ck, .rates = div_1_1_rates }, { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
...@@ -671,85 +501,104 @@ static const struct clksel timer2_to_7_clk_sel[] = { ...@@ -671,85 +501,104 @@ static const struct clksel timer2_to_7_clk_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk timer2_fck = { static const char *timer2_to_7_ck_parents[] = {
.name = "timer2_fck", "tclkin_ck", "sys_clkin_ck", "clkdiv32k_ick",
};
static struct clk timer2_fck;
static struct clk_hw_omap timer2_fck_hw = {
.hw = {
.clk = &timer2_fck,
},
.clkdm_name = "l4ls_clkdm", .clkdm_name = "l4ls_clkdm",
.parent = &sys_clkin_ck,
.init = &omap2_init_clksel_parent,
.clksel = timer2_to_7_clk_sel, .clksel = timer2_to_7_clk_sel,
.clksel_reg = AM33XX_CLKSEL_TIMER2_CLK, .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk timer3_fck = { DEFINE_STRUCT_CLK(timer2_fck, timer2_to_7_ck_parents, timer1_fck_ops);
.name = "timer3_fck",
static struct clk timer3_fck;
static struct clk_hw_omap timer3_fck_hw = {
.hw = {
.clk = &timer3_fck,
},
.clkdm_name = "l4ls_clkdm", .clkdm_name = "l4ls_clkdm",
.parent = &sys_clkin_ck,
.init = &am33xx_init_timer_parent,
.clksel = timer2_to_7_clk_sel, .clksel = timer2_to_7_clk_sel,
.clksel_reg = AM33XX_CLKSEL_TIMER3_CLK, .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk timer4_fck = { DEFINE_STRUCT_CLK(timer3_fck, timer2_to_7_ck_parents, timer1_fck_ops);
.name = "timer4_fck",
static struct clk timer4_fck;
static struct clk_hw_omap timer4_fck_hw = {
.hw = {
.clk = &timer4_fck,
},
.clkdm_name = "l4ls_clkdm", .clkdm_name = "l4ls_clkdm",
.parent = &sys_clkin_ck,
.init = &omap2_init_clksel_parent,
.clksel = timer2_to_7_clk_sel, .clksel = timer2_to_7_clk_sel,
.clksel_reg = AM33XX_CLKSEL_TIMER4_CLK, .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk timer5_fck = { DEFINE_STRUCT_CLK(timer4_fck, timer2_to_7_ck_parents, timer1_fck_ops);
.name = "timer5_fck",
static struct clk timer5_fck;
static struct clk_hw_omap timer5_fck_hw = {
.hw = {
.clk = &timer5_fck,
},
.clkdm_name = "l4ls_clkdm", .clkdm_name = "l4ls_clkdm",
.parent = &sys_clkin_ck,
.init = &omap2_init_clksel_parent,
.clksel = timer2_to_7_clk_sel, .clksel = timer2_to_7_clk_sel,
.clksel_reg = AM33XX_CLKSEL_TIMER5_CLK, .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk timer6_fck = { DEFINE_STRUCT_CLK(timer5_fck, timer2_to_7_ck_parents, timer1_fck_ops);
.name = "timer6_fck",
static struct clk timer6_fck;
static struct clk_hw_omap timer6_fck_hw = {
.hw = {
.clk = &timer6_fck,
},
.clkdm_name = "l4ls_clkdm", .clkdm_name = "l4ls_clkdm",
.parent = &sys_clkin_ck,
.init = &am33xx_init_timer_parent,
.clksel = timer2_to_7_clk_sel, .clksel = timer2_to_7_clk_sel,
.clksel_reg = AM33XX_CLKSEL_TIMER6_CLK, .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk timer7_fck = { DEFINE_STRUCT_CLK(timer6_fck, timer2_to_7_ck_parents, timer1_fck_ops);
.name = "timer7_fck",
static struct clk timer7_fck;
static struct clk_hw_omap timer7_fck_hw = {
.hw = {
.clk = &timer7_fck,
},
.clkdm_name = "l4ls_clkdm", .clkdm_name = "l4ls_clkdm",
.parent = &sys_clkin_ck,
.init = &omap2_init_clksel_parent,
.clksel = timer2_to_7_clk_sel, .clksel = timer2_to_7_clk_sel,
.clksel_reg = AM33XX_CLKSEL_TIMER7_CLK, .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk cpsw_125mhz_gclk = { DEFINE_STRUCT_CLK(timer7_fck, timer2_to_7_ck_parents, timer1_fck_ops);
.name = "cpsw_125mhz_gclk",
.clkdm_name = "cpsw_125mhz_clkdm", DEFINE_CLK_FIXED_FACTOR(cpsw_125mhz_gclk,
.parent = &dpll_core_m5_ck, "dpll_core_m5_ck",
.ops = &clkops_null, &dpll_core_m5_ck,
.fixed_div = 2, 0x0,
.recalc = &omap_fixed_divisor_recalc, 1, 2);
static const struct clk_ops cpsw_fck_ops = {
.recalc_rate = &omap2_clksel_recalc,
.get_parent = &omap2_clksel_find_parent_index,
.set_parent = &omap2_clksel_set_parent,
}; };
static const struct clksel cpsw_cpts_rft_clkmux_sel[] = { static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
...@@ -758,18 +607,30 @@ static const struct clksel cpsw_cpts_rft_clkmux_sel[] = { ...@@ -758,18 +607,30 @@ static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk cpsw_cpts_rft_clk = { static const char *cpsw_cpts_rft_ck_parents[] = {
.name = "cpsw_cpts_rft_clk", "dpll_core_m5_ck", "dpll_core_m4_ck",
};
static struct clk cpsw_cpts_rft_clk;
static struct clk_hw_omap cpsw_cpts_rft_clk_hw = {
.hw = {
.clk = &cpsw_cpts_rft_clk,
},
.clkdm_name = "cpsw_125mhz_clkdm", .clkdm_name = "cpsw_125mhz_clkdm",
.parent = &dpll_core_m5_ck,
.clksel = cpsw_cpts_rft_clkmux_sel, .clksel = cpsw_cpts_rft_clkmux_sel,
.clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL, .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
.clksel_mask = AM33XX_CLKSEL_0_0_MASK, .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
.ops = &clkops_null,
.recalc = &followparent_recalc,
}; };
DEFINE_STRUCT_CLK(cpsw_cpts_rft_clk, cpsw_cpts_rft_ck_parents, cpsw_fck_ops);
/* gpio */ /* gpio */
static const char *gpio0_ck_parents[] = {
"clk_rc32k_ck", "clk_32768_ck", "clkdiv32k_ick",
};
static const struct clksel gpio0_dbclk_mux_sel[] = { static const struct clksel gpio0_dbclk_mux_sel[] = {
{ .parent = &clk_rc32k_ck, .rates = div_1_0_rates }, { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
{ .parent = &clk_32768_ck, .rates = div_1_1_rates }, { .parent = &clk_32768_ck, .rates = div_1_1_rates },
...@@ -777,56 +638,46 @@ static const struct clksel gpio0_dbclk_mux_sel[] = { ...@@ -777,56 +638,46 @@ static const struct clksel gpio0_dbclk_mux_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk gpio0_dbclk_mux_ck = { static const struct clk_ops gpio_fck_ops = {
.name = "gpio0_dbclk_mux_ck", .recalc_rate = &omap2_clksel_recalc,
.get_parent = &omap2_clksel_find_parent_index,
.set_parent = &omap2_clksel_set_parent,
.init = &omap2_init_clk_clkdm,
};
static struct clk gpio0_dbclk_mux_ck;
static struct clk_hw_omap gpio0_dbclk_mux_ck_hw = {
.hw = {
.clk = &gpio0_dbclk_mux_ck,
},
.clkdm_name = "l4_wkup_clkdm", .clkdm_name = "l4_wkup_clkdm",
.parent = &clk_rc32k_ck,
.init = &omap2_init_clksel_parent,
.clksel = gpio0_dbclk_mux_sel, .clksel = gpio0_dbclk_mux_sel,
.clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK, .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
static struct clk gpio0_dbclk = { DEFINE_STRUCT_CLK(gpio0_dbclk_mux_ck, gpio0_ck_parents, gpio_fck_ops);
.name = "gpio0_dbclk",
.clkdm_name = "l4_wkup_clkdm",
.parent = &gpio0_dbclk_mux_ck,
.enable_reg = AM33XX_CM_WKUP_GPIO0_CLKCTRL,
.enable_bit = AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT,
.ops = &clkops_omap2_dflt,
.recalc = &followparent_recalc,
};
static struct clk gpio1_dbclk = { DEFINE_CLK_GATE(gpio0_dbclk, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, 0x0,
.name = "gpio1_dbclk", AM33XX_CM_WKUP_GPIO0_CLKCTRL,
.clkdm_name = "l4ls_clkdm", AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT, 0x0, NULL);
.parent = &clkdiv32k_ick,
.enable_reg = AM33XX_CM_PER_GPIO1_CLKCTRL,
.enable_bit = AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT,
.ops = &clkops_omap2_dflt,
.recalc = &followparent_recalc,
};
static struct clk gpio2_dbclk = { DEFINE_CLK_GATE(gpio1_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
.name = "gpio2_dbclk", AM33XX_CM_PER_GPIO1_CLKCTRL,
.clkdm_name = "l4ls_clkdm", AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT, 0x0, NULL);
.parent = &clkdiv32k_ick,
.enable_reg = AM33XX_CM_PER_GPIO2_CLKCTRL,
.enable_bit = AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT,
.ops = &clkops_omap2_dflt,
.recalc = &followparent_recalc,
};
static struct clk gpio3_dbclk = { DEFINE_CLK_GATE(gpio2_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
.name = "gpio3_dbclk", AM33XX_CM_PER_GPIO2_CLKCTRL,
.clkdm_name = "l4ls_clkdm", AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT, 0x0, NULL);
.parent = &clkdiv32k_ick,
.enable_reg = AM33XX_CM_PER_GPIO3_CLKCTRL, DEFINE_CLK_GATE(gpio3_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
.enable_bit = AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT, AM33XX_CM_PER_GPIO3_CLKCTRL,
.ops = &clkops_omap2_dflt, AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT, 0x0, NULL);
.recalc = &followparent_recalc,
static const char *pruss_ck_parents[] = {
"l3_gclk", "dpll_disp_m2_ck",
}; };
static const struct clksel pruss_ocp_clk_mux_sel[] = { static const struct clksel pruss_ocp_clk_mux_sel[] = {
...@@ -835,16 +686,22 @@ static const struct clksel pruss_ocp_clk_mux_sel[] = { ...@@ -835,16 +686,22 @@ static const struct clksel pruss_ocp_clk_mux_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk pruss_ocp_gclk = { static struct clk pruss_ocp_gclk;
.name = "pruss_ocp_gclk",
static struct clk_hw_omap pruss_ocp_gclk_hw = {
.hw = {
.clk = &pruss_ocp_gclk,
},
.clkdm_name = "pruss_ocp_clkdm", .clkdm_name = "pruss_ocp_clkdm",
.parent = &l3_gclk,
.init = &omap2_init_clksel_parent,
.clksel = pruss_ocp_clk_mux_sel, .clksel = pruss_ocp_clk_mux_sel,
.clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK, .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
.clksel_mask = AM33XX_CLKSEL_0_0_MASK, .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
.ops = &clkops_null, };
.recalc = &followparent_recalc,
DEFINE_STRUCT_CLK(pruss_ocp_gclk, pruss_ck_parents, gpio_fck_ops);
static const char *lcd_ck_parents[] = {
"dpll_disp_m2_ck", "dpll_core_m5_ck", "dpll_per_m2_ck",
}; };
static const struct clksel lcd_clk_mux_sel[] = { static const struct clksel lcd_clk_mux_sel[] = {
...@@ -854,33 +711,24 @@ static const struct clksel lcd_clk_mux_sel[] = { ...@@ -854,33 +711,24 @@ static const struct clksel lcd_clk_mux_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk lcd_gclk = { static struct clk lcd_gclk;
.name = "lcd_gclk",
static struct clk_hw_omap lcd_gclk_hw = {
.hw = {
.clk = &lcd_gclk,
},
.clkdm_name = "lcdc_clkdm", .clkdm_name = "lcdc_clkdm",
.parent = &dpll_disp_m2_ck,
.init = &omap2_init_clksel_parent,
.clksel = lcd_clk_mux_sel, .clksel = lcd_clk_mux_sel,
.clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK, .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &followparent_recalc,
}; };
static struct clk mmc_clk = { DEFINE_STRUCT_CLK(lcd_gclk, lcd_ck_parents, gpio_fck_ops);
.name = "mmc_clk",
.clkdm_name = "l4ls_clkdm", DEFINE_CLK_FIXED_FACTOR(mmc_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1, 2);
.parent = &dpll_per_m2_ck,
.ops = &clkops_null,
.fixed_div = 2,
.recalc = &omap_fixed_divisor_recalc,
};
static struct clk mmc2_fck = { static const char *gfx_ck_parents[] = {
.name = "mmc2_fck", "dpll_core_m4_ck", "dpll_per_m2_ck",
.clkdm_name = "l3s_clkdm",
.parent = &mmc_clk,
.ops = &clkops_null,
.recalc = &followparent_recalc,
}; };
static const struct clksel gfx_clksel_sel[] = { static const struct clksel gfx_clksel_sel[] = {
...@@ -889,39 +737,33 @@ static const struct clksel gfx_clksel_sel[] = { ...@@ -889,39 +737,33 @@ static const struct clksel gfx_clksel_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk gfx_fclk_clksel_ck = { static struct clk gfx_fclk_clksel_ck;
.name = "gfx_fclk_clksel_ck",
.parent = &dpll_core_m4_ck, static struct clk_hw_omap gfx_fclk_clksel_ck_hw = {
.hw = {
.clk = &gfx_fclk_clksel_ck,
},
.clksel = gfx_clksel_sel, .clksel = gfx_clksel_sel,
.ops = &clkops_null,
.clksel_reg = AM33XX_CLKSEL_GFX_FCLK, .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
.clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK, .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
.recalc = &omap2_clksel_recalc,
}; };
static const struct clksel_rate div_1_0_2_1_rates[] = { DEFINE_STRUCT_CLK(gfx_fclk_clksel_ck, gfx_ck_parents, gpio_fck_ops);
{ .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
{ .div = 2, .val = 1, .flags = RATE_IN_AM33XX }, static const struct clk_div_table div_1_0_2_1_rates[] = {
{ .div = 1, .val = 0, },
{ .div = 2, .val = 1, },
{ .div = 0 }, { .div = 0 },
}; };
static const struct clksel gfx_div_sel[] = { DEFINE_CLK_DIVIDER_TABLE(gfx_fck_div_ck, "gfx_fclk_clksel_ck",
{ .parent = &gfx_fclk_clksel_ck, .rates = div_1_0_2_1_rates }, &gfx_fclk_clksel_ck, 0x0, AM33XX_CLKSEL_GFX_FCLK,
{ .parent = NULL }, AM33XX_CLKSEL_0_0_SHIFT, AM33XX_CLKSEL_0_0_WIDTH,
}; 0x0, div_1_0_2_1_rates, NULL);
static struct clk gfx_fck_div_ck = { static const char *sysclkout_ck_parents[] = {
.name = "gfx_fck_div_ck", "clk_32768_ck", "l3_gclk", "dpll_ddr_m2_ck", "dpll_per_m2_ck",
.clkdm_name = "gfx_l3_clkdm", "lcd_gclk",
.parent = &gfx_fclk_clksel_ck,
.init = &omap2_init_clksel_parent,
.clksel = gfx_div_sel,
.clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
.clksel_mask = AM33XX_CLKSEL_0_0_MASK,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
.ops = &clkops_null,
}; };
static const struct clksel sysclkout_pre_sel[] = { static const struct clksel sysclkout_pre_sel[] = {
...@@ -933,47 +775,41 @@ static const struct clksel sysclkout_pre_sel[] = { ...@@ -933,47 +775,41 @@ static const struct clksel sysclkout_pre_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk sysclkout_pre_ck = { static struct clk sysclkout_pre_ck;
.name = "sysclkout_pre_ck",
.parent = &clk_32768_ck, static struct clk_hw_omap sysclkout_pre_ck_hw = {
.init = &omap2_init_clksel_parent, .hw = {
.clk = &sysclkout_pre_ck,
},
.clksel = sysclkout_pre_sel, .clksel = sysclkout_pre_sel,
.clksel_reg = AM33XX_CM_CLKOUT_CTRL, .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
.clksel_mask = AM33XX_CLKOUT2SOURCE_MASK, .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
DEFINE_STRUCT_CLK(sysclkout_pre_ck, sysclkout_ck_parents, gpio_fck_ops);
/* Divide by 8 clock rates with default clock is 1/1*/ /* Divide by 8 clock rates with default clock is 1/1*/
static const struct clksel_rate div8_rates[] = { static const struct clk_div_table div8_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_AM33XX }, { .div = 1, .val = 0, },
{ .div = 2, .val = 1, .flags = RATE_IN_AM33XX }, { .div = 2, .val = 1, },
{ .div = 3, .val = 2, .flags = RATE_IN_AM33XX }, { .div = 3, .val = 2, },
{ .div = 4, .val = 3, .flags = RATE_IN_AM33XX }, { .div = 4, .val = 3, },
{ .div = 5, .val = 4, .flags = RATE_IN_AM33XX }, { .div = 5, .val = 4, },
{ .div = 6, .val = 5, .flags = RATE_IN_AM33XX }, { .div = 6, .val = 5, },
{ .div = 7, .val = 6, .flags = RATE_IN_AM33XX }, { .div = 7, .val = 6, },
{ .div = 8, .val = 7, .flags = RATE_IN_AM33XX }, { .div = 8, .val = 7, },
{ .div = 0 }, { .div = 0 },
}; };
static const struct clksel clkout2_div[] = { DEFINE_CLK_DIVIDER_TABLE(clkout2_div_ck, "sysclkout_pre_ck", &sysclkout_pre_ck,
{ .parent = &sysclkout_pre_ck, .rates = div8_rates }, 0x0, AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2DIV_SHIFT,
{ .parent = NULL }, AM33XX_CLKOUT2DIV_WIDTH, 0x0, div8_rates, NULL);
};
static struct clk clkout2_ck = { DEFINE_CLK_GATE(clkout2_ck, "clkout2_div_ck", &clkout2_div_ck, 0x0,
.name = "clkout2_ck", AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2EN_SHIFT, 0x0, NULL);
.parent = &sysclkout_pre_ck,
.ops = &clkops_omap2_dflt, static const char *wdt_ck_parents[] = {
.clksel = clkout2_div, "clk_rc32k_ck", "clkdiv32k_ick",
.clksel_reg = AM33XX_CM_CLKOUT_CTRL,
.clksel_mask = AM33XX_CLKOUT2DIV_MASK,
.enable_reg = AM33XX_CM_CLKOUT_CTRL,
.enable_bit = AM33XX_CLKOUT2EN_SHIFT,
.recalc = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
.set_rate = &omap2_clksel_set_rate,
}; };
static const struct clksel wdt_clkmux_sel[] = { static const struct clksel wdt_clkmux_sel[] = {
...@@ -982,18 +818,20 @@ static const struct clksel wdt_clkmux_sel[] = { ...@@ -982,18 +818,20 @@ static const struct clksel wdt_clkmux_sel[] = {
{ .parent = NULL }, { .parent = NULL },
}; };
static struct clk wdt1_fck = { static struct clk wdt1_fck;
.name = "wdt1_fck",
static struct clk_hw_omap wdt1_fck_hw = {
.hw = {
.clk = &wdt1_fck,
},
.clkdm_name = "l4_wkup_clkdm", .clkdm_name = "l4_wkup_clkdm",
.parent = &clk_rc32k_ck,
.init = &omap2_init_clksel_parent,
.clksel = wdt_clkmux_sel, .clksel = wdt_clkmux_sel,
.clksel_reg = AM33XX_CLKSEL_WDT1_CLK, .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
.clksel_mask = AM33XX_CLKSEL_0_1_MASK, .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
.ops = &clkops_null,
.recalc = &omap2_clksel_recalc,
}; };
DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
/* /*
* clkdev * clkdev
*/ */
...@@ -1025,6 +863,7 @@ static struct omap_clk am33xx_clks[] = { ...@@ -1025,6 +863,7 @@ static struct omap_clk am33xx_clks[] = {
CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX), CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX),
CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX), CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX),
CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX), CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX),
CLK(NULL, "clkdiv32k_ck", &clkdiv32k_ck, CK_AM33XX),
CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX), CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX),
CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX), CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX), CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX),
...@@ -1032,14 +871,11 @@ static struct omap_clk am33xx_clks[] = { ...@@ -1032,14 +871,11 @@ static struct omap_clk am33xx_clks[] = {
CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX), CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX),
CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX), CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX),
CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX), CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX),
CLK("davinci-mcasp.0", NULL, &mcasp0_fck, CK_AM33XX),
CLK("davinci-mcasp.1", NULL, &mcasp1_fck, CK_AM33XX),
CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX), CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX),
CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX), CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX),
CLK("NULL", "mmc2_fck", &mmc2_fck, CK_AM33XX),
CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX), CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_AM33XX), CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX),
CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_AM33XX), CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX),
CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX), CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX),
CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX), CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX),
CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX), CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX),
...@@ -1071,11 +907,21 @@ static struct omap_clk am33xx_clks[] = { ...@@ -1071,11 +907,21 @@ static struct omap_clk am33xx_clks[] = {
CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX), CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX),
CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX), CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX),
CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX), CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX),
CLK(NULL, "clkout2_ck", &clkout2_ck, CK_AM33XX), CLK(NULL, "clkout2_div_ck", &clkout2_div_ck, CK_AM33XX),
CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX), CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX),
CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX), CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX),
}; };
static const char *enable_init_clks[] = {
"dpll_ddr_m2_ck",
"dpll_mpu_m2_ck",
"l3_gclk",
"l4hs_gclk",
"l4fw_gclk",
"l4ls_gclk",
};
int __init am33xx_clk_init(void) int __init am33xx_clk_init(void)
{ {
struct omap_clk *c; struct omap_clk *c;
...@@ -1086,24 +932,30 @@ int __init am33xx_clk_init(void) ...@@ -1086,24 +932,30 @@ int __init am33xx_clk_init(void)
cpu_clkflg = CK_AM33XX; cpu_clkflg = CK_AM33XX;
} }
for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++)
clk_preinit(c->lk.clk);
for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) { for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
if (c->cpu & cpu_clkflg) { if (c->cpu & cpu_clkflg) {
clkdev_add(&c->lk); clkdev_add(&c->lk);
clk_register(c->lk.clk); if (!__clk_init(NULL, c->lk.clk))
omap2_init_clk_clkdm(c->lk.clk); omap2_init_clk_hw_omap_clocks(c->lk.clk);
} }
} }
recalculate_root_clocks(); omap2_clk_disable_autoidle_all();
/* omap2_clk_enable_init_clocks(enable_init_clks,
* Only enable those clocks we will need, let the drivers ARRAY_SIZE(enable_init_clks));
* enable other clocks as necessary
/* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
* physically present, in such a case HWMOD enabling of
* clock would be failure with default parent. And timer
* probe thinks clock is already enabled, this leads to
* crash upon accessing timer 3 & 6 registers in probe.
* Fix by setting parent of both these timers to master
* oscillator clock.
*/ */
clk_enable_init_clocks();
clk_set_parent(&timer3_fck, &sys_clkin_ck);
clk_set_parent(&timer6_fck, &sys_clkin_ck);
return 0; return 0;
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* OMAP4 Clock data
*
* Copyright (C) 2009-2012 Texas Instruments, Inc.
* Copyright (C) 2009-2010 Nokia Corporation
*
* Paul Walmsley (paul@pwsan.com)
* Rajendra Nayak (rnayak@ti.com)
* Benoit Cousson (b-cousson@ti.com)
* Mike Turquette (mturquette@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.
*
* XXX Some of the ES1 clocks have been removed/changed; once support
* is added for discriminating clocks by ES level, these should be added back
* in.
*/
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/clk-private.h>
#include <linux/clkdev.h>
#include <linux/io.h>
#include "soc.h"
#include "iomap.h"
#include "clock.h"
#include "clock44xx.h"
#include "cm1_44xx.h"
#include "cm2_44xx.h"
#include "cm-regbits-44xx.h"
#include "prm44xx.h"
#include "prm-regbits-44xx.h"
#include "control.h"
#include "scrm44xx.h"
/* OMAP4 modulemode control */
#define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0
#define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1
/* Root clocks */
DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0);
DEFINE_CLK_FIXED_RATE(pad_clks_src_ck, CLK_IS_ROOT, 12000000, 0x0);
DEFINE_CLK_GATE(pad_clks_ck, "pad_clks_src_ck", &pad_clks_src_ck, 0x0,
OMAP4430_CM_CLKSEL_ABE, OMAP4430_PAD_CLKS_GATE_SHIFT,
0x0, NULL);
DEFINE_CLK_FIXED_RATE(pad_slimbus_core_clks_ck, CLK_IS_ROOT, 12000000, 0x0);
DEFINE_CLK_FIXED_RATE(secure_32k_clk_src_ck, CLK_IS_ROOT, 32768, 0x0);
DEFINE_CLK_FIXED_RATE(slimbus_src_clk, CLK_IS_ROOT, 12000000, 0x0);
DEFINE_CLK_GATE(slimbus_clk, "slimbus_src_clk", &slimbus_src_clk, 0x0,
OMAP4430_CM_CLKSEL_ABE, OMAP4430_SLIMBUS_CLK_GATE_SHIFT,
0x0, NULL);
DEFINE_CLK_FIXED_RATE(sys_32k_ck, CLK_IS_ROOT, 32768, 0x0);
DEFINE_CLK_FIXED_RATE(virt_12000000_ck, CLK_IS_ROOT, 12000000, 0x0);
DEFINE_CLK_FIXED_RATE(virt_13000000_ck, CLK_IS_ROOT, 13000000, 0x0);
DEFINE_CLK_FIXED_RATE(virt_16800000_ck, CLK_IS_ROOT, 16800000, 0x0);
DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
DEFINE_CLK_FIXED_RATE(virt_27000000_ck, CLK_IS_ROOT, 27000000, 0x0);
DEFINE_CLK_FIXED_RATE(virt_38400000_ck, CLK_IS_ROOT, 38400000, 0x0);
static const char *sys_clkin_ck_parents[] = {
"virt_12000000_ck", "virt_13000000_ck", "virt_16800000_ck",
"virt_19200000_ck", "virt_26000000_ck", "virt_27000000_ck",
"virt_38400000_ck",
};
DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
OMAP4430_CM_SYS_CLKSEL, OMAP4430_SYS_CLKSEL_SHIFT,
OMAP4430_SYS_CLKSEL_WIDTH, CLK_MUX_INDEX_ONE, NULL);
DEFINE_CLK_FIXED_RATE(tie_low_clock_ck, CLK_IS_ROOT, 0, 0x0);
DEFINE_CLK_FIXED_RATE(utmi_phy_clkout_ck, CLK_IS_ROOT, 60000000, 0x0);
DEFINE_CLK_FIXED_RATE(xclk60mhsp1_ck, CLK_IS_ROOT, 60000000, 0x0);
DEFINE_CLK_FIXED_RATE(xclk60mhsp2_ck, CLK_IS_ROOT, 60000000, 0x0);
DEFINE_CLK_FIXED_RATE(xclk60motg_ck, CLK_IS_ROOT, 60000000, 0x0);
/* Module clocks and DPLL outputs */
static const char *abe_dpll_bypass_clk_mux_ck_parents[] = {
"sys_clkin_ck", "sys_32k_ck",
};
DEFINE_CLK_MUX(abe_dpll_bypass_clk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents,
NULL, 0x0, OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_SHIFT,
OMAP4430_CLKSEL_WIDTH, 0x0, NULL);
DEFINE_CLK_MUX(abe_dpll_refclk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents, NULL,
0x0, OMAP4430_CM_ABE_PLL_REF_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
/* DPLL_ABE */
static struct dpll_data dpll_abe_dd = {
.mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
.clk_bypass = &abe_dpll_bypass_clk_mux_ck,
.clk_ref = &abe_dpll_refclk_mux_ck,
.control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
.modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
.autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
.idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
.mult_mask = OMAP4430_DPLL_MULT_MASK,
.div1_mask = OMAP4430_DPLL_DIV_MASK,
.enable_mask = OMAP4430_DPLL_EN_MASK,
.autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
.idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
.max_multiplier = 2047,
.max_divider = 128,
.min_divider = 1,
};
static const char *dpll_abe_ck_parents[] = {
"abe_dpll_refclk_mux_ck",
};
static struct clk dpll_abe_ck;
static const struct clk_ops dpll_abe_ck_ops = {
.enable = &omap3_noncore_dpll_enable,
.disable = &omap3_noncore_dpll_disable,
.recalc_rate = &omap4_dpll_regm4xen_recalc,
.round_rate = &omap4_dpll_regm4xen_round_rate,
.set_rate = &omap3_noncore_dpll_set_rate,
.get_parent = &omap2_init_dpll_parent,
};
static struct clk_hw_omap dpll_abe_ck_hw = {
.hw = {
.clk = &dpll_abe_ck,
},
.dpll_data = &dpll_abe_dd,
.ops = &clkhwops_omap3_dpll,
};
DEFINE_STRUCT_CLK(dpll_abe_ck, dpll_abe_ck_parents, dpll_abe_ck_ops);
static const char *dpll_abe_x2_ck_parents[] = {
"dpll_abe_ck",
};
static struct clk dpll_abe_x2_ck;
static const struct clk_ops dpll_abe_x2_ck_ops = {
.recalc_rate = &omap3_clkoutx2_recalc,
};
static struct clk_hw_omap dpll_abe_x2_ck_hw = {
.hw = {
.clk = &dpll_abe_x2_ck,
},
.flags = CLOCK_CLKOUTX2,
.clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
.ops = &clkhwops_omap4_dpllmx,
};
DEFINE_STRUCT_CLK(dpll_abe_x2_ck, dpll_abe_x2_ck_parents, dpll_abe_x2_ck_ops);
static const struct clk_ops omap_hsdivider_ops = {
.set_rate = &omap2_clksel_set_rate,
.recalc_rate = &omap2_clksel_recalc,
.round_rate = &omap2_clksel_round_rate,
};
DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m2x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
0x0, OMAP4430_CM_DIV_M2_DPLL_ABE,
OMAP4430_DPLL_CLKOUT_DIV_MASK);
DEFINE_CLK_FIXED_FACTOR(abe_24m_fclk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
0x0, 1, 8);
DEFINE_CLK_DIVIDER(abe_clk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, 0x0,
OMAP4430_CM_CLKSEL_ABE, OMAP4430_CLKSEL_OPP_SHIFT,
OMAP4430_CLKSEL_OPP_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
DEFINE_CLK_DIVIDER(aess_fclk, "abe_clk", &abe_clk, 0x0,
OMAP4430_CM1_ABE_AESS_CLKCTRL,
OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
0x0, NULL);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m3x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
0x0, OMAP4430_CM_DIV_M3_DPLL_ABE,
OMAP4430_DPLL_CLKOUTHIF_DIV_MASK);
static const char *core_hsd_byp_clk_mux_ck_parents[] = {
"sys_clkin_ck", "dpll_abe_m3x2_ck",
};
DEFINE_CLK_MUX(core_hsd_byp_clk_mux_ck, core_hsd_byp_clk_mux_ck_parents, NULL,
0x0, OMAP4430_CM_CLKSEL_DPLL_CORE,
OMAP4430_DPLL_BYP_CLKSEL_SHIFT, OMAP4430_DPLL_BYP_CLKSEL_WIDTH,
0x0, NULL);
/* DPLL_CORE */
static struct dpll_data dpll_core_dd = {
.mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
.clk_bypass = &core_hsd_byp_clk_mux_ck,
.clk_ref = &sys_clkin_ck,
.control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
.modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
.autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
.idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
.mult_mask = OMAP4430_DPLL_MULT_MASK,
.div1_mask = OMAP4430_DPLL_DIV_MASK,
.enable_mask = OMAP4430_DPLL_EN_MASK,
.autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
.idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
.max_multiplier = 2047,
.max_divider = 128,
.min_divider = 1,
};
static const char *dpll_core_ck_parents[] = {
"sys_clkin_ck",
};
static struct clk dpll_core_ck;
static const struct clk_ops dpll_core_ck_ops = {
.recalc_rate = &omap3_dpll_recalc,
.get_parent = &omap2_init_dpll_parent,
};
static struct clk_hw_omap dpll_core_ck_hw = {
.hw = {
.clk = &dpll_core_ck,
},
.dpll_data = &dpll_core_dd,
.ops = &clkhwops_omap3_dpll,
};
DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
static const char *dpll_core_x2_ck_parents[] = {
"dpll_core_ck",
};
static struct clk dpll_core_x2_ck;
static struct clk_hw_omap dpll_core_x2_ck_hw = {
.hw = {
.clk = &dpll_core_x2_ck,
},
};
DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_abe_x2_ck_ops);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m6x2_ck, "dpll_core_x2_ck",
&dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M6_DPLL_CORE,
OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m2_ck, "dpll_core_ck", &dpll_core_ck, 0x0,
OMAP4430_CM_DIV_M2_DPLL_CORE,
OMAP4430_DPLL_CLKOUT_DIV_MASK);
DEFINE_CLK_FIXED_FACTOR(ddrphy_ck, "dpll_core_m2_ck", &dpll_core_m2_ck, 0x0, 1,
2);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m5x2_ck, "dpll_core_x2_ck",
&dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M5_DPLL_CORE,
OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
DEFINE_CLK_DIVIDER(div_core_ck, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, 0x0,
OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT,
OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL);
DEFINE_CLK_OMAP_HSDIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck",
&dpll_core_m5x2_ck, 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA,
OMAP4430_CLKSEL_0_1_MASK);
DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck,
0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT,
OMAP4430_CLKSEL_0_1_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m4x2_ck, "dpll_core_x2_ck",
&dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M4_DPLL_CORE,
OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
DEFINE_CLK_FIXED_FACTOR(dll_clk_div_ck, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck,
0x0, 1, 2);
DEFINE_CLK_DIVIDER(dpll_abe_m2_ck, "dpll_abe_ck", &dpll_abe_ck, 0x0,
OMAP4430_CM_DIV_M2_DPLL_ABE, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
static const struct clk_ops dmic_fck_ops = {
.enable = &omap2_dflt_clk_enable,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
.recalc_rate = &omap2_clksel_recalc,
.get_parent = &omap2_clksel_find_parent_index,
.set_parent = &omap2_clksel_set_parent,
.init = &omap2_init_clk_clkdm,
};
static const char *dpll_core_m3x2_ck_parents[] = {
"dpll_core_x2_ck",
};
static const struct clksel dpll_core_m3x2_div[] = {
{ .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
{ .parent = NULL },
};
/* XXX Missing round_rate, set_rate in ops */
DEFINE_CLK_OMAP_MUX_GATE(dpll_core_m3x2_ck, NULL, dpll_core_m3x2_div,
OMAP4430_CM_DIV_M3_DPLL_CORE,
OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
OMAP4430_CM_DIV_M3_DPLL_CORE,
OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
dpll_core_m3x2_ck_parents, dmic_fck_ops);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m7x2_ck, "dpll_core_x2_ck",
&dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M7_DPLL_CORE,
OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
static const char *iva_hsd_byp_clk_mux_ck_parents[] = {
"sys_clkin_ck", "div_iva_hs_clk",
};
DEFINE_CLK_MUX(iva_hsd_byp_clk_mux_ck, iva_hsd_byp_clk_mux_ck_parents, NULL,
0x0, OMAP4430_CM_CLKSEL_DPLL_IVA, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
/* DPLL_IVA */
static struct dpll_data dpll_iva_dd = {
.mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
.clk_bypass = &iva_hsd_byp_clk_mux_ck,
.clk_ref = &sys_clkin_ck,
.control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
.modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
.autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
.idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
.mult_mask = OMAP4430_DPLL_MULT_MASK,
.div1_mask = OMAP4430_DPLL_DIV_MASK,
.enable_mask = OMAP4430_DPLL_EN_MASK,
.autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
.idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
.max_multiplier = 2047,
.max_divider = 128,
.min_divider = 1,
};
static struct clk dpll_iva_ck;
static struct clk_hw_omap dpll_iva_ck_hw = {
.hw = {
.clk = &dpll_iva_ck,
},
.dpll_data = &dpll_iva_dd,
.ops = &clkhwops_omap3_dpll,
};
DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
static const char *dpll_iva_x2_ck_parents[] = {
"dpll_iva_ck",
};
static struct clk dpll_iva_x2_ck;
static struct clk_hw_omap dpll_iva_x2_ck_hw = {
.hw = {
.clk = &dpll_iva_x2_ck,
},
};
DEFINE_STRUCT_CLK(dpll_iva_x2_ck, dpll_iva_x2_ck_parents, dpll_abe_x2_ck_ops);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m4x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
0x0, OMAP4430_CM_DIV_M4_DPLL_IVA,
OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m5x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
0x0, OMAP4430_CM_DIV_M5_DPLL_IVA,
OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
/* DPLL_MPU */
static struct dpll_data dpll_mpu_dd = {
.mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
.clk_bypass = &div_mpu_hs_clk,
.clk_ref = &sys_clkin_ck,
.control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
.modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
.autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
.idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
.mult_mask = OMAP4430_DPLL_MULT_MASK,
.div1_mask = OMAP4430_DPLL_DIV_MASK,
.enable_mask = OMAP4430_DPLL_EN_MASK,
.autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
.idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
.max_multiplier = 2047,
.max_divider = 128,
.min_divider = 1,
};
static struct clk dpll_mpu_ck;
static struct clk_hw_omap dpll_mpu_ck_hw = {
.hw = {
.clk = &dpll_mpu_ck,
},
.dpll_data = &dpll_mpu_dd,
.ops = &clkhwops_omap3_dpll,
};
DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck, 0x0,
OMAP4430_CM_DIV_M2_DPLL_MPU,
OMAP4430_DPLL_CLKOUT_DIV_MASK);
DEFINE_CLK_FIXED_FACTOR(per_hs_clk_div_ck, "dpll_abe_m3x2_ck",
&dpll_abe_m3x2_ck, 0x0, 1, 2);
static const char *per_hsd_byp_clk_mux_ck_parents[] = {
"sys_clkin_ck", "per_hs_clk_div_ck",
};
DEFINE_CLK_MUX(per_hsd_byp_clk_mux_ck, per_hsd_byp_clk_mux_ck_parents, NULL,
0x0, OMAP4430_CM_CLKSEL_DPLL_PER, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
/* DPLL_PER */
static struct dpll_data dpll_per_dd = {
.mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
.clk_bypass = &per_hsd_byp_clk_mux_ck,
.clk_ref = &sys_clkin_ck,
.control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
.modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
.autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
.idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
.mult_mask = OMAP4430_DPLL_MULT_MASK,
.div1_mask = OMAP4430_DPLL_DIV_MASK,
.enable_mask = OMAP4430_DPLL_EN_MASK,
.autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
.idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
.max_multiplier = 2047,
.max_divider = 128,
.min_divider = 1,
};
static struct clk dpll_per_ck;
static struct clk_hw_omap dpll_per_ck_hw = {
.hw = {
.clk = &dpll_per_ck,
},
.dpll_data = &dpll_per_dd,
.ops = &clkhwops_omap3_dpll,
};
DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
static const char *dpll_per_x2_ck_parents[] = {
"dpll_per_ck",
};
static struct clk dpll_per_x2_ck;
static struct clk_hw_omap dpll_per_x2_ck_hw = {
.hw = {
.clk = &dpll_per_x2_ck,
},
.flags = CLOCK_CLKOUTX2,
.clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
.ops = &clkhwops_omap4_dpllmx,
};
DEFINE_STRUCT_CLK(dpll_per_x2_ck, dpll_per_x2_ck_parents, dpll_abe_x2_ck_ops);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m2x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
0x0, OMAP4430_CM_DIV_M2_DPLL_PER,
OMAP4430_DPLL_CLKOUT_DIV_MASK);
static const char *dpll_per_m3x2_ck_parents[] = {
"dpll_per_x2_ck",
};
static const struct clksel dpll_per_m3x2_div[] = {
{ .parent = &dpll_per_x2_ck, .rates = div31_1to31_rates },
{ .parent = NULL },
};
/* XXX Missing round_rate, set_rate in ops */
DEFINE_CLK_OMAP_MUX_GATE(dpll_per_m3x2_ck, NULL, dpll_per_m3x2_div,
OMAP4430_CM_DIV_M3_DPLL_PER,
OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
OMAP4430_CM_DIV_M3_DPLL_PER,
OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
dpll_per_m3x2_ck_parents, dmic_fck_ops);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m4x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
0x0, OMAP4430_CM_DIV_M4_DPLL_PER,
OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m5x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
0x0, OMAP4430_CM_DIV_M5_DPLL_PER,
OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m6x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
0x0, OMAP4430_CM_DIV_M6_DPLL_PER,
OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m7x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
0x0, OMAP4430_CM_DIV_M7_DPLL_PER,
OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
DEFINE_CLK_FIXED_FACTOR(usb_hs_clk_div_ck, "dpll_abe_m3x2_ck",
&dpll_abe_m3x2_ck, 0x0, 1, 3);
/* DPLL_USB */
static struct dpll_data dpll_usb_dd = {
.mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
.clk_bypass = &usb_hs_clk_div_ck,
.flags = DPLL_J_TYPE,
.clk_ref = &sys_clkin_ck,
.control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
.modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
.autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
.idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
.mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
.div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
.enable_mask = OMAP4430_DPLL_EN_MASK,
.autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
.idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
.sddiv_mask = OMAP4430_DPLL_SD_DIV_MASK,
.max_multiplier = 4095,
.max_divider = 256,
.min_divider = 1,
};
static struct clk dpll_usb_ck;
static struct clk_hw_omap dpll_usb_ck_hw = {
.hw = {
.clk = &dpll_usb_ck,
},
.dpll_data = &dpll_usb_dd,
.ops = &clkhwops_omap3_dpll,
};
DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
static const char *dpll_usb_clkdcoldo_ck_parents[] = {
"dpll_usb_ck",
};
static struct clk dpll_usb_clkdcoldo_ck;
static const struct clk_ops dpll_usb_clkdcoldo_ck_ops = {
};
static struct clk_hw_omap dpll_usb_clkdcoldo_ck_hw = {
.hw = {
.clk = &dpll_usb_clkdcoldo_ck,
},
.clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
.ops = &clkhwops_omap4_dpllmx,
};
DEFINE_STRUCT_CLK(dpll_usb_clkdcoldo_ck, dpll_usb_clkdcoldo_ck_parents,
dpll_usb_clkdcoldo_ck_ops);
DEFINE_CLK_OMAP_HSDIVIDER(dpll_usb_m2_ck, "dpll_usb_ck", &dpll_usb_ck, 0x0,
OMAP4430_CM_DIV_M2_DPLL_USB,
OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK);
static const char *ducati_clk_mux_ck_parents[] = {
"div_core_ck", "dpll_per_m6x2_ck",
};
DEFINE_CLK_MUX(ducati_clk_mux_ck, ducati_clk_mux_ck_parents, NULL, 0x0,
OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT, OMAP4430_CLKSEL_0_0_SHIFT,
OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
DEFINE_CLK_FIXED_FACTOR(func_12m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
0x0, 1, 16);
DEFINE_CLK_FIXED_FACTOR(func_24m_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0,
1, 4);
DEFINE_CLK_FIXED_FACTOR(func_24mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
0x0, 1, 8);
static const struct clk_div_table func_48m_fclk_rates[] = {
{ .div = 4, .val = 0 },
{ .div = 8, .val = 1 },
{ .div = 0 },
};
DEFINE_CLK_DIVIDER_TABLE(func_48m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_48m_fclk_rates,
NULL);
DEFINE_CLK_FIXED_FACTOR(func_48mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
0x0, 1, 4);
static const struct clk_div_table func_64m_fclk_rates[] = {
{ .div = 2, .val = 0 },
{ .div = 4, .val = 1 },
{ .div = 0 },
};
DEFINE_CLK_DIVIDER_TABLE(func_64m_fclk, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck,
0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_64m_fclk_rates,
NULL);
static const struct clk_div_table func_96m_fclk_rates[] = {
{ .div = 2, .val = 0 },
{ .div = 4, .val = 1 },
{ .div = 0 },
};
DEFINE_CLK_DIVIDER_TABLE(func_96m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_96m_fclk_rates,
NULL);
static const struct clk_div_table init_60m_fclk_rates[] = {
{ .div = 1, .val = 0 },
{ .div = 8, .val = 1 },
{ .div = 0 },
};
DEFINE_CLK_DIVIDER_TABLE(init_60m_fclk, "dpll_usb_m2_ck", &dpll_usb_m2_ck,
0x0, OMAP4430_CM_CLKSEL_USB_60MHZ,
OMAP4430_CLKSEL_0_0_SHIFT, OMAP4430_CLKSEL_0_0_WIDTH,
0x0, init_60m_fclk_rates, NULL);
DEFINE_CLK_DIVIDER(l3_div_ck, "div_core_ck", &div_core_ck, 0x0,
OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L3_SHIFT,
OMAP4430_CLKSEL_L3_WIDTH, 0x0, NULL);
DEFINE_CLK_DIVIDER(l4_div_ck, "l3_div_ck", &l3_div_ck, 0x0,
OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L4_SHIFT,
OMAP4430_CLKSEL_L4_WIDTH, 0x0, NULL);
DEFINE_CLK_FIXED_FACTOR(lp_clk_div_ck, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
0x0, 1, 16);
static const char *l4_wkup_clk_mux_ck_parents[] = {
"sys_clkin_ck", "lp_clk_div_ck",
};
DEFINE_CLK_MUX(l4_wkup_clk_mux_ck, l4_wkup_clk_mux_ck_parents, NULL, 0x0,
OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
static const struct clk_div_table ocp_abe_iclk_rates[] = {
{ .div = 2, .val = 0 },
{ .div = 1, .val = 1 },
{ .div = 0 },
};
DEFINE_CLK_DIVIDER_TABLE(ocp_abe_iclk, "aess_fclk", &aess_fclk, 0x0,
OMAP4430_CM1_ABE_AESS_CLKCTRL,
OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
0x0, ocp_abe_iclk_rates, NULL);
DEFINE_CLK_FIXED_FACTOR(per_abe_24m_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck,
0x0, 1, 4);
DEFINE_CLK_DIVIDER(per_abe_nc_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck, 0x0,
OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
OMAP4430_SCALE_FCLK_WIDTH, 0x0, NULL);
DEFINE_CLK_DIVIDER(syc_clk_div_ck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
static struct clk dbgclk_mux_ck;
DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL);
DEFINE_STRUCT_CLK(dbgclk_mux_ck, dpll_core_ck_parents,
dpll_usb_clkdcoldo_ck_ops);
/* Leaf clocks controlled by modules */
DEFINE_CLK_GATE(aes1_fck, "l3_div_ck", &l3_div_ck, 0x0,
OMAP4430_CM_L4SEC_AES1_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(aes2_fck, "l3_div_ck", &l3_div_ck, 0x0,
OMAP4430_CM_L4SEC_AES2_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(aess_fck, "aess_fclk", &aess_fclk, 0x0,
OMAP4430_CM1_ABE_AESS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(bandgap_fclk, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT, 0x0, NULL);
static const struct clk_div_table div_ts_ck_rates[] = {
{ .div = 8, .val = 0 },
{ .div = 16, .val = 1 },
{ .div = 32, .val = 2 },
{ .div = 0 },
};
DEFINE_CLK_DIVIDER_TABLE(div_ts_ck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
0x0, OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
OMAP4430_CLKSEL_24_25_SHIFT,
OMAP4430_CLKSEL_24_25_WIDTH, 0x0, div_ts_ck_rates,
NULL);
DEFINE_CLK_GATE(bandgap_ts_fclk, "div_ts_ck", &div_ts_ck, 0x0,
OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(des3des_fck, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4SEC_DES3DES_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT,
0x0, NULL);
static const char *dmic_sync_mux_ck_parents[] = {
"abe_24m_fclk", "syc_clk_div_ck", "func_24m_clk",
};
DEFINE_CLK_MUX(dmic_sync_mux_ck, dmic_sync_mux_ck_parents, NULL,
0x0, OMAP4430_CM1_ABE_DMIC_CLKCTRL,
OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
static const struct clksel func_dmic_abe_gfclk_sel[] = {
{ .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
{ .parent = &pad_clks_ck, .rates = div_1_1_rates },
{ .parent = &slimbus_clk, .rates = div_1_2_rates },
{ .parent = NULL },
};
static const char *dmic_fck_parents[] = {
"dmic_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
};
/* Merged func_dmic_abe_gfclk into dmic */
static struct clk dmic_fck;
DEFINE_CLK_OMAP_MUX_GATE(dmic_fck, "abe_clkdm", func_dmic_abe_gfclk_sel,
OMAP4430_CM1_ABE_DMIC_CLKCTRL,
OMAP4430_CLKSEL_SOURCE_MASK,
OMAP4430_CM1_ABE_DMIC_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
dmic_fck_parents, dmic_fck_ops);
DEFINE_CLK_GATE(dsp_fck, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, 0x0,
OMAP4430_CM_TESLA_TESLA_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(dss_sys_clk, "syc_clk_div_ck", &syc_clk_div_ck, 0x0,
OMAP4430_CM_DSS_DSS_CLKCTRL,
OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(dss_tv_clk, "extalt_clkin_ck", &extalt_clkin_ck, 0x0,
OMAP4430_CM_DSS_DSS_CLKCTRL,
OMAP4430_OPTFCLKEN_TV_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(dss_dss_clk, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, 0x0,
OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_DSSCLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(dss_48mhz_clk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(dss_fck, "l3_div_ck", &l3_div_ck, 0x0,
OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(efuse_ctrl_cust_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(emif1_fck, "ddrphy_ck", &ddrphy_ck, 0x0,
OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(emif2_fck, "ddrphy_ck", &ddrphy_ck, 0x0,
OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_DIVIDER(fdif_fck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
OMAP4430_CM_CAM_FDIF_CLKCTRL, OMAP4430_CLKSEL_FCLK_SHIFT,
OMAP4430_CLKSEL_FCLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
DEFINE_CLK_GATE(fpka_fck, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpio1_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpio1_ick, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, 0x0,
OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpio2_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_L4PER_GPIO2_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(gpio2_ick, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpio3_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpio3_ick, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpio4_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_L4PER_GPIO4_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(gpio4_ick, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpio5_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_L4PER_GPIO5_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(gpio5_ick, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpio6_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_L4PER_GPIO6_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(gpio6_ick, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(gpmc_ick, "l3_div_ck", &l3_div_ck, 0x0,
OMAP4430_CM_L3_2_GPMC_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
0x0, NULL);
static const struct clksel sgx_clk_mux_sel[] = {
{ .parent = &dpll_core_m7x2_ck, .rates = div_1_0_rates },
{ .parent = &dpll_per_m7x2_ck, .rates = div_1_1_rates },
{ .parent = NULL },
};
static const char *gpu_fck_parents[] = {
"dpll_core_m7x2_ck", "dpll_per_m7x2_ck",
};
/* Merged sgx_clk_mux into gpu */
DEFINE_CLK_OMAP_MUX_GATE(gpu_fck, "l3_gfx_clkdm", sgx_clk_mux_sel,
OMAP4430_CM_GFX_GFX_CLKCTRL,
OMAP4430_CLKSEL_SGX_FCLK_MASK,
OMAP4430_CM_GFX_GFX_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
gpu_fck_parents, dmic_fck_ops);
DEFINE_CLK_GATE(hdq1w_fck, "func_12m_fclk", &func_12m_fclk, 0x0,
OMAP4430_CM_L4PER_HDQ1W_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_DIVIDER(hsi_fck, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, 0x0,
OMAP4430_CM_L3INIT_HSI_CLKCTRL, OMAP4430_CLKSEL_24_25_SHIFT,
OMAP4430_CLKSEL_24_25_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
NULL);
DEFINE_CLK_GATE(i2c1_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
OMAP4430_CM_L4PER_I2C1_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(i2c2_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
OMAP4430_CM_L4PER_I2C2_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(i2c3_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
OMAP4430_CM_L4PER_I2C3_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(i2c4_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
OMAP4430_CM_L4PER_I2C4_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(ipu_fck, "ducati_clk_mux_ck", &ducati_clk_mux_ck, 0x0,
OMAP4430_CM_DUCATI_DUCATI_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(iss_ctrlclk, "func_96m_fclk", &func_96m_fclk, 0x0,
OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(iss_fck, "ducati_clk_mux_ck", &ducati_clk_mux_ck, 0x0,
OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(iva_fck, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, 0x0,
OMAP4430_CM_IVAHD_IVAHD_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(kbd_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
static struct clk l3_instr_ick;
static const char *l3_instr_ick_parent_names[] = {
"l3_div_ck",
};
static const struct clk_ops l3_instr_ick_ops = {
.enable = &omap2_dflt_clk_enable,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
.init = &omap2_init_clk_clkdm,
};
static struct clk_hw_omap l3_instr_ick_hw = {
.hw = {
.clk = &l3_instr_ick,
},
.enable_reg = OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL,
.enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
.clkdm_name = "l3_instr_clkdm",
};
DEFINE_STRUCT_CLK(l3_instr_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
static struct clk l3_main_3_ick;
static struct clk_hw_omap l3_main_3_ick_hw = {
.hw = {
.clk = &l3_main_3_ick,
},
.enable_reg = OMAP4430_CM_L3INSTR_L3_3_CLKCTRL,
.enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
.clkdm_name = "l3_instr_clkdm",
};
DEFINE_STRUCT_CLK(l3_main_3_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
DEFINE_CLK_MUX(mcasp_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
OMAP4430_CM1_ABE_MCASP_CLKCTRL,
OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
static const struct clksel func_mcasp_abe_gfclk_sel[] = {
{ .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
{ .parent = &pad_clks_ck, .rates = div_1_1_rates },
{ .parent = &slimbus_clk, .rates = div_1_2_rates },
{ .parent = NULL },
};
static const char *mcasp_fck_parents[] = {
"mcasp_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
};
/* Merged func_mcasp_abe_gfclk into mcasp */
DEFINE_CLK_OMAP_MUX_GATE(mcasp_fck, "abe_clkdm", func_mcasp_abe_gfclk_sel,
OMAP4430_CM1_ABE_MCASP_CLKCTRL,
OMAP4430_CLKSEL_SOURCE_MASK,
OMAP4430_CM1_ABE_MCASP_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
mcasp_fck_parents, dmic_fck_ops);
DEFINE_CLK_MUX(mcbsp1_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
static const struct clksel func_mcbsp1_gfclk_sel[] = {
{ .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
{ .parent = &pad_clks_ck, .rates = div_1_1_rates },
{ .parent = &slimbus_clk, .rates = div_1_2_rates },
{ .parent = NULL },
};
static const char *mcbsp1_fck_parents[] = {
"mcbsp1_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
};
/* Merged func_mcbsp1_gfclk into mcbsp1 */
DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "abe_clkdm", func_mcbsp1_gfclk_sel,
OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
OMAP4430_CLKSEL_SOURCE_MASK,
OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
mcbsp1_fck_parents, dmic_fck_ops);
DEFINE_CLK_MUX(mcbsp2_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
static const struct clksel func_mcbsp2_gfclk_sel[] = {
{ .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
{ .parent = &pad_clks_ck, .rates = div_1_1_rates },
{ .parent = &slimbus_clk, .rates = div_1_2_rates },
{ .parent = NULL },
};
static const char *mcbsp2_fck_parents[] = {
"mcbsp2_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
};
/* Merged func_mcbsp2_gfclk into mcbsp2 */
DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "abe_clkdm", func_mcbsp2_gfclk_sel,
OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
OMAP4430_CLKSEL_SOURCE_MASK,
OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
mcbsp2_fck_parents, dmic_fck_ops);
DEFINE_CLK_MUX(mcbsp3_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
static const struct clksel func_mcbsp3_gfclk_sel[] = {
{ .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
{ .parent = &pad_clks_ck, .rates = div_1_1_rates },
{ .parent = &slimbus_clk, .rates = div_1_2_rates },
{ .parent = NULL },
};
static const char *mcbsp3_fck_parents[] = {
"mcbsp3_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
};
/* Merged func_mcbsp3_gfclk into mcbsp3 */
DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "abe_clkdm", func_mcbsp3_gfclk_sel,
OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
OMAP4430_CLKSEL_SOURCE_MASK,
OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
mcbsp3_fck_parents, dmic_fck_ops);
static const char *mcbsp4_sync_mux_ck_parents[] = {
"func_96m_fclk", "per_abe_nc_fclk",
};
DEFINE_CLK_MUX(mcbsp4_sync_mux_ck, mcbsp4_sync_mux_ck_parents, NULL, 0x0,
OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
static const struct clksel per_mcbsp4_gfclk_sel[] = {
{ .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
{ .parent = &pad_clks_ck, .rates = div_1_1_rates },
{ .parent = NULL },
};
static const char *mcbsp4_fck_parents[] = {
"mcbsp4_sync_mux_ck", "pad_clks_ck",
};
/* Merged per_mcbsp4_gfclk into mcbsp4 */
DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "l4_per_clkdm", per_mcbsp4_gfclk_sel,
OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
OMAP4430_CLKSEL_SOURCE_24_24_MASK,
OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
mcbsp4_fck_parents, dmic_fck_ops);
DEFINE_CLK_GATE(mcpdm_fck, "pad_clks_ck", &pad_clks_ck, 0x0,
OMAP4430_CM1_ABE_PDM_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(mcspi1_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_MCSPI1_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(mcspi2_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_MCSPI2_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(mcspi3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_MCSPI3_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(mcspi4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_MCSPI4_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
static const struct clksel hsmmc1_fclk_sel[] = {
{ .parent = &func_64m_fclk, .rates = div_1_0_rates },
{ .parent = &func_96m_fclk, .rates = div_1_1_rates },
{ .parent = NULL },
};
static const char *mmc1_fck_parents[] = {
"func_64m_fclk", "func_96m_fclk",
};
/* Merged hsmmc1_fclk into mmc1 */
DEFINE_CLK_OMAP_MUX_GATE(mmc1_fck, "l3_init_clkdm", hsmmc1_fclk_sel,
OMAP4430_CM_L3INIT_MMC1_CLKCTRL, OMAP4430_CLKSEL_MASK,
OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
mmc1_fck_parents, dmic_fck_ops);
/* Merged hsmmc2_fclk into mmc2 */
DEFINE_CLK_OMAP_MUX_GATE(mmc2_fck, "l3_init_clkdm", hsmmc1_fclk_sel,
OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK,
OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
mmc1_fck_parents, dmic_fck_ops);
DEFINE_CLK_GATE(mmc3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_MMCSD3_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(mmc4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_MMCSD4_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(mmc5_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_MMCSD5_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(ocp2scp_usb_phy_phy_48m, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
OMAP4430_OPTFCLKEN_PHY_48M_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(ocp2scp_usb_phy_ick, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
static struct clk ocp_wp_noc_ick;
static struct clk_hw_omap ocp_wp_noc_ick_hw = {
.hw = {
.clk = &ocp_wp_noc_ick,
},
.enable_reg = OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL,
.enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
.clkdm_name = "l3_instr_clkdm",
};
DEFINE_STRUCT_CLK(ocp_wp_noc_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
DEFINE_CLK_GATE(rng_ick, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4SEC_RNG_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0,
OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(sl2if_ick, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, 0x0,
OMAP4430_CM_IVAHD_SL2_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(slimbus1_fclk_1, "func_24m_clk", &func_24m_clk, 0x0,
OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
OMAP4430_OPTFCLKEN_FCLK1_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(slimbus1_fclk_0, "abe_24m_fclk", &abe_24m_fclk, 0x0,
OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
OMAP4430_OPTFCLKEN_FCLK0_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(slimbus1_fclk_2, "pad_clks_ck", &pad_clks_ck, 0x0,
OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
OMAP4430_OPTFCLKEN_FCLK2_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(slimbus1_slimbus_clk, "slimbus_clk", &slimbus_clk, 0x0,
OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(slimbus1_fck, "ocp_abe_iclk", &ocp_abe_iclk, 0x0,
OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(slimbus2_fclk_1, "per_abe_24m_fclk", &per_abe_24m_fclk, 0x0,
OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(slimbus2_fclk_0, "func_24mc_fclk", &func_24mc_fclk, 0x0,
OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(slimbus2_slimbus_clk, "pad_slimbus_core_clks_ck",
&pad_slimbus_core_clks_ck, 0x0,
OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(slimbus2_fck, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(smartreflex_core_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
0x0, OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(smartreflex_iva_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
0x0, OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(smartreflex_mpu_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
0x0, OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
static const struct clksel dmt1_clk_mux_sel[] = {
{ .parent = &sys_clkin_ck, .rates = div_1_0_rates },
{ .parent = &sys_32k_ck, .rates = div_1_1_rates },
{ .parent = NULL },
};
/* Merged dmt1_clk_mux into timer1 */
DEFINE_CLK_OMAP_MUX_GATE(timer1_fck, "l4_wkup_clkdm", dmt1_clk_mux_sel,
OMAP4430_CM_WKUP_TIMER1_CLKCTRL, OMAP4430_CLKSEL_MASK,
OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
/* Merged cm2_dm10_mux into timer10 */
DEFINE_CLK_OMAP_MUX_GATE(timer10_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
OMAP4430_CLKSEL_MASK,
OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
/* Merged cm2_dm11_mux into timer11 */
DEFINE_CLK_OMAP_MUX_GATE(timer11_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
OMAP4430_CLKSEL_MASK,
OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
/* Merged cm2_dm2_mux into timer2 */
DEFINE_CLK_OMAP_MUX_GATE(timer2_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
OMAP4430_CLKSEL_MASK,
OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
/* Merged cm2_dm3_mux into timer3 */
DEFINE_CLK_OMAP_MUX_GATE(timer3_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
OMAP4430_CLKSEL_MASK,
OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
/* Merged cm2_dm4_mux into timer4 */
DEFINE_CLK_OMAP_MUX_GATE(timer4_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
OMAP4430_CLKSEL_MASK,
OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
static const struct clksel timer5_sync_mux_sel[] = {
{ .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
{ .parent = &sys_32k_ck, .rates = div_1_1_rates },
{ .parent = NULL },
};
static const char *timer5_fck_parents[] = {
"syc_clk_div_ck", "sys_32k_ck",
};
/* Merged timer5_sync_mux into timer5 */
DEFINE_CLK_OMAP_MUX_GATE(timer5_fck, "abe_clkdm", timer5_sync_mux_sel,
OMAP4430_CM1_ABE_TIMER5_CLKCTRL, OMAP4430_CLKSEL_MASK,
OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
timer5_fck_parents, dmic_fck_ops);
/* Merged timer6_sync_mux into timer6 */
DEFINE_CLK_OMAP_MUX_GATE(timer6_fck, "abe_clkdm", timer5_sync_mux_sel,
OMAP4430_CM1_ABE_TIMER6_CLKCTRL, OMAP4430_CLKSEL_MASK,
OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
timer5_fck_parents, dmic_fck_ops);
/* Merged timer7_sync_mux into timer7 */
DEFINE_CLK_OMAP_MUX_GATE(timer7_fck, "abe_clkdm", timer5_sync_mux_sel,
OMAP4430_CM1_ABE_TIMER7_CLKCTRL, OMAP4430_CLKSEL_MASK,
OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
timer5_fck_parents, dmic_fck_ops);
/* Merged timer8_sync_mux into timer8 */
DEFINE_CLK_OMAP_MUX_GATE(timer8_fck, "abe_clkdm", timer5_sync_mux_sel,
OMAP4430_CM1_ABE_TIMER8_CLKCTRL, OMAP4430_CLKSEL_MASK,
OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
timer5_fck_parents, dmic_fck_ops);
/* Merged cm2_dm9_mux into timer9 */
DEFINE_CLK_OMAP_MUX_GATE(timer9_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
OMAP4430_CLKSEL_MASK,
OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
DEFINE_CLK_GATE(uart1_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_UART1_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(uart2_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_UART2_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(uart3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_UART3_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(uart4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
OMAP4430_CM_L4PER_UART4_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
static struct clk usb_host_fs_fck;
static const char *usb_host_fs_fck_parent_names[] = {
"func_48mc_fclk",
};
static const struct clk_ops usb_host_fs_fck_ops = {
.enable = &omap2_dflt_clk_enable,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
};
static struct clk_hw_omap usb_host_fs_fck_hw = {
.hw = {
.clk = &usb_host_fs_fck,
},
.enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
.enable_bit = OMAP4430_MODULEMODE_SWCTRL_SHIFT,
.clkdm_name = "l3_init_clkdm",
};
DEFINE_STRUCT_CLK(usb_host_fs_fck, usb_host_fs_fck_parent_names,
usb_host_fs_fck_ops);
static const char *utmi_p1_gfclk_parents[] = {
"init_60m_fclk", "xclk60mhsp1_ck",
};
DEFINE_CLK_MUX(utmi_p1_gfclk, utmi_p1_gfclk_parents, NULL, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_CLKSEL_UTMI_P1_SHIFT, OMAP4430_CLKSEL_UTMI_P1_WIDTH,
0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_utmi_p1_clk, "utmi_p1_gfclk", &utmi_p1_gfclk, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, 0x0, NULL);
static const char *utmi_p2_gfclk_parents[] = {
"init_60m_fclk", "xclk60mhsp2_ck",
};
DEFINE_CLK_MUX(utmi_p2_gfclk, utmi_p2_gfclk_parents, NULL, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_CLKSEL_UTMI_P2_SHIFT, OMAP4430_CLKSEL_UTMI_P2_WIDTH,
0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_utmi_p2_clk, "utmi_p2_gfclk", &utmi_p2_gfclk, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_utmi_p3_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_hsic480m_p1_clk, "dpll_usb_m2_ck",
&dpll_usb_m2_ck, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_hsic60m_p1_clk, "init_60m_fclk",
&init_60m_fclk, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_hsic60m_p2_clk, "init_60m_fclk",
&init_60m_fclk, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_hsic480m_p2_clk, "dpll_usb_m2_ck",
&dpll_usb_m2_ck, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_func48mclk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_host_hs_fck, "init_60m_fclk", &init_60m_fclk, 0x0,
OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
static const char *otg_60m_gfclk_parents[] = {
"utmi_phy_clkout_ck", "xclk60motg_ck",
};
DEFINE_CLK_MUX(otg_60m_gfclk, otg_60m_gfclk_parents, NULL, 0x0,
OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL, OMAP4430_CLKSEL_60M_SHIFT,
OMAP4430_CLKSEL_60M_WIDTH, 0x0, NULL);
DEFINE_CLK_GATE(usb_otg_hs_xclk, "otg_60m_gfclk", &otg_60m_gfclk, 0x0,
OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
OMAP4430_OPTFCLKEN_XCLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_otg_hs_ick, "l3_div_ck", &l3_div_ck, 0x0,
OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_phy_cm_clk32k, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_ALWON_USBPHY_CLKCTRL,
OMAP4430_OPTFCLKEN_CLK32K_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_tll_hs_usb_ch2_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_tll_hs_usb_ch0_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_tll_hs_usb_ch1_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT, 0x0, NULL);
DEFINE_CLK_GATE(usb_tll_hs_ick, "l4_div_ck", &l4_div_ck, 0x0,
OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
static const struct clk_div_table usim_ck_rates[] = {
{ .div = 14, .val = 0 },
{ .div = 18, .val = 1 },
{ .div = 0 },
};
DEFINE_CLK_DIVIDER_TABLE(usim_ck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
OMAP4430_CM_WKUP_USIM_CLKCTRL,
OMAP4430_CLKSEL_DIV_SHIFT, OMAP4430_CLKSEL_DIV_WIDTH,
0x0, usim_ck_rates, NULL);
DEFINE_CLK_GATE(usim_fclk, "usim_ck", &usim_ck, 0x0,
OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_OPTFCLKEN_FCLK_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(usim_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(wd_timer2_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM_WKUP_WDT2_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
0x0, NULL);
DEFINE_CLK_GATE(wd_timer3_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
OMAP4430_CM1_ABE_WDT3_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
0x0, NULL);
/* Remaining optional clocks */
static const char *pmd_stm_clock_mux_ck_parents[] = {
"sys_clkin_ck", "dpll_core_m6x2_ck", "tie_low_clock_ck",
};
DEFINE_CLK_MUX(pmd_stm_clock_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
OMAP4430_CM_EMU_DEBUGSS_CLKCTRL, OMAP4430_PMD_STM_MUX_CTRL_SHIFT,
OMAP4430_PMD_STM_MUX_CTRL_WIDTH, 0x0, NULL);
DEFINE_CLK_MUX(pmd_trace_clk_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
OMAP4430_PMD_TRACE_MUX_CTRL_SHIFT,
OMAP4430_PMD_TRACE_MUX_CTRL_WIDTH, 0x0, NULL);
DEFINE_CLK_DIVIDER(stm_clk_div_ck, "pmd_stm_clock_mux_ck",
&pmd_stm_clock_mux_ck, 0x0, OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
OMAP4430_CLKSEL_PMD_STM_CLK_SHIFT,
OMAP4430_CLKSEL_PMD_STM_CLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
NULL);
static const char *trace_clk_div_ck_parents[] = {
"pmd_trace_clk_mux_ck",
};
static const struct clksel trace_clk_div_div[] = {
{ .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
{ .parent = NULL },
};
static struct clk trace_clk_div_ck;
static const struct clk_ops trace_clk_div_ck_ops = {
.recalc_rate = &omap2_clksel_recalc,
.set_rate = &omap2_clksel_set_rate,
.round_rate = &omap2_clksel_round_rate,
.init = &omap2_init_clk_clkdm,
.enable = &omap2_clkops_enable_clkdm,
.disable = &omap2_clkops_disable_clkdm,
};
static struct clk_hw_omap trace_clk_div_ck_hw = {
.hw = {
.clk = &trace_clk_div_ck,
},
.clkdm_name = "emu_sys_clkdm",
.clksel = trace_clk_div_div,
.clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
.clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
};
DEFINE_STRUCT_CLK(trace_clk_div_ck, trace_clk_div_ck_parents,
trace_clk_div_ck_ops);
/* SCRM aux clk nodes */
static const struct clksel auxclk_src_sel[] = {
{ .parent = &sys_clkin_ck, .rates = div_1_0_rates },
{ .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
{ .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
{ .parent = NULL },
};
static const char *auxclk_src_ck_parents[] = {
"sys_clkin_ck", "dpll_core_m3x2_ck", "dpll_per_m3x2_ck",
};
static const struct clk_ops auxclk_src_ck_ops = {
.enable = &omap2_dflt_clk_enable,
.disable = &omap2_dflt_clk_disable,
.is_enabled = &omap2_dflt_clk_is_enabled,
.recalc_rate = &omap2_clksel_recalc,
.get_parent = &omap2_clksel_find_parent_index,
};
DEFINE_CLK_OMAP_MUX_GATE(auxclk0_src_ck, NULL, auxclk_src_sel,
OMAP4_SCRM_AUXCLK0, OMAP4_SRCSELECT_MASK,
OMAP4_SCRM_AUXCLK0, OMAP4_ENABLE_SHIFT, NULL,
auxclk_src_ck_parents, auxclk_src_ck_ops);
DEFINE_CLK_DIVIDER(auxclk0_ck, "auxclk0_src_ck", &auxclk0_src_ck, 0x0,
OMAP4_SCRM_AUXCLK0, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
0x0, NULL);
DEFINE_CLK_OMAP_MUX_GATE(auxclk1_src_ck, NULL, auxclk_src_sel,
OMAP4_SCRM_AUXCLK1, OMAP4_SRCSELECT_MASK,
OMAP4_SCRM_AUXCLK1, OMAP4_ENABLE_SHIFT, NULL,
auxclk_src_ck_parents, auxclk_src_ck_ops);
DEFINE_CLK_DIVIDER(auxclk1_ck, "auxclk1_src_ck", &auxclk1_src_ck, 0x0,
OMAP4_SCRM_AUXCLK1, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
0x0, NULL);
DEFINE_CLK_OMAP_MUX_GATE(auxclk2_src_ck, NULL, auxclk_src_sel,
OMAP4_SCRM_AUXCLK2, OMAP4_SRCSELECT_MASK,
OMAP4_SCRM_AUXCLK2, OMAP4_ENABLE_SHIFT, NULL,
auxclk_src_ck_parents, auxclk_src_ck_ops);
DEFINE_CLK_DIVIDER(auxclk2_ck, "auxclk2_src_ck", &auxclk2_src_ck, 0x0,
OMAP4_SCRM_AUXCLK2, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
0x0, NULL);
DEFINE_CLK_OMAP_MUX_GATE(auxclk3_src_ck, NULL, auxclk_src_sel,
OMAP4_SCRM_AUXCLK3, OMAP4_SRCSELECT_MASK,
OMAP4_SCRM_AUXCLK3, OMAP4_ENABLE_SHIFT, NULL,
auxclk_src_ck_parents, auxclk_src_ck_ops);
DEFINE_CLK_DIVIDER(auxclk3_ck, "auxclk3_src_ck", &auxclk3_src_ck, 0x0,
OMAP4_SCRM_AUXCLK3, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
0x0, NULL);
DEFINE_CLK_OMAP_MUX_GATE(auxclk4_src_ck, NULL, auxclk_src_sel,
OMAP4_SCRM_AUXCLK4, OMAP4_SRCSELECT_MASK,
OMAP4_SCRM_AUXCLK4, OMAP4_ENABLE_SHIFT, NULL,
auxclk_src_ck_parents, auxclk_src_ck_ops);
DEFINE_CLK_DIVIDER(auxclk4_ck, "auxclk4_src_ck", &auxclk4_src_ck, 0x0,
OMAP4_SCRM_AUXCLK4, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
0x0, NULL);
DEFINE_CLK_OMAP_MUX_GATE(auxclk5_src_ck, NULL, auxclk_src_sel,
OMAP4_SCRM_AUXCLK5, OMAP4_SRCSELECT_MASK,
OMAP4_SCRM_AUXCLK5, OMAP4_ENABLE_SHIFT, NULL,
auxclk_src_ck_parents, auxclk_src_ck_ops);
DEFINE_CLK_DIVIDER(auxclk5_ck, "auxclk5_src_ck", &auxclk5_src_ck, 0x0,
OMAP4_SCRM_AUXCLK5, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
0x0, NULL);
static const char *auxclkreq_ck_parents[] = {
"auxclk0_ck", "auxclk1_ck", "auxclk2_ck", "auxclk3_ck", "auxclk4_ck",
"auxclk5_ck",
};
DEFINE_CLK_MUX(auxclkreq0_ck, auxclkreq_ck_parents, NULL, 0x0,
OMAP4_SCRM_AUXCLKREQ0, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
0x0, NULL);
DEFINE_CLK_MUX(auxclkreq1_ck, auxclkreq_ck_parents, NULL, 0x0,
OMAP4_SCRM_AUXCLKREQ1, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
0x0, NULL);
DEFINE_CLK_MUX(auxclkreq2_ck, auxclkreq_ck_parents, NULL, 0x0,
OMAP4_SCRM_AUXCLKREQ2, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
0x0, NULL);
DEFINE_CLK_MUX(auxclkreq3_ck, auxclkreq_ck_parents, NULL, 0x0,
OMAP4_SCRM_AUXCLKREQ3, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
0x0, NULL);
DEFINE_CLK_MUX(auxclkreq4_ck, auxclkreq_ck_parents, NULL, 0x0,
OMAP4_SCRM_AUXCLKREQ4, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
0x0, NULL);
DEFINE_CLK_MUX(auxclkreq5_ck, auxclkreq_ck_parents, NULL, 0x0,
OMAP4_SCRM_AUXCLKREQ5, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
0x0, NULL);
/*
* clkdev
*/
static struct omap_clk omap44xx_clks[] = {
CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X),
CLK(NULL, "pad_clks_src_ck", &pad_clks_src_ck, CK_443X),
CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X),
CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X),
CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X),
CLK(NULL, "slimbus_src_clk", &slimbus_src_clk, CK_443X),
CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X),
CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X),
CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X),
CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X),
CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X),
CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X),
CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X),
CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X),
CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X),
CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X),
CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck, CK_443X),
CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X),
CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X),
CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X),
CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X),
CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck, CK_443X),
CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X),
CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X),
CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck, CK_443X),
CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X),
CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X),
CLK(NULL, "abe_clk", &abe_clk, CK_443X),
CLK(NULL, "aess_fclk", &aess_fclk, CK_443X),
CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck, CK_443X),
CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X),
CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X),
CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_443X),
CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck, CK_443X),
CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X),
CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X),
CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X),
CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, CK_443X),
CLK(NULL, "div_core_ck", &div_core_ck, CK_443X),
CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X),
CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X),
CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck, CK_443X),
CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X),
CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X),
CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck, CK_443X),
CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck, CK_443X),
CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X),
CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X),
CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck, CK_443X),
CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, CK_443X),
CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, CK_443X),
CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X),
CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X),
CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X),
CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X),
CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X),
CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X),
CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck, CK_443X),
CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X),
CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck, CK_443X),
CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, CK_443X),
CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, CK_443X),
CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck, CK_443X),
CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck, CK_443X),
CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X),
CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X),
CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X),
CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X),
CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X),
CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X),
CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X),
CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X),
CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X),
CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X),
CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X),
CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X),
CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X),
CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X),
CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
CLK("smp_twd", NULL, &mpu_periphclk, CK_443X),
CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X),
CLK(NULL, "aes1_fck", &aes1_fck, CK_443X),
CLK(NULL, "aes2_fck", &aes2_fck, CK_443X),
CLK(NULL, "aess_fck", &aess_fck, CK_443X),
CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X),
CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X),
CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X),
CLK(NULL, "des3des_fck", &des3des_fck, CK_443X),
CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
CLK(NULL, "dmic_fck", &dmic_fck, CK_443X),
CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X),
CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
CLK(NULL, "dss_fck", &dss_fck, CK_443X),
CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
CLK(NULL, "fdif_fck", &fdif_fck, CK_443X),
CLK(NULL, "fpka_fck", &fpka_fck, CK_443X),
CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_443X),
CLK(NULL, "gpio1_ick", &gpio1_ick, CK_443X),
CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_443X),
CLK(NULL, "gpio2_ick", &gpio2_ick, CK_443X),
CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_443X),
CLK(NULL, "gpio3_ick", &gpio3_ick, CK_443X),
CLK(NULL, "gpio4_dbclk", &gpio4_dbclk, CK_443X),
CLK(NULL, "gpio4_ick", &gpio4_ick, CK_443X),
CLK(NULL, "gpio5_dbclk", &gpio5_dbclk, CK_443X),
CLK(NULL, "gpio5_ick", &gpio5_ick, CK_443X),
CLK(NULL, "gpio6_dbclk", &gpio6_dbclk, CK_443X),
CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X),
CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X),
CLK(NULL, "gpu_fck", &gpu_fck, CK_443X),
CLK(NULL, "hdq1w_fck", &hdq1w_fck, CK_443X),
CLK(NULL, "hsi_fck", &hsi_fck, CK_443X),
CLK(NULL, "i2c1_fck", &i2c1_fck, CK_443X),
CLK(NULL, "i2c2_fck", &i2c2_fck, CK_443X),
CLK(NULL, "i2c3_fck", &i2c3_fck, CK_443X),
CLK(NULL, "i2c4_fck", &i2c4_fck, CK_443X),
CLK(NULL, "ipu_fck", &ipu_fck, CK_443X),
CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X),
CLK(NULL, "iss_fck", &iss_fck, CK_443X),
CLK(NULL, "iva_fck", &iva_fck, CK_443X),
CLK(NULL, "kbd_fck", &kbd_fck, CK_443X),
CLK(NULL, "l3_instr_ick", &l3_instr_ick, CK_443X),
CLK(NULL, "l3_main_3_ick", &l3_main_3_ick, CK_443X),
CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X),
CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_443X),
CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_443X),
CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_443X),
CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_443X),
CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X),
CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_443X),
CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_443X),
CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_443X),
CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_443X),
CLK(NULL, "mmc1_fck", &mmc1_fck, CK_443X),
CLK(NULL, "mmc2_fck", &mmc2_fck, CK_443X),
CLK(NULL, "mmc3_fck", &mmc3_fck, CK_443X),
CLK(NULL, "mmc4_fck", &mmc4_fck, CK_443X),
CLK(NULL, "mmc5_fck", &mmc5_fck, CK_443X),
CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
CLK(NULL, "rng_ick", &rng_ick, CK_443X),
CLK("omap_rng", "ick", &rng_ick, CK_443X),
CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X),
CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X),
CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X),
CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2, CK_443X),
CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk, CK_443X),
CLK(NULL, "slimbus1_fck", &slimbus1_fck, CK_443X),
CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1, CK_443X),
CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X),
CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X),
CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X),
CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X),
CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X),
CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X),
CLK(NULL, "timer1_fck", &timer1_fck, CK_443X),
CLK(NULL, "timer10_fck", &timer10_fck, CK_443X),
CLK(NULL, "timer11_fck", &timer11_fck, CK_443X),
CLK(NULL, "timer2_fck", &timer2_fck, CK_443X),
CLK(NULL, "timer3_fck", &timer3_fck, CK_443X),
CLK(NULL, "timer4_fck", &timer4_fck, CK_443X),
CLK(NULL, "timer5_fck", &timer5_fck, CK_443X),
CLK(NULL, "timer6_fck", &timer6_fck, CK_443X),
CLK(NULL, "timer7_fck", &timer7_fck, CK_443X),
CLK(NULL, "timer8_fck", &timer8_fck, CK_443X),
CLK(NULL, "timer9_fck", &timer9_fck, CK_443X),
CLK(NULL, "uart1_fck", &uart1_fck, CK_443X),
CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X),
CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk, CK_443X),
CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk, CK_443X),
CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk, CK_443X),
CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk, CK_443X),
CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X),
CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X),
CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X),
CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
CLK(NULL, "usim_ck", &usim_ck, CK_443X),
CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
CLK(NULL, "usim_fck", &usim_fck, CK_443X),
CLK(NULL, "wd_timer2_fck", &wd_timer2_fck, CK_443X),
CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X),
CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X),
CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X),
CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X),
CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X),
CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X),
CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X),
CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X),
CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X),
CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X),
CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X),
CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X),
CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X),
CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X),
CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
CLK("omap-gpmc", "fck", &dummy_ck, CK_443X),
CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
CLK("omap_i2c.4", "ick", &dummy_ck, CK_443X),
CLK(NULL, "mailboxes_ick", &dummy_ck, CK_443X),
CLK("omap_hsmmc.0", "ick", &dummy_ck, CK_443X),
CLK("omap_hsmmc.1", "ick", &dummy_ck, CK_443X),
CLK("omap_hsmmc.2", "ick", &dummy_ck, CK_443X),
CLK("omap_hsmmc.3", "ick", &dummy_ck, CK_443X),
CLK("omap_hsmmc.4", "ick", &dummy_ck, CK_443X),
CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_443X),
CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X),
CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X),
CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X),
CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X),
CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X),
CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X),
CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X),
CLK(NULL, "uart1_ick", &dummy_ck, CK_443X),
CLK(NULL, "uart2_ick", &dummy_ck, CK_443X),
CLK(NULL, "uart3_ick", &dummy_ck, CK_443X),
CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
/* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X),
};
static const char *enable_init_clks[] = {
"emif1_fck",
"emif2_fck",
"gpmc_ick",
"l3_instr_ick",
"l3_main_3_ick",
"ocp_wp_noc_ick",
};
int __init omap4xxx_clk_init(void)
{
u32 cpu_clkflg;
struct omap_clk *c;
if (cpu_is_omap443x()) {
cpu_mask = RATE_IN_4430;
cpu_clkflg = CK_443X;
} else if (cpu_is_omap446x() || cpu_is_omap447x()) {
cpu_mask = RATE_IN_4460 | RATE_IN_4430;
cpu_clkflg = CK_446X | CK_443X;
if (cpu_is_omap447x())
pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
} else {
return 0;
}
for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
c++) {
if (c->cpu & cpu_clkflg) {
clkdev_add(&c->lk);
if (!__clk_init(NULL, c->lk.clk))
omap2_init_clk_hw_omap_clocks(c->lk.clk);
}
}
omap2_clk_disable_autoidle_all();
omap2_clk_enable_init_clocks(enable_init_clks,
ARRAY_SIZE(enable_init_clks));
return 0;
}
...@@ -38,62 +38,88 @@ ...@@ -38,62 +38,88 @@
/* Private functions */ /* Private functions */
static int _apll96_enable(struct clk *clk) /**
* omap2xxx_clk_apll_locked - is the APLL locked?
* @hw: struct clk_hw * of the APLL to check
*
* If the APLL IP block referred to by @hw indicates that it's locked,
* return true; otherwise, return false.
*/
static bool omap2xxx_clk_apll_locked(struct clk_hw *hw)
{
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 r, apll_mask;
apll_mask = EN_APLL_LOCKED << clk->enable_bit;
r = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
return ((r & apll_mask) == apll_mask) ? true : false;
}
int omap2_clk_apll96_enable(struct clk_hw *hw)
{ {
return omap2xxx_cm_apll96_enable(); return omap2xxx_cm_apll96_enable();
} }
static int _apll54_enable(struct clk *clk) int omap2_clk_apll54_enable(struct clk_hw *hw)
{ {
return omap2xxx_cm_apll54_enable(); return omap2xxx_cm_apll54_enable();
} }
static void _apll96_allow_idle(struct clk *clk) static void _apll96_allow_idle(struct clk_hw_omap *clk)
{ {
omap2xxx_cm_set_apll96_auto_low_power_stop(); omap2xxx_cm_set_apll96_auto_low_power_stop();
} }
static void _apll96_deny_idle(struct clk *clk) static void _apll96_deny_idle(struct clk_hw_omap *clk)
{ {
omap2xxx_cm_set_apll96_disable_autoidle(); omap2xxx_cm_set_apll96_disable_autoidle();
} }
static void _apll54_allow_idle(struct clk *clk) static void _apll54_allow_idle(struct clk_hw_omap *clk)
{ {
omap2xxx_cm_set_apll54_auto_low_power_stop(); omap2xxx_cm_set_apll54_auto_low_power_stop();
} }
static void _apll54_deny_idle(struct clk *clk) static void _apll54_deny_idle(struct clk_hw_omap *clk)
{ {
omap2xxx_cm_set_apll54_disable_autoidle(); omap2xxx_cm_set_apll54_disable_autoidle();
} }
static void _apll96_disable(struct clk *clk) void omap2_clk_apll96_disable(struct clk_hw *hw)
{ {
omap2xxx_cm_apll96_disable(); omap2xxx_cm_apll96_disable();
} }
static void _apll54_disable(struct clk *clk) void omap2_clk_apll54_disable(struct clk_hw *hw)
{ {
omap2xxx_cm_apll54_disable(); omap2xxx_cm_apll54_disable();
} }
/* Public data */ unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw,
unsigned long parent_rate)
{
return (omap2xxx_clk_apll_locked(hw)) ? 54000000 : 0;
}
const struct clkops clkops_apll96 = { unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw,
.enable = _apll96_enable, unsigned long parent_rate)
.disable = _apll96_disable, {
.allow_idle = _apll96_allow_idle, return (omap2xxx_clk_apll_locked(hw)) ? 96000000 : 0;
.deny_idle = _apll96_deny_idle, }
};
const struct clkops clkops_apll54 = { /* Public data */
.enable = _apll54_enable, const struct clk_hw_omap_ops clkhwops_apll54 = {
.disable = _apll54_disable,
.allow_idle = _apll54_allow_idle, .allow_idle = _apll54_allow_idle,
.deny_idle = _apll54_deny_idle, .deny_idle = _apll54_deny_idle,
}; };
const struct clk_hw_omap_ops clkhwops_apll96 = {
.allow_idle = _apll96_allow_idle,
.deny_idle = _apll96_deny_idle,
};
/* Public functions */ /* Public functions */
u32 omap2xxx_get_apll_clkin(void) u32 omap2xxx_get_apll_clkin(void)
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* REVISIT: DPLL can optionally enter low-power bypass by writing 0x1 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1
* instead. Add some mechanism to optionally enter this mode. * instead. Add some mechanism to optionally enter this mode.
*/ */
static void _allow_idle(struct clk *clk) static void _allow_idle(struct clk_hw_omap *clk)
{ {
if (!clk || !clk->dpll_data) if (!clk || !clk->dpll_data)
return; return;
...@@ -43,7 +43,7 @@ static void _allow_idle(struct clk *clk) ...@@ -43,7 +43,7 @@ static void _allow_idle(struct clk *clk)
* *
* Disable DPLL automatic idle control. No return value. * Disable DPLL automatic idle control. No return value.
*/ */
static void _deny_idle(struct clk *clk) static void _deny_idle(struct clk_hw_omap *clk)
{ {
if (!clk || !clk->dpll_data) if (!clk || !clk->dpll_data)
return; return;
...@@ -53,9 +53,7 @@ static void _deny_idle(struct clk *clk) ...@@ -53,9 +53,7 @@ static void _deny_idle(struct clk *clk)
/* Public data */ /* Public data */
const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll = {
const struct clkops clkops_omap2xxx_dpll_ops = {
.allow_idle = _allow_idle, .allow_idle = _allow_idle,
.deny_idle = _deny_idle, .deny_idle = _deny_idle,
}; };
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
* (currently defined as "dpll_ck" in the OMAP2xxx clock tree). Set * (currently defined as "dpll_ck" in the OMAP2xxx clock tree). Set
* during dpll_ck init and used later by omap2xxx_clk_get_core_rate(). * during dpll_ck init and used later by omap2xxx_clk_get_core_rate().
*/ */
static struct clk *dpll_core_ck; static struct clk_hw_omap *dpll_core_ck;
/** /**
* omap2xxx_clk_get_core_rate - return the CORE_CLK rate * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
...@@ -105,13 +105,16 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate) ...@@ -105,13 +105,16 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
} }
unsigned long omap2_dpllcore_recalc(struct clk *clk) unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
unsigned long parent_rate)
{ {
return omap2xxx_clk_get_core_rate(); return omap2xxx_clk_get_core_rate();
} }
int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 cur_rate, low, mult, div, valid_rate, done_rate; u32 cur_rate, low, mult, div, valid_rate, done_rate;
u32 bypass = 0; u32 bypass = 0;
struct prcm_config tmpset; struct prcm_config tmpset;
...@@ -189,8 +192,8 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) ...@@ -189,8 +192,8 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
* statically defined, this code may need to change to increment some * statically defined, this code may need to change to increment some
* kind of use count on dpll_ck. * kind of use count on dpll_ck.
*/ */
void omap2xxx_clkt_dpllcore_init(struct clk *clk) void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw)
{ {
WARN(dpll_core_ck, "dpll_core_ck already set - should never happen"); WARN(dpll_core_ck, "dpll_core_ck already set - should never happen");
dpll_core_ck = clk; dpll_core_ck = to_clk_hw_omap(hw);
} }
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
* clk_enable/clk_disable()-based usecounting for osc_ck should be * clk_enable/clk_disable()-based usecounting for osc_ck should be
* replaced with autoidle-based usecounting. * replaced with autoidle-based usecounting.
*/ */
static int omap2_enable_osc_ck(struct clk *clk) int omap2_enable_osc_ck(struct clk_hw *clk)
{ {
u32 pcc; u32 pcc;
...@@ -53,7 +53,7 @@ static int omap2_enable_osc_ck(struct clk *clk) ...@@ -53,7 +53,7 @@ static int omap2_enable_osc_ck(struct clk *clk)
* clk_enable/clk_disable()-based usecounting for osc_ck should be * clk_enable/clk_disable()-based usecounting for osc_ck should be
* replaced with autoidle-based usecounting. * replaced with autoidle-based usecounting.
*/ */
static void omap2_disable_osc_ck(struct clk *clk) void omap2_disable_osc_ck(struct clk_hw *clk)
{ {
u32 pcc; u32 pcc;
...@@ -62,13 +62,8 @@ static void omap2_disable_osc_ck(struct clk *clk) ...@@ -62,13 +62,8 @@ static void omap2_disable_osc_ck(struct clk *clk)
__raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl); __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
} }
const struct clkops clkops_oscck = { unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
.enable = omap2_enable_osc_ck, unsigned long parent_rate)
.disable = omap2_disable_osc_ck,
};
unsigned long omap2_osc_clk_recalc(struct clk *clk)
{ {
return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv(); return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv();
} }
...@@ -40,9 +40,8 @@ u32 omap2xxx_get_sysclkdiv(void) ...@@ -40,9 +40,8 @@ u32 omap2xxx_get_sysclkdiv(void)
return div; return div;
} }
unsigned long omap2xxx_sys_clk_recalc(struct clk *clk) unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
unsigned long parent_rate)
{ {
return clk->parent->rate / omap2xxx_get_sysclkdiv(); return parent_rate / omap2xxx_get_sysclkdiv();
} }
...@@ -59,7 +59,8 @@ static unsigned long sys_ck_rate; ...@@ -59,7 +59,8 @@ static unsigned long sys_ck_rate;
* *
* Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set. * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set.
*/ */
unsigned long omap2_table_mpu_recalc(struct clk *clk) unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
unsigned long parent_rate)
{ {
return curr_prcm_set->mpu_speed; return curr_prcm_set->mpu_speed;
} }
...@@ -71,7 +72,8 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk) ...@@ -71,7 +72,8 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk)
* Some might argue L3-DDR, others ARM, others IVA. This code is simple and * Some might argue L3-DDR, others ARM, others IVA. This code is simple and
* just uses the ARM rates. * just uses the ARM rates.
*/ */
long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{ {
const struct prcm_config *ptr; const struct prcm_config *ptr;
long highest_rate; long highest_rate;
...@@ -94,7 +96,8 @@ long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) ...@@ -94,7 +96,8 @@ long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
} }
/* Sets basic clocks based on the specified rate */ /* Sets basic clocks based on the specified rate */
int omap2_select_table_rate(struct clk *clk, unsigned long rate) int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ {
u32 cur_rate, done_rate, bypass = 0, tmp; u32 cur_rate, done_rate, bypass = 0, tmp;
const struct prcm_config *prcm; const struct prcm_config *prcm;
......
...@@ -45,8 +45,10 @@ ...@@ -45,8 +45,10 @@
* Program the DPLL M2 divider with the rounded target rate. Returns * Program the DPLL M2 divider with the rounded target rate. Returns
* -EINVAL upon error, or 0 upon success. * -EINVAL upon error, or 0 upon success.
*/ */
int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) int omap3_core_dpll_m2_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 new_div = 0; u32 new_div = 0;
u32 unlock_dll = 0; u32 unlock_dll = 0;
u32 c; u32 c;
...@@ -64,7 +66,7 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) ...@@ -64,7 +66,7 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
return -EINVAL; return -EINVAL;
sdrcrate = __clk_get_rate(sdrc_ick_p); sdrcrate = __clk_get_rate(sdrc_ick_p);
clkrate = __clk_get_rate(clk); clkrate = __clk_get_rate(hw->clk);
if (rate > clkrate) if (rate > clkrate)
sdrcrate <<= ((rate / clkrate) >> 1); sdrcrate <<= ((rate / clkrate) >> 1);
else else
...@@ -113,8 +115,6 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) ...@@ -113,8 +115,6 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
0, 0, 0, 0); 0, 0, 0, 0);
clk->rate = rate;
return 0; return 0;
} }
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/clk.h> #include <linux/clk-provider.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/bug.h> #include <linux/bug.h>
...@@ -58,11 +58,14 @@ ...@@ -58,11 +58,14 @@
* the element associated with the supplied parent clock address. * the element associated with the supplied parent clock address.
* Returns a pointer to the struct clksel on success or NULL on error. * Returns a pointer to the struct clksel on success or NULL on error.
*/ */
static const struct clksel *_get_clksel_by_parent(struct clk *clk, static const struct clksel *_get_clksel_by_parent(struct clk_hw_omap *clk,
struct clk *src_clk) struct clk *src_clk)
{ {
const struct clksel *clks; const struct clksel *clks;
if (!src_clk)
return NULL;
for (clks = clk->clksel; clks->parent; clks++) for (clks = clk->clksel; clks->parent; clks++)
if (clks->parent == src_clk) if (clks->parent == src_clk)
break; /* Found the requested parent */ break; /* Found the requested parent */
...@@ -70,71 +73,13 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk, ...@@ -70,71 +73,13 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk,
if (!clks->parent) { if (!clks->parent) {
/* This indicates a data problem */ /* This indicates a data problem */
WARN(1, "clock: %s: could not find parent clock %s in clksel array\n", WARN(1, "clock: %s: could not find parent clock %s in clksel array\n",
__clk_get_name(clk), __clk_get_name(src_clk)); __clk_get_name(clk->hw.clk), __clk_get_name(src_clk));
return NULL; return NULL;
} }
return clks; return clks;
} }
/**
* _get_div_and_fieldval() - find the new clksel divisor and field value to use
* @src_clk: planned new parent struct clk *
* @clk: struct clk * that is being reparented
* @field_val: pointer to a u32 to contain the register data for the divisor
*
* Given an intended new parent struct clk * @src_clk, and the struct
* clk * @clk to the clock that is being reparented, find the
* appropriate rate divisor for the new clock (returned as the return
* value), and the corresponding register bitfield data to program to
* reach that divisor (returned in the u32 pointed to by @field_val).
* Returns 0 on error, or returns the newly-selected divisor upon
* success (in this latter case, the corresponding register bitfield
* value is passed back in the variable pointed to by @field_val)
*/
static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
u32 *field_val)
{
const struct clksel *clks;
const struct clksel_rate *clkr, *max_clkr = NULL;
u8 max_div = 0;
clks = _get_clksel_by_parent(clk, src_clk);
if (!clks)
return 0;
/*
* Find the highest divisor (e.g., the one resulting in the
* lowest rate) to use as the default. This should avoid
* clock rates that are too high for the device. XXX A better
* solution here would be to try to determine if there is a
* divisor matching the original clock rate before the parent
* switch, and if it cannot be found, to fall back to the
* highest divisor.
*/
for (clkr = clks->rates; clkr->div; clkr++) {
if (!(clkr->flags & cpu_mask))
continue;
if (clkr->div > max_div) {
max_div = clkr->div;
max_clkr = clkr;
}
}
if (max_div == 0) {
/* This indicates an error in the clksel data */
WARN(1, "clock: %s: could not find divisor for parent %s\n",
__clk_get_name(clk),
__clk_get_name(__clk_get_parent(src_clk)));
return 0;
}
*field_val = max_clkr->val;
return max_div;
}
/** /**
* _write_clksel_reg() - program a clock's clksel register in hardware * _write_clksel_reg() - program a clock's clksel register in hardware
* @clk: struct clk * to program * @clk: struct clk * to program
...@@ -148,7 +93,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk, ...@@ -148,7 +93,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
* take into account any time the hardware might take to switch the * take into account any time the hardware might take to switch the
* clock source. * clock source.
*/ */
static void _write_clksel_reg(struct clk *clk, u32 field_val) static void _write_clksel_reg(struct clk_hw_omap *clk, u32 field_val)
{ {
u32 v; u32 v;
...@@ -171,13 +116,14 @@ static void _write_clksel_reg(struct clk *clk, u32 field_val) ...@@ -171,13 +116,14 @@ static void _write_clksel_reg(struct clk *clk, u32 field_val)
* before calling. Returns 0 on error or returns the actual integer divisor * before calling. Returns 0 on error or returns the actual integer divisor
* upon success. * upon success.
*/ */
static u32 _clksel_to_divisor(struct clk *clk, u32 field_val) static u32 _clksel_to_divisor(struct clk_hw_omap *clk, u32 field_val)
{ {
const struct clksel *clks; const struct clksel *clks;
const struct clksel_rate *clkr; const struct clksel_rate *clkr;
struct clk *parent; struct clk *parent;
parent = __clk_get_parent(clk); parent = __clk_get_parent(clk->hw.clk);
clks = _get_clksel_by_parent(clk, parent); clks = _get_clksel_by_parent(clk, parent);
if (!clks) if (!clks)
return 0; return 0;
...@@ -193,7 +139,8 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val) ...@@ -193,7 +139,8 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
if (!clkr->div) { if (!clkr->div) {
/* This indicates a data error */ /* This indicates a data error */
WARN(1, "clock: %s: could not find fieldval %d for parent %s\n", WARN(1, "clock: %s: could not find fieldval %d for parent %s\n",
__clk_get_name(clk), field_val, __clk_get_name(parent)); __clk_get_name(clk->hw.clk), field_val,
__clk_get_name(parent));
return 0; return 0;
} }
...@@ -210,7 +157,7 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val) ...@@ -210,7 +157,7 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
* register field value _before_ left-shifting (i.e., LSB is at bit * register field value _before_ left-shifting (i.e., LSB is at bit
* 0); or returns 0xFFFFFFFF (~0) upon error. * 0); or returns 0xFFFFFFFF (~0) upon error.
*/ */
static u32 _divisor_to_clksel(struct clk *clk, u32 div) static u32 _divisor_to_clksel(struct clk_hw_omap *clk, u32 div)
{ {
const struct clksel *clks; const struct clksel *clks;
const struct clksel_rate *clkr; const struct clksel_rate *clkr;
...@@ -219,7 +166,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div) ...@@ -219,7 +166,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
/* should never happen */ /* should never happen */
WARN_ON(div == 0); WARN_ON(div == 0);
parent = __clk_get_parent(clk); parent = __clk_get_parent(clk->hw.clk);
clks = _get_clksel_by_parent(clk, parent); clks = _get_clksel_by_parent(clk, parent);
if (!clks) if (!clks)
return ~0; return ~0;
...@@ -234,7 +181,8 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div) ...@@ -234,7 +181,8 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
if (!clkr->div) { if (!clkr->div) {
pr_err("clock: %s: could not find divisor %d for parent %s\n", pr_err("clock: %s: could not find divisor %d for parent %s\n",
__clk_get_name(clk), div, __clk_get_name(parent)); __clk_get_name(clk->hw.clk), div,
__clk_get_name(parent));
return ~0; return ~0;
} }
...@@ -249,7 +197,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div) ...@@ -249,7 +197,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
* into the hardware, convert it into the actual divisor value, and * into the hardware, convert it into the actual divisor value, and
* return it; or return 0 on error. * return it; or return 0 on error.
*/ */
static u32 _read_divisor(struct clk *clk) static u32 _read_divisor(struct clk_hw_omap *clk)
{ {
u32 v; u32 v;
...@@ -277,7 +225,8 @@ static u32 _read_divisor(struct clk *clk) ...@@ -277,7 +225,8 @@ static u32 _read_divisor(struct clk *clk)
* *
* Returns the rounded clock rate or returns 0xffffffff on error. * Returns the rounded clock rate or returns 0xffffffff on error.
*/ */
u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk,
unsigned long target_rate,
u32 *new_div) u32 *new_div)
{ {
unsigned long test_rate; unsigned long test_rate;
...@@ -288,9 +237,9 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, ...@@ -288,9 +237,9 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
unsigned long parent_rate; unsigned long parent_rate;
const char *clk_name; const char *clk_name;
parent = __clk_get_parent(clk); parent = __clk_get_parent(clk->hw.clk);
clk_name = __clk_get_name(clk->hw.clk);
parent_rate = __clk_get_rate(parent); parent_rate = __clk_get_rate(parent);
clk_name = __clk_get_name(clk);
if (!clk->clksel || !clk->clksel_mask) if (!clk->clksel || !clk->clksel_mask)
return ~0; return ~0;
...@@ -341,27 +290,35 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, ...@@ -341,27 +290,35 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
*/ */
/** /**
* omap2_init_clksel_parent() - set a clksel clk's parent field from the hdwr * omap2_clksel_find_parent_index() - return the array index of the current
* @clk: OMAP clock struct ptr to use * hardware parent of @hw
* @hw: struct clk_hw * to find the current hardware parent of
* *
* Given a pointer @clk to a source-selectable struct clk, read the * Given a struct clk_hw pointer @hw to the 'hw' member of a struct
* hardware register and determine what its parent is currently set * clk_hw_omap record representing a source-selectable hardware clock,
* to. Update @clk's .parent field with the appropriate clk ptr. No * read the hardware register and determine what its parent is
* return value. * currently set to. Intended to be called only by the common clock
* framework struct clk_hw_ops.get_parent function pointer. Return
* the array index of this parent clock upon success -- there is no
* way to return an error, so if we encounter an error, just WARN()
* and pretend that we know that we're doing.
*/ */
void omap2_init_clksel_parent(struct clk *clk) u8 omap2_clksel_find_parent_index(struct clk_hw *hw)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
const struct clksel *clks; const struct clksel *clks;
const struct clksel_rate *clkr; const struct clksel_rate *clkr;
u32 r, found = 0; u32 r, found = 0;
struct clk *parent; struct clk *parent;
const char *clk_name; const char *clk_name;
int ret = 0, f = 0;
if (!clk->clksel || !clk->clksel_mask) parent = __clk_get_parent(hw->clk);
return; clk_name = __clk_get_name(hw->clk);
parent = __clk_get_parent(clk); /* XXX should be able to return an error */
clk_name = __clk_get_name(clk); WARN((!clk->clksel || !clk->clksel_mask),
"clock: %s: attempt to call on a non-clksel clock", clk_name);
r = __raw_readl(clk->clksel_reg) & clk->clksel_mask; r = __raw_readl(clk->clksel_reg) & clk->clksel_mask;
r >>= __ffs(clk->clksel_mask); r >>= __ffs(clk->clksel_mask);
...@@ -372,27 +329,21 @@ void omap2_init_clksel_parent(struct clk *clk) ...@@ -372,27 +329,21 @@ void omap2_init_clksel_parent(struct clk *clk)
continue; continue;
if (clkr->val == r) { if (clkr->val == r) {
if (parent != clks->parent) {
pr_debug("clock: %s: inited parent to %s (was %s)\n",
clk_name,
__clk_get_name(clks->parent),
((parent) ?
__clk_get_name(parent) :
"NULL"));
clk_reparent(clk, clks->parent);
}
found = 1; found = 1;
ret = f;
} }
} }
f++;
} }
/* This indicates a data error */ /* This indicates a data error */
WARN(!found, "clock: %s: init parent: could not find regval %0x\n", WARN(!found, "clock: %s: init parent: could not find regval %0x\n",
clk_name, r); clk_name, r);
return; return ret;
} }
/** /**
* omap2_clksel_recalc() - function ptr to pass via struct clk .recalc field * omap2_clksel_recalc() - function ptr to pass via struct clk .recalc field
* @clk: struct clk * * @clk: struct clk *
...@@ -402,21 +353,23 @@ void omap2_init_clksel_parent(struct clk *clk) ...@@ -402,21 +353,23 @@ void omap2_init_clksel_parent(struct clk *clk)
* function. Returns the clock's current rate, based on its parent's rate * function. Returns the clock's current rate, based on its parent's rate
* and its current divisor setting in the hardware. * and its current divisor setting in the hardware.
*/ */
unsigned long omap2_clksel_recalc(struct clk *clk) unsigned long omap2_clksel_recalc(struct clk_hw *hw, unsigned long parent_rate)
{ {
unsigned long rate; unsigned long rate;
u32 div = 0; u32 div = 0;
struct clk *parent; struct clk_hw_omap *clk = to_clk_hw_omap(hw);
div = _read_divisor(clk); if (!parent_rate)
if (div == 0) return 0;
return __clk_get_rate(clk);
parent = __clk_get_parent(clk); div = _read_divisor(clk);
rate = __clk_get_rate(parent) / div; if (!div)
rate = parent_rate;
else
rate = parent_rate / div;
pr_debug("clock: %s: recalc'd rate is %ld (div %d)\n", pr_debug("%s: recalc'd %s's rate to %lu (div %d)\n", __func__,
__clk_get_name(clk), rate, div); __clk_get_name(hw->clk), rate, div);
return rate; return rate;
} }
...@@ -432,8 +385,10 @@ unsigned long omap2_clksel_recalc(struct clk *clk) ...@@ -432,8 +385,10 @@ unsigned long omap2_clksel_recalc(struct clk *clk)
* *
* Returns the rounded clock rate or returns 0xffffffff on error. * Returns the rounded clock rate or returns 0xffffffff on error.
*/ */
long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate) long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate,
unsigned long *parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 new_div; u32 new_div;
return omap2_clksel_round_rate_div(clk, target_rate, &new_div); return omap2_clksel_round_rate_div(clk, target_rate, &new_div);
...@@ -454,8 +409,10 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate) ...@@ -454,8 +409,10 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate)
* is changed, they will all be affected without any notification. * is changed, they will all be affected without any notification.
* Returns -EINVAL upon error, or 0 upon success. * Returns -EINVAL upon error, or 0 upon success.
*/ */
int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 field_val, validrate, new_div = 0; u32 field_val, validrate, new_div = 0;
if (!clk->clksel || !clk->clksel_mask) if (!clk->clksel || !clk->clksel_mask)
...@@ -471,10 +428,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) ...@@ -471,10 +428,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
_write_clksel_reg(clk, field_val); _write_clksel_reg(clk, field_val);
clk->rate = __clk_get_rate(__clk_get_parent(clk)) / new_div; pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(hw->clk),
__clk_get_rate(hw->clk));
pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(clk),
__clk_get_rate(clk));
return 0; return 0;
} }
...@@ -499,32 +454,13 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) ...@@ -499,32 +454,13 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
* affected without any notification. Returns -EINVAL upon error, or * affected without any notification. Returns -EINVAL upon error, or
* 0 upon success. * 0 upon success.
*/ */
int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent) int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val)
{ {
u32 field_val = 0; struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 parent_div;
if (!clk->clksel || !clk->clksel_mask) if (!clk->clksel || !clk->clksel_mask)
return -EINVAL; return -EINVAL;
parent_div = _get_div_and_fieldval(new_parent, clk, &field_val);
if (!parent_div)
return -EINVAL;
_write_clksel_reg(clk, field_val); _write_clksel_reg(clk, field_val);
clk_reparent(clk, new_parent);
/* CLKSEL clocks follow their parents' rates, divided by a divisor */
clk->rate = __clk_get_rate(new_parent);
if (parent_div > 0)
__clk_get_rate(clk) /= parent_div;
pr_debug("clock: %s: set parent to %s (new rate %ld)\n",
__clk_get_name(clk),
__clk_get_name(__clk_get_parent(clk)),
__clk_get_rate(clk));
return 0; return 0;
} }
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/clk.h> #include <linux/clk-provider.h>
#include <linux/io.h> #include <linux/io.h>
#include <asm/div64.h> #include <asm/div64.h>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
* (assuming that it is counting N upwards), or -2 if the enclosing loop * (assuming that it is counting N upwards), or -2 if the enclosing loop
* should skip to the next iteration (again assuming N is increasing). * should skip to the next iteration (again assuming N is increasing).
*/ */
static int _dpll_test_fint(struct clk *clk, u8 n) static int _dpll_test_fint(struct clk_hw_omap *clk, u8 n)
{ {
struct dpll_data *dd; struct dpll_data *dd;
long fint, fint_min, fint_max; long fint, fint_min, fint_max;
...@@ -85,7 +85,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n) ...@@ -85,7 +85,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n)
dd = clk->dpll_data; dd = clk->dpll_data;
/* DPLL divider must result in a valid jitter correction val */ /* DPLL divider must result in a valid jitter correction val */
fint = __clk_get_rate(__clk_get_parent(clk)) / n; fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n;
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
/* Should not be called for OMAP2, so warn if it is called */ /* Should not be called for OMAP2, so warn if it is called */
...@@ -186,15 +186,15 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate, ...@@ -186,15 +186,15 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
} }
/* Public functions */ /* Public functions */
u8 omap2_init_dpll_parent(struct clk_hw *hw)
void omap2_init_dpll_parent(struct clk *clk)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 v; u32 v;
struct dpll_data *dd; struct dpll_data *dd;
dd = clk->dpll_data; dd = clk->dpll_data;
if (!dd) if (!dd)
return; return -EINVAL;
v = __raw_readl(dd->control_reg); v = __raw_readl(dd->control_reg);
v &= dd->enable_mask; v &= dd->enable_mask;
...@@ -204,18 +204,18 @@ void omap2_init_dpll_parent(struct clk *clk) ...@@ -204,18 +204,18 @@ void omap2_init_dpll_parent(struct clk *clk)
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
if (v == OMAP2XXX_EN_DPLL_LPBYPASS || if (v == OMAP2XXX_EN_DPLL_LPBYPASS ||
v == OMAP2XXX_EN_DPLL_FRBYPASS) v == OMAP2XXX_EN_DPLL_FRBYPASS)
clk_reparent(clk, dd->clk_bypass); return 1;
} else if (cpu_is_omap34xx()) { } else if (cpu_is_omap34xx()) {
if (v == OMAP3XXX_EN_DPLL_LPBYPASS || if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
v == OMAP3XXX_EN_DPLL_FRBYPASS) v == OMAP3XXX_EN_DPLL_FRBYPASS)
clk_reparent(clk, dd->clk_bypass); return 1;
} else if (soc_is_am33xx() || cpu_is_omap44xx()) { } else if (soc_is_am33xx() || cpu_is_omap44xx()) {
if (v == OMAP4XXX_EN_DPLL_LPBYPASS || if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
v == OMAP4XXX_EN_DPLL_FRBYPASS || v == OMAP4XXX_EN_DPLL_FRBYPASS ||
v == OMAP4XXX_EN_DPLL_MNBYPASS) v == OMAP4XXX_EN_DPLL_MNBYPASS)
clk_reparent(clk, dd->clk_bypass); return 1;
} }
return; return 0;
} }
/** /**
...@@ -232,7 +232,7 @@ void omap2_init_dpll_parent(struct clk *clk) ...@@ -232,7 +232,7 @@ void omap2_init_dpll_parent(struct clk *clk)
* locked, or the appropriate bypass rate if the DPLL is bypassed, or 0 * locked, or the appropriate bypass rate if the DPLL is bypassed, or 0
* if the clock @clk is not a DPLL. * if the clock @clk is not a DPLL.
*/ */
u32 omap2_get_dpll_rate(struct clk *clk) unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
{ {
long long dpll_clk; long long dpll_clk;
u32 dpll_mult, dpll_div, v; u32 dpll_mult, dpll_div, v;
...@@ -288,8 +288,10 @@ u32 omap2_get_dpll_rate(struct clk *clk) ...@@ -288,8 +288,10 @@ u32 omap2_get_dpll_rate(struct clk *clk)
* (expensive) function again. Returns ~0 if the target rate cannot * (expensive) function again. Returns ~0 if the target rate cannot
* be rounded, or the rounded rate upon success. * be rounded, or the rounded rate upon success.
*/ */
long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
unsigned long *parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
int m, n, r, scaled_max_m; int m, n, r, scaled_max_m;
unsigned long scaled_rt_rp; unsigned long scaled_rt_rp;
unsigned long new_rate = 0; unsigned long new_rate = 0;
...@@ -303,7 +305,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) ...@@ -303,7 +305,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
dd = clk->dpll_data; dd = clk->dpll_data;
ref_rate = __clk_get_rate(dd->clk_ref); ref_rate = __clk_get_rate(dd->clk_ref);
clk_name = __clk_get_name(clk); clk_name = __clk_get_name(hw->clk);
pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n", pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n",
clk_name, target_rate); clk_name, target_rate);
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#undef DEBUG #undef DEBUG
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/clk.h> #include <linux/clk-provider.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
/* Private functions */ /* Private functions */
/* XXX */ /* XXX */
void omap2_clkt_iclk_allow_idle(struct clk *clk) void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk)
{ {
u32 v, r; u32 v, r;
...@@ -35,7 +35,7 @@ void omap2_clkt_iclk_allow_idle(struct clk *clk) ...@@ -35,7 +35,7 @@ void omap2_clkt_iclk_allow_idle(struct clk *clk)
} }
/* XXX */ /* XXX */
void omap2_clkt_iclk_deny_idle(struct clk *clk) void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
{ {
u32 v, r; u32 v, r;
...@@ -48,33 +48,17 @@ void omap2_clkt_iclk_deny_idle(struct clk *clk) ...@@ -48,33 +48,17 @@ void omap2_clkt_iclk_deny_idle(struct clk *clk)
/* Public data */ /* Public data */
const struct clkops clkops_omap2_iclk_dflt_wait = { const struct clk_hw_omap_ops clkhwops_iclk = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_companion = omap2_clk_dflt_find_companion,
.find_idlest = omap2_clk_dflt_find_idlest,
.allow_idle = omap2_clkt_iclk_allow_idle, .allow_idle = omap2_clkt_iclk_allow_idle,
.deny_idle = omap2_clkt_iclk_deny_idle, .deny_idle = omap2_clkt_iclk_deny_idle,
}; };
const struct clkops clkops_omap2_iclk_dflt = { const struct clk_hw_omap_ops clkhwops_iclk_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.allow_idle = omap2_clkt_iclk_allow_idle, .allow_idle = omap2_clkt_iclk_allow_idle,
.deny_idle = omap2_clkt_iclk_deny_idle, .deny_idle = omap2_clkt_iclk_deny_idle,
.find_idlest = omap2_clk_dflt_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
}; };
const struct clkops clkops_omap2_iclk_idle_only = {
.allow_idle = omap2_clkt_iclk_allow_idle,
.deny_idle = omap2_clkt_iclk_deny_idle,
};
const struct clkops clkops_omap2_mdmclk_dflt_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_companion = omap2_clk_dflt_find_companion,
.find_idlest = omap2_clk_dflt_find_idlest,
.allow_idle = omap2_clkt_iclk_allow_idle,
.deny_idle = omap2_clkt_iclk_deny_idle,
};
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/clk.h> #include <linux/clk-provider.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/bitops.h> #include <linux/bitops.h>
...@@ -55,9 +55,28 @@ u16 cpu_mask; ...@@ -55,9 +55,28 @@ u16 cpu_mask;
*/ */
static bool clkdm_control = true; static bool clkdm_control = true;
static LIST_HEAD(clocks); static LIST_HEAD(clk_hw_omap_clocks);
static DEFINE_MUTEX(clocks_mutex);
static DEFINE_SPINLOCK(clockfw_lock); /*
* Used for clocks that have the same value as the parent clock,
* divided by some factor
*/
unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
unsigned long parent_rate)
{
struct clk_hw_omap *oclk;
if (!hw) {
pr_warn("%s: hw is NULL\n", __func__);
return -EINVAL;
}
oclk = to_clk_hw_omap(hw);
WARN_ON(!oclk->fixed_div);
return parent_rate / oclk->fixed_div;
}
/* /*
* OMAP2+ specific clock functions * OMAP2+ specific clock functions
...@@ -109,7 +128,7 @@ static int _wait_idlest_generic(void __iomem *reg, u32 mask, u8 idlest, ...@@ -109,7 +128,7 @@ static int _wait_idlest_generic(void __iomem *reg, u32 mask, u8 idlest,
* belong in the clock code and will be moved in the medium term to * belong in the clock code and will be moved in the medium term to
* module-dependent code. No return value. * module-dependent code. No return value.
*/ */
static void _omap2_module_wait_ready(struct clk *clk) static void _omap2_module_wait_ready(struct clk_hw_omap *clk)
{ {
void __iomem *companion_reg, *idlest_reg; void __iomem *companion_reg, *idlest_reg;
u8 other_bit, idlest_bit, idlest_val, idlest_reg_id; u8 other_bit, idlest_bit, idlest_val, idlest_reg_id;
...@@ -124,12 +143,11 @@ static void _omap2_module_wait_ready(struct clk *clk) ...@@ -124,12 +143,11 @@ static void _omap2_module_wait_ready(struct clk *clk)
} }
clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val);
r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id); r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id);
if (r) { if (r) {
/* IDLEST register not in the CM module */ /* IDLEST register not in the CM module */
_wait_idlest_generic(idlest_reg, (1 << idlest_bit), idlest_val, _wait_idlest_generic(idlest_reg, (1 << idlest_bit), idlest_val,
clk->name); __clk_get_name(clk->hw.clk));
} else { } else {
cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit); cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit);
}; };
...@@ -145,15 +163,16 @@ static void _omap2_module_wait_ready(struct clk *clk) ...@@ -145,15 +163,16 @@ static void _omap2_module_wait_ready(struct clk *clk)
* clockdomain pointer, and save it into the struct clk. Intended to be * clockdomain pointer, and save it into the struct clk. Intended to be
* called during clk_register(). No return value. * called during clk_register(). No return value.
*/ */
void omap2_init_clk_clkdm(struct clk *clk) void omap2_init_clk_clkdm(struct clk_hw *hw)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
struct clockdomain *clkdm; struct clockdomain *clkdm;
const char *clk_name; const char *clk_name;
if (!clk->clkdm_name) if (!clk->clkdm_name)
return; return;
clk_name = __clk_get_name(clk); clk_name = __clk_get_name(hw->clk);
clkdm = clkdm_lookup(clk->clkdm_name); clkdm = clkdm_lookup(clk->clkdm_name);
if (clkdm) { if (clkdm) {
...@@ -200,8 +219,8 @@ void __init omap2_clk_disable_clkdm_control(void) ...@@ -200,8 +219,8 @@ void __init omap2_clk_disable_clkdm_control(void)
* associate this type of code with per-module data structures to * associate this type of code with per-module data structures to
* avoid this issue, and remove the casts. No return value. * avoid this issue, and remove the casts. No return value.
*/ */
void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
u8 *other_bit) void __iomem **other_reg, u8 *other_bit)
{ {
u32 r; u32 r;
...@@ -229,8 +248,8 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, ...@@ -229,8 +248,8 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
* register address ID (e.g., that CM_FCLKEN2 corresponds to * register address ID (e.g., that CM_FCLKEN2 corresponds to
* CM_IDLEST2). This is not true for all modules. No return value. * CM_IDLEST2). This is not true for all modules. No return value.
*/ */
void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
u8 *idlest_bit, u8 *idlest_val) void __iomem **idlest_reg, u8 *idlest_bit, u8 *idlest_val)
{ {
u32 r; u32 r;
...@@ -252,16 +271,44 @@ void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, ...@@ -252,16 +271,44 @@ void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
} }
int omap2_dflt_clk_enable(struct clk *clk) /**
* omap2_dflt_clk_enable - enable a clock in the hardware
* @hw: struct clk_hw * of the clock to enable
*
* Enable the clock @hw in the hardware. We first call into the OMAP
* clockdomain code to "enable" the corresponding clockdomain if this
* is the first enabled user of the clockdomain. Then program the
* hardware to enable the clock. Then wait for the IP block that uses
* this clock to leave idle (if applicable). Returns the error value
* from clkdm_clk_enable() if it terminated with an error, or -EINVAL
* if @hw has a null clock enable_reg, or zero upon success.
*/
int omap2_dflt_clk_enable(struct clk_hw *hw)
{ {
struct clk_hw_omap *clk;
u32 v; u32 v;
int ret = 0;
clk = to_clk_hw_omap(hw);
if (clkdm_control && clk->clkdm) {
ret = clkdm_clk_enable(clk->clkdm, hw->clk);
if (ret) {
WARN(1, "%s: could not enable %s's clockdomain %s: %d\n",
__func__, __clk_get_name(hw->clk),
clk->clkdm->name, ret);
return ret;
}
}
if (unlikely(clk->enable_reg == NULL)) { if (unlikely(clk->enable_reg == NULL)) {
pr_err("clock.c: Enable for %s without enable code\n", pr_err("%s: %s missing enable_reg\n", __func__,
clk->name); __clk_get_name(hw->clk));
return 0; /* REVISIT: -EINVAL */ ret = -EINVAL;
goto err;
} }
/* FIXME should not have INVERT_ENABLE bit here */
v = __raw_readl(clk->enable_reg); v = __raw_readl(clk->enable_reg);
if (clk->flags & INVERT_ENABLE) if (clk->flags & INVERT_ENABLE)
v &= ~(1 << clk->enable_bit); v &= ~(1 << clk->enable_bit);
...@@ -270,22 +317,39 @@ int omap2_dflt_clk_enable(struct clk *clk) ...@@ -270,22 +317,39 @@ int omap2_dflt_clk_enable(struct clk *clk)
__raw_writel(v, clk->enable_reg); __raw_writel(v, clk->enable_reg);
v = __raw_readl(clk->enable_reg); /* OCP barrier */ v = __raw_readl(clk->enable_reg); /* OCP barrier */
if (clk->ops->find_idlest) if (clk->ops && clk->ops->find_idlest)
_omap2_module_wait_ready(clk); _omap2_module_wait_ready(clk);
return 0; return 0;
err:
if (clkdm_control && clk->clkdm)
clkdm_clk_disable(clk->clkdm, hw->clk);
return ret;
} }
void omap2_dflt_clk_disable(struct clk *clk) /**
* omap2_dflt_clk_disable - disable a clock in the hardware
* @hw: struct clk_hw * of the clock to disable
*
* Disable the clock @hw in the hardware, and call into the OMAP
* clockdomain code to "disable" the corresponding clockdomain if all
* clocks/hwmods in that clockdomain are now disabled. No return
* value.
*/
void omap2_dflt_clk_disable(struct clk_hw *hw)
{ {
struct clk_hw_omap *clk;
u32 v; u32 v;
clk = to_clk_hw_omap(hw);
if (!clk->enable_reg) { if (!clk->enable_reg) {
/* /*
* 'Independent' here refers to a clock which is not * 'independent' here refers to a clock which is not
* controlled by its parent. * controlled by its parent.
*/ */
pr_err("clock: clk_disable called on independent clock %s which has no enable_reg\n", clk->name); pr_err("%s: independent clock %s has no enable_reg\n",
__func__, __clk_get_name(hw->clk));
return; return;
} }
...@@ -296,191 +360,213 @@ void omap2_dflt_clk_disable(struct clk *clk) ...@@ -296,191 +360,213 @@ void omap2_dflt_clk_disable(struct clk *clk)
v &= ~(1 << clk->enable_bit); v &= ~(1 << clk->enable_bit);
__raw_writel(v, clk->enable_reg); __raw_writel(v, clk->enable_reg);
/* No OCP barrier needed here since it is a disable operation */ /* No OCP barrier needed here since it is a disable operation */
}
const struct clkops clkops_omap2_dflt_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_companion = omap2_clk_dflt_find_companion,
.find_idlest = omap2_clk_dflt_find_idlest,
};
const struct clkops clkops_omap2_dflt = { if (clkdm_control && clk->clkdm)
.enable = omap2_dflt_clk_enable, clkdm_clk_disable(clk->clkdm, hw->clk);
.disable = omap2_dflt_clk_disable, }
};
/** /**
* omap2_clk_disable - disable a clock, if the system is not using it * omap2_clkops_enable_clkdm - increment usecount on clkdm of @hw
* @clk: struct clk * to disable * @hw: struct clk_hw * of the clock being enabled
* *
* Decrements the usecount on struct clk @clk. If there are no users * Increment the usecount of the clockdomain of the clock pointed to
* left, call the clkops-specific clock disable function to disable it * by @hw; if the usecount is 1, the clockdomain will be "enabled."
* in hardware. If the clock is part of a clockdomain (which they all * Only needed for clocks that don't use omap2_dflt_clk_enable() as
* should be), request that the clockdomain be disabled. (It too has * their enable function pointer. Passes along the return value of
* a usecount, and so will not be disabled in the hardware until it no * clkdm_clk_enable(), -EINVAL if @hw is not associated with a
* longer has any users.) If the clock has a parent clock (most of * clockdomain, or 0 if clock framework-based clockdomain control is
* them do), then call ourselves, recursing on the parent clock. This * not implemented.
* can cause an entire branch of the clock tree to be powered off by
* simply disabling one clock. Intended to be called with the clockfw_lock
* spinlock held. No return value.
*/ */
void omap2_clk_disable(struct clk *clk) int omap2_clkops_enable_clkdm(struct clk_hw *hw)
{ {
if (clk->usecount == 0) { struct clk_hw_omap *clk;
WARN(1, "clock: %s: omap2_clk_disable() called, but usecount already 0?", clk->name); int ret = 0;
return;
}
pr_debug("clock: %s: decrementing usecount\n", clk->name);
clk->usecount--; clk = to_clk_hw_omap(hw);
if (clk->usecount > 0) if (unlikely(!clk->clkdm)) {
return; pr_err("%s: %s: no clkdm set ?!\n", __func__,
__clk_get_name(hw->clk));
return -EINVAL;
}
pr_debug("clock: %s: disabling in hardware\n", clk->name); if (unlikely(clk->enable_reg))
pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__,
__clk_get_name(hw->clk));
if (clk->ops && clk->ops->disable) { if (!clkdm_control) {
trace_clock_disable(clk->name, 0, smp_processor_id()); pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
clk->ops->disable(clk); __func__, __clk_get_name(hw->clk));
return 0;
} }
if (clkdm_control && clk->clkdm) ret = clkdm_clk_enable(clk->clkdm, hw->clk);
clkdm_clk_disable(clk->clkdm, clk); WARN(ret, "%s: could not enable %s's clockdomain %s: %d\n",
__func__, __clk_get_name(hw->clk), clk->clkdm->name, ret);
if (clk->parent) return ret;
omap2_clk_disable(clk->parent);
} }
/** /**
* omap2_clk_enable - request that the system enable a clock * omap2_clkops_disable_clkdm - decrement usecount on clkdm of @hw
* @clk: struct clk * to enable * @hw: struct clk_hw * of the clock being disabled
* *
* Increments the usecount on struct clk @clk. If there were no users * Decrement the usecount of the clockdomain of the clock pointed to
* previously, then recurse up the clock tree, enabling all of the * by @hw; if the usecount is 0, the clockdomain will be "disabled."
* clock's parents and all of the parent clockdomains, and finally, * Only needed for clocks that don't use omap2_dflt_clk_disable() as their
* enabling @clk's clockdomain, and @clk itself. Intended to be * disable function pointer. No return value.
* called with the clockfw_lock spinlock held. Returns 0 upon success
* or a negative error code upon failure.
*/ */
int omap2_clk_enable(struct clk *clk) void omap2_clkops_disable_clkdm(struct clk_hw *hw)
{ {
int ret; struct clk_hw_omap *clk;
pr_debug("clock: %s: incrementing usecount\n", clk->name);
clk->usecount++; clk = to_clk_hw_omap(hw);
if (clk->usecount > 1) if (unlikely(!clk->clkdm)) {
return 0; pr_err("%s: %s: no clkdm set ?!\n", __func__,
__clk_get_name(hw->clk));
return;
}
pr_debug("clock: %s: enabling in hardware\n", clk->name); if (unlikely(clk->enable_reg))
pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__,
__clk_get_name(hw->clk));
if (clk->parent) { if (!clkdm_control) {
ret = omap2_clk_enable(clk->parent); pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
if (ret) { __func__, __clk_get_name(hw->clk));
WARN(1, "clock: %s: could not enable parent %s: %d\n", return;
clk->name, clk->parent->name, ret);
goto oce_err1;
}
} }
if (clkdm_control && clk->clkdm) { clkdm_clk_disable(clk->clkdm, hw->clk);
ret = clkdm_clk_enable(clk->clkdm, clk); }
if (ret) {
WARN(1, "clock: %s: could not enable clockdomain %s: %d\n",
clk->name, clk->clkdm->name, ret);
goto oce_err2;
}
}
if (clk->ops && clk->ops->enable) { /**
trace_clock_enable(clk->name, 1, smp_processor_id()); * omap2_dflt_clk_is_enabled - is clock enabled in the hardware?
ret = clk->ops->enable(clk); * @hw: struct clk_hw * to check
if (ret) { *
WARN(1, "clock: %s: could not enable: %d\n", * Return 1 if the clock represented by @hw is enabled in the
clk->name, ret); * hardware, or 0 otherwise. Intended for use in the struct
goto oce_err3; * clk_ops.is_enabled function pointer.
} */
} int omap2_dflt_clk_is_enabled(struct clk_hw *hw)
{
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 v;
return 0; v = __raw_readl(clk->enable_reg);
oce_err3: if (clk->flags & INVERT_ENABLE)
if (clkdm_control && clk->clkdm) v ^= BIT(clk->enable_bit);
clkdm_clk_disable(clk->clkdm, clk);
oce_err2:
if (clk->parent)
omap2_clk_disable(clk->parent);
oce_err1:
clk->usecount--;
return ret; v &= BIT(clk->enable_bit);
return v ? 1 : 0;
} }
/* Given a clock and a rate apply a clock specific rounding function */ static int __initdata mpurate;
long omap2_clk_round_rate(struct clk *clk, unsigned long rate)
/*
* By default we use the rate set by the bootloader.
* You can override this with mpurate= cmdline option.
*/
static int __init omap_clk_setup(char *str)
{ {
if (clk->round_rate) get_option(&str, &mpurate);
return clk->round_rate(clk, rate);
return clk->rate; if (!mpurate)
return 1;
if (mpurate < 1000)
mpurate *= 1000000;
return 1;
} }
__setup("mpurate=", omap_clk_setup);
/* Set the clock rate for a clock source */ /**
int omap2_clk_set_rate(struct clk *clk, unsigned long rate) * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
* @clk: struct clk * to initialize
*
* Add an OMAP clock @clk to the internal list of OMAP clocks. Used
* temporarily for autoidle handling, until this support can be
* integrated into the common clock framework code in some way. No
* return value.
*/
void omap2_init_clk_hw_omap_clocks(struct clk *clk)
{ {
int ret = -EINVAL; struct clk_hw_omap *c;
pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate);
/* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */ if (__clk_get_flags(clk) & CLK_IS_BASIC)
if (clk->set_rate) { return;
trace_clock_set_rate(clk->name, rate, smp_processor_id());
ret = clk->set_rate(clk, rate);
}
return ret; c = to_clk_hw_omap(__clk_get_hw(clk));
list_add(&c->node, &clk_hw_omap_clocks);
} }
int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) /**
* omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that
* support it
*
* Enable clock autoidle on all OMAP clocks that have allow_idle
* function pointers associated with them. This function is intended
* to be temporary until support for this is added to the common clock
* code. Returns 0.
*/
int omap2_clk_enable_autoidle_all(void)
{ {
if (!clk->clksel) struct clk_hw_omap *c;
return -EINVAL;
if (clk->parent == new_parent) list_for_each_entry(c, &clk_hw_omap_clocks, node)
if (c->ops && c->ops->allow_idle)
c->ops->allow_idle(c);
return 0; return 0;
return omap2_clksel_set_parent(clk, new_parent);
} }
/* /**
* OMAP2+ clock reset and init functions * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that
* support it
*
* Disable clock autoidle on all OMAP clocks that have allow_idle
* function pointers associated with them. This function is intended
* to be temporary until support for this is added to the common clock
* code. Returns 0.
*/ */
int omap2_clk_disable_autoidle_all(void)
#ifdef CONFIG_OMAP_RESET_CLOCKS
void omap2_clk_disable_unused(struct clk *clk)
{ {
u32 regval32, v; struct clk_hw_omap *c;
v = (clk->flags & INVERT_ENABLE) ? (1 << clk->enable_bit) : 0; list_for_each_entry(c, &clk_hw_omap_clocks, node)
if (c->ops && c->ops->deny_idle)
c->ops->deny_idle(c);
return 0;
}
regval32 = __raw_readl(clk->enable_reg); /**
if ((regval32 & (1 << clk->enable_bit)) == v) * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
return; * @clk_names: ptr to an array of strings of clock names to enable
* @num_clocks: number of clock names in @clk_names
*
* Prepare and enable a list of clocks, named by @clk_names. No
* return value. XXX Deprecated; only needed until these clocks are
* properly claimed and enabled by the drivers or core code that uses
* them. XXX What code disables & calls clk_put on these clocks?
*/
void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
{
struct clk *init_clk;
int i;
pr_debug("Disabling unused clock \"%s\"\n", clk->name); for (i = 0; i < num_clocks; i++) {
if (cpu_is_omap34xx()) { init_clk = clk_get(NULL, clk_names[i]);
omap2_clk_enable(clk); clk_prepare_enable(init_clk);
omap2_clk_disable(clk);
} else {
clk->ops->disable(clk);
} }
if (clk->clkdm != NULL)
pwrdm_state_switch(clk->clkdm->pwrdm.ptr);
} }
#endif
const struct clk_hw_omap_ops clkhwops_wait = {
.find_idlest = omap2_clk_dflt_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
};
/** /**
* omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument
...@@ -512,14 +598,12 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name) ...@@ -512,14 +598,12 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name)
r = clk_set_rate(mpurate_ck, mpurate); r = clk_set_rate(mpurate_ck, mpurate);
if (IS_ERR_VALUE(r)) { if (IS_ERR_VALUE(r)) {
WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n",
mpurate_ck->name, mpurate, r); mpurate_ck_name, mpurate, r);
clk_put(mpurate_ck); clk_put(mpurate_ck);
return -EINVAL; return -EINVAL;
} }
calibrate_delay(); calibrate_delay();
recalculate_root_clocks();
clk_put(mpurate_ck); clk_put(mpurate_ck);
return 0; return 0;
...@@ -563,513 +647,3 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name, ...@@ -563,513 +647,3 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
(clk_get_rate(core_ck) / 1000000), (clk_get_rate(core_ck) / 1000000),
(clk_get_rate(mpu_ck) / 1000000)); (clk_get_rate(mpu_ck) / 1000000));
} }
/* Common data */
int clk_enable(struct clk *clk)
{
unsigned long flags;
int ret;
if (clk == NULL || IS_ERR(clk))
return -EINVAL;
spin_lock_irqsave(&clockfw_lock, flags);
ret = omap2_clk_enable(clk);
spin_unlock_irqrestore(&clockfw_lock, flags);
return ret;
}
EXPORT_SYMBOL(clk_enable);
void clk_disable(struct clk *clk)
{
unsigned long flags;
if (clk == NULL || IS_ERR(clk))
return;
spin_lock_irqsave(&clockfw_lock, flags);
if (clk->usecount == 0) {
pr_err("Trying disable clock %s with 0 usecount\n",
clk->name);
WARN_ON(1);
goto out;
}
omap2_clk_disable(clk);
out:
spin_unlock_irqrestore(&clockfw_lock, flags);
}
EXPORT_SYMBOL(clk_disable);
unsigned long clk_get_rate(struct clk *clk)
{
unsigned long flags;
unsigned long ret;
if (clk == NULL || IS_ERR(clk))
return 0;
spin_lock_irqsave(&clockfw_lock, flags);
ret = clk->rate;
spin_unlock_irqrestore(&clockfw_lock, flags);
return ret;
}
EXPORT_SYMBOL(clk_get_rate);
/*
* Optional clock functions defined in include/linux/clk.h
*/
long clk_round_rate(struct clk *clk, unsigned long rate)
{
unsigned long flags;
long ret;
if (clk == NULL || IS_ERR(clk))
return 0;
spin_lock_irqsave(&clockfw_lock, flags);
ret = omap2_clk_round_rate(clk, rate);
spin_unlock_irqrestore(&clockfw_lock, flags);
return ret;
}
EXPORT_SYMBOL(clk_round_rate);
int clk_set_rate(struct clk *clk, unsigned long rate)
{
unsigned long flags;
int ret = -EINVAL;
if (clk == NULL || IS_ERR(clk))
return ret;
spin_lock_irqsave(&clockfw_lock, flags);
ret = omap2_clk_set_rate(clk, rate);
if (ret == 0)
propagate_rate(clk);
spin_unlock_irqrestore(&clockfw_lock, flags);
return ret;
}
EXPORT_SYMBOL(clk_set_rate);
int clk_set_parent(struct clk *clk, struct clk *parent)
{
unsigned long flags;
int ret = -EINVAL;
if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent))
return ret;
spin_lock_irqsave(&clockfw_lock, flags);
if (clk->usecount == 0) {
ret = omap2_clk_set_parent(clk, parent);
if (ret == 0)
propagate_rate(clk);
} else {
ret = -EBUSY;
}
spin_unlock_irqrestore(&clockfw_lock, flags);
return ret;
}
EXPORT_SYMBOL(clk_set_parent);
struct clk *clk_get_parent(struct clk *clk)
{
return clk->parent;
}
EXPORT_SYMBOL(clk_get_parent);
/*
* OMAP specific clock functions shared between omap1 and omap2
*/
int __initdata mpurate;
/*
* By default we use the rate set by the bootloader.
* You can override this with mpurate= cmdline option.
*/
static int __init omap_clk_setup(char *str)
{
get_option(&str, &mpurate);
if (!mpurate)
return 1;
if (mpurate < 1000)
mpurate *= 1000000;
return 1;
}
__setup("mpurate=", omap_clk_setup);
/* Used for clocks that always have same value as the parent clock */
unsigned long followparent_recalc(struct clk *clk)
{
return clk->parent->rate;
}
/*
* Used for clocks that have the same value as the parent clock,
* divided by some factor
*/
unsigned long omap_fixed_divisor_recalc(struct clk *clk)
{
WARN_ON(!clk->fixed_div);
return clk->parent->rate / clk->fixed_div;
}
void clk_reparent(struct clk *child, struct clk *parent)
{
list_del_init(&child->sibling);
if (parent)
list_add(&child->sibling, &parent->children);
child->parent = parent;
/* now do the debugfs renaming to reattach the child
to the proper parent */
}
/* Propagate rate to children */
void propagate_rate(struct clk *tclk)
{
struct clk *clkp;
list_for_each_entry(clkp, &tclk->children, sibling) {
if (clkp->recalc)
clkp->rate = clkp->recalc(clkp);
propagate_rate(clkp);
}
}
static LIST_HEAD(root_clks);
/**
* recalculate_root_clocks - recalculate and propagate all root clocks
*
* Recalculates all root clocks (clocks with no parent), which if the
* clock's .recalc is set correctly, should also propagate their rates.
* Called at init.
*/
void recalculate_root_clocks(void)
{
struct clk *clkp;
list_for_each_entry(clkp, &root_clks, sibling) {
if (clkp->recalc)
clkp->rate = clkp->recalc(clkp);
propagate_rate(clkp);
}
}
/**
* clk_preinit - initialize any fields in the struct clk before clk init
* @clk: struct clk * to initialize
*
* Initialize any struct clk fields needed before normal clk initialization
* can run. No return value.
*/
void clk_preinit(struct clk *clk)
{
INIT_LIST_HEAD(&clk->children);
}
int clk_register(struct clk *clk)
{
if (clk == NULL || IS_ERR(clk))
return -EINVAL;
/*
* trap out already registered clocks
*/
if (clk->node.next || clk->node.prev)
return 0;
mutex_lock(&clocks_mutex);
if (clk->parent)
list_add(&clk->sibling, &clk->parent->children);
else
list_add(&clk->sibling, &root_clks);
list_add(&clk->node, &clocks);
if (clk->init)
clk->init(clk);
mutex_unlock(&clocks_mutex);
return 0;
}
EXPORT_SYMBOL(clk_register);
void clk_unregister(struct clk *clk)
{
if (clk == NULL || IS_ERR(clk))
return;
mutex_lock(&clocks_mutex);
list_del(&clk->sibling);
list_del(&clk->node);
mutex_unlock(&clocks_mutex);
}
EXPORT_SYMBOL(clk_unregister);
void clk_enable_init_clocks(void)
{
struct clk *clkp;
list_for_each_entry(clkp, &clocks, node)
if (clkp->flags & ENABLE_ON_INIT)
clk_enable(clkp);
}
/**
* omap_clk_get_by_name - locate OMAP struct clk by its name
* @name: name of the struct clk to locate
*
* Locate an OMAP struct clk by its name. Assumes that struct clk
* names are unique. Returns NULL if not found or a pointer to the
* struct clk if found.
*/
struct clk *omap_clk_get_by_name(const char *name)
{
struct clk *c;
struct clk *ret = NULL;
mutex_lock(&clocks_mutex);
list_for_each_entry(c, &clocks, node) {
if (!strcmp(c->name, name)) {
ret = c;
break;
}
}
mutex_unlock(&clocks_mutex);
return ret;
}
int omap_clk_enable_autoidle_all(void)
{
struct clk *c;
unsigned long flags;
spin_lock_irqsave(&clockfw_lock, flags);
list_for_each_entry(c, &clocks, node)
if (c->ops->allow_idle)
c->ops->allow_idle(c);
spin_unlock_irqrestore(&clockfw_lock, flags);
return 0;
}
int omap_clk_disable_autoidle_all(void)
{
struct clk *c;
unsigned long flags;
spin_lock_irqsave(&clockfw_lock, flags);
list_for_each_entry(c, &clocks, node)
if (c->ops->deny_idle)
c->ops->deny_idle(c);
spin_unlock_irqrestore(&clockfw_lock, flags);
return 0;
}
/*
* Low level helpers
*/
static int clkll_enable_null(struct clk *clk)
{
return 0;
}
static void clkll_disable_null(struct clk *clk)
{
}
const struct clkops clkops_null = {
.enable = clkll_enable_null,
.disable = clkll_disable_null,
};
/*
* Dummy clock
*
* Used for clock aliases that are needed on some OMAPs, but not others
*/
struct clk dummy_ck = {
.name = "dummy",
.ops = &clkops_null,
};
/*
*
*/
#ifdef CONFIG_OMAP_RESET_CLOCKS
/*
* Disable any unused clocks left on by the bootloader
*/
static int __init clk_disable_unused(void)
{
struct clk *ck;
unsigned long flags;
pr_info("clock: disabling unused clocks to save power\n");
spin_lock_irqsave(&clockfw_lock, flags);
list_for_each_entry(ck, &clocks, node) {
if (ck->ops == &clkops_null)
continue;
if (ck->usecount > 0 || !ck->enable_reg)
continue;
omap2_clk_disable_unused(ck);
}
spin_unlock_irqrestore(&clockfw_lock, flags);
return 0;
}
late_initcall(clk_disable_unused);
late_initcall(omap_clk_enable_autoidle_all);
#endif
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
/*
* debugfs support to trace clock tree hierarchy and attributes
*/
#include <linux/debugfs.h>
#include <linux/seq_file.h>
static struct dentry *clk_debugfs_root;
static int clk_dbg_show_summary(struct seq_file *s, void *unused)
{
struct clk *c;
struct clk *pa;
mutex_lock(&clocks_mutex);
seq_printf(s, "%-30s %-30s %-10s %s\n",
"clock-name", "parent-name", "rate", "use-count");
list_for_each_entry(c, &clocks, node) {
pa = c->parent;
seq_printf(s, "%-30s %-30s %-10lu %d\n",
c->name, pa ? pa->name : "none", c->rate,
c->usecount);
}
mutex_unlock(&clocks_mutex);
return 0;
}
static int clk_dbg_open(struct inode *inode, struct file *file)
{
return single_open(file, clk_dbg_show_summary, inode->i_private);
}
static const struct file_operations debug_clock_fops = {
.open = clk_dbg_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
static int clk_debugfs_register_one(struct clk *c)
{
int err;
struct dentry *d;
struct clk *pa = c->parent;
d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
if (!d)
return -ENOMEM;
c->dent = d;
d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
if (!d) {
err = -ENOMEM;
goto err_out;
}
d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
if (!d) {
err = -ENOMEM;
goto err_out;
}
d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
if (!d) {
err = -ENOMEM;
goto err_out;
}
return 0;
err_out:
debugfs_remove_recursive(c->dent);
return err;
}
static int clk_debugfs_register(struct clk *c)
{
int err;
struct clk *pa = c->parent;
if (pa && !pa->dent) {
err = clk_debugfs_register(pa);
if (err)
return err;
}
if (!c->dent) {
err = clk_debugfs_register_one(c);
if (err)
return err;
}
return 0;
}
static int __init clk_debugfs_init(void)
{
struct clk *c;
struct dentry *d;
int err;
d = debugfs_create_dir("clock", NULL);
if (!d)
return -ENOMEM;
clk_debugfs_root = d;
list_for_each_entry(c, &clocks, node) {
err = clk_debugfs_register(c);
if (err)
goto err_out;
}
d = debugfs_create_file("summary", S_IRUGO,
d, NULL, &debug_clock_fops);
if (!d)
return -ENOMEM;
return 0;
err_out:
debugfs_remove_recursive(clk_debugfs_root);
return err;
}
late_initcall(clk_debugfs_init);
#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/list.h> #include <linux/list.h>
#include <linux/clkdev.h> #include <linux/clkdev.h>
#include <linux/clk-provider.h>
struct omap_clk { struct omap_clk {
u16 cpu; u16 cpu;
...@@ -52,43 +53,84 @@ struct omap_clk { ...@@ -52,43 +53,84 @@ struct omap_clk {
#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS) #define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX) #define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
struct module;
struct clk;
struct clockdomain; struct clockdomain;
#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
/* Temporary, needed during the common clock framework conversion */
#define __clk_get_name(clk) (clk->name) #define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \
#define __clk_get_parent(clk) (clk->parent) static struct clk _name = { \
#define __clk_get_rate(clk) (clk->rate) .name = #_name, \
.hw = &_name##_hw.hw, \
/** .parent_names = _parent_array_name, \
* struct clkops - some clock function pointers .num_parents = ARRAY_SIZE(_parent_array_name), \
* @enable: fn ptr that enables the current clock in hardware .ops = &_clkops_name, \
* @disable: fn ptr that enables the current clock in hardware };
* @find_idlest: function returning the IDLEST register for the clock's IP blk
* @find_companion: function returning the "companion" clk reg for the clock #define DEFINE_STRUCT_CLK_HW_OMAP(_name, _clkdm_name) \
* @allow_idle: fn ptr that enables autoidle for the current clock in hardware static struct clk_hw_omap _name##_hw = { \
* @deny_idle: fn ptr that disables autoidle for the current clock in hardware .hw = { \
* .clk = &_name, \
* A "companion" clk is an accompanying clock to the one being queried }, \
* that must be enabled for the IP module connected to the clock to .clkdm_name = _clkdm_name, \
* become accessible by the hardware. Neither @find_idlest nor };
* @find_companion should be needed; that information is IP
* block-specific; the hwmod code has been created to handle this, but #define DEFINE_CLK_OMAP_MUX(_name, _clkdm_name, _clksel, \
* until hwmod data is ready and drivers have been converted to use PM _clksel_reg, _clksel_mask, \
* runtime calls in place of clk_enable()/clk_disable(), @find_idlest and _parent_names, _ops) \
* @find_companion must, unfortunately, remain. static struct clk _name; \
*/ static struct clk_hw_omap _name##_hw = { \
struct clkops { .hw = { \
int (*enable)(struct clk *); .clk = &_name, \
void (*disable)(struct clk *); }, \
void (*find_idlest)(struct clk *, void __iomem **, .clksel = _clksel, \
u8 *, u8 *); .clksel_reg = _clksel_reg, \
void (*find_companion)(struct clk *, void __iomem **, .clksel_mask = _clksel_mask, \
u8 *); .clkdm_name = _clkdm_name, \
void (*allow_idle)(struct clk *); }; \
void (*deny_idle)(struct clk *); DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
};
#define DEFINE_CLK_OMAP_MUX_GATE(_name, _clkdm_name, _clksel, \
_clksel_reg, _clksel_mask, \
_enable_reg, _enable_bit, \
_hwops, _parent_names, _ops) \
static struct clk _name; \
static struct clk_hw_omap _name##_hw = { \
.hw = { \
.clk = &_name, \
}, \
.ops = _hwops, \
.enable_reg = _enable_reg, \
.enable_bit = _enable_bit, \
.clksel = _clksel, \
.clksel_reg = _clksel_reg, \
.clksel_mask = _clksel_mask, \
.clkdm_name = _clkdm_name, \
}; \
DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
#define DEFINE_CLK_OMAP_HSDIVIDER(_name, _parent_name, \
_parent_ptr, _flags, \
_clksel_reg, _clksel_mask) \
static const struct clksel _name##_div[] = { \
{ \
.parent = _parent_ptr, \
.rates = div31_1to31_rates \
}, \
{ .parent = NULL }, \
}; \
static struct clk _name; \
static const char *_name##_parent_names[] = { \
_parent_name, \
}; \
static struct clk_hw_omap _name##_hw = { \
.hw = { \
.clk = &_name, \
}, \
.clksel = _name##_div, \
.clksel_reg = _clksel_reg, \
.clksel_mask = _clksel_mask, \
.ops = &clkhwops_omap4_dpllmx, \
}; \
DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops);
/* struct clksel_rate.flags possibilities */ /* struct clksel_rate.flags possibilities */
#define RATE_IN_242X (1 << 0) #define RATE_IN_242X (1 << 0)
...@@ -229,22 +271,10 @@ struct dpll_data { ...@@ -229,22 +271,10 @@ struct dpll_data {
#define CLOCK_CLKOUTX2 (1 << 5) #define CLOCK_CLKOUTX2 (1 << 5)
/** /**
* struct clk - OMAP struct clk * struct clk_hw_omap - OMAP struct clk
* @node: list_head connecting this clock into the full clock list * @node: list_head connecting this clock into the full clock list
* @ops: struct clkops * for this clock
* @name: the name of the clock in the hardware (used in hwmod data and debug)
* @parent: pointer to this clock's parent struct clk
* @children: list_head connecting to the child clks' @sibling list_heads
* @sibling: list_head connecting this clk to its parent clk's @children
* @rate: current clock rate
* @enable_reg: register to write to enable the clock (see @enable_bit) * @enable_reg: register to write to enable the clock (see @enable_bit)
* @recalc: fn ptr that returns the clock's current rate
* @set_rate: fn ptr that can change the clock's current rate
* @round_rate: fn ptr that can round the clock's current rate
* @init: fn ptr to do clock-specific initialization
* @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
* @usecount: number of users that have requested this clock to be enabled
* @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
* @flags: see "struct clk.flags possibilities" above * @flags: see "struct clk.flags possibilities" above
* @clksel_reg: for clksel clks, register va containing src/divisor select * @clksel_reg: for clksel clks, register va containing src/divisor select
* @clksel_mask: bitmask in @clksel_reg for the src/divisor selector * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
...@@ -258,39 +288,17 @@ struct dpll_data { ...@@ -258,39 +288,17 @@ struct dpll_data {
* XXX @rate_offset, @src_offset should probably be removed and OMAP1 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
* clock code converted to use clksel. * clock code converted to use clksel.
* *
* XXX @usecount is poorly named. It should be "enable_count" or
* something similar. "users" in the description refers to kernel
* code (core code or drivers) that have called clk_enable() and not
* yet called clk_disable(); the usecount of parent clocks is also
* incremented by the clock code when clk_enable() is called on child
* clocks and decremented by the clock code when clk_disable() is
* called on child clocks.
*
* XXX @clkdm, @usecount, @children, @sibling should be marked for
* internal use only.
*
* @children and @sibling are used to optimize parent-to-child clock
* tree traversals. (child-to-parent traversals use @parent.)
*
* XXX The notion of the clock's current rate probably needs to be
* separated from the clock's target rate.
*/ */
struct clk {
struct clk_hw_omap_ops;
struct clk_hw_omap {
struct clk_hw hw;
struct list_head node; struct list_head node;
const struct clkops *ops; unsigned long fixed_rate;
const char *name; u8 fixed_div;
struct clk *parent;
struct list_head children;
struct list_head sibling; /* node for children */
unsigned long rate;
void __iomem *enable_reg; void __iomem *enable_reg;
unsigned long (*recalc)(struct clk *);
int (*set_rate)(struct clk *, unsigned long);
long (*round_rate)(struct clk *, unsigned long);
void (*init)(struct clk *);
u8 enable_bit; u8 enable_bit;
s8 usecount;
u8 fixed_div;
u8 flags; u8 flags;
void __iomem *clksel_reg; void __iomem *clksel_reg;
u32 clksel_mask; u32 clksel_mask;
...@@ -298,42 +306,22 @@ struct clk { ...@@ -298,42 +306,22 @@ struct clk {
struct dpll_data *dpll_data; struct dpll_data *dpll_data;
const char *clkdm_name; const char *clkdm_name;
struct clockdomain *clkdm; struct clockdomain *clkdm;
#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) const struct clk_hw_omap_ops *ops;
struct dentry *dent; /* For visible tree hierarchy */
#endif
}; };
struct clk_functions { struct clk_hw_omap_ops {
int (*clk_enable)(struct clk *clk); void (*find_idlest)(struct clk_hw_omap *oclk,
void (*clk_disable)(struct clk *clk); void __iomem **idlest_reg,
long (*clk_round_rate)(struct clk *clk, unsigned long rate); u8 *idlest_bit, u8 *idlest_val);
int (*clk_set_rate)(struct clk *clk, unsigned long rate); void (*find_companion)(struct clk_hw_omap *oclk,
int (*clk_set_parent)(struct clk *clk, struct clk *parent); void __iomem **other_reg,
void (*clk_allow_idle)(struct clk *clk); u8 *other_bit);
void (*clk_deny_idle)(struct clk *clk); void (*allow_idle)(struct clk_hw_omap *oclk);
void (*clk_disable_unused)(struct clk *clk); void (*deny_idle)(struct clk_hw_omap *oclk);
}; };
extern int mpurate; unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
unsigned long parent_rate);
extern int clk_init(struct clk_functions *custom_clocks);
extern void clk_preinit(struct clk *clk);
extern int clk_register(struct clk *clk);
extern void clk_reparent(struct clk *child, struct clk *parent);
extern void clk_unregister(struct clk *clk);
extern void propagate_rate(struct clk *clk);
extern void recalculate_root_clocks(void);
extern unsigned long followparent_recalc(struct clk *clk);
extern void clk_enable_init_clocks(void);
unsigned long omap_fixed_divisor_recalc(struct clk *clk);
extern struct clk *omap_clk_get_by_name(const char *name);
extern int omap_clk_enable_autoidle_all(void);
extern int omap_clk_disable_autoidle_all(void);
extern const struct clkops clkops_null;
extern struct clk dummy_ck;
/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ /* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
#define CORE_CLK_SRC_32K 0x0 #define CORE_CLK_SRC_32K 0x0
...@@ -364,57 +352,62 @@ extern struct clk dummy_ck; ...@@ -364,57 +352,62 @@ extern struct clk dummy_ck;
/* DPLL Type and DCO Selection Flags */ /* DPLL Type and DCO Selection Flags */
#define DPLL_J_TYPE 0x1 #define DPLL_J_TYPE 0x1
int omap2_clk_enable(struct clk *clk); long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
void omap2_clk_disable(struct clk *clk); unsigned long *parent_rate);
long omap2_clk_round_rate(struct clk *clk, unsigned long rate); unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate);
int omap2_clk_set_rate(struct clk *clk, unsigned long rate); int omap3_noncore_dpll_enable(struct clk_hw *hw);
int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); void omap3_noncore_dpll_disable(struct clk_hw *hw);
long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate); int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long omap3_dpll_recalc(struct clk *clk); unsigned long parent_rate);
unsigned long omap3_clkoutx2_recalc(struct clk *clk); u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk);
void omap3_dpll_allow_idle(struct clk *clk); void omap3_dpll_allow_idle(struct clk_hw_omap *clk);
void omap3_dpll_deny_idle(struct clk *clk); void omap3_dpll_deny_idle(struct clk_hw_omap *clk);
u32 omap3_dpll_autoidle_read(struct clk *clk); unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate); unsigned long parent_rate);
int omap3_noncore_dpll_enable(struct clk *clk); int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk);
void omap3_noncore_dpll_disable(struct clk *clk); void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk);
int omap4_dpllmx_gatectrl_read(struct clk *clk); void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk);
void omap4_dpllmx_allow_gatectrl(struct clk *clk); unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
void omap4_dpllmx_deny_gatectrl(struct clk *clk); unsigned long parent_rate);
long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate); long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk); unsigned long target_rate,
unsigned long *parent_rate);
#ifdef CONFIG_OMAP_RESET_CLOCKS
void omap2_clk_disable_unused(struct clk *clk); void omap2_init_clk_clkdm(struct clk_hw *clk);
#else
#define omap2_clk_disable_unused NULL
#endif
void omap2_init_clk_clkdm(struct clk *clk);
void __init omap2_clk_disable_clkdm_control(void); void __init omap2_clk_disable_clkdm_control(void);
/* clkt_clksel.c public functions */ /* clkt_clksel.c public functions */
u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk,
unsigned long target_rate,
u32 *new_div); u32 *new_div);
void omap2_init_clksel_parent(struct clk *clk); u8 omap2_clksel_find_parent_index(struct clk_hw *hw);
unsigned long omap2_clksel_recalc(struct clk *clk); unsigned long omap2_clksel_recalc(struct clk_hw *hw, unsigned long parent_rate);
long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate,
int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); unsigned long *parent_rate);
int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate);
int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val);
/* clkt_iclk.c public functions */ /* clkt_iclk.c public functions */
extern void omap2_clkt_iclk_allow_idle(struct clk *clk); extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk);
extern void omap2_clkt_iclk_deny_idle(struct clk *clk); extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk);
u32 omap2_get_dpll_rate(struct clk *clk); u8 omap2_init_dpll_parent(struct clk_hw *hw);
void omap2_init_dpll_parent(struct clk *clk); unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk);
int omap2_dflt_clk_enable(struct clk *clk); int omap2_dflt_clk_enable(struct clk_hw *hw);
void omap2_dflt_clk_disable(struct clk *clk); void omap2_dflt_clk_disable(struct clk_hw *hw);
void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
void __iomem **other_reg,
u8 *other_bit); u8 *other_bit);
void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg,
u8 *idlest_bit, u8 *idlest_val); u8 *idlest_bit, u8 *idlest_val);
void omap2_init_clk_hw_omap_clocks(struct clk *clk);
int omap2_clk_enable_autoidle_all(void);
int omap2_clk_disable_autoidle_all(void);
void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name);
void omap2_clk_print_new_rates(const char *hfclkin_ck_name, void omap2_clk_print_new_rates(const char *hfclkin_ck_name,
const char *core_ck_name, const char *core_ck_name,
...@@ -432,28 +425,38 @@ extern const struct clksel_rate gpt_32k_rates[]; ...@@ -432,28 +425,38 @@ extern const struct clksel_rate gpt_32k_rates[];
extern const struct clksel_rate gpt_sys_rates[]; extern const struct clksel_rate gpt_sys_rates[];
extern const struct clksel_rate gfx_l3_rates[]; extern const struct clksel_rate gfx_l3_rates[];
extern const struct clksel_rate dsp_ick_rates[]; extern const struct clksel_rate dsp_ick_rates[];
extern struct clk dummy_ck;
extern const struct clkops clkops_omap2_iclk_dflt_wait; extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;
extern const struct clkops clkops_omap2_iclk_dflt; extern const struct clk_hw_omap_ops clkhwops_iclk_wait;
extern const struct clkops clkops_omap2_iclk_idle_only; extern const struct clk_hw_omap_ops clkhwops_wait;
extern const struct clkops clkops_omap2_mdmclk_dflt_wait; extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx;
extern const struct clkops clkops_omap2xxx_dpll_ops; extern const struct clk_hw_omap_ops clkhwops_iclk;
extern const struct clkops clkops_omap3_noncore_dpll_ops; extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait;
extern const struct clkops clkops_omap3_core_dpll_ops; extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait;
extern const struct clkops clkops_omap4_dpllmx_ops; extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait;
extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait;
extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait;
extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait;
extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait;
extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait;
extern const struct clk_hw_omap_ops clkhwops_apll54;
extern const struct clk_hw_omap_ops clkhwops_apll96;
extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
/* clksel_rate blocks shared between OMAP44xx and AM33xx */ /* clksel_rate blocks shared between OMAP44xx and AM33xx */
extern const struct clksel_rate div_1_0_rates[]; extern const struct clksel_rate div_1_0_rates[];
extern const struct clksel_rate div3_1to4_rates[];
extern const struct clksel_rate div_1_1_rates[]; extern const struct clksel_rate div_1_1_rates[];
extern const struct clksel_rate div_1_2_rates[]; extern const struct clksel_rate div_1_2_rates[];
extern const struct clksel_rate div_1_3_rates[]; extern const struct clksel_rate div_1_3_rates[];
extern const struct clksel_rate div_1_4_rates[]; extern const struct clksel_rate div_1_4_rates[];
extern const struct clksel_rate div31_1to31_rates[]; extern const struct clksel_rate div31_1to31_rates[];
/* clocks shared between various OMAP SoCs */
extern struct clk virt_19200000_ck;
extern struct clk virt_26000000_ck;
extern int am33xx_clk_init(void); extern int am33xx_clk_init(void);
extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);
extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);
#endif #endif
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* passes back the correct CM_IDLEST register address for I2CHS * passes back the correct CM_IDLEST register address for I2CHS
* modules. No return value. * modules. No return value.
*/ */
static void omap2430_clk_i2chs_find_idlest(struct clk *clk, static void omap2430_clk_i2chs_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg, void __iomem **idlest_reg,
u8 *idlest_bit, u8 *idlest_bit,
u8 *idlest_val) u8 *idlest_val)
...@@ -51,9 +51,7 @@ static void omap2430_clk_i2chs_find_idlest(struct clk *clk, ...@@ -51,9 +51,7 @@ static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
} }
/* 2430 I2CHS has non-standard IDLEST register */ /* 2430 I2CHS has non-standard IDLEST register */
const struct clkops clkops_omap2430_i2chs_wait = { const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_idlest = omap2430_clk_i2chs_find_idlest, .find_idlest = omap2430_clk_i2chs_find_idlest,
.find_companion = omap2_clk_dflt_find_companion, .find_companion = omap2_clk_dflt_find_companion,
}; };
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "cm.h" #include "cm.h"
#include "cm-regbits-24xx.h" #include "cm-regbits-24xx.h"
struct clk_hw *dclk_hw;
/* /*
* Omap24xx specific clock functions * Omap24xx specific clock functions
*/ */
......
...@@ -8,18 +8,32 @@ ...@@ -8,18 +8,32 @@
#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H
#define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H #define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H
unsigned long omap2_table_mpu_recalc(struct clk *clk); #include <linux/clk-provider.h>
int omap2_select_table_rate(struct clk *clk, unsigned long rate); #include "clock.h"
long omap2_round_to_table_rate(struct clk *clk, unsigned long rate);
unsigned long omap2xxx_sys_clk_recalc(struct clk *clk); unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
unsigned long omap2_osc_clk_recalc(struct clk *clk); unsigned long parent_rate);
unsigned long omap2_dpllcore_recalc(struct clk *clk); int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); unsigned long parent_rate);
long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate);
unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
unsigned long parent_rate);
unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
unsigned long parent_rate);
unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
unsigned long parent_rate);
int omap2_reprogram_dpllcore(struct clk_hw *clk, unsigned long rate,
unsigned long parent_rate);
void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw);
unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw,
unsigned long parent_rate);
unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw,
unsigned long parent_rate);
unsigned long omap2xxx_clk_get_core_rate(void); unsigned long omap2xxx_clk_get_core_rate(void);
u32 omap2xxx_get_apll_clkin(void); u32 omap2xxx_get_apll_clkin(void);
u32 omap2xxx_get_sysclkdiv(void); u32 omap2xxx_get_sysclkdiv(void);
void omap2xxx_clk_prepare_for_reboot(void); void omap2xxx_clk_prepare_for_reboot(void);
void omap2xxx_clkt_dpllcore_init(struct clk *clk);
void omap2xxx_clkt_vps_check_bootloader_rates(void); void omap2xxx_clkt_vps_check_bootloader_rates(void);
void omap2xxx_clkt_vps_late_init(void); void omap2xxx_clkt_vps_late_init(void);
...@@ -37,9 +51,12 @@ int omap2430_clk_init(void); ...@@ -37,9 +51,12 @@ int omap2430_clk_init(void);
extern void __iomem *prcm_clksrc_ctrl; extern void __iomem *prcm_clksrc_ctrl;
extern const struct clkops clkops_omap2430_i2chs_wait; extern struct clk_hw *dclk_hw;
extern const struct clkops clkops_oscck; int omap2_enable_osc_ck(struct clk_hw *hw);
extern const struct clkops clkops_apll96; void omap2_disable_osc_ck(struct clk_hw *hw);
extern const struct clkops clkops_apll54; int omap2_clk_apll96_enable(struct clk_hw *hw);
int omap2_clk_apll54_enable(struct clk_hw *hw);
void omap2_clk_apll96_disable(struct clk_hw *hw);
void omap2_clk_apll54_disable(struct clk_hw *hw);
#endif #endif
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
* from the CM_{I,F}CLKEN bit. Pass back the correct info via * from the CM_{I,F}CLKEN bit. Pass back the correct info via
* @idlest_reg and @idlest_bit. No return value. * @idlest_reg and @idlest_bit. No return value.
*/ */
static void omap3430es2_clk_ssi_find_idlest(struct clk *clk, static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg, void __iomem **idlest_reg,
u8 *idlest_bit, u8 *idlest_bit,
u8 *idlest_val) u8 *idlest_val)
...@@ -49,21 +49,16 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk *clk, ...@@ -49,21 +49,16 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
*idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT; *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
*idlest_val = OMAP34XX_CM_IDLEST_VAL; *idlest_val = OMAP34XX_CM_IDLEST_VAL;
} }
const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
const struct clkops clkops_omap3430es2_ssi_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_idlest = omap3430es2_clk_ssi_find_idlest, .find_idlest = omap3430es2_clk_ssi_find_idlest,
.find_companion = omap2_clk_dflt_find_companion, .find_companion = omap2_clk_dflt_find_companion,
}; };
const struct clkops clkops_omap3430es2_iclk_ssi_wait = { const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_idlest = omap3430es2_clk_ssi_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
.allow_idle = omap2_clkt_iclk_allow_idle, .allow_idle = omap2_clkt_iclk_allow_idle,
.deny_idle = omap2_clkt_iclk_deny_idle, .deny_idle = omap2_clkt_iclk_deny_idle,
.find_idlest = omap3430es2_clk_ssi_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
}; };
/** /**
...@@ -80,7 +75,7 @@ const struct clkops clkops_omap3430es2_iclk_ssi_wait = { ...@@ -80,7 +75,7 @@ const struct clkops clkops_omap3430es2_iclk_ssi_wait = {
* default find_idlest code assumes that they are at the same * default find_idlest code assumes that they are at the same
* position.) No return value. * position.) No return value.
*/ */
static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg, void __iomem **idlest_reg,
u8 *idlest_bit, u8 *idlest_bit,
u8 *idlest_val) u8 *idlest_val)
...@@ -94,20 +89,16 @@ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, ...@@ -94,20 +89,16 @@ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
*idlest_val = OMAP34XX_CM_IDLEST_VAL; *idlest_val = OMAP34XX_CM_IDLEST_VAL;
} }
const struct clkops clkops_omap3430es2_dss_usbhost_wait = { const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_idlest = omap3430es2_clk_dss_usbhost_find_idlest, .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
.find_companion = omap2_clk_dflt_find_companion, .find_companion = omap2_clk_dflt_find_companion,
}; };
const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = { const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
.allow_idle = omap2_clkt_iclk_allow_idle, .allow_idle = omap2_clkt_iclk_allow_idle,
.deny_idle = omap2_clkt_iclk_deny_idle, .deny_idle = omap2_clkt_iclk_deny_idle,
.find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
}; };
/** /**
...@@ -121,7 +112,7 @@ const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = { ...@@ -121,7 +112,7 @@ const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = {
* shift from the CM_{I,F}CLKEN bit. Pass back the correct info via * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
* @idlest_reg and @idlest_bit. No return value. * @idlest_reg and @idlest_bit. No return value.
*/ */
static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, static void omap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg, void __iomem **idlest_reg,
u8 *idlest_bit, u8 *idlest_bit,
u8 *idlest_val) u8 *idlest_val)
...@@ -134,18 +125,14 @@ static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, ...@@ -134,18 +125,14 @@ static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
*idlest_val = OMAP34XX_CM_IDLEST_VAL; *idlest_val = OMAP34XX_CM_IDLEST_VAL;
} }
const struct clkops clkops_omap3430es2_hsotgusb_wait = { const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
.enable = omap2_dflt_clk_enable, .allow_idle = omap2_clkt_iclk_allow_idle,
.disable = omap2_dflt_clk_disable, .deny_idle = omap2_clkt_iclk_deny_idle,
.find_idlest = omap3430es2_clk_hsotgusb_find_idlest, .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
.find_companion = omap2_clk_dflt_find_companion, .find_companion = omap2_clk_dflt_find_companion,
}; };
const struct clkops clkops_omap3430es2_iclk_hsotgusb_wait = { const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_idlest = omap3430es2_clk_hsotgusb_find_idlest, .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
.find_companion = omap2_clk_dflt_find_companion, .find_companion = omap2_clk_dflt_find_companion,
.allow_idle = omap2_clkt_iclk_allow_idle,
.deny_idle = omap2_clkt_iclk_deny_idle,
}; };
...@@ -47,7 +47,7 @@ ...@@ -47,7 +47,7 @@
* in the enable register itsel at a bit offset of 4 from the enable * in the enable register itsel at a bit offset of 4 from the enable
* bit. A value of 1 indicates that clock is enabled. * bit. A value of 1 indicates that clock is enabled.
*/ */
static void am35xx_clk_find_idlest(struct clk *clk, static void am35xx_clk_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg, void __iomem **idlest_reg,
u8 *idlest_bit, u8 *idlest_bit,
u8 *idlest_val) u8 *idlest_val)
...@@ -71,7 +71,8 @@ static void am35xx_clk_find_idlest(struct clk *clk, ...@@ -71,7 +71,8 @@ static void am35xx_clk_find_idlest(struct clk *clk,
* associate this type of code with per-module data structures to * associate this type of code with per-module data structures to
* avoid this issue, and remove the casts. No return value. * avoid this issue, and remove the casts. No return value.
*/ */
static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg, static void am35xx_clk_find_companion(struct clk_hw_omap *clk,
void __iomem **other_reg,
u8 *other_bit) u8 *other_bit)
{ {
*other_reg = (__force void __iomem *)(clk->enable_reg); *other_reg = (__force void __iomem *)(clk->enable_reg);
...@@ -80,10 +81,7 @@ static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg, ...@@ -80,10 +81,7 @@ static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg,
else else
*other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET; *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET;
} }
const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait = {
const struct clkops clkops_am35xx_ipss_module_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_idlest = am35xx_clk_find_idlest, .find_idlest = am35xx_clk_find_idlest,
.find_companion = am35xx_clk_find_companion, .find_companion = am35xx_clk_find_companion,
}; };
...@@ -99,7 +97,7 @@ const struct clkops clkops_am35xx_ipss_module_wait = { ...@@ -99,7 +97,7 @@ const struct clkops clkops_am35xx_ipss_module_wait = {
* CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg
* and @idlest_bit. No return value. * and @idlest_bit. No return value.
*/ */
static void am35xx_clk_ipss_find_idlest(struct clk *clk, static void am35xx_clk_ipss_find_idlest(struct clk_hw_omap *clk,
void __iomem **idlest_reg, void __iomem **idlest_reg,
u8 *idlest_bit, u8 *idlest_bit,
u8 *idlest_val) u8 *idlest_val)
...@@ -112,13 +110,9 @@ static void am35xx_clk_ipss_find_idlest(struct clk *clk, ...@@ -112,13 +110,9 @@ static void am35xx_clk_ipss_find_idlest(struct clk *clk,
*idlest_val = OMAP34XX_CM_IDLEST_VAL; *idlest_val = OMAP34XX_CM_IDLEST_VAL;
} }
const struct clkops clkops_am35xx_ipss_wait = { const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait = {
.enable = omap2_dflt_clk_enable,
.disable = omap2_dflt_clk_disable,
.find_idlest = am35xx_clk_ipss_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
.allow_idle = omap2_clkt_iclk_allow_idle, .allow_idle = omap2_clkt_iclk_allow_idle,
.deny_idle = omap2_clkt_iclk_deny_idle, .deny_idle = omap2_clkt_iclk_deny_idle,
.find_idlest = am35xx_clk_ipss_find_idlest,
.find_companion = omap2_clk_dflt_find_companion,
}; };
...@@ -37,34 +37,32 @@ ...@@ -37,34 +37,32 @@
* (Any other value different from the Read value) to the * (Any other value different from the Read value) to the
* corresponding CM_CLKSEL register will refresh the dividers. * corresponding CM_CLKSEL register will refresh the dividers.
*/ */
static int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk *clk) int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
{ {
struct clk_hw_omap *parent;
struct clk_hw *parent_hw;
u32 dummy_v, orig_v, clksel_shift; u32 dummy_v, orig_v, clksel_shift;
int ret; int ret;
/* Clear PWRDN bit of HSDIVIDER */ /* Clear PWRDN bit of HSDIVIDER */
ret = omap2_dflt_clk_enable(clk); ret = omap2_dflt_clk_enable(clk);
parent_hw = __clk_get_hw(__clk_get_parent(clk->clk));
parent = to_clk_hw_omap(parent_hw);
/* Restore the dividers */ /* Restore the dividers */
if (!ret) { if (!ret) {
clksel_shift = __ffs(clk->parent->clksel_mask); clksel_shift = __ffs(parent->clksel_mask);
orig_v = __raw_readl(clk->parent->clksel_reg); orig_v = __raw_readl(parent->clksel_reg);
dummy_v = orig_v; dummy_v = orig_v;
/* Write any other value different from the Read value */ /* Write any other value different from the Read value */
dummy_v ^= (1 << clksel_shift); dummy_v ^= (1 << clksel_shift);
__raw_writel(dummy_v, clk->parent->clksel_reg); __raw_writel(dummy_v, parent->clksel_reg);
/* Write the original divider */ /* Write the original divider */
__raw_writel(orig_v, clk->parent->clksel_reg); __raw_writel(orig_v, parent->clksel_reg);
} }
return ret; return ret;
} }
const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore = {
.enable = omap36xx_pwrdn_clk_enable_with_hsdiv_restore,
.disable = omap2_dflt_clk_disable,
.find_companion = omap2_clk_dflt_find_companion,
.find_idlest = omap2_clk_dflt_find_idlest,
};
...@@ -8,6 +8,6 @@ ...@@ -8,6 +8,6 @@
#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H #ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H #define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
extern const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; extern int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *hw);
#endif #endif
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
/* needed by omap3_core_dpll_m2_set_rate() */ /* needed by omap3_core_dpll_m2_set_rate() */
struct clk *sdrc_ick_p, *arm_fck_p; struct clk *sdrc_ick_p, *arm_fck_p;
int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) unsigned long parent_rate)
{ {
/* /*
* According to the 12-5 CDP code from TI, "Limitation 2.5" * According to the 12-5 CDP code from TI, "Limitation 2.5"
...@@ -51,7 +51,7 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) ...@@ -51,7 +51,7 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
return -EINVAL; return -EINVAL;
} }
return omap3_noncore_dpll_set_rate(clk, rate); return omap3_noncore_dpll_set_rate(hw, rate, parent_rate);
} }
void __init omap3_clk_lock_dpll5(void) void __init omap3_clk_lock_dpll5(void)
......
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H #define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H
int omap3xxx_clk_init(void); int omap3xxx_clk_init(void);
int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate); int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate,
int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate); unsigned long parent_rate);
int omap3_core_dpll_m2_set_rate(struct clk_hw *clk, unsigned long rate,
unsigned long parent_rate);
void omap3_clk_lock_dpll5(void); void omap3_clk_lock_dpll5(void);
extern struct clk *sdrc_ick_p; extern struct clk *sdrc_ick_p;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
* OMAP3xxx clock definition files. * OMAP3xxx clock definition files.
*/ */
#include <linux/clk-private.h>
#include "clock.h" #include "clock.h"
/* clksel_rate data common to 24xx/343x */ /* clksel_rate data common to 24xx/343x */
...@@ -52,6 +53,13 @@ const struct clksel_rate div_1_0_rates[] = { ...@@ -52,6 +53,13 @@ const struct clksel_rate div_1_0_rates[] = {
{ .div = 0 }, { .div = 0 },
}; };
const struct clksel_rate div3_1to4_rates[] = {
{ .div = 1, .val = 0, .flags = RATE_IN_4430 },
{ .div = 2, .val = 1, .flags = RATE_IN_4430 },
{ .div = 4, .val = 2, .flags = RATE_IN_4430 },
{ .div = 0 },
};
const struct clksel_rate div_1_1_rates[] = { const struct clksel_rate div_1_1_rates[] = {
{ .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX }, { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
{ .div = 0 }, { .div = 0 },
...@@ -109,14 +117,10 @@ const struct clksel_rate div31_1to31_rates[] = { ...@@ -109,14 +117,10 @@ const struct clksel_rate div31_1to31_rates[] = {
/* Clocks shared between various OMAP SoCs */ /* Clocks shared between various OMAP SoCs */
struct clk virt_19200000_ck = { static struct clk_ops dummy_ck_ops = {};
.name = "virt_19200000_ck",
.ops = &clkops_null,
.rate = 19200000,
};
struct clk virt_26000000_ck = { struct clk dummy_ck = {
.name = "virt_26000000_ck", .name = "dummy_clk",
.ops = &clkops_null, .ops = &dummy_ck_ops,
.rate = 26000000, .flags = CLK_IS_BASIC,
}; };
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/limits.h> #include <linux/limits.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/clk-provider.h>
#include <linux/io.h> #include <linux/io.h>
...@@ -947,35 +948,6 @@ static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm) ...@@ -947,35 +948,6 @@ static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
return 0; return 0;
} }
static int _clkdm_clk_hwmod_disable(struct clockdomain *clkdm)
{
unsigned long flags;
if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
return -EINVAL;
spin_lock_irqsave(&clkdm->lock, flags);
if (atomic_read(&clkdm->usecount) == 0) {
spin_unlock_irqrestore(&clkdm->lock, flags);
WARN_ON(1); /* underflow */
return -ERANGE;
}
if (atomic_dec_return(&clkdm->usecount) > 0) {
spin_unlock_irqrestore(&clkdm->lock, flags);
return 0;
}
arch_clkdm->clkdm_clk_disable(clkdm);
pwrdm_state_switch(clkdm->pwrdm.ptr);
spin_unlock_irqrestore(&clkdm->lock, flags);
pr_debug("clockdomain: %s: disabled\n", clkdm->name);
return 0;
}
/** /**
* clkdm_clk_enable - add an enabled downstream clock to this clkdm * clkdm_clk_enable - add an enabled downstream clock to this clkdm
* @clkdm: struct clockdomain * * @clkdm: struct clockdomain *
...@@ -1018,15 +990,37 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk) ...@@ -1018,15 +990,37 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
*/ */
int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
{ {
/* unsigned long flags;
* XXX Rewrite this code to maintain a list of enabled
* downstream clocks for debugging purposes?
*/
if (!clk) if (!clkdm || !clk || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
return -EINVAL; return -EINVAL;
return _clkdm_clk_hwmod_disable(clkdm); spin_lock_irqsave(&clkdm->lock, flags);
/* corner case: disabling unused clocks */
if (__clk_get_enable_count(clk) == 0)
goto ccd_exit;
if (atomic_read(&clkdm->usecount) == 0) {
spin_unlock_irqrestore(&clkdm->lock, flags);
WARN_ON(1); /* underflow */
return -ERANGE;
}
if (atomic_dec_return(&clkdm->usecount) > 0) {
spin_unlock_irqrestore(&clkdm->lock, flags);
return 0;
}
arch_clkdm->clkdm_clk_disable(clkdm);
pwrdm_state_switch(clkdm->pwrdm.ptr);
pr_debug("clockdomain: %s: disabled\n", clkdm->name);
ccd_exit:
spin_unlock_irqrestore(&clkdm->lock, flags);
return 0;
} }
/** /**
...@@ -1077,6 +1071,8 @@ int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh) ...@@ -1077,6 +1071,8 @@ int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh)
*/ */
int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh) int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
{ {
unsigned long flags;
/* The clkdm attribute does not exist yet prior OMAP4 */ /* The clkdm attribute does not exist yet prior OMAP4 */
if (cpu_is_omap24xx() || cpu_is_omap34xx()) if (cpu_is_omap24xx() || cpu_is_omap34xx())
return 0; return 0;
...@@ -1086,9 +1082,28 @@ int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh) ...@@ -1086,9 +1082,28 @@ int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
* downstream hwmods for debugging purposes? * downstream hwmods for debugging purposes?
*/ */
if (!oh) if (!clkdm || !oh || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
return -EINVAL; return -EINVAL;
return _clkdm_clk_hwmod_disable(clkdm); spin_lock_irqsave(&clkdm->lock, flags);
if (atomic_read(&clkdm->usecount) == 0) {
spin_unlock_irqrestore(&clkdm->lock, flags);
WARN_ON(1); /* underflow */
return -ERANGE;
}
if (atomic_dec_return(&clkdm->usecount) > 0) {
spin_unlock_irqrestore(&clkdm->lock, flags);
return 0;
}
arch_clkdm->clkdm_clk_disable(clkdm);
pwrdm_state_switch(clkdm->pwrdm.ptr);
spin_unlock_irqrestore(&clkdm->lock, flags);
pr_debug("clockdomain: %s: disabled\n", clkdm->name);
return 0;
} }
...@@ -59,6 +59,7 @@ ...@@ -59,6 +59,7 @@
/* CM_CLKSEL_MPU */ /* CM_CLKSEL_MPU */
#define OMAP24XX_CLKSEL_MPU_SHIFT 0 #define OMAP24XX_CLKSEL_MPU_SHIFT 0
#define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0) #define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0)
#define OMAP24XX_CLKSEL_MPU_WIDTH 5
/* CM_CLKSTCTRL_MPU */ /* CM_CLKSTCTRL_MPU */
#define OMAP24XX_AUTOSTATE_MPU_SHIFT 0 #define OMAP24XX_AUTOSTATE_MPU_SHIFT 0
...@@ -237,8 +238,10 @@ ...@@ -237,8 +238,10 @@
#define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8) #define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8)
#define OMAP24XX_CLKSEL_L4_SHIFT 5 #define OMAP24XX_CLKSEL_L4_SHIFT 5
#define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5) #define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5)
#define OMAP24XX_CLKSEL_L4_WIDTH 2
#define OMAP24XX_CLKSEL_L3_SHIFT 0 #define OMAP24XX_CLKSEL_L3_SHIFT 0
#define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0) #define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0)
#define OMAP24XX_CLKSEL_L3_WIDTH 5
/* CM_CLKSEL2_CORE */ /* CM_CLKSEL2_CORE */
#define OMAP24XX_CLKSEL_GPT12_SHIFT 22 #define OMAP24XX_CLKSEL_GPT12_SHIFT 22
...@@ -363,8 +366,10 @@ ...@@ -363,8 +366,10 @@
#define OMAP24XX_DPLL_DIV_MASK (0xf << 8) #define OMAP24XX_DPLL_DIV_MASK (0xf << 8)
#define OMAP24XX_54M_SOURCE_SHIFT 5 #define OMAP24XX_54M_SOURCE_SHIFT 5
#define OMAP24XX_54M_SOURCE_MASK (1 << 5) #define OMAP24XX_54M_SOURCE_MASK (1 << 5)
#define OMAP24XX_54M_SOURCE_WIDTH 1
#define OMAP2430_96M_SOURCE_SHIFT 4 #define OMAP2430_96M_SOURCE_SHIFT 4
#define OMAP2430_96M_SOURCE_MASK (1 << 4) #define OMAP2430_96M_SOURCE_MASK (1 << 4)
#define OMAP2430_96M_SOURCE_WIDTH 1
#define OMAP24XX_48M_SOURCE_SHIFT 3 #define OMAP24XX_48M_SOURCE_SHIFT 3
#define OMAP24XX_48M_SOURCE_MASK (1 << 3) #define OMAP24XX_48M_SOURCE_MASK (1 << 3)
#define OMAP2430_ALTCLK_SOURCE_SHIFT 0 #define OMAP2430_ALTCLK_SOURCE_SHIFT 0
......
...@@ -81,6 +81,7 @@ ...@@ -81,6 +81,7 @@
/* CM_CLKSEL1_PLL_IVA2 */ /* CM_CLKSEL1_PLL_IVA2 */
#define OMAP3430_IVA2_CLK_SRC_SHIFT 19 #define OMAP3430_IVA2_CLK_SRC_SHIFT 19
#define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19) #define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19)
#define OMAP3430_IVA2_CLK_SRC_WIDTH 3
#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8 #define OMAP3430_IVA2_DPLL_MULT_SHIFT 8
#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8) #define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8)
#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0 #define OMAP3430_IVA2_DPLL_DIV_SHIFT 0
...@@ -89,6 +90,7 @@ ...@@ -89,6 +90,7 @@
/* CM_CLKSEL2_PLL_IVA2 */ /* CM_CLKSEL2_PLL_IVA2 */
#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0 #define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0
#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0) #define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_WIDTH 5
/* CM_CLKSTCTRL_IVA2 */ /* CM_CLKSTCTRL_IVA2 */
#define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0 #define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0
...@@ -118,6 +120,7 @@ ...@@ -118,6 +120,7 @@
/* CM_IDLEST_PLL_MPU */ /* CM_IDLEST_PLL_MPU */
#define OMAP3430_ST_MPU_CLK_SHIFT 0 #define OMAP3430_ST_MPU_CLK_SHIFT 0
#define OMAP3430_ST_MPU_CLK_MASK (1 << 0) #define OMAP3430_ST_MPU_CLK_MASK (1 << 0)
#define OMAP3430_ST_MPU_CLK_WIDTH 1
/* CM_AUTOIDLE_PLL_MPU */ /* CM_AUTOIDLE_PLL_MPU */
#define OMAP3430_AUTO_MPU_DPLL_SHIFT 0 #define OMAP3430_AUTO_MPU_DPLL_SHIFT 0
...@@ -126,6 +129,7 @@ ...@@ -126,6 +129,7 @@
/* CM_CLKSEL1_PLL_MPU */ /* CM_CLKSEL1_PLL_MPU */
#define OMAP3430_MPU_CLK_SRC_SHIFT 19 #define OMAP3430_MPU_CLK_SRC_SHIFT 19
#define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19) #define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19)
#define OMAP3430_MPU_CLK_SRC_WIDTH 3
#define OMAP3430_MPU_DPLL_MULT_SHIFT 8 #define OMAP3430_MPU_DPLL_MULT_SHIFT 8
#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8) #define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8)
#define OMAP3430_MPU_DPLL_DIV_SHIFT 0 #define OMAP3430_MPU_DPLL_DIV_SHIFT 0
...@@ -134,6 +138,7 @@ ...@@ -134,6 +138,7 @@
/* CM_CLKSEL2_PLL_MPU */ /* CM_CLKSEL2_PLL_MPU */
#define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0 #define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0
#define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0) #define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
#define OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH 5
/* CM_CLKSTCTRL_MPU */ /* CM_CLKSTCTRL_MPU */
#define OMAP3430_CLKTRCTRL_MPU_SHIFT 0 #define OMAP3430_CLKTRCTRL_MPU_SHIFT 0
...@@ -345,10 +350,13 @@ ...@@ -345,10 +350,13 @@
#define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4) #define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4)
#define OMAP3430_CLKSEL_L4_SHIFT 2 #define OMAP3430_CLKSEL_L4_SHIFT 2
#define OMAP3430_CLKSEL_L4_MASK (0x3 << 2) #define OMAP3430_CLKSEL_L4_MASK (0x3 << 2)
#define OMAP3430_CLKSEL_L4_WIDTH 2
#define OMAP3430_CLKSEL_L3_SHIFT 0 #define OMAP3430_CLKSEL_L3_SHIFT 0
#define OMAP3430_CLKSEL_L3_MASK (0x3 << 0) #define OMAP3430_CLKSEL_L3_MASK (0x3 << 0)
#define OMAP3430_CLKSEL_L3_WIDTH 2
#define OMAP3630_CLKSEL_96M_SHIFT 12 #define OMAP3630_CLKSEL_96M_SHIFT 12
#define OMAP3630_CLKSEL_96M_MASK (0x3 << 12) #define OMAP3630_CLKSEL_96M_MASK (0x3 << 12)
#define OMAP3630_CLKSEL_96M_WIDTH 2
/* CM_CLKSTCTRL_CORE */ /* CM_CLKSTCTRL_CORE */
#define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4 #define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4
...@@ -452,6 +460,7 @@ ...@@ -452,6 +460,7 @@
#define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3) #define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3)
#define OMAP3430_CLKSEL_RM_SHIFT 1 #define OMAP3430_CLKSEL_RM_SHIFT 1
#define OMAP3430_CLKSEL_RM_MASK (0x3 << 1) #define OMAP3430_CLKSEL_RM_MASK (0x3 << 1)
#define OMAP3430_CLKSEL_RM_WIDTH 2
#define OMAP3430_CLKSEL_GPT1_SHIFT 0 #define OMAP3430_CLKSEL_GPT1_SHIFT 0
#define OMAP3430_CLKSEL_GPT1_MASK (1 << 0) #define OMAP3430_CLKSEL_GPT1_MASK (1 << 0)
...@@ -520,14 +529,17 @@ ...@@ -520,14 +529,17 @@
/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */ /* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */
#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27 #define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27
#define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27) #define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27)
#define OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH 5
#define OMAP3430_CORE_DPLL_MULT_SHIFT 16 #define OMAP3430_CORE_DPLL_MULT_SHIFT 16
#define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16) #define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16)
#define OMAP3430_CORE_DPLL_DIV_SHIFT 8 #define OMAP3430_CORE_DPLL_DIV_SHIFT 8
#define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8) #define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8)
#define OMAP3430_SOURCE_96M_SHIFT 6 #define OMAP3430_SOURCE_96M_SHIFT 6
#define OMAP3430_SOURCE_96M_MASK (1 << 6) #define OMAP3430_SOURCE_96M_MASK (1 << 6)
#define OMAP3430_SOURCE_96M_WIDTH 1
#define OMAP3430_SOURCE_54M_SHIFT 5 #define OMAP3430_SOURCE_54M_SHIFT 5
#define OMAP3430_SOURCE_54M_MASK (1 << 5) #define OMAP3430_SOURCE_54M_MASK (1 << 5)
#define OMAP3430_SOURCE_54M_WIDTH 1
#define OMAP3430_SOURCE_48M_SHIFT 3 #define OMAP3430_SOURCE_48M_SHIFT 3
#define OMAP3430_SOURCE_48M_MASK (1 << 3) #define OMAP3430_SOURCE_48M_MASK (1 << 3)
...@@ -545,7 +557,9 @@ ...@@ -545,7 +557,9 @@
/* CM_CLKSEL3_PLL */ /* CM_CLKSEL3_PLL */
#define OMAP3430_DIV_96M_SHIFT 0 #define OMAP3430_DIV_96M_SHIFT 0
#define OMAP3430_DIV_96M_MASK (0x1f << 0) #define OMAP3430_DIV_96M_MASK (0x1f << 0)
#define OMAP3430_DIV_96M_WIDTH 5
#define OMAP3630_DIV_96M_MASK (0x3f << 0) #define OMAP3630_DIV_96M_MASK (0x3f << 0)
#define OMAP3630_DIV_96M_WIDTH 6
/* CM_CLKSEL4_PLL */ /* CM_CLKSEL4_PLL */
#define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8 #define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8
...@@ -556,12 +570,14 @@ ...@@ -556,12 +570,14 @@
/* CM_CLKSEL5_PLL */ /* CM_CLKSEL5_PLL */
#define OMAP3430ES2_DIV_120M_SHIFT 0 #define OMAP3430ES2_DIV_120M_SHIFT 0
#define OMAP3430ES2_DIV_120M_MASK (0x1f << 0) #define OMAP3430ES2_DIV_120M_MASK (0x1f << 0)
#define OMAP3430ES2_DIV_120M_WIDTH 5
/* CM_CLKOUT_CTRL */ /* CM_CLKOUT_CTRL */
#define OMAP3430_CLKOUT2_EN_SHIFT 7 #define OMAP3430_CLKOUT2_EN_SHIFT 7
#define OMAP3430_CLKOUT2_EN_MASK (1 << 7) #define OMAP3430_CLKOUT2_EN_MASK (1 << 7)
#define OMAP3430_CLKOUT2_DIV_SHIFT 3 #define OMAP3430_CLKOUT2_DIV_SHIFT 3
#define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3) #define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3)
#define OMAP3430_CLKOUT2_DIV_WIDTH 3
#define OMAP3430_CLKOUT2SOURCE_SHIFT 0 #define OMAP3430_CLKOUT2SOURCE_SHIFT 0
#define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0) #define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0)
...@@ -592,10 +608,14 @@ ...@@ -592,10 +608,14 @@
/* CM_CLKSEL_DSS */ /* CM_CLKSEL_DSS */
#define OMAP3430_CLKSEL_TV_SHIFT 8 #define OMAP3430_CLKSEL_TV_SHIFT 8
#define OMAP3430_CLKSEL_TV_MASK (0x1f << 8) #define OMAP3430_CLKSEL_TV_MASK (0x1f << 8)
#define OMAP3430_CLKSEL_TV_WIDTH 5
#define OMAP3630_CLKSEL_TV_MASK (0x3f << 8) #define OMAP3630_CLKSEL_TV_MASK (0x3f << 8)
#define OMAP3630_CLKSEL_TV_WIDTH 6
#define OMAP3430_CLKSEL_DSS1_SHIFT 0 #define OMAP3430_CLKSEL_DSS1_SHIFT 0
#define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0) #define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0)
#define OMAP3430_CLKSEL_DSS1_WIDTH 5
#define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0) #define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0)
#define OMAP3630_CLKSEL_DSS1_WIDTH 6
/* CM_SLEEPDEP_DSS specific bits */ /* CM_SLEEPDEP_DSS specific bits */
...@@ -623,7 +643,9 @@ ...@@ -623,7 +643,9 @@
/* CM_CLKSEL_CAM */ /* CM_CLKSEL_CAM */
#define OMAP3430_CLKSEL_CAM_SHIFT 0 #define OMAP3430_CLKSEL_CAM_SHIFT 0
#define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0) #define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0)
#define OMAP3430_CLKSEL_CAM_WIDTH 5
#define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0) #define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0)
#define OMAP3630_CLKSEL_CAM_WIDTH 6
/* CM_SLEEPDEP_CAM specific bits */ /* CM_SLEEPDEP_CAM specific bits */
...@@ -721,21 +743,30 @@ ...@@ -721,21 +743,30 @@
/* CM_CLKSEL1_EMU */ /* CM_CLKSEL1_EMU */
#define OMAP3430_DIV_DPLL4_SHIFT 24 #define OMAP3430_DIV_DPLL4_SHIFT 24
#define OMAP3430_DIV_DPLL4_MASK (0x1f << 24) #define OMAP3430_DIV_DPLL4_MASK (0x1f << 24)
#define OMAP3430_DIV_DPLL4_WIDTH 5
#define OMAP3630_DIV_DPLL4_MASK (0x3f << 24) #define OMAP3630_DIV_DPLL4_MASK (0x3f << 24)
#define OMAP3630_DIV_DPLL4_WIDTH 6
#define OMAP3430_DIV_DPLL3_SHIFT 16 #define OMAP3430_DIV_DPLL3_SHIFT 16
#define OMAP3430_DIV_DPLL3_MASK (0x1f << 16) #define OMAP3430_DIV_DPLL3_MASK (0x1f << 16)
#define OMAP3430_DIV_DPLL3_WIDTH 5
#define OMAP3430_CLKSEL_TRACECLK_SHIFT 11 #define OMAP3430_CLKSEL_TRACECLK_SHIFT 11
#define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11) #define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11)
#define OMAP3430_CLKSEL_TRACECLK_WIDTH 3
#define OMAP3430_CLKSEL_PCLK_SHIFT 8 #define OMAP3430_CLKSEL_PCLK_SHIFT 8
#define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8) #define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8)
#define OMAP3430_CLKSEL_PCLK_WIDTH 3
#define OMAP3430_CLKSEL_PCLKX2_SHIFT 6 #define OMAP3430_CLKSEL_PCLKX2_SHIFT 6
#define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6) #define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6)
#define OMAP3430_CLKSEL_PCLKX2_WIDTH 2
#define OMAP3430_CLKSEL_ATCLK_SHIFT 4 #define OMAP3430_CLKSEL_ATCLK_SHIFT 4
#define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4) #define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4)
#define OMAP3430_CLKSEL_ATCLK_WIDTH 2
#define OMAP3430_TRACE_MUX_CTRL_SHIFT 2 #define OMAP3430_TRACE_MUX_CTRL_SHIFT 2
#define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2) #define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2)
#define OMAP3430_TRACE_MUX_CTRL_WIDTH 2
#define OMAP3430_MUX_CTRL_SHIFT 0 #define OMAP3430_MUX_CTRL_SHIFT 0
#define OMAP3430_MUX_CTRL_MASK (0x3 << 0) #define OMAP3430_MUX_CTRL_MASK (0x3 << 0)
#define OMAP3430_MUX_CTRL_WIDTH 2
/* CM_CLKSTCTRL_EMU */ /* CM_CLKSTCTRL_EMU */
#define OMAP3430_CLKTRCTRL_EMU_SHIFT 0 #define OMAP3430_CLKTRCTRL_EMU_SHIFT 0
......
...@@ -108,6 +108,7 @@ extern void omap2xxx_cm_apll96_disable(void); ...@@ -108,6 +108,7 @@ extern void omap2xxx_cm_apll96_disable(void);
/* CM_CLKSEL_GFX */ /* CM_CLKSEL_GFX */
#define OMAP_CLKSEL_GFX_SHIFT 0 #define OMAP_CLKSEL_GFX_SHIFT 0
#define OMAP_CLKSEL_GFX_MASK (0x7 << 0) #define OMAP_CLKSEL_GFX_MASK (0x7 << 0)
#define OMAP_CLKSEL_GFX_WIDTH 3
/* CM_ICLKEN_GFX */ /* CM_ICLKEN_GFX */
#define OMAP_EN_GFX_SHIFT 0 #define OMAP_EN_GFX_SHIFT 0
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <linux/clkdev.h> #include <linux/clkdev.h>
#include "soc.h" #include "soc.h"
#include "clockdomain.h"
#include "clock.h" #include "clock.h"
#include "cm2xxx_3xxx.h" #include "cm2xxx_3xxx.h"
#include "cm-regbits-34xx.h" #include "cm-regbits-34xx.h"
...@@ -42,7 +43,7 @@ ...@@ -42,7 +43,7 @@
/* Private functions */ /* Private functions */
/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ /* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits)
{ {
const struct dpll_data *dd; const struct dpll_data *dd;
u32 v; u32 v;
...@@ -56,7 +57,7 @@ static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) ...@@ -56,7 +57,7 @@ static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
} }
/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */ /* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
static int _omap3_wait_dpll_status(struct clk *clk, u8 state) static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state)
{ {
const struct dpll_data *dd; const struct dpll_data *dd;
int i = 0; int i = 0;
...@@ -64,7 +65,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state) ...@@ -64,7 +65,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
const char *clk_name; const char *clk_name;
dd = clk->dpll_data; dd = clk->dpll_data;
clk_name = __clk_get_name(clk); clk_name = __clk_get_name(clk->hw.clk);
state <<= __ffs(dd->idlest_mask); state <<= __ffs(dd->idlest_mask);
...@@ -88,7 +89,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state) ...@@ -88,7 +89,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
} }
/* From 3430 TRM ES2 4.7.6.2 */ /* From 3430 TRM ES2 4.7.6.2 */
static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) static u16 _omap3_dpll_compute_freqsel(struct clk_hw_omap *clk, u8 n)
{ {
unsigned long fint; unsigned long fint;
u16 f = 0; u16 f = 0;
...@@ -133,14 +134,14 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) ...@@ -133,14 +134,14 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
* locked successfully, return 0; if the DPLL did not lock in the time * locked successfully, return 0; if the DPLL did not lock in the time
* allotted, or DPLL3 was passed in, return -EINVAL. * allotted, or DPLL3 was passed in, return -EINVAL.
*/ */
static int _omap3_noncore_dpll_lock(struct clk *clk) static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk)
{ {
const struct dpll_data *dd; const struct dpll_data *dd;
u8 ai; u8 ai;
u8 state = 1; u8 state = 1;
int r = 0; int r = 0;
pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk)); pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk->hw.clk));
dd = clk->dpll_data; dd = clk->dpll_data;
state <<= __ffs(dd->idlest_mask); state <<= __ffs(dd->idlest_mask);
...@@ -178,7 +179,7 @@ static int _omap3_noncore_dpll_lock(struct clk *clk) ...@@ -178,7 +179,7 @@ static int _omap3_noncore_dpll_lock(struct clk *clk)
* DPLL3 was passed in, or the DPLL does not support low-power bypass, * DPLL3 was passed in, or the DPLL does not support low-power bypass,
* return -EINVAL. * return -EINVAL.
*/ */
static int _omap3_noncore_dpll_bypass(struct clk *clk) static int _omap3_noncore_dpll_bypass(struct clk_hw_omap *clk)
{ {
int r; int r;
u8 ai; u8 ai;
...@@ -187,7 +188,7 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk) ...@@ -187,7 +188,7 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
return -EINVAL; return -EINVAL;
pr_debug("clock: configuring DPLL %s for low-power bypass\n", pr_debug("clock: configuring DPLL %s for low-power bypass\n",
__clk_get_name(clk)); __clk_get_name(clk->hw.clk));
ai = omap3_dpll_autoidle_read(clk); ai = omap3_dpll_autoidle_read(clk);
...@@ -210,14 +211,14 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk) ...@@ -210,14 +211,14 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
* code. If DPLL3 was passed in, or the DPLL does not support * code. If DPLL3 was passed in, or the DPLL does not support
* low-power stop, return -EINVAL; otherwise, return 0. * low-power stop, return -EINVAL; otherwise, return 0.
*/ */
static int _omap3_noncore_dpll_stop(struct clk *clk) static int _omap3_noncore_dpll_stop(struct clk_hw_omap *clk)
{ {
u8 ai; u8 ai;
if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
return -EINVAL; return -EINVAL;
pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk)); pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk->hw.clk));
ai = omap3_dpll_autoidle_read(clk); ai = omap3_dpll_autoidle_read(clk);
...@@ -241,11 +242,11 @@ static int _omap3_noncore_dpll_stop(struct clk *clk) ...@@ -241,11 +242,11 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)
* XXX This code is not needed for 3430/AM35xx; can it be optimized * XXX This code is not needed for 3430/AM35xx; can it be optimized
* out in non-multi-OMAP builds for those chips? * out in non-multi-OMAP builds for those chips?
*/ */
static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) static void _lookup_dco(struct clk_hw_omap *clk, u8 *dco, u16 m, u8 n)
{ {
unsigned long fint, clkinp; /* watch out for overflow */ unsigned long fint, clkinp; /* watch out for overflow */
clkinp = __clk_get_rate(__clk_get_parent(clk)); clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk));
fint = (clkinp / n) * m; fint = (clkinp / n) * m;
if (fint < 1000000000) if (fint < 1000000000)
...@@ -266,12 +267,12 @@ static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) ...@@ -266,12 +267,12 @@ static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n)
* XXX This code is not needed for 3430/AM35xx; can it be optimized * XXX This code is not needed for 3430/AM35xx; can it be optimized
* out in non-multi-OMAP builds for those chips? * out in non-multi-OMAP builds for those chips?
*/ */
static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n) static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n)
{ {
unsigned long clkinp, sd; /* watch out for overflow */ unsigned long clkinp, sd; /* watch out for overflow */
int mod1, mod2; int mod1, mod2;
clkinp = __clk_get_rate(__clk_get_parent(clk)); clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk));
/* /*
* target sigma-delta to near 250MHz * target sigma-delta to near 250MHz
...@@ -298,7 +299,8 @@ static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n) ...@@ -298,7 +299,8 @@ static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n)
* Program the DPLL with the supplied M, N values, and wait for the DPLL to * Program the DPLL with the supplied M, N values, and wait for the DPLL to
* lock.. Returns -EINVAL upon error, or 0 upon success. * lock.. Returns -EINVAL upon error, or 0 upon success.
*/ */
static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n,
u16 freqsel)
{ {
struct dpll_data *dd = clk->dpll_data; struct dpll_data *dd = clk->dpll_data;
u8 dco, sd_div; u8 dco, sd_div;
...@@ -355,8 +357,10 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) ...@@ -355,8 +357,10 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
* *
* Recalculate and propagate the DPLL rate. * Recalculate and propagate the DPLL rate.
*/ */
unsigned long omap3_dpll_recalc(struct clk *clk) unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
return omap2_get_dpll_rate(clk); return omap2_get_dpll_rate(clk);
} }
...@@ -376,8 +380,9 @@ unsigned long omap3_dpll_recalc(struct clk *clk) ...@@ -376,8 +380,9 @@ unsigned long omap3_dpll_recalc(struct clk *clk)
* support low-power stop, or if the DPLL took too long to enter * support low-power stop, or if the DPLL took too long to enter
* bypass or lock, return -EINVAL; otherwise, return 0. * bypass or lock, return -EINVAL; otherwise, return 0.
*/ */
int omap3_noncore_dpll_enable(struct clk *clk) int omap3_noncore_dpll_enable(struct clk_hw *hw)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
int r; int r;
struct dpll_data *dd; struct dpll_data *dd;
struct clk *parent; struct clk *parent;
...@@ -386,22 +391,26 @@ int omap3_noncore_dpll_enable(struct clk *clk) ...@@ -386,22 +391,26 @@ int omap3_noncore_dpll_enable(struct clk *clk)
if (!dd) if (!dd)
return -EINVAL; return -EINVAL;
parent = __clk_get_parent(clk); if (clk->clkdm) {
r = clkdm_clk_enable(clk->clkdm, hw->clk);
if (r) {
WARN(1,
"%s: could not enable %s's clockdomain %s: %d\n",
__func__, __clk_get_name(hw->clk),
clk->clkdm->name, r);
return r;
}
}
if (__clk_get_rate(clk) == __clk_get_rate(dd->clk_bypass)) { parent = __clk_get_parent(hw->clk);
if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) {
WARN_ON(parent != dd->clk_bypass); WARN_ON(parent != dd->clk_bypass);
r = _omap3_noncore_dpll_bypass(clk); r = _omap3_noncore_dpll_bypass(clk);
} else { } else {
WARN_ON(parent != dd->clk_ref); WARN_ON(parent != dd->clk_ref);
r = _omap3_noncore_dpll_lock(clk); r = _omap3_noncore_dpll_lock(clk);
} }
/*
*FIXME: this is dubious - if clk->rate has changed, what about
* propagating?
*/
if (!r)
clk->rate = (clk->recalc) ? clk->recalc(clk) :
omap2_get_dpll_rate(clk);
return r; return r;
} }
...@@ -413,9 +422,13 @@ int omap3_noncore_dpll_enable(struct clk *clk) ...@@ -413,9 +422,13 @@ int omap3_noncore_dpll_enable(struct clk *clk)
* Instructs a non-CORE DPLL to enter low-power stop. This function is * Instructs a non-CORE DPLL to enter low-power stop. This function is
* intended for use in struct clkops. No return value. * intended for use in struct clkops. No return value.
*/ */
void omap3_noncore_dpll_disable(struct clk *clk) void omap3_noncore_dpll_disable(struct clk_hw *hw)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
_omap3_noncore_dpll_stop(clk); _omap3_noncore_dpll_stop(clk);
if (clk->clkdm)
clkdm_clk_disable(clk->clkdm, hw->clk);
} }
...@@ -432,80 +445,72 @@ void omap3_noncore_dpll_disable(struct clk *clk) ...@@ -432,80 +445,72 @@ void omap3_noncore_dpll_disable(struct clk *clk)
* target rate if it hasn't been done already, then program and lock * target rate if it hasn't been done already, then program and lock
* the DPLL. Returns -EINVAL upon error, or 0 upon success. * the DPLL. Returns -EINVAL upon error, or 0 upon success.
*/ */
int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
struct clk *new_parent = NULL; struct clk *new_parent = NULL;
unsigned long hw_rate, bypass_rate;
u16 freqsel = 0; u16 freqsel = 0;
struct dpll_data *dd; struct dpll_data *dd;
int ret; int ret;
if (!clk || !rate) if (!hw || !rate)
return -EINVAL; return -EINVAL;
dd = clk->dpll_data; dd = clk->dpll_data;
if (!dd) if (!dd)
return -EINVAL; return -EINVAL;
hw_rate = (clk->recalc) ? clk->recalc(clk) : omap2_get_dpll_rate(clk); __clk_prepare(dd->clk_bypass);
if (rate == hw_rate) clk_enable(dd->clk_bypass);
return 0; __clk_prepare(dd->clk_ref);
clk_enable(dd->clk_ref);
/* if (__clk_get_rate(dd->clk_bypass) == rate &&
* Ensure both the bypass and ref clocks are enabled prior to (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
* doing anything; we need the bypass clock running to reprogram pr_debug("%s: %s: set rate: entering bypass.\n",
* the DPLL. __func__, __clk_get_name(hw->clk));
*/
omap2_clk_enable(dd->clk_bypass);
omap2_clk_enable(dd->clk_ref);
bypass_rate = __clk_get_rate(dd->clk_bypass);
if (bypass_rate == rate &&
(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
pr_debug("clock: %s: set rate: entering bypass.\n", clk->name);
ret = _omap3_noncore_dpll_bypass(clk); ret = _omap3_noncore_dpll_bypass(clk);
if (!ret) if (!ret)
new_parent = dd->clk_bypass; new_parent = dd->clk_bypass;
} else { } else {
if (dd->last_rounded_rate != rate) if (dd->last_rounded_rate != rate)
rate = clk->round_rate(clk, rate); rate = __clk_round_rate(hw->clk, rate);
if (dd->last_rounded_rate == 0) if (dd->last_rounded_rate == 0)
return -EINVAL; return -EINVAL;
/* No freqsel on OMAP4 and OMAP3630 */ /* No freqsel on OMAP4 and OMAP3630 */
if (!soc_is_am33xx() && !cpu_is_omap44xx() && !cpu_is_omap3630()) { if (!cpu_is_omap44xx() && !cpu_is_omap3630()) {
freqsel = _omap3_dpll_compute_freqsel(clk, freqsel = _omap3_dpll_compute_freqsel(clk,
dd->last_rounded_n); dd->last_rounded_n);
if (!freqsel) if (!freqsel)
WARN_ON(1); WARN_ON(1);
} }
pr_debug("clock: %s: set rate: locking rate to %lu.\n", pr_debug("%s: %s: set rate: locking rate to %lu.\n",
__clk_get_name(clk), rate); __func__, __clk_get_name(hw->clk), rate);
ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m,
dd->last_rounded_n, freqsel); dd->last_rounded_n, freqsel);
if (!ret) if (!ret)
new_parent = dd->clk_ref; new_parent = dd->clk_ref;
} }
if (!ret) {
/* /*
* Switch the parent clock in the hierarchy, and make sure * FIXME - this is all wrong. common code handles reparenting and
* that the new parent's usecount is correct. Note: we * migrating prepare/enable counts. dplls should be a multiplexer
* enable the new parent before disabling the old to avoid * clock and this should be a set_parent operation so that all of that
* any unnecessary hardware disable->enable transitions. * stuff is inherited for free
*/ */
if (clk->usecount) {
omap2_clk_enable(new_parent); if (!ret)
omap2_clk_disable(clk->parent); __clk_reparent(hw->clk, new_parent);
}
clk_reparent(clk, new_parent); clk_disable(dd->clk_ref);
clk->rate = rate; __clk_unprepare(dd->clk_ref);
} clk_disable(dd->clk_bypass);
omap2_clk_disable(dd->clk_ref); __clk_unprepare(dd->clk_bypass);
omap2_clk_disable(dd->clk_bypass);
return 0; return 0;
} }
...@@ -520,7 +525,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) ...@@ -520,7 +525,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
* -EINVAL if passed a null pointer or if the struct clk does not * -EINVAL if passed a null pointer or if the struct clk does not
* appear to refer to a DPLL. * appear to refer to a DPLL.
*/ */
u32 omap3_dpll_autoidle_read(struct clk *clk) u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk)
{ {
const struct dpll_data *dd; const struct dpll_data *dd;
u32 v; u32 v;
...@@ -549,7 +554,7 @@ u32 omap3_dpll_autoidle_read(struct clk *clk) ...@@ -549,7 +554,7 @@ u32 omap3_dpll_autoidle_read(struct clk *clk)
* OMAP3430. The DPLL will enter low-power stop when its downstream * OMAP3430. The DPLL will enter low-power stop when its downstream
* clocks are gated. No return value. * clocks are gated. No return value.
*/ */
void omap3_dpll_allow_idle(struct clk *clk) void omap3_dpll_allow_idle(struct clk_hw_omap *clk)
{ {
const struct dpll_data *dd; const struct dpll_data *dd;
u32 v; u32 v;
...@@ -559,11 +564,8 @@ void omap3_dpll_allow_idle(struct clk *clk) ...@@ -559,11 +564,8 @@ void omap3_dpll_allow_idle(struct clk *clk)
dd = clk->dpll_data; dd = clk->dpll_data;
if (!dd->autoidle_reg) { if (!dd->autoidle_reg)
pr_debug("clock: DPLL %s: autoidle not supported\n",
__clk_get_name(clk));
return; return;
}
/* /*
* REVISIT: CORE DPLL can optionally enter low-power bypass * REVISIT: CORE DPLL can optionally enter low-power bypass
...@@ -583,7 +585,7 @@ void omap3_dpll_allow_idle(struct clk *clk) ...@@ -583,7 +585,7 @@ void omap3_dpll_allow_idle(struct clk *clk)
* *
* Disable DPLL automatic idle control. No return value. * Disable DPLL automatic idle control. No return value.
*/ */
void omap3_dpll_deny_idle(struct clk *clk) void omap3_dpll_deny_idle(struct clk_hw_omap *clk)
{ {
const struct dpll_data *dd; const struct dpll_data *dd;
u32 v; u32 v;
...@@ -593,11 +595,8 @@ void omap3_dpll_deny_idle(struct clk *clk) ...@@ -593,11 +595,8 @@ void omap3_dpll_deny_idle(struct clk *clk)
dd = clk->dpll_data; dd = clk->dpll_data;
if (!dd->autoidle_reg) { if (!dd->autoidle_reg)
pr_debug("clock: DPLL %s: autoidle not supported\n",
__clk_get_name(clk));
return; return;
}
v = __raw_readl(dd->autoidle_reg); v = __raw_readl(dd->autoidle_reg);
v &= ~dd->autoidle_mask; v &= ~dd->autoidle_mask;
...@@ -615,18 +614,25 @@ void omap3_dpll_deny_idle(struct clk *clk) ...@@ -615,18 +614,25 @@ void omap3_dpll_deny_idle(struct clk *clk)
* Using parent clock DPLL data, look up DPLL state. If locked, set our * Using parent clock DPLL data, look up DPLL state. If locked, set our
* rate to the dpll_clk * 2; otherwise, just use dpll_clk. * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
*/ */
unsigned long omap3_clkoutx2_recalc(struct clk *clk) unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
unsigned long parent_rate)
{ {
const struct dpll_data *dd; const struct dpll_data *dd;
unsigned long rate; unsigned long rate;
u32 v; u32 v;
struct clk *pclk; struct clk_hw_omap *pclk = NULL;
unsigned long parent_rate; struct clk *parent;
/* Walk up the parents of clk, looking for a DPLL */ /* Walk up the parents of clk, looking for a DPLL */
pclk = __clk_get_parent(clk); do {
while (pclk && !pclk->dpll_data) do {
pclk = __clk_get_parent(pclk); parent = __clk_get_parent(hw->clk);
hw = __clk_get_hw(parent);
} while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC));
if (!hw)
break;
pclk = to_clk_hw_omap(hw);
} while (pclk && !pclk->dpll_data);
/* clk does not have a DPLL as a parent? error in the clock data */ /* clk does not have a DPLL as a parent? error in the clock data */
if (!pclk) { if (!pclk) {
...@@ -638,7 +644,6 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk) ...@@ -638,7 +644,6 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
WARN_ON(!dd->enable_mask); WARN_ON(!dd->enable_mask);
parent_rate = __clk_get_rate(__clk_get_parent(clk));
v = __raw_readl(dd->control_reg) & dd->enable_mask; v = __raw_readl(dd->control_reg) & dd->enable_mask;
v >>= __ffs(dd->enable_mask); v >>= __ffs(dd->enable_mask);
if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE)) if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE))
...@@ -649,15 +654,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk) ...@@ -649,15 +654,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
} }
/* OMAP3/4 non-CORE DPLL clkops */ /* OMAP3/4 non-CORE DPLL clkops */
const struct clk_hw_omap_ops clkhwops_omap3_dpll = {
const struct clkops clkops_omap3_noncore_dpll_ops = {
.enable = omap3_noncore_dpll_enable,
.disable = omap3_noncore_dpll_disable,
.allow_idle = omap3_dpll_allow_idle,
.deny_idle = omap3_dpll_deny_idle,
};
const struct clkops clkops_omap3_core_dpll_ops = {
.allow_idle = omap3_dpll_allow_idle, .allow_idle = omap3_dpll_allow_idle,
.deny_idle = omap3_dpll_deny_idle, .deny_idle = omap3_dpll_deny_idle,
}; };
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "cm-regbits-44xx.h" #include "cm-regbits-44xx.h"
/* Supported only on OMAP4 */ /* Supported only on OMAP4 */
int omap4_dpllmx_gatectrl_read(struct clk *clk) int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk)
{ {
u32 v; u32 v;
u32 mask; u32 mask;
...@@ -40,7 +40,7 @@ int omap4_dpllmx_gatectrl_read(struct clk *clk) ...@@ -40,7 +40,7 @@ int omap4_dpllmx_gatectrl_read(struct clk *clk)
return v; return v;
} }
void omap4_dpllmx_allow_gatectrl(struct clk *clk) void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk)
{ {
u32 v; u32 v;
u32 mask; u32 mask;
...@@ -58,7 +58,7 @@ void omap4_dpllmx_allow_gatectrl(struct clk *clk) ...@@ -58,7 +58,7 @@ void omap4_dpllmx_allow_gatectrl(struct clk *clk)
__raw_writel(v, clk->clksel_reg); __raw_writel(v, clk->clksel_reg);
} }
void omap4_dpllmx_deny_gatectrl(struct clk *clk) void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
{ {
u32 v; u32 v;
u32 mask; u32 mask;
...@@ -76,7 +76,7 @@ void omap4_dpllmx_deny_gatectrl(struct clk *clk) ...@@ -76,7 +76,7 @@ void omap4_dpllmx_deny_gatectrl(struct clk *clk)
__raw_writel(v, clk->clksel_reg); __raw_writel(v, clk->clksel_reg);
} }
const struct clkops clkops_omap4_dpllmx_ops = { const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = {
.allow_idle = omap4_dpllmx_allow_gatectrl, .allow_idle = omap4_dpllmx_allow_gatectrl,
.deny_idle = omap4_dpllmx_deny_gatectrl, .deny_idle = omap4_dpllmx_deny_gatectrl,
}; };
...@@ -90,8 +90,10 @@ const struct clkops clkops_omap4_dpllmx_ops = { ...@@ -90,8 +90,10 @@ const struct clkops clkops_omap4_dpllmx_ops = {
* OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers) * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers)
* upon success, or 0 upon error. * upon success, or 0 upon error.
*/ */
unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk) unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
unsigned long parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 v; u32 v;
unsigned long rate; unsigned long rate;
struct dpll_data *dd; struct dpll_data *dd;
...@@ -123,8 +125,11 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk) ...@@ -123,8 +125,11 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk)
* M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or
* ~0 if an error occurred in omap2_dpll_round_rate(). * ~0 if an error occurred in omap2_dpll_round_rate().
*/ */
long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate) long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
unsigned long target_rate,
unsigned long *parent_rate)
{ {
struct clk_hw_omap *clk = to_clk_hw_omap(hw);
u32 v; u32 v;
struct dpll_data *dd; struct dpll_data *dd;
long r; long r;
...@@ -140,7 +145,7 @@ long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate) ...@@ -140,7 +145,7 @@ long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate)
if (v) if (v)
target_rate = target_rate / OMAP4430_REGM4XEN_MULT; target_rate = target_rate / OMAP4430_REGM4XEN_MULT;
r = omap2_dpll_round_rate(clk, target_rate); r = omap2_dpll_round_rate(hw, target_rate, NULL);
if (r == ~0) if (r == ~0)
return r; return r;
......
...@@ -407,6 +407,7 @@ void __init omap2420_init_late(void) ...@@ -407,6 +407,7 @@ void __init omap2420_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap2_pm_init(); omap2_pm_init();
omap2_clk_enable_autoidle_all();
} }
#endif #endif
...@@ -436,6 +437,7 @@ void __init omap2430_init_late(void) ...@@ -436,6 +437,7 @@ void __init omap2430_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap2_pm_init(); omap2_pm_init();
omap2_clk_enable_autoidle_all();
} }
#endif #endif
...@@ -509,6 +511,7 @@ void __init omap3_init_late(void) ...@@ -509,6 +511,7 @@ void __init omap3_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
omap2_clk_enable_autoidle_all();
} }
void __init omap3430_init_late(void) void __init omap3430_init_late(void)
...@@ -516,6 +519,7 @@ void __init omap3430_init_late(void) ...@@ -516,6 +519,7 @@ void __init omap3430_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
omap2_clk_enable_autoidle_all();
} }
void __init omap35xx_init_late(void) void __init omap35xx_init_late(void)
...@@ -523,6 +527,7 @@ void __init omap35xx_init_late(void) ...@@ -523,6 +527,7 @@ void __init omap35xx_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
omap2_clk_enable_autoidle_all();
} }
void __init omap3630_init_late(void) void __init omap3630_init_late(void)
...@@ -530,6 +535,7 @@ void __init omap3630_init_late(void) ...@@ -530,6 +535,7 @@ void __init omap3630_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
omap2_clk_enable_autoidle_all();
} }
void __init am35xx_init_late(void) void __init am35xx_init_late(void)
...@@ -537,6 +543,7 @@ void __init am35xx_init_late(void) ...@@ -537,6 +543,7 @@ void __init am35xx_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
omap2_clk_enable_autoidle_all();
} }
void __init ti81xx_init_late(void) void __init ti81xx_init_late(void)
...@@ -544,6 +551,7 @@ void __init ti81xx_init_late(void) ...@@ -544,6 +551,7 @@ void __init ti81xx_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap3_pm_init(); omap3_pm_init();
omap2_clk_enable_autoidle_all();
} }
#endif #endif
...@@ -597,6 +605,7 @@ void __init omap4430_init_late(void) ...@@ -597,6 +605,7 @@ void __init omap4430_init_late(void)
omap_mux_late_init(); omap_mux_late_init();
omap2_common_pm_late_init(); omap2_common_pm_late_init();
omap4_pm_init(); omap4_pm_init();
omap2_clk_enable_autoidle_all();
} }
#endif #endif
......
...@@ -130,7 +130,7 @@ ...@@ -130,7 +130,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/clk.h> #include <linux/clk-provider.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/list.h> #include <linux/list.h>
...@@ -614,6 +614,19 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) ...@@ -614,6 +614,19 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
return 0; return 0;
} }
static struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
{
struct clk_hw_omap *clk;
if (oh->clkdm) {
return oh->clkdm;
} else if (oh->_clk) {
clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
return clk->clkdm;
}
return NULL;
}
/** /**
* _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active
* @oh: struct omap_hwmod * * @oh: struct omap_hwmod *
...@@ -629,13 +642,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v) ...@@ -629,13 +642,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
*/ */
static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
{ {
if (!oh->_clk) struct clockdomain *clkdm, *init_clkdm;
clkdm = _get_clkdm(oh);
init_clkdm = _get_clkdm(init_oh);
if (!clkdm || !init_clkdm)
return -EINVAL; return -EINVAL;
if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
return 0; return 0;
return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); return clkdm_add_sleepdep(clkdm, init_clkdm);
} }
/** /**
...@@ -653,13 +671,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) ...@@ -653,13 +671,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
*/ */
static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
{ {
if (!oh->_clk) struct clockdomain *clkdm, *init_clkdm;
clkdm = _get_clkdm(oh);
init_clkdm = _get_clkdm(init_oh);
if (!clkdm || !init_clkdm)
return -EINVAL; return -EINVAL;
if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
return 0; return 0;
return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); return clkdm_del_sleepdep(clkdm, init_clkdm);
} }
/** /**
...@@ -693,7 +716,7 @@ static int _init_main_clk(struct omap_hwmod *oh) ...@@ -693,7 +716,7 @@ static int _init_main_clk(struct omap_hwmod *oh)
*/ */
clk_prepare(oh->_clk); clk_prepare(oh->_clk);
if (!oh->_clk->clkdm) if (!_get_clkdm(oh))
pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n", pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n",
oh->name, oh->main_clk); oh->name, oh->main_clk);
...@@ -1276,6 +1299,7 @@ static void _enable_sysc(struct omap_hwmod *oh) ...@@ -1276,6 +1299,7 @@ static void _enable_sysc(struct omap_hwmod *oh)
u8 idlemode, sf; u8 idlemode, sf;
u32 v; u32 v;
bool clkdm_act; bool clkdm_act;
struct clockdomain *clkdm;
if (!oh->class->sysc) if (!oh->class->sysc)
return; return;
...@@ -1283,11 +1307,9 @@ static void _enable_sysc(struct omap_hwmod *oh) ...@@ -1283,11 +1307,9 @@ static void _enable_sysc(struct omap_hwmod *oh)
v = oh->_sysc_cache; v = oh->_sysc_cache;
sf = oh->class->sysc->sysc_flags; sf = oh->class->sysc->sysc_flags;
clkdm = _get_clkdm(oh);
if (sf & SYSC_HAS_SIDLEMODE) { if (sf & SYSC_HAS_SIDLEMODE) {
clkdm_act = ((oh->clkdm && clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU);
oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) ||
(oh->_clk && oh->_clk->clkdm &&
oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU));
if (clkdm_act && !(oh->class->sysc->idlemodes & if (clkdm_act && !(oh->class->sysc->idlemodes &
(SIDLE_SMART | SIDLE_SMART_WKUP))) (SIDLE_SMART | SIDLE_SMART_WKUP)))
idlemode = HWMOD_IDLEMODE_FORCE; idlemode = HWMOD_IDLEMODE_FORCE;
...@@ -1489,11 +1511,12 @@ static int _init_clocks(struct omap_hwmod *oh, void *data) ...@@ -1489,11 +1511,12 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name); pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name);
if (soc_ops.init_clkdm)
ret |= soc_ops.init_clkdm(oh);
ret |= _init_main_clk(oh); ret |= _init_main_clk(oh);
ret |= _init_interface_clks(oh); ret |= _init_interface_clks(oh);
ret |= _init_opt_clks(oh); ret |= _init_opt_clks(oh);
if (soc_ops.init_clkdm)
ret |= soc_ops.init_clkdm(oh);
if (!ret) if (!ret)
oh->_state = _HWMOD_STATE_CLKS_INITED; oh->_state = _HWMOD_STATE_CLKS_INITED;
...@@ -3556,10 +3579,15 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) ...@@ -3556,10 +3579,15 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
{ {
struct clk *c; struct clk *c;
struct omap_hwmod_ocp_if *oi; struct omap_hwmod_ocp_if *oi;
struct clockdomain *clkdm;
struct clk_hw_omap *clk;
if (!oh) if (!oh)
return NULL; return NULL;
if (oh->clkdm)
return oh->clkdm->pwrdm.ptr;
if (oh->_clk) { if (oh->_clk) {
c = oh->_clk; c = oh->_clk;
} else { } else {
...@@ -3569,11 +3597,12 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh) ...@@ -3569,11 +3597,12 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
c = oi->_clk; c = oi->_clk;
} }
if (!c->clkdm) clk = to_clk_hw_omap(__clk_get_hw(c));
clkdm = clk->clkdm;
if (!clkdm)
return NULL; return NULL;
return c->clkdm->pwrdm.ptr; return clkdm->pwrdm.ptr;
} }
/** /**
......
...@@ -1410,7 +1410,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = { ...@@ -1410,7 +1410,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_mpu_irqs[] = {
static struct omap_hwmod omap34xx_sr1_hwmod = { static struct omap_hwmod omap34xx_sr1_hwmod = {
.name = "smartreflex_mpu_iva", .name = "smartreflex_mpu_iva",
.class = &omap34xx_smartreflex_hwmod_class, .class = &omap34xx_smartreflex_hwmod_class,
.main_clk = "smartreflex_mpu_iva_fck", .main_clk = "sr1_fck",
.prcm = { .prcm = {
.omap2 = { .omap2 = {
.prcm_reg_id = 1, .prcm_reg_id = 1,
...@@ -1428,7 +1428,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = { ...@@ -1428,7 +1428,7 @@ static struct omap_hwmod omap34xx_sr1_hwmod = {
static struct omap_hwmod omap36xx_sr1_hwmod = { static struct omap_hwmod omap36xx_sr1_hwmod = {
.name = "smartreflex_mpu_iva", .name = "smartreflex_mpu_iva",
.class = &omap36xx_smartreflex_hwmod_class, .class = &omap36xx_smartreflex_hwmod_class,
.main_clk = "smartreflex_mpu_iva_fck", .main_clk = "sr1_fck",
.prcm = { .prcm = {
.omap2 = { .omap2 = {
.prcm_reg_id = 1, .prcm_reg_id = 1,
...@@ -1455,7 +1455,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = { ...@@ -1455,7 +1455,7 @@ static struct omap_hwmod_irq_info omap3_smartreflex_core_irqs[] = {
static struct omap_hwmod omap34xx_sr2_hwmod = { static struct omap_hwmod omap34xx_sr2_hwmod = {
.name = "smartreflex_core", .name = "smartreflex_core",
.class = &omap34xx_smartreflex_hwmod_class, .class = &omap34xx_smartreflex_hwmod_class,
.main_clk = "smartreflex_core_fck", .main_clk = "sr2_fck",
.prcm = { .prcm = {
.omap2 = { .omap2 = {
.prcm_reg_id = 1, .prcm_reg_id = 1,
...@@ -1473,7 +1473,7 @@ static struct omap_hwmod omap34xx_sr2_hwmod = { ...@@ -1473,7 +1473,7 @@ static struct omap_hwmod omap34xx_sr2_hwmod = {
static struct omap_hwmod omap36xx_sr2_hwmod = { static struct omap_hwmod omap36xx_sr2_hwmod = {
.name = "smartreflex_core", .name = "smartreflex_core",
.class = &omap36xx_smartreflex_hwmod_class, .class = &omap36xx_smartreflex_hwmod_class,
.main_clk = "smartreflex_core_fck", .main_clk = "sr2_fck",
.prcm = { .prcm = {
.omap2 = { .omap2 = {
.prcm_reg_id = 1, .prcm_reg_id = 1,
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/clk.h> #include <linux/clk-provider.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/gpio.h> #include <linux/gpio.h>
...@@ -202,7 +202,7 @@ static int omap2_can_sleep(void) ...@@ -202,7 +202,7 @@ static int omap2_can_sleep(void)
{ {
if (omap2_fclks_active()) if (omap2_fclks_active())
return 0; return 0;
if (osc_ck->usecount > 1) if (__clk_is_enabled(osc_ck))
return 0; return 0;
if (omap_dma_running()) if (omap_dma_running())
return 0; return 0;
......
...@@ -107,12 +107,14 @@ ...@@ -107,12 +107,14 @@
#define OMAP2420_CLKOUT2_EN_MASK (1 << 15) #define OMAP2420_CLKOUT2_EN_MASK (1 << 15)
#define OMAP2420_CLKOUT2_DIV_SHIFT 11 #define OMAP2420_CLKOUT2_DIV_SHIFT 11
#define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11) #define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11)
#define OMAP2420_CLKOUT2_DIV_WIDTH 3
#define OMAP2420_CLKOUT2_SOURCE_SHIFT 8 #define OMAP2420_CLKOUT2_SOURCE_SHIFT 8
#define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8) #define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8)
#define OMAP24XX_CLKOUT_EN_SHIFT 7 #define OMAP24XX_CLKOUT_EN_SHIFT 7
#define OMAP24XX_CLKOUT_EN_MASK (1 << 7) #define OMAP24XX_CLKOUT_EN_MASK (1 << 7)
#define OMAP24XX_CLKOUT_DIV_SHIFT 3 #define OMAP24XX_CLKOUT_DIV_SHIFT 3
#define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3) #define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3)
#define OMAP24XX_CLKOUT_DIV_WIDTH 3
#define OMAP24XX_CLKOUT_SOURCE_SHIFT 0 #define OMAP24XX_CLKOUT_SOURCE_SHIFT 0
#define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0) #define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0)
......
...@@ -384,6 +384,7 @@ ...@@ -384,6 +384,7 @@
/* PRM_CLKSEL */ /* PRM_CLKSEL */
#define OMAP3430_SYS_CLKIN_SEL_SHIFT 0 #define OMAP3430_SYS_CLKIN_SEL_SHIFT 0
#define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0) #define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0)
#define OMAP3430_SYS_CLKIN_SEL_WIDTH 3
/* PRM_CLKOUT_CTRL */ /* PRM_CLKOUT_CTRL */
#define OMAP3430_CLKOUT_EN_MASK (1 << 7) #define OMAP3430_CLKOUT_EN_MASK (1 << 7)
......
...@@ -152,6 +152,7 @@ extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm); ...@@ -152,6 +152,7 @@ extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
/* Named PRCM_CLKSRC_CTRL on the 24XX */ /* Named PRCM_CLKSRC_CTRL on the 24XX */
#define OMAP_SYSCLKDIV_SHIFT 6 #define OMAP_SYSCLKDIV_SHIFT 6
#define OMAP_SYSCLKDIV_MASK (0x3 << 6) #define OMAP_SYSCLKDIV_MASK (0x3 << 6)
#define OMAP_SYSCLKDIV_WIDTH 2
#define OMAP_AUTOEXTCLKMODE_SHIFT 3 #define OMAP_AUTOEXTCLKMODE_SHIFT 3
#define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3) #define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3)
#define OMAP_SYSCLKSEL_SHIFT 0 #define OMAP_SYSCLKSEL_SHIFT 0
......
...@@ -127,12 +127,14 @@ ...@@ -127,12 +127,14 @@
/* AUXCLKREQ0 */ /* AUXCLKREQ0 */
#define OMAP4_MAPPING_SHIFT 2 #define OMAP4_MAPPING_SHIFT 2
#define OMAP4_MAPPING_MASK (0x7 << 2) #define OMAP4_MAPPING_MASK (0x7 << 2)
#define OMAP4_MAPPING_WIDTH 3
#define OMAP4_ACCURACY_SHIFT 1 #define OMAP4_ACCURACY_SHIFT 1
#define OMAP4_ACCURACY_MASK (1 << 1) #define OMAP4_ACCURACY_MASK (1 << 1)
/* AUXCLK0 */ /* AUXCLK0 */
#define OMAP4_CLKDIV_SHIFT 16 #define OMAP4_CLKDIV_SHIFT 16
#define OMAP4_CLKDIV_MASK (0xf << 16) #define OMAP4_CLKDIV_MASK (0xf << 16)
#define OMAP4_CLKDIV_WIDTH 4
#define OMAP4_DISABLECLK_SHIFT 9 #define OMAP4_DISABLECLK_SHIFT 9
#define OMAP4_DISABLECLK_MASK (1 << 9) #define OMAP4_DISABLECLK_MASK (1 << 9)
#define OMAP4_ENABLE_SHIFT 8 #define OMAP4_ENABLE_SHIFT 8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment