162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * OMAP3 Clock init
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2013 Texas Instruments, Inc
662306a36Sopenharmony_ci *     Tero Kristo (t-kristo@ti.com)
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/kernel.h>
1062306a36Sopenharmony_ci#include <linux/list.h>
1162306a36Sopenharmony_ci#include <linux/clk.h>
1262306a36Sopenharmony_ci#include <linux/clk-provider.h>
1362306a36Sopenharmony_ci#include <linux/clk/ti.h>
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#include "clock.h"
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define OMAP3430ES2_ST_DSS_IDLE_SHIFT			1
1862306a36Sopenharmony_ci#define OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT		5
1962306a36Sopenharmony_ci#define OMAP3430ES2_ST_SSI_IDLE_SHIFT			8
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci#define OMAP34XX_CM_IDLEST_VAL				1
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ci/*
2462306a36Sopenharmony_ci * In AM35xx IPSS, the {ICK,FCK} enable bits for modules are exported
2562306a36Sopenharmony_ci * in the same register at a bit offset of 0x8. The EN_ACK for ICK is
2662306a36Sopenharmony_ci * at an offset of 4 from ICK enable bit.
2762306a36Sopenharmony_ci */
2862306a36Sopenharmony_ci#define AM35XX_IPSS_ICK_MASK			0xF
2962306a36Sopenharmony_ci#define AM35XX_IPSS_ICK_EN_ACK_OFFSET		0x4
3062306a36Sopenharmony_ci#define AM35XX_IPSS_ICK_FCK_OFFSET		0x8
3162306a36Sopenharmony_ci#define AM35XX_IPSS_CLK_IDLEST_VAL		0
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci#define AM35XX_ST_IPSS_SHIFT			5
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/**
3662306a36Sopenharmony_ci * omap3430es2_clk_ssi_find_idlest - return CM_IDLEST info for SSI
3762306a36Sopenharmony_ci * @clk: struct clk * being enabled
3862306a36Sopenharmony_ci * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
3962306a36Sopenharmony_ci * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
4062306a36Sopenharmony_ci * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
4162306a36Sopenharmony_ci *
4262306a36Sopenharmony_ci * The OMAP3430ES2 SSI target CM_IDLEST bit is at a different shift
4362306a36Sopenharmony_ci * from the CM_{I,F}CLKEN bit.  Pass back the correct info via
4462306a36Sopenharmony_ci * @idlest_reg and @idlest_bit.  No return value.
4562306a36Sopenharmony_ci */
4662306a36Sopenharmony_cistatic void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
4762306a36Sopenharmony_ci					    struct clk_omap_reg *idlest_reg,
4862306a36Sopenharmony_ci					    u8 *idlest_bit,
4962306a36Sopenharmony_ci					    u8 *idlest_val)
5062306a36Sopenharmony_ci{
5162306a36Sopenharmony_ci	memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
5262306a36Sopenharmony_ci	idlest_reg->offset &= ~0xf0;
5362306a36Sopenharmony_ci	idlest_reg->offset |= 0x20;
5462306a36Sopenharmony_ci	*idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
5562306a36Sopenharmony_ci	*idlest_val = OMAP34XX_CM_IDLEST_VAL;
5662306a36Sopenharmony_ci}
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciconst struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
5962306a36Sopenharmony_ci	.allow_idle	= omap2_clkt_iclk_allow_idle,
6062306a36Sopenharmony_ci	.deny_idle	= omap2_clkt_iclk_deny_idle,
6162306a36Sopenharmony_ci	.find_idlest	= omap3430es2_clk_ssi_find_idlest,
6262306a36Sopenharmony_ci	.find_companion	= omap2_clk_dflt_find_companion,
6362306a36Sopenharmony_ci};
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/**
6662306a36Sopenharmony_ci * omap3430es2_clk_dss_usbhost_find_idlest - CM_IDLEST info for DSS, USBHOST
6762306a36Sopenharmony_ci * @clk: struct clk * being enabled
6862306a36Sopenharmony_ci * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
6962306a36Sopenharmony_ci * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
7062306a36Sopenharmony_ci * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
7162306a36Sopenharmony_ci *
7262306a36Sopenharmony_ci * Some OMAP modules on OMAP3 ES2+ chips have both initiator and
7362306a36Sopenharmony_ci * target IDLEST bits.  For our purposes, we are concerned with the
7462306a36Sopenharmony_ci * target IDLEST bits, which exist at a different bit position than
7562306a36Sopenharmony_ci * the *CLKEN bit position for these modules (DSS and USBHOST) (The
7662306a36Sopenharmony_ci * default find_idlest code assumes that they are at the same
7762306a36Sopenharmony_ci * position.)  No return value.
7862306a36Sopenharmony_ci */
7962306a36Sopenharmony_cistatic void
8062306a36Sopenharmony_ciomap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap *clk,
8162306a36Sopenharmony_ci					struct clk_omap_reg *idlest_reg,
8262306a36Sopenharmony_ci					u8 *idlest_bit, u8 *idlest_val)
8362306a36Sopenharmony_ci{
8462306a36Sopenharmony_ci	memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci	idlest_reg->offset &= ~0xf0;
8762306a36Sopenharmony_ci	idlest_reg->offset |= 0x20;
8862306a36Sopenharmony_ci	/* USBHOST_IDLE has same shift */
8962306a36Sopenharmony_ci	*idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT;
9062306a36Sopenharmony_ci	*idlest_val = OMAP34XX_CM_IDLEST_VAL;
9162306a36Sopenharmony_ci}
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ciconst struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait = {
9462306a36Sopenharmony_ci	.find_idlest	= omap3430es2_clk_dss_usbhost_find_idlest,
9562306a36Sopenharmony_ci	.find_companion	= omap2_clk_dflt_find_companion,
9662306a36Sopenharmony_ci};
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciconst struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait = {
9962306a36Sopenharmony_ci	.allow_idle	= omap2_clkt_iclk_allow_idle,
10062306a36Sopenharmony_ci	.deny_idle	= omap2_clkt_iclk_deny_idle,
10162306a36Sopenharmony_ci	.find_idlest	= omap3430es2_clk_dss_usbhost_find_idlest,
10262306a36Sopenharmony_ci	.find_companion	= omap2_clk_dflt_find_companion,
10362306a36Sopenharmony_ci};
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ci/**
10662306a36Sopenharmony_ci * omap3430es2_clk_hsotgusb_find_idlest - return CM_IDLEST info for HSOTGUSB
10762306a36Sopenharmony_ci * @clk: struct clk * being enabled
10862306a36Sopenharmony_ci * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
10962306a36Sopenharmony_ci * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
11062306a36Sopenharmony_ci * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
11162306a36Sopenharmony_ci *
11262306a36Sopenharmony_ci * The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different
11362306a36Sopenharmony_ci * shift from the CM_{I,F}CLKEN bit.  Pass back the correct info via
11462306a36Sopenharmony_ci * @idlest_reg and @idlest_bit.  No return value.
11562306a36Sopenharmony_ci */
11662306a36Sopenharmony_cistatic void
11762306a36Sopenharmony_ciomap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap *clk,
11862306a36Sopenharmony_ci				     struct clk_omap_reg *idlest_reg,
11962306a36Sopenharmony_ci				     u8 *idlest_bit,
12062306a36Sopenharmony_ci				     u8 *idlest_val)
12162306a36Sopenharmony_ci{
12262306a36Sopenharmony_ci	memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
12362306a36Sopenharmony_ci	idlest_reg->offset &= ~0xf0;
12462306a36Sopenharmony_ci	idlest_reg->offset |= 0x20;
12562306a36Sopenharmony_ci	*idlest_bit = OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT;
12662306a36Sopenharmony_ci	*idlest_val = OMAP34XX_CM_IDLEST_VAL;
12762306a36Sopenharmony_ci}
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ciconst struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
13062306a36Sopenharmony_ci	.allow_idle	= omap2_clkt_iclk_allow_idle,
13162306a36Sopenharmony_ci	.deny_idle	= omap2_clkt_iclk_deny_idle,
13262306a36Sopenharmony_ci	.find_idlest	= omap3430es2_clk_hsotgusb_find_idlest,
13362306a36Sopenharmony_ci	.find_companion	= omap2_clk_dflt_find_companion,
13462306a36Sopenharmony_ci};
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/**
13762306a36Sopenharmony_ci * am35xx_clk_find_idlest - return clock ACK info for AM35XX IPSS
13862306a36Sopenharmony_ci * @clk: struct clk * being enabled
13962306a36Sopenharmony_ci * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
14062306a36Sopenharmony_ci * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
14162306a36Sopenharmony_ci * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
14262306a36Sopenharmony_ci *
14362306a36Sopenharmony_ci * The interface clocks on AM35xx IPSS reflects the clock idle status
14462306a36Sopenharmony_ci * in the enable register itsel at a bit offset of 4 from the enable
14562306a36Sopenharmony_ci * bit. A value of 1 indicates that clock is enabled.
14662306a36Sopenharmony_ci */
14762306a36Sopenharmony_cistatic void am35xx_clk_find_idlest(struct clk_hw_omap *clk,
14862306a36Sopenharmony_ci				   struct clk_omap_reg *idlest_reg,
14962306a36Sopenharmony_ci				   u8 *idlest_bit,
15062306a36Sopenharmony_ci				   u8 *idlest_val)
15162306a36Sopenharmony_ci{
15262306a36Sopenharmony_ci	memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
15362306a36Sopenharmony_ci	*idlest_bit = clk->enable_bit + AM35XX_IPSS_ICK_EN_ACK_OFFSET;
15462306a36Sopenharmony_ci	*idlest_val = AM35XX_IPSS_CLK_IDLEST_VAL;
15562306a36Sopenharmony_ci}
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci/**
15862306a36Sopenharmony_ci * am35xx_clk_find_companion - find companion clock to @clk
15962306a36Sopenharmony_ci * @clk: struct clk * to find the companion clock of
16062306a36Sopenharmony_ci * @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in
16162306a36Sopenharmony_ci * @other_bit: u8 ** to return the companion clock bit shift in
16262306a36Sopenharmony_ci *
16362306a36Sopenharmony_ci * Some clocks don't have companion clocks.  For example, modules with
16462306a36Sopenharmony_ci * only an interface clock (such as HECC) don't have a companion
16562306a36Sopenharmony_ci * clock.  Right now, this code relies on the hardware exporting a bit
16662306a36Sopenharmony_ci * in the correct companion register that indicates that the
16762306a36Sopenharmony_ci * nonexistent 'companion clock' is active.  Future patches will
16862306a36Sopenharmony_ci * associate this type of code with per-module data structures to
16962306a36Sopenharmony_ci * avoid this issue, and remove the casts.  No return value.
17062306a36Sopenharmony_ci */
17162306a36Sopenharmony_cistatic void am35xx_clk_find_companion(struct clk_hw_omap *clk,
17262306a36Sopenharmony_ci				      struct clk_omap_reg *other_reg,
17362306a36Sopenharmony_ci				      u8 *other_bit)
17462306a36Sopenharmony_ci{
17562306a36Sopenharmony_ci	memcpy(other_reg, &clk->enable_reg, sizeof(*other_reg));
17662306a36Sopenharmony_ci	if (clk->enable_bit & AM35XX_IPSS_ICK_MASK)
17762306a36Sopenharmony_ci		*other_bit = clk->enable_bit + AM35XX_IPSS_ICK_FCK_OFFSET;
17862306a36Sopenharmony_ci	else
17962306a36Sopenharmony_ci	*other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET;
18062306a36Sopenharmony_ci}
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ciconst struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait = {
18362306a36Sopenharmony_ci	.find_idlest	= am35xx_clk_find_idlest,
18462306a36Sopenharmony_ci	.find_companion	= am35xx_clk_find_companion,
18562306a36Sopenharmony_ci};
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci/**
18862306a36Sopenharmony_ci * am35xx_clk_ipss_find_idlest - return CM_IDLEST info for IPSS
18962306a36Sopenharmony_ci * @clk: struct clk * being enabled
19062306a36Sopenharmony_ci * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into
19162306a36Sopenharmony_ci * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into
19262306a36Sopenharmony_ci * @idlest_val: pointer to a u8 to store the CM_IDLEST indicator
19362306a36Sopenharmony_ci *
19462306a36Sopenharmony_ci * The IPSS target CM_IDLEST bit is at a different shift from the
19562306a36Sopenharmony_ci * CM_{I,F}CLKEN bit.  Pass back the correct info via @idlest_reg
19662306a36Sopenharmony_ci * and @idlest_bit.  No return value.
19762306a36Sopenharmony_ci */
19862306a36Sopenharmony_cistatic void am35xx_clk_ipss_find_idlest(struct clk_hw_omap *clk,
19962306a36Sopenharmony_ci					struct clk_omap_reg *idlest_reg,
20062306a36Sopenharmony_ci					u8 *idlest_bit,
20162306a36Sopenharmony_ci					u8 *idlest_val)
20262306a36Sopenharmony_ci{
20362306a36Sopenharmony_ci	memcpy(idlest_reg, &clk->enable_reg, sizeof(*idlest_reg));
20462306a36Sopenharmony_ci
20562306a36Sopenharmony_ci	idlest_reg->offset &= ~0xf0;
20662306a36Sopenharmony_ci	idlest_reg->offset |= 0x20;
20762306a36Sopenharmony_ci	*idlest_bit = AM35XX_ST_IPSS_SHIFT;
20862306a36Sopenharmony_ci	*idlest_val = OMAP34XX_CM_IDLEST_VAL;
20962306a36Sopenharmony_ci}
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ciconst struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait = {
21262306a36Sopenharmony_ci	.allow_idle	= omap2_clkt_iclk_allow_idle,
21362306a36Sopenharmony_ci	.deny_idle	= omap2_clkt_iclk_deny_idle,
21462306a36Sopenharmony_ci	.find_idlest	= am35xx_clk_ipss_find_idlest,
21562306a36Sopenharmony_ci	.find_companion	= omap2_clk_dflt_find_companion,
21662306a36Sopenharmony_ci};
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_cistatic struct ti_dt_clk omap3xxx_clks[] = {
21962306a36Sopenharmony_ci	DT_CLK(NULL, "timer_32k_ck", "omap_32k_fck"),
22062306a36Sopenharmony_ci	DT_CLK(NULL, "timer_sys_ck", "sys_ck"),
22162306a36Sopenharmony_ci	{ .node_name = NULL },
22262306a36Sopenharmony_ci};
22362306a36Sopenharmony_ci
22462306a36Sopenharmony_cistatic struct ti_dt_clk omap36xx_omap3430es2plus_clks[] = {
22562306a36Sopenharmony_ci	DT_CLK(NULL, "ssi_ssr_fck", "ssi_ssr_fck_3430es2"),
22662306a36Sopenharmony_ci	DT_CLK(NULL, "ssi_sst_fck", "ssi_sst_fck_3430es2"),
22762306a36Sopenharmony_ci	DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_3430es2"),
22862306a36Sopenharmony_ci	DT_CLK(NULL, "ssi_ick", "ssi_ick_3430es2"),
22962306a36Sopenharmony_ci	{ .node_name = NULL },
23062306a36Sopenharmony_ci};
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_cistatic struct ti_dt_clk omap3430es1_clks[] = {
23362306a36Sopenharmony_ci	DT_CLK(NULL, "ssi_ssr_fck", "ssi_ssr_fck_3430es1"),
23462306a36Sopenharmony_ci	DT_CLK(NULL, "ssi_sst_fck", "ssi_sst_fck_3430es1"),
23562306a36Sopenharmony_ci	DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_3430es1"),
23662306a36Sopenharmony_ci	DT_CLK(NULL, "ssi_ick", "ssi_ick_3430es1"),
23762306a36Sopenharmony_ci	DT_CLK(NULL, "dss1_alwon_fck", "dss1_alwon_fck_3430es1"),
23862306a36Sopenharmony_ci	DT_CLK(NULL, "dss_ick", "dss_ick_3430es1"),
23962306a36Sopenharmony_ci	{ .node_name = NULL },
24062306a36Sopenharmony_ci};
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_cistatic struct ti_dt_clk omap36xx_am35xx_omap3430es2plus_clks[] = {
24362306a36Sopenharmony_ci	DT_CLK(NULL, "dss1_alwon_fck", "dss1_alwon_fck_3430es2"),
24462306a36Sopenharmony_ci	DT_CLK(NULL, "dss_ick", "dss_ick_3430es2"),
24562306a36Sopenharmony_ci	{ .node_name = NULL },
24662306a36Sopenharmony_ci};
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_cistatic struct ti_dt_clk am35xx_clks[] = {
24962306a36Sopenharmony_ci	DT_CLK(NULL, "hsotgusb_ick", "hsotgusb_ick_am35xx"),
25062306a36Sopenharmony_ci	DT_CLK(NULL, "hsotgusb_fck", "hsotgusb_fck_am35xx"),
25162306a36Sopenharmony_ci	DT_CLK(NULL, "uart4_ick", "uart4_ick_am35xx"),
25262306a36Sopenharmony_ci	DT_CLK(NULL, "uart4_fck", "uart4_fck_am35xx"),
25362306a36Sopenharmony_ci	{ .node_name = NULL },
25462306a36Sopenharmony_ci};
25562306a36Sopenharmony_ci
25662306a36Sopenharmony_cistatic const char *enable_init_clks[] = {
25762306a36Sopenharmony_ci	"sdrc_ick",
25862306a36Sopenharmony_ci	"gpmc_fck",
25962306a36Sopenharmony_ci	"omapctrl_ick",
26062306a36Sopenharmony_ci};
26162306a36Sopenharmony_ci
26262306a36Sopenharmony_cienum {
26362306a36Sopenharmony_ci	OMAP3_SOC_AM35XX,
26462306a36Sopenharmony_ci	OMAP3_SOC_OMAP3430_ES1,
26562306a36Sopenharmony_ci	OMAP3_SOC_OMAP3430_ES2_PLUS,
26662306a36Sopenharmony_ci	OMAP3_SOC_OMAP3630,
26762306a36Sopenharmony_ci};
26862306a36Sopenharmony_ci
26962306a36Sopenharmony_ci/**
27062306a36Sopenharmony_ci * omap3_clk_lock_dpll5 - locks DPLL5
27162306a36Sopenharmony_ci *
27262306a36Sopenharmony_ci * Locks DPLL5 to a pre-defined frequency. This is required for proper
27362306a36Sopenharmony_ci * operation of USB.
27462306a36Sopenharmony_ci */
27562306a36Sopenharmony_civoid __init omap3_clk_lock_dpll5(void)
27662306a36Sopenharmony_ci{
27762306a36Sopenharmony_ci	struct clk *dpll5_clk;
27862306a36Sopenharmony_ci	struct clk *dpll5_m2_clk;
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci	/*
28162306a36Sopenharmony_ci	 * Errata sprz319f advisory 2.1 documents a USB host clock drift issue
28262306a36Sopenharmony_ci	 * that can be worked around using specially crafted dpll5 settings
28362306a36Sopenharmony_ci	 * with a dpll5_m2 divider set to 8. Set the dpll5 rate to 8x the USB
28462306a36Sopenharmony_ci	 * host clock rate, its .set_rate handler() will detect that frequency
28562306a36Sopenharmony_ci	 * and use the errata settings.
28662306a36Sopenharmony_ci	 */
28762306a36Sopenharmony_ci	dpll5_clk = clk_get(NULL, "dpll5_ck");
28862306a36Sopenharmony_ci	clk_set_rate(dpll5_clk, OMAP3_DPLL5_FREQ_FOR_USBHOST * 8);
28962306a36Sopenharmony_ci	clk_prepare_enable(dpll5_clk);
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_ci	/* Program dpll5_m2_clk divider */
29262306a36Sopenharmony_ci	dpll5_m2_clk = clk_get(NULL, "dpll5_m2_ck");
29362306a36Sopenharmony_ci	clk_prepare_enable(dpll5_m2_clk);
29462306a36Sopenharmony_ci	clk_set_rate(dpll5_m2_clk, OMAP3_DPLL5_FREQ_FOR_USBHOST);
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci	clk_disable_unprepare(dpll5_m2_clk);
29762306a36Sopenharmony_ci	clk_disable_unprepare(dpll5_clk);
29862306a36Sopenharmony_ci}
29962306a36Sopenharmony_ci
30062306a36Sopenharmony_cistatic int __init omap3xxx_dt_clk_init(int soc_type)
30162306a36Sopenharmony_ci{
30262306a36Sopenharmony_ci	if (soc_type == OMAP3_SOC_AM35XX || soc_type == OMAP3_SOC_OMAP3630 ||
30362306a36Sopenharmony_ci	    soc_type == OMAP3_SOC_OMAP3430_ES1 ||
30462306a36Sopenharmony_ci	    soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS)
30562306a36Sopenharmony_ci		ti_dt_clocks_register(omap3xxx_clks);
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ci	if (soc_type == OMAP3_SOC_AM35XX)
30862306a36Sopenharmony_ci		ti_dt_clocks_register(am35xx_clks);
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_ci	if (soc_type == OMAP3_SOC_OMAP3630 || soc_type == OMAP3_SOC_AM35XX ||
31162306a36Sopenharmony_ci	    soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS)
31262306a36Sopenharmony_ci		ti_dt_clocks_register(omap36xx_am35xx_omap3430es2plus_clks);
31362306a36Sopenharmony_ci
31462306a36Sopenharmony_ci	if (soc_type == OMAP3_SOC_OMAP3430_ES1)
31562306a36Sopenharmony_ci		ti_dt_clocks_register(omap3430es1_clks);
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci	if (soc_type == OMAP3_SOC_OMAP3430_ES2_PLUS ||
31862306a36Sopenharmony_ci	    soc_type == OMAP3_SOC_OMAP3630)
31962306a36Sopenharmony_ci		ti_dt_clocks_register(omap36xx_omap3430es2plus_clks);
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci	omap2_clk_disable_autoidle_all();
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci	ti_clk_add_aliases();
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_ci	omap2_clk_enable_init_clocks(enable_init_clks,
32662306a36Sopenharmony_ci				     ARRAY_SIZE(enable_init_clks));
32762306a36Sopenharmony_ci
32862306a36Sopenharmony_ci	pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
32962306a36Sopenharmony_ci		(clk_get_rate(clk_get_sys(NULL, "osc_sys_ck")) / 1000000),
33062306a36Sopenharmony_ci		(clk_get_rate(clk_get_sys(NULL, "osc_sys_ck")) / 100000) % 10,
33162306a36Sopenharmony_ci		(clk_get_rate(clk_get_sys(NULL, "core_ck")) / 1000000),
33262306a36Sopenharmony_ci		(clk_get_rate(clk_get_sys(NULL, "arm_fck")) / 1000000));
33362306a36Sopenharmony_ci
33462306a36Sopenharmony_ci	if (soc_type != OMAP3_SOC_OMAP3430_ES1)
33562306a36Sopenharmony_ci		omap3_clk_lock_dpll5();
33662306a36Sopenharmony_ci
33762306a36Sopenharmony_ci	return 0;
33862306a36Sopenharmony_ci}
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ciint __init omap3430_dt_clk_init(void)
34162306a36Sopenharmony_ci{
34262306a36Sopenharmony_ci	return omap3xxx_dt_clk_init(OMAP3_SOC_OMAP3430_ES2_PLUS);
34362306a36Sopenharmony_ci}
34462306a36Sopenharmony_ci
34562306a36Sopenharmony_ciint __init omap3630_dt_clk_init(void)
34662306a36Sopenharmony_ci{
34762306a36Sopenharmony_ci	return omap3xxx_dt_clk_init(OMAP3_SOC_OMAP3630);
34862306a36Sopenharmony_ci}
34962306a36Sopenharmony_ci
35062306a36Sopenharmony_ciint __init am35xx_dt_clk_init(void)
35162306a36Sopenharmony_ci{
35262306a36Sopenharmony_ci	return omap3xxx_dt_clk_init(OMAP3_SOC_AM35XX);
35362306a36Sopenharmony_ci}
354