1*52e6676eSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2aafd900cSTero Kristo /*
3aafd900cSTero Kristo * OMAP3 Clock init
4aafd900cSTero Kristo *
5aafd900cSTero Kristo * Copyright (C) 2013 Texas Instruments, Inc
6aafd900cSTero Kristo * Tero Kristo (t-kristo@ti.com)
7aafd900cSTero Kristo */
8aafd900cSTero Kristo
9aafd900cSTero Kristo #include <linux/kernel.h>
10aafd900cSTero Kristo #include <linux/list.h>
111b29e601SStephen Boyd #include <linux/clk.h>
12aafd900cSTero Kristo #include <linux/clk-provider.h>
13aafd900cSTero Kristo #include <linux/clk/ti.h>
14aafd900cSTero Kristo
15a5aa8a60STero Kristo #include "clock.h"
16aafd900cSTero Kristo
17f2671d5cSTero Kristo #define OMAP3430ES2_ST_DSS_IDLE_SHIFT 1
18f2671d5cSTero Kristo #define OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT 5
19f2671d5cSTero Kristo #define OMAP3430ES2_ST_SSI_IDLE_SHIFT 8
20f2671d5cSTero Kristo
21f2671d5cSTero Kristo #define OMAP34XX_CM_IDLEST_VAL 1
22f2671d5cSTero Kristo
23c9a58b0aSTero Kristo /*
24c9a58b0aSTero Kristo * In AM35xx IPSS, the {ICK,FCK} enable bits for modules are exported
25c9a58b0aSTero Kristo * in the same register at a bit offset of 0x8. The EN_ACK for ICK is
26c9a58b0aSTero Kristo * at an offset of 4 from ICK enable bit.
27c9a58b0aSTero Kristo */
28c9a58b0aSTero Kristo #define AM35XX_IPSS_ICK_MASK 0xF
29c9a58b0aSTero Kristo #define AM35XX_IPSS_ICK_EN_ACK_OFFSET 0x4
30c9a58b0aSTero Kristo #define AM35XX_IPSS_ICK_FCK_OFFSET 0x8
31c9a58b0aSTero Kristo #define AM35XX_IPSS_CLK_IDLEST_VAL 0
32c9a58b0aSTero Kristo
33c9a58b0aSTero Kristo #define AM35XX_ST_IPSS_SHIFT 5
34c9a58b0aSTero Kristo
35f2671d5cSTero Kristo /**
36f2671d5cSTero Kristo * omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI
37f2671d5cSTero Kristo * @clk: struct clk * being enabled
38f2671d5cSTero Kristo * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
39f2671d5cSTero Kristo * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
40f2671d5cSTero Kristo * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
41f2671d5cSTero Kristo *
42f2671d5cSTero Kristo * The OMAP3430ES2 SSI target CM_IDLEST bit is at a different shift
43f2671d5cSTero Kristo * from the CM_{I,F}CLKEN bit. Pass back the correct info via
44f2671d5cSTero Kristo * @idlest_reg and @idlest_bit. No return value.
45f2671d5cSTero Kristo */
omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap * clk,struct clk_omap_reg * idlest_reg,u8 * idlest_bit,u8 * idlest_val)46f2671d5cSTero Kristo static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
476c0afb50STero Kristo struct clk_omap_reg *idlest_reg,
48f2671d5cSTero Kristo u8 *idlest_bit,
49f2671d5cSTero Kristo u8 *idlest_val)
50f2671d5cSTero Kristo {
516c0afb50STero Kristo memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
526c0afb50STero Kristo idlest_reg->offset &= ~0xf0;
536c0afb50STero Kristo idlest_reg->offset |= 0x20;
54f2671d5cSTero Kristo *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
55f2671d5cSTero Kristo *idlest_val = OMAP34XX_CM_IDLEST_VAL;
56f2671d5cSTero Kristo }
57f2671d5cSTero Kristo
58f2671d5cSTero Kristo const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
59f2671d5cSTero Kristo .allow_idle = omap2_clkt_iclk_allow_idle,
60f2671d5cSTero Kristo .deny_idle = omap2_clkt_iclk_deny_idle,
61f2671d5cSTero Kristo .find_idlest = omap3430es2_clk_ssi_find_idlest,
62f2671d5cSTero Kristo .find_companion = omap2_clk_dflt_find_companion,
63f2671d5cSTero Kristo };
64f2671d5cSTero Kristo
65f2671d5cSTero Kristo /**
66f2671d5cSTero Kristo * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
67f2671d5cSTero Kristo * @clk: struct clk * being enabled
68f2671d5cSTero Kristo * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
69f2671d5cSTero Kristo * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
70f2671d5cSTero Kristo * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
71f2671d5cSTero Kristo *
72f2671d5cSTero Kristo * Some OMAP modules on OMAP3 ES2+ chips have both initiator and
73f2671d5cSTero Kristo * target IDLEST bits. For our purposes, we are concerned with the
74f2671d5cSTero Kristo * target IDLEST bits, which exist at a different bit position than
75f2671d5cSTero Kristo * the *CLKEN bit position for these modules (DSS and USBHOST) (The
76f2671d5cSTero Kristo * default find_idlest code assumes that they are at the same
77f2671d5cSTero Kristo * position.) No return value.
78f2671d5cSTero Kristo */
796c0afb50STero Kristo static void
omap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap * clk,struct clk_omap_reg * idlest_reg,u8 * idlest_bit,u8 * idlest_val)806c0afb50STero Kristo omap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap *clk,
816c0afb50STero Kristo struct clk_omap_reg *idlest_reg,
826c0afb50STero Kristo u8 *idlest_bit, u8 *idlest_val)
83f2671d5cSTero Kristo {
846c0afb50STero Kristo memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
85f2671d5cSTero Kristo
866c0afb50STero Kristo idlest_reg->offset &= ~0xf0;
876c0afb50STero Kristo idlest_reg->offset |= 0x20;
88f2671d5cSTero Kristo /* USBHOST_IDLE has same shift */
89f2671d5cSTero Kristo *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT;
90f2671d5cSTero Kristo *idlest_val = OMAP34XX_CM_IDLEST_VAL;
91f2671d5cSTero Kristo }
92f2671d5cSTero Kristo
93f2671d5cSTero Kristo const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait = {
94f2671d5cSTero Kristo .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
95f2671d5cSTero Kristo .find_companion = omap2_clk_dflt_find_companion,
96f2671d5cSTero Kristo };
97f2671d5cSTero Kristo
98f2671d5cSTero Kristo const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait = {
99f2671d5cSTero Kristo .allow_idle = omap2_clkt_iclk_allow_idle,
100f2671d5cSTero Kristo .deny_idle = omap2_clkt_iclk_deny_idle,
101f2671d5cSTero Kristo .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
102f2671d5cSTero Kristo .find_companion = omap2_clk_dflt_find_companion,
103f2671d5cSTero Kristo };
104f2671d5cSTero Kristo
105f2671d5cSTero Kristo /**
106f2671d5cSTero Kristo * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
107f2671d5cSTero Kristo * @clk: struct clk * being enabled
108f2671d5cSTero Kristo * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
109f2671d5cSTero Kristo * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
110f2671d5cSTero Kristo * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
111f2671d5cSTero Kristo *
112f2671d5cSTero Kristo * The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different
113f2671d5cSTero Kristo * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
114f2671d5cSTero Kristo * @idlest_reg and @idlest_bit. No return value.
115f2671d5cSTero Kristo */
1166c0afb50STero Kristo static void
omap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap * clk,struct clk_omap_reg * idlest_reg,u8 * idlest_bit,u8 * idlest_val)1176c0afb50STero Kristo omap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap *clk,
1186c0afb50STero Kristo struct clk_omap_reg *idlest_reg,
119f2671d5cSTero Kristo u8 *idlest_bit,
120f2671d5cSTero Kristo u8 *idlest_val)
121f2671d5cSTero Kristo {
1226c0afb50STero Kristo memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
1236c0afb50STero Kristo idlest_reg->offset &= ~0xf0;
1246c0afb50STero Kristo idlest_reg->offset |= 0x20;
125f2671d5cSTero Kristo *idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT;
126f2671d5cSTero Kristo *idlest_val = OMAP34XX_CM_IDLEST_VAL;
127f2671d5cSTero Kristo }
128f2671d5cSTero Kristo
129f2671d5cSTero Kristo const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
130f2671d5cSTero Kristo .allow_idle = omap2_clkt_iclk_allow_idle,
131f2671d5cSTero Kristo .deny_idle = omap2_clkt_iclk_deny_idle,
132f2671d5cSTero Kristo .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
133f2671d5cSTero Kristo .find_companion = omap2_clk_dflt_find_companion,
134f2671d5cSTero Kristo };
135f2671d5cSTero Kristo
136c9a58b0aSTero Kristo /**
137c9a58b0aSTero Kristo * am35xx_clk_find_idlest - return clock ACK info for AM35XX IPSS
138c9a58b0aSTero Kristo * @clk: struct clk * being enabled
139c9a58b0aSTero Kristo * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
140c9a58b0aSTero Kristo * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
141c9a58b0aSTero Kristo * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
142c9a58b0aSTero Kristo *
143c9a58b0aSTero Kristo * The interface clocks on AM35xx IPSS reflects the clock idle status
144c9a58b0aSTero Kristo * in the enable register itsel at a bit offset of 4 from the enable
145c9a58b0aSTero Kristo * bit. A value of 1 indicates that clock is enabled.
146c9a58b0aSTero Kristo */
am35xx_clk_find_idlest(struct clk_hw_omap * clk,struct clk_omap_reg * idlest_reg,u8 * idlest_bit,u8 * idlest_val)147c9a58b0aSTero Kristo static void am35xx_clk_find_idlest(struct clk_hw_omap *clk,
1486c0afb50STero Kristo struct clk_omap_reg *idlest_reg,
149c9a58b0aSTero Kristo u8 *idlest_bit,
150c9a58b0aSTero Kristo u8 *idlest_val)
151c9a58b0aSTero Kristo {
1526c0afb50STero Kristo memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
153c9a58b0aSTero Kristo *idlest_bit = clk->enable_bit + AM35XX_IPSS_ICK_EN_ACK_OFFSET;
154c9a58b0aSTero Kristo *idlest_val = AM35XX_IPSS_CLK_IDLEST_VAL;
155c9a58b0aSTero Kristo }
156c9a58b0aSTero Kristo
157c9a58b0aSTero Kristo /**
158c9a58b0aSTero Kristo * am35xx_clk_find_companion - find companion clock to @clk
159c9a58b0aSTero Kristo * @clk: struct clk * to find the companion clock of
160c9a58b0aSTero Kristo * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in
161c9a58b0aSTero Kristo * @other_bit: u8 ** to return the companion clock bit shift in
162c9a58b0aSTero Kristo *
163c9a58b0aSTero Kristo * Some clocks don't have companion clocks. For example, modules with
164c9a58b0aSTero Kristo * only an interface clock (such as HECC) don't have a companion
165c9a58b0aSTero Kristo * clock. Right now, this code relies on the hardware exporting a bit
166c9a58b0aSTero Kristo * in the correct companion register that indicates that the
167c9a58b0aSTero Kristo * nonexistent 'companion clock' is active. Future patches will
168c9a58b0aSTero Kristo * associate this type of code with per-module data structures to
169c9a58b0aSTero Kristo * avoid this issue, and remove the casts. No return value.
170c9a58b0aSTero Kristo */
am35xx_clk_find_companion(struct clk_hw_omap * clk,struct clk_omap_reg * other_reg,u8 * other_bit)171c9a58b0aSTero Kristo static void am35xx_clk_find_companion(struct clk_hw_omap *clk,
1726c0afb50STero Kristo struct clk_omap_reg *other_reg,
173c9a58b0aSTero Kristo u8 *other_bit)
174c9a58b0aSTero Kristo {
1756c0afb50STero Kristo memcpy(other_reg, &clk->enable_reg, sizeof(*other_reg));
176c9a58b0aSTero Kristo if (clk->enable_bit & AM35XX_IPSS_ICK_MASK)
177c9a58b0aSTero Kristo *other_bit = clk->enable_bit + AM35XX_IPSS_ICK_FCK_OFFSET;
178c9a58b0aSTero Kristo else
179c9a58b0aSTero Kristo *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET;
180c9a58b0aSTero Kristo }
181c9a58b0aSTero Kristo
182c9a58b0aSTero Kristo const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait = {
183c9a58b0aSTero Kristo .find_idlest = am35xx_clk_find_idlest,
184c9a58b0aSTero Kristo .find_companion = am35xx_clk_find_companion,
185c9a58b0aSTero Kristo };
186c9a58b0aSTero Kristo
187c9a58b0aSTero Kristo /**
188c9a58b0aSTero Kristo * am35xx_clk_ipss_find_idlest - return CM_IDLEST info for IPSS
189c9a58b0aSTero Kristo * @clk: struct clk * being enabled
190c9a58b0aSTero Kristo * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
191c9a58b0aSTero Kristo * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
192c9a58b0aSTero Kristo * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
193c9a58b0aSTero Kristo *
194c9a58b0aSTero Kristo * The IPSS target CM_IDLEST bit is at a different shift from the
195c9a58b0aSTero Kristo * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg
196c9a58b0aSTero Kristo * and @idlest_bit. No return value.
197c9a58b0aSTero Kristo */
am35xx_clk_ipss_find_idlest(struct clk_hw_omap * clk,struct clk_omap_reg * idlest_reg,u8 * idlest_bit,u8 * idlest_val)198c9a58b0aSTero Kristo static void am35xx_clk_ipss_find_idlest(struct clk_hw_omap *clk,
1996c0afb50STero Kristo struct clk_omap_reg *idlest_reg,
200c9a58b0aSTero Kristo u8 *idlest_bit,
201c9a58b0aSTero Kristo u8 *idlest_val)
202c9a58b0aSTero Kristo {
2036c0afb50STero Kristo memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
204c9a58b0aSTero Kristo
2056c0afb50STero Kristo idlest_reg->offset &= ~0xf0;
2066c0afb50STero Kristo idlest_reg->offset |= 0x20;
207c9a58b0aSTero Kristo *idlest_bit = AM35XX_ST_IPSS_SHIFT;
208c9a58b0aSTero Kristo *idlest_val = OMAP34XX_CM_IDLEST_VAL;
209c9a58b0aSTero Kristo }
210c9a58b0aSTero Kristo
211c9a58b0aSTero Kristo const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait = {
212c9a58b0aSTero Kristo .allow_idle = omap2_clkt_iclk_allow_idle,
213c9a58b0aSTero Kristo .deny_idle = omap2_clkt_iclk_deny_idle,
214c9a58b0aSTero Kristo .find_idlest = am35xx_clk_ipss_find_idlest,
215c9a58b0aSTero Kristo .find_companion = omap2_clk_dflt_find_companion,
216c9a58b0aSTero Kristo };
217c9a58b0aSTero Kristo
218aafd900cSTero Kristo static struct ti_dt_clk omap3xxx_clks[] = {
219aafd900cSTero Kristo DT_CLK(NULL, "timer_32k_ck", "omap_32k_fck"),
220aafd900cSTero Kristo DT_CLK(NULL, "timer_sys_ck", "sys_ck"),
221aafd900cSTero Kristo { .node_name = NULL },
222aafd900cSTero Kristo };
223aafd900cSTero Kristo
224aafd900cSTero Kristo static struct ti_dt_clk omap36xx_omap3430es2plus_clks[] = {
225aafd900cSTero Kristo DT_CLK(NULL, "ssi_ssr_fck", "ssi_ssr_fck_3430es2"),
226aafd900cSTero Kristo DT_CLK(NULL, "ssi_sst_fck", "ssi_sst_fck_3430es2"),
227aafd900cSTero Kristo DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_3430es2"),
228aafd900cSTero Kristo DT_CLK(NULL, "ssi_ick", "ssi_ick_3430es2"),
229aafd900cSTero Kristo { .node_name = NULL },
230aafd900cSTero Kristo };
231aafd900cSTero Kristo
232aafd900cSTero Kristo static struct ti_dt_clk omap3430es1_clks[] = {
233aafd900cSTero Kristo DT_CLK(NULL, "ssi_ssr_fck", "ssi_ssr_fck_3430es1"),
234aafd900cSTero Kristo DT_CLK(NULL, "ssi_sst_fck", "ssi_sst_fck_3430es1"),
235aafd900cSTero Kristo DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_3430es1"),
236aafd900cSTero Kristo DT_CLK(NULL, "ssi_ick", "ssi_ick_3430es1"),
237aafd900cSTero Kristo DT_CLK(NULL, "dss1_alwon_fck", "dss1_alwon_fck_3430es1"),
238aafd900cSTero Kristo DT_CLK(NULL, "dss_ick", "dss_ick_3430es1"),
239aafd900cSTero Kristo { .node_name = NULL },
240aafd900cSTero Kristo };
241aafd900cSTero Kristo
242aafd900cSTero Kristo static struct ti_dt_clk omap36xx_am35xx_omap3430es2plus_clks[] = {
243aafd900cSTero Kristo DT_CLK(NULL, "dss1_alwon_fck", "dss1_alwon_fck_3430es2"),
244aafd900cSTero Kristo DT_CLK(NULL, "dss_ick", "dss_ick_3430es2"),
245aafd900cSTero Kristo { .node_name = NULL },
246aafd900cSTero Kristo };
247aafd900cSTero Kristo
248aafd900cSTero Kristo static struct ti_dt_clk am35xx_clks[] = {
249aafd900cSTero Kristo DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_am35xx"),
250aafd900cSTero Kristo DT_CLK(NULL, "hsotgusb_fck", "hsotgusb_fck_am35xx"),
251aafd900cSTero Kristo DT_CLK(NULL, "uart4_ick", "uart4_ick_am35xx"),
252aafd900cSTero Kristo DT_CLK(NULL, "uart4_fck", "uart4_fck_am35xx"),
253aafd900cSTero Kristo { .node_name = NULL },
254aafd900cSTero Kristo };
255aafd900cSTero Kristo
256aafd900cSTero Kristo static const char *enable_init_clks[] = {
257aafd900cSTero Kristo "sdrc_ick",
258aafd900cSTero Kristo "gpmc_fck",
259aafd900cSTero Kristo "omapctrl_ick",
260aafd900cSTero Kristo };
261aafd900cSTero Kristo
262aafd900cSTero Kristo enum {
263aafd900cSTero Kristo OMAP3_SOC_AM35XX,
264aafd900cSTero Kristo OMAP3_SOC_OMAP3430_ES1,
265aafd900cSTero Kristo OMAP3_SOC_OMAP3430_ES2_PLUS,
266aafd900cSTero Kristo OMAP3_SOC_OMAP3630,
267aafd900cSTero Kristo };
268aafd900cSTero Kristo
2690565fb16STero Kristo /**
2700565fb16STero Kristo * omap3_clk_lock_dpll5 - locks DPLL5
2710565fb16STero Kristo *
2720565fb16STero Kristo * Locks DPLL5 to a pre-defined frequency. This is required for proper
2730565fb16STero Kristo * operation of USB.
2740565fb16STero Kristo */
omap3_clk_lock_dpll5(void)2750565fb16STero Kristo void __init omap3_clk_lock_dpll5(void)
2760565fb16STero Kristo {
2770565fb16STero Kristo struct clk *dpll5_clk;
2780565fb16STero Kristo struct clk *dpll5_m2_clk;
2790565fb16STero Kristo
280035cd485SRichard Watts /*
281035cd485SRichard Watts * Errata sprz319f advisory 2.1 documents a USB host clock drift issue
282035cd485SRichard Watts * that can be worked around using specially crafted dpll5 settings
283035cd485SRichard Watts * with a dpll5_m2 divider set to 8. Set the dpll5 rate to 8x the USB
284035cd485SRichard Watts * host clock rate, its .set_rate handler() will detect that frequency
285035cd485SRichard Watts * and use the errata settings.
286035cd485SRichard Watts */
2870565fb16STero Kristo dpll5_clk = clk_get(NULL, "dpll5_ck");
288035cd485SRichard Watts clk_set_rate(dpll5_clk, OMAP3_DPLL5_FREQ_FOR_USBHOST * 8);
2890565fb16STero Kristo clk_prepare_enable(dpll5_clk);
2900565fb16STero Kristo
291035cd485SRichard Watts /* Program dpll5_m2_clk divider */
2920565fb16STero Kristo dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
2930565fb16STero Kristo clk_prepare_enable(dpll5_m2_clk);
294035cd485SRichard Watts clk_set_rate(dpll5_m2_clk, OMAP3_DPLL5_FREQ_FOR_USBHOST);
2950565fb16STero Kristo
2960565fb16STero Kristo clk_disable_unprepare(dpll5_m2_clk);
2970565fb16STero Kristo clk_disable_unprepare(dpll5_clk);
2980565fb16STero Kristo }
2990565fb16STero Kristo
omap3xxx_dt_clk_init(int soc_type)300aafd900cSTero Kristo static int __init omap3xxx_dt_clk_init(int soc_type)
301aafd900cSTero Kristo {
302aafd900cSTero Kristo if (soc_type == OMAP3_SOC_AM35XX || soc_type == OMAP3_SOC_OMAP3630 ||
303aafd900cSTero Kristo soc_type == OMAP3_SOC_OMAP3430_ES1 ||
304aafd900cSTero Kristo soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS)
305aafd900cSTero Kristo ti_dt_clocks_register(omap3xxx_clks);
306aafd900cSTero Kristo
307aafd900cSTero Kristo if (soc_type == OMAP3_SOC_AM35XX)
308aafd900cSTero Kristo ti_dt_clocks_register(am35xx_clks);
309aafd900cSTero Kristo
310aafd900cSTero Kristo if (soc_type == OMAP3_SOC_OMAP3630 || soc_type == OMAP3_SOC_AM35XX ||
311aafd900cSTero Kristo soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS)
312aafd900cSTero Kristo ti_dt_clocks_register(omap36xx_am35xx_omap3430es2plus_clks);
313aafd900cSTero Kristo
314aafd900cSTero Kristo if (soc_type == OMAP3_SOC_OMAP3430_ES1)
315aafd900cSTero Kristo ti_dt_clocks_register(omap3430es1_clks);
316aafd900cSTero Kristo
317aafd900cSTero Kristo if (soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS ||
318aafd900cSTero Kristo soc_type == OMAP3_SOC_OMAP3630)
319aafd900cSTero Kristo ti_dt_clocks_register(omap36xx_omap3430es2plus_clks);
320aafd900cSTero Kristo
321aafd900cSTero Kristo omap2_clk_disable_autoidle_all();
322aafd900cSTero Kristo
3230ed266d7STero Kristo ti_clk_add_aliases();
3240ed266d7STero Kristo
325aafd900cSTero Kristo omap2_clk_enable_init_clocks(enable_init_clks,
326aafd900cSTero Kristo ARRAY_SIZE(enable_init_clks));
327aafd900cSTero Kristo
328aafd900cSTero Kristo pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
329aafd900cSTero Kristo (clk_get_rate(clk_get_sys(NULL, "osc_sys_ck")) / 1000000),
330aafd900cSTero Kristo (clk_get_rate(clk_get_sys(NULL, "osc_sys_ck")) / 100000) % 10,
331aafd900cSTero Kristo (clk_get_rate(clk_get_sys(NULL, "core_ck")) / 1000000),
332aafd900cSTero Kristo (clk_get_rate(clk_get_sys(NULL, "arm_fck")) / 1000000));
333aafd900cSTero Kristo
3341a34275dSTony Lindgren if (soc_type != OMAP3_SOC_OMAP3430_ES1)
335aafd900cSTero Kristo omap3_clk_lock_dpll5();
336aafd900cSTero Kristo
337aafd900cSTero Kristo return 0;
338aafd900cSTero Kristo }
339aafd900cSTero Kristo
omap3430_dt_clk_init(void)340aafd900cSTero Kristo int __init omap3430_dt_clk_init(void)
341aafd900cSTero Kristo {
342aafd900cSTero Kristo return omap3xxx_dt_clk_init(OMAP3_SOC_OMAP3430_ES2_PLUS);
343aafd900cSTero Kristo }
344aafd900cSTero Kristo
omap3630_dt_clk_init(void)345aafd900cSTero Kristo int __init omap3630_dt_clk_init(void)
346aafd900cSTero Kristo {
347aafd900cSTero Kristo return omap3xxx_dt_clk_init(OMAP3_SOC_OMAP3630);
348aafd900cSTero Kristo }
349aafd900cSTero Kristo
am35xx_dt_clk_init(void)350aafd900cSTero Kristo int __init am35xx_dt_clk_init(void)
351aafd900cSTero Kristo {
352aafd900cSTero Kristo return omap3xxx_dt_clk_init(OMAP3_SOC_AM35XX);
353aafd900cSTero Kristo }
354