18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  linux/arch/arm/mach-omap1/clock_data.c
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 2004 - 2005, 2009-2010 Nokia Corporation
68c2ecf20Sopenharmony_ci *  Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
78c2ecf20Sopenharmony_ci *  Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
88c2ecf20Sopenharmony_ci *
98c2ecf20Sopenharmony_ci * To do:
108c2ecf20Sopenharmony_ci * - Clocks that are only available on some chips should be marked with the
118c2ecf20Sopenharmony_ci *   chips that they are present on.
128c2ecf20Sopenharmony_ci */
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/kernel.h>
158c2ecf20Sopenharmony_ci#include <linux/io.h>
168c2ecf20Sopenharmony_ci#include <linux/clk.h>
178c2ecf20Sopenharmony_ci#include <linux/cpufreq.h>
188c2ecf20Sopenharmony_ci#include <linux/delay.h>
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#include <asm/mach-types.h>  /* for machine_is_* */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#include "soc.h"
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#include <mach/hardware.h>
258c2ecf20Sopenharmony_ci#include <mach/usb.h>   /* for OTG_BASE */
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci#include "iomap.h"
288c2ecf20Sopenharmony_ci#include "clock.h"
298c2ecf20Sopenharmony_ci#include "sram.h"
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/* Some ARM_IDLECT1 bit shifts - used in struct arm_idlect1_clk */
328c2ecf20Sopenharmony_ci#define IDL_CLKOUT_ARM_SHIFT			12
338c2ecf20Sopenharmony_ci#define IDLTIM_ARM_SHIFT			9
348c2ecf20Sopenharmony_ci#define IDLAPI_ARM_SHIFT			8
358c2ecf20Sopenharmony_ci#define IDLIF_ARM_SHIFT				6
368c2ecf20Sopenharmony_ci#define IDLLB_ARM_SHIFT				4	/* undocumented? */
378c2ecf20Sopenharmony_ci#define OMAP1510_IDLLCD_ARM_SHIFT		3	/* undocumented? */
388c2ecf20Sopenharmony_ci#define IDLPER_ARM_SHIFT			2
398c2ecf20Sopenharmony_ci#define IDLXORP_ARM_SHIFT			1
408c2ecf20Sopenharmony_ci#define IDLWDT_ARM_SHIFT			0
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci/* Some MOD_CONF_CTRL_0 bit shifts - used in struct clk.enable_bit */
438c2ecf20Sopenharmony_ci#define CONF_MOD_UART3_CLK_MODE_R		31
448c2ecf20Sopenharmony_ci#define CONF_MOD_UART2_CLK_MODE_R		30
458c2ecf20Sopenharmony_ci#define CONF_MOD_UART1_CLK_MODE_R		29
468c2ecf20Sopenharmony_ci#define CONF_MOD_MMC_SD_CLK_REQ_R		23
478c2ecf20Sopenharmony_ci#define CONF_MOD_MCBSP3_AUXON			20
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/* Some MOD_CONF_CTRL_1 bit shifts - used in struct clk.enable_bit */
508c2ecf20Sopenharmony_ci#define CONF_MOD_SOSSI_CLK_EN_R			16
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* Some OTG_SYSCON_2-specific bit fields */
538c2ecf20Sopenharmony_ci#define OTG_SYSCON_2_UHOST_EN_SHIFT		8
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci/* Some SOFT_REQ_REG bit fields - used in struct clk.enable_bit */
568c2ecf20Sopenharmony_ci#define SOFT_MMC2_DPLL_REQ_SHIFT	13
578c2ecf20Sopenharmony_ci#define SOFT_MMC_DPLL_REQ_SHIFT		12
588c2ecf20Sopenharmony_ci#define SOFT_UART3_DPLL_REQ_SHIFT	11
598c2ecf20Sopenharmony_ci#define SOFT_UART2_DPLL_REQ_SHIFT	10
608c2ecf20Sopenharmony_ci#define SOFT_UART1_DPLL_REQ_SHIFT	9
618c2ecf20Sopenharmony_ci#define SOFT_USB_OTG_DPLL_REQ_SHIFT	8
628c2ecf20Sopenharmony_ci#define SOFT_CAM_DPLL_REQ_SHIFT		7
638c2ecf20Sopenharmony_ci#define SOFT_COM_MCKO_REQ_SHIFT		6
648c2ecf20Sopenharmony_ci#define SOFT_PERIPH_REQ_SHIFT		5	/* sys_ck gate for UART2 ? */
658c2ecf20Sopenharmony_ci#define USB_REQ_EN_SHIFT		4
668c2ecf20Sopenharmony_ci#define SOFT_USB_REQ_SHIFT		3	/* sys_ck gate for USB host? */
678c2ecf20Sopenharmony_ci#define SOFT_SDW_REQ_SHIFT		2	/* sys_ck gate for Bluetooth? */
688c2ecf20Sopenharmony_ci#define SOFT_COM_REQ_SHIFT		1	/* sys_ck gate for com proc? */
698c2ecf20Sopenharmony_ci#define SOFT_DPLL_REQ_SHIFT		0
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/*
728c2ecf20Sopenharmony_ci * Omap1 clocks
738c2ecf20Sopenharmony_ci */
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_cistatic struct clk ck_ref = {
768c2ecf20Sopenharmony_ci	.name		= "ck_ref",
778c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
788c2ecf20Sopenharmony_ci	.rate		= 12000000,
798c2ecf20Sopenharmony_ci};
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_cistatic struct clk ck_dpll1 = {
828c2ecf20Sopenharmony_ci	.name		= "ck_dpll1",
838c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
848c2ecf20Sopenharmony_ci	.parent		= &ck_ref,
858c2ecf20Sopenharmony_ci};
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/*
888c2ecf20Sopenharmony_ci * FIXME: This clock seems to be necessary but no-one has asked for its
898c2ecf20Sopenharmony_ci * activation.  [ FIX: SoSSI, SSR ]
908c2ecf20Sopenharmony_ci */
918c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk ck_dpll1out = {
928c2ecf20Sopenharmony_ci	.clk = {
938c2ecf20Sopenharmony_ci		.name		= "ck_dpll1out",
948c2ecf20Sopenharmony_ci		.ops		= &clkops_generic,
958c2ecf20Sopenharmony_ci		.parent		= &ck_dpll1,
968c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT |
978c2ecf20Sopenharmony_ci				  ENABLE_ON_INIT,
988c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
998c2ecf20Sopenharmony_ci		.enable_bit	= EN_CKOUT_ARM,
1008c2ecf20Sopenharmony_ci		.recalc		= &followparent_recalc,
1018c2ecf20Sopenharmony_ci	},
1028c2ecf20Sopenharmony_ci	.idlect_shift	= IDL_CLKOUT_ARM_SHIFT,
1038c2ecf20Sopenharmony_ci};
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_cistatic struct clk sossi_ck = {
1068c2ecf20Sopenharmony_ci	.name		= "ck_sossi",
1078c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
1088c2ecf20Sopenharmony_ci	.parent		= &ck_dpll1out.clk,
1098c2ecf20Sopenharmony_ci	.flags		= CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
1108c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
1118c2ecf20Sopenharmony_ci	.enable_bit	= CONF_MOD_SOSSI_CLK_EN_R,
1128c2ecf20Sopenharmony_ci	.recalc		= &omap1_sossi_recalc,
1138c2ecf20Sopenharmony_ci	.set_rate	= &omap1_set_sossi_rate,
1148c2ecf20Sopenharmony_ci};
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_cistatic struct clk arm_ck = {
1178c2ecf20Sopenharmony_ci	.name		= "arm_ck",
1188c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
1198c2ecf20Sopenharmony_ci	.parent		= &ck_dpll1,
1208c2ecf20Sopenharmony_ci	.rate_offset	= CKCTL_ARMDIV_OFFSET,
1218c2ecf20Sopenharmony_ci	.recalc		= &omap1_ckctl_recalc,
1228c2ecf20Sopenharmony_ci	.round_rate	= omap1_clk_round_rate_ckctl_arm,
1238c2ecf20Sopenharmony_ci	.set_rate	= omap1_clk_set_rate_ckctl_arm,
1248c2ecf20Sopenharmony_ci};
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk armper_ck = {
1278c2ecf20Sopenharmony_ci	.clk = {
1288c2ecf20Sopenharmony_ci		.name		= "armper_ck",
1298c2ecf20Sopenharmony_ci		.ops		= &clkops_generic,
1308c2ecf20Sopenharmony_ci		.parent		= &ck_dpll1,
1318c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL,
1328c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
1338c2ecf20Sopenharmony_ci		.enable_bit	= EN_PERCK,
1348c2ecf20Sopenharmony_ci		.rate_offset	= CKCTL_PERDIV_OFFSET,
1358c2ecf20Sopenharmony_ci		.recalc		= &omap1_ckctl_recalc,
1368c2ecf20Sopenharmony_ci		.round_rate	= omap1_clk_round_rate_ckctl_arm,
1378c2ecf20Sopenharmony_ci		.set_rate	= omap1_clk_set_rate_ckctl_arm,
1388c2ecf20Sopenharmony_ci	},
1398c2ecf20Sopenharmony_ci	.idlect_shift	= IDLPER_ARM_SHIFT,
1408c2ecf20Sopenharmony_ci};
1418c2ecf20Sopenharmony_ci
1428c2ecf20Sopenharmony_ci/*
1438c2ecf20Sopenharmony_ci * FIXME: This clock seems to be necessary but no-one has asked for its
1448c2ecf20Sopenharmony_ci * activation.  [ GPIO code for 1510 ]
1458c2ecf20Sopenharmony_ci */
1468c2ecf20Sopenharmony_cistatic struct clk arm_gpio_ck = {
1478c2ecf20Sopenharmony_ci	.name		= "ick",
1488c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
1498c2ecf20Sopenharmony_ci	.parent		= &ck_dpll1,
1508c2ecf20Sopenharmony_ci	.flags		= ENABLE_ON_INIT,
1518c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
1528c2ecf20Sopenharmony_ci	.enable_bit	= EN_GPIOCK,
1538c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
1548c2ecf20Sopenharmony_ci};
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk armxor_ck = {
1578c2ecf20Sopenharmony_ci	.clk = {
1588c2ecf20Sopenharmony_ci		.name		= "armxor_ck",
1598c2ecf20Sopenharmony_ci		.ops		= &clkops_generic,
1608c2ecf20Sopenharmony_ci		.parent		= &ck_ref,
1618c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL,
1628c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
1638c2ecf20Sopenharmony_ci		.enable_bit	= EN_XORPCK,
1648c2ecf20Sopenharmony_ci		.recalc		= &followparent_recalc,
1658c2ecf20Sopenharmony_ci	},
1668c2ecf20Sopenharmony_ci	.idlect_shift	= IDLXORP_ARM_SHIFT,
1678c2ecf20Sopenharmony_ci};
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk armtim_ck = {
1708c2ecf20Sopenharmony_ci	.clk = {
1718c2ecf20Sopenharmony_ci		.name		= "armtim_ck",
1728c2ecf20Sopenharmony_ci		.ops		= &clkops_generic,
1738c2ecf20Sopenharmony_ci		.parent		= &ck_ref,
1748c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL,
1758c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
1768c2ecf20Sopenharmony_ci		.enable_bit	= EN_TIMCK,
1778c2ecf20Sopenharmony_ci		.recalc		= &followparent_recalc,
1788c2ecf20Sopenharmony_ci	},
1798c2ecf20Sopenharmony_ci	.idlect_shift	= IDLTIM_ARM_SHIFT,
1808c2ecf20Sopenharmony_ci};
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk armwdt_ck = {
1838c2ecf20Sopenharmony_ci	.clk = {
1848c2ecf20Sopenharmony_ci		.name		= "armwdt_ck",
1858c2ecf20Sopenharmony_ci		.ops		= &clkops_generic,
1868c2ecf20Sopenharmony_ci		.parent		= &ck_ref,
1878c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL,
1888c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
1898c2ecf20Sopenharmony_ci		.enable_bit	= EN_WDTCK,
1908c2ecf20Sopenharmony_ci		.fixed_div	= 14,
1918c2ecf20Sopenharmony_ci		.recalc		= &omap_fixed_divisor_recalc,
1928c2ecf20Sopenharmony_ci	},
1938c2ecf20Sopenharmony_ci	.idlect_shift	= IDLWDT_ARM_SHIFT,
1948c2ecf20Sopenharmony_ci};
1958c2ecf20Sopenharmony_ci
1968c2ecf20Sopenharmony_cistatic struct clk arminth_ck16xx = {
1978c2ecf20Sopenharmony_ci	.name		= "arminth_ck",
1988c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
1998c2ecf20Sopenharmony_ci	.parent		= &arm_ck,
2008c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
2018c2ecf20Sopenharmony_ci	/* Note: On 16xx the frequency can be divided by 2 by programming
2028c2ecf20Sopenharmony_ci	 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
2038c2ecf20Sopenharmony_ci	 *
2048c2ecf20Sopenharmony_ci	 * 1510 version is in TC clocks.
2058c2ecf20Sopenharmony_ci	 */
2068c2ecf20Sopenharmony_ci};
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_cistatic struct clk dsp_ck = {
2098c2ecf20Sopenharmony_ci	.name		= "dsp_ck",
2108c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
2118c2ecf20Sopenharmony_ci	.parent		= &ck_dpll1,
2128c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(ARM_CKCTL),
2138c2ecf20Sopenharmony_ci	.enable_bit	= EN_DSPCK,
2148c2ecf20Sopenharmony_ci	.rate_offset	= CKCTL_DSPDIV_OFFSET,
2158c2ecf20Sopenharmony_ci	.recalc		= &omap1_ckctl_recalc,
2168c2ecf20Sopenharmony_ci	.round_rate	= omap1_clk_round_rate_ckctl_arm,
2178c2ecf20Sopenharmony_ci	.set_rate	= omap1_clk_set_rate_ckctl_arm,
2188c2ecf20Sopenharmony_ci};
2198c2ecf20Sopenharmony_ci
2208c2ecf20Sopenharmony_cistatic struct clk dspmmu_ck = {
2218c2ecf20Sopenharmony_ci	.name		= "dspmmu_ck",
2228c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
2238c2ecf20Sopenharmony_ci	.parent		= &ck_dpll1,
2248c2ecf20Sopenharmony_ci	.rate_offset	= CKCTL_DSPMMUDIV_OFFSET,
2258c2ecf20Sopenharmony_ci	.recalc		= &omap1_ckctl_recalc,
2268c2ecf20Sopenharmony_ci	.round_rate	= omap1_clk_round_rate_ckctl_arm,
2278c2ecf20Sopenharmony_ci	.set_rate	= omap1_clk_set_rate_ckctl_arm,
2288c2ecf20Sopenharmony_ci};
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_cistatic struct clk dspper_ck = {
2318c2ecf20Sopenharmony_ci	.name		= "dspper_ck",
2328c2ecf20Sopenharmony_ci	.ops		= &clkops_dspck,
2338c2ecf20Sopenharmony_ci	.parent		= &ck_dpll1,
2348c2ecf20Sopenharmony_ci	.enable_reg	= DSP_IDLECT2,
2358c2ecf20Sopenharmony_ci	.enable_bit	= EN_PERCK,
2368c2ecf20Sopenharmony_ci	.rate_offset	= CKCTL_PERDIV_OFFSET,
2378c2ecf20Sopenharmony_ci	.recalc		= &omap1_ckctl_recalc_dsp_domain,
2388c2ecf20Sopenharmony_ci	.round_rate	= omap1_clk_round_rate_ckctl_arm,
2398c2ecf20Sopenharmony_ci	.set_rate	= &omap1_clk_set_rate_dsp_domain,
2408c2ecf20Sopenharmony_ci};
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_cistatic struct clk dspxor_ck = {
2438c2ecf20Sopenharmony_ci	.name		= "dspxor_ck",
2448c2ecf20Sopenharmony_ci	.ops		= &clkops_dspck,
2458c2ecf20Sopenharmony_ci	.parent		= &ck_ref,
2468c2ecf20Sopenharmony_ci	.enable_reg	= DSP_IDLECT2,
2478c2ecf20Sopenharmony_ci	.enable_bit	= EN_XORPCK,
2488c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
2498c2ecf20Sopenharmony_ci};
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_cistatic struct clk dsptim_ck = {
2528c2ecf20Sopenharmony_ci	.name		= "dsptim_ck",
2538c2ecf20Sopenharmony_ci	.ops		= &clkops_dspck,
2548c2ecf20Sopenharmony_ci	.parent		= &ck_ref,
2558c2ecf20Sopenharmony_ci	.enable_reg	= DSP_IDLECT2,
2568c2ecf20Sopenharmony_ci	.enable_bit	= EN_DSPTIMCK,
2578c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
2588c2ecf20Sopenharmony_ci};
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk tc_ck = {
2618c2ecf20Sopenharmony_ci	.clk = {
2628c2ecf20Sopenharmony_ci		.name		= "tc_ck",
2638c2ecf20Sopenharmony_ci		.ops		= &clkops_null,
2648c2ecf20Sopenharmony_ci		.parent		= &ck_dpll1,
2658c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL,
2668c2ecf20Sopenharmony_ci		.rate_offset	= CKCTL_TCDIV_OFFSET,
2678c2ecf20Sopenharmony_ci		.recalc		= &omap1_ckctl_recalc,
2688c2ecf20Sopenharmony_ci		.round_rate	= omap1_clk_round_rate_ckctl_arm,
2698c2ecf20Sopenharmony_ci		.set_rate	= omap1_clk_set_rate_ckctl_arm,
2708c2ecf20Sopenharmony_ci	},
2718c2ecf20Sopenharmony_ci	.idlect_shift	= IDLIF_ARM_SHIFT,
2728c2ecf20Sopenharmony_ci};
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_cistatic struct clk arminth_ck1510 = {
2758c2ecf20Sopenharmony_ci	.name		= "arminth_ck",
2768c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
2778c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
2788c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
2798c2ecf20Sopenharmony_ci	/* Note: On 1510 the frequency follows TC_CK
2808c2ecf20Sopenharmony_ci	 *
2818c2ecf20Sopenharmony_ci	 * 16xx version is in MPU clocks.
2828c2ecf20Sopenharmony_ci	 */
2838c2ecf20Sopenharmony_ci};
2848c2ecf20Sopenharmony_ci
2858c2ecf20Sopenharmony_cistatic struct clk tipb_ck = {
2868c2ecf20Sopenharmony_ci	/* No-idle controlled by "tc_ck" */
2878c2ecf20Sopenharmony_ci	.name		= "tipb_ck",
2888c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
2898c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
2908c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
2918c2ecf20Sopenharmony_ci};
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_cistatic struct clk l3_ocpi_ck = {
2948c2ecf20Sopenharmony_ci	/* No-idle controlled by "tc_ck" */
2958c2ecf20Sopenharmony_ci	.name		= "l3_ocpi_ck",
2968c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
2978c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
2988c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
2998c2ecf20Sopenharmony_ci	.enable_bit	= EN_OCPI_CK,
3008c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
3018c2ecf20Sopenharmony_ci};
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_cistatic struct clk tc1_ck = {
3048c2ecf20Sopenharmony_ci	.name		= "tc1_ck",
3058c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
3068c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
3078c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
3088c2ecf20Sopenharmony_ci	.enable_bit	= EN_TC1_CK,
3098c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
3108c2ecf20Sopenharmony_ci};
3118c2ecf20Sopenharmony_ci
3128c2ecf20Sopenharmony_ci/*
3138c2ecf20Sopenharmony_ci * FIXME: This clock seems to be necessary but no-one has asked for its
3148c2ecf20Sopenharmony_ci * activation.  [ pm.c (SRAM), CCP, Camera ]
3158c2ecf20Sopenharmony_ci */
3168c2ecf20Sopenharmony_cistatic struct clk tc2_ck = {
3178c2ecf20Sopenharmony_ci	.name		= "tc2_ck",
3188c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
3198c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
3208c2ecf20Sopenharmony_ci	.flags		= ENABLE_ON_INIT,
3218c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
3228c2ecf20Sopenharmony_ci	.enable_bit	= EN_TC2_CK,
3238c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
3248c2ecf20Sopenharmony_ci};
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_cistatic struct clk dma_ck = {
3278c2ecf20Sopenharmony_ci	/* No-idle controlled by "tc_ck" */
3288c2ecf20Sopenharmony_ci	.name		= "dma_ck",
3298c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
3308c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
3318c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
3328c2ecf20Sopenharmony_ci};
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_cistatic struct clk dma_lcdfree_ck = {
3358c2ecf20Sopenharmony_ci	.name		= "dma_lcdfree_ck",
3368c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
3378c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
3388c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
3398c2ecf20Sopenharmony_ci};
3408c2ecf20Sopenharmony_ci
3418c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk api_ck = {
3428c2ecf20Sopenharmony_ci	.clk = {
3438c2ecf20Sopenharmony_ci		.name		= "api_ck",
3448c2ecf20Sopenharmony_ci		.ops		= &clkops_generic,
3458c2ecf20Sopenharmony_ci		.parent		= &tc_ck.clk,
3468c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL,
3478c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
3488c2ecf20Sopenharmony_ci		.enable_bit	= EN_APICK,
3498c2ecf20Sopenharmony_ci		.recalc		= &followparent_recalc,
3508c2ecf20Sopenharmony_ci	},
3518c2ecf20Sopenharmony_ci	.idlect_shift	= IDLAPI_ARM_SHIFT,
3528c2ecf20Sopenharmony_ci};
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk lb_ck = {
3558c2ecf20Sopenharmony_ci	.clk = {
3568c2ecf20Sopenharmony_ci		.name		= "lb_ck",
3578c2ecf20Sopenharmony_ci		.ops		= &clkops_generic,
3588c2ecf20Sopenharmony_ci		.parent		= &tc_ck.clk,
3598c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL,
3608c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
3618c2ecf20Sopenharmony_ci		.enable_bit	= EN_LBCK,
3628c2ecf20Sopenharmony_ci		.recalc		= &followparent_recalc,
3638c2ecf20Sopenharmony_ci	},
3648c2ecf20Sopenharmony_ci	.idlect_shift	= IDLLB_ARM_SHIFT,
3658c2ecf20Sopenharmony_ci};
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_cistatic struct clk rhea1_ck = {
3688c2ecf20Sopenharmony_ci	.name		= "rhea1_ck",
3698c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
3708c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
3718c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
3728c2ecf20Sopenharmony_ci};
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_cistatic struct clk rhea2_ck = {
3758c2ecf20Sopenharmony_ci	.name		= "rhea2_ck",
3768c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
3778c2ecf20Sopenharmony_ci	.parent		= &tc_ck.clk,
3788c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
3798c2ecf20Sopenharmony_ci};
3808c2ecf20Sopenharmony_ci
3818c2ecf20Sopenharmony_cistatic struct clk lcd_ck_16xx = {
3828c2ecf20Sopenharmony_ci	.name		= "lcd_ck",
3838c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
3848c2ecf20Sopenharmony_ci	.parent		= &ck_dpll1,
3858c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
3868c2ecf20Sopenharmony_ci	.enable_bit	= EN_LCDCK,
3878c2ecf20Sopenharmony_ci	.rate_offset	= CKCTL_LCDDIV_OFFSET,
3888c2ecf20Sopenharmony_ci	.recalc		= &omap1_ckctl_recalc,
3898c2ecf20Sopenharmony_ci	.round_rate	= omap1_clk_round_rate_ckctl_arm,
3908c2ecf20Sopenharmony_ci	.set_rate	= omap1_clk_set_rate_ckctl_arm,
3918c2ecf20Sopenharmony_ci};
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_cistatic struct arm_idlect1_clk lcd_ck_1510 = {
3948c2ecf20Sopenharmony_ci	.clk = {
3958c2ecf20Sopenharmony_ci		.name		= "lcd_ck",
3968c2ecf20Sopenharmony_ci		.ops		= &clkops_generic,
3978c2ecf20Sopenharmony_ci		.parent		= &ck_dpll1,
3988c2ecf20Sopenharmony_ci		.flags		= CLOCK_IDLE_CONTROL,
3998c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
4008c2ecf20Sopenharmony_ci		.enable_bit	= EN_LCDCK,
4018c2ecf20Sopenharmony_ci		.rate_offset	= CKCTL_LCDDIV_OFFSET,
4028c2ecf20Sopenharmony_ci		.recalc		= &omap1_ckctl_recalc,
4038c2ecf20Sopenharmony_ci		.round_rate	= omap1_clk_round_rate_ckctl_arm,
4048c2ecf20Sopenharmony_ci		.set_rate	= omap1_clk_set_rate_ckctl_arm,
4058c2ecf20Sopenharmony_ci	},
4068c2ecf20Sopenharmony_ci	.idlect_shift	= OMAP1510_IDLLCD_ARM_SHIFT,
4078c2ecf20Sopenharmony_ci};
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/*
4108c2ecf20Sopenharmony_ci * XXX The enable_bit here is misused - it simply switches between 12MHz
4118c2ecf20Sopenharmony_ci * and 48MHz.  Reimplement with clksel.
4128c2ecf20Sopenharmony_ci *
4138c2ecf20Sopenharmony_ci * XXX does this need SYSC register handling?
4148c2ecf20Sopenharmony_ci */
4158c2ecf20Sopenharmony_cistatic struct clk uart1_1510 = {
4168c2ecf20Sopenharmony_ci	.name		= "uart1_ck",
4178c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
4188c2ecf20Sopenharmony_ci	/* Direct from ULPD, no real parent */
4198c2ecf20Sopenharmony_ci	.parent		= &armper_ck.clk,
4208c2ecf20Sopenharmony_ci	.rate		= 12000000,
4218c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
4228c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
4238c2ecf20Sopenharmony_ci	.enable_bit	= CONF_MOD_UART1_CLK_MODE_R,
4248c2ecf20Sopenharmony_ci	.set_rate	= &omap1_set_uart_rate,
4258c2ecf20Sopenharmony_ci	.recalc		= &omap1_uart_recalc,
4268c2ecf20Sopenharmony_ci};
4278c2ecf20Sopenharmony_ci
4288c2ecf20Sopenharmony_ci/*
4298c2ecf20Sopenharmony_ci * XXX The enable_bit here is misused - it simply switches between 12MHz
4308c2ecf20Sopenharmony_ci * and 48MHz.  Reimplement with clksel.
4318c2ecf20Sopenharmony_ci *
4328c2ecf20Sopenharmony_ci * XXX SYSC register handling does not belong in the clock framework
4338c2ecf20Sopenharmony_ci */
4348c2ecf20Sopenharmony_cistatic struct uart_clk uart1_16xx = {
4358c2ecf20Sopenharmony_ci	.clk	= {
4368c2ecf20Sopenharmony_ci		.name		= "uart1_ck",
4378c2ecf20Sopenharmony_ci		.ops		= &clkops_uart_16xx,
4388c2ecf20Sopenharmony_ci		/* Direct from ULPD, no real parent */
4398c2ecf20Sopenharmony_ci		.parent		= &armper_ck.clk,
4408c2ecf20Sopenharmony_ci		.rate		= 48000000,
4418c2ecf20Sopenharmony_ci		.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
4428c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
4438c2ecf20Sopenharmony_ci		.enable_bit	= CONF_MOD_UART1_CLK_MODE_R,
4448c2ecf20Sopenharmony_ci	},
4458c2ecf20Sopenharmony_ci	.sysc_addr	= 0xfffb0054,
4468c2ecf20Sopenharmony_ci};
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci/*
4498c2ecf20Sopenharmony_ci * XXX The enable_bit here is misused - it simply switches between 12MHz
4508c2ecf20Sopenharmony_ci * and 48MHz.  Reimplement with clksel.
4518c2ecf20Sopenharmony_ci *
4528c2ecf20Sopenharmony_ci * XXX does this need SYSC register handling?
4538c2ecf20Sopenharmony_ci */
4548c2ecf20Sopenharmony_cistatic struct clk uart2_ck = {
4558c2ecf20Sopenharmony_ci	.name		= "uart2_ck",
4568c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
4578c2ecf20Sopenharmony_ci	/* Direct from ULPD, no real parent */
4588c2ecf20Sopenharmony_ci	.parent		= &armper_ck.clk,
4598c2ecf20Sopenharmony_ci	.rate		= 12000000,
4608c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
4618c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
4628c2ecf20Sopenharmony_ci	.enable_bit	= CONF_MOD_UART2_CLK_MODE_R,
4638c2ecf20Sopenharmony_ci	.set_rate	= &omap1_set_uart_rate,
4648c2ecf20Sopenharmony_ci	.recalc		= &omap1_uart_recalc,
4658c2ecf20Sopenharmony_ci};
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci/*
4688c2ecf20Sopenharmony_ci * XXX The enable_bit here is misused - it simply switches between 12MHz
4698c2ecf20Sopenharmony_ci * and 48MHz.  Reimplement with clksel.
4708c2ecf20Sopenharmony_ci *
4718c2ecf20Sopenharmony_ci * XXX does this need SYSC register handling?
4728c2ecf20Sopenharmony_ci */
4738c2ecf20Sopenharmony_cistatic struct clk uart3_1510 = {
4748c2ecf20Sopenharmony_ci	.name		= "uart3_ck",
4758c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
4768c2ecf20Sopenharmony_ci	/* Direct from ULPD, no real parent */
4778c2ecf20Sopenharmony_ci	.parent		= &armper_ck.clk,
4788c2ecf20Sopenharmony_ci	.rate		= 12000000,
4798c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
4808c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
4818c2ecf20Sopenharmony_ci	.enable_bit	= CONF_MOD_UART3_CLK_MODE_R,
4828c2ecf20Sopenharmony_ci	.set_rate	= &omap1_set_uart_rate,
4838c2ecf20Sopenharmony_ci	.recalc		= &omap1_uart_recalc,
4848c2ecf20Sopenharmony_ci};
4858c2ecf20Sopenharmony_ci
4868c2ecf20Sopenharmony_ci/*
4878c2ecf20Sopenharmony_ci * XXX The enable_bit here is misused - it simply switches between 12MHz
4888c2ecf20Sopenharmony_ci * and 48MHz.  Reimplement with clksel.
4898c2ecf20Sopenharmony_ci *
4908c2ecf20Sopenharmony_ci * XXX SYSC register handling does not belong in the clock framework
4918c2ecf20Sopenharmony_ci */
4928c2ecf20Sopenharmony_cistatic struct uart_clk uart3_16xx = {
4938c2ecf20Sopenharmony_ci	.clk	= {
4948c2ecf20Sopenharmony_ci		.name		= "uart3_ck",
4958c2ecf20Sopenharmony_ci		.ops		= &clkops_uart_16xx,
4968c2ecf20Sopenharmony_ci		/* Direct from ULPD, no real parent */
4978c2ecf20Sopenharmony_ci		.parent		= &armper_ck.clk,
4988c2ecf20Sopenharmony_ci		.rate		= 48000000,
4998c2ecf20Sopenharmony_ci		.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
5008c2ecf20Sopenharmony_ci		.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
5018c2ecf20Sopenharmony_ci		.enable_bit	= CONF_MOD_UART3_CLK_MODE_R,
5028c2ecf20Sopenharmony_ci	},
5038c2ecf20Sopenharmony_ci	.sysc_addr	= 0xfffb9854,
5048c2ecf20Sopenharmony_ci};
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_cistatic struct clk usb_clko = {	/* 6 MHz output on W4_USB_CLKO */
5078c2ecf20Sopenharmony_ci	.name		= "usb_clko",
5088c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5098c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent */
5108c2ecf20Sopenharmony_ci	.rate		= 6000000,
5118c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT,
5128c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL),
5138c2ecf20Sopenharmony_ci	.enable_bit	= USB_MCLK_EN_BIT,
5148c2ecf20Sopenharmony_ci};
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_cistatic struct clk usb_hhc_ck1510 = {
5178c2ecf20Sopenharmony_ci	.name		= "usb_hhc_ck",
5188c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5198c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent */
5208c2ecf20Sopenharmony_ci	.rate		= 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
5218c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT,
5228c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
5238c2ecf20Sopenharmony_ci	.enable_bit	= USB_HOST_HHC_UHOST_EN,
5248c2ecf20Sopenharmony_ci};
5258c2ecf20Sopenharmony_ci
5268c2ecf20Sopenharmony_cistatic struct clk usb_hhc_ck16xx = {
5278c2ecf20Sopenharmony_ci	.name		= "usb_hhc_ck",
5288c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5298c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent */
5308c2ecf20Sopenharmony_ci	.rate		= 48000000,
5318c2ecf20Sopenharmony_ci	/* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
5328c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT,
5338c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */
5348c2ecf20Sopenharmony_ci	.enable_bit	= OTG_SYSCON_2_UHOST_EN_SHIFT
5358c2ecf20Sopenharmony_ci};
5368c2ecf20Sopenharmony_ci
5378c2ecf20Sopenharmony_cistatic struct clk usb_dc_ck = {
5388c2ecf20Sopenharmony_ci	.name		= "usb_dc_ck",
5398c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5408c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent */
5418c2ecf20Sopenharmony_ci	.rate		= 48000000,
5428c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
5438c2ecf20Sopenharmony_ci	.enable_bit	= SOFT_USB_OTG_DPLL_REQ_SHIFT,
5448c2ecf20Sopenharmony_ci};
5458c2ecf20Sopenharmony_ci
5468c2ecf20Sopenharmony_cistatic struct clk uart1_7xx = {
5478c2ecf20Sopenharmony_ci	.name		= "uart1_ck",
5488c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5498c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent */
5508c2ecf20Sopenharmony_ci	.rate		= 12000000,
5518c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
5528c2ecf20Sopenharmony_ci	.enable_bit	= 9,
5538c2ecf20Sopenharmony_ci};
5548c2ecf20Sopenharmony_ci
5558c2ecf20Sopenharmony_cistatic struct clk uart2_7xx = {
5568c2ecf20Sopenharmony_ci	.name		= "uart2_ck",
5578c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5588c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent */
5598c2ecf20Sopenharmony_ci	.rate		= 12000000,
5608c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
5618c2ecf20Sopenharmony_ci	.enable_bit	= 11,
5628c2ecf20Sopenharmony_ci};
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_cistatic struct clk mclk_1510 = {
5658c2ecf20Sopenharmony_ci	.name		= "mclk",
5668c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5678c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
5688c2ecf20Sopenharmony_ci	.rate		= 12000000,
5698c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
5708c2ecf20Sopenharmony_ci	.enable_bit	= SOFT_COM_MCKO_REQ_SHIFT,
5718c2ecf20Sopenharmony_ci};
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_cistatic struct clk mclk_16xx = {
5748c2ecf20Sopenharmony_ci	.name		= "mclk",
5758c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5768c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
5778c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL),
5788c2ecf20Sopenharmony_ci	.enable_bit	= COM_ULPD_PLL_CLK_REQ,
5798c2ecf20Sopenharmony_ci	.set_rate	= &omap1_set_ext_clk_rate,
5808c2ecf20Sopenharmony_ci	.round_rate	= &omap1_round_ext_clk_rate,
5818c2ecf20Sopenharmony_ci	.init		= &omap1_init_ext_clk,
5828c2ecf20Sopenharmony_ci};
5838c2ecf20Sopenharmony_ci
5848c2ecf20Sopenharmony_cistatic struct clk bclk_1510 = {
5858c2ecf20Sopenharmony_ci	.name		= "bclk",
5868c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5878c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
5888c2ecf20Sopenharmony_ci	.rate		= 12000000,
5898c2ecf20Sopenharmony_ci};
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_cistatic struct clk bclk_16xx = {
5928c2ecf20Sopenharmony_ci	.name		= "bclk",
5938c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
5948c2ecf20Sopenharmony_ci	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
5958c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL),
5968c2ecf20Sopenharmony_ci	.enable_bit	= SWD_ULPD_PLL_CLK_REQ,
5978c2ecf20Sopenharmony_ci	.set_rate	= &omap1_set_ext_clk_rate,
5988c2ecf20Sopenharmony_ci	.round_rate	= &omap1_round_ext_clk_rate,
5998c2ecf20Sopenharmony_ci	.init		= &omap1_init_ext_clk,
6008c2ecf20Sopenharmony_ci};
6018c2ecf20Sopenharmony_ci
6028c2ecf20Sopenharmony_cistatic struct clk mmc1_ck = {
6038c2ecf20Sopenharmony_ci	.name		= "mmc1_ck",
6048c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
6058c2ecf20Sopenharmony_ci	/* Functional clock is direct from ULPD, interface clock is ARMPER */
6068c2ecf20Sopenharmony_ci	.parent		= &armper_ck.clk,
6078c2ecf20Sopenharmony_ci	.rate		= 48000000,
6088c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
6098c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
6108c2ecf20Sopenharmony_ci	.enable_bit	= CONF_MOD_MMC_SD_CLK_REQ_R,
6118c2ecf20Sopenharmony_ci};
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ci/*
6148c2ecf20Sopenharmony_ci * XXX MOD_CONF_CTRL_0 bit 20 is defined in the 1510 TRM as
6158c2ecf20Sopenharmony_ci * CONF_MOD_MCBSP3_AUXON ??
6168c2ecf20Sopenharmony_ci */
6178c2ecf20Sopenharmony_cistatic struct clk mmc2_ck = {
6188c2ecf20Sopenharmony_ci	.name		= "mmc2_ck",
6198c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
6208c2ecf20Sopenharmony_ci	/* Functional clock is direct from ULPD, interface clock is ARMPER */
6218c2ecf20Sopenharmony_ci	.parent		= &armper_ck.clk,
6228c2ecf20Sopenharmony_ci	.rate		= 48000000,
6238c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
6248c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
6258c2ecf20Sopenharmony_ci	.enable_bit	= 20,
6268c2ecf20Sopenharmony_ci};
6278c2ecf20Sopenharmony_ci
6288c2ecf20Sopenharmony_cistatic struct clk mmc3_ck = {
6298c2ecf20Sopenharmony_ci	.name		= "mmc3_ck",
6308c2ecf20Sopenharmony_ci	.ops		= &clkops_generic,
6318c2ecf20Sopenharmony_ci	/* Functional clock is direct from ULPD, interface clock is ARMPER */
6328c2ecf20Sopenharmony_ci	.parent		= &armper_ck.clk,
6338c2ecf20Sopenharmony_ci	.rate		= 48000000,
6348c2ecf20Sopenharmony_ci	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
6358c2ecf20Sopenharmony_ci	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
6368c2ecf20Sopenharmony_ci	.enable_bit	= SOFT_MMC_DPLL_REQ_SHIFT,
6378c2ecf20Sopenharmony_ci};
6388c2ecf20Sopenharmony_ci
6398c2ecf20Sopenharmony_cistatic struct clk virtual_ck_mpu = {
6408c2ecf20Sopenharmony_ci	.name		= "mpu",
6418c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
6428c2ecf20Sopenharmony_ci	.parent		= &arm_ck, /* Is smarter alias for */
6438c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
6448c2ecf20Sopenharmony_ci	.set_rate	= &omap1_select_table_rate,
6458c2ecf20Sopenharmony_ci	.round_rate	= &omap1_round_to_table_rate,
6468c2ecf20Sopenharmony_ci};
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci/* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK
6498c2ecf20Sopenharmony_ciremains active during MPU idle whenever this is enabled */
6508c2ecf20Sopenharmony_cistatic struct clk i2c_fck = {
6518c2ecf20Sopenharmony_ci	.name		= "i2c_fck",
6528c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
6538c2ecf20Sopenharmony_ci	.flags		= CLOCK_NO_IDLE_PARENT,
6548c2ecf20Sopenharmony_ci	.parent		= &armxor_ck.clk,
6558c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
6568c2ecf20Sopenharmony_ci};
6578c2ecf20Sopenharmony_ci
6588c2ecf20Sopenharmony_cistatic struct clk i2c_ick = {
6598c2ecf20Sopenharmony_ci	.name		= "i2c_ick",
6608c2ecf20Sopenharmony_ci	.ops		= &clkops_null,
6618c2ecf20Sopenharmony_ci	.flags		= CLOCK_NO_IDLE_PARENT,
6628c2ecf20Sopenharmony_ci	.parent		= &armper_ck.clk,
6638c2ecf20Sopenharmony_ci	.recalc		= &followparent_recalc,
6648c2ecf20Sopenharmony_ci};
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_ci/*
6678c2ecf20Sopenharmony_ci * clkdev integration
6688c2ecf20Sopenharmony_ci */
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_cistatic struct omap_clk omap_clks[] = {
6718c2ecf20Sopenharmony_ci	/* non-ULPD clocks */
6728c2ecf20Sopenharmony_ci	CLK(NULL,	"ck_ref",	&ck_ref,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
6738c2ecf20Sopenharmony_ci	CLK(NULL,	"ck_dpll1",	&ck_dpll1,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
6748c2ecf20Sopenharmony_ci	/* CK_GEN1 clocks */
6758c2ecf20Sopenharmony_ci	CLK(NULL,	"ck_dpll1out",	&ck_dpll1out.clk, CK_16XX),
6768c2ecf20Sopenharmony_ci	CLK(NULL,	"ck_sossi",	&sossi_ck,	CK_16XX),
6778c2ecf20Sopenharmony_ci	CLK(NULL,	"arm_ck",	&arm_ck,	CK_16XX | CK_1510 | CK_310),
6788c2ecf20Sopenharmony_ci	CLK(NULL,	"armper_ck",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310),
6798c2ecf20Sopenharmony_ci	CLK("omap_gpio.0", "ick",	&arm_gpio_ck,	CK_1510 | CK_310),
6808c2ecf20Sopenharmony_ci	CLK(NULL,	"armxor_ck",	&armxor_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
6818c2ecf20Sopenharmony_ci	CLK(NULL,	"armtim_ck",	&armtim_ck.clk,	CK_16XX | CK_1510 | CK_310),
6828c2ecf20Sopenharmony_ci	CLK("omap_wdt",	"fck",		&armwdt_ck.clk,	CK_16XX | CK_1510 | CK_310),
6838c2ecf20Sopenharmony_ci	CLK("omap_wdt",	"ick",		&armper_ck.clk,	CK_16XX),
6848c2ecf20Sopenharmony_ci	CLK("omap_wdt", "ick",		&dummy_ck,	CK_1510 | CK_310),
6858c2ecf20Sopenharmony_ci	CLK(NULL,	"arminth_ck",	&arminth_ck1510, CK_1510 | CK_310),
6868c2ecf20Sopenharmony_ci	CLK(NULL,	"arminth_ck",	&arminth_ck16xx, CK_16XX),
6878c2ecf20Sopenharmony_ci	/* CK_GEN2 clocks */
6888c2ecf20Sopenharmony_ci	CLK(NULL,	"dsp_ck",	&dsp_ck,	CK_16XX | CK_1510 | CK_310),
6898c2ecf20Sopenharmony_ci	CLK(NULL,	"dspmmu_ck",	&dspmmu_ck,	CK_16XX | CK_1510 | CK_310),
6908c2ecf20Sopenharmony_ci	CLK(NULL,	"dspper_ck",	&dspper_ck,	CK_16XX | CK_1510 | CK_310),
6918c2ecf20Sopenharmony_ci	CLK(NULL,	"dspxor_ck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
6928c2ecf20Sopenharmony_ci	CLK(NULL,	"dsptim_ck",	&dsptim_ck,	CK_16XX | CK_1510 | CK_310),
6938c2ecf20Sopenharmony_ci	/* CK_GEN3 clocks */
6948c2ecf20Sopenharmony_ci	CLK(NULL,	"tc_ck",	&tc_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
6958c2ecf20Sopenharmony_ci	CLK(NULL,	"tipb_ck",	&tipb_ck,	CK_1510 | CK_310),
6968c2ecf20Sopenharmony_ci	CLK(NULL,	"l3_ocpi_ck",	&l3_ocpi_ck,	CK_16XX | CK_7XX),
6978c2ecf20Sopenharmony_ci	CLK(NULL,	"tc1_ck",	&tc1_ck,	CK_16XX),
6988c2ecf20Sopenharmony_ci	CLK(NULL,	"tc2_ck",	&tc2_ck,	CK_16XX),
6998c2ecf20Sopenharmony_ci	CLK(NULL,	"dma_ck",	&dma_ck,	CK_16XX | CK_1510 | CK_310),
7008c2ecf20Sopenharmony_ci	CLK(NULL,	"dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
7018c2ecf20Sopenharmony_ci	CLK(NULL,	"api_ck",	&api_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
7028c2ecf20Sopenharmony_ci	CLK(NULL,	"lb_ck",	&lb_ck.clk,	CK_1510 | CK_310),
7038c2ecf20Sopenharmony_ci	CLK(NULL,	"rhea1_ck",	&rhea1_ck,	CK_16XX),
7048c2ecf20Sopenharmony_ci	CLK(NULL,	"rhea2_ck",	&rhea2_ck,	CK_16XX),
7058c2ecf20Sopenharmony_ci	CLK(NULL,	"lcd_ck",	&lcd_ck_16xx,	CK_16XX | CK_7XX),
7068c2ecf20Sopenharmony_ci	CLK(NULL,	"lcd_ck",	&lcd_ck_1510.clk, CK_1510 | CK_310),
7078c2ecf20Sopenharmony_ci	/* ULPD clocks */
7088c2ecf20Sopenharmony_ci	CLK(NULL,	"uart1_ck",	&uart1_1510,	CK_1510 | CK_310),
7098c2ecf20Sopenharmony_ci	CLK(NULL,	"uart1_ck",	&uart1_16xx.clk, CK_16XX),
7108c2ecf20Sopenharmony_ci	CLK(NULL,	"uart1_ck",	&uart1_7xx,	CK_7XX),
7118c2ecf20Sopenharmony_ci	CLK(NULL,	"uart2_ck",	&uart2_ck,	CK_16XX | CK_1510 | CK_310),
7128c2ecf20Sopenharmony_ci	CLK(NULL,	"uart2_ck",	&uart2_7xx,	CK_7XX),
7138c2ecf20Sopenharmony_ci	CLK(NULL,	"uart3_ck",	&uart3_1510,	CK_1510 | CK_310),
7148c2ecf20Sopenharmony_ci	CLK(NULL,	"uart3_ck",	&uart3_16xx.clk, CK_16XX),
7158c2ecf20Sopenharmony_ci	CLK(NULL,	"usb_clko",	&usb_clko,	CK_16XX | CK_1510 | CK_310),
7168c2ecf20Sopenharmony_ci	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck1510, CK_1510 | CK_310),
7178c2ecf20Sopenharmony_ci	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck16xx, CK_16XX),
7188c2ecf20Sopenharmony_ci	CLK(NULL,	"usb_dc_ck",	&usb_dc_ck,	CK_16XX | CK_7XX),
7198c2ecf20Sopenharmony_ci	CLK(NULL,	"mclk",		&mclk_1510,	CK_1510 | CK_310),
7208c2ecf20Sopenharmony_ci	CLK(NULL,	"mclk",		&mclk_16xx,	CK_16XX),
7218c2ecf20Sopenharmony_ci	CLK(NULL,	"bclk",		&bclk_1510,	CK_1510 | CK_310),
7228c2ecf20Sopenharmony_ci	CLK(NULL,	"bclk",		&bclk_16xx,	CK_16XX),
7238c2ecf20Sopenharmony_ci	CLK("mmci-omap.0", "fck",	&mmc1_ck,	CK_16XX | CK_1510 | CK_310),
7248c2ecf20Sopenharmony_ci	CLK("mmci-omap.0", "fck",	&mmc3_ck,	CK_7XX),
7258c2ecf20Sopenharmony_ci	CLK("mmci-omap.0", "ick",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
7268c2ecf20Sopenharmony_ci	CLK("mmci-omap.1", "fck",	&mmc2_ck,	CK_16XX),
7278c2ecf20Sopenharmony_ci	CLK("mmci-omap.1", "ick",	&armper_ck.clk,	CK_16XX),
7288c2ecf20Sopenharmony_ci	/* Virtual clocks */
7298c2ecf20Sopenharmony_ci	CLK(NULL,	"mpu",		&virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
7308c2ecf20Sopenharmony_ci	CLK("omap_i2c.1", "fck",	&i2c_fck,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
7318c2ecf20Sopenharmony_ci	CLK("omap_i2c.1", "ick",	&i2c_ick,	CK_16XX),
7328c2ecf20Sopenharmony_ci	CLK("omap_i2c.1", "ick",	&dummy_ck,	CK_1510 | CK_310 | CK_7XX),
7338c2ecf20Sopenharmony_ci	CLK("omap1_spi100k.1", "fck",	&dummy_ck,	CK_7XX),
7348c2ecf20Sopenharmony_ci	CLK("omap1_spi100k.1", "ick",	&dummy_ck,	CK_7XX),
7358c2ecf20Sopenharmony_ci	CLK("omap1_spi100k.2", "fck",	&dummy_ck,	CK_7XX),
7368c2ecf20Sopenharmony_ci	CLK("omap1_spi100k.2", "ick",	&dummy_ck,	CK_7XX),
7378c2ecf20Sopenharmony_ci	CLK("omap_uwire", "fck",	&armxor_ck.clk,	CK_16XX | CK_1510 | CK_310),
7388c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.1", "ick",	&dspper_ck,	CK_16XX),
7398c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.1", "ick",	&dummy_ck,	CK_1510 | CK_310),
7408c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.2", "ick",	&armper_ck.clk,	CK_16XX),
7418c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.2", "ick",	&dummy_ck,	CK_1510 | CK_310),
7428c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.3", "ick",	&dspper_ck,	CK_16XX),
7438c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.3", "ick",	&dummy_ck,	CK_1510 | CK_310),
7448c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.1", "fck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
7458c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.2", "fck",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310),
7468c2ecf20Sopenharmony_ci	CLK("omap-mcbsp.3", "fck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
7478c2ecf20Sopenharmony_ci};
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci/*
7508c2ecf20Sopenharmony_ci * init
7518c2ecf20Sopenharmony_ci */
7528c2ecf20Sopenharmony_ci
7538c2ecf20Sopenharmony_cistatic void __init omap1_show_rates(void)
7548c2ecf20Sopenharmony_ci{
7558c2ecf20Sopenharmony_ci	pr_notice("Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
7568c2ecf20Sopenharmony_ci		  ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
7578c2ecf20Sopenharmony_ci		  ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
7588c2ecf20Sopenharmony_ci		  arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
7598c2ecf20Sopenharmony_ci}
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_ciu32 cpu_mask;
7628c2ecf20Sopenharmony_ci
7638c2ecf20Sopenharmony_ciint __init omap1_clk_init(void)
7648c2ecf20Sopenharmony_ci{
7658c2ecf20Sopenharmony_ci	struct omap_clk *c;
7668c2ecf20Sopenharmony_ci	int crystal_type = 0; /* Default 12 MHz */
7678c2ecf20Sopenharmony_ci	u32 reg;
7688c2ecf20Sopenharmony_ci
7698c2ecf20Sopenharmony_ci#ifdef CONFIG_DEBUG_LL
7708c2ecf20Sopenharmony_ci	/*
7718c2ecf20Sopenharmony_ci	 * Resets some clocks that may be left on from bootloader,
7728c2ecf20Sopenharmony_ci	 * but leaves serial clocks on.
7738c2ecf20Sopenharmony_ci	 */
7748c2ecf20Sopenharmony_ci	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
7758c2ecf20Sopenharmony_ci#endif
7768c2ecf20Sopenharmony_ci
7778c2ecf20Sopenharmony_ci	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
7788c2ecf20Sopenharmony_ci	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
7798c2ecf20Sopenharmony_ci	omap_writew(reg, SOFT_REQ_REG);
7808c2ecf20Sopenharmony_ci	if (!cpu_is_omap15xx())
7818c2ecf20Sopenharmony_ci		omap_writew(0, SOFT_REQ_REG2);
7828c2ecf20Sopenharmony_ci
7838c2ecf20Sopenharmony_ci	/* By default all idlect1 clocks are allowed to idle */
7848c2ecf20Sopenharmony_ci	arm_idlect1_mask = ~0;
7858c2ecf20Sopenharmony_ci
7868c2ecf20Sopenharmony_ci	for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
7878c2ecf20Sopenharmony_ci		clk_preinit(c->lk.clk);
7888c2ecf20Sopenharmony_ci
7898c2ecf20Sopenharmony_ci	cpu_mask = 0;
7908c2ecf20Sopenharmony_ci	if (cpu_is_omap1710())
7918c2ecf20Sopenharmony_ci		cpu_mask |= CK_1710;
7928c2ecf20Sopenharmony_ci	if (cpu_is_omap16xx())
7938c2ecf20Sopenharmony_ci		cpu_mask |= CK_16XX;
7948c2ecf20Sopenharmony_ci	if (cpu_is_omap1510())
7958c2ecf20Sopenharmony_ci		cpu_mask |= CK_1510;
7968c2ecf20Sopenharmony_ci	if (cpu_is_omap7xx())
7978c2ecf20Sopenharmony_ci		cpu_mask |= CK_7XX;
7988c2ecf20Sopenharmony_ci	if (cpu_is_omap310())
7998c2ecf20Sopenharmony_ci		cpu_mask |= CK_310;
8008c2ecf20Sopenharmony_ci
8018c2ecf20Sopenharmony_ci	for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
8028c2ecf20Sopenharmony_ci		if (c->cpu & cpu_mask) {
8038c2ecf20Sopenharmony_ci			clkdev_add(&c->lk);
8048c2ecf20Sopenharmony_ci			clk_register(c->lk.clk);
8058c2ecf20Sopenharmony_ci		}
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci	/* Pointers to these clocks are needed by code in clock.c */
8088c2ecf20Sopenharmony_ci	api_ck_p = clk_get(NULL, "api_ck");
8098c2ecf20Sopenharmony_ci	ck_dpll1_p = clk_get(NULL, "ck_dpll1");
8108c2ecf20Sopenharmony_ci	ck_ref_p = clk_get(NULL, "ck_ref");
8118c2ecf20Sopenharmony_ci
8128c2ecf20Sopenharmony_ci	if (cpu_is_omap7xx())
8138c2ecf20Sopenharmony_ci		ck_ref.rate = 13000000;
8148c2ecf20Sopenharmony_ci	if (cpu_is_omap16xx() && crystal_type == 2)
8158c2ecf20Sopenharmony_ci		ck_ref.rate = 19200000;
8168c2ecf20Sopenharmony_ci
8178c2ecf20Sopenharmony_ci	pr_info("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: 0x%04x\n",
8188c2ecf20Sopenharmony_ci		omap_readw(ARM_SYSST), omap_readw(DPLL_CTL),
8198c2ecf20Sopenharmony_ci		omap_readw(ARM_CKCTL));
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_ci	/* We want to be in syncronous scalable mode */
8228c2ecf20Sopenharmony_ci	omap_writew(0x1000, ARM_SYSST);
8238c2ecf20Sopenharmony_ci
8248c2ecf20Sopenharmony_ci
8258c2ecf20Sopenharmony_ci	/*
8268c2ecf20Sopenharmony_ci	 * Initially use the values set by bootloader. Determine PLL rate and
8278c2ecf20Sopenharmony_ci	 * recalculate dependent clocks as if kernel had changed PLL or
8288c2ecf20Sopenharmony_ci	 * divisors. See also omap1_clk_late_init() that can reprogram dpll1
8298c2ecf20Sopenharmony_ci	 * after the SRAM is initialized.
8308c2ecf20Sopenharmony_ci	 */
8318c2ecf20Sopenharmony_ci	{
8328c2ecf20Sopenharmony_ci		unsigned pll_ctl_val = omap_readw(DPLL_CTL);
8338c2ecf20Sopenharmony_ci
8348c2ecf20Sopenharmony_ci		ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
8358c2ecf20Sopenharmony_ci		if (pll_ctl_val & 0x10) {
8368c2ecf20Sopenharmony_ci			/* PLL enabled, apply multiplier and divisor */
8378c2ecf20Sopenharmony_ci			if (pll_ctl_val & 0xf80)
8388c2ecf20Sopenharmony_ci				ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
8398c2ecf20Sopenharmony_ci			ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
8408c2ecf20Sopenharmony_ci		} else {
8418c2ecf20Sopenharmony_ci			/* PLL disabled, apply bypass divisor */
8428c2ecf20Sopenharmony_ci			switch (pll_ctl_val & 0xc) {
8438c2ecf20Sopenharmony_ci			case 0:
8448c2ecf20Sopenharmony_ci				break;
8458c2ecf20Sopenharmony_ci			case 0x4:
8468c2ecf20Sopenharmony_ci				ck_dpll1.rate /= 2;
8478c2ecf20Sopenharmony_ci				break;
8488c2ecf20Sopenharmony_ci			default:
8498c2ecf20Sopenharmony_ci				ck_dpll1.rate /= 4;
8508c2ecf20Sopenharmony_ci				break;
8518c2ecf20Sopenharmony_ci			}
8528c2ecf20Sopenharmony_ci		}
8538c2ecf20Sopenharmony_ci	}
8548c2ecf20Sopenharmony_ci	propagate_rate(&ck_dpll1);
8558c2ecf20Sopenharmony_ci	/* Cache rates for clocks connected to ck_ref (not dpll1) */
8568c2ecf20Sopenharmony_ci	propagate_rate(&ck_ref);
8578c2ecf20Sopenharmony_ci	omap1_show_rates();
8588c2ecf20Sopenharmony_ci	if (machine_is_omap_perseus2() || machine_is_omap_fsample()) {
8598c2ecf20Sopenharmony_ci		/* Select slicer output as OMAP input clock */
8608c2ecf20Sopenharmony_ci		omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1,
8618c2ecf20Sopenharmony_ci				OMAP7XX_PCC_UPLD_CTRL);
8628c2ecf20Sopenharmony_ci	}
8638c2ecf20Sopenharmony_ci
8648c2ecf20Sopenharmony_ci	/* Amstrad Delta wants BCLK high when inactive */
8658c2ecf20Sopenharmony_ci	if (machine_is_ams_delta())
8668c2ecf20Sopenharmony_ci		omap_writel(omap_readl(ULPD_CLOCK_CTRL) |
8678c2ecf20Sopenharmony_ci				(1 << SDW_MCLK_INV_BIT),
8688c2ecf20Sopenharmony_ci				ULPD_CLOCK_CTRL);
8698c2ecf20Sopenharmony_ci
8708c2ecf20Sopenharmony_ci	/* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
8718c2ecf20Sopenharmony_ci	/* (on 730, bit 13 must not be cleared) */
8728c2ecf20Sopenharmony_ci	if (cpu_is_omap7xx())
8738c2ecf20Sopenharmony_ci		omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
8748c2ecf20Sopenharmony_ci	else
8758c2ecf20Sopenharmony_ci		omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
8768c2ecf20Sopenharmony_ci
8778c2ecf20Sopenharmony_ci	/* Put DSP/MPUI into reset until needed */
8788c2ecf20Sopenharmony_ci	omap_writew(0, ARM_RSTCT1);
8798c2ecf20Sopenharmony_ci	omap_writew(1, ARM_RSTCT2);
8808c2ecf20Sopenharmony_ci	omap_writew(0x400, ARM_IDLECT1);
8818c2ecf20Sopenharmony_ci
8828c2ecf20Sopenharmony_ci	/*
8838c2ecf20Sopenharmony_ci	 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
8848c2ecf20Sopenharmony_ci	 * of the ARM_IDLECT2 register must be set to zero. The power-on
8858c2ecf20Sopenharmony_ci	 * default value of this bit is one.
8868c2ecf20Sopenharmony_ci	 */
8878c2ecf20Sopenharmony_ci	omap_writew(0x0000, ARM_IDLECT2);	/* Turn LCD clock off also */
8888c2ecf20Sopenharmony_ci
8898c2ecf20Sopenharmony_ci	/*
8908c2ecf20Sopenharmony_ci	 * Only enable those clocks we will need, let the drivers
8918c2ecf20Sopenharmony_ci	 * enable other clocks as necessary
8928c2ecf20Sopenharmony_ci	 */
8938c2ecf20Sopenharmony_ci	clk_enable(&armper_ck.clk);
8948c2ecf20Sopenharmony_ci	clk_enable(&armxor_ck.clk);
8958c2ecf20Sopenharmony_ci	clk_enable(&armtim_ck.clk); /* This should be done by timer code */
8968c2ecf20Sopenharmony_ci
8978c2ecf20Sopenharmony_ci	if (cpu_is_omap15xx())
8988c2ecf20Sopenharmony_ci		clk_enable(&arm_gpio_ck);
8998c2ecf20Sopenharmony_ci
9008c2ecf20Sopenharmony_ci	return 0;
9018c2ecf20Sopenharmony_ci}
9028c2ecf20Sopenharmony_ci
9038c2ecf20Sopenharmony_ci#define OMAP1_DPLL1_SANE_VALUE	60000000
9048c2ecf20Sopenharmony_ci
9058c2ecf20Sopenharmony_civoid __init omap1_clk_late_init(void)
9068c2ecf20Sopenharmony_ci{
9078c2ecf20Sopenharmony_ci	unsigned long rate = ck_dpll1.rate;
9088c2ecf20Sopenharmony_ci
9098c2ecf20Sopenharmony_ci	/* Find the highest supported frequency and enable it */
9108c2ecf20Sopenharmony_ci	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
9118c2ecf20Sopenharmony_ci		pr_err("System frequencies not set, using default. Check your config.\n");
9128c2ecf20Sopenharmony_ci		/*
9138c2ecf20Sopenharmony_ci		 * Reprogramming the DPLL is tricky, it must be done from SRAM.
9148c2ecf20Sopenharmony_ci		 */
9158c2ecf20Sopenharmony_ci		omap_sram_reprogram_clock(0x2290, 0x0005);
9168c2ecf20Sopenharmony_ci		ck_dpll1.rate = OMAP1_DPLL1_SANE_VALUE;
9178c2ecf20Sopenharmony_ci	}
9188c2ecf20Sopenharmony_ci	propagate_rate(&ck_dpll1);
9198c2ecf20Sopenharmony_ci	omap1_show_rates();
9208c2ecf20Sopenharmony_ci	loops_per_jiffy = cpufreq_scale(loops_per_jiffy, rate, ck_dpll1.rate);
9218c2ecf20Sopenharmony_ci}
922