xref: /linux/arch/arm/mach-omap1/clock_data.c (revision bf92a40762fb10a394281941a46f529463c49ffc)
152650505SPaul Walmsley /*
252650505SPaul Walmsley  *  linux/arch/arm/mach-omap1/clock_data.c
352650505SPaul Walmsley  *
452650505SPaul Walmsley  *  Copyright (C) 2004 - 2005, 2009 Nokia corporation
552650505SPaul Walmsley  *  Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
652650505SPaul Walmsley  *  Based on clocks.h by Tony Lindgren, Gordon McNutt and RidgeRun, Inc
752650505SPaul Walmsley  *
852650505SPaul Walmsley  * This program is free software; you can redistribute it and/or modify
952650505SPaul Walmsley  * it under the terms of the GNU General Public License version 2 as
1052650505SPaul Walmsley  * published by the Free Software Foundation.
1152650505SPaul Walmsley  */
1252650505SPaul Walmsley 
1352650505SPaul Walmsley #include <linux/kernel.h>
1452650505SPaul Walmsley #include <linux/clk.h>
1552650505SPaul Walmsley #include <linux/io.h>
1652650505SPaul Walmsley 
1752650505SPaul Walmsley #include <asm/mach-types.h>  /* for machine_is_* */
1852650505SPaul Walmsley 
1952650505SPaul Walmsley #include <plat/clock.h>
2052650505SPaul Walmsley #include <plat/cpu.h>
2152650505SPaul Walmsley #include <plat/clkdev_omap.h>
2252650505SPaul Walmsley #include <plat/usb.h>   /* for OTG_BASE */
2352650505SPaul Walmsley 
2452650505SPaul Walmsley #include "clock.h"
2552650505SPaul Walmsley 
2652650505SPaul Walmsley /*------------------------------------------------------------------------
2752650505SPaul Walmsley  * Omap1 clocks
2852650505SPaul Walmsley  *-------------------------------------------------------------------------*/
2952650505SPaul Walmsley 
3052650505SPaul Walmsley /* XXX is this necessary? */
3152650505SPaul Walmsley static struct clk dummy_ck = {
3252650505SPaul Walmsley 	.name	= "dummy",
3352650505SPaul Walmsley 	.ops	= &clkops_dummy,
3452650505SPaul Walmsley 	.flags	= RATE_FIXED,
3552650505SPaul Walmsley };
3652650505SPaul Walmsley 
3752650505SPaul Walmsley static struct clk ck_ref = {
3852650505SPaul Walmsley 	.name		= "ck_ref",
3952650505SPaul Walmsley 	.ops		= &clkops_null,
4052650505SPaul Walmsley 	.rate		= 12000000,
4152650505SPaul Walmsley };
4252650505SPaul Walmsley 
4352650505SPaul Walmsley static struct clk ck_dpll1 = {
4452650505SPaul Walmsley 	.name		= "ck_dpll1",
4552650505SPaul Walmsley 	.ops		= &clkops_null,
4652650505SPaul Walmsley 	.parent		= &ck_ref,
4752650505SPaul Walmsley };
4852650505SPaul Walmsley 
4952650505SPaul Walmsley /*
5052650505SPaul Walmsley  * FIXME: This clock seems to be necessary but no-one has asked for its
5152650505SPaul Walmsley  * activation.  [ FIX: SoSSI, SSR ]
5252650505SPaul Walmsley  */
5352650505SPaul Walmsley static struct arm_idlect1_clk ck_dpll1out = {
5452650505SPaul Walmsley 	.clk = {
5552650505SPaul Walmsley 		.name		= "ck_dpll1out",
5652650505SPaul Walmsley 		.ops		= &clkops_generic,
5752650505SPaul Walmsley 		.parent		= &ck_dpll1,
5852650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL | ENABLE_REG_32BIT |
5952650505SPaul Walmsley 				  ENABLE_ON_INIT,
6052650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
6152650505SPaul Walmsley 		.enable_bit	= EN_CKOUT_ARM,
6252650505SPaul Walmsley 		.recalc		= &followparent_recalc,
6352650505SPaul Walmsley 	},
6452650505SPaul Walmsley 	.idlect_shift	= 12,
6552650505SPaul Walmsley };
6652650505SPaul Walmsley 
6752650505SPaul Walmsley static struct clk sossi_ck = {
6852650505SPaul Walmsley 	.name		= "ck_sossi",
6952650505SPaul Walmsley 	.ops		= &clkops_generic,
7052650505SPaul Walmsley 	.parent		= &ck_dpll1out.clk,
7152650505SPaul Walmsley 	.flags		= CLOCK_NO_IDLE_PARENT | ENABLE_REG_32BIT,
7252650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_1),
7352650505SPaul Walmsley 	.enable_bit	= 16,
7452650505SPaul Walmsley 	.recalc		= &omap1_sossi_recalc,
7552650505SPaul Walmsley 	.set_rate	= &omap1_set_sossi_rate,
7652650505SPaul Walmsley };
7752650505SPaul Walmsley 
7852650505SPaul Walmsley static struct clk arm_ck = {
7952650505SPaul Walmsley 	.name		= "arm_ck",
8052650505SPaul Walmsley 	.ops		= &clkops_null,
8152650505SPaul Walmsley 	.parent		= &ck_dpll1,
8252650505SPaul Walmsley 	.rate_offset	= CKCTL_ARMDIV_OFFSET,
8352650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc,
8452650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
8552650505SPaul Walmsley 	.set_rate	= omap1_clk_set_rate_ckctl_arm,
8652650505SPaul Walmsley };
8752650505SPaul Walmsley 
8852650505SPaul Walmsley static struct arm_idlect1_clk armper_ck = {
8952650505SPaul Walmsley 	.clk = {
9052650505SPaul Walmsley 		.name		= "armper_ck",
9152650505SPaul Walmsley 		.ops		= &clkops_generic,
9252650505SPaul Walmsley 		.parent		= &ck_dpll1,
9352650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
9452650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
9552650505SPaul Walmsley 		.enable_bit	= EN_PERCK,
9652650505SPaul Walmsley 		.rate_offset	= CKCTL_PERDIV_OFFSET,
9752650505SPaul Walmsley 		.recalc		= &omap1_ckctl_recalc,
9852650505SPaul Walmsley 		.round_rate	= omap1_clk_round_rate_ckctl_arm,
9952650505SPaul Walmsley 		.set_rate	= omap1_clk_set_rate_ckctl_arm,
10052650505SPaul Walmsley 	},
10152650505SPaul Walmsley 	.idlect_shift	= 2,
10252650505SPaul Walmsley };
10352650505SPaul Walmsley 
10452650505SPaul Walmsley /*
10552650505SPaul Walmsley  * FIXME: This clock seems to be necessary but no-one has asked for its
10652650505SPaul Walmsley  * activation.  [ GPIO code for 1510 ]
10752650505SPaul Walmsley  */
10852650505SPaul Walmsley static struct clk arm_gpio_ck = {
10952650505SPaul Walmsley 	.name		= "arm_gpio_ck",
11052650505SPaul Walmsley 	.ops		= &clkops_generic,
11152650505SPaul Walmsley 	.parent		= &ck_dpll1,
11252650505SPaul Walmsley 	.flags		= ENABLE_ON_INIT,
11352650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
11452650505SPaul Walmsley 	.enable_bit	= EN_GPIOCK,
11552650505SPaul Walmsley 	.recalc		= &followparent_recalc,
11652650505SPaul Walmsley };
11752650505SPaul Walmsley 
11852650505SPaul Walmsley static struct arm_idlect1_clk armxor_ck = {
11952650505SPaul Walmsley 	.clk = {
12052650505SPaul Walmsley 		.name		= "armxor_ck",
12152650505SPaul Walmsley 		.ops		= &clkops_generic,
12252650505SPaul Walmsley 		.parent		= &ck_ref,
12352650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
12452650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
12552650505SPaul Walmsley 		.enable_bit	= EN_XORPCK,
12652650505SPaul Walmsley 		.recalc		= &followparent_recalc,
12752650505SPaul Walmsley 	},
12852650505SPaul Walmsley 	.idlect_shift	= 1,
12952650505SPaul Walmsley };
13052650505SPaul Walmsley 
13152650505SPaul Walmsley static struct arm_idlect1_clk armtim_ck = {
13252650505SPaul Walmsley 	.clk = {
13352650505SPaul Walmsley 		.name		= "armtim_ck",
13452650505SPaul Walmsley 		.ops		= &clkops_generic,
13552650505SPaul Walmsley 		.parent		= &ck_ref,
13652650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
13752650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
13852650505SPaul Walmsley 		.enable_bit	= EN_TIMCK,
13952650505SPaul Walmsley 		.recalc		= &followparent_recalc,
14052650505SPaul Walmsley 	},
14152650505SPaul Walmsley 	.idlect_shift	= 9,
14252650505SPaul Walmsley };
14352650505SPaul Walmsley 
14452650505SPaul Walmsley static struct arm_idlect1_clk armwdt_ck = {
14552650505SPaul Walmsley 	.clk = {
14652650505SPaul Walmsley 		.name		= "armwdt_ck",
14752650505SPaul Walmsley 		.ops		= &clkops_generic,
14852650505SPaul Walmsley 		.parent		= &ck_ref,
14952650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
15052650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
15152650505SPaul Walmsley 		.enable_bit	= EN_WDTCK,
15252650505SPaul Walmsley 		.recalc		= &omap1_watchdog_recalc,
15352650505SPaul Walmsley 	},
15452650505SPaul Walmsley 	.idlect_shift	= 0,
15552650505SPaul Walmsley };
15652650505SPaul Walmsley 
15752650505SPaul Walmsley static struct clk arminth_ck16xx = {
15852650505SPaul Walmsley 	.name		= "arminth_ck",
15952650505SPaul Walmsley 	.ops		= &clkops_null,
16052650505SPaul Walmsley 	.parent		= &arm_ck,
16152650505SPaul Walmsley 	.recalc		= &followparent_recalc,
16252650505SPaul Walmsley 	/* Note: On 16xx the frequency can be divided by 2 by programming
16352650505SPaul Walmsley 	 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
16452650505SPaul Walmsley 	 *
16552650505SPaul Walmsley 	 * 1510 version is in TC clocks.
16652650505SPaul Walmsley 	 */
16752650505SPaul Walmsley };
16852650505SPaul Walmsley 
16952650505SPaul Walmsley static struct clk dsp_ck = {
17052650505SPaul Walmsley 	.name		= "dsp_ck",
17152650505SPaul Walmsley 	.ops		= &clkops_generic,
17252650505SPaul Walmsley 	.parent		= &ck_dpll1,
17352650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_CKCTL),
17452650505SPaul Walmsley 	.enable_bit	= EN_DSPCK,
17552650505SPaul Walmsley 	.rate_offset	= CKCTL_DSPDIV_OFFSET,
17652650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc,
17752650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
17852650505SPaul Walmsley 	.set_rate	= omap1_clk_set_rate_ckctl_arm,
17952650505SPaul Walmsley };
18052650505SPaul Walmsley 
18152650505SPaul Walmsley static struct clk dspmmu_ck = {
18252650505SPaul Walmsley 	.name		= "dspmmu_ck",
18352650505SPaul Walmsley 	.ops		= &clkops_null,
18452650505SPaul Walmsley 	.parent		= &ck_dpll1,
18552650505SPaul Walmsley 	.rate_offset	= CKCTL_DSPMMUDIV_OFFSET,
18652650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc,
18752650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
18852650505SPaul Walmsley 	.set_rate	= omap1_clk_set_rate_ckctl_arm,
18952650505SPaul Walmsley };
19052650505SPaul Walmsley 
19152650505SPaul Walmsley static struct clk dspper_ck = {
19252650505SPaul Walmsley 	.name		= "dspper_ck",
19352650505SPaul Walmsley 	.ops		= &clkops_dspck,
19452650505SPaul Walmsley 	.parent		= &ck_dpll1,
19552650505SPaul Walmsley 	.enable_reg	= DSP_IDLECT2,
19652650505SPaul Walmsley 	.enable_bit	= EN_PERCK,
19752650505SPaul Walmsley 	.rate_offset	= CKCTL_PERDIV_OFFSET,
19852650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc_dsp_domain,
19952650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
20052650505SPaul Walmsley 	.set_rate	= &omap1_clk_set_rate_dsp_domain,
20152650505SPaul Walmsley };
20252650505SPaul Walmsley 
20352650505SPaul Walmsley static struct clk dspxor_ck = {
20452650505SPaul Walmsley 	.name		= "dspxor_ck",
20552650505SPaul Walmsley 	.ops		= &clkops_dspck,
20652650505SPaul Walmsley 	.parent		= &ck_ref,
20752650505SPaul Walmsley 	.enable_reg	= DSP_IDLECT2,
20852650505SPaul Walmsley 	.enable_bit	= EN_XORPCK,
20952650505SPaul Walmsley 	.recalc		= &followparent_recalc,
21052650505SPaul Walmsley };
21152650505SPaul Walmsley 
21252650505SPaul Walmsley static struct clk dsptim_ck = {
21352650505SPaul Walmsley 	.name		= "dsptim_ck",
21452650505SPaul Walmsley 	.ops		= &clkops_dspck,
21552650505SPaul Walmsley 	.parent		= &ck_ref,
21652650505SPaul Walmsley 	.enable_reg	= DSP_IDLECT2,
21752650505SPaul Walmsley 	.enable_bit	= EN_DSPTIMCK,
21852650505SPaul Walmsley 	.recalc		= &followparent_recalc,
21952650505SPaul Walmsley };
22052650505SPaul Walmsley 
22152650505SPaul Walmsley /* Tie ARM_IDLECT1:IDLIF_ARM to this logical clock structure */
22252650505SPaul Walmsley static struct arm_idlect1_clk tc_ck = {
22352650505SPaul Walmsley 	.clk = {
22452650505SPaul Walmsley 		.name		= "tc_ck",
22552650505SPaul Walmsley 		.ops		= &clkops_null,
22652650505SPaul Walmsley 		.parent		= &ck_dpll1,
22752650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
22852650505SPaul Walmsley 		.rate_offset	= CKCTL_TCDIV_OFFSET,
22952650505SPaul Walmsley 		.recalc		= &omap1_ckctl_recalc,
23052650505SPaul Walmsley 		.round_rate	= omap1_clk_round_rate_ckctl_arm,
23152650505SPaul Walmsley 		.set_rate	= omap1_clk_set_rate_ckctl_arm,
23252650505SPaul Walmsley 	},
23352650505SPaul Walmsley 	.idlect_shift	= 6,
23452650505SPaul Walmsley };
23552650505SPaul Walmsley 
23652650505SPaul Walmsley static struct clk arminth_ck1510 = {
23752650505SPaul Walmsley 	.name		= "arminth_ck",
23852650505SPaul Walmsley 	.ops		= &clkops_null,
23952650505SPaul Walmsley 	.parent		= &tc_ck.clk,
24052650505SPaul Walmsley 	.recalc		= &followparent_recalc,
24152650505SPaul Walmsley 	/* Note: On 1510 the frequency follows TC_CK
24252650505SPaul Walmsley 	 *
24352650505SPaul Walmsley 	 * 16xx version is in MPU clocks.
24452650505SPaul Walmsley 	 */
24552650505SPaul Walmsley };
24652650505SPaul Walmsley 
24752650505SPaul Walmsley static struct clk tipb_ck = {
24852650505SPaul Walmsley 	/* No-idle controlled by "tc_ck" */
24952650505SPaul Walmsley 	.name		= "tipb_ck",
25052650505SPaul Walmsley 	.ops		= &clkops_null,
25152650505SPaul Walmsley 	.parent		= &tc_ck.clk,
25252650505SPaul Walmsley 	.recalc		= &followparent_recalc,
25352650505SPaul Walmsley };
25452650505SPaul Walmsley 
25552650505SPaul Walmsley static struct clk l3_ocpi_ck = {
25652650505SPaul Walmsley 	/* No-idle controlled by "tc_ck" */
25752650505SPaul Walmsley 	.name		= "l3_ocpi_ck",
25852650505SPaul Walmsley 	.ops		= &clkops_generic,
25952650505SPaul Walmsley 	.parent		= &tc_ck.clk,
26052650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
26152650505SPaul Walmsley 	.enable_bit	= EN_OCPI_CK,
26252650505SPaul Walmsley 	.recalc		= &followparent_recalc,
26352650505SPaul Walmsley };
26452650505SPaul Walmsley 
26552650505SPaul Walmsley static struct clk tc1_ck = {
26652650505SPaul Walmsley 	.name		= "tc1_ck",
26752650505SPaul Walmsley 	.ops		= &clkops_generic,
26852650505SPaul Walmsley 	.parent		= &tc_ck.clk,
26952650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
27052650505SPaul Walmsley 	.enable_bit	= EN_TC1_CK,
27152650505SPaul Walmsley 	.recalc		= &followparent_recalc,
27252650505SPaul Walmsley };
27352650505SPaul Walmsley 
27452650505SPaul Walmsley /*
27552650505SPaul Walmsley  * FIXME: This clock seems to be necessary but no-one has asked for its
27652650505SPaul Walmsley  * activation.  [ pm.c (SRAM), CCP, Camera ]
27752650505SPaul Walmsley  */
27852650505SPaul Walmsley static struct clk tc2_ck = {
27952650505SPaul Walmsley 	.name		= "tc2_ck",
28052650505SPaul Walmsley 	.ops		= &clkops_generic,
28152650505SPaul Walmsley 	.parent		= &tc_ck.clk,
28252650505SPaul Walmsley 	.flags		= ENABLE_ON_INIT,
28352650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT3),
28452650505SPaul Walmsley 	.enable_bit	= EN_TC2_CK,
28552650505SPaul Walmsley 	.recalc		= &followparent_recalc,
28652650505SPaul Walmsley };
28752650505SPaul Walmsley 
28852650505SPaul Walmsley static struct clk dma_ck = {
28952650505SPaul Walmsley 	/* No-idle controlled by "tc_ck" */
29052650505SPaul Walmsley 	.name		= "dma_ck",
29152650505SPaul Walmsley 	.ops		= &clkops_null,
29252650505SPaul Walmsley 	.parent		= &tc_ck.clk,
29352650505SPaul Walmsley 	.recalc		= &followparent_recalc,
29452650505SPaul Walmsley };
29552650505SPaul Walmsley 
29652650505SPaul Walmsley static struct clk dma_lcdfree_ck = {
29752650505SPaul Walmsley 	.name		= "dma_lcdfree_ck",
29852650505SPaul Walmsley 	.ops		= &clkops_null,
29952650505SPaul Walmsley 	.parent		= &tc_ck.clk,
30052650505SPaul Walmsley 	.recalc		= &followparent_recalc,
30152650505SPaul Walmsley };
30252650505SPaul Walmsley 
30352650505SPaul Walmsley static struct arm_idlect1_clk api_ck = {
30452650505SPaul Walmsley 	.clk = {
30552650505SPaul Walmsley 		.name		= "api_ck",
30652650505SPaul Walmsley 		.ops		= &clkops_generic,
30752650505SPaul Walmsley 		.parent		= &tc_ck.clk,
30852650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
30952650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
31052650505SPaul Walmsley 		.enable_bit	= EN_APICK,
31152650505SPaul Walmsley 		.recalc		= &followparent_recalc,
31252650505SPaul Walmsley 	},
31352650505SPaul Walmsley 	.idlect_shift	= 8,
31452650505SPaul Walmsley };
31552650505SPaul Walmsley 
31652650505SPaul Walmsley static struct arm_idlect1_clk lb_ck = {
31752650505SPaul Walmsley 	.clk = {
31852650505SPaul Walmsley 		.name		= "lb_ck",
31952650505SPaul Walmsley 		.ops		= &clkops_generic,
32052650505SPaul Walmsley 		.parent		= &tc_ck.clk,
32152650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
32252650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
32352650505SPaul Walmsley 		.enable_bit	= EN_LBCK,
32452650505SPaul Walmsley 		.recalc		= &followparent_recalc,
32552650505SPaul Walmsley 	},
32652650505SPaul Walmsley 	.idlect_shift	= 4,
32752650505SPaul Walmsley };
32852650505SPaul Walmsley 
32952650505SPaul Walmsley static struct clk rhea1_ck = {
33052650505SPaul Walmsley 	.name		= "rhea1_ck",
33152650505SPaul Walmsley 	.ops		= &clkops_null,
33252650505SPaul Walmsley 	.parent		= &tc_ck.clk,
33352650505SPaul Walmsley 	.recalc		= &followparent_recalc,
33452650505SPaul Walmsley };
33552650505SPaul Walmsley 
33652650505SPaul Walmsley static struct clk rhea2_ck = {
33752650505SPaul Walmsley 	.name		= "rhea2_ck",
33852650505SPaul Walmsley 	.ops		= &clkops_null,
33952650505SPaul Walmsley 	.parent		= &tc_ck.clk,
34052650505SPaul Walmsley 	.recalc		= &followparent_recalc,
34152650505SPaul Walmsley };
34252650505SPaul Walmsley 
34352650505SPaul Walmsley static struct clk lcd_ck_16xx = {
34452650505SPaul Walmsley 	.name		= "lcd_ck",
34552650505SPaul Walmsley 	.ops		= &clkops_generic,
34652650505SPaul Walmsley 	.parent		= &ck_dpll1,
34752650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
34852650505SPaul Walmsley 	.enable_bit	= EN_LCDCK,
34952650505SPaul Walmsley 	.rate_offset	= CKCTL_LCDDIV_OFFSET,
35052650505SPaul Walmsley 	.recalc		= &omap1_ckctl_recalc,
35152650505SPaul Walmsley 	.round_rate	= omap1_clk_round_rate_ckctl_arm,
35252650505SPaul Walmsley 	.set_rate	= omap1_clk_set_rate_ckctl_arm,
35352650505SPaul Walmsley };
35452650505SPaul Walmsley 
35552650505SPaul Walmsley static struct arm_idlect1_clk lcd_ck_1510 = {
35652650505SPaul Walmsley 	.clk = {
35752650505SPaul Walmsley 		.name		= "lcd_ck",
35852650505SPaul Walmsley 		.ops		= &clkops_generic,
35952650505SPaul Walmsley 		.parent		= &ck_dpll1,
36052650505SPaul Walmsley 		.flags		= CLOCK_IDLE_CONTROL,
36152650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(ARM_IDLECT2),
36252650505SPaul Walmsley 		.enable_bit	= EN_LCDCK,
36352650505SPaul Walmsley 		.rate_offset	= CKCTL_LCDDIV_OFFSET,
36452650505SPaul Walmsley 		.recalc		= &omap1_ckctl_recalc,
36552650505SPaul Walmsley 		.round_rate	= omap1_clk_round_rate_ckctl_arm,
36652650505SPaul Walmsley 		.set_rate	= omap1_clk_set_rate_ckctl_arm,
36752650505SPaul Walmsley 	},
36852650505SPaul Walmsley 	.idlect_shift	= 3,
36952650505SPaul Walmsley };
37052650505SPaul Walmsley 
37152650505SPaul Walmsley static struct clk uart1_1510 = {
37252650505SPaul Walmsley 	.name		= "uart1_ck",
37352650505SPaul Walmsley 	.ops		= &clkops_null,
37452650505SPaul Walmsley 	/* Direct from ULPD, no real parent */
37552650505SPaul Walmsley 	.parent		= &armper_ck.clk,
37652650505SPaul Walmsley 	.rate		= 12000000,
37752650505SPaul Walmsley 	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
37852650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
37952650505SPaul Walmsley 	.enable_bit	= 29,	/* Chooses between 12MHz and 48MHz */
38052650505SPaul Walmsley 	.set_rate	= &omap1_set_uart_rate,
38152650505SPaul Walmsley 	.recalc		= &omap1_uart_recalc,
38252650505SPaul Walmsley };
38352650505SPaul Walmsley 
38452650505SPaul Walmsley static struct uart_clk uart1_16xx = {
38552650505SPaul Walmsley 	.clk	= {
38652650505SPaul Walmsley 		.name		= "uart1_ck",
38752650505SPaul Walmsley 		.ops		= &clkops_uart,
38852650505SPaul Walmsley 		/* Direct from ULPD, no real parent */
38952650505SPaul Walmsley 		.parent		= &armper_ck.clk,
39052650505SPaul Walmsley 		.rate		= 48000000,
39152650505SPaul Walmsley 		.flags		= RATE_FIXED | ENABLE_REG_32BIT |
39252650505SPaul Walmsley 				  CLOCK_NO_IDLE_PARENT,
39352650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
39452650505SPaul Walmsley 		.enable_bit	= 29,
39552650505SPaul Walmsley 	},
39652650505SPaul Walmsley 	.sysc_addr	= 0xfffb0054,
39752650505SPaul Walmsley };
39852650505SPaul Walmsley 
39952650505SPaul Walmsley static struct clk uart2_ck = {
40052650505SPaul Walmsley 	.name		= "uart2_ck",
40152650505SPaul Walmsley 	.ops		= &clkops_null,
40252650505SPaul Walmsley 	/* Direct from ULPD, no real parent */
40352650505SPaul Walmsley 	.parent		= &armper_ck.clk,
40452650505SPaul Walmsley 	.rate		= 12000000,
40552650505SPaul Walmsley 	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
40652650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
40752650505SPaul Walmsley 	.enable_bit	= 30,	/* Chooses between 12MHz and 48MHz */
40852650505SPaul Walmsley 	.set_rate	= &omap1_set_uart_rate,
40952650505SPaul Walmsley 	.recalc		= &omap1_uart_recalc,
41052650505SPaul Walmsley };
41152650505SPaul Walmsley 
41252650505SPaul Walmsley static struct clk uart3_1510 = {
41352650505SPaul Walmsley 	.name		= "uart3_ck",
41452650505SPaul Walmsley 	.ops		= &clkops_null,
41552650505SPaul Walmsley 	/* Direct from ULPD, no real parent */
41652650505SPaul Walmsley 	.parent		= &armper_ck.clk,
41752650505SPaul Walmsley 	.rate		= 12000000,
41852650505SPaul Walmsley 	.flags		= ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
41952650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
42052650505SPaul Walmsley 	.enable_bit	= 31,	/* Chooses between 12MHz and 48MHz */
42152650505SPaul Walmsley 	.set_rate	= &omap1_set_uart_rate,
42252650505SPaul Walmsley 	.recalc		= &omap1_uart_recalc,
42352650505SPaul Walmsley };
42452650505SPaul Walmsley 
42552650505SPaul Walmsley static struct uart_clk uart3_16xx = {
42652650505SPaul Walmsley 	.clk	= {
42752650505SPaul Walmsley 		.name		= "uart3_ck",
42852650505SPaul Walmsley 		.ops		= &clkops_uart,
42952650505SPaul Walmsley 		/* Direct from ULPD, no real parent */
43052650505SPaul Walmsley 		.parent		= &armper_ck.clk,
43152650505SPaul Walmsley 		.rate		= 48000000,
43252650505SPaul Walmsley 		.flags		= RATE_FIXED | ENABLE_REG_32BIT |
43352650505SPaul Walmsley 				  CLOCK_NO_IDLE_PARENT,
43452650505SPaul Walmsley 		.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
43552650505SPaul Walmsley 		.enable_bit	= 31,
43652650505SPaul Walmsley 	},
43752650505SPaul Walmsley 	.sysc_addr	= 0xfffb9854,
43852650505SPaul Walmsley };
43952650505SPaul Walmsley 
44052650505SPaul Walmsley static struct clk usb_clko = {	/* 6 MHz output on W4_USB_CLKO */
44152650505SPaul Walmsley 	.name		= "usb_clko",
44252650505SPaul Walmsley 	.ops		= &clkops_generic,
44352650505SPaul Walmsley 	/* Direct from ULPD, no parent */
44452650505SPaul Walmsley 	.rate		= 6000000,
44552650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT,
44652650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(ULPD_CLOCK_CTRL),
44752650505SPaul Walmsley 	.enable_bit	= USB_MCLK_EN_BIT,
44852650505SPaul Walmsley };
44952650505SPaul Walmsley 
45052650505SPaul Walmsley static struct clk usb_hhc_ck1510 = {
45152650505SPaul Walmsley 	.name		= "usb_hhc_ck",
45252650505SPaul Walmsley 	.ops		= &clkops_generic,
45352650505SPaul Walmsley 	/* Direct from ULPD, no parent */
45452650505SPaul Walmsley 	.rate		= 48000000, /* Actually 2 clocks, 12MHz and 48MHz */
45552650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT,
45652650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
45752650505SPaul Walmsley 	.enable_bit	= USB_HOST_HHC_UHOST_EN,
45852650505SPaul Walmsley };
45952650505SPaul Walmsley 
46052650505SPaul Walmsley static struct clk usb_hhc_ck16xx = {
46152650505SPaul Walmsley 	.name		= "usb_hhc_ck",
46252650505SPaul Walmsley 	.ops		= &clkops_generic,
46352650505SPaul Walmsley 	/* Direct from ULPD, no parent */
46452650505SPaul Walmsley 	.rate		= 48000000,
46552650505SPaul Walmsley 	/* OTG_SYSCON_2.OTG_PADEN == 0 (not 1510-compatible) */
46652650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT,
46752650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(OTG_BASE + 0x08), /* OTG_SYSCON_2 */
46852650505SPaul Walmsley 	.enable_bit	= 8 /* UHOST_EN */,
46952650505SPaul Walmsley };
47052650505SPaul Walmsley 
47152650505SPaul Walmsley static struct clk usb_dc_ck = {
47252650505SPaul Walmsley 	.name		= "usb_dc_ck",
47352650505SPaul Walmsley 	.ops		= &clkops_generic,
47452650505SPaul Walmsley 	/* Direct from ULPD, no parent */
47552650505SPaul Walmsley 	.rate		= 48000000,
47652650505SPaul Walmsley 	.flags		= RATE_FIXED,
47752650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
47852650505SPaul Walmsley 	.enable_bit	= 4,
47952650505SPaul Walmsley };
48052650505SPaul Walmsley 
48152650505SPaul Walmsley static struct clk usb_dc_ck7xx = {
48252650505SPaul Walmsley 	.name		= "usb_dc_ck",
48352650505SPaul Walmsley 	.ops		= &clkops_generic,
48452650505SPaul Walmsley 	/* Direct from ULPD, no parent */
48552650505SPaul Walmsley 	.rate		= 48000000,
48652650505SPaul Walmsley 	.flags		= RATE_FIXED,
48752650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
48852650505SPaul Walmsley 	.enable_bit	= 8,
48952650505SPaul Walmsley };
49052650505SPaul Walmsley 
49152650505SPaul Walmsley static struct clk mclk_1510 = {
49252650505SPaul Walmsley 	.name		= "mclk",
49352650505SPaul Walmsley 	.ops		= &clkops_generic,
49452650505SPaul Walmsley 	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
49552650505SPaul Walmsley 	.rate		= 12000000,
49652650505SPaul Walmsley 	.flags		= RATE_FIXED,
49752650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
49852650505SPaul Walmsley 	.enable_bit	= 6,
49952650505SPaul Walmsley };
50052650505SPaul Walmsley 
50152650505SPaul Walmsley static struct clk mclk_16xx = {
50252650505SPaul Walmsley 	.name		= "mclk",
50352650505SPaul Walmsley 	.ops		= &clkops_generic,
50452650505SPaul Walmsley 	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
50552650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(COM_CLK_DIV_CTRL_SEL),
50652650505SPaul Walmsley 	.enable_bit	= COM_ULPD_PLL_CLK_REQ,
50752650505SPaul Walmsley 	.set_rate	= &omap1_set_ext_clk_rate,
50852650505SPaul Walmsley 	.round_rate	= &omap1_round_ext_clk_rate,
50952650505SPaul Walmsley 	.init		= &omap1_init_ext_clk,
51052650505SPaul Walmsley };
51152650505SPaul Walmsley 
51252650505SPaul Walmsley static struct clk bclk_1510 = {
51352650505SPaul Walmsley 	.name		= "bclk",
51452650505SPaul Walmsley 	.ops		= &clkops_generic,
51552650505SPaul Walmsley 	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
51652650505SPaul Walmsley 	.rate		= 12000000,
51752650505SPaul Walmsley 	.flags		= RATE_FIXED,
51852650505SPaul Walmsley };
51952650505SPaul Walmsley 
52052650505SPaul Walmsley static struct clk bclk_16xx = {
52152650505SPaul Walmsley 	.name		= "bclk",
52252650505SPaul Walmsley 	.ops		= &clkops_generic,
52352650505SPaul Walmsley 	/* Direct from ULPD, no parent. May be enabled by ext hardware. */
52452650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SWD_CLK_DIV_CTRL_SEL),
52552650505SPaul Walmsley 	.enable_bit	= SWD_ULPD_PLL_CLK_REQ,
52652650505SPaul Walmsley 	.set_rate	= &omap1_set_ext_clk_rate,
52752650505SPaul Walmsley 	.round_rate	= &omap1_round_ext_clk_rate,
52852650505SPaul Walmsley 	.init		= &omap1_init_ext_clk,
52952650505SPaul Walmsley };
53052650505SPaul Walmsley 
53152650505SPaul Walmsley static struct clk mmc1_ck = {
53252650505SPaul Walmsley 	.name		= "mmc_ck",
53352650505SPaul Walmsley 	.ops		= &clkops_generic,
53452650505SPaul Walmsley 	/* Functional clock is direct from ULPD, interface clock is ARMPER */
53552650505SPaul Walmsley 	.parent		= &armper_ck.clk,
53652650505SPaul Walmsley 	.rate		= 48000000,
53752650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
53852650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
53952650505SPaul Walmsley 	.enable_bit	= 23,
54052650505SPaul Walmsley };
54152650505SPaul Walmsley 
54252650505SPaul Walmsley static struct clk mmc2_ck = {
54352650505SPaul Walmsley 	.name		= "mmc_ck",
54452650505SPaul Walmsley 	.id		= 1,
54552650505SPaul Walmsley 	.ops		= &clkops_generic,
54652650505SPaul Walmsley 	/* Functional clock is direct from ULPD, interface clock is ARMPER */
54752650505SPaul Walmsley 	.parent		= &armper_ck.clk,
54852650505SPaul Walmsley 	.rate		= 48000000,
54952650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
55052650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(MOD_CONF_CTRL_0),
55152650505SPaul Walmsley 	.enable_bit	= 20,
55252650505SPaul Walmsley };
55352650505SPaul Walmsley 
55452650505SPaul Walmsley static struct clk mmc3_ck = {
55552650505SPaul Walmsley 	.name		= "mmc_ck",
55652650505SPaul Walmsley 	.id		= 2,
55752650505SPaul Walmsley 	.ops		= &clkops_generic,
55852650505SPaul Walmsley 	/* Functional clock is direct from ULPD, interface clock is ARMPER */
55952650505SPaul Walmsley 	.parent		= &armper_ck.clk,
56052650505SPaul Walmsley 	.rate		= 48000000,
56152650505SPaul Walmsley 	.flags		= RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
56252650505SPaul Walmsley 	.enable_reg	= OMAP1_IO_ADDRESS(SOFT_REQ_REG),
56352650505SPaul Walmsley 	.enable_bit	= 12,
56452650505SPaul Walmsley };
56552650505SPaul Walmsley 
56652650505SPaul Walmsley static struct clk virtual_ck_mpu = {
56752650505SPaul Walmsley 	.name		= "mpu",
56852650505SPaul Walmsley 	.ops		= &clkops_null,
56952650505SPaul Walmsley 	.parent		= &arm_ck, /* Is smarter alias for */
57052650505SPaul Walmsley 	.recalc		= &followparent_recalc,
57152650505SPaul Walmsley 	.set_rate	= &omap1_select_table_rate,
57252650505SPaul Walmsley 	.round_rate	= &omap1_round_to_table_rate,
57352650505SPaul Walmsley };
57452650505SPaul Walmsley 
57552650505SPaul Walmsley /* virtual functional clock domain for I2C. Just for making sure that ARMXOR_CK
57652650505SPaul Walmsley remains active during MPU idle whenever this is enabled */
57752650505SPaul Walmsley static struct clk i2c_fck = {
57852650505SPaul Walmsley 	.name		= "i2c_fck",
57952650505SPaul Walmsley 	.id		= 1,
58052650505SPaul Walmsley 	.ops		= &clkops_null,
58152650505SPaul Walmsley 	.flags		= CLOCK_NO_IDLE_PARENT,
58252650505SPaul Walmsley 	.parent		= &armxor_ck.clk,
58352650505SPaul Walmsley 	.recalc		= &followparent_recalc,
58452650505SPaul Walmsley };
58552650505SPaul Walmsley 
58652650505SPaul Walmsley static struct clk i2c_ick = {
58752650505SPaul Walmsley 	.name		= "i2c_ick",
58852650505SPaul Walmsley 	.id		= 1,
58952650505SPaul Walmsley 	.ops		= &clkops_null,
59052650505SPaul Walmsley 	.flags		= CLOCK_NO_IDLE_PARENT,
59152650505SPaul Walmsley 	.parent		= &armper_ck.clk,
59252650505SPaul Walmsley 	.recalc		= &followparent_recalc,
59352650505SPaul Walmsley };
59452650505SPaul Walmsley 
59552650505SPaul Walmsley /*
59652650505SPaul Walmsley  * clkdev integration
59752650505SPaul Walmsley  */
59852650505SPaul Walmsley 
59952650505SPaul Walmsley static struct omap_clk omap_clks[] = {
60052650505SPaul Walmsley 	/* non-ULPD clocks */
60152650505SPaul Walmsley 	CLK(NULL,	"ck_ref",	&ck_ref,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
60252650505SPaul Walmsley 	CLK(NULL,	"ck_dpll1",	&ck_dpll1,	CK_16XX | CK_1510 | CK_310),
60352650505SPaul Walmsley 	/* CK_GEN1 clocks */
60452650505SPaul Walmsley 	CLK(NULL,	"ck_dpll1out",	&ck_dpll1out.clk, CK_16XX),
60552650505SPaul Walmsley 	CLK(NULL,	"ck_sossi",	&sossi_ck,	CK_16XX),
60652650505SPaul Walmsley 	CLK(NULL,	"arm_ck",	&arm_ck,	CK_16XX | CK_1510 | CK_310),
60752650505SPaul Walmsley 	CLK(NULL,	"armper_ck",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310),
60852650505SPaul Walmsley 	CLK(NULL,	"arm_gpio_ck",	&arm_gpio_ck,	CK_1510 | CK_310),
60952650505SPaul Walmsley 	CLK(NULL,	"armxor_ck",	&armxor_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
61052650505SPaul Walmsley 	CLK(NULL,	"armtim_ck",	&armtim_ck.clk,	CK_16XX | CK_1510 | CK_310),
61152650505SPaul Walmsley 	CLK("omap_wdt",	"fck",		&armwdt_ck.clk,	CK_16XX | CK_1510 | CK_310),
61252650505SPaul Walmsley 	CLK("omap_wdt",	"ick",		&armper_ck.clk,	CK_16XX),
61352650505SPaul Walmsley 	CLK("omap_wdt", "ick",		&dummy_ck,	CK_1510 | CK_310),
61452650505SPaul Walmsley 	CLK(NULL,	"arminth_ck",	&arminth_ck1510, CK_1510 | CK_310),
61552650505SPaul Walmsley 	CLK(NULL,	"arminth_ck",	&arminth_ck16xx, CK_16XX),
61652650505SPaul Walmsley 	/* CK_GEN2 clocks */
61752650505SPaul Walmsley 	CLK(NULL,	"dsp_ck",	&dsp_ck,	CK_16XX | CK_1510 | CK_310),
61852650505SPaul Walmsley 	CLK(NULL,	"dspmmu_ck",	&dspmmu_ck,	CK_16XX | CK_1510 | CK_310),
61952650505SPaul Walmsley 	CLK(NULL,	"dspper_ck",	&dspper_ck,	CK_16XX | CK_1510 | CK_310),
62052650505SPaul Walmsley 	CLK(NULL,	"dspxor_ck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
62152650505SPaul Walmsley 	CLK(NULL,	"dsptim_ck",	&dsptim_ck,	CK_16XX | CK_1510 | CK_310),
62252650505SPaul Walmsley 	/* CK_GEN3 clocks */
62352650505SPaul Walmsley 	CLK(NULL,	"tc_ck",	&tc_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
62452650505SPaul Walmsley 	CLK(NULL,	"tipb_ck",	&tipb_ck,	CK_1510 | CK_310),
62552650505SPaul Walmsley 	CLK(NULL,	"l3_ocpi_ck",	&l3_ocpi_ck,	CK_16XX | CK_7XX),
62652650505SPaul Walmsley 	CLK(NULL,	"tc1_ck",	&tc1_ck,	CK_16XX),
62752650505SPaul Walmsley 	CLK(NULL,	"tc2_ck",	&tc2_ck,	CK_16XX),
62852650505SPaul Walmsley 	CLK(NULL,	"dma_ck",	&dma_ck,	CK_16XX | CK_1510 | CK_310),
62952650505SPaul Walmsley 	CLK(NULL,	"dma_lcdfree_ck", &dma_lcdfree_ck, CK_16XX),
63052650505SPaul Walmsley 	CLK(NULL,	"api_ck",	&api_ck.clk,	CK_16XX | CK_1510 | CK_310),
63152650505SPaul Walmsley 	CLK(NULL,	"lb_ck",	&lb_ck.clk,	CK_1510 | CK_310),
63252650505SPaul Walmsley 	CLK(NULL,	"rhea1_ck",	&rhea1_ck,	CK_16XX),
63352650505SPaul Walmsley 	CLK(NULL,	"rhea2_ck",	&rhea2_ck,	CK_16XX),
63452650505SPaul Walmsley 	CLK(NULL,	"lcd_ck",	&lcd_ck_16xx,	CK_16XX | CK_7XX),
63552650505SPaul Walmsley 	CLK(NULL,	"lcd_ck",	&lcd_ck_1510.clk, CK_1510 | CK_310),
63652650505SPaul Walmsley 	/* ULPD clocks */
63752650505SPaul Walmsley 	CLK(NULL,	"uart1_ck",	&uart1_1510,	CK_1510 | CK_310),
63852650505SPaul Walmsley 	CLK(NULL,	"uart1_ck",	&uart1_16xx.clk, CK_16XX),
63952650505SPaul Walmsley 	CLK(NULL,	"uart2_ck",	&uart2_ck,	CK_16XX | CK_1510 | CK_310),
64052650505SPaul Walmsley 	CLK(NULL,	"uart3_ck",	&uart3_1510,	CK_1510 | CK_310),
64152650505SPaul Walmsley 	CLK(NULL,	"uart3_ck",	&uart3_16xx.clk, CK_16XX),
64252650505SPaul Walmsley 	CLK(NULL,	"usb_clko",	&usb_clko,	CK_16XX | CK_1510 | CK_310),
64352650505SPaul Walmsley 	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck1510, CK_1510 | CK_310),
64452650505SPaul Walmsley 	CLK(NULL,	"usb_hhc_ck",	&usb_hhc_ck16xx, CK_16XX),
64552650505SPaul Walmsley 	CLK(NULL,	"usb_dc_ck",	&usb_dc_ck,	CK_16XX),
64652650505SPaul Walmsley 	CLK(NULL,	"usb_dc_ck",	&usb_dc_ck7xx,	CK_7XX),
64752650505SPaul Walmsley 	CLK(NULL,	"mclk",		&mclk_1510,	CK_1510 | CK_310),
64852650505SPaul Walmsley 	CLK(NULL,	"mclk",		&mclk_16xx,	CK_16XX),
64952650505SPaul Walmsley 	CLK(NULL,	"bclk",		&bclk_1510,	CK_1510 | CK_310),
65052650505SPaul Walmsley 	CLK(NULL,	"bclk",		&bclk_16xx,	CK_16XX),
65152650505SPaul Walmsley 	CLK("mmci-omap.0", "fck",	&mmc1_ck,	CK_16XX | CK_1510 | CK_310),
65252650505SPaul Walmsley 	CLK("mmci-omap.0", "fck",	&mmc3_ck,	CK_7XX),
65352650505SPaul Walmsley 	CLK("mmci-omap.0", "ick",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
65452650505SPaul Walmsley 	CLK("mmci-omap.1", "fck",	&mmc2_ck,	CK_16XX),
65552650505SPaul Walmsley 	CLK("mmci-omap.1", "ick",	&armper_ck.clk,	CK_16XX),
65652650505SPaul Walmsley 	/* Virtual clocks */
65752650505SPaul Walmsley 	CLK(NULL,	"mpu",		&virtual_ck_mpu, CK_16XX | CK_1510 | CK_310),
658*bf92a407SCory Maccarrone 	CLK("i2c_omap.1", "fck",	&i2c_fck,	CK_16XX | CK_1510 | CK_310 | CK_7XX),
65952650505SPaul Walmsley 	CLK("i2c_omap.1", "ick",	&i2c_ick,	CK_16XX),
660*bf92a407SCory Maccarrone 	CLK("i2c_omap.1", "ick",	&dummy_ck,	CK_1510 | CK_310 | CK_7XX),
66152650505SPaul Walmsley 	CLK("omap_uwire", "fck",	&armxor_ck.clk,	CK_16XX | CK_1510 | CK_310),
66252650505SPaul Walmsley 	CLK("omap-mcbsp.1", "ick",	&dspper_ck,	CK_16XX),
66352650505SPaul Walmsley 	CLK("omap-mcbsp.1", "ick",	&dummy_ck,	CK_1510 | CK_310),
66452650505SPaul Walmsley 	CLK("omap-mcbsp.2", "ick",	&armper_ck.clk,	CK_16XX),
66552650505SPaul Walmsley 	CLK("omap-mcbsp.2", "ick",	&dummy_ck,	CK_1510 | CK_310),
66652650505SPaul Walmsley 	CLK("omap-mcbsp.3", "ick",	&dspper_ck,	CK_16XX),
66752650505SPaul Walmsley 	CLK("omap-mcbsp.3", "ick",	&dummy_ck,	CK_1510 | CK_310),
66852650505SPaul Walmsley 	CLK("omap-mcbsp.1", "fck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
66952650505SPaul Walmsley 	CLK("omap-mcbsp.2", "fck",	&armper_ck.clk,	CK_16XX | CK_1510 | CK_310),
67052650505SPaul Walmsley 	CLK("omap-mcbsp.3", "fck",	&dspxor_ck,	CK_16XX | CK_1510 | CK_310),
67152650505SPaul Walmsley };
67252650505SPaul Walmsley 
67352650505SPaul Walmsley /*
67452650505SPaul Walmsley  * init
67552650505SPaul Walmsley  */
67652650505SPaul Walmsley 
67752650505SPaul Walmsley static struct clk_functions omap1_clk_functions __initdata = {
67852650505SPaul Walmsley 	.clk_enable		= omap1_clk_enable,
67952650505SPaul Walmsley 	.clk_disable		= omap1_clk_disable,
68052650505SPaul Walmsley 	.clk_round_rate		= omap1_clk_round_rate,
68152650505SPaul Walmsley 	.clk_set_rate		= omap1_clk_set_rate,
68252650505SPaul Walmsley 	.clk_disable_unused	= omap1_clk_disable_unused,
68352650505SPaul Walmsley };
68452650505SPaul Walmsley 
68552650505SPaul Walmsley int __init omap1_clk_init(void)
68652650505SPaul Walmsley {
68752650505SPaul Walmsley 	struct omap_clk *c;
68852650505SPaul Walmsley 	const struct omap_clock_config *info;
68952650505SPaul Walmsley 	int crystal_type = 0; /* Default 12 MHz */
69052650505SPaul Walmsley 	u32 reg, cpu_mask;
69152650505SPaul Walmsley 
69252650505SPaul Walmsley #ifdef CONFIG_DEBUG_LL
69352650505SPaul Walmsley 	/*
69452650505SPaul Walmsley 	 * Resets some clocks that may be left on from bootloader,
69552650505SPaul Walmsley 	 * but leaves serial clocks on.
69652650505SPaul Walmsley 	 */
69752650505SPaul Walmsley 	omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
69852650505SPaul Walmsley #endif
69952650505SPaul Walmsley 
70052650505SPaul Walmsley 	/* USB_REQ_EN will be disabled later if necessary (usb_dc_ck) */
70152650505SPaul Walmsley 	reg = omap_readw(SOFT_REQ_REG) & (1 << 4);
70252650505SPaul Walmsley 	omap_writew(reg, SOFT_REQ_REG);
70352650505SPaul Walmsley 	if (!cpu_is_omap15xx())
70452650505SPaul Walmsley 		omap_writew(0, SOFT_REQ_REG2);
70552650505SPaul Walmsley 
70652650505SPaul Walmsley 	clk_init(&omap1_clk_functions);
70752650505SPaul Walmsley 
70852650505SPaul Walmsley 	/* By default all idlect1 clocks are allowed to idle */
70952650505SPaul Walmsley 	arm_idlect1_mask = ~0;
71052650505SPaul Walmsley 
71152650505SPaul Walmsley 	for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
71252650505SPaul Walmsley 		clk_preinit(c->lk.clk);
71352650505SPaul Walmsley 
71452650505SPaul Walmsley 	cpu_mask = 0;
71552650505SPaul Walmsley 	if (cpu_is_omap16xx())
71652650505SPaul Walmsley 		cpu_mask |= CK_16XX;
71752650505SPaul Walmsley 	if (cpu_is_omap1510())
71852650505SPaul Walmsley 		cpu_mask |= CK_1510;
71952650505SPaul Walmsley 	if (cpu_is_omap7xx())
72052650505SPaul Walmsley 		cpu_mask |= CK_7XX;
72152650505SPaul Walmsley 	if (cpu_is_omap310())
72252650505SPaul Walmsley 		cpu_mask |= CK_310;
72352650505SPaul Walmsley 
72452650505SPaul Walmsley 	for (c = omap_clks; c < omap_clks + ARRAY_SIZE(omap_clks); c++)
72552650505SPaul Walmsley 		if (c->cpu & cpu_mask) {
72652650505SPaul Walmsley 			clkdev_add(&c->lk);
72752650505SPaul Walmsley 			clk_register(c->lk.clk);
72852650505SPaul Walmsley 		}
72952650505SPaul Walmsley 
73052650505SPaul Walmsley 	/* Pointers to these clocks are needed by code in clock.c */
73152650505SPaul Walmsley 	api_ck_p = clk_get(NULL, "api_ck");
73252650505SPaul Walmsley 	ck_dpll1_p = clk_get(NULL, "ck_dpll1");
73352650505SPaul Walmsley 	ck_ref_p = clk_get(NULL, "ck_ref");
73452650505SPaul Walmsley 
73552650505SPaul Walmsley 	info = omap_get_config(OMAP_TAG_CLOCK, struct omap_clock_config);
73652650505SPaul Walmsley 	if (info != NULL) {
73752650505SPaul Walmsley 		if (!cpu_is_omap15xx())
73852650505SPaul Walmsley 			crystal_type = info->system_clock_type;
73952650505SPaul Walmsley 	}
74052650505SPaul Walmsley 
74152650505SPaul Walmsley #if defined(CONFIG_ARCH_OMAP730) || defined(CONFIG_ARCH_OMAP850)
74252650505SPaul Walmsley 	ck_ref.rate = 13000000;
74352650505SPaul Walmsley #elif defined(CONFIG_ARCH_OMAP16XX)
74452650505SPaul Walmsley 	if (crystal_type == 2)
74552650505SPaul Walmsley 		ck_ref.rate = 19200000;
74652650505SPaul Walmsley #endif
74752650505SPaul Walmsley 
74852650505SPaul Walmsley 	pr_info("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: "
74952650505SPaul Walmsley 		"0x%04x\n", omap_readw(ARM_SYSST), omap_readw(DPLL_CTL),
75052650505SPaul Walmsley 		omap_readw(ARM_CKCTL));
75152650505SPaul Walmsley 
75252650505SPaul Walmsley 	/* We want to be in syncronous scalable mode */
75352650505SPaul Walmsley 	omap_writew(0x1000, ARM_SYSST);
75452650505SPaul Walmsley 
75552650505SPaul Walmsley #ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
75652650505SPaul Walmsley 	/* Use values set by bootloader. Determine PLL rate and recalculate
75752650505SPaul Walmsley 	 * dependent clocks as if kernel had changed PLL or divisors.
75852650505SPaul Walmsley 	 */
75952650505SPaul Walmsley 	{
76052650505SPaul Walmsley 		unsigned pll_ctl_val = omap_readw(DPLL_CTL);
76152650505SPaul Walmsley 
76252650505SPaul Walmsley 		ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
76352650505SPaul Walmsley 		if (pll_ctl_val & 0x10) {
76452650505SPaul Walmsley 			/* PLL enabled, apply multiplier and divisor */
76552650505SPaul Walmsley 			if (pll_ctl_val & 0xf80)
76652650505SPaul Walmsley 				ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
76752650505SPaul Walmsley 			ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
76852650505SPaul Walmsley 		} else {
76952650505SPaul Walmsley 			/* PLL disabled, apply bypass divisor */
77052650505SPaul Walmsley 			switch (pll_ctl_val & 0xc) {
77152650505SPaul Walmsley 			case 0:
77252650505SPaul Walmsley 				break;
77352650505SPaul Walmsley 			case 0x4:
77452650505SPaul Walmsley 				ck_dpll1.rate /= 2;
77552650505SPaul Walmsley 				break;
77652650505SPaul Walmsley 			default:
77752650505SPaul Walmsley 				ck_dpll1.rate /= 4;
77852650505SPaul Walmsley 				break;
77952650505SPaul Walmsley 			}
78052650505SPaul Walmsley 		}
78152650505SPaul Walmsley 	}
78252650505SPaul Walmsley #else
78352650505SPaul Walmsley 	/* Find the highest supported frequency and enable it */
78452650505SPaul Walmsley 	if (omap1_select_table_rate(&virtual_ck_mpu, ~0)) {
78552650505SPaul Walmsley 		printk(KERN_ERR "System frequencies not set. Check your config.\n");
78652650505SPaul Walmsley 		/* Guess sane values (60MHz) */
78752650505SPaul Walmsley 		omap_writew(0x2290, DPLL_CTL);
78852650505SPaul Walmsley 		omap_writew(cpu_is_omap7xx() ? 0x3005 : 0x1005, ARM_CKCTL);
78952650505SPaul Walmsley 		ck_dpll1.rate = 60000000;
79052650505SPaul Walmsley 	}
79152650505SPaul Walmsley #endif
79252650505SPaul Walmsley 	propagate_rate(&ck_dpll1);
79352650505SPaul Walmsley 	/* Cache rates for clocks connected to ck_ref (not dpll1) */
79452650505SPaul Walmsley 	propagate_rate(&ck_ref);
79552650505SPaul Walmsley 	printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): "
79652650505SPaul Walmsley 		"%ld.%01ld/%ld.%01ld/%ld.%01ld MHz\n",
79752650505SPaul Walmsley 	       ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
79852650505SPaul Walmsley 	       ck_dpll1.rate / 1000000, (ck_dpll1.rate / 100000) % 10,
79952650505SPaul Walmsley 	       arm_ck.rate / 1000000, (arm_ck.rate / 100000) % 10);
80052650505SPaul Walmsley 
80152650505SPaul Walmsley #if defined(CONFIG_MACH_OMAP_PERSEUS2) || defined(CONFIG_MACH_OMAP_FSAMPLE)
80252650505SPaul Walmsley 	/* Select slicer output as OMAP input clock */
80352650505SPaul Walmsley 	omap_writew(omap_readw(OMAP7XX_PCC_UPLD_CTRL) & ~0x1, OMAP7XX_PCC_UPLD_CTRL);
80452650505SPaul Walmsley #endif
80552650505SPaul Walmsley 
80652650505SPaul Walmsley 	/* Amstrad Delta wants BCLK high when inactive */
80752650505SPaul Walmsley 	if (machine_is_ams_delta())
80852650505SPaul Walmsley 		omap_writel(omap_readl(ULPD_CLOCK_CTRL) |
80952650505SPaul Walmsley 				(1 << SDW_MCLK_INV_BIT),
81052650505SPaul Walmsley 				ULPD_CLOCK_CTRL);
81152650505SPaul Walmsley 
81252650505SPaul Walmsley 	/* Turn off DSP and ARM_TIMXO. Make sure ARM_INTHCK is not divided */
81352650505SPaul Walmsley 	/* (on 730, bit 13 must not be cleared) */
81452650505SPaul Walmsley 	if (cpu_is_omap7xx())
81552650505SPaul Walmsley 		omap_writew(omap_readw(ARM_CKCTL) & 0x2fff, ARM_CKCTL);
81652650505SPaul Walmsley 	else
81752650505SPaul Walmsley 		omap_writew(omap_readw(ARM_CKCTL) & 0x0fff, ARM_CKCTL);
81852650505SPaul Walmsley 
81952650505SPaul Walmsley 	/* Put DSP/MPUI into reset until needed */
82052650505SPaul Walmsley 	omap_writew(0, ARM_RSTCT1);
82152650505SPaul Walmsley 	omap_writew(1, ARM_RSTCT2);
82252650505SPaul Walmsley 	omap_writew(0x400, ARM_IDLECT1);
82352650505SPaul Walmsley 
82452650505SPaul Walmsley 	/*
82552650505SPaul Walmsley 	 * According to OMAP5910 Erratum SYS_DMA_1, bit DMACK_REQ (bit 8)
82652650505SPaul Walmsley 	 * of the ARM_IDLECT2 register must be set to zero. The power-on
82752650505SPaul Walmsley 	 * default value of this bit is one.
82852650505SPaul Walmsley 	 */
82952650505SPaul Walmsley 	omap_writew(0x0000, ARM_IDLECT2);	/* Turn LCD clock off also */
83052650505SPaul Walmsley 
83152650505SPaul Walmsley 	/*
83252650505SPaul Walmsley 	 * Only enable those clocks we will need, let the drivers
83352650505SPaul Walmsley 	 * enable other clocks as necessary
83452650505SPaul Walmsley 	 */
83552650505SPaul Walmsley 	clk_enable(&armper_ck.clk);
83652650505SPaul Walmsley 	clk_enable(&armxor_ck.clk);
83752650505SPaul Walmsley 	clk_enable(&armtim_ck.clk); /* This should be done by timer code */
83852650505SPaul Walmsley 
83952650505SPaul Walmsley 	if (cpu_is_omap15xx())
84052650505SPaul Walmsley 		clk_enable(&arm_gpio_ck);
84152650505SPaul Walmsley 
84252650505SPaul Walmsley 	return 0;
84352650505SPaul Walmsley }
844