aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-11-30 11:40:31 -0500
committerTony Lindgren <tony@atomide.com>2012-11-30 11:40:31 -0500
commit2589d056122f6dcb405d411eae872aac8cf9da1b (patch)
tree8b2fb3a9f8205c110842c59ed42987a6f2b17e1a /arch/arm
parent42a1cc9c0ec2a00b53b4f02849dc4377b09b3b05 (diff)
parent8b9c1ac2e11a9fb3a5a8860fb7570ff7633aa7f7 (diff)
Merge tag 'tags/omap-for-v3.8/devel-prcm-signed' into omap-for-v3.8/cleanup-headers-prepare-multiplatform-v3
omap prcm changes via Paul Walmsley <paul@pwsan.com>: Some miscellaneous OMAP hwmod changes for 3.8, along with a PRM change needed for one of the hwmod patches to function. Basic test logs for this branch on top of Tony's omap-for-v3.8/clock branch at commit 558a0780b0a04862a678f7823215424b4e5501f9 are here: http://www.pwsan.com/omap/testlogs/hwmod_devel_a_3.8/20121121161522/ However, omap-for-v3.8/clock at 558a0780 does not include some fixes that are needed for a successful test. With several reverts, fixes, and workarounds applied, the following test logs were obtained: http://www.pwsan.com/omap/testlogs/TEST_hwmod_devel_a_3.8/20121121162719/ which indicate that the series tests cleanly. Conflicts: arch/arm/mach-omap2/cm33xx.c arch/arm/mach-omap2/io.c arch/arm/mach-omap2/prm_common.c
Diffstat (limited to 'arch/arm')
-rw-r--r--arch/arm/mach-omap1/common.h2
-rw-r--r--arch/arm/mach-omap1/devices.c21
-rw-r--r--arch/arm/mach-omap1/reset.c41
-rw-r--r--arch/arm/mach-omap2/Kconfig5
-rw-r--r--arch/arm/mach-omap2/Makefile121
-rw-r--r--arch/arm/mach-omap2/am33xx.h1
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c2
-rw-r--r--arch/arm/mach-omap2/board-am3517crane.c2
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c2
-rw-r--r--arch/arm/mach-omap2/board-apollon.c2
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c18
-rw-r--r--arch/arm/mach-omap2/board-cm-t3517.c2
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c2
-rw-r--r--arch/arm/mach-omap2/board-generic.c10
-rw-r--r--arch/arm/mach-omap2/board-h4.c2
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c4
-rw-r--r--arch/arm/mach-omap2/board-ldp.c2
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c6
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3logic.c4
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3stalker.c2
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c2
-rw-r--r--arch/arm/mach-omap2/board-omap4panda.c2
-rw-r--r--arch/arm/mach-omap2/board-overo.c2
-rw-r--r--arch/arm/mach-omap2/board-rm680.c4
-rw-r--r--arch/arm/mach-omap2/board-rx51.c2
-rw-r--r--arch/arm/mach-omap2/board-ti8168evm.c4
-rw-r--r--arch/arm/mach-omap2/board-zoom.c4
-rw-r--r--arch/arm/mach-omap2/cclock2420_data.c1950
-rw-r--r--arch/arm/mach-omap2/cclock2430_data.c2065
-rw-r--r--arch/arm/mach-omap2/cclock33xx_data.c961
-rw-r--r--arch/arm/mach-omap2/cclock3xxx_data.c3595
-rw-r--r--arch/arm/mach-omap2/cclock44xx_data.c1987
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_apll.c91
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpll.c10
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c43
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_osc.c13
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_sys.c7
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c79
-rw-r--r--arch/arm/mach-omap2/clkt34xx_dpll3m2.c8
-rw-r--r--arch/arm/mach-omap2/clkt_clksel.c194
-rw-r--r--arch/arm/mach-omap2/clkt_dpll.c28
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c31
-rw-r--r--arch/arm/mach-omap2/clock.c968
-rw-r--r--arch/arm/mach-omap2/clock.h357
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c1986
-rw-r--r--arch/arm/mach-omap2/clock2430.c10
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c2085
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c17
-rw-r--r--arch/arm/mach-omap2/clock2xxx.h48
-rw-r--r--arch/arm/mach-omap2/clock33xx_data.c1109
-rw-r--r--arch/arm/mach-omap2/clock34xx.c53
-rw-r--r--arch/arm/mach-omap2/clock3517.c26
-rw-r--r--arch/arm/mach-omap2/clock36xx.c22
-rw-r--r--arch/arm/mach-omap2/clock36xx.h2
-rw-r--r--arch/arm/mach-omap2/clock3xxx.c6
-rw-r--r--arch/arm/mach-omap2/clock3xxx.h6
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c3613
-rw-r--r--arch/arm/mach-omap2/clock44xx_data.c3398
-rw-r--r--arch/arm/mach-omap2/clock_common_data.c22
-rw-r--r--arch/arm/mach-omap2/clockdomain.c89
-rw-r--r--arch/arm/mach-omap2/clockdomain2xxx_3xxx.c341
-rw-r--r--arch/arm/mach-omap2/clockdomain33xx.c74
-rw-r--r--arch/arm/mach-omap2/clockdomain44xx.c151
-rw-r--r--arch/arm/mach-omap2/cm-regbits-24xx.h7
-rw-r--r--arch/arm/mach-omap2/cm-regbits-34xx.h31
-rw-r--r--arch/arm/mach-omap2/cm.h30
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c381
-rw-r--r--arch/arm/mach-omap2/cm2xxx.h70
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.h126
-rw-r--r--arch/arm/mach-omap2/cm33xx.c56
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c (renamed from arch/arm/mach-omap2/cm2xxx_3xxx.c)371
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h91
-rw-r--r--arch/arm/mach-omap2/cm_common.c139
-rw-r--r--arch/arm/mach-omap2/cminst44xx.c142
-rw-r--r--arch/arm/mach-omap2/cminst44xx.h2
-rw-r--r--arch/arm/mach-omap2/common.c183
-rw-r--r--arch/arm/mach-omap2/common.h133
-rw-r--r--arch/arm/mach-omap2/control.c14
-rw-r--r--arch/arm/mach-omap2/control.h3
-rw-r--r--arch/arm/mach-omap2/cpuidle34xx.c1
-rw-r--r--arch/arm/mach-omap2/devices.c26
-rw-r--r--arch/arm/mach-omap2/display.c2
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c183
-rw-r--r--arch/arm/mach-omap2/dpll44xx.c21
-rw-r--r--arch/arm/mach-omap2/hdq1w.c4
-rw-r--r--arch/arm/mach-omap2/i2c.c6
-rw-r--r--arch/arm/mach-omap2/id.c7
-rw-r--r--arch/arm/mach-omap2/io.c101
-rw-r--r--arch/arm/mach-omap2/mcbsp.c2
-rw-r--r--arch/arm/mach-omap2/msdi.c4
-rw-r--r--arch/arm/mach-omap2/omap2-restart.c65
-rw-r--r--arch/arm/mach-omap2/omap3-restart.c36
-rw-r--r--arch/arm/mach-omap2/omap4-common.c19
-rw-r--r--arch/arm/mach-omap2/omap_device.c87
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.c204
-rw-r--r--arch/arm/mach-omap2/omap_hwmod.h12
-rw-r--r--arch/arm/mach-omap2/omap_opp_data.h9
-rw-r--r--arch/arm/mach-omap2/omap_twl.c73
-rw-r--r--arch/arm/mach-omap2/opp4xxx_data.c98
-rw-r--r--arch/arm/mach-omap2/pm.c30
-rw-r--r--arch/arm/mach-omap2/pm.h10
-rw-r--r--arch/arm/mach-omap2/pm24xx.c8
-rw-r--r--arch/arm/mach-omap2/pm34xx.c6
-rw-r--r--arch/arm/mach-omap2/powerdomain.c2
-rw-r--r--arch/arm/mach-omap2/powerdomain2xxx_3xxx.c242
-rw-r--r--arch/arm/mach-omap2/powerdomain33xx.c229
-rw-r--r--arch/arm/mach-omap2/powerdomain44xx.c285
-rw-r--r--arch/arm/mach-omap2/prcm-common.h22
-rw-r--r--arch/arm/mach-omap2/prcm.c189
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.c17
-rw-r--r--arch/arm/mach-omap2/prcm_mpu44xx.h9
-rw-r--r--arch/arm/mach-omap2/prm-regbits-24xx.h8
-rw-r--r--arch/arm/mach-omap2/prm-regbits-34xx.h13
-rw-r--r--arch/arm/mach-omap2/prm.h86
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c138
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h133
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.c332
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h285
-rw-r--r--arch/arm/mach-omap2/prm33xx.c202
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c420
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h163
-rw-r--r--arch/arm/mach-omap2/prm44xx.c391
-rw-r--r--arch/arm/mach-omap2/prm44xx.h3
-rw-r--r--arch/arm/mach-omap2/prm_common.c154
-rw-r--r--arch/arm/mach-omap2/prminst44xx.h2
-rw-r--r--arch/arm/mach-omap2/scrm44xx.h2
-rw-r--r--arch/arm/mach-omap2/sdrc.c8
-rw-r--r--arch/arm/mach-omap2/sdrc.h2
-rw-r--r--arch/arm/mach-omap2/sdrc2xxx.c2
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S4
-rw-r--r--arch/arm/mach-omap2/sr_device.c13
-rw-r--r--arch/arm/mach-omap2/sram242x.S4
-rw-r--r--arch/arm/mach-omap2/sram243x.S4
-rw-r--r--arch/arm/mach-omap2/sram34xx.S2
-rw-r--r--arch/arm/mach-omap2/ti81xx.h9
-rw-r--r--arch/arm/mach-omap2/vc.c451
-rw-r--r--arch/arm/mach-omap2/vc.h8
-rw-r--r--arch/arm/mach-omap2/vc3xxx_data.c22
-rw-r--r--arch/arm/mach-omap2/vc44xx_data.c28
-rw-r--r--arch/arm/mach-omap2/voltage.h44
-rw-r--r--arch/arm/mach-omap2/voltagedomains3xxx_data.c5
-rw-r--r--arch/arm/mach-omap2/voltagedomains44xx_data.c25
-rw-r--r--arch/arm/mach-omap2/vp.c19
-rw-r--r--arch/arm/mach-omap2/vp.h7
-rw-r--r--arch/arm/mach-omap2/vp3xxx_data.c10
-rw-r--r--arch/arm/mach-omap2/vp44xx_data.c15
-rw-r--r--arch/arm/mach-omap2/wd_timer.c40
-rw-r--r--arch/arm/plat-omap/include/plat/prcm.h37
154 files changed, 16092 insertions, 16515 deletions
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index fc8c9449eba8..b53e0854422f 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -93,4 +93,6 @@ extern int ocpi_enable(void);
93static inline int ocpi_enable(void) { return 0; } 93static inline int ocpi_enable(void) { return 0; }
94#endif 94#endif
95 95
96extern u32 omap1_get_reset_sources(void);
97
96#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ 98#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 7155ed8b97f8..0af635205e8a 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -17,6 +17,8 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/spi/spi.h> 18#include <linux/spi/spi.h>
19 19
20#include <linux/platform_data/omap-wd-timer.h>
21
20#include <asm/mach/map.h> 22#include <asm/mach/map.h>
21 23
22#include <mach/tc.h> 24#include <mach/tc.h>
@@ -447,18 +449,31 @@ static struct resource wdt_resources[] = {
447}; 449};
448 450
449static struct platform_device omap_wdt_device = { 451static struct platform_device omap_wdt_device = {
450 .name = "omap_wdt", 452 .name = "omap_wdt",
451 .id = -1, 453 .id = -1,
452 .num_resources = ARRAY_SIZE(wdt_resources), 454 .num_resources = ARRAY_SIZE(wdt_resources),
453 .resource = wdt_resources, 455 .resource = wdt_resources,
454}; 456};
455 457
456static int __init omap_init_wdt(void) 458static int __init omap_init_wdt(void)
457{ 459{
460 struct omap_wd_timer_platform_data pdata;
461 int ret;
462
458 if (!cpu_is_omap16xx()) 463 if (!cpu_is_omap16xx())
459 return -ENODEV; 464 return -ENODEV;
460 465
461 return platform_device_register(&omap_wdt_device); 466 pdata.read_reset_sources = omap1_get_reset_sources;
467
468 ret = platform_device_register(&omap_wdt_device);
469 if (!ret) {
470 ret = platform_device_add_data(&omap_wdt_device, &pdata,
471 sizeof(pdata));
472 if (ret)
473 platform_device_del(&omap_wdt_device);
474 }
475
476 return ret;
462} 477}
463subsys_initcall(omap_init_wdt); 478subsys_initcall(omap_init_wdt);
464#endif 479#endif
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index b17709103866..5eebd7e889d0 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -4,12 +4,24 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/io.h> 5#include <linux/io.h>
6 6
7#include <plat/prcm.h>
8
9#include <mach/hardware.h> 7#include <mach/hardware.h>
10 8
9#include "iomap.h"
11#include "common.h" 10#include "common.h"
12 11
12/* ARM_SYSST bit shifts related to SoC reset sources */
13#define ARM_SYSST_POR_SHIFT 5
14#define ARM_SYSST_EXT_RST_SHIFT 4
15#define ARM_SYSST_ARM_WDRST_SHIFT 2
16#define ARM_SYSST_GLOB_SWRST_SHIFT 1
17
18/* Standardized reset source bits (across all OMAP SoCs) */
19#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
20#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
21#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
22#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
23
24
13void omap1_restart(char mode, const char *cmd) 25void omap1_restart(char mode, const char *cmd)
14{ 26{
15 /* 27 /*
@@ -23,3 +35,28 @@ void omap1_restart(char mode, const char *cmd)
23 35
24 omap_writew(1, ARM_RSTCT1); 36 omap_writew(1, ARM_RSTCT1);
25} 37}
38
39/**
40 * omap1_get_reset_sources - return the source of the SoC's last reset
41 *
42 * Returns bits that represent the last reset source for the SoC. The
43 * format is standardized across OMAPs for use by the OMAP watchdog.
44 */
45u32 omap1_get_reset_sources(void)
46{
47 u32 ret = 0;
48 u16 rs;
49
50 rs = __raw_readw(OMAP1_IO_ADDRESS(ARM_SYSST));
51
52 if (rs & (1 << ARM_SYSST_POR_SHIFT))
53 ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT;
54 if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT))
55 ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT;
56 if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT))
57 ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT;
58 if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT))
59 ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT;
60
61 return ret;
62}
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index d669e227e00c..c81bc508e7a3 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -34,6 +34,7 @@ config ARCH_OMAP2
34 select CPU_V6 34 select CPU_V6
35 select MULTI_IRQ_HANDLER 35 select MULTI_IRQ_HANDLER
36 select SOC_HAS_OMAP2_SDRC 36 select SOC_HAS_OMAP2_SDRC
37 select COMMON_CLK
37 38
38config ARCH_OMAP3 39config ARCH_OMAP3
39 bool "TI OMAP3" 40 bool "TI OMAP3"
@@ -47,6 +48,7 @@ config ARCH_OMAP3
47 select PM_OPP if PM 48 select PM_OPP if PM
48 select PM_RUNTIME if CPU_IDLE 49 select PM_RUNTIME if CPU_IDLE
49 select SOC_HAS_OMAP2_SDRC 50 select SOC_HAS_OMAP2_SDRC
51 select COMMON_CLK
50 select USB_ARCH_HAS_EHCI if USB_SUPPORT 52 select USB_ARCH_HAS_EHCI if USB_SUPPORT
51 53
52config ARCH_OMAP4 54config ARCH_OMAP4
@@ -68,6 +70,7 @@ config ARCH_OMAP4
68 select PM_OPP if PM 70 select PM_OPP if PM
69 select PM_RUNTIME if CPU_IDLE 71 select PM_RUNTIME if CPU_IDLE
70 select USB_ARCH_HAS_EHCI if USB_SUPPORT 72 select USB_ARCH_HAS_EHCI if USB_SUPPORT
73 select COMMON_CLK
71 74
72config SOC_OMAP5 75config SOC_OMAP5
73 bool "TI OMAP5" 76 bool "TI OMAP5"
@@ -77,6 +80,7 @@ config SOC_OMAP5
77 select CPU_V7 80 select CPU_V7
78 select HAVE_SMP 81 select HAVE_SMP
79 select SOC_HAS_REALTIME_COUNTER 82 select SOC_HAS_REALTIME_COUNTER
83 select COMMON_CLK
80 84
81comment "OMAP Core Type" 85comment "OMAP Core Type"
82 depends on ARCH_OMAP2 86 depends on ARCH_OMAP2
@@ -111,6 +115,7 @@ config SOC_AM33XX
111 select ARM_CPU_SUSPEND if PM 115 select ARM_CPU_SUSPEND if PM
112 select CPU_V7 116 select CPU_V7
113 select MULTI_IRQ_HANDLER 117 select MULTI_IRQ_HANDLER
118 select COMMON_CLK
114 119
115config OMAP_PACKAGE_ZAF 120config OMAP_PACKAGE_ZAF
116 bool 121 bool
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ada6006ab2f3..745401020c2b 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -7,28 +7,34 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \
7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ 7 common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \
8 omap_device.o sram.o 8 omap_device.o sram.o
9 9
10# INTCPS IP block support - XXX should be moved to drivers/ 10omap-2-3-common = irq.o
11obj-$(CONFIG_ARCH_OMAP2) += irq.o 11hwmod-common = omap_hwmod.o \
12obj-$(CONFIG_ARCH_OMAP3) += irq.o 12 omap_hwmod_common_data.o
13obj-$(CONFIG_SOC_AM33XX) += irq.o 13clock-common = clock.o clock_common_data.o \
14 14 clkt_dpll.o clkt_clksel.o
15# Secure monitor API support 15secure-common = omap-smc.o omap-secure.o
16obj-$(CONFIG_ARCH_OMAP3) += omap-smc.o omap-secure.o 16
17obj-$(CONFIG_ARCH_OMAP4) += omap-smc.o omap-secure.o 17obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
18obj-$(CONFIG_SOC_OMAP5) += omap-smc.o omap-secure.o 18obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
19obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common)
20obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common)
21obj-$(CONFIG_SOC_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common)
19 22
20ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) 23ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),)
21obj-y += mcbsp.o 24obj-y += mcbsp.o
22endif 25endif
23 26
24obj-$(CONFIG_TWL4030_CORE) += omap_twl.o 27obj-$(CONFIG_TWL4030_CORE) += omap_twl.o
28obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
25 29
26# SMP support ONLY available for OMAP4 30# SMP support ONLY available for OMAP4
27 31
28obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o 32obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o
29obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o 33obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o
30obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o 34omap-4-5-common = omap4-common.o omap-wakeupgen.o \
31obj-$(CONFIG_SOC_OMAP5) += omap4-common.o omap-wakeupgen.o 35 sleep44xx.o
36obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-common)
37obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common)
32 38
33plus_sec := $(call as-instr,.arch_extension sec,+sec) 39plus_sec := $(call as-instr,.arch_extension sec,+sec)
34AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) 40AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -44,6 +50,11 @@ AFLAGS_sram242x.o :=-Wa,-march=armv6
44AFLAGS_sram243x.o :=-Wa,-march=armv6 50AFLAGS_sram243x.o :=-Wa,-march=armv6
45AFLAGS_sram34xx.o :=-Wa,-march=armv7-a 51AFLAGS_sram34xx.o :=-Wa,-march=armv7-a
46 52
53# Restart code (OMAP4/5 currently in omap4-common.c)
54obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o
55obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o
56obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o
57
47# Pin multiplexing 58# Pin multiplexing
48obj-$(CONFIG_SOC_OMAP2420) += mux2420.o 59obj-$(CONFIG_SOC_OMAP2420) += mux2420.o
49obj-$(CONFIG_SOC_OMAP2430) += mux2430.o 60obj-$(CONFIG_SOC_OMAP2430) += mux2430.o
@@ -53,7 +64,6 @@ obj-$(CONFIG_ARCH_OMAP4) += mux44xx.o
53# SMS/SDRC 64# SMS/SDRC
54obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o 65obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o
55# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o 66# obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o
56obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o
57 67
58# OPP table initialization 68# OPP table initialization
59ifeq ($(CONFIG_PM_OPP),y) 69ifeq ($(CONFIG_PM_OPP),y)
@@ -66,15 +76,15 @@ endif
66obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o 76obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o
67 77
68ifeq ($(CONFIG_PM),y) 78ifeq ($(CONFIG_PM),y)
69obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o sleep24xx.o 79obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o
80obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o
70obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o 81obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o
71obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o 82obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o
72obj-$(CONFIG_ARCH_OMAP4) += sleep44xx.o 83obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o
73obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o sleep44xx.o
74obj-$(CONFIG_PM_DEBUG) += pm-debug.o 84obj-$(CONFIG_PM_DEBUG) += pm-debug.o
75 85
76obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o 86obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o
77obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o 87obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o
78 88
79AFLAGS_sleep24xx.o :=-Wa,-march=armv6 89AFLAGS_sleep24xx.o :=-Wa,-march=armv6
80AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) 90AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec)
@@ -86,76 +96,82 @@ endif
86endif 96endif
87 97
88ifeq ($(CONFIG_CPU_IDLE),y) 98ifeq ($(CONFIG_CPU_IDLE),y)
89obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o 99obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o
90obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o 100obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o
91endif 101endif
92 102
93# PRCM 103# PRCM
94obj-y += prcm.o prm_common.o 104obj-y += prm_common.o cm_common.o
95obj-$(CONFIG_ARCH_OMAP2) += cm2xxx_3xxx.o prm2xxx_3xxx.o 105obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
96obj-$(CONFIG_ARCH_OMAP3) += cm2xxx_3xxx.o prm2xxx_3xxx.o 106obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
97obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 107obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o
98obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o 108obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o
99omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ 109omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \
100 prcm_mpu44xx.o prminst44xx.o \ 110 prcm_mpu44xx.o prminst44xx.o \
101 vc44xx_data.o vp44xx_data.o \ 111 vc44xx_data.o vp44xx_data.o
102 prm44xx.o
103obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) 112obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common)
104obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) 113obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common)
105 114
106# OMAP voltage domains 115# OMAP voltage domains
107obj-y += voltage.o vc.o vp.o 116voltagedomain-common := voltage.o vc.o vp.o
117obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common)
108obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o 118obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o
119obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common)
109obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o 120obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o
121obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common)
110obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o 122obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o
111obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o 123obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common)
124obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o
125obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common)
112 126
113# OMAP powerdomain framework 127# OMAP powerdomain framework
114obj-y += powerdomain.o powerdomain-common.o 128powerdomain-common += powerdomain.o powerdomain-common.o
129obj-$(CONFIG_ARCH_OMAP2) += $(powerdomain-common)
115obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o 130obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o
116obj-$(CONFIG_ARCH_OMAP2) += powerdomain2xxx_3xxx.o
117obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o 131obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o
118obj-$(CONFIG_ARCH_OMAP3) += powerdomain2xxx_3xxx.o 132obj-$(CONFIG_ARCH_OMAP3) += $(powerdomain-common)
119obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o 133obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o
120obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o 134obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o
121obj-$(CONFIG_ARCH_OMAP4) += powerdomain44xx.o 135obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common)
122obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o 136obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o
123obj-$(CONFIG_SOC_AM33XX) += powerdomain33xx.o 137obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common)
124obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o 138obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o
125obj-$(CONFIG_SOC_OMAP5) += powerdomain44xx.o 139obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common)
126 140
127# PRCM clockdomain control 141# PRCM clockdomain control
128obj-y += clockdomain.o 142clockdomain-common += clockdomain.o
129obj-$(CONFIG_ARCH_OMAP2) += clockdomain2xxx_3xxx.o 143obj-$(CONFIG_ARCH_OMAP2) += $(clockdomain-common)
130obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o 144obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o
131obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o 145obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o
132obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o 146obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o
133obj-$(CONFIG_ARCH_OMAP3) += clockdomain2xxx_3xxx.o 147obj-$(CONFIG_ARCH_OMAP3) += $(clockdomain-common)
134obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o 148obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o
135obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o 149obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o
136obj-$(CONFIG_ARCH_OMAP4) += clockdomain44xx.o 150obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common)
137obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o 151obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o
138obj-$(CONFIG_SOC_AM33XX) += clockdomain33xx.o 152obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common)
139obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o 153obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o
140obj-$(CONFIG_SOC_OMAP5) += clockdomain44xx.o 154obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common)
141 155
142# Clock framework 156# Clock framework
143obj-y += clock.o clock_common_data.o \ 157obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o
144 clkt_dpll.o clkt_clksel.o 158obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_sys.o
145obj-$(CONFIG_ARCH_OMAP2) += clock2xxx.o 159obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o
146obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o clkt2xxx_sys.o
147obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o 160obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o
148obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o 161obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o
149obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o 162obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o
150obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o 163obj-$(CONFIG_SOC_OMAP2420) += cclock2420_data.o
151obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o 164obj-$(CONFIG_SOC_OMAP2430) += clock2430.o cclock2430_data.o
152obj-$(CONFIG_ARCH_OMAP3) += clock3xxx.o 165obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o
153obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o 166obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o
154obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o clkt_iclk.o 167obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o
155obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o clock3xxx_data.o 168obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o cclock3xxx_data.o
156obj-$(CONFIG_ARCH_OMAP4) += clock44xx_data.o 169obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o
170obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) cclock44xx_data.o
157obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o 171obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o
158obj-$(CONFIG_SOC_AM33XX) += dpll3xxx.o clock33xx_data.o 172obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o
173obj-$(CONFIG_SOC_AM33XX) += cclock33xx_data.o
174obj-$(CONFIG_SOC_OMAP5) += $(clock-common)
159obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o 175obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o
160 176
161# OMAP2 clock rate set data (old "OPP" data) 177# OMAP2 clock rate set data (old "OPP" data)
@@ -163,7 +179,6 @@ obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o
163obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o 179obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o
164 180
165# hwmod data 181# hwmod data
166obj-y += omap_hwmod_common_data.o
167obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o 182obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o
168obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o 183obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o
169obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o 184obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o
@@ -209,10 +224,10 @@ obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o
209obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o 224obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o
210obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o 225obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o
211obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o 226obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o
212obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o 227obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o
213obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o 228obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o
214obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o 229obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o
215obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o 230obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o
216obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o 231obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o
217obj-$(CONFIG_MACH_OVERO) += board-overo.o 232obj-$(CONFIG_MACH_OVERO) += board-overo.o
218obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o 233obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o
diff --git a/arch/arm/mach-omap2/am33xx.h b/arch/arm/mach-omap2/am33xx.h
index 06c19bb7bca6..43296c1af9ee 100644
--- a/arch/arm/mach-omap2/am33xx.h
+++ b/arch/arm/mach-omap2/am33xx.h
@@ -21,5 +21,6 @@
21#define AM33XX_SCM_BASE 0x44E10000 21#define AM33XX_SCM_BASE 0x44E10000
22#define AM33XX_CTRL_BASE AM33XX_SCM_BASE 22#define AM33XX_CTRL_BASE AM33XX_SCM_BASE
23#define AM33XX_PRCM_BASE 0x44E00000 23#define AM33XX_PRCM_BASE 0x44E00000
24#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + 0x3FC)
24 25
25#endif /* __ASM_ARCH_AM33XX_H */ 26#endif /* __ASM_ARCH_AM33XX_H */
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index d1c01625fe5a..4815ea6f8f5d 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -285,5 +285,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
285 .init_machine = omap_2430sdp_init, 285 .init_machine = omap_2430sdp_init,
286 .init_late = omap2430_init_late, 286 .init_late = omap2430_init_late,
287 .timer = &omap2_timer, 287 .timer = &omap2_timer,
288 .restart = omap_prcm_restart, 288 .restart = omap2xxx_restart,
289MACHINE_END 289MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 79fd9048fd79..6601754f9512 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -597,5 +597,5 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
597 .init_machine = omap_3430sdp_init, 597 .init_machine = omap_3430sdp_init,
598 .init_late = omap3430_init_late, 598 .init_late = omap3430_init_late,
599 .timer = &omap3_timer, 599 .timer = &omap3_timer,
600 .restart = omap_prcm_restart, 600 .restart = omap3xxx_restart,
601MACHINE_END 601MACHINE_END
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index 81871b1c735c..050aaa771254 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -212,5 +212,5 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
212 .init_machine = omap_sdp_init, 212 .init_machine = omap_sdp_init,
213 .init_late = omap3630_init_late, 213 .init_late = omap3630_init_late,
214 .timer = &omap3_timer, 214 .timer = &omap3_timer,
215 .restart = omap_prcm_restart, 215 .restart = omap3xxx_restart,
216MACHINE_END 216MACHINE_END
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index fd80d976872d..85dfa71e0dc6 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -881,5 +881,5 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
881 .init_machine = omap_4430sdp_init, 881 .init_machine = omap_4430sdp_init,
882 .init_late = omap4430_init_late, 882 .init_late = omap4430_init_late,
883 .timer = &omap4_timer, 883 .timer = &omap4_timer,
884 .restart = omap_prcm_restart, 884 .restart = omap44xx_restart,
885MACHINE_END 885MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517crane.c b/arch/arm/mach-omap2/board-am3517crane.c
index 603503c587b7..51b96a1206d1 100644
--- a/arch/arm/mach-omap2/board-am3517crane.c
+++ b/arch/arm/mach-omap2/board-am3517crane.c
@@ -93,5 +93,5 @@ MACHINE_START(CRANEBOARD, "AM3517/05 CRANEBOARD")
93 .init_machine = am3517_crane_init, 93 .init_machine = am3517_crane_init,
94 .init_late = am35xx_init_late, 94 .init_late = am35xx_init_late,
95 .timer = &omap3_timer, 95 .timer = &omap3_timer,
96 .restart = omap_prcm_restart, 96 .restart = omap3xxx_restart,
97MACHINE_END 97MACHINE_END
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 96d6c5ab5d4c..4be58fd071f6 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -393,5 +393,5 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
393 .init_machine = am3517_evm_init, 393 .init_machine = am3517_evm_init,
394 .init_late = am35xx_init_late, 394 .init_late = am35xx_init_late,
395 .timer = &omap3_timer, 395 .timer = &omap3_timer,
396 .restart = omap_prcm_restart, 396 .restart = omap3xxx_restart,
397MACHINE_END 397MACHINE_END
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index 64cf1bde0f3b..5d0a61f54165 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -338,5 +338,5 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
338 .init_machine = omap_apollon_init, 338 .init_machine = omap_apollon_init,
339 .init_late = omap2420_init_late, 339 .init_late = omap2420_init_late,
340 .timer = &omap2_timer, 340 .timer = &omap2_timer,
341 .restart = omap_prcm_restart, 341 .restart = omap2xxx_restart,
342MACHINE_END 342MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index a8cad2237a2a..c8e37dc00892 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -751,18 +751,18 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
751 .init_machine = cm_t35_init, 751 .init_machine = cm_t35_init,
752 .init_late = omap35xx_init_late, 752 .init_late = omap35xx_init_late,
753 .timer = &omap3_timer, 753 .timer = &omap3_timer,
754 .restart = omap_prcm_restart, 754 .restart = omap3xxx_restart,
755MACHINE_END 755MACHINE_END
756 756
757MACHINE_START(CM_T3730, "Compulab CM-T3730") 757MACHINE_START(CM_T3730, "Compulab CM-T3730")
758 .atag_offset = 0x100, 758 .atag_offset = 0x100,
759 .reserve = omap_reserve, 759 .reserve = omap_reserve,
760 .map_io = omap3_map_io, 760 .map_io = omap3_map_io,
761 .init_early = omap3630_init_early, 761 .init_early = omap3630_init_early,
762 .init_irq = omap3_init_irq, 762 .init_irq = omap3_init_irq,
763 .handle_irq = omap3_intc_handle_irq, 763 .handle_irq = omap3_intc_handle_irq,
764 .init_machine = cm_t3730_init, 764 .init_machine = cm_t3730_init,
765 .init_late = omap3630_init_late, 765 .init_late = omap3630_init_late,
766 .timer = &omap3_timer, 766 .timer = &omap3_timer,
767 .restart = omap_prcm_restart, 767 .restart = omap3xxx_restart,
768MACHINE_END 768MACHINE_END
diff --git a/arch/arm/mach-omap2/board-cm-t3517.c b/arch/arm/mach-omap2/board-cm-t3517.c
index 278664731d2c..699caec8f9e2 100644
--- a/arch/arm/mach-omap2/board-cm-t3517.c
+++ b/arch/arm/mach-omap2/board-cm-t3517.c
@@ -298,5 +298,5 @@ MACHINE_START(CM_T3517, "Compulab CM-T3517")
298 .init_machine = cm_t3517_init, 298 .init_machine = cm_t3517_init,
299 .init_late = am35xx_init_late, 299 .init_late = am35xx_init_late,
300 .timer = &omap3_timer, 300 .timer = &omap3_timer,
301 .restart = omap_prcm_restart, 301 .restart = omap3xxx_restart,
302MACHINE_END 302MACHINE_END
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 933479e36737..7667eb749522 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -643,5 +643,5 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
643 .init_machine = devkit8000_init, 643 .init_machine = devkit8000_init,
644 .init_late = omap35xx_init_late, 644 .init_late = omap35xx_init_late,
645 .timer = &omap3_secure_timer, 645 .timer = &omap3_secure_timer,
646 .restart = omap_prcm_restart, 646 .restart = omap3xxx_restart,
647MACHINE_END 647MACHINE_END
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 601ecdfb1cf9..475e14f07216 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -57,7 +57,7 @@ DT_MACHINE_START(OMAP242X_DT, "Generic OMAP2420 (Flattened Device Tree)")
57 .init_machine = omap_generic_init, 57 .init_machine = omap_generic_init,
58 .timer = &omap2_timer, 58 .timer = &omap2_timer,
59 .dt_compat = omap242x_boards_compat, 59 .dt_compat = omap242x_boards_compat,
60 .restart = omap_prcm_restart, 60 .restart = omap2xxx_restart,
61MACHINE_END 61MACHINE_END
62#endif 62#endif
63 63
@@ -76,7 +76,7 @@ DT_MACHINE_START(OMAP243X_DT, "Generic OMAP2430 (Flattened Device Tree)")
76 .init_machine = omap_generic_init, 76 .init_machine = omap_generic_init,
77 .timer = &omap2_timer, 77 .timer = &omap2_timer,
78 .dt_compat = omap243x_boards_compat, 78 .dt_compat = omap243x_boards_compat,
79 .restart = omap_prcm_restart, 79 .restart = omap2xxx_restart,
80MACHINE_END 80MACHINE_END
81#endif 81#endif
82 82
@@ -95,7 +95,7 @@ DT_MACHINE_START(OMAP3_DT, "Generic OMAP3 (Flattened Device Tree)")
95 .init_machine = omap_generic_init, 95 .init_machine = omap_generic_init,
96 .timer = &omap3_timer, 96 .timer = &omap3_timer,
97 .dt_compat = omap3_boards_compat, 97 .dt_compat = omap3_boards_compat,
98 .restart = omap_prcm_restart, 98 .restart = omap3xxx_restart,
99MACHINE_END 99MACHINE_END
100#endif 100#endif
101 101
@@ -134,7 +134,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)")
134 .init_late = omap4430_init_late, 134 .init_late = omap4430_init_late,
135 .timer = &omap4_timer, 135 .timer = &omap4_timer,
136 .dt_compat = omap4_boards_compat, 136 .dt_compat = omap4_boards_compat,
137 .restart = omap_prcm_restart, 137 .restart = omap44xx_restart,
138MACHINE_END 138MACHINE_END
139#endif 139#endif
140 140
@@ -154,6 +154,6 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)")
154 .init_machine = omap_generic_init, 154 .init_machine = omap_generic_init,
155 .timer = &omap5_timer, 155 .timer = &omap5_timer,
156 .dt_compat = omap5_boards_compat, 156 .dt_compat = omap5_boards_compat,
157 .restart = omap_prcm_restart, 157 .restart = omap44xx_restart,
158MACHINE_END 158MACHINE_END
159#endif 159#endif
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 8668c72ee810..b626dbe6f7bc 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -386,5 +386,5 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
386 .init_machine = omap_h4_init, 386 .init_machine = omap_h4_init,
387 .init_late = omap2420_init_late, 387 .init_late = omap2420_init_late,
388 .timer = &omap2_timer, 388 .timer = &omap2_timer,
389 .restart = omap_prcm_restart, 389 .restart = omap2xxx_restart,
390MACHINE_END 390MACHINE_END
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index dbc705ac4334..cea5d5292628 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -651,7 +651,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
651 .init_machine = igep_init, 651 .init_machine = igep_init,
652 .init_late = omap35xx_init_late, 652 .init_late = omap35xx_init_late,
653 .timer = &omap3_timer, 653 .timer = &omap3_timer,
654 .restart = omap_prcm_restart, 654 .restart = omap3xxx_restart,
655MACHINE_END 655MACHINE_END
656 656
657MACHINE_START(IGEP0030, "IGEP OMAP3 module") 657MACHINE_START(IGEP0030, "IGEP OMAP3 module")
@@ -664,5 +664,5 @@ MACHINE_START(IGEP0030, "IGEP OMAP3 module")
664 .init_machine = igep_init, 664 .init_machine = igep_init,
665 .init_late = omap35xx_init_late, 665 .init_late = omap35xx_init_late,
666 .timer = &omap3_timer, 666 .timer = &omap3_timer,
667 .restart = omap_prcm_restart, 667 .restart = omap3xxx_restart,
668MACHINE_END 668MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 1164b1061038..0869f4f3d3e1 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -436,5 +436,5 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
436 .init_machine = omap_ldp_init, 436 .init_machine = omap_ldp_init,
437 .init_late = omap3430_init_late, 437 .init_late = omap3430_init_late,
438 .timer = &omap3_timer, 438 .timer = &omap3_timer,
439 .restart = omap_prcm_restart, 439 .restart = omap3xxx_restart,
440MACHINE_END 440MACHINE_END
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index e3efcb88cb3b..a4e167c55c1d 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -690,7 +690,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
690 .init_machine = n8x0_init_machine, 690 .init_machine = n8x0_init_machine,
691 .init_late = omap2420_init_late, 691 .init_late = omap2420_init_late,
692 .timer = &omap2_timer, 692 .timer = &omap2_timer,
693 .restart = omap_prcm_restart, 693 .restart = omap2xxx_restart,
694MACHINE_END 694MACHINE_END
695 695
696MACHINE_START(NOKIA_N810, "Nokia N810") 696MACHINE_START(NOKIA_N810, "Nokia N810")
@@ -703,7 +703,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
703 .init_machine = n8x0_init_machine, 703 .init_machine = n8x0_init_machine,
704 .init_late = omap2420_init_late, 704 .init_late = omap2420_init_late,
705 .timer = &omap2_timer, 705 .timer = &omap2_timer,
706 .restart = omap_prcm_restart, 706 .restart = omap2xxx_restart,
707MACHINE_END 707MACHINE_END
708 708
709MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") 709MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
@@ -716,5 +716,5 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
716 .init_machine = n8x0_init_machine, 716 .init_machine = n8x0_init_machine,
717 .init_late = omap2420_init_late, 717 .init_late = omap2420_init_late,
718 .timer = &omap2_timer, 718 .timer = &omap2_timer,
719 .restart = omap_prcm_restart, 719 .restart = omap2xxx_restart,
720MACHINE_END 720MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 5a3800da903f..22c483d5dfa8 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -545,5 +545,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
545 .init_machine = omap3_beagle_init, 545 .init_machine = omap3_beagle_init,
546 .init_late = omap3_init_late, 546 .init_late = omap3_init_late,
547 .timer = &omap3_secure_timer, 547 .timer = &omap3_secure_timer,
548 .restart = omap_prcm_restart, 548 .restart = omap3xxx_restart,
549MACHINE_END 549MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 3c0b9a90f3b3..54647d6286b4 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -757,5 +757,5 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
757 .init_machine = omap3_evm_init, 757 .init_machine = omap3_evm_init,
758 .init_late = omap35xx_init_late, 758 .init_late = omap35xx_init_late,
759 .timer = &omap3_timer, 759 .timer = &omap3_timer,
760 .restart = omap_prcm_restart, 760 .restart = omap3xxx_restart,
761MACHINE_END 761MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3logic.c b/arch/arm/mach-omap2/board-omap3logic.c
index e84e2a875378..2a065ba6eb58 100644
--- a/arch/arm/mach-omap2/board-omap3logic.c
+++ b/arch/arm/mach-omap2/board-omap3logic.c
@@ -232,7 +232,7 @@ MACHINE_START(OMAP3_TORPEDO, "Logic OMAP3 Torpedo board")
232 .init_machine = omap3logic_init, 232 .init_machine = omap3logic_init,
233 .init_late = omap35xx_init_late, 233 .init_late = omap35xx_init_late,
234 .timer = &omap3_timer, 234 .timer = &omap3_timer,
235 .restart = omap_prcm_restart, 235 .restart = omap3xxx_restart,
236MACHINE_END 236MACHINE_END
237 237
238MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board") 238MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
@@ -245,5 +245,5 @@ MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board")
245 .init_machine = omap3logic_init, 245 .init_machine = omap3logic_init,
246 .init_late = omap35xx_init_late, 246 .init_late = omap35xx_init_late,
247 .timer = &omap3_timer, 247 .timer = &omap3_timer,
248 .restart = omap_prcm_restart, 248 .restart = omap3xxx_restart,
249MACHINE_END 249MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index ce31bd329f38..a53a6683c1b8 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -619,5 +619,5 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
619 .init_machine = omap3pandora_init, 619 .init_machine = omap3pandora_init,
620 .init_late = omap35xx_init_late, 620 .init_late = omap35xx_init_late,
621 .timer = &omap3_timer, 621 .timer = &omap3_timer,
622 .restart = omap_prcm_restart, 622 .restart = omap3xxx_restart,
623MACHINE_END 623MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index ba1124538b9c..d8638b3b4f94 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -427,5 +427,5 @@ MACHINE_START(SBC3530, "OMAP3 STALKER")
427 .init_machine = omap3_stalker_init, 427 .init_machine = omap3_stalker_init,
428 .init_late = omap35xx_init_late, 428 .init_late = omap35xx_init_late,
429 .timer = &omap3_secure_timer, 429 .timer = &omap3_secure_timer,
430 .restart = omap_prcm_restart, 430 .restart = omap3xxx_restart,
431MACHINE_END 431MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index a225d819633f..263cb9cfbf37 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -387,5 +387,5 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
387 .init_machine = omap3_touchbook_init, 387 .init_machine = omap3_touchbook_init,
388 .init_late = omap3430_init_late, 388 .init_late = omap3430_init_late,
389 .timer = &omap3_secure_timer, 389 .timer = &omap3_secure_timer,
390 .restart = omap_prcm_restart, 390 .restart = omap3xxx_restart,
391MACHINE_END 391MACHINE_END
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 8c00b99cd2a3..12a3a24d5bb5 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -524,5 +524,5 @@ MACHINE_START(OMAP4_PANDA, "OMAP4 Panda board")
524 .init_machine = omap4_panda_init, 524 .init_machine = omap4_panda_init,
525 .init_late = omap4430_init_late, 525 .init_late = omap4430_init_late,
526 .timer = &omap4_timer, 526 .timer = &omap4_timer,
527 .restart = omap_prcm_restart, 527 .restart = omap44xx_restart,
528MACHINE_END 528MACHINE_END
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index f5ba43fa0400..c8fde3e56441 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -552,5 +552,5 @@ MACHINE_START(OVERO, "Gumstix Overo")
552 .init_machine = overo_init, 552 .init_machine = overo_init,
553 .init_late = omap35xx_init_late, 553 .init_late = omap35xx_init_late,
554 .timer = &omap3_timer, 554 .timer = &omap3_timer,
555 .restart = omap_prcm_restart, 555 .restart = omap3xxx_restart,
556MACHINE_END 556MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rm680.c b/arch/arm/mach-omap2/board-rm680.c
index 1997e0e722a1..cbcb1b2dc31f 100644
--- a/arch/arm/mach-omap2/board-rm680.c
+++ b/arch/arm/mach-omap2/board-rm680.c
@@ -148,7 +148,7 @@ MACHINE_START(NOKIA_RM680, "Nokia RM-680 board")
148 .init_machine = rm680_init, 148 .init_machine = rm680_init,
149 .init_late = omap3630_init_late, 149 .init_late = omap3630_init_late,
150 .timer = &omap3_timer, 150 .timer = &omap3_timer,
151 .restart = omap_prcm_restart, 151 .restart = omap3xxx_restart,
152MACHINE_END 152MACHINE_END
153 153
154MACHINE_START(NOKIA_RM696, "Nokia RM-696 board") 154MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
@@ -161,5 +161,5 @@ MACHINE_START(NOKIA_RM696, "Nokia RM-696 board")
161 .init_machine = rm680_init, 161 .init_machine = rm680_init,
162 .init_late = omap3630_init_late, 162 .init_late = omap3630_init_late,
163 .timer = &omap3_timer, 163 .timer = &omap3_timer,
164 .restart = omap_prcm_restart, 164 .restart = omap3xxx_restart,
165MACHINE_END 165MACHINE_END
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index c388aec14799..bf8f74b0ce3e 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -127,5 +127,5 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
127 .init_machine = rx51_init, 127 .init_machine = rx51_init,
128 .init_late = omap3430_init_late, 128 .init_late = omap3430_init_late,
129 .timer = &omap3_timer, 129 .timer = &omap3_timer,
130 .restart = omap_prcm_restart, 130 .restart = omap3xxx_restart,
131MACHINE_END 131MACHINE_END
diff --git a/arch/arm/mach-omap2/board-ti8168evm.c b/arch/arm/mach-omap2/board-ti8168evm.c
index 5e672c2b6a43..1a3e056d63a7 100644
--- a/arch/arm/mach-omap2/board-ti8168evm.c
+++ b/arch/arm/mach-omap2/board-ti8168evm.c
@@ -46,7 +46,7 @@ MACHINE_START(TI8168EVM, "ti8168evm")
46 .timer = &omap3_timer, 46 .timer = &omap3_timer,
47 .init_machine = ti81xx_evm_init, 47 .init_machine = ti81xx_evm_init,
48 .init_late = ti81xx_init_late, 48 .init_late = ti81xx_init_late,
49 .restart = omap_prcm_restart, 49 .restart = omap44xx_restart,
50MACHINE_END 50MACHINE_END
51 51
52MACHINE_START(TI8148EVM, "ti8148evm") 52MACHINE_START(TI8148EVM, "ti8148evm")
@@ -58,5 +58,5 @@ MACHINE_START(TI8148EVM, "ti8148evm")
58 .timer = &omap3_timer, 58 .timer = &omap3_timer,
59 .init_machine = ti81xx_evm_init, 59 .init_machine = ti81xx_evm_init,
60 .init_late = ti81xx_init_late, 60 .init_late = ti81xx_init_late,
61 .restart = omap_prcm_restart, 61 .restart = omap44xx_restart,
62MACHINE_END 62MACHINE_END
diff --git a/arch/arm/mach-omap2/board-zoom.c b/arch/arm/mach-omap2/board-zoom.c
index 8feb4d99b96d..d7fa31e67238 100644
--- a/arch/arm/mach-omap2/board-zoom.c
+++ b/arch/arm/mach-omap2/board-zoom.c
@@ -138,7 +138,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
138 .init_machine = omap_zoom_init, 138 .init_machine = omap_zoom_init,
139 .init_late = omap3430_init_late, 139 .init_late = omap3430_init_late,
140 .timer = &omap3_timer, 140 .timer = &omap3_timer,
141 .restart = omap_prcm_restart, 141 .restart = omap3xxx_restart,
142MACHINE_END 142MACHINE_END
143 143
144MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board") 144MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
@@ -151,5 +151,5 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
151 .init_machine = omap_zoom_init, 151 .init_machine = omap_zoom_init,
152 .init_late = omap3630_init_late, 152 .init_late = omap3630_init_late,
153 .timer = &omap3_timer, 153 .timer = &omap3_timer,
154 .restart = omap_prcm_restart, 154 .restart = omap3xxx_restart,
155MACHINE_END 155MACHINE_END
diff --git a/arch/arm/mach-omap2/cclock2420_data.c b/arch/arm/mach-omap2/cclock2420_data.c
new file mode 100644
index 000000000000..7e5febe456d9
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock2420_data.c
@@ -0,0 +1,1950 @@
1/*
2 * OMAP2420 clock data
3 *
4 * Copyright (C) 2005-2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 * Updated to COMMON clk format by Rajendra Nayak <rnayak@ti.com>
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 */
16
17#include <linux/kernel.h>
18#include <linux/io.h>
19#include <linux/clk.h>
20#include <linux/clk-private.h>
21#include <linux/list.h>
22
23#include "soc.h"
24#include "iomap.h"
25#include "clock.h"
26#include "clock2xxx.h"
27#include "opp2xxx.h"
28#include "cm2xxx.h"
29#include "prm2xxx.h"
30#include "prm-regbits-24xx.h"
31#include "cm-regbits-24xx.h"
32#include "sdrc.h"
33#include "control.h"
34
35#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
36
37/*
38 * 2420 clock tree.
39 *
40 * NOTE:In many cases here we are assigning a 'default' parent. In
41 * many cases the parent is selectable. The set parent calls will
42 * also switch sources.
43 *
44 * Several sources are given initial rates which may be wrong, this will
45 * be fixed up in the init func.
46 *
47 * Things are broadly separated below by clock domains. It is
48 * noteworthy that most peripherals have dependencies on multiple clock
49 * domains. Many get their interface clocks from the L4 domain, but get
50 * functional clocks from fixed sources or other core domain derived
51 * clocks.
52 */
53
54DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
55
56DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
57
58DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
59
60static struct clk osc_ck;
61
62static const struct clk_ops osc_ck_ops = {
63 .recalc_rate = &omap2_osc_clk_recalc,
64};
65
66static struct clk_hw_omap osc_ck_hw = {
67 .hw = {
68 .clk = &osc_ck,
69 },
70};
71
72static struct clk osc_ck = {
73 .name = "osc_ck",
74 .ops = &osc_ck_ops,
75 .hw = &osc_ck_hw.hw,
76 .flags = CLK_IS_ROOT,
77};
78
79DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
80
81static struct clk sys_ck;
82
83static const char *sys_ck_parent_names[] = {
84 "osc_ck",
85};
86
87static const struct clk_ops sys_ck_ops = {
88 .init = &omap2_init_clk_clkdm,
89 .recalc_rate = &omap2xxx_sys_clk_recalc,
90};
91
92DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
93DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
94
95static struct dpll_data dpll_dd = {
96 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
97 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
98 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
99 .clk_bypass = &sys_ck,
100 .clk_ref = &sys_ck,
101 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
102 .enable_mask = OMAP24XX_EN_DPLL_MASK,
103 .max_multiplier = 1023,
104 .min_divider = 1,
105 .max_divider = 16,
106};
107
108static struct clk dpll_ck;
109
110static const char *dpll_ck_parent_names[] = {
111 "sys_ck",
112};
113
114static const struct clk_ops dpll_ck_ops = {
115 .init = &omap2_init_clk_clkdm,
116 .get_parent = &omap2_init_dpll_parent,
117 .recalc_rate = &omap2_dpllcore_recalc,
118 .round_rate = &omap2_dpll_round_rate,
119 .set_rate = &omap2_reprogram_dpllcore,
120};
121
122static struct clk_hw_omap dpll_ck_hw = {
123 .hw = {
124 .clk = &dpll_ck,
125 },
126 .ops = &clkhwops_omap2xxx_dpll,
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129};
130
131DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
132
133static struct clk core_ck;
134
135static const char *core_ck_parent_names[] = {
136 "dpll_ck",
137};
138
139static const struct clk_ops core_ck_ops = {
140 .init = &omap2_init_clk_clkdm,
141};
142
143DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
144DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
145
146DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
147 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
148 OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
149 CLK_DIVIDER_ONE_BASED, NULL);
150
151DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
153 OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156static struct clk aes_ick;
157
158static const char *aes_ick_parent_names[] = {
159 "l4_ck",
160};
161
162static const struct clk_ops aes_ick_ops = {
163 .init = &omap2_init_clk_clkdm,
164 .enable = &omap2_dflt_clk_enable,
165 .disable = &omap2_dflt_clk_disable,
166 .is_enabled = &omap2_dflt_clk_is_enabled,
167};
168
169static struct clk_hw_omap aes_ick_hw = {
170 .hw = {
171 .clk = &aes_ick,
172 },
173 .ops = &clkhwops_iclk_wait,
174 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
175 .enable_bit = OMAP24XX_EN_AES_SHIFT,
176 .clkdm_name = "core_l4_clkdm",
177};
178
179DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
180
181static struct clk apll54_ck;
182
183static const struct clk_ops apll54_ck_ops = {
184 .init = &omap2_init_clk_clkdm,
185 .enable = &omap2_clk_apll54_enable,
186 .disable = &omap2_clk_apll54_disable,
187 .recalc_rate = &omap2_clk_apll54_recalc,
188};
189
190static struct clk_hw_omap apll54_ck_hw = {
191 .hw = {
192 .clk = &apll54_ck,
193 },
194 .ops = &clkhwops_apll54,
195 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
196 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
197 .flags = ENABLE_ON_INIT,
198 .clkdm_name = "wkup_clkdm",
199};
200
201DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
202
203static struct clk apll96_ck;
204
205static const struct clk_ops apll96_ck_ops = {
206 .init = &omap2_init_clk_clkdm,
207 .enable = &omap2_clk_apll96_enable,
208 .disable = &omap2_clk_apll96_disable,
209 .recalc_rate = &omap2_clk_apll96_recalc,
210};
211
212static struct clk_hw_omap apll96_ck_hw = {
213 .hw = {
214 .clk = &apll96_ck,
215 },
216 .ops = &clkhwops_apll96,
217 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
218 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
219 .flags = ENABLE_ON_INIT,
220 .clkdm_name = "wkup_clkdm",
221};
222
223DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
224
225static struct clk func_96m_ck;
226
227static const char *func_96m_ck_parent_names[] = {
228 "apll96_ck",
229};
230
231DEFINE_STRUCT_CLK_HW_OMAP(func_96m_ck, "wkup_clkdm");
232DEFINE_STRUCT_CLK(func_96m_ck, func_96m_ck_parent_names, core_ck_ops);
233
234static struct clk cam_fck;
235
236static const char *cam_fck_parent_names[] = {
237 "func_96m_ck",
238};
239
240static struct clk_hw_omap cam_fck_hw = {
241 .hw = {
242 .clk = &cam_fck,
243 },
244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
245 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
246 .clkdm_name = "core_l3_clkdm",
247};
248
249DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
250
251static struct clk cam_ick;
252
253static struct clk_hw_omap cam_ick_hw = {
254 .hw = {
255 .clk = &cam_ick,
256 },
257 .ops = &clkhwops_iclk,
258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
259 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
260 .clkdm_name = "core_l4_clkdm",
261};
262
263DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
264
265static struct clk des_ick;
266
267static struct clk_hw_omap des_ick_hw = {
268 .hw = {
269 .clk = &des_ick,
270 },
271 .ops = &clkhwops_iclk_wait,
272 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
273 .enable_bit = OMAP24XX_EN_DES_SHIFT,
274 .clkdm_name = "core_l4_clkdm",
275};
276
277DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
278
279static const struct clksel_rate dsp_fck_core_rates[] = {
280 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
281 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
282 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
283 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
284 { .div = 6, .val = 6, .flags = RATE_IN_242X },
285 { .div = 8, .val = 8, .flags = RATE_IN_242X },
286 { .div = 12, .val = 12, .flags = RATE_IN_242X },
287 { .div = 0 }
288};
289
290static const struct clksel dsp_fck_clksel[] = {
291 { .parent = &core_ck, .rates = dsp_fck_core_rates },
292 { .parent = NULL },
293};
294
295static const char *dsp_fck_parent_names[] = {
296 "core_ck",
297};
298
299static const struct clk_ops dsp_fck_ops = {
300 .init = &omap2_init_clk_clkdm,
301 .enable = &omap2_dflt_clk_enable,
302 .disable = &omap2_dflt_clk_disable,
303 .is_enabled = &omap2_dflt_clk_is_enabled,
304 .recalc_rate = &omap2_clksel_recalc,
305 .set_rate = &omap2_clksel_set_rate,
306 .round_rate = &omap2_clksel_round_rate,
307};
308
309DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
310 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
311 OMAP24XX_CLKSEL_DSP_MASK,
312 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
313 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
314 dsp_fck_parent_names, dsp_fck_ops);
315
316static const struct clksel dsp_ick_clksel[] = {
317 { .parent = &dsp_fck, .rates = dsp_ick_rates },
318 { .parent = NULL },
319};
320
321static const char *dsp_ick_parent_names[] = {
322 "dsp_fck",
323};
324
325DEFINE_CLK_OMAP_MUX_GATE(dsp_ick, "dsp_clkdm", dsp_ick_clksel,
326 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
327 OMAP24XX_CLKSEL_DSP_IF_MASK,
328 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
329 OMAP2420_EN_DSP_IPI_SHIFT, &clkhwops_iclk_wait,
330 dsp_ick_parent_names, dsp_fck_ops);
331
332static const struct clksel_rate dss1_fck_sys_rates[] = {
333 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
334 { .div = 0 }
335};
336
337static const struct clksel_rate dss1_fck_core_rates[] = {
338 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
339 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
340 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
341 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
342 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
343 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
344 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
345 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
346 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
347 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
348 { .div = 0 }
349};
350
351static const struct clksel dss1_fck_clksel[] = {
352 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
353 { .parent = &core_ck, .rates = dss1_fck_core_rates },
354 { .parent = NULL },
355};
356
357static const char *dss1_fck_parent_names[] = {
358 "sys_ck", "core_ck",
359};
360
361static struct clk dss1_fck;
362
363static const struct clk_ops dss1_fck_ops = {
364 .init = &omap2_init_clk_clkdm,
365 .enable = &omap2_dflt_clk_enable,
366 .disable = &omap2_dflt_clk_disable,
367 .is_enabled = &omap2_dflt_clk_is_enabled,
368 .recalc_rate = &omap2_clksel_recalc,
369 .get_parent = &omap2_clksel_find_parent_index,
370 .set_parent = &omap2_clksel_set_parent,
371};
372
373DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
374 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
375 OMAP24XX_CLKSEL_DSS1_MASK,
376 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
377 OMAP24XX_EN_DSS1_SHIFT, NULL,
378 dss1_fck_parent_names, dss1_fck_ops);
379
380static const struct clksel_rate dss2_fck_sys_rates[] = {
381 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
382 { .div = 0 }
383};
384
385static const struct clksel_rate dss2_fck_48m_rates[] = {
386 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
387 { .div = 0 }
388};
389
390static const struct clksel_rate func_48m_apll96_rates[] = {
391 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
392 { .div = 0 }
393};
394
395static const struct clksel_rate func_48m_alt_rates[] = {
396 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
397 { .div = 0 }
398};
399
400static const struct clksel func_48m_clksel[] = {
401 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
402 { .parent = &alt_ck, .rates = func_48m_alt_rates },
403 { .parent = NULL },
404};
405
406static const char *func_48m_ck_parent_names[] = {
407 "apll96_ck", "alt_ck",
408};
409
410static struct clk func_48m_ck;
411
412static const struct clk_ops func_48m_ck_ops = {
413 .init = &omap2_init_clk_clkdm,
414 .recalc_rate = &omap2_clksel_recalc,
415 .set_rate = &omap2_clksel_set_rate,
416 .round_rate = &omap2_clksel_round_rate,
417 .get_parent = &omap2_clksel_find_parent_index,
418 .set_parent = &omap2_clksel_set_parent,
419};
420
421static struct clk_hw_omap func_48m_ck_hw = {
422 .hw = {
423 .clk = &func_48m_ck,
424 },
425 .clksel = func_48m_clksel,
426 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
427 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
428 .clkdm_name = "wkup_clkdm",
429};
430
431DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
432
433static const struct clksel dss2_fck_clksel[] = {
434 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
435 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
436 { .parent = NULL },
437};
438
439static const char *dss2_fck_parent_names[] = {
440 "sys_ck", "func_48m_ck",
441};
442
443DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
444 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
445 OMAP24XX_CLKSEL_DSS2_MASK,
446 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
447 OMAP24XX_EN_DSS2_SHIFT, NULL,
448 dss2_fck_parent_names, dss1_fck_ops);
449
450static const char *func_54m_ck_parent_names[] = {
451 "apll54_ck", "alt_ck",
452};
453
454DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
455 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
456 OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH,
457 0x0, NULL);
458
459static struct clk dss_54m_fck;
460
461static const char *dss_54m_fck_parent_names[] = {
462 "func_54m_ck",
463};
464
465static struct clk_hw_omap dss_54m_fck_hw = {
466 .hw = {
467 .clk = &dss_54m_fck,
468 },
469 .ops = &clkhwops_wait,
470 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
471 .enable_bit = OMAP24XX_EN_TV_SHIFT,
472 .clkdm_name = "dss_clkdm",
473};
474
475DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
476
477static struct clk dss_ick;
478
479static struct clk_hw_omap dss_ick_hw = {
480 .hw = {
481 .clk = &dss_ick,
482 },
483 .ops = &clkhwops_iclk,
484 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
485 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
486 .clkdm_name = "dss_clkdm",
487};
488
489DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
490
491static struct clk eac_fck;
492
493static struct clk_hw_omap eac_fck_hw = {
494 .hw = {
495 .clk = &eac_fck,
496 },
497 .ops = &clkhwops_wait,
498 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
499 .enable_bit = OMAP2420_EN_EAC_SHIFT,
500 .clkdm_name = "core_l4_clkdm",
501};
502
503DEFINE_STRUCT_CLK(eac_fck, cam_fck_parent_names, aes_ick_ops);
504
505static struct clk eac_ick;
506
507static struct clk_hw_omap eac_ick_hw = {
508 .hw = {
509 .clk = &eac_ick,
510 },
511 .ops = &clkhwops_iclk_wait,
512 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
513 .enable_bit = OMAP2420_EN_EAC_SHIFT,
514 .clkdm_name = "core_l4_clkdm",
515};
516
517DEFINE_STRUCT_CLK(eac_ick, aes_ick_parent_names, aes_ick_ops);
518
519static struct clk emul_ck;
520
521static struct clk_hw_omap emul_ck_hw = {
522 .hw = {
523 .clk = &emul_ck,
524 },
525 .enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
526 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
527 .clkdm_name = "wkup_clkdm",
528};
529
530DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
531
532DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
533
534static struct clk fac_fck;
535
536static const char *fac_fck_parent_names[] = {
537 "func_12m_ck",
538};
539
540static struct clk_hw_omap fac_fck_hw = {
541 .hw = {
542 .clk = &fac_fck,
543 },
544 .ops = &clkhwops_wait,
545 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
546 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
547 .clkdm_name = "core_l4_clkdm",
548};
549
550DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
551
552static struct clk fac_ick;
553
554static struct clk_hw_omap fac_ick_hw = {
555 .hw = {
556 .clk = &fac_ick,
557 },
558 .ops = &clkhwops_iclk_wait,
559 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
560 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
561 .clkdm_name = "core_l4_clkdm",
562};
563
564DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
565
566static const struct clksel gfx_fck_clksel[] = {
567 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
568 { .parent = NULL },
569};
570
571static const char *gfx_2d_fck_parent_names[] = {
572 "core_l3_ck",
573};
574
575DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
576 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
577 OMAP_CLKSEL_GFX_MASK,
578 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
579 OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
580 gfx_2d_fck_parent_names, dsp_fck_ops);
581
582DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
583 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
584 OMAP_CLKSEL_GFX_MASK,
585 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
586 OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
587 gfx_2d_fck_parent_names, dsp_fck_ops);
588
589static struct clk gfx_ick;
590
591static const char *gfx_ick_parent_names[] = {
592 "core_l3_ck",
593};
594
595static struct clk_hw_omap gfx_ick_hw = {
596 .hw = {
597 .clk = &gfx_ick,
598 },
599 .ops = &clkhwops_wait,
600 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
601 .enable_bit = OMAP_EN_GFX_SHIFT,
602 .clkdm_name = "gfx_clkdm",
603};
604
605DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
606
607static struct clk gpios_fck;
608
609static const char *gpios_fck_parent_names[] = {
610 "func_32k_ck",
611};
612
613static struct clk_hw_omap gpios_fck_hw = {
614 .hw = {
615 .clk = &gpios_fck,
616 },
617 .ops = &clkhwops_wait,
618 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
619 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
620 .clkdm_name = "wkup_clkdm",
621};
622
623DEFINE_STRUCT_CLK(gpios_fck, gpios_fck_parent_names, aes_ick_ops);
624
625static struct clk wu_l4_ick;
626
627DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
628DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
629
630static struct clk gpios_ick;
631
632static const char *gpios_ick_parent_names[] = {
633 "wu_l4_ick",
634};
635
636static struct clk_hw_omap gpios_ick_hw = {
637 .hw = {
638 .clk = &gpios_ick,
639 },
640 .ops = &clkhwops_iclk_wait,
641 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
642 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
643 .clkdm_name = "wkup_clkdm",
644};
645
646DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
647
648static struct clk gpmc_fck;
649
650static struct clk_hw_omap gpmc_fck_hw = {
651 .hw = {
652 .clk = &gpmc_fck,
653 },
654 .ops = &clkhwops_iclk,
655 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
656 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
657 .flags = ENABLE_ON_INIT,
658 .clkdm_name = "core_l3_clkdm",
659};
660
661DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
662
663static const struct clksel_rate gpt_alt_rates[] = {
664 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
665 { .div = 0 }
666};
667
668static const struct clksel omap24xx_gpt_clksel[] = {
669 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
670 { .parent = &sys_ck, .rates = gpt_sys_rates },
671 { .parent = &alt_ck, .rates = gpt_alt_rates },
672 { .parent = NULL },
673};
674
675static const char *gpt10_fck_parent_names[] = {
676 "func_32k_ck", "sys_ck", "alt_ck",
677};
678
679DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
680 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
681 OMAP24XX_CLKSEL_GPT10_MASK,
682 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
683 OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
684 gpt10_fck_parent_names, dss1_fck_ops);
685
686static struct clk gpt10_ick;
687
688static struct clk_hw_omap gpt10_ick_hw = {
689 .hw = {
690 .clk = &gpt10_ick,
691 },
692 .ops = &clkhwops_iclk_wait,
693 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
694 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
695 .clkdm_name = "core_l4_clkdm",
696};
697
698DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
699
700DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
701 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
702 OMAP24XX_CLKSEL_GPT11_MASK,
703 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
704 OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
705 gpt10_fck_parent_names, dss1_fck_ops);
706
707static struct clk gpt11_ick;
708
709static struct clk_hw_omap gpt11_ick_hw = {
710 .hw = {
711 .clk = &gpt11_ick,
712 },
713 .ops = &clkhwops_iclk_wait,
714 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
715 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
716 .clkdm_name = "core_l4_clkdm",
717};
718
719DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
720
721DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
722 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
723 OMAP24XX_CLKSEL_GPT12_MASK,
724 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
725 OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
726 gpt10_fck_parent_names, dss1_fck_ops);
727
728static struct clk gpt12_ick;
729
730static struct clk_hw_omap gpt12_ick_hw = {
731 .hw = {
732 .clk = &gpt12_ick,
733 },
734 .ops = &clkhwops_iclk_wait,
735 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
736 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
737 .clkdm_name = "core_l4_clkdm",
738};
739
740DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
741
742static const struct clk_ops gpt1_fck_ops = {
743 .init = &omap2_init_clk_clkdm,
744 .enable = &omap2_dflt_clk_enable,
745 .disable = &omap2_dflt_clk_disable,
746 .is_enabled = &omap2_dflt_clk_is_enabled,
747 .recalc_rate = &omap2_clksel_recalc,
748 .set_rate = &omap2_clksel_set_rate,
749 .round_rate = &omap2_clksel_round_rate,
750 .get_parent = &omap2_clksel_find_parent_index,
751 .set_parent = &omap2_clksel_set_parent,
752};
753
754DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
755 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
756 OMAP24XX_CLKSEL_GPT1_MASK,
757 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
758 OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
759 gpt10_fck_parent_names, gpt1_fck_ops);
760
761static struct clk gpt1_ick;
762
763static struct clk_hw_omap gpt1_ick_hw = {
764 .hw = {
765 .clk = &gpt1_ick,
766 },
767 .ops = &clkhwops_iclk_wait,
768 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
769 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
770 .clkdm_name = "wkup_clkdm",
771};
772
773DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
774
775DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
776 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
777 OMAP24XX_CLKSEL_GPT2_MASK,
778 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
779 OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
780 gpt10_fck_parent_names, dss1_fck_ops);
781
782static struct clk gpt2_ick;
783
784static struct clk_hw_omap gpt2_ick_hw = {
785 .hw = {
786 .clk = &gpt2_ick,
787 },
788 .ops = &clkhwops_iclk_wait,
789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
790 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
791 .clkdm_name = "core_l4_clkdm",
792};
793
794DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
795
796DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
797 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
798 OMAP24XX_CLKSEL_GPT3_MASK,
799 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
800 OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
801 gpt10_fck_parent_names, dss1_fck_ops);
802
803static struct clk gpt3_ick;
804
805static struct clk_hw_omap gpt3_ick_hw = {
806 .hw = {
807 .clk = &gpt3_ick,
808 },
809 .ops = &clkhwops_iclk_wait,
810 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
811 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
812 .clkdm_name = "core_l4_clkdm",
813};
814
815DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
816
817DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
818 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
819 OMAP24XX_CLKSEL_GPT4_MASK,
820 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
821 OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
822 gpt10_fck_parent_names, dss1_fck_ops);
823
824static struct clk gpt4_ick;
825
826static struct clk_hw_omap gpt4_ick_hw = {
827 .hw = {
828 .clk = &gpt4_ick,
829 },
830 .ops = &clkhwops_iclk_wait,
831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
832 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
833 .clkdm_name = "core_l4_clkdm",
834};
835
836DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
837
838DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
839 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
840 OMAP24XX_CLKSEL_GPT5_MASK,
841 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
842 OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
843 gpt10_fck_parent_names, dss1_fck_ops);
844
845static struct clk gpt5_ick;
846
847static struct clk_hw_omap gpt5_ick_hw = {
848 .hw = {
849 .clk = &gpt5_ick,
850 },
851 .ops = &clkhwops_iclk_wait,
852 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
853 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
854 .clkdm_name = "core_l4_clkdm",
855};
856
857DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
858
859DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
860 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
861 OMAP24XX_CLKSEL_GPT6_MASK,
862 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
863 OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
864 gpt10_fck_parent_names, dss1_fck_ops);
865
866static struct clk gpt6_ick;
867
868static struct clk_hw_omap gpt6_ick_hw = {
869 .hw = {
870 .clk = &gpt6_ick,
871 },
872 .ops = &clkhwops_iclk_wait,
873 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
874 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
875 .clkdm_name = "core_l4_clkdm",
876};
877
878DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
879
880DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
881 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
882 OMAP24XX_CLKSEL_GPT7_MASK,
883 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
884 OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
885 gpt10_fck_parent_names, dss1_fck_ops);
886
887static struct clk gpt7_ick;
888
889static struct clk_hw_omap gpt7_ick_hw = {
890 .hw = {
891 .clk = &gpt7_ick,
892 },
893 .ops = &clkhwops_iclk_wait,
894 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
895 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
896 .clkdm_name = "core_l4_clkdm",
897};
898
899DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
900
901DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
902 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
903 OMAP24XX_CLKSEL_GPT8_MASK,
904 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
905 OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
906 gpt10_fck_parent_names, dss1_fck_ops);
907
908static struct clk gpt8_ick;
909
910static struct clk_hw_omap gpt8_ick_hw = {
911 .hw = {
912 .clk = &gpt8_ick,
913 },
914 .ops = &clkhwops_iclk_wait,
915 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
916 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
917 .clkdm_name = "core_l4_clkdm",
918};
919
920DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
921
922DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
923 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
924 OMAP24XX_CLKSEL_GPT9_MASK,
925 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
926 OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
927 gpt10_fck_parent_names, dss1_fck_ops);
928
929static struct clk gpt9_ick;
930
931static struct clk_hw_omap gpt9_ick_hw = {
932 .hw = {
933 .clk = &gpt9_ick,
934 },
935 .ops = &clkhwops_iclk_wait,
936 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
937 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
938 .clkdm_name = "core_l4_clkdm",
939};
940
941DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
942
943static struct clk hdq_fck;
944
945static struct clk_hw_omap hdq_fck_hw = {
946 .hw = {
947 .clk = &hdq_fck,
948 },
949 .ops = &clkhwops_wait,
950 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
951 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
952 .clkdm_name = "core_l4_clkdm",
953};
954
955DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
956
957static struct clk hdq_ick;
958
959static struct clk_hw_omap hdq_ick_hw = {
960 .hw = {
961 .clk = &hdq_ick,
962 },
963 .ops = &clkhwops_iclk_wait,
964 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
965 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
966 .clkdm_name = "core_l4_clkdm",
967};
968
969DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
970
971static struct clk i2c1_fck;
972
973static struct clk_hw_omap i2c1_fck_hw = {
974 .hw = {
975 .clk = &i2c1_fck,
976 },
977 .ops = &clkhwops_wait,
978 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
979 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
980 .clkdm_name = "core_l4_clkdm",
981};
982
983DEFINE_STRUCT_CLK(i2c1_fck, fac_fck_parent_names, aes_ick_ops);
984
985static struct clk i2c1_ick;
986
987static struct clk_hw_omap i2c1_ick_hw = {
988 .hw = {
989 .clk = &i2c1_ick,
990 },
991 .ops = &clkhwops_iclk_wait,
992 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
993 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
994 .clkdm_name = "core_l4_clkdm",
995};
996
997DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
998
999static struct clk i2c2_fck;
1000
1001static struct clk_hw_omap i2c2_fck_hw = {
1002 .hw = {
1003 .clk = &i2c2_fck,
1004 },
1005 .ops = &clkhwops_wait,
1006 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1007 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1008 .clkdm_name = "core_l4_clkdm",
1009};
1010
1011DEFINE_STRUCT_CLK(i2c2_fck, fac_fck_parent_names, aes_ick_ops);
1012
1013static struct clk i2c2_ick;
1014
1015static struct clk_hw_omap i2c2_ick_hw = {
1016 .hw = {
1017 .clk = &i2c2_ick,
1018 },
1019 .ops = &clkhwops_iclk_wait,
1020 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1021 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1022 .clkdm_name = "core_l4_clkdm",
1023};
1024
1025DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
1026
1027DEFINE_CLK_OMAP_MUX_GATE(iva1_ifck, "iva1_clkdm", dsp_fck_clksel,
1028 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
1029 OMAP2420_CLKSEL_IVA_MASK,
1030 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1031 OMAP2420_EN_IVA_COP_SHIFT, &clkhwops_wait,
1032 dsp_fck_parent_names, dsp_fck_ops);
1033
1034static struct clk iva1_mpu_int_ifck;
1035
1036static const char *iva1_mpu_int_ifck_parent_names[] = {
1037 "iva1_ifck",
1038};
1039
1040static const struct clk_ops iva1_mpu_int_ifck_ops = {
1041 .init = &omap2_init_clk_clkdm,
1042 .enable = &omap2_dflt_clk_enable,
1043 .disable = &omap2_dflt_clk_disable,
1044 .is_enabled = &omap2_dflt_clk_is_enabled,
1045 .recalc_rate = &omap_fixed_divisor_recalc,
1046};
1047
1048static struct clk_hw_omap iva1_mpu_int_ifck_hw = {
1049 .hw = {
1050 .clk = &iva1_mpu_int_ifck,
1051 },
1052 .ops = &clkhwops_wait,
1053 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1054 .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
1055 .clkdm_name = "iva1_clkdm",
1056 .fixed_div = 2,
1057};
1058
1059DEFINE_STRUCT_CLK(iva1_mpu_int_ifck, iva1_mpu_int_ifck_parent_names,
1060 iva1_mpu_int_ifck_ops);
1061
1062static struct clk mailboxes_ick;
1063
1064static struct clk_hw_omap mailboxes_ick_hw = {
1065 .hw = {
1066 .clk = &mailboxes_ick,
1067 },
1068 .ops = &clkhwops_iclk_wait,
1069 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1070 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1071 .clkdm_name = "core_l4_clkdm",
1072};
1073
1074DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
1075
1076static const struct clksel_rate common_mcbsp_96m_rates[] = {
1077 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1078 { .div = 0 }
1079};
1080
1081static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1082 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1083 { .div = 0 }
1084};
1085
1086static const struct clksel mcbsp_fck_clksel[] = {
1087 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1088 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1089 { .parent = NULL },
1090};
1091
1092static const char *mcbsp1_fck_parent_names[] = {
1093 "func_96m_ck", "mcbsp_clks",
1094};
1095
1096DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1097 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1098 OMAP2_MCBSP1_CLKS_MASK,
1099 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1100 OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
1101 mcbsp1_fck_parent_names, dss1_fck_ops);
1102
1103static struct clk mcbsp1_ick;
1104
1105static struct clk_hw_omap mcbsp1_ick_hw = {
1106 .hw = {
1107 .clk = &mcbsp1_ick,
1108 },
1109 .ops = &clkhwops_iclk_wait,
1110 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1111 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1112 .clkdm_name = "core_l4_clkdm",
1113};
1114
1115DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
1116
1117DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1118 OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1119 OMAP2_MCBSP2_CLKS_MASK,
1120 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1121 OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
1122 mcbsp1_fck_parent_names, dss1_fck_ops);
1123
1124static struct clk mcbsp2_ick;
1125
1126static struct clk_hw_omap mcbsp2_ick_hw = {
1127 .hw = {
1128 .clk = &mcbsp2_ick,
1129 },
1130 .ops = &clkhwops_iclk_wait,
1131 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1132 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1133 .clkdm_name = "core_l4_clkdm",
1134};
1135
1136DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
1137
1138static struct clk mcspi1_fck;
1139
1140static const char *mcspi1_fck_parent_names[] = {
1141 "func_48m_ck",
1142};
1143
1144static struct clk_hw_omap mcspi1_fck_hw = {
1145 .hw = {
1146 .clk = &mcspi1_fck,
1147 },
1148 .ops = &clkhwops_wait,
1149 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1150 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1151 .clkdm_name = "core_l4_clkdm",
1152};
1153
1154DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1155
1156static struct clk mcspi1_ick;
1157
1158static struct clk_hw_omap mcspi1_ick_hw = {
1159 .hw = {
1160 .clk = &mcspi1_ick,
1161 },
1162 .ops = &clkhwops_iclk_wait,
1163 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1164 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1165 .clkdm_name = "core_l4_clkdm",
1166};
1167
1168DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
1169
1170static struct clk mcspi2_fck;
1171
1172static struct clk_hw_omap mcspi2_fck_hw = {
1173 .hw = {
1174 .clk = &mcspi2_fck,
1175 },
1176 .ops = &clkhwops_wait,
1177 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1178 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1179 .clkdm_name = "core_l4_clkdm",
1180};
1181
1182DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1183
1184static struct clk mcspi2_ick;
1185
1186static struct clk_hw_omap mcspi2_ick_hw = {
1187 .hw = {
1188 .clk = &mcspi2_ick,
1189 },
1190 .ops = &clkhwops_iclk_wait,
1191 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1192 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1193 .clkdm_name = "core_l4_clkdm",
1194};
1195
1196DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
1197
1198static struct clk mmc_fck;
1199
1200static struct clk_hw_omap mmc_fck_hw = {
1201 .hw = {
1202 .clk = &mmc_fck,
1203 },
1204 .ops = &clkhwops_wait,
1205 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1206 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1207 .clkdm_name = "core_l4_clkdm",
1208};
1209
1210DEFINE_STRUCT_CLK(mmc_fck, cam_fck_parent_names, aes_ick_ops);
1211
1212static struct clk mmc_ick;
1213
1214static struct clk_hw_omap mmc_ick_hw = {
1215 .hw = {
1216 .clk = &mmc_ick,
1217 },
1218 .ops = &clkhwops_iclk_wait,
1219 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1220 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1221 .clkdm_name = "core_l4_clkdm",
1222};
1223
1224DEFINE_STRUCT_CLK(mmc_ick, aes_ick_parent_names, aes_ick_ops);
1225
1226DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
1227 OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
1228 OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
1229 CLK_DIVIDER_ONE_BASED, NULL);
1230
1231static struct clk mpu_wdt_fck;
1232
1233static struct clk_hw_omap mpu_wdt_fck_hw = {
1234 .hw = {
1235 .clk = &mpu_wdt_fck,
1236 },
1237 .ops = &clkhwops_wait,
1238 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1239 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1240 .clkdm_name = "wkup_clkdm",
1241};
1242
1243DEFINE_STRUCT_CLK(mpu_wdt_fck, gpios_fck_parent_names, aes_ick_ops);
1244
1245static struct clk mpu_wdt_ick;
1246
1247static struct clk_hw_omap mpu_wdt_ick_hw = {
1248 .hw = {
1249 .clk = &mpu_wdt_ick,
1250 },
1251 .ops = &clkhwops_iclk_wait,
1252 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1253 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1254 .clkdm_name = "wkup_clkdm",
1255};
1256
1257DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
1258
1259static struct clk mspro_fck;
1260
1261static struct clk_hw_omap mspro_fck_hw = {
1262 .hw = {
1263 .clk = &mspro_fck,
1264 },
1265 .ops = &clkhwops_wait,
1266 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1267 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1268 .clkdm_name = "core_l4_clkdm",
1269};
1270
1271DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
1272
1273static struct clk mspro_ick;
1274
1275static struct clk_hw_omap mspro_ick_hw = {
1276 .hw = {
1277 .clk = &mspro_ick,
1278 },
1279 .ops = &clkhwops_iclk_wait,
1280 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1281 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1282 .clkdm_name = "core_l4_clkdm",
1283};
1284
1285DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
1286
1287static struct clk omapctrl_ick;
1288
1289static struct clk_hw_omap omapctrl_ick_hw = {
1290 .hw = {
1291 .clk = &omapctrl_ick,
1292 },
1293 .ops = &clkhwops_iclk_wait,
1294 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1295 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1296 .flags = ENABLE_ON_INIT,
1297 .clkdm_name = "wkup_clkdm",
1298};
1299
1300DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
1301
1302static struct clk pka_ick;
1303
1304static struct clk_hw_omap pka_ick_hw = {
1305 .hw = {
1306 .clk = &pka_ick,
1307 },
1308 .ops = &clkhwops_iclk_wait,
1309 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1310 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1311 .clkdm_name = "core_l4_clkdm",
1312};
1313
1314DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
1315
1316static struct clk rng_ick;
1317
1318static struct clk_hw_omap rng_ick_hw = {
1319 .hw = {
1320 .clk = &rng_ick,
1321 },
1322 .ops = &clkhwops_iclk_wait,
1323 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1324 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1325 .clkdm_name = "core_l4_clkdm",
1326};
1327
1328DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
1329
1330static struct clk sdma_fck;
1331
1332DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
1333DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
1334
1335static struct clk sdma_ick;
1336
1337static struct clk_hw_omap sdma_ick_hw = {
1338 .hw = {
1339 .clk = &sdma_ick,
1340 },
1341 .ops = &clkhwops_iclk,
1342 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1343 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1344 .clkdm_name = "core_l3_clkdm",
1345};
1346
1347DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
1348
1349static struct clk sdrc_ick;
1350
1351static struct clk_hw_omap sdrc_ick_hw = {
1352 .hw = {
1353 .clk = &sdrc_ick,
1354 },
1355 .ops = &clkhwops_iclk,
1356 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1357 .enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
1358 .flags = ENABLE_ON_INIT,
1359 .clkdm_name = "core_l3_clkdm",
1360};
1361
1362DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
1363
1364static struct clk sha_ick;
1365
1366static struct clk_hw_omap sha_ick_hw = {
1367 .hw = {
1368 .clk = &sha_ick,
1369 },
1370 .ops = &clkhwops_iclk_wait,
1371 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1372 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1373 .clkdm_name = "core_l4_clkdm",
1374};
1375
1376DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
1377
1378static struct clk ssi_l4_ick;
1379
1380static struct clk_hw_omap ssi_l4_ick_hw = {
1381 .hw = {
1382 .clk = &ssi_l4_ick,
1383 },
1384 .ops = &clkhwops_iclk_wait,
1385 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1386 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
1387 .clkdm_name = "core_l4_clkdm",
1388};
1389
1390DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
1391
1392static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
1393 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1394 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1395 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
1396 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1397 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1398 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1399 { .div = 0 }
1400};
1401
1402static const struct clksel ssi_ssr_sst_fck_clksel[] = {
1403 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
1404 { .parent = NULL },
1405};
1406
1407static const char *ssi_ssr_sst_fck_parent_names[] = {
1408 "core_ck",
1409};
1410
1411DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
1412 ssi_ssr_sst_fck_clksel,
1413 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1414 OMAP24XX_CLKSEL_SSI_MASK,
1415 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1416 OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
1417 ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
1418
1419static struct clk sync_32k_ick;
1420
1421static struct clk_hw_omap sync_32k_ick_hw = {
1422 .hw = {
1423 .clk = &sync_32k_ick,
1424 },
1425 .ops = &clkhwops_iclk_wait,
1426 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1427 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1428 .flags = ENABLE_ON_INIT,
1429 .clkdm_name = "wkup_clkdm",
1430};
1431
1432DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
1433
1434static const struct clksel_rate common_clkout_src_core_rates[] = {
1435 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1436 { .div = 0 }
1437};
1438
1439static const struct clksel_rate common_clkout_src_sys_rates[] = {
1440 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1441 { .div = 0 }
1442};
1443
1444static const struct clksel_rate common_clkout_src_96m_rates[] = {
1445 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
1446 { .div = 0 }
1447};
1448
1449static const struct clksel_rate common_clkout_src_54m_rates[] = {
1450 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
1451 { .div = 0 }
1452};
1453
1454static const struct clksel common_clkout_src_clksel[] = {
1455 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
1456 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
1457 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
1458 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
1459 { .parent = NULL },
1460};
1461
1462static const char *sys_clkout_src_parent_names[] = {
1463 "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
1464};
1465
1466DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
1467 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
1468 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
1469 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1470
1471DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
1472 OMAP2420_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
1473 OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1474
1475DEFINE_CLK_OMAP_MUX_GATE(sys_clkout2_src, "wkup_clkdm",
1476 common_clkout_src_clksel, OMAP2420_PRCM_CLKOUT_CTRL,
1477 OMAP2420_CLKOUT2_SOURCE_MASK,
1478 OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_EN_SHIFT,
1479 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1480
1481DEFINE_CLK_DIVIDER(sys_clkout2, "sys_clkout2_src", &sys_clkout2_src, 0x0,
1482 OMAP2420_PRCM_CLKOUT_CTRL, OMAP2420_CLKOUT2_DIV_SHIFT,
1483 OMAP2420_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1484
1485static struct clk uart1_fck;
1486
1487static struct clk_hw_omap uart1_fck_hw = {
1488 .hw = {
1489 .clk = &uart1_fck,
1490 },
1491 .ops = &clkhwops_wait,
1492 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1493 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1494 .clkdm_name = "core_l4_clkdm",
1495};
1496
1497DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1498
1499static struct clk uart1_ick;
1500
1501static struct clk_hw_omap uart1_ick_hw = {
1502 .hw = {
1503 .clk = &uart1_ick,
1504 },
1505 .ops = &clkhwops_iclk_wait,
1506 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1507 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1508 .clkdm_name = "core_l4_clkdm",
1509};
1510
1511DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
1512
1513static struct clk uart2_fck;
1514
1515static struct clk_hw_omap uart2_fck_hw = {
1516 .hw = {
1517 .clk = &uart2_fck,
1518 },
1519 .ops = &clkhwops_wait,
1520 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1521 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1522 .clkdm_name = "core_l4_clkdm",
1523};
1524
1525DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1526
1527static struct clk uart2_ick;
1528
1529static struct clk_hw_omap uart2_ick_hw = {
1530 .hw = {
1531 .clk = &uart2_ick,
1532 },
1533 .ops = &clkhwops_iclk_wait,
1534 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1535 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1536 .clkdm_name = "core_l4_clkdm",
1537};
1538
1539DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
1540
1541static struct clk uart3_fck;
1542
1543static struct clk_hw_omap uart3_fck_hw = {
1544 .hw = {
1545 .clk = &uart3_fck,
1546 },
1547 .ops = &clkhwops_wait,
1548 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1549 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1550 .clkdm_name = "core_l4_clkdm",
1551};
1552
1553DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1554
1555static struct clk uart3_ick;
1556
1557static struct clk_hw_omap uart3_ick_hw = {
1558 .hw = {
1559 .clk = &uart3_ick,
1560 },
1561 .ops = &clkhwops_iclk_wait,
1562 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1563 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1564 .clkdm_name = "core_l4_clkdm",
1565};
1566
1567DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
1568
1569static struct clk usb_fck;
1570
1571static struct clk_hw_omap usb_fck_hw = {
1572 .hw = {
1573 .clk = &usb_fck,
1574 },
1575 .ops = &clkhwops_wait,
1576 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1577 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1578 .clkdm_name = "core_l3_clkdm",
1579};
1580
1581DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
1582
1583static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
1584 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1585 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1586 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1587 { .div = 0 }
1588};
1589
1590static const struct clksel usb_l4_ick_clksel[] = {
1591 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
1592 { .parent = NULL },
1593};
1594
1595static const char *usb_l4_ick_parent_names[] = {
1596 "core_l3_ck",
1597};
1598
1599DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
1600 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1601 OMAP24XX_CLKSEL_USB_MASK,
1602 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1603 OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
1604 usb_l4_ick_parent_names, dsp_fck_ops);
1605
1606static struct clk virt_prcm_set;
1607
1608static const char *virt_prcm_set_parent_names[] = {
1609 "mpu_ck",
1610};
1611
1612static const struct clk_ops virt_prcm_set_ops = {
1613 .recalc_rate = &omap2_table_mpu_recalc,
1614 .set_rate = &omap2_select_table_rate,
1615 .round_rate = &omap2_round_to_table_rate,
1616};
1617
1618DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
1619DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
1620
1621static const struct clksel_rate vlynq_fck_96m_rates[] = {
1622 { .div = 1, .val = 0, .flags = RATE_IN_242X },
1623 { .div = 0 }
1624};
1625
1626static const struct clksel_rate vlynq_fck_core_rates[] = {
1627 { .div = 1, .val = 1, .flags = RATE_IN_242X },
1628 { .div = 2, .val = 2, .flags = RATE_IN_242X },
1629 { .div = 3, .val = 3, .flags = RATE_IN_242X },
1630 { .div = 4, .val = 4, .flags = RATE_IN_242X },
1631 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1632 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1633 { .div = 9, .val = 9, .flags = RATE_IN_242X },
1634 { .div = 12, .val = 12, .flags = RATE_IN_242X },
1635 { .div = 16, .val = 16, .flags = RATE_IN_242X },
1636 { .div = 18, .val = 18, .flags = RATE_IN_242X },
1637 { .div = 0 }
1638};
1639
1640static const struct clksel vlynq_fck_clksel[] = {
1641 { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
1642 { .parent = &core_ck, .rates = vlynq_fck_core_rates },
1643 { .parent = NULL },
1644};
1645
1646static const char *vlynq_fck_parent_names[] = {
1647 "func_96m_ck", "core_ck",
1648};
1649
1650DEFINE_CLK_OMAP_MUX_GATE(vlynq_fck, "core_l3_clkdm", vlynq_fck_clksel,
1651 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1652 OMAP2420_CLKSEL_VLYNQ_MASK,
1653 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1654 OMAP2420_EN_VLYNQ_SHIFT, &clkhwops_wait,
1655 vlynq_fck_parent_names, dss1_fck_ops);
1656
1657static struct clk vlynq_ick;
1658
1659static struct clk_hw_omap vlynq_ick_hw = {
1660 .hw = {
1661 .clk = &vlynq_ick,
1662 },
1663 .ops = &clkhwops_iclk_wait,
1664 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1665 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1666 .clkdm_name = "core_l3_clkdm",
1667};
1668
1669DEFINE_STRUCT_CLK(vlynq_ick, gfx_ick_parent_names, aes_ick_ops);
1670
1671static struct clk wdt1_ick;
1672
1673static struct clk_hw_omap wdt1_ick_hw = {
1674 .hw = {
1675 .clk = &wdt1_ick,
1676 },
1677 .ops = &clkhwops_iclk_wait,
1678 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1679 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1680 .clkdm_name = "wkup_clkdm",
1681};
1682
1683DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
1684
1685static struct clk wdt1_osc_ck;
1686
1687static const struct clk_ops wdt1_osc_ck_ops = {};
1688
1689DEFINE_STRUCT_CLK_HW_OMAP(wdt1_osc_ck, NULL);
1690DEFINE_STRUCT_CLK(wdt1_osc_ck, sys_ck_parent_names, wdt1_osc_ck_ops);
1691
1692static struct clk wdt3_fck;
1693
1694static struct clk_hw_omap wdt3_fck_hw = {
1695 .hw = {
1696 .clk = &wdt3_fck,
1697 },
1698 .ops = &clkhwops_wait,
1699 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1700 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1701 .clkdm_name = "core_l4_clkdm",
1702};
1703
1704DEFINE_STRUCT_CLK(wdt3_fck, gpios_fck_parent_names, aes_ick_ops);
1705
1706static struct clk wdt3_ick;
1707
1708static struct clk_hw_omap wdt3_ick_hw = {
1709 .hw = {
1710 .clk = &wdt3_ick,
1711 },
1712 .ops = &clkhwops_iclk_wait,
1713 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1714 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1715 .clkdm_name = "core_l4_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(wdt3_ick, aes_ick_parent_names, aes_ick_ops);
1719
1720static struct clk wdt4_fck;
1721
1722static struct clk_hw_omap wdt4_fck_hw = {
1723 .hw = {
1724 .clk = &wdt4_fck,
1725 },
1726 .ops = &clkhwops_wait,
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1728 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1729 .clkdm_name = "core_l4_clkdm",
1730};
1731
1732DEFINE_STRUCT_CLK(wdt4_fck, gpios_fck_parent_names, aes_ick_ops);
1733
1734static struct clk wdt4_ick;
1735
1736static struct clk_hw_omap wdt4_ick_hw = {
1737 .hw = {
1738 .clk = &wdt4_ick,
1739 },
1740 .ops = &clkhwops_iclk_wait,
1741 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1742 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1743 .clkdm_name = "core_l4_clkdm",
1744};
1745
1746DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1747
1748/*
1749 * clkdev integration
1750 */
1751
1752static struct omap_clk omap2420_clks[] = {
1753 /* external root sources */
1754 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_242X),
1755 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_242X),
1756 CLK(NULL, "osc_ck", &osc_ck, CK_242X),
1757 CLK(NULL, "sys_ck", &sys_ck, CK_242X),
1758 CLK(NULL, "alt_ck", &alt_ck, CK_242X),
1759 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X),
1760 /* internal analog sources */
1761 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X),
1762 CLK(NULL, "apll96_ck", &apll96_ck, CK_242X),
1763 CLK(NULL, "apll54_ck", &apll54_ck, CK_242X),
1764 /* internal prcm root sources */
1765 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X),
1766 CLK(NULL, "core_ck", &core_ck, CK_242X),
1767 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X),
1768 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X),
1769 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X),
1770 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_242X),
1771 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_242X),
1772 CLK(NULL, "sys_clkout", &sys_clkout, CK_242X),
1773 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
1774 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
1775 CLK(NULL, "emul_ck", &emul_ck, CK_242X),
1776 /* mpu domain clocks */
1777 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X),
1778 /* dsp domain clocks */
1779 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X),
1780 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
1781 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
1782 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
1783 /* GFX domain clocks */
1784 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_242X),
1785 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_242X),
1786 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X),
1787 /* DSS domain clocks */
1788 CLK("omapdss_dss", "ick", &dss_ick, CK_242X),
1789 CLK(NULL, "dss_ick", &dss_ick, CK_242X),
1790 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X),
1791 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X),
1792 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X),
1793 /* L3 domain clocks */
1794 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X),
1795 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X),
1796 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_242X),
1797 /* L4 domain clocks */
1798 CLK(NULL, "l4_ck", &l4_ck, CK_242X),
1799 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X),
1800 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_242X),
1801 /* virtual meta-group clock */
1802 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X),
1803 /* general l4 interface ck, multi-parent functional clk */
1804 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_242X),
1805 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_242X),
1806 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_242X),
1807 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_242X),
1808 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_242X),
1809 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_242X),
1810 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_242X),
1811 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_242X),
1812 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_242X),
1813 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_242X),
1814 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_242X),
1815 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_242X),
1816 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_242X),
1817 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_242X),
1818 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_242X),
1819 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_242X),
1820 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_242X),
1821 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_242X),
1822 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_242X),
1823 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_242X),
1824 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_242X),
1825 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_242X),
1826 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X),
1827 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X),
1828 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X),
1829 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_242X),
1830 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X),
1831 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X),
1832 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_242X),
1833 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X),
1834 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X),
1835 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_242X),
1836 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X),
1837 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X),
1838 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_242X),
1839 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X),
1840 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X),
1841 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X),
1842 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X),
1843 CLK(NULL, "uart2_fck", &uart2_fck, CK_242X),
1844 CLK(NULL, "uart3_ick", &uart3_ick, CK_242X),
1845 CLK(NULL, "uart3_fck", &uart3_fck, CK_242X),
1846 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X),
1847 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
1848 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
1849 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_242X),
1850 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X),
1851 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
1852 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
1853 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
1854 CLK("omap24xxcam", "fck", &cam_fck, CK_242X),
1855 CLK(NULL, "cam_fck", &cam_fck, CK_242X),
1856 CLK("omap24xxcam", "ick", &cam_ick, CK_242X),
1857 CLK(NULL, "cam_ick", &cam_ick, CK_242X),
1858 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X),
1859 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X),
1860 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X),
1861 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
1862 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
1863 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X),
1864 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X),
1865 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
1866 CLK(NULL, "mmc_ick", &mmc_ick, CK_242X),
1867 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
1868 CLK(NULL, "mmc_fck", &mmc_fck, CK_242X),
1869 CLK(NULL, "fac_ick", &fac_ick, CK_242X),
1870 CLK(NULL, "fac_fck", &fac_fck, CK_242X),
1871 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
1872 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
1873 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X),
1874 CLK(NULL, "hdq_ick", &hdq_ick, CK_242X),
1875 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X),
1876 CLK(NULL, "hdq_fck", &hdq_fck, CK_242X),
1877 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X),
1878 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_242X),
1879 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X),
1880 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X),
1881 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_242X),
1882 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X),
1883 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1884 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
1885 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X),
1886 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_242X),
1887 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
1888 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
1889 CLK(NULL, "des_ick", &des_ick, CK_242X),
1890 CLK("omap-sham", "ick", &sha_ick, CK_242X),
1891 CLK(NULL, "sha_ick", &sha_ick, CK_242X),
1892 CLK("omap_rng", "ick", &rng_ick, CK_242X),
1893 CLK(NULL, "rng_ick", &rng_ick, CK_242X),
1894 CLK("omap-aes", "ick", &aes_ick, CK_242X),
1895 CLK(NULL, "aes_ick", &aes_ick, CK_242X),
1896 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1897 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1898 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1899 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_242X),
1900 CLK(NULL, "timer_sys_ck", &sys_ck, CK_242X),
1901 CLK(NULL, "timer_ext_ck", &alt_ck, CK_242X),
1902 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X),
1903};
1904
1905
1906static const char *enable_init_clks[] = {
1907 "apll96_ck",
1908 "apll54_ck",
1909 "sync_32k_ick",
1910 "omapctrl_ick",
1911 "gpmc_fck",
1912 "sdrc_ick",
1913};
1914
1915/*
1916 * init code
1917 */
1918
1919int __init omap2420_clk_init(void)
1920{
1921 struct omap_clk *c;
1922
1923 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1924 cpu_mask = RATE_IN_242X;
1925 rate_table = omap2420_rate_table;
1926
1927 omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
1928
1929 omap2xxx_clkt_vps_check_bootloader_rates();
1930
1931 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1932 c++) {
1933 clkdev_add(&c->lk);
1934 if (!__clk_init(NULL, c->lk.clk))
1935 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1936 }
1937
1938 omap2_clk_disable_autoidle_all();
1939
1940 omap2_clk_enable_init_clocks(enable_init_clks,
1941 ARRAY_SIZE(enable_init_clks));
1942
1943 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
1944 (clk_get_rate(&sys_ck) / 1000000),
1945 (clk_get_rate(&sys_ck) / 100000) % 10,
1946 (clk_get_rate(&dpll_ck) / 1000000),
1947 (clk_get_rate(&mpu_ck) / 1000000));
1948
1949 return 0;
1950}
diff --git a/arch/arm/mach-omap2/cclock2430_data.c b/arch/arm/mach-omap2/cclock2430_data.c
new file mode 100644
index 000000000000..eda079b96c6a
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock2430_data.c
@@ -0,0 +1,2065 @@
1/*
2 * OMAP2430 clock data
3 *
4 * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/clk.h>
18#include <linux/clk-private.h>
19#include <linux/list.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "clock.h"
24#include "clock2xxx.h"
25#include "opp2xxx.h"
26#include "cm2xxx.h"
27#include "prm2xxx.h"
28#include "prm-regbits-24xx.h"
29#include "cm-regbits-24xx.h"
30#include "sdrc.h"
31#include "control.h"
32
33#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
34
35/*
36 * 2430 clock tree.
37 *
38 * NOTE:In many cases here we are assigning a 'default' parent. In
39 * many cases the parent is selectable. The set parent calls will
40 * also switch sources.
41 *
42 * Several sources are given initial rates which may be wrong, this will
43 * be fixed up in the init func.
44 *
45 * Things are broadly separated below by clock domains. It is
46 * noteworthy that most peripherals have dependencies on multiple clock
47 * domains. Many get their interface clocks from the L4 domain, but get
48 * functional clocks from fixed sources or other core domain derived
49 * clocks.
50 */
51
52DEFINE_CLK_FIXED_RATE(alt_ck, CLK_IS_ROOT, 54000000, 0x0);
53
54DEFINE_CLK_FIXED_RATE(func_32k_ck, CLK_IS_ROOT, 32768, 0x0);
55
56DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
57
58static struct clk osc_ck;
59
60static const struct clk_ops osc_ck_ops = {
61 .enable = &omap2_enable_osc_ck,
62 .disable = omap2_disable_osc_ck,
63 .recalc_rate = &omap2_osc_clk_recalc,
64};
65
66static struct clk_hw_omap osc_ck_hw = {
67 .hw = {
68 .clk = &osc_ck,
69 },
70};
71
72static struct clk osc_ck = {
73 .name = "osc_ck",
74 .ops = &osc_ck_ops,
75 .hw = &osc_ck_hw.hw,
76 .flags = CLK_IS_ROOT,
77};
78
79DEFINE_CLK_FIXED_RATE(secure_32k_ck, CLK_IS_ROOT, 32768, 0x0);
80
81static struct clk sys_ck;
82
83static const char *sys_ck_parent_names[] = {
84 "osc_ck",
85};
86
87static const struct clk_ops sys_ck_ops = {
88 .init = &omap2_init_clk_clkdm,
89 .recalc_rate = &omap2xxx_sys_clk_recalc,
90};
91
92DEFINE_STRUCT_CLK_HW_OMAP(sys_ck, "wkup_clkdm");
93DEFINE_STRUCT_CLK(sys_ck, sys_ck_parent_names, sys_ck_ops);
94
95static struct dpll_data dpll_dd = {
96 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
97 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
98 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
99 .clk_bypass = &sys_ck,
100 .clk_ref = &sys_ck,
101 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
102 .enable_mask = OMAP24XX_EN_DPLL_MASK,
103 .max_multiplier = 1023,
104 .min_divider = 1,
105 .max_divider = 16,
106};
107
108static struct clk dpll_ck;
109
110static const char *dpll_ck_parent_names[] = {
111 "sys_ck",
112};
113
114static const struct clk_ops dpll_ck_ops = {
115 .init = &omap2_init_clk_clkdm,
116 .get_parent = &omap2_init_dpll_parent,
117 .recalc_rate = &omap2_dpllcore_recalc,
118 .round_rate = &omap2_dpll_round_rate,
119 .set_rate = &omap2_reprogram_dpllcore,
120};
121
122static struct clk_hw_omap dpll_ck_hw = {
123 .hw = {
124 .clk = &dpll_ck,
125 },
126 .ops = &clkhwops_omap2xxx_dpll,
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129};
130
131DEFINE_STRUCT_CLK(dpll_ck, dpll_ck_parent_names, dpll_ck_ops);
132
133static struct clk core_ck;
134
135static const char *core_ck_parent_names[] = {
136 "dpll_ck",
137};
138
139static const struct clk_ops core_ck_ops = {
140 .init = &omap2_init_clk_clkdm,
141};
142
143DEFINE_STRUCT_CLK_HW_OMAP(core_ck, "wkup_clkdm");
144DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
145
146DEFINE_CLK_DIVIDER(core_l3_ck, "core_ck", &core_ck, 0x0,
147 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
148 OMAP24XX_CLKSEL_L3_SHIFT, OMAP24XX_CLKSEL_L3_WIDTH,
149 CLK_DIVIDER_ONE_BASED, NULL);
150
151DEFINE_CLK_DIVIDER(l4_ck, "core_l3_ck", &core_l3_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
153 OMAP24XX_CLKSEL_L4_SHIFT, OMAP24XX_CLKSEL_L4_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156static struct clk aes_ick;
157
158static const char *aes_ick_parent_names[] = {
159 "l4_ck",
160};
161
162static const struct clk_ops aes_ick_ops = {
163 .init = &omap2_init_clk_clkdm,
164 .enable = &omap2_dflt_clk_enable,
165 .disable = &omap2_dflt_clk_disable,
166 .is_enabled = &omap2_dflt_clk_is_enabled,
167};
168
169static struct clk_hw_omap aes_ick_hw = {
170 .hw = {
171 .clk = &aes_ick,
172 },
173 .ops = &clkhwops_iclk_wait,
174 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
175 .enable_bit = OMAP24XX_EN_AES_SHIFT,
176 .clkdm_name = "core_l4_clkdm",
177};
178
179DEFINE_STRUCT_CLK(aes_ick, aes_ick_parent_names, aes_ick_ops);
180
181static struct clk apll54_ck;
182
183static const struct clk_ops apll54_ck_ops = {
184 .init = &omap2_init_clk_clkdm,
185 .enable = &omap2_clk_apll54_enable,
186 .disable = &omap2_clk_apll54_disable,
187 .recalc_rate = &omap2_clk_apll54_recalc,
188};
189
190static struct clk_hw_omap apll54_ck_hw = {
191 .hw = {
192 .clk = &apll54_ck,
193 },
194 .ops = &clkhwops_apll54,
195 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
196 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
197 .flags = ENABLE_ON_INIT,
198 .clkdm_name = "wkup_clkdm",
199};
200
201DEFINE_STRUCT_CLK(apll54_ck, dpll_ck_parent_names, apll54_ck_ops);
202
203static struct clk apll96_ck;
204
205static const struct clk_ops apll96_ck_ops = {
206 .init = &omap2_init_clk_clkdm,
207 .enable = &omap2_clk_apll96_enable,
208 .disable = &omap2_clk_apll96_disable,
209 .recalc_rate = &omap2_clk_apll96_recalc,
210};
211
212static struct clk_hw_omap apll96_ck_hw = {
213 .hw = {
214 .clk = &apll96_ck,
215 },
216 .ops = &clkhwops_apll96,
217 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
218 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
219 .flags = ENABLE_ON_INIT,
220 .clkdm_name = "wkup_clkdm",
221};
222
223DEFINE_STRUCT_CLK(apll96_ck, dpll_ck_parent_names, apll96_ck_ops);
224
225static const char *func_96m_ck_parent_names[] = {
226 "apll96_ck", "alt_ck",
227};
228
229DEFINE_CLK_MUX(func_96m_ck, func_96m_ck_parent_names, NULL, 0x0,
230 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP2430_96M_SOURCE_SHIFT,
231 OMAP2430_96M_SOURCE_WIDTH, 0x0, NULL);
232
233static struct clk cam_fck;
234
235static const char *cam_fck_parent_names[] = {
236 "func_96m_ck",
237};
238
239static struct clk_hw_omap cam_fck_hw = {
240 .hw = {
241 .clk = &cam_fck,
242 },
243 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
244 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
245 .clkdm_name = "core_l3_clkdm",
246};
247
248DEFINE_STRUCT_CLK(cam_fck, cam_fck_parent_names, aes_ick_ops);
249
250static struct clk cam_ick;
251
252static struct clk_hw_omap cam_ick_hw = {
253 .hw = {
254 .clk = &cam_ick,
255 },
256 .ops = &clkhwops_iclk,
257 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
258 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
259 .clkdm_name = "core_l4_clkdm",
260};
261
262DEFINE_STRUCT_CLK(cam_ick, aes_ick_parent_names, aes_ick_ops);
263
264static struct clk des_ick;
265
266static struct clk_hw_omap des_ick_hw = {
267 .hw = {
268 .clk = &des_ick,
269 },
270 .ops = &clkhwops_iclk_wait,
271 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
272 .enable_bit = OMAP24XX_EN_DES_SHIFT,
273 .clkdm_name = "core_l4_clkdm",
274};
275
276DEFINE_STRUCT_CLK(des_ick, aes_ick_parent_names, aes_ick_ops);
277
278static const struct clksel_rate dsp_fck_core_rates[] = {
279 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
280 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
281 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
282 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
283 { .div = 0 }
284};
285
286static const struct clksel dsp_fck_clksel[] = {
287 { .parent = &core_ck, .rates = dsp_fck_core_rates },
288 { .parent = NULL },
289};
290
291static const char *dsp_fck_parent_names[] = {
292 "core_ck",
293};
294
295static struct clk dsp_fck;
296
297static const struct clk_ops dsp_fck_ops = {
298 .init = &omap2_init_clk_clkdm,
299 .enable = &omap2_dflt_clk_enable,
300 .disable = &omap2_dflt_clk_disable,
301 .is_enabled = &omap2_dflt_clk_is_enabled,
302 .recalc_rate = &omap2_clksel_recalc,
303 .set_rate = &omap2_clksel_set_rate,
304 .round_rate = &omap2_clksel_round_rate,
305};
306
307DEFINE_CLK_OMAP_MUX_GATE(dsp_fck, "dsp_clkdm", dsp_fck_clksel,
308 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
309 OMAP24XX_CLKSEL_DSP_MASK,
310 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
311 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
312 dsp_fck_parent_names, dsp_fck_ops);
313
314static const struct clksel_rate dss1_fck_sys_rates[] = {
315 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
316 { .div = 0 }
317};
318
319static const struct clksel_rate dss1_fck_core_rates[] = {
320 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
321 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
322 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
323 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
324 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
325 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
326 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
327 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
328 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
329 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
330 { .div = 0 }
331};
332
333static const struct clksel dss1_fck_clksel[] = {
334 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
335 { .parent = &core_ck, .rates = dss1_fck_core_rates },
336 { .parent = NULL },
337};
338
339static const char *dss1_fck_parent_names[] = {
340 "sys_ck", "core_ck",
341};
342
343static const struct clk_ops dss1_fck_ops = {
344 .init = &omap2_init_clk_clkdm,
345 .enable = &omap2_dflt_clk_enable,
346 .disable = &omap2_dflt_clk_disable,
347 .is_enabled = &omap2_dflt_clk_is_enabled,
348 .recalc_rate = &omap2_clksel_recalc,
349 .get_parent = &omap2_clksel_find_parent_index,
350 .set_parent = &omap2_clksel_set_parent,
351};
352
353DEFINE_CLK_OMAP_MUX_GATE(dss1_fck, "dss_clkdm", dss1_fck_clksel,
354 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
355 OMAP24XX_CLKSEL_DSS1_MASK,
356 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
357 OMAP24XX_EN_DSS1_SHIFT, NULL,
358 dss1_fck_parent_names, dss1_fck_ops);
359
360static const struct clksel_rate dss2_fck_sys_rates[] = {
361 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
362 { .div = 0 }
363};
364
365static const struct clksel_rate dss2_fck_48m_rates[] = {
366 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
367 { .div = 0 }
368};
369
370static const struct clksel_rate func_48m_apll96_rates[] = {
371 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
372 { .div = 0 }
373};
374
375static const struct clksel_rate func_48m_alt_rates[] = {
376 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
377 { .div = 0 }
378};
379
380static const struct clksel func_48m_clksel[] = {
381 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
382 { .parent = &alt_ck, .rates = func_48m_alt_rates },
383 { .parent = NULL },
384};
385
386static const char *func_48m_ck_parent_names[] = {
387 "apll96_ck", "alt_ck",
388};
389
390static struct clk func_48m_ck;
391
392static const struct clk_ops func_48m_ck_ops = {
393 .init = &omap2_init_clk_clkdm,
394 .recalc_rate = &omap2_clksel_recalc,
395 .set_rate = &omap2_clksel_set_rate,
396 .round_rate = &omap2_clksel_round_rate,
397 .get_parent = &omap2_clksel_find_parent_index,
398 .set_parent = &omap2_clksel_set_parent,
399};
400
401static struct clk_hw_omap func_48m_ck_hw = {
402 .hw = {
403 .clk = &func_48m_ck,
404 },
405 .clksel = func_48m_clksel,
406 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
407 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
408 .clkdm_name = "wkup_clkdm",
409};
410
411DEFINE_STRUCT_CLK(func_48m_ck, func_48m_ck_parent_names, func_48m_ck_ops);
412
413static const struct clksel dss2_fck_clksel[] = {
414 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
415 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
416 { .parent = NULL },
417};
418
419static const char *dss2_fck_parent_names[] = {
420 "sys_ck", "func_48m_ck",
421};
422
423DEFINE_CLK_OMAP_MUX_GATE(dss2_fck, "dss_clkdm", dss2_fck_clksel,
424 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
425 OMAP24XX_CLKSEL_DSS2_MASK,
426 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
427 OMAP24XX_EN_DSS2_SHIFT, NULL,
428 dss2_fck_parent_names, dss1_fck_ops);
429
430static const char *func_54m_ck_parent_names[] = {
431 "apll54_ck", "alt_ck",
432};
433
434DEFINE_CLK_MUX(func_54m_ck, func_54m_ck_parent_names, NULL, 0x0,
435 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
436 OMAP24XX_54M_SOURCE_SHIFT, OMAP24XX_54M_SOURCE_WIDTH, 0x0, NULL);
437
438static struct clk dss_54m_fck;
439
440static const char *dss_54m_fck_parent_names[] = {
441 "func_54m_ck",
442};
443
444static struct clk_hw_omap dss_54m_fck_hw = {
445 .hw = {
446 .clk = &dss_54m_fck,
447 },
448 .ops = &clkhwops_wait,
449 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
450 .enable_bit = OMAP24XX_EN_TV_SHIFT,
451 .clkdm_name = "dss_clkdm",
452};
453
454DEFINE_STRUCT_CLK(dss_54m_fck, dss_54m_fck_parent_names, aes_ick_ops);
455
456static struct clk dss_ick;
457
458static struct clk_hw_omap dss_ick_hw = {
459 .hw = {
460 .clk = &dss_ick,
461 },
462 .ops = &clkhwops_iclk,
463 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
464 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
465 .clkdm_name = "dss_clkdm",
466};
467
468DEFINE_STRUCT_CLK(dss_ick, aes_ick_parent_names, aes_ick_ops);
469
470static struct clk emul_ck;
471
472static struct clk_hw_omap emul_ck_hw = {
473 .hw = {
474 .clk = &emul_ck,
475 },
476 .enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
477 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
478 .clkdm_name = "wkup_clkdm",
479};
480
481DEFINE_STRUCT_CLK(emul_ck, dss_54m_fck_parent_names, aes_ick_ops);
482
483DEFINE_CLK_FIXED_FACTOR(func_12m_ck, "func_48m_ck", &func_48m_ck, 0x0, 1, 4);
484
485static struct clk fac_fck;
486
487static const char *fac_fck_parent_names[] = {
488 "func_12m_ck",
489};
490
491static struct clk_hw_omap fac_fck_hw = {
492 .hw = {
493 .clk = &fac_fck,
494 },
495 .ops = &clkhwops_wait,
496 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
497 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
498 .clkdm_name = "core_l4_clkdm",
499};
500
501DEFINE_STRUCT_CLK(fac_fck, fac_fck_parent_names, aes_ick_ops);
502
503static struct clk fac_ick;
504
505static struct clk_hw_omap fac_ick_hw = {
506 .hw = {
507 .clk = &fac_ick,
508 },
509 .ops = &clkhwops_iclk_wait,
510 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
511 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
512 .clkdm_name = "core_l4_clkdm",
513};
514
515DEFINE_STRUCT_CLK(fac_ick, aes_ick_parent_names, aes_ick_ops);
516
517static const struct clksel gfx_fck_clksel[] = {
518 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
519 { .parent = NULL },
520};
521
522static const char *gfx_2d_fck_parent_names[] = {
523 "core_l3_ck",
524};
525
526DEFINE_CLK_OMAP_MUX_GATE(gfx_2d_fck, "gfx_clkdm", gfx_fck_clksel,
527 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
528 OMAP_CLKSEL_GFX_MASK,
529 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
530 OMAP24XX_EN_2D_SHIFT, &clkhwops_wait,
531 gfx_2d_fck_parent_names, dsp_fck_ops);
532
533DEFINE_CLK_OMAP_MUX_GATE(gfx_3d_fck, "gfx_clkdm", gfx_fck_clksel,
534 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
535 OMAP_CLKSEL_GFX_MASK,
536 OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
537 OMAP24XX_EN_3D_SHIFT, &clkhwops_wait,
538 gfx_2d_fck_parent_names, dsp_fck_ops);
539
540static struct clk gfx_ick;
541
542static const char *gfx_ick_parent_names[] = {
543 "core_l3_ck",
544};
545
546static struct clk_hw_omap gfx_ick_hw = {
547 .hw = {
548 .clk = &gfx_ick,
549 },
550 .ops = &clkhwops_wait,
551 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
552 .enable_bit = OMAP_EN_GFX_SHIFT,
553 .clkdm_name = "gfx_clkdm",
554};
555
556DEFINE_STRUCT_CLK(gfx_ick, gfx_ick_parent_names, aes_ick_ops);
557
558static struct clk gpio5_fck;
559
560static const char *gpio5_fck_parent_names[] = {
561 "func_32k_ck",
562};
563
564static struct clk_hw_omap gpio5_fck_hw = {
565 .hw = {
566 .clk = &gpio5_fck,
567 },
568 .ops = &clkhwops_wait,
569 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
570 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
571 .clkdm_name = "core_l4_clkdm",
572};
573
574DEFINE_STRUCT_CLK(gpio5_fck, gpio5_fck_parent_names, aes_ick_ops);
575
576static struct clk gpio5_ick;
577
578static struct clk_hw_omap gpio5_ick_hw = {
579 .hw = {
580 .clk = &gpio5_ick,
581 },
582 .ops = &clkhwops_iclk_wait,
583 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
584 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
585 .clkdm_name = "core_l4_clkdm",
586};
587
588DEFINE_STRUCT_CLK(gpio5_ick, aes_ick_parent_names, aes_ick_ops);
589
590static struct clk gpios_fck;
591
592static struct clk_hw_omap gpios_fck_hw = {
593 .hw = {
594 .clk = &gpios_fck,
595 },
596 .ops = &clkhwops_wait,
597 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
598 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
599 .clkdm_name = "wkup_clkdm",
600};
601
602DEFINE_STRUCT_CLK(gpios_fck, gpio5_fck_parent_names, aes_ick_ops);
603
604static struct clk wu_l4_ick;
605
606DEFINE_STRUCT_CLK_HW_OMAP(wu_l4_ick, "wkup_clkdm");
607DEFINE_STRUCT_CLK(wu_l4_ick, dpll_ck_parent_names, core_ck_ops);
608
609static struct clk gpios_ick;
610
611static const char *gpios_ick_parent_names[] = {
612 "wu_l4_ick",
613};
614
615static struct clk_hw_omap gpios_ick_hw = {
616 .hw = {
617 .clk = &gpios_ick,
618 },
619 .ops = &clkhwops_iclk_wait,
620 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
621 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
622 .clkdm_name = "wkup_clkdm",
623};
624
625DEFINE_STRUCT_CLK(gpios_ick, gpios_ick_parent_names, aes_ick_ops);
626
627static struct clk gpmc_fck;
628
629static struct clk_hw_omap gpmc_fck_hw = {
630 .hw = {
631 .clk = &gpmc_fck,
632 },
633 .ops = &clkhwops_iclk,
634 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
635 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
636 .flags = ENABLE_ON_INIT,
637 .clkdm_name = "core_l3_clkdm",
638};
639
640DEFINE_STRUCT_CLK(gpmc_fck, gfx_ick_parent_names, core_ck_ops);
641
642static const struct clksel_rate gpt_alt_rates[] = {
643 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
644 { .div = 0 }
645};
646
647static const struct clksel omap24xx_gpt_clksel[] = {
648 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
649 { .parent = &sys_ck, .rates = gpt_sys_rates },
650 { .parent = &alt_ck, .rates = gpt_alt_rates },
651 { .parent = NULL },
652};
653
654static const char *gpt10_fck_parent_names[] = {
655 "func_32k_ck", "sys_ck", "alt_ck",
656};
657
658DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
659 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
660 OMAP24XX_CLKSEL_GPT10_MASK,
661 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
662 OMAP24XX_EN_GPT10_SHIFT, &clkhwops_wait,
663 gpt10_fck_parent_names, dss1_fck_ops);
664
665static struct clk gpt10_ick;
666
667static struct clk_hw_omap gpt10_ick_hw = {
668 .hw = {
669 .clk = &gpt10_ick,
670 },
671 .ops = &clkhwops_iclk_wait,
672 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
673 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
674 .clkdm_name = "core_l4_clkdm",
675};
676
677DEFINE_STRUCT_CLK(gpt10_ick, aes_ick_parent_names, aes_ick_ops);
678
679DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
680 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
681 OMAP24XX_CLKSEL_GPT11_MASK,
682 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
683 OMAP24XX_EN_GPT11_SHIFT, &clkhwops_wait,
684 gpt10_fck_parent_names, dss1_fck_ops);
685
686static struct clk gpt11_ick;
687
688static struct clk_hw_omap gpt11_ick_hw = {
689 .hw = {
690 .clk = &gpt11_ick,
691 },
692 .ops = &clkhwops_iclk_wait,
693 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
694 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
695 .clkdm_name = "core_l4_clkdm",
696};
697
698DEFINE_STRUCT_CLK(gpt11_ick, aes_ick_parent_names, aes_ick_ops);
699
700DEFINE_CLK_OMAP_MUX_GATE(gpt12_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
701 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
702 OMAP24XX_CLKSEL_GPT12_MASK,
703 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
704 OMAP24XX_EN_GPT12_SHIFT, &clkhwops_wait,
705 gpt10_fck_parent_names, dss1_fck_ops);
706
707static struct clk gpt12_ick;
708
709static struct clk_hw_omap gpt12_ick_hw = {
710 .hw = {
711 .clk = &gpt12_ick,
712 },
713 .ops = &clkhwops_iclk_wait,
714 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
715 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
716 .clkdm_name = "core_l4_clkdm",
717};
718
719DEFINE_STRUCT_CLK(gpt12_ick, aes_ick_parent_names, aes_ick_ops);
720
721static const struct clk_ops gpt1_fck_ops = {
722 .init = &omap2_init_clk_clkdm,
723 .enable = &omap2_dflt_clk_enable,
724 .disable = &omap2_dflt_clk_disable,
725 .is_enabled = &omap2_dflt_clk_is_enabled,
726 .recalc_rate = &omap2_clksel_recalc,
727 .set_rate = &omap2_clksel_set_rate,
728 .round_rate = &omap2_clksel_round_rate,
729 .get_parent = &omap2_clksel_find_parent_index,
730 .set_parent = &omap2_clksel_set_parent,
731};
732
733DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
734 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
735 OMAP24XX_CLKSEL_GPT1_MASK,
736 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
737 OMAP24XX_EN_GPT1_SHIFT, &clkhwops_wait,
738 gpt10_fck_parent_names, gpt1_fck_ops);
739
740static struct clk gpt1_ick;
741
742static struct clk_hw_omap gpt1_ick_hw = {
743 .hw = {
744 .clk = &gpt1_ick,
745 },
746 .ops = &clkhwops_iclk_wait,
747 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
748 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
749 .clkdm_name = "wkup_clkdm",
750};
751
752DEFINE_STRUCT_CLK(gpt1_ick, gpios_ick_parent_names, aes_ick_ops);
753
754DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
755 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
756 OMAP24XX_CLKSEL_GPT2_MASK,
757 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
758 OMAP24XX_EN_GPT2_SHIFT, &clkhwops_wait,
759 gpt10_fck_parent_names, dss1_fck_ops);
760
761static struct clk gpt2_ick;
762
763static struct clk_hw_omap gpt2_ick_hw = {
764 .hw = {
765 .clk = &gpt2_ick,
766 },
767 .ops = &clkhwops_iclk_wait,
768 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
769 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
770 .clkdm_name = "core_l4_clkdm",
771};
772
773DEFINE_STRUCT_CLK(gpt2_ick, aes_ick_parent_names, aes_ick_ops);
774
775DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
776 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
777 OMAP24XX_CLKSEL_GPT3_MASK,
778 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
779 OMAP24XX_EN_GPT3_SHIFT, &clkhwops_wait,
780 gpt10_fck_parent_names, dss1_fck_ops);
781
782static struct clk gpt3_ick;
783
784static struct clk_hw_omap gpt3_ick_hw = {
785 .hw = {
786 .clk = &gpt3_ick,
787 },
788 .ops = &clkhwops_iclk_wait,
789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
790 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
791 .clkdm_name = "core_l4_clkdm",
792};
793
794DEFINE_STRUCT_CLK(gpt3_ick, aes_ick_parent_names, aes_ick_ops);
795
796DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
797 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
798 OMAP24XX_CLKSEL_GPT4_MASK,
799 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
800 OMAP24XX_EN_GPT4_SHIFT, &clkhwops_wait,
801 gpt10_fck_parent_names, dss1_fck_ops);
802
803static struct clk gpt4_ick;
804
805static struct clk_hw_omap gpt4_ick_hw = {
806 .hw = {
807 .clk = &gpt4_ick,
808 },
809 .ops = &clkhwops_iclk_wait,
810 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
811 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
812 .clkdm_name = "core_l4_clkdm",
813};
814
815DEFINE_STRUCT_CLK(gpt4_ick, aes_ick_parent_names, aes_ick_ops);
816
817DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
818 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
819 OMAP24XX_CLKSEL_GPT5_MASK,
820 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
821 OMAP24XX_EN_GPT5_SHIFT, &clkhwops_wait,
822 gpt10_fck_parent_names, dss1_fck_ops);
823
824static struct clk gpt5_ick;
825
826static struct clk_hw_omap gpt5_ick_hw = {
827 .hw = {
828 .clk = &gpt5_ick,
829 },
830 .ops = &clkhwops_iclk_wait,
831 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
832 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
833 .clkdm_name = "core_l4_clkdm",
834};
835
836DEFINE_STRUCT_CLK(gpt5_ick, aes_ick_parent_names, aes_ick_ops);
837
838DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
839 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
840 OMAP24XX_CLKSEL_GPT6_MASK,
841 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
842 OMAP24XX_EN_GPT6_SHIFT, &clkhwops_wait,
843 gpt10_fck_parent_names, dss1_fck_ops);
844
845static struct clk gpt6_ick;
846
847static struct clk_hw_omap gpt6_ick_hw = {
848 .hw = {
849 .clk = &gpt6_ick,
850 },
851 .ops = &clkhwops_iclk_wait,
852 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
853 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
854 .clkdm_name = "core_l4_clkdm",
855};
856
857DEFINE_STRUCT_CLK(gpt6_ick, aes_ick_parent_names, aes_ick_ops);
858
859DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
860 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
861 OMAP24XX_CLKSEL_GPT7_MASK,
862 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
863 OMAP24XX_EN_GPT7_SHIFT, &clkhwops_wait,
864 gpt10_fck_parent_names, dss1_fck_ops);
865
866static struct clk gpt7_ick;
867
868static struct clk_hw_omap gpt7_ick_hw = {
869 .hw = {
870 .clk = &gpt7_ick,
871 },
872 .ops = &clkhwops_iclk_wait,
873 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
874 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
875 .clkdm_name = "core_l4_clkdm",
876};
877
878DEFINE_STRUCT_CLK(gpt7_ick, aes_ick_parent_names, aes_ick_ops);
879
880static struct clk gpt8_fck;
881
882DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
883 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
884 OMAP24XX_CLKSEL_GPT8_MASK,
885 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
886 OMAP24XX_EN_GPT8_SHIFT, &clkhwops_wait,
887 gpt10_fck_parent_names, dss1_fck_ops);
888
889static struct clk gpt8_ick;
890
891static struct clk_hw_omap gpt8_ick_hw = {
892 .hw = {
893 .clk = &gpt8_ick,
894 },
895 .ops = &clkhwops_iclk_wait,
896 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
897 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
898 .clkdm_name = "core_l4_clkdm",
899};
900
901DEFINE_STRUCT_CLK(gpt8_ick, aes_ick_parent_names, aes_ick_ops);
902
903DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "core_l4_clkdm", omap24xx_gpt_clksel,
904 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
905 OMAP24XX_CLKSEL_GPT9_MASK,
906 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
907 OMAP24XX_EN_GPT9_SHIFT, &clkhwops_wait,
908 gpt10_fck_parent_names, dss1_fck_ops);
909
910static struct clk gpt9_ick;
911
912static struct clk_hw_omap gpt9_ick_hw = {
913 .hw = {
914 .clk = &gpt9_ick,
915 },
916 .ops = &clkhwops_iclk_wait,
917 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
918 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
919 .clkdm_name = "core_l4_clkdm",
920};
921
922DEFINE_STRUCT_CLK(gpt9_ick, aes_ick_parent_names, aes_ick_ops);
923
924static struct clk hdq_fck;
925
926static struct clk_hw_omap hdq_fck_hw = {
927 .hw = {
928 .clk = &hdq_fck,
929 },
930 .ops = &clkhwops_wait,
931 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
932 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
933 .clkdm_name = "core_l4_clkdm",
934};
935
936DEFINE_STRUCT_CLK(hdq_fck, fac_fck_parent_names, aes_ick_ops);
937
938static struct clk hdq_ick;
939
940static struct clk_hw_omap hdq_ick_hw = {
941 .hw = {
942 .clk = &hdq_ick,
943 },
944 .ops = &clkhwops_iclk_wait,
945 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
946 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
947 .clkdm_name = "core_l4_clkdm",
948};
949
950DEFINE_STRUCT_CLK(hdq_ick, aes_ick_parent_names, aes_ick_ops);
951
952static struct clk i2c1_ick;
953
954static struct clk_hw_omap i2c1_ick_hw = {
955 .hw = {
956 .clk = &i2c1_ick,
957 },
958 .ops = &clkhwops_iclk_wait,
959 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
960 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
961 .clkdm_name = "core_l4_clkdm",
962};
963
964DEFINE_STRUCT_CLK(i2c1_ick, aes_ick_parent_names, aes_ick_ops);
965
966static struct clk i2c2_ick;
967
968static struct clk_hw_omap i2c2_ick_hw = {
969 .hw = {
970 .clk = &i2c2_ick,
971 },
972 .ops = &clkhwops_iclk_wait,
973 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
974 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
975 .clkdm_name = "core_l4_clkdm",
976};
977
978DEFINE_STRUCT_CLK(i2c2_ick, aes_ick_parent_names, aes_ick_ops);
979
980static struct clk i2chs1_fck;
981
982static struct clk_hw_omap i2chs1_fck_hw = {
983 .hw = {
984 .clk = &i2chs1_fck,
985 },
986 .ops = &clkhwops_omap2430_i2chs_wait,
987 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
988 .enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
989 .clkdm_name = "core_l4_clkdm",
990};
991
992DEFINE_STRUCT_CLK(i2chs1_fck, cam_fck_parent_names, aes_ick_ops);
993
994static struct clk i2chs2_fck;
995
996static struct clk_hw_omap i2chs2_fck_hw = {
997 .hw = {
998 .clk = &i2chs2_fck,
999 },
1000 .ops = &clkhwops_omap2430_i2chs_wait,
1001 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1002 .enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
1003 .clkdm_name = "core_l4_clkdm",
1004};
1005
1006DEFINE_STRUCT_CLK(i2chs2_fck, cam_fck_parent_names, aes_ick_ops);
1007
1008static struct clk icr_ick;
1009
1010static struct clk_hw_omap icr_ick_hw = {
1011 .hw = {
1012 .clk = &icr_ick,
1013 },
1014 .ops = &clkhwops_iclk_wait,
1015 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1016 .enable_bit = OMAP2430_EN_ICR_SHIFT,
1017 .clkdm_name = "wkup_clkdm",
1018};
1019
1020DEFINE_STRUCT_CLK(icr_ick, gpios_ick_parent_names, aes_ick_ops);
1021
1022static const struct clksel dsp_ick_clksel[] = {
1023 { .parent = &dsp_fck, .rates = dsp_ick_rates },
1024 { .parent = NULL },
1025};
1026
1027static const char *iva2_1_ick_parent_names[] = {
1028 "dsp_fck",
1029};
1030
1031DEFINE_CLK_OMAP_MUX_GATE(iva2_1_ick, "dsp_clkdm", dsp_ick_clksel,
1032 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
1033 OMAP24XX_CLKSEL_DSP_IF_MASK,
1034 OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
1035 OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT, &clkhwops_wait,
1036 iva2_1_ick_parent_names, dsp_fck_ops);
1037
1038static struct clk mailboxes_ick;
1039
1040static struct clk_hw_omap mailboxes_ick_hw = {
1041 .hw = {
1042 .clk = &mailboxes_ick,
1043 },
1044 .ops = &clkhwops_iclk_wait,
1045 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1046 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1047 .clkdm_name = "core_l4_clkdm",
1048};
1049
1050DEFINE_STRUCT_CLK(mailboxes_ick, aes_ick_parent_names, aes_ick_ops);
1051
1052static const struct clksel_rate common_mcbsp_96m_rates[] = {
1053 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1054 { .div = 0 }
1055};
1056
1057static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1058 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1059 { .div = 0 }
1060};
1061
1062static const struct clksel mcbsp_fck_clksel[] = {
1063 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1064 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1065 { .parent = NULL },
1066};
1067
1068static const char *mcbsp1_fck_parent_names[] = {
1069 "func_96m_ck", "mcbsp_clks",
1070};
1071
1072DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1073 OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1074 OMAP2_MCBSP1_CLKS_MASK,
1075 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1076 OMAP24XX_EN_MCBSP1_SHIFT, &clkhwops_wait,
1077 mcbsp1_fck_parent_names, dss1_fck_ops);
1078
1079static struct clk mcbsp1_ick;
1080
1081static struct clk_hw_omap mcbsp1_ick_hw = {
1082 .hw = {
1083 .clk = &mcbsp1_ick,
1084 },
1085 .ops = &clkhwops_iclk_wait,
1086 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1087 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1088 .clkdm_name = "core_l4_clkdm",
1089};
1090
1091DEFINE_STRUCT_CLK(mcbsp1_ick, aes_ick_parent_names, aes_ick_ops);
1092
1093DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1094 OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1095 OMAP2_MCBSP2_CLKS_MASK,
1096 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1097 OMAP24XX_EN_MCBSP2_SHIFT, &clkhwops_wait,
1098 mcbsp1_fck_parent_names, dss1_fck_ops);
1099
1100static struct clk mcbsp2_ick;
1101
1102static struct clk_hw_omap mcbsp2_ick_hw = {
1103 .hw = {
1104 .clk = &mcbsp2_ick,
1105 },
1106 .ops = &clkhwops_iclk_wait,
1107 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1108 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1109 .clkdm_name = "core_l4_clkdm",
1110};
1111
1112DEFINE_STRUCT_CLK(mcbsp2_ick, aes_ick_parent_names, aes_ick_ops);
1113
1114DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1115 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1116 OMAP2_MCBSP3_CLKS_MASK,
1117 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1118 OMAP2430_EN_MCBSP3_SHIFT, &clkhwops_wait,
1119 mcbsp1_fck_parent_names, dss1_fck_ops);
1120
1121static struct clk mcbsp3_ick;
1122
1123static struct clk_hw_omap mcbsp3_ick_hw = {
1124 .hw = {
1125 .clk = &mcbsp3_ick,
1126 },
1127 .ops = &clkhwops_iclk_wait,
1128 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1129 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1130 .clkdm_name = "core_l4_clkdm",
1131};
1132
1133DEFINE_STRUCT_CLK(mcbsp3_ick, aes_ick_parent_names, aes_ick_ops);
1134
1135DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1136 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1137 OMAP2_MCBSP4_CLKS_MASK,
1138 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1139 OMAP2430_EN_MCBSP4_SHIFT, &clkhwops_wait,
1140 mcbsp1_fck_parent_names, dss1_fck_ops);
1141
1142static struct clk mcbsp4_ick;
1143
1144static struct clk_hw_omap mcbsp4_ick_hw = {
1145 .hw = {
1146 .clk = &mcbsp4_ick,
1147 },
1148 .ops = &clkhwops_iclk_wait,
1149 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1150 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1151 .clkdm_name = "core_l4_clkdm",
1152};
1153
1154DEFINE_STRUCT_CLK(mcbsp4_ick, aes_ick_parent_names, aes_ick_ops);
1155
1156DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_fck_clksel,
1157 OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1158 OMAP2_MCBSP5_CLKS_MASK,
1159 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1160 OMAP2430_EN_MCBSP5_SHIFT, &clkhwops_wait,
1161 mcbsp1_fck_parent_names, dss1_fck_ops);
1162
1163static struct clk mcbsp5_ick;
1164
1165static struct clk_hw_omap mcbsp5_ick_hw = {
1166 .hw = {
1167 .clk = &mcbsp5_ick,
1168 },
1169 .ops = &clkhwops_iclk_wait,
1170 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1171 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1172 .clkdm_name = "core_l4_clkdm",
1173};
1174
1175DEFINE_STRUCT_CLK(mcbsp5_ick, aes_ick_parent_names, aes_ick_ops);
1176
1177static struct clk mcspi1_fck;
1178
1179static const char *mcspi1_fck_parent_names[] = {
1180 "func_48m_ck",
1181};
1182
1183static struct clk_hw_omap mcspi1_fck_hw = {
1184 .hw = {
1185 .clk = &mcspi1_fck,
1186 },
1187 .ops = &clkhwops_wait,
1188 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1189 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1190 .clkdm_name = "core_l4_clkdm",
1191};
1192
1193DEFINE_STRUCT_CLK(mcspi1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1194
1195static struct clk mcspi1_ick;
1196
1197static struct clk_hw_omap mcspi1_ick_hw = {
1198 .hw = {
1199 .clk = &mcspi1_ick,
1200 },
1201 .ops = &clkhwops_iclk_wait,
1202 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1203 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1204 .clkdm_name = "core_l4_clkdm",
1205};
1206
1207DEFINE_STRUCT_CLK(mcspi1_ick, aes_ick_parent_names, aes_ick_ops);
1208
1209static struct clk mcspi2_fck;
1210
1211static struct clk_hw_omap mcspi2_fck_hw = {
1212 .hw = {
1213 .clk = &mcspi2_fck,
1214 },
1215 .ops = &clkhwops_wait,
1216 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1217 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1218 .clkdm_name = "core_l4_clkdm",
1219};
1220
1221DEFINE_STRUCT_CLK(mcspi2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1222
1223static struct clk mcspi2_ick;
1224
1225static struct clk_hw_omap mcspi2_ick_hw = {
1226 .hw = {
1227 .clk = &mcspi2_ick,
1228 },
1229 .ops = &clkhwops_iclk_wait,
1230 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1231 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1232 .clkdm_name = "core_l4_clkdm",
1233};
1234
1235DEFINE_STRUCT_CLK(mcspi2_ick, aes_ick_parent_names, aes_ick_ops);
1236
1237static struct clk mcspi3_fck;
1238
1239static struct clk_hw_omap mcspi3_fck_hw = {
1240 .hw = {
1241 .clk = &mcspi3_fck,
1242 },
1243 .ops = &clkhwops_wait,
1244 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1245 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1246 .clkdm_name = "core_l4_clkdm",
1247};
1248
1249DEFINE_STRUCT_CLK(mcspi3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1250
1251static struct clk mcspi3_ick;
1252
1253static struct clk_hw_omap mcspi3_ick_hw = {
1254 .hw = {
1255 .clk = &mcspi3_ick,
1256 },
1257 .ops = &clkhwops_iclk_wait,
1258 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1259 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1260 .clkdm_name = "core_l4_clkdm",
1261};
1262
1263DEFINE_STRUCT_CLK(mcspi3_ick, aes_ick_parent_names, aes_ick_ops);
1264
1265static const struct clksel_rate mdm_ick_core_rates[] = {
1266 { .div = 1, .val = 1, .flags = RATE_IN_243X },
1267 { .div = 4, .val = 4, .flags = RATE_IN_243X },
1268 { .div = 6, .val = 6, .flags = RATE_IN_243X },
1269 { .div = 9, .val = 9, .flags = RATE_IN_243X },
1270 { .div = 0 }
1271};
1272
1273static const struct clksel mdm_ick_clksel[] = {
1274 { .parent = &core_ck, .rates = mdm_ick_core_rates },
1275 { .parent = NULL },
1276};
1277
1278static const char *mdm_ick_parent_names[] = {
1279 "core_ck",
1280};
1281
1282DEFINE_CLK_OMAP_MUX_GATE(mdm_ick, "mdm_clkdm", mdm_ick_clksel,
1283 OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
1284 OMAP2430_CLKSEL_MDM_MASK,
1285 OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
1286 OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
1287 &clkhwops_iclk_wait, mdm_ick_parent_names,
1288 dsp_fck_ops);
1289
1290static struct clk mdm_intc_ick;
1291
1292static struct clk_hw_omap mdm_intc_ick_hw = {
1293 .hw = {
1294 .clk = &mdm_intc_ick,
1295 },
1296 .ops = &clkhwops_iclk_wait,
1297 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1298 .enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
1299 .clkdm_name = "core_l4_clkdm",
1300};
1301
1302DEFINE_STRUCT_CLK(mdm_intc_ick, aes_ick_parent_names, aes_ick_ops);
1303
1304static struct clk mdm_osc_ck;
1305
1306static struct clk_hw_omap mdm_osc_ck_hw = {
1307 .hw = {
1308 .clk = &mdm_osc_ck,
1309 },
1310 .ops = &clkhwops_iclk_wait,
1311 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
1312 .enable_bit = OMAP2430_EN_OSC_SHIFT,
1313 .clkdm_name = "mdm_clkdm",
1314};
1315
1316DEFINE_STRUCT_CLK(mdm_osc_ck, sys_ck_parent_names, aes_ick_ops);
1317
1318static struct clk mmchs1_fck;
1319
1320static struct clk_hw_omap mmchs1_fck_hw = {
1321 .hw = {
1322 .clk = &mmchs1_fck,
1323 },
1324 .ops = &clkhwops_wait,
1325 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1326 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1327 .clkdm_name = "core_l4_clkdm",
1328};
1329
1330DEFINE_STRUCT_CLK(mmchs1_fck, cam_fck_parent_names, aes_ick_ops);
1331
1332static struct clk mmchs1_ick;
1333
1334static struct clk_hw_omap mmchs1_ick_hw = {
1335 .hw = {
1336 .clk = &mmchs1_ick,
1337 },
1338 .ops = &clkhwops_iclk_wait,
1339 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1340 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1341 .clkdm_name = "core_l4_clkdm",
1342};
1343
1344DEFINE_STRUCT_CLK(mmchs1_ick, aes_ick_parent_names, aes_ick_ops);
1345
1346static struct clk mmchs2_fck;
1347
1348static struct clk_hw_omap mmchs2_fck_hw = {
1349 .hw = {
1350 .clk = &mmchs2_fck,
1351 },
1352 .ops = &clkhwops_wait,
1353 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1354 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1355 .clkdm_name = "core_l4_clkdm",
1356};
1357
1358DEFINE_STRUCT_CLK(mmchs2_fck, cam_fck_parent_names, aes_ick_ops);
1359
1360static struct clk mmchs2_ick;
1361
1362static struct clk_hw_omap mmchs2_ick_hw = {
1363 .hw = {
1364 .clk = &mmchs2_ick,
1365 },
1366 .ops = &clkhwops_iclk_wait,
1367 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1368 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1369 .clkdm_name = "core_l4_clkdm",
1370};
1371
1372DEFINE_STRUCT_CLK(mmchs2_ick, aes_ick_parent_names, aes_ick_ops);
1373
1374static struct clk mmchsdb1_fck;
1375
1376static struct clk_hw_omap mmchsdb1_fck_hw = {
1377 .hw = {
1378 .clk = &mmchsdb1_fck,
1379 },
1380 .ops = &clkhwops_wait,
1381 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1382 .enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT,
1383 .clkdm_name = "core_l4_clkdm",
1384};
1385
1386DEFINE_STRUCT_CLK(mmchsdb1_fck, gpio5_fck_parent_names, aes_ick_ops);
1387
1388static struct clk mmchsdb2_fck;
1389
1390static struct clk_hw_omap mmchsdb2_fck_hw = {
1391 .hw = {
1392 .clk = &mmchsdb2_fck,
1393 },
1394 .ops = &clkhwops_wait,
1395 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1396 .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
1397 .clkdm_name = "core_l4_clkdm",
1398};
1399
1400DEFINE_STRUCT_CLK(mmchsdb2_fck, gpio5_fck_parent_names, aes_ick_ops);
1401
1402DEFINE_CLK_DIVIDER(mpu_ck, "core_ck", &core_ck, 0x0,
1403 OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
1404 OMAP24XX_CLKSEL_MPU_SHIFT, OMAP24XX_CLKSEL_MPU_WIDTH,
1405 CLK_DIVIDER_ONE_BASED, NULL);
1406
1407static struct clk mpu_wdt_fck;
1408
1409static struct clk_hw_omap mpu_wdt_fck_hw = {
1410 .hw = {
1411 .clk = &mpu_wdt_fck,
1412 },
1413 .ops = &clkhwops_wait,
1414 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1415 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1416 .clkdm_name = "wkup_clkdm",
1417};
1418
1419DEFINE_STRUCT_CLK(mpu_wdt_fck, gpio5_fck_parent_names, aes_ick_ops);
1420
1421static struct clk mpu_wdt_ick;
1422
1423static struct clk_hw_omap mpu_wdt_ick_hw = {
1424 .hw = {
1425 .clk = &mpu_wdt_ick,
1426 },
1427 .ops = &clkhwops_iclk_wait,
1428 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1429 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1430 .clkdm_name = "wkup_clkdm",
1431};
1432
1433DEFINE_STRUCT_CLK(mpu_wdt_ick, gpios_ick_parent_names, aes_ick_ops);
1434
1435static struct clk mspro_fck;
1436
1437static struct clk_hw_omap mspro_fck_hw = {
1438 .hw = {
1439 .clk = &mspro_fck,
1440 },
1441 .ops = &clkhwops_wait,
1442 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1443 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1444 .clkdm_name = "core_l4_clkdm",
1445};
1446
1447DEFINE_STRUCT_CLK(mspro_fck, cam_fck_parent_names, aes_ick_ops);
1448
1449static struct clk mspro_ick;
1450
1451static struct clk_hw_omap mspro_ick_hw = {
1452 .hw = {
1453 .clk = &mspro_ick,
1454 },
1455 .ops = &clkhwops_iclk_wait,
1456 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1457 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1458 .clkdm_name = "core_l4_clkdm",
1459};
1460
1461DEFINE_STRUCT_CLK(mspro_ick, aes_ick_parent_names, aes_ick_ops);
1462
1463static struct clk omapctrl_ick;
1464
1465static struct clk_hw_omap omapctrl_ick_hw = {
1466 .hw = {
1467 .clk = &omapctrl_ick,
1468 },
1469 .ops = &clkhwops_iclk_wait,
1470 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1471 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1472 .flags = ENABLE_ON_INIT,
1473 .clkdm_name = "wkup_clkdm",
1474};
1475
1476DEFINE_STRUCT_CLK(omapctrl_ick, gpios_ick_parent_names, aes_ick_ops);
1477
1478static struct clk pka_ick;
1479
1480static struct clk_hw_omap pka_ick_hw = {
1481 .hw = {
1482 .clk = &pka_ick,
1483 },
1484 .ops = &clkhwops_iclk_wait,
1485 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1486 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1487 .clkdm_name = "core_l4_clkdm",
1488};
1489
1490DEFINE_STRUCT_CLK(pka_ick, aes_ick_parent_names, aes_ick_ops);
1491
1492static struct clk rng_ick;
1493
1494static struct clk_hw_omap rng_ick_hw = {
1495 .hw = {
1496 .clk = &rng_ick,
1497 },
1498 .ops = &clkhwops_iclk_wait,
1499 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1500 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1501 .clkdm_name = "core_l4_clkdm",
1502};
1503
1504DEFINE_STRUCT_CLK(rng_ick, aes_ick_parent_names, aes_ick_ops);
1505
1506static struct clk sdma_fck;
1507
1508DEFINE_STRUCT_CLK_HW_OMAP(sdma_fck, "core_l3_clkdm");
1509DEFINE_STRUCT_CLK(sdma_fck, gfx_ick_parent_names, core_ck_ops);
1510
1511static struct clk sdma_ick;
1512
1513static struct clk_hw_omap sdma_ick_hw = {
1514 .hw = {
1515 .clk = &sdma_ick,
1516 },
1517 .ops = &clkhwops_iclk,
1518 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1519 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1520 .clkdm_name = "core_l3_clkdm",
1521};
1522
1523DEFINE_STRUCT_CLK(sdma_ick, gfx_ick_parent_names, core_ck_ops);
1524
1525static struct clk sdrc_ick;
1526
1527static struct clk_hw_omap sdrc_ick_hw = {
1528 .hw = {
1529 .clk = &sdrc_ick,
1530 },
1531 .ops = &clkhwops_iclk,
1532 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1533 .enable_bit = OMAP2430_EN_SDRC_SHIFT,
1534 .flags = ENABLE_ON_INIT,
1535 .clkdm_name = "core_l3_clkdm",
1536};
1537
1538DEFINE_STRUCT_CLK(sdrc_ick, gfx_ick_parent_names, core_ck_ops);
1539
1540static struct clk sha_ick;
1541
1542static struct clk_hw_omap sha_ick_hw = {
1543 .hw = {
1544 .clk = &sha_ick,
1545 },
1546 .ops = &clkhwops_iclk_wait,
1547 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1548 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1549 .clkdm_name = "core_l4_clkdm",
1550};
1551
1552DEFINE_STRUCT_CLK(sha_ick, aes_ick_parent_names, aes_ick_ops);
1553
1554static struct clk ssi_l4_ick;
1555
1556static struct clk_hw_omap ssi_l4_ick_hw = {
1557 .hw = {
1558 .clk = &ssi_l4_ick,
1559 },
1560 .ops = &clkhwops_iclk_wait,
1561 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1562 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
1563 .clkdm_name = "core_l4_clkdm",
1564};
1565
1566DEFINE_STRUCT_CLK(ssi_l4_ick, aes_ick_parent_names, aes_ick_ops);
1567
1568static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
1569 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1570 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1571 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
1572 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1573 { .div = 5, .val = 5, .flags = RATE_IN_243X },
1574 { .div = 0 }
1575};
1576
1577static const struct clksel ssi_ssr_sst_fck_clksel[] = {
1578 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
1579 { .parent = NULL },
1580};
1581
1582static const char *ssi_ssr_sst_fck_parent_names[] = {
1583 "core_ck",
1584};
1585
1586DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_sst_fck, "core_l3_clkdm",
1587 ssi_ssr_sst_fck_clksel,
1588 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1589 OMAP24XX_CLKSEL_SSI_MASK,
1590 OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1591 OMAP24XX_EN_SSI_SHIFT, &clkhwops_wait,
1592 ssi_ssr_sst_fck_parent_names, dsp_fck_ops);
1593
1594static struct clk sync_32k_ick;
1595
1596static struct clk_hw_omap sync_32k_ick_hw = {
1597 .hw = {
1598 .clk = &sync_32k_ick,
1599 },
1600 .ops = &clkhwops_iclk_wait,
1601 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1602 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1603 .flags = ENABLE_ON_INIT,
1604 .clkdm_name = "wkup_clkdm",
1605};
1606
1607DEFINE_STRUCT_CLK(sync_32k_ick, gpios_ick_parent_names, aes_ick_ops);
1608
1609static const struct clksel_rate common_clkout_src_core_rates[] = {
1610 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1611 { .div = 0 }
1612};
1613
1614static const struct clksel_rate common_clkout_src_sys_rates[] = {
1615 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1616 { .div = 0 }
1617};
1618
1619static const struct clksel_rate common_clkout_src_96m_rates[] = {
1620 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
1621 { .div = 0 }
1622};
1623
1624static const struct clksel_rate common_clkout_src_54m_rates[] = {
1625 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
1626 { .div = 0 }
1627};
1628
1629static const struct clksel common_clkout_src_clksel[] = {
1630 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
1631 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
1632 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
1633 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
1634 { .parent = NULL },
1635};
1636
1637static const char *sys_clkout_src_parent_names[] = {
1638 "core_ck", "sys_ck", "func_96m_ck", "func_54m_ck",
1639};
1640
1641DEFINE_CLK_OMAP_MUX_GATE(sys_clkout_src, "wkup_clkdm", common_clkout_src_clksel,
1642 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_SOURCE_MASK,
1643 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_EN_SHIFT,
1644 NULL, sys_clkout_src_parent_names, gpt1_fck_ops);
1645
1646DEFINE_CLK_DIVIDER(sys_clkout, "sys_clkout_src", &sys_clkout_src, 0x0,
1647 OMAP2430_PRCM_CLKOUT_CTRL, OMAP24XX_CLKOUT_DIV_SHIFT,
1648 OMAP24XX_CLKOUT_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
1649
1650static struct clk uart1_fck;
1651
1652static struct clk_hw_omap uart1_fck_hw = {
1653 .hw = {
1654 .clk = &uart1_fck,
1655 },
1656 .ops = &clkhwops_wait,
1657 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1658 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1659 .clkdm_name = "core_l4_clkdm",
1660};
1661
1662DEFINE_STRUCT_CLK(uart1_fck, mcspi1_fck_parent_names, aes_ick_ops);
1663
1664static struct clk uart1_ick;
1665
1666static struct clk_hw_omap uart1_ick_hw = {
1667 .hw = {
1668 .clk = &uart1_ick,
1669 },
1670 .ops = &clkhwops_iclk_wait,
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1672 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1673 .clkdm_name = "core_l4_clkdm",
1674};
1675
1676DEFINE_STRUCT_CLK(uart1_ick, aes_ick_parent_names, aes_ick_ops);
1677
1678static struct clk uart2_fck;
1679
1680static struct clk_hw_omap uart2_fck_hw = {
1681 .hw = {
1682 .clk = &uart2_fck,
1683 },
1684 .ops = &clkhwops_wait,
1685 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1686 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1687 .clkdm_name = "core_l4_clkdm",
1688};
1689
1690DEFINE_STRUCT_CLK(uart2_fck, mcspi1_fck_parent_names, aes_ick_ops);
1691
1692static struct clk uart2_ick;
1693
1694static struct clk_hw_omap uart2_ick_hw = {
1695 .hw = {
1696 .clk = &uart2_ick,
1697 },
1698 .ops = &clkhwops_iclk_wait,
1699 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1700 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1701 .clkdm_name = "core_l4_clkdm",
1702};
1703
1704DEFINE_STRUCT_CLK(uart2_ick, aes_ick_parent_names, aes_ick_ops);
1705
1706static struct clk uart3_fck;
1707
1708static struct clk_hw_omap uart3_fck_hw = {
1709 .hw = {
1710 .clk = &uart3_fck,
1711 },
1712 .ops = &clkhwops_wait,
1713 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1714 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1715 .clkdm_name = "core_l4_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(uart3_fck, mcspi1_fck_parent_names, aes_ick_ops);
1719
1720static struct clk uart3_ick;
1721
1722static struct clk_hw_omap uart3_ick_hw = {
1723 .hw = {
1724 .clk = &uart3_ick,
1725 },
1726 .ops = &clkhwops_iclk_wait,
1727 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1728 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1729 .clkdm_name = "core_l4_clkdm",
1730};
1731
1732DEFINE_STRUCT_CLK(uart3_ick, aes_ick_parent_names, aes_ick_ops);
1733
1734static struct clk usb_fck;
1735
1736static struct clk_hw_omap usb_fck_hw = {
1737 .hw = {
1738 .clk = &usb_fck,
1739 },
1740 .ops = &clkhwops_wait,
1741 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1742 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1743 .clkdm_name = "core_l3_clkdm",
1744};
1745
1746DEFINE_STRUCT_CLK(usb_fck, mcspi1_fck_parent_names, aes_ick_ops);
1747
1748static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
1749 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1750 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
1751 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
1752 { .div = 0 }
1753};
1754
1755static const struct clksel usb_l4_ick_clksel[] = {
1756 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
1757 { .parent = NULL },
1758};
1759
1760static const char *usb_l4_ick_parent_names[] = {
1761 "core_l3_ck",
1762};
1763
1764DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_ick_clksel,
1765 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1766 OMAP24XX_CLKSEL_USB_MASK,
1767 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1768 OMAP24XX_EN_USB_SHIFT, &clkhwops_iclk_wait,
1769 usb_l4_ick_parent_names, dsp_fck_ops);
1770
1771static struct clk usbhs_ick;
1772
1773static struct clk_hw_omap usbhs_ick_hw = {
1774 .hw = {
1775 .clk = &usbhs_ick,
1776 },
1777 .ops = &clkhwops_iclk_wait,
1778 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1779 .enable_bit = OMAP2430_EN_USBHS_SHIFT,
1780 .clkdm_name = "core_l3_clkdm",
1781};
1782
1783DEFINE_STRUCT_CLK(usbhs_ick, gfx_ick_parent_names, aes_ick_ops);
1784
1785static struct clk virt_prcm_set;
1786
1787static const char *virt_prcm_set_parent_names[] = {
1788 "mpu_ck",
1789};
1790
1791static const struct clk_ops virt_prcm_set_ops = {
1792 .recalc_rate = &omap2_table_mpu_recalc,
1793 .set_rate = &omap2_select_table_rate,
1794 .round_rate = &omap2_round_to_table_rate,
1795};
1796
1797DEFINE_STRUCT_CLK_HW_OMAP(virt_prcm_set, NULL);
1798DEFINE_STRUCT_CLK(virt_prcm_set, virt_prcm_set_parent_names, virt_prcm_set_ops);
1799
1800static struct clk wdt1_ick;
1801
1802static struct clk_hw_omap wdt1_ick_hw = {
1803 .hw = {
1804 .clk = &wdt1_ick,
1805 },
1806 .ops = &clkhwops_iclk_wait,
1807 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1808 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1809 .clkdm_name = "wkup_clkdm",
1810};
1811
1812DEFINE_STRUCT_CLK(wdt1_ick, gpios_ick_parent_names, aes_ick_ops);
1813
1814static struct clk wdt1_osc_ck;
1815
1816static const struct clk_ops wdt1_osc_ck_ops = {};
1817
1818DEFINE_STRUCT_CLK_HW_OMAP(wdt1_osc_ck, NULL);
1819DEFINE_STRUCT_CLK(wdt1_osc_ck, sys_ck_parent_names, wdt1_osc_ck_ops);
1820
1821static struct clk wdt4_fck;
1822
1823static struct clk_hw_omap wdt4_fck_hw = {
1824 .hw = {
1825 .clk = &wdt4_fck,
1826 },
1827 .ops = &clkhwops_wait,
1828 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1829 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1830 .clkdm_name = "core_l4_clkdm",
1831};
1832
1833DEFINE_STRUCT_CLK(wdt4_fck, gpio5_fck_parent_names, aes_ick_ops);
1834
1835static struct clk wdt4_ick;
1836
1837static struct clk_hw_omap wdt4_ick_hw = {
1838 .hw = {
1839 .clk = &wdt4_ick,
1840 },
1841 .ops = &clkhwops_iclk_wait,
1842 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1843 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1844 .clkdm_name = "core_l4_clkdm",
1845};
1846
1847DEFINE_STRUCT_CLK(wdt4_ick, aes_ick_parent_names, aes_ick_ops);
1848
1849/*
1850 * clkdev integration
1851 */
1852
1853static struct omap_clk omap2430_clks[] = {
1854 /* external root sources */
1855 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X),
1856 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X),
1857 CLK(NULL, "osc_ck", &osc_ck, CK_243X),
1858 CLK("twl", "fck", &osc_ck, CK_243X),
1859 CLK(NULL, "sys_ck", &sys_ck, CK_243X),
1860 CLK(NULL, "alt_ck", &alt_ck, CK_243X),
1861 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X),
1862 /* internal analog sources */
1863 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X),
1864 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X),
1865 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X),
1866 /* internal prcm root sources */
1867 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X),
1868 CLK(NULL, "core_ck", &core_ck, CK_243X),
1869 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X),
1870 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X),
1871 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X),
1872 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X),
1873 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X),
1874 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X),
1875 CLK(NULL, "emul_ck", &emul_ck, CK_243X),
1876 /* mpu domain clocks */
1877 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X),
1878 /* dsp domain clocks */
1879 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X),
1880 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
1881 /* GFX domain clocks */
1882 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X),
1883 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X),
1884 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X),
1885 /* Modem domain clocks */
1886 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
1887 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
1888 /* DSS domain clocks */
1889 CLK("omapdss_dss", "ick", &dss_ick, CK_243X),
1890 CLK(NULL, "dss_ick", &dss_ick, CK_243X),
1891 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X),
1892 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X),
1893 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X),
1894 /* L3 domain clocks */
1895 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X),
1896 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X),
1897 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X),
1898 /* L4 domain clocks */
1899 CLK(NULL, "l4_ck", &l4_ck, CK_243X),
1900 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X),
1901 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_243X),
1902 /* virtual meta-group clock */
1903 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X),
1904 /* general l4 interface ck, multi-parent functional clk */
1905 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X),
1906 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X),
1907 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X),
1908 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X),
1909 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X),
1910 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X),
1911 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X),
1912 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X),
1913 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X),
1914 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X),
1915 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X),
1916 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X),
1917 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X),
1918 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X),
1919 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X),
1920 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X),
1921 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X),
1922 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X),
1923 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X),
1924 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X),
1925 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X),
1926 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X),
1927 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X),
1928 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X),
1929 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X),
1930 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_243X),
1931 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X),
1932 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X),
1933 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_243X),
1934 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X),
1935 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
1936 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_243X),
1937 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X),
1938 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
1939 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick, CK_243X),
1940 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X),
1941 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
1942 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_243X),
1943 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X),
1944 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X),
1945 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_243X),
1946 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X),
1947 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X),
1948 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_243X),
1949 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X),
1950 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
1951 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_243X),
1952 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X),
1953 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X),
1954 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X),
1955 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X),
1956 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X),
1957 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X),
1958 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X),
1959 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X),
1960 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
1961 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
1962 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X),
1963 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X),
1964 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
1965 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
1966 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
1967 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
1968 CLK("omap24xxcam", "fck", &cam_fck, CK_243X),
1969 CLK(NULL, "cam_fck", &cam_fck, CK_243X),
1970 CLK("omap24xxcam", "ick", &cam_ick, CK_243X),
1971 CLK(NULL, "cam_ick", &cam_ick, CK_243X),
1972 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X),
1973 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X),
1974 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X),
1975 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X),
1976 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X),
1977 CLK(NULL, "fac_ick", &fac_ick, CK_243X),
1978 CLK(NULL, "fac_fck", &fac_fck, CK_243X),
1979 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X),
1980 CLK(NULL, "hdq_ick", &hdq_ick, CK_243X),
1981 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X),
1982 CLK(NULL, "hdq_fck", &hdq_fck, CK_243X),
1983 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X),
1984 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_243X),
1985 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X),
1986 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X),
1987 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_243X),
1988 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X),
1989 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X),
1990 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X),
1991 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X),
1992 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
1993 CLK(NULL, "des_ick", &des_ick, CK_243X),
1994 CLK("omap-sham", "ick", &sha_ick, CK_243X),
1995 CLK("omap_rng", "ick", &rng_ick, CK_243X),
1996 CLK(NULL, "rng_ick", &rng_ick, CK_243X),
1997 CLK("omap-aes", "ick", &aes_ick, CK_243X),
1998 CLK(NULL, "pka_ick", &pka_ick, CK_243X),
1999 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
2000 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
2001 CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X),
2002 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X),
2003 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_243X),
2004 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X),
2005 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X),
2006 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_243X),
2007 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X),
2008 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
2009 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
2010 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
2011 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2012 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck, CK_243X),
2013 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2014 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck, CK_243X),
2015 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
2016 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
2017 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
2018 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X),
2019};
2020
2021static const char *enable_init_clks[] = {
2022 "apll96_ck",
2023 "apll54_ck",
2024 "sync_32k_ick",
2025 "omapctrl_ick",
2026 "gpmc_fck",
2027 "sdrc_ick",
2028};
2029
2030/*
2031 * init code
2032 */
2033
2034int __init omap2430_clk_init(void)
2035{
2036 struct omap_clk *c;
2037
2038 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2039 cpu_mask = RATE_IN_243X;
2040 rate_table = omap2430_rate_table;
2041
2042 omap2xxx_clkt_dpllcore_init(&dpll_ck_hw.hw);
2043
2044 omap2xxx_clkt_vps_check_bootloader_rates();
2045
2046 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2047 c++) {
2048 clkdev_add(&c->lk);
2049 if (!__clk_init(NULL, c->lk.clk))
2050 omap2_init_clk_hw_omap_clocks(c->lk.clk);
2051 }
2052
2053 omap2_clk_disable_autoidle_all();
2054
2055 omap2_clk_enable_init_clocks(enable_init_clks,
2056 ARRAY_SIZE(enable_init_clks));
2057
2058 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
2059 (clk_get_rate(&sys_ck) / 1000000),
2060 (clk_get_rate(&sys_ck) / 100000) % 10,
2061 (clk_get_rate(&dpll_ck) / 1000000),
2062 (clk_get_rate(&mpu_ck) / 1000000));
2063
2064 return 0;
2065}
diff --git a/arch/arm/mach-omap2/cclock33xx_data.c b/arch/arm/mach-omap2/cclock33xx_data.c
new file mode 100644
index 000000000000..ea64ad606759
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock33xx_data.c
@@ -0,0 +1,961 @@
1/*
2 * AM33XX Clock data
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/clk-private.h>
20#include <linux/clkdev.h>
21#include <linux/io.h>
22
23#include "am33xx.h"
24#include "soc.h"
25#include "iomap.h"
26#include "clock.h"
27#include "control.h"
28#include "cm.h"
29#include "cm33xx.h"
30#include "cm-regbits-33xx.h"
31#include "prm.h"
32
33/* Modulemode control */
34#define AM33XX_MODULEMODE_HWCTRL_SHIFT 0
35#define AM33XX_MODULEMODE_SWCTRL_SHIFT 1
36
37/*LIST_HEAD(clocks);*/
38
39/* Root clocks */
40
41/* RTC 32k */
42DEFINE_CLK_FIXED_RATE(clk_32768_ck, CLK_IS_ROOT, 32768, 0x0);
43
44/* On-Chip 32KHz RC OSC */
45DEFINE_CLK_FIXED_RATE(clk_rc32k_ck, CLK_IS_ROOT, 32000, 0x0);
46
47/* Crystal input clks */
48DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
49
50DEFINE_CLK_FIXED_RATE(virt_24000000_ck, CLK_IS_ROOT, 24000000, 0x0);
51
52DEFINE_CLK_FIXED_RATE(virt_25000000_ck, CLK_IS_ROOT, 25000000, 0x0);
53
54DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
55
56/* Oscillator clock */
57/* 19.2, 24, 25 or 26 MHz */
58static const char *sys_clkin_ck_parents[] = {
59 "virt_19200000_ck", "virt_24000000_ck", "virt_25000000_ck",
60 "virt_26000000_ck",
61};
62
63/*
64 * sys_clk in: input to the dpll and also used as funtional clock for,
65 * adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse
66 *
67 */
68DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
69 AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS),
70 AM33XX_CONTROL_STATUS_SYSBOOT1_SHIFT,
71 AM33XX_CONTROL_STATUS_SYSBOOT1_WIDTH,
72 0, NULL);
73
74/* External clock - 12 MHz */
75DEFINE_CLK_FIXED_RATE(tclkin_ck, CLK_IS_ROOT, 12000000, 0x0);
76
77/* Module clocks and DPLL outputs */
78
79/* DPLL_CORE */
80static struct dpll_data dpll_core_dd = {
81 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_CORE,
82 .clk_bypass = &sys_clkin_ck,
83 .clk_ref = &sys_clkin_ck,
84 .control_reg = AM33XX_CM_CLKMODE_DPLL_CORE,
85 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
86 .idlest_reg = AM33XX_CM_IDLEST_DPLL_CORE,
87 .mult_mask = AM33XX_DPLL_MULT_MASK,
88 .div1_mask = AM33XX_DPLL_DIV_MASK,
89 .enable_mask = AM33XX_DPLL_EN_MASK,
90 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
91 .max_multiplier = 2047,
92 .max_divider = 128,
93 .min_divider = 1,
94};
95
96/* CLKDCOLDO output */
97static const char *dpll_core_ck_parents[] = {
98 "sys_clkin_ck",
99};
100
101static struct clk dpll_core_ck;
102
103static const struct clk_ops dpll_core_ck_ops = {
104 .recalc_rate = &omap3_dpll_recalc,
105 .get_parent = &omap2_init_dpll_parent,
106};
107
108static struct clk_hw_omap dpll_core_ck_hw = {
109 .hw = {
110 .clk = &dpll_core_ck,
111 },
112 .dpll_data = &dpll_core_dd,
113 .ops = &clkhwops_omap3_dpll,
114};
115
116DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
117
118static const char *dpll_core_x2_ck_parents[] = {
119 "dpll_core_ck",
120};
121
122static struct clk dpll_core_x2_ck;
123
124static const struct clk_ops dpll_x2_ck_ops = {
125 .recalc_rate = &omap3_clkoutx2_recalc,
126};
127
128static struct clk_hw_omap dpll_core_x2_ck_hw = {
129 .hw = {
130 .clk = &dpll_core_x2_ck,
131 },
132 .flags = CLOCK_CLKOUTX2,
133};
134
135DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_x2_ck_ops);
136
137DEFINE_CLK_DIVIDER(dpll_core_m4_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
138 0x0, AM33XX_CM_DIV_M4_DPLL_CORE,
139 AM33XX_HSDIVIDER_CLKOUT1_DIV_SHIFT,
140 AM33XX_HSDIVIDER_CLKOUT1_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
141 NULL);
142
143DEFINE_CLK_DIVIDER(dpll_core_m5_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
144 0x0, AM33XX_CM_DIV_M5_DPLL_CORE,
145 AM33XX_HSDIVIDER_CLKOUT2_DIV_SHIFT,
146 AM33XX_HSDIVIDER_CLKOUT2_DIV_WIDTH,
147 CLK_DIVIDER_ONE_BASED, NULL);
148
149DEFINE_CLK_DIVIDER(dpll_core_m6_ck, "dpll_core_x2_ck", &dpll_core_x2_ck,
150 0x0, AM33XX_CM_DIV_M6_DPLL_CORE,
151 AM33XX_HSDIVIDER_CLKOUT3_DIV_SHIFT,
152 AM33XX_HSDIVIDER_CLKOUT3_DIV_WIDTH,
153 CLK_DIVIDER_ONE_BASED, NULL);
154
155
156/* DPLL_MPU */
157static struct dpll_data dpll_mpu_dd = {
158 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU,
159 .clk_bypass = &sys_clkin_ck,
160 .clk_ref = &sys_clkin_ck,
161 .control_reg = AM33XX_CM_CLKMODE_DPLL_MPU,
162 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
163 .idlest_reg = AM33XX_CM_IDLEST_DPLL_MPU,
164 .mult_mask = AM33XX_DPLL_MULT_MASK,
165 .div1_mask = AM33XX_DPLL_DIV_MASK,
166 .enable_mask = AM33XX_DPLL_EN_MASK,
167 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
168 .max_multiplier = 2047,
169 .max_divider = 128,
170 .min_divider = 1,
171};
172
173/* CLKOUT: fdpll/M2 */
174static struct clk dpll_mpu_ck;
175
176static const struct clk_ops dpll_mpu_ck_ops = {
177 .enable = &omap3_noncore_dpll_enable,
178 .disable = &omap3_noncore_dpll_disable,
179 .recalc_rate = &omap3_dpll_recalc,
180 .round_rate = &omap2_dpll_round_rate,
181 .set_rate = &omap3_noncore_dpll_set_rate,
182 .get_parent = &omap2_init_dpll_parent,
183};
184
185static struct clk_hw_omap dpll_mpu_ck_hw = {
186 .hw = {
187 .clk = &dpll_mpu_ck,
188 },
189 .dpll_data = &dpll_mpu_dd,
190 .ops = &clkhwops_omap3_dpll,
191};
192
193DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_mpu_ck_ops);
194
195/*
196 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
197 * and ALT_CLK1/2)
198 */
199DEFINE_CLK_DIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck,
200 0x0, AM33XX_CM_DIV_M2_DPLL_MPU, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
201 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
202
203/* DPLL_DDR */
204static struct dpll_data dpll_ddr_dd = {
205 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DDR,
206 .clk_bypass = &sys_clkin_ck,
207 .clk_ref = &sys_clkin_ck,
208 .control_reg = AM33XX_CM_CLKMODE_DPLL_DDR,
209 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
210 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DDR,
211 .mult_mask = AM33XX_DPLL_MULT_MASK,
212 .div1_mask = AM33XX_DPLL_DIV_MASK,
213 .enable_mask = AM33XX_DPLL_EN_MASK,
214 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
215 .max_multiplier = 2047,
216 .max_divider = 128,
217 .min_divider = 1,
218};
219
220/* CLKOUT: fdpll/M2 */
221static struct clk dpll_ddr_ck;
222
223static const struct clk_ops dpll_ddr_ck_ops = {
224 .recalc_rate = &omap3_dpll_recalc,
225 .get_parent = &omap2_init_dpll_parent,
226 .round_rate = &omap2_dpll_round_rate,
227 .set_rate = &omap3_noncore_dpll_set_rate,
228};
229
230static struct clk_hw_omap dpll_ddr_ck_hw = {
231 .hw = {
232 .clk = &dpll_ddr_ck,
233 },
234 .dpll_data = &dpll_ddr_dd,
235 .ops = &clkhwops_omap3_dpll,
236};
237
238DEFINE_STRUCT_CLK(dpll_ddr_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
239
240/*
241 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
242 * and ALT_CLK1/2)
243 */
244DEFINE_CLK_DIVIDER(dpll_ddr_m2_ck, "dpll_ddr_ck", &dpll_ddr_ck,
245 0x0, AM33XX_CM_DIV_M2_DPLL_DDR,
246 AM33XX_DPLL_CLKOUT_DIV_SHIFT, AM33XX_DPLL_CLKOUT_DIV_WIDTH,
247 CLK_DIVIDER_ONE_BASED, NULL);
248
249/* emif_fck functional clock */
250DEFINE_CLK_FIXED_FACTOR(dpll_ddr_m2_div2_ck, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck,
251 0x0, 1, 2);
252
253/* DPLL_DISP */
254static struct dpll_data dpll_disp_dd = {
255 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DISP,
256 .clk_bypass = &sys_clkin_ck,
257 .clk_ref = &sys_clkin_ck,
258 .control_reg = AM33XX_CM_CLKMODE_DPLL_DISP,
259 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
260 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DISP,
261 .mult_mask = AM33XX_DPLL_MULT_MASK,
262 .div1_mask = AM33XX_DPLL_DIV_MASK,
263 .enable_mask = AM33XX_DPLL_EN_MASK,
264 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
265 .max_multiplier = 2047,
266 .max_divider = 128,
267 .min_divider = 1,
268};
269
270/* CLKOUT: fdpll/M2 */
271static struct clk dpll_disp_ck;
272
273static struct clk_hw_omap dpll_disp_ck_hw = {
274 .hw = {
275 .clk = &dpll_disp_ck,
276 },
277 .dpll_data = &dpll_disp_dd,
278 .ops = &clkhwops_omap3_dpll,
279};
280
281DEFINE_STRUCT_CLK(dpll_disp_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
282
283/*
284 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
285 * and ALT_CLK1/2)
286 */
287DEFINE_CLK_DIVIDER(dpll_disp_m2_ck, "dpll_disp_ck", &dpll_disp_ck, 0x0,
288 AM33XX_CM_DIV_M2_DPLL_DISP, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
289 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
290
291/* DPLL_PER */
292static struct dpll_data dpll_per_dd = {
293 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_PERIPH,
294 .clk_bypass = &sys_clkin_ck,
295 .clk_ref = &sys_clkin_ck,
296 .control_reg = AM33XX_CM_CLKMODE_DPLL_PER,
297 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
298 .idlest_reg = AM33XX_CM_IDLEST_DPLL_PER,
299 .mult_mask = AM33XX_DPLL_MULT_PERIPH_MASK,
300 .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
301 .enable_mask = AM33XX_DPLL_EN_MASK,
302 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
303 .max_multiplier = 2047,
304 .max_divider = 128,
305 .min_divider = 1,
306 .flags = DPLL_J_TYPE,
307};
308
309/* CLKDCOLDO */
310static struct clk dpll_per_ck;
311
312static struct clk_hw_omap dpll_per_ck_hw = {
313 .hw = {
314 .clk = &dpll_per_ck,
315 },
316 .dpll_data = &dpll_per_dd,
317 .ops = &clkhwops_omap3_dpll,
318};
319
320DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_ddr_ck_ops);
321
322/* CLKOUT: fdpll/M2 */
323DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
324 AM33XX_CM_DIV_M2_DPLL_PER, AM33XX_DPLL_CLKOUT_DIV_SHIFT,
325 AM33XX_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED,
326 NULL);
327
328DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_wkupdm_ck, "dpll_per_m2_ck",
329 &dpll_per_m2_ck, 0x0, 1, 4);
330
331DEFINE_CLK_FIXED_FACTOR(dpll_per_m2_div4_ck, "dpll_per_m2_ck",
332 &dpll_per_m2_ck, 0x0, 1, 4);
333
334DEFINE_CLK_FIXED_FACTOR(dpll_core_m4_div2_ck, "dpll_core_m4_ck",
335 &dpll_core_m4_ck, 0x0, 1, 2);
336
337DEFINE_CLK_FIXED_FACTOR(l4_rtc_gclk, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
338 1, 2);
339
340DEFINE_CLK_FIXED_FACTOR(clk_24mhz, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1,
341 8);
342
343/*
344 * Below clock nodes describes clockdomains derived out
345 * of core clock.
346 */
347static const struct clk_ops clk_ops_null = {
348};
349
350static const char *l3_gclk_parents[] = {
351 "dpll_core_m4_ck"
352};
353
354static struct clk l3_gclk;
355DEFINE_STRUCT_CLK_HW_OMAP(l3_gclk, NULL);
356DEFINE_STRUCT_CLK(l3_gclk, l3_gclk_parents, clk_ops_null);
357
358static struct clk l4hs_gclk;
359DEFINE_STRUCT_CLK_HW_OMAP(l4hs_gclk, NULL);
360DEFINE_STRUCT_CLK(l4hs_gclk, l3_gclk_parents, clk_ops_null);
361
362static const char *l3s_gclk_parents[] = {
363 "dpll_core_m4_div2_ck"
364};
365
366static struct clk l3s_gclk;
367DEFINE_STRUCT_CLK_HW_OMAP(l3s_gclk, NULL);
368DEFINE_STRUCT_CLK(l3s_gclk, l3s_gclk_parents, clk_ops_null);
369
370static struct clk l4fw_gclk;
371DEFINE_STRUCT_CLK_HW_OMAP(l4fw_gclk, NULL);
372DEFINE_STRUCT_CLK(l4fw_gclk, l3s_gclk_parents, clk_ops_null);
373
374static struct clk l4ls_gclk;
375DEFINE_STRUCT_CLK_HW_OMAP(l4ls_gclk, NULL);
376DEFINE_STRUCT_CLK(l4ls_gclk, l3s_gclk_parents, clk_ops_null);
377
378static struct clk sysclk_div_ck;
379DEFINE_STRUCT_CLK_HW_OMAP(sysclk_div_ck, NULL);
380DEFINE_STRUCT_CLK(sysclk_div_ck, l3_gclk_parents, clk_ops_null);
381
382/*
383 * In order to match the clock domain with hwmod clockdomain entry,
384 * separate clock nodes is required for the modules which are
385 * directly getting their funtioncal clock from sys_clkin.
386 */
387static struct clk adc_tsc_fck;
388DEFINE_STRUCT_CLK_HW_OMAP(adc_tsc_fck, NULL);
389DEFINE_STRUCT_CLK(adc_tsc_fck, dpll_core_ck_parents, clk_ops_null);
390
391static struct clk dcan0_fck;
392DEFINE_STRUCT_CLK_HW_OMAP(dcan0_fck, NULL);
393DEFINE_STRUCT_CLK(dcan0_fck, dpll_core_ck_parents, clk_ops_null);
394
395static struct clk dcan1_fck;
396DEFINE_STRUCT_CLK_HW_OMAP(dcan1_fck, NULL);
397DEFINE_STRUCT_CLK(dcan1_fck, dpll_core_ck_parents, clk_ops_null);
398
399static struct clk mcasp0_fck;
400DEFINE_STRUCT_CLK_HW_OMAP(mcasp0_fck, NULL);
401DEFINE_STRUCT_CLK(mcasp0_fck, dpll_core_ck_parents, clk_ops_null);
402
403static struct clk mcasp1_fck;
404DEFINE_STRUCT_CLK_HW_OMAP(mcasp1_fck, NULL);
405DEFINE_STRUCT_CLK(mcasp1_fck, dpll_core_ck_parents, clk_ops_null);
406
407static struct clk smartreflex0_fck;
408DEFINE_STRUCT_CLK_HW_OMAP(smartreflex0_fck, NULL);
409DEFINE_STRUCT_CLK(smartreflex0_fck, dpll_core_ck_parents, clk_ops_null);
410
411static struct clk smartreflex1_fck;
412DEFINE_STRUCT_CLK_HW_OMAP(smartreflex1_fck, NULL);
413DEFINE_STRUCT_CLK(smartreflex1_fck, dpll_core_ck_parents, clk_ops_null);
414
415/*
416 * Modules clock nodes
417 *
418 * The following clock leaf nodes are added for the moment because:
419 *
420 * - hwmod data is not present for these modules, either hwmod
421 * control is not required or its not populated.
422 * - Driver code is not yet migrated to use hwmod/runtime pm
423 * - Modules outside kernel access (to disable them by default)
424 *
425 * - debugss
426 * - mmu (gfx domain)
427 * - cefuse
428 * - usbotg_fck (its additional clock and not really a modulemode)
429 * - ieee5000
430 */
431DEFINE_CLK_GATE(debugss_ick, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
432 AM33XX_CM_WKUP_DEBUGSS_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
433 0x0, NULL);
434
435DEFINE_CLK_GATE(mmu_fck, "dpll_core_m4_ck", &dpll_core_m4_ck, 0x0,
436 AM33XX_CM_GFX_MMUDATA_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
437 0x0, NULL);
438
439DEFINE_CLK_GATE(cefuse_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
440 AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
441 0x0, NULL);
442
443/*
444 * clkdiv32 is generated from fixed division of 732.4219
445 */
446DEFINE_CLK_FIXED_FACTOR(clkdiv32k_ck, "clk_24mhz", &clk_24mhz, 0x0, 1, 732);
447
448DEFINE_CLK_GATE(clkdiv32k_ick, "clkdiv32k_ck", &clkdiv32k_ck, 0x0,
449 AM33XX_CM_PER_CLKDIV32K_CLKCTRL, AM33XX_MODULEMODE_SWCTRL_SHIFT,
450 0x0, NULL);
451
452/* "usbotg_fck" is an additional clock and not really a modulemode */
453DEFINE_CLK_GATE(usbotg_fck, "dpll_per_ck", &dpll_per_ck, 0x0,
454 AM33XX_CM_CLKDCOLDO_DPLL_PER, AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
455 0x0, NULL);
456
457DEFINE_CLK_GATE(ieee5000_fck, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck,
458 0x0, AM33XX_CM_PER_IEEE5000_CLKCTRL,
459 AM33XX_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
460
461/* Timers */
462static const struct clksel timer1_clkmux_sel[] = {
463 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
464 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
465 { .parent = &tclkin_ck, .rates = div_1_2_rates },
466 { .parent = &clk_rc32k_ck, .rates = div_1_3_rates },
467 { .parent = &clk_32768_ck, .rates = div_1_4_rates },
468 { .parent = NULL },
469};
470
471static const char *timer1_ck_parents[] = {
472 "sys_clkin_ck", "clkdiv32k_ick", "tclkin_ck", "clk_rc32k_ck",
473 "clk_32768_ck",
474};
475
476static struct clk timer1_fck;
477
478static const struct clk_ops timer1_fck_ops = {
479 .recalc_rate = &omap2_clksel_recalc,
480 .get_parent = &omap2_clksel_find_parent_index,
481 .set_parent = &omap2_clksel_set_parent,
482 .init = &omap2_init_clk_clkdm,
483};
484
485static struct clk_hw_omap timer1_fck_hw = {
486 .hw = {
487 .clk = &timer1_fck,
488 },
489 .clkdm_name = "l4ls_clkdm",
490 .clksel = timer1_clkmux_sel,
491 .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
492 .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
493};
494
495DEFINE_STRUCT_CLK(timer1_fck, timer1_ck_parents, timer1_fck_ops);
496
497static const struct clksel timer2_to_7_clk_sel[] = {
498 { .parent = &tclkin_ck, .rates = div_1_0_rates },
499 { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
500 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
501 { .parent = NULL },
502};
503
504static const char *timer2_to_7_ck_parents[] = {
505 "tclkin_ck", "sys_clkin_ck", "clkdiv32k_ick",
506};
507
508static struct clk timer2_fck;
509
510static struct clk_hw_omap timer2_fck_hw = {
511 .hw = {
512 .clk = &timer2_fck,
513 },
514 .clkdm_name = "l4ls_clkdm",
515 .clksel = timer2_to_7_clk_sel,
516 .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
517 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
518};
519
520DEFINE_STRUCT_CLK(timer2_fck, timer2_to_7_ck_parents, timer1_fck_ops);
521
522static struct clk timer3_fck;
523
524static struct clk_hw_omap timer3_fck_hw = {
525 .hw = {
526 .clk = &timer3_fck,
527 },
528 .clkdm_name = "l4ls_clkdm",
529 .clksel = timer2_to_7_clk_sel,
530 .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
531 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
532};
533
534DEFINE_STRUCT_CLK(timer3_fck, timer2_to_7_ck_parents, timer1_fck_ops);
535
536static struct clk timer4_fck;
537
538static struct clk_hw_omap timer4_fck_hw = {
539 .hw = {
540 .clk = &timer4_fck,
541 },
542 .clkdm_name = "l4ls_clkdm",
543 .clksel = timer2_to_7_clk_sel,
544 .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
545 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
546};
547
548DEFINE_STRUCT_CLK(timer4_fck, timer2_to_7_ck_parents, timer1_fck_ops);
549
550static struct clk timer5_fck;
551
552static struct clk_hw_omap timer5_fck_hw = {
553 .hw = {
554 .clk = &timer5_fck,
555 },
556 .clkdm_name = "l4ls_clkdm",
557 .clksel = timer2_to_7_clk_sel,
558 .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
559 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
560};
561
562DEFINE_STRUCT_CLK(timer5_fck, timer2_to_7_ck_parents, timer1_fck_ops);
563
564static struct clk timer6_fck;
565
566static struct clk_hw_omap timer6_fck_hw = {
567 .hw = {
568 .clk = &timer6_fck,
569 },
570 .clkdm_name = "l4ls_clkdm",
571 .clksel = timer2_to_7_clk_sel,
572 .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
573 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
574};
575
576DEFINE_STRUCT_CLK(timer6_fck, timer2_to_7_ck_parents, timer1_fck_ops);
577
578static struct clk timer7_fck;
579
580static struct clk_hw_omap timer7_fck_hw = {
581 .hw = {
582 .clk = &timer7_fck,
583 },
584 .clkdm_name = "l4ls_clkdm",
585 .clksel = timer2_to_7_clk_sel,
586 .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
587 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
588};
589
590DEFINE_STRUCT_CLK(timer7_fck, timer2_to_7_ck_parents, timer1_fck_ops);
591
592DEFINE_CLK_FIXED_FACTOR(cpsw_125mhz_gclk,
593 "dpll_core_m5_ck",
594 &dpll_core_m5_ck,
595 0x0,
596 1, 2);
597
598static const struct clk_ops cpsw_fck_ops = {
599 .recalc_rate = &omap2_clksel_recalc,
600 .get_parent = &omap2_clksel_find_parent_index,
601 .set_parent = &omap2_clksel_set_parent,
602};
603
604static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
605 { .parent = &dpll_core_m5_ck, .rates = div_1_0_rates },
606 { .parent = &dpll_core_m4_ck, .rates = div_1_1_rates },
607 { .parent = NULL },
608};
609
610static const char *cpsw_cpts_rft_ck_parents[] = {
611 "dpll_core_m5_ck", "dpll_core_m4_ck",
612};
613
614static struct clk cpsw_cpts_rft_clk;
615
616static struct clk_hw_omap cpsw_cpts_rft_clk_hw = {
617 .hw = {
618 .clk = &cpsw_cpts_rft_clk,
619 },
620 .clkdm_name = "cpsw_125mhz_clkdm",
621 .clksel = cpsw_cpts_rft_clkmux_sel,
622 .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
623 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
624};
625
626DEFINE_STRUCT_CLK(cpsw_cpts_rft_clk, cpsw_cpts_rft_ck_parents, cpsw_fck_ops);
627
628
629/* gpio */
630static const char *gpio0_ck_parents[] = {
631 "clk_rc32k_ck", "clk_32768_ck", "clkdiv32k_ick",
632};
633
634static const struct clksel gpio0_dbclk_mux_sel[] = {
635 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
636 { .parent = &clk_32768_ck, .rates = div_1_1_rates },
637 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
638 { .parent = NULL },
639};
640
641static const struct clk_ops gpio_fck_ops = {
642 .recalc_rate = &omap2_clksel_recalc,
643 .get_parent = &omap2_clksel_find_parent_index,
644 .set_parent = &omap2_clksel_set_parent,
645 .init = &omap2_init_clk_clkdm,
646};
647
648static struct clk gpio0_dbclk_mux_ck;
649
650static struct clk_hw_omap gpio0_dbclk_mux_ck_hw = {
651 .hw = {
652 .clk = &gpio0_dbclk_mux_ck,
653 },
654 .clkdm_name = "l4_wkup_clkdm",
655 .clksel = gpio0_dbclk_mux_sel,
656 .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
657 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
658};
659
660DEFINE_STRUCT_CLK(gpio0_dbclk_mux_ck, gpio0_ck_parents, gpio_fck_ops);
661
662DEFINE_CLK_GATE(gpio0_dbclk, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, 0x0,
663 AM33XX_CM_WKUP_GPIO0_CLKCTRL,
664 AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT, 0x0, NULL);
665
666DEFINE_CLK_GATE(gpio1_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
667 AM33XX_CM_PER_GPIO1_CLKCTRL,
668 AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT, 0x0, NULL);
669
670DEFINE_CLK_GATE(gpio2_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
671 AM33XX_CM_PER_GPIO2_CLKCTRL,
672 AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT, 0x0, NULL);
673
674DEFINE_CLK_GATE(gpio3_dbclk, "clkdiv32k_ick", &clkdiv32k_ick, 0x0,
675 AM33XX_CM_PER_GPIO3_CLKCTRL,
676 AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT, 0x0, NULL);
677
678
679static const char *pruss_ck_parents[] = {
680 "l3_gclk", "dpll_disp_m2_ck",
681};
682
683static const struct clksel pruss_ocp_clk_mux_sel[] = {
684 { .parent = &l3_gclk, .rates = div_1_0_rates },
685 { .parent = &dpll_disp_m2_ck, .rates = div_1_1_rates },
686 { .parent = NULL },
687};
688
689static struct clk pruss_ocp_gclk;
690
691static struct clk_hw_omap pruss_ocp_gclk_hw = {
692 .hw = {
693 .clk = &pruss_ocp_gclk,
694 },
695 .clkdm_name = "pruss_ocp_clkdm",
696 .clksel = pruss_ocp_clk_mux_sel,
697 .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
698 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
699};
700
701DEFINE_STRUCT_CLK(pruss_ocp_gclk, pruss_ck_parents, gpio_fck_ops);
702
703static const char *lcd_ck_parents[] = {
704 "dpll_disp_m2_ck", "dpll_core_m5_ck", "dpll_per_m2_ck",
705};
706
707static const struct clksel lcd_clk_mux_sel[] = {
708 { .parent = &dpll_disp_m2_ck, .rates = div_1_0_rates },
709 { .parent = &dpll_core_m5_ck, .rates = div_1_1_rates },
710 { .parent = &dpll_per_m2_ck, .rates = div_1_2_rates },
711 { .parent = NULL },
712};
713
714static struct clk lcd_gclk;
715
716static struct clk_hw_omap lcd_gclk_hw = {
717 .hw = {
718 .clk = &lcd_gclk,
719 },
720 .clkdm_name = "lcdc_clkdm",
721 .clksel = lcd_clk_mux_sel,
722 .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
723 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
724};
725
726DEFINE_STRUCT_CLK(lcd_gclk, lcd_ck_parents, gpio_fck_ops);
727
728DEFINE_CLK_FIXED_FACTOR(mmc_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0, 1, 2);
729
730static const char *gfx_ck_parents[] = {
731 "dpll_core_m4_ck", "dpll_per_m2_ck",
732};
733
734static const struct clksel gfx_clksel_sel[] = {
735 { .parent = &dpll_core_m4_ck, .rates = div_1_0_rates },
736 { .parent = &dpll_per_m2_ck, .rates = div_1_1_rates },
737 { .parent = NULL },
738};
739
740static struct clk gfx_fclk_clksel_ck;
741
742static struct clk_hw_omap gfx_fclk_clksel_ck_hw = {
743 .hw = {
744 .clk = &gfx_fclk_clksel_ck,
745 },
746 .clksel = gfx_clksel_sel,
747 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
748 .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
749};
750
751DEFINE_STRUCT_CLK(gfx_fclk_clksel_ck, gfx_ck_parents, gpio_fck_ops);
752
753static const struct clk_div_table div_1_0_2_1_rates[] = {
754 { .div = 1, .val = 0, },
755 { .div = 2, .val = 1, },
756 { .div = 0 },
757};
758
759DEFINE_CLK_DIVIDER_TABLE(gfx_fck_div_ck, "gfx_fclk_clksel_ck",
760 &gfx_fclk_clksel_ck, 0x0, AM33XX_CLKSEL_GFX_FCLK,
761 AM33XX_CLKSEL_0_0_SHIFT, AM33XX_CLKSEL_0_0_WIDTH,
762 0x0, div_1_0_2_1_rates, NULL);
763
764static const char *sysclkout_ck_parents[] = {
765 "clk_32768_ck", "l3_gclk", "dpll_ddr_m2_ck", "dpll_per_m2_ck",
766 "lcd_gclk",
767};
768
769static const struct clksel sysclkout_pre_sel[] = {
770 { .parent = &clk_32768_ck, .rates = div_1_0_rates },
771 { .parent = &l3_gclk, .rates = div_1_1_rates },
772 { .parent = &dpll_ddr_m2_ck, .rates = div_1_2_rates },
773 { .parent = &dpll_per_m2_ck, .rates = div_1_3_rates },
774 { .parent = &lcd_gclk, .rates = div_1_4_rates },
775 { .parent = NULL },
776};
777
778static struct clk sysclkout_pre_ck;
779
780static struct clk_hw_omap sysclkout_pre_ck_hw = {
781 .hw = {
782 .clk = &sysclkout_pre_ck,
783 },
784 .clksel = sysclkout_pre_sel,
785 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
786 .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
787};
788
789DEFINE_STRUCT_CLK(sysclkout_pre_ck, sysclkout_ck_parents, gpio_fck_ops);
790
791/* Divide by 8 clock rates with default clock is 1/1*/
792static const struct clk_div_table div8_rates[] = {
793 { .div = 1, .val = 0, },
794 { .div = 2, .val = 1, },
795 { .div = 3, .val = 2, },
796 { .div = 4, .val = 3, },
797 { .div = 5, .val = 4, },
798 { .div = 6, .val = 5, },
799 { .div = 7, .val = 6, },
800 { .div = 8, .val = 7, },
801 { .div = 0 },
802};
803
804DEFINE_CLK_DIVIDER_TABLE(clkout2_div_ck, "sysclkout_pre_ck", &sysclkout_pre_ck,
805 0x0, AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2DIV_SHIFT,
806 AM33XX_CLKOUT2DIV_WIDTH, 0x0, div8_rates, NULL);
807
808DEFINE_CLK_GATE(clkout2_ck, "clkout2_div_ck", &clkout2_div_ck, 0x0,
809 AM33XX_CM_CLKOUT_CTRL, AM33XX_CLKOUT2EN_SHIFT, 0x0, NULL);
810
811static const char *wdt_ck_parents[] = {
812 "clk_rc32k_ck", "clkdiv32k_ick",
813};
814
815static const struct clksel wdt_clkmux_sel[] = {
816 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
817 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
818 { .parent = NULL },
819};
820
821static struct clk wdt1_fck;
822
823static struct clk_hw_omap wdt1_fck_hw = {
824 .hw = {
825 .clk = &wdt1_fck,
826 },
827 .clkdm_name = "l4_wkup_clkdm",
828 .clksel = wdt_clkmux_sel,
829 .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
830 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
831};
832
833DEFINE_STRUCT_CLK(wdt1_fck, wdt_ck_parents, gpio_fck_ops);
834
835/*
836 * clkdev
837 */
838static struct omap_clk am33xx_clks[] = {
839 CLK(NULL, "clk_32768_ck", &clk_32768_ck, CK_AM33XX),
840 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck, CK_AM33XX),
841 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_AM33XX),
842 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck, CK_AM33XX),
843 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck, CK_AM33XX),
844 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_AM33XX),
845 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_AM33XX),
846 CLK(NULL, "tclkin_ck", &tclkin_ck, CK_AM33XX),
847 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_AM33XX),
848 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_AM33XX),
849 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck, CK_AM33XX),
850 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX),
851 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX),
852 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX),
853 CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX),
854 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
855 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
856 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
857 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck, CK_AM33XX),
858 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck, CK_AM33XX),
859 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck, CK_AM33XX),
860 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_AM33XX),
861 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_AM33XX),
862 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck, CK_AM33XX),
863 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX),
864 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX),
865 CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX),
866 CLK(NULL, "clkdiv32k_ck", &clkdiv32k_ck, CK_AM33XX),
867 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX),
868 CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
869 CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX),
870 CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX),
871 CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX),
872 CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX),
873 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX),
874 CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX),
875 CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX),
876 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
877 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX),
878 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX),
879 CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX),
880 CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX),
881 CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX),
882 CLK(NULL, "timer4_fck", &timer4_fck, CK_AM33XX),
883 CLK(NULL, "timer5_fck", &timer5_fck, CK_AM33XX),
884 CLK(NULL, "timer6_fck", &timer6_fck, CK_AM33XX),
885 CLK(NULL, "timer7_fck", &timer7_fck, CK_AM33XX),
886 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX),
887 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX),
888 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX),
889 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk, CK_AM33XX),
890 CLK(NULL, "l3_gclk", &l3_gclk, CK_AM33XX),
891 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck, CK_AM33XX),
892 CLK(NULL, "l4hs_gclk", &l4hs_gclk, CK_AM33XX),
893 CLK(NULL, "l3s_gclk", &l3s_gclk, CK_AM33XX),
894 CLK(NULL, "l4fw_gclk", &l4fw_gclk, CK_AM33XX),
895 CLK(NULL, "l4ls_gclk", &l4ls_gclk, CK_AM33XX),
896 CLK(NULL, "clk_24mhz", &clk_24mhz, CK_AM33XX),
897 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck, CK_AM33XX),
898 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk, CK_AM33XX),
899 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk, CK_AM33XX),
900 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, CK_AM33XX),
901 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk, CK_AM33XX),
902 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_AM33XX),
903 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_AM33XX),
904 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_AM33XX),
905 CLK(NULL, "lcd_gclk", &lcd_gclk, CK_AM33XX),
906 CLK(NULL, "mmc_clk", &mmc_clk, CK_AM33XX),
907 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX),
908 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX),
909 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX),
910 CLK(NULL, "clkout2_div_ck", &clkout2_div_ck, CK_AM33XX),
911 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX),
912 CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX),
913};
914
915
916static const char *enable_init_clks[] = {
917 "dpll_ddr_m2_ck",
918 "dpll_mpu_m2_ck",
919 "l3_gclk",
920 "l4hs_gclk",
921 "l4fw_gclk",
922 "l4ls_gclk",
923};
924
925int __init am33xx_clk_init(void)
926{
927 struct omap_clk *c;
928 u32 cpu_clkflg;
929
930 if (soc_is_am33xx()) {
931 cpu_mask = RATE_IN_AM33XX;
932 cpu_clkflg = CK_AM33XX;
933 }
934
935 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
936 if (c->cpu & cpu_clkflg) {
937 clkdev_add(&c->lk);
938 if (!__clk_init(NULL, c->lk.clk))
939 omap2_init_clk_hw_omap_clocks(c->lk.clk);
940 }
941 }
942
943 omap2_clk_disable_autoidle_all();
944
945 omap2_clk_enable_init_clocks(enable_init_clks,
946 ARRAY_SIZE(enable_init_clks));
947
948 /* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
949 * physically present, in such a case HWMOD enabling of
950 * clock would be failure with default parent. And timer
951 * probe thinks clock is already enabled, this leads to
952 * crash upon accessing timer 3 & 6 registers in probe.
953 * Fix by setting parent of both these timers to master
954 * oscillator clock.
955 */
956
957 clk_set_parent(&timer3_fck, &sys_clkin_ck);
958 clk_set_parent(&timer6_fck, &sys_clkin_ck);
959
960 return 0;
961}
diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c b/arch/arm/mach-omap2/cclock3xxx_data.c
new file mode 100644
index 000000000000..bdf39481fbd6
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -0,0 +1,3595 @@
1/*
2 * OMAP3 clock data
3 *
4 * Copyright (C) 2007-2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * Updated to COMMON clk data format by Rajendra Nayak <rnayak@ti.com>
9 * With many device clock fixes by Kevin Hilman and Jouni Högander
10 * DPLL bypass clock support added by Roman Tereshonkov
11 *
12 */
13
14/*
15 * Virtual clocks are introduced as convenient tools.
16 * They are sources for other clocks and not supposed
17 * to be requested from drivers directly.
18 */
19
20#include <linux/kernel.h>
21#include <linux/clk.h>
22#include <linux/clk-private.h>
23#include <linux/list.h>
24#include <linux/io.h>
25
26#include "soc.h"
27#include "iomap.h"
28#include "clock.h"
29#include "clock3xxx.h"
30#include "clock34xx.h"
31#include "clock36xx.h"
32#include "clock3517.h"
33#include "cm3xxx.h"
34#include "cm-regbits-34xx.h"
35#include "prm3xxx.h"
36#include "prm-regbits-34xx.h"
37#include "control.h"
38
39/*
40 * clocks
41 */
42
43#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
44
45/* Maximum DPLL multiplier, divider values for OMAP3 */
46#define OMAP3_MAX_DPLL_MULT 2047
47#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095
48#define OMAP3_MAX_DPLL_DIV 128
49
50DEFINE_CLK_FIXED_RATE(dummy_apb_pclk, CLK_IS_ROOT, 0x0, 0x0);
51
52DEFINE_CLK_FIXED_RATE(mcbsp_clks, CLK_IS_ROOT, 0x0, 0x0);
53
54DEFINE_CLK_FIXED_RATE(omap_32k_fck, CLK_IS_ROOT, 32768, 0x0);
55
56DEFINE_CLK_FIXED_RATE(pclk_ck, CLK_IS_ROOT, 27000000, 0x0);
57
58DEFINE_CLK_FIXED_RATE(rmii_ck, CLK_IS_ROOT, 50000000, 0x0);
59
60DEFINE_CLK_FIXED_RATE(secure_32k_fck, CLK_IS_ROOT, 32768, 0x0);
61
62DEFINE_CLK_FIXED_RATE(sys_altclk, CLK_IS_ROOT, 0x0, 0x0);
63
64DEFINE_CLK_FIXED_RATE(virt_12m_ck, CLK_IS_ROOT, 12000000, 0x0);
65
66DEFINE_CLK_FIXED_RATE(virt_13m_ck, CLK_IS_ROOT, 13000000, 0x0);
67
68DEFINE_CLK_FIXED_RATE(virt_16_8m_ck, CLK_IS_ROOT, 16800000, 0x0);
69
70DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
71
72DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
73
74DEFINE_CLK_FIXED_RATE(virt_38_4m_ck, CLK_IS_ROOT, 38400000, 0x0);
75
76static const char *osc_sys_ck_parent_names[] = {
77 "virt_12m_ck", "virt_13m_ck", "virt_19200000_ck", "virt_26000000_ck",
78 "virt_38_4m_ck", "virt_16_8m_ck",
79};
80
81DEFINE_CLK_MUX(osc_sys_ck, osc_sys_ck_parent_names, NULL, 0x0,
82 OMAP3430_PRM_CLKSEL, OMAP3430_SYS_CLKIN_SEL_SHIFT,
83 OMAP3430_SYS_CLKIN_SEL_WIDTH, 0x0, NULL);
84
85DEFINE_CLK_DIVIDER(sys_ck, "osc_sys_ck", &osc_sys_ck, 0x0,
86 OMAP3430_PRM_CLKSRC_CTRL, OMAP_SYSCLKDIV_SHIFT,
87 OMAP_SYSCLKDIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
88
89static struct dpll_data dpll3_dd = {
90 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
91 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
92 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
93 .clk_bypass = &sys_ck,
94 .clk_ref = &sys_ck,
95 .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK,
96 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
97 .enable_mask = OMAP3430_EN_CORE_DPLL_MASK,
98 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
99 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
100 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
101 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
102 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
103 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
104 .idlest_mask = OMAP3430_ST_CORE_CLK_MASK,
105 .max_multiplier = OMAP3_MAX_DPLL_MULT,
106 .min_divider = 1,
107 .max_divider = OMAP3_MAX_DPLL_DIV,
108};
109
110static struct clk dpll3_ck;
111
112static const char *dpll3_ck_parent_names[] = {
113 "sys_ck",
114};
115
116static const struct clk_ops dpll3_ck_ops = {
117 .init = &omap2_init_clk_clkdm,
118 .get_parent = &omap2_init_dpll_parent,
119 .recalc_rate = &omap3_dpll_recalc,
120 .round_rate = &omap2_dpll_round_rate,
121};
122
123static struct clk_hw_omap dpll3_ck_hw = {
124 .hw = {
125 .clk = &dpll3_ck,
126 },
127 .ops = &clkhwops_omap3_dpll,
128 .dpll_data = &dpll3_dd,
129 .clkdm_name = "dpll3_clkdm",
130};
131
132DEFINE_STRUCT_CLK(dpll3_ck, dpll3_ck_parent_names, dpll3_ck_ops);
133
134DEFINE_CLK_DIVIDER(dpll3_m2_ck, "dpll3_ck", &dpll3_ck, 0x0,
135 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
136 OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT,
137 OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH,
138 CLK_DIVIDER_ONE_BASED, NULL);
139
140static struct clk core_ck;
141
142static const char *core_ck_parent_names[] = {
143 "dpll3_m2_ck",
144};
145
146static const struct clk_ops core_ck_ops = {};
147
148DEFINE_STRUCT_CLK_HW_OMAP(core_ck, NULL);
149DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
150
151DEFINE_CLK_DIVIDER(l3_ick, "core_ck", &core_ck, 0x0,
152 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
153 OMAP3430_CLKSEL_L3_SHIFT, OMAP3430_CLKSEL_L3_WIDTH,
154 CLK_DIVIDER_ONE_BASED, NULL);
155
156DEFINE_CLK_DIVIDER(l4_ick, "l3_ick", &l3_ick, 0x0,
157 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
158 OMAP3430_CLKSEL_L4_SHIFT, OMAP3430_CLKSEL_L4_WIDTH,
159 CLK_DIVIDER_ONE_BASED, NULL);
160
161static struct clk security_l4_ick2;
162
163static const char *security_l4_ick2_parent_names[] = {
164 "l4_ick",
165};
166
167DEFINE_STRUCT_CLK_HW_OMAP(security_l4_ick2, NULL);
168DEFINE_STRUCT_CLK(security_l4_ick2, security_l4_ick2_parent_names, core_ck_ops);
169
170static struct clk aes1_ick;
171
172static const char *aes1_ick_parent_names[] = {
173 "security_l4_ick2",
174};
175
176static const struct clk_ops aes1_ick_ops = {
177 .enable = &omap2_dflt_clk_enable,
178 .disable = &omap2_dflt_clk_disable,
179 .is_enabled = &omap2_dflt_clk_is_enabled,
180};
181
182static struct clk_hw_omap aes1_ick_hw = {
183 .hw = {
184 .clk = &aes1_ick,
185 },
186 .ops = &clkhwops_iclk_wait,
187 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
188 .enable_bit = OMAP3430_EN_AES1_SHIFT,
189};
190
191DEFINE_STRUCT_CLK(aes1_ick, aes1_ick_parent_names, aes1_ick_ops);
192
193static struct clk core_l4_ick;
194
195static const struct clk_ops core_l4_ick_ops = {
196 .init = &omap2_init_clk_clkdm,
197};
198
199DEFINE_STRUCT_CLK_HW_OMAP(core_l4_ick, "core_l4_clkdm");
200DEFINE_STRUCT_CLK(core_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
201
202static struct clk aes2_ick;
203
204static const char *aes2_ick_parent_names[] = {
205 "core_l4_ick",
206};
207
208static const struct clk_ops aes2_ick_ops = {
209 .init = &omap2_init_clk_clkdm,
210 .enable = &omap2_dflt_clk_enable,
211 .disable = &omap2_dflt_clk_disable,
212 .is_enabled = &omap2_dflt_clk_is_enabled,
213};
214
215static struct clk_hw_omap aes2_ick_hw = {
216 .hw = {
217 .clk = &aes2_ick,
218 },
219 .ops = &clkhwops_iclk_wait,
220 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
221 .enable_bit = OMAP3430_EN_AES2_SHIFT,
222 .clkdm_name = "core_l4_clkdm",
223};
224
225DEFINE_STRUCT_CLK(aes2_ick, aes2_ick_parent_names, aes2_ick_ops);
226
227static struct clk dpll1_fck;
228
229static struct dpll_data dpll1_dd = {
230 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
231 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
232 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
233 .clk_bypass = &dpll1_fck,
234 .clk_ref = &sys_ck,
235 .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK,
236 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
237 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
238 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
239 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
240 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
241 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
242 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
243 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
244 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
245 .idlest_mask = OMAP3430_ST_MPU_CLK_MASK,
246 .max_multiplier = OMAP3_MAX_DPLL_MULT,
247 .min_divider = 1,
248 .max_divider = OMAP3_MAX_DPLL_DIV,
249};
250
251static struct clk dpll1_ck;
252
253static const struct clk_ops dpll1_ck_ops = {
254 .init = &omap2_init_clk_clkdm,
255 .enable = &omap3_noncore_dpll_enable,
256 .disable = &omap3_noncore_dpll_disable,
257 .get_parent = &omap2_init_dpll_parent,
258 .recalc_rate = &omap3_dpll_recalc,
259 .set_rate = &omap3_noncore_dpll_set_rate,
260 .round_rate = &omap2_dpll_round_rate,
261};
262
263static struct clk_hw_omap dpll1_ck_hw = {
264 .hw = {
265 .clk = &dpll1_ck,
266 },
267 .ops = &clkhwops_omap3_dpll,
268 .dpll_data = &dpll1_dd,
269 .clkdm_name = "dpll1_clkdm",
270};
271
272DEFINE_STRUCT_CLK(dpll1_ck, dpll3_ck_parent_names, dpll1_ck_ops);
273
274DEFINE_CLK_FIXED_FACTOR(dpll1_x2_ck, "dpll1_ck", &dpll1_ck, 0x0, 2, 1);
275
276DEFINE_CLK_DIVIDER(dpll1_x2m2_ck, "dpll1_x2_ck", &dpll1_x2_ck, 0x0,
277 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
278 OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT,
279 OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH,
280 CLK_DIVIDER_ONE_BASED, NULL);
281
282static struct clk mpu_ck;
283
284static const char *mpu_ck_parent_names[] = {
285 "dpll1_x2m2_ck",
286};
287
288DEFINE_STRUCT_CLK_HW_OMAP(mpu_ck, "mpu_clkdm");
289DEFINE_STRUCT_CLK(mpu_ck, mpu_ck_parent_names, core_l4_ick_ops);
290
291DEFINE_CLK_DIVIDER(arm_fck, "mpu_ck", &mpu_ck, 0x0,
292 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
293 OMAP3430_ST_MPU_CLK_SHIFT, OMAP3430_ST_MPU_CLK_WIDTH,
294 0x0, NULL);
295
296static struct clk cam_ick;
297
298static struct clk_hw_omap cam_ick_hw = {
299 .hw = {
300 .clk = &cam_ick,
301 },
302 .ops = &clkhwops_iclk,
303 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
304 .enable_bit = OMAP3430_EN_CAM_SHIFT,
305 .clkdm_name = "cam_clkdm",
306};
307
308DEFINE_STRUCT_CLK(cam_ick, security_l4_ick2_parent_names, aes2_ick_ops);
309
310/* DPLL4 */
311/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
312/* Type: DPLL */
313static struct dpll_data dpll4_dd;
314
315static struct dpll_data dpll4_dd_34xx __initdata = {
316 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
317 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
318 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
319 .clk_bypass = &sys_ck,
320 .clk_ref = &sys_ck,
321 .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK,
322 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
323 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
324 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
325 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
326 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
327 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
328 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
329 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
330 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
331 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
332 .max_multiplier = OMAP3_MAX_DPLL_MULT,
333 .min_divider = 1,
334 .max_divider = OMAP3_MAX_DPLL_DIV,
335};
336
337static struct dpll_data dpll4_dd_3630 __initdata = {
338 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
339 .mult_mask = OMAP3630_PERIPH_DPLL_MULT_MASK,
340 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
341 .clk_bypass = &sys_ck,
342 .clk_ref = &sys_ck,
343 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
344 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
345 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
346 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
347 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
348 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
349 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
350 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
351 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
352 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
353 .dco_mask = OMAP3630_PERIPH_DPLL_DCO_SEL_MASK,
354 .sddiv_mask = OMAP3630_PERIPH_DPLL_SD_DIV_MASK,
355 .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT,
356 .min_divider = 1,
357 .max_divider = OMAP3_MAX_DPLL_DIV,
358 .flags = DPLL_J_TYPE
359};
360
361static struct clk dpll4_ck;
362
363static const struct clk_ops dpll4_ck_ops = {
364 .init = &omap2_init_clk_clkdm,
365 .enable = &omap3_noncore_dpll_enable,
366 .disable = &omap3_noncore_dpll_disable,
367 .get_parent = &omap2_init_dpll_parent,
368 .recalc_rate = &omap3_dpll_recalc,
369 .set_rate = &omap3_dpll4_set_rate,
370 .round_rate = &omap2_dpll_round_rate,
371};
372
373static struct clk_hw_omap dpll4_ck_hw = {
374 .hw = {
375 .clk = &dpll4_ck,
376 },
377 .dpll_data = &dpll4_dd,
378 .ops = &clkhwops_omap3_dpll,
379 .clkdm_name = "dpll4_clkdm",
380};
381
382DEFINE_STRUCT_CLK(dpll4_ck, dpll3_ck_parent_names, dpll4_ck_ops);
383
384DEFINE_CLK_DIVIDER(dpll4_m5_ck, "dpll4_ck", &dpll4_ck, 0x0,
385 OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
386 OMAP3430_CLKSEL_CAM_SHIFT, OMAP3630_CLKSEL_CAM_WIDTH,
387 CLK_DIVIDER_ONE_BASED, NULL);
388
389static struct clk dpll4_m5x2_ck;
390
391static const char *dpll4_m5x2_ck_parent_names[] = {
392 "dpll4_m5_ck",
393};
394
395static const struct clk_ops dpll4_m5x2_ck_ops = {
396 .init = &omap2_init_clk_clkdm,
397 .enable = &omap2_dflt_clk_enable,
398 .disable = &omap2_dflt_clk_disable,
399 .is_enabled = &omap2_dflt_clk_is_enabled,
400 .recalc_rate = &omap3_clkoutx2_recalc,
401};
402
403static const struct clk_ops dpll4_m5x2_ck_3630_ops = {
404 .init = &omap2_init_clk_clkdm,
405 .enable = &omap36xx_pwrdn_clk_enable_with_hsdiv_restore,
406 .disable = &omap2_dflt_clk_disable,
407 .recalc_rate = &omap3_clkoutx2_recalc,
408};
409
410static struct clk_hw_omap dpll4_m5x2_ck_hw = {
411 .hw = {
412 .clk = &dpll4_m5x2_ck,
413 },
414 .ops = &clkhwops_wait,
415 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
416 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
417 .flags = INVERT_ENABLE,
418 .clkdm_name = "dpll4_clkdm",
419};
420
421DEFINE_STRUCT_CLK(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names, dpll4_m5x2_ck_ops);
422
423static struct clk dpll4_m5x2_ck_3630 = {
424 .name = "dpll4_m5x2_ck",
425 .hw = &dpll4_m5x2_ck_hw.hw,
426 .parent_names = dpll4_m5x2_ck_parent_names,
427 .num_parents = ARRAY_SIZE(dpll4_m5x2_ck_parent_names),
428 .ops = &dpll4_m5x2_ck_3630_ops,
429};
430
431static struct clk cam_mclk;
432
433static const char *cam_mclk_parent_names[] = {
434 "dpll4_m5x2_ck",
435};
436
437static struct clk_hw_omap cam_mclk_hw = {
438 .hw = {
439 .clk = &cam_mclk,
440 },
441 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
442 .enable_bit = OMAP3430_EN_CAM_SHIFT,
443 .clkdm_name = "cam_clkdm",
444};
445
446DEFINE_STRUCT_CLK(cam_mclk, cam_mclk_parent_names, aes2_ick_ops);
447
448static const struct clksel_rate clkout2_src_core_rates[] = {
449 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
450 { .div = 0 }
451};
452
453static const struct clksel_rate clkout2_src_sys_rates[] = {
454 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
455 { .div = 0 }
456};
457
458static const struct clksel_rate clkout2_src_96m_rates[] = {
459 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
460 { .div = 0 }
461};
462
463DEFINE_CLK_DIVIDER(dpll4_m2_ck, "dpll4_ck", &dpll4_ck, 0x0,
464 OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3),
465 OMAP3430_DIV_96M_SHIFT, OMAP3630_DIV_96M_WIDTH,
466 CLK_DIVIDER_ONE_BASED, NULL);
467
468static struct clk dpll4_m2x2_ck;
469
470static const char *dpll4_m2x2_ck_parent_names[] = {
471 "dpll4_m2_ck",
472};
473
474static struct clk_hw_omap dpll4_m2x2_ck_hw = {
475 .hw = {
476 .clk = &dpll4_m2x2_ck,
477 },
478 .ops = &clkhwops_wait,
479 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
480 .enable_bit = OMAP3430_PWRDN_96M_SHIFT,
481 .flags = INVERT_ENABLE,
482 .clkdm_name = "dpll4_clkdm",
483};
484
485DEFINE_STRUCT_CLK(dpll4_m2x2_ck, dpll4_m2x2_ck_parent_names, dpll4_m5x2_ck_ops);
486
487static struct clk dpll4_m2x2_ck_3630 = {
488 .name = "dpll4_m2x2_ck",
489 .hw = &dpll4_m2x2_ck_hw.hw,
490 .parent_names = dpll4_m2x2_ck_parent_names,
491 .num_parents = ARRAY_SIZE(dpll4_m2x2_ck_parent_names),
492 .ops = &dpll4_m5x2_ck_3630_ops,
493};
494
495static struct clk omap_96m_alwon_fck;
496
497static const char *omap_96m_alwon_fck_parent_names[] = {
498 "dpll4_m2x2_ck",
499};
500
501DEFINE_STRUCT_CLK_HW_OMAP(omap_96m_alwon_fck, NULL);
502DEFINE_STRUCT_CLK(omap_96m_alwon_fck, omap_96m_alwon_fck_parent_names,
503 core_ck_ops);
504
505static struct clk cm_96m_fck;
506
507static const char *cm_96m_fck_parent_names[] = {
508 "omap_96m_alwon_fck",
509};
510
511DEFINE_STRUCT_CLK_HW_OMAP(cm_96m_fck, NULL);
512DEFINE_STRUCT_CLK(cm_96m_fck, cm_96m_fck_parent_names, core_ck_ops);
513
514static const struct clksel_rate clkout2_src_54m_rates[] = {
515 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
516 { .div = 0 }
517};
518
519DEFINE_CLK_DIVIDER(dpll4_m3_ck, "dpll4_ck", &dpll4_ck, 0x0,
520 OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
521 OMAP3430_CLKSEL_TV_SHIFT, OMAP3630_CLKSEL_TV_WIDTH,
522 CLK_DIVIDER_ONE_BASED, NULL);
523
524static struct clk dpll4_m3x2_ck;
525
526static const char *dpll4_m3x2_ck_parent_names[] = {
527 "dpll4_m3_ck",
528};
529
530static struct clk_hw_omap dpll4_m3x2_ck_hw = {
531 .hw = {
532 .clk = &dpll4_m3x2_ck,
533 },
534 .ops = &clkhwops_wait,
535 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
536 .enable_bit = OMAP3430_PWRDN_TV_SHIFT,
537 .flags = INVERT_ENABLE,
538 .clkdm_name = "dpll4_clkdm",
539};
540
541DEFINE_STRUCT_CLK(dpll4_m3x2_ck, dpll4_m3x2_ck_parent_names, dpll4_m5x2_ck_ops);
542
543static struct clk dpll4_m3x2_ck_3630 = {
544 .name = "dpll4_m3x2_ck",
545 .hw = &dpll4_m3x2_ck_hw.hw,
546 .parent_names = dpll4_m3x2_ck_parent_names,
547 .num_parents = ARRAY_SIZE(dpll4_m3x2_ck_parent_names),
548 .ops = &dpll4_m5x2_ck_3630_ops,
549};
550
551static const char *omap_54m_fck_parent_names[] = {
552 "dpll4_m3x2_ck", "sys_altclk",
553};
554
555DEFINE_CLK_MUX(omap_54m_fck, omap_54m_fck_parent_names, NULL, 0x0,
556 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1), OMAP3430_SOURCE_54M_SHIFT,
557 OMAP3430_SOURCE_54M_WIDTH, 0x0, NULL);
558
559static const struct clksel clkout2_src_clksel[] = {
560 { .parent = &core_ck, .rates = clkout2_src_core_rates },
561 { .parent = &sys_ck, .rates = clkout2_src_sys_rates },
562 { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates },
563 { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates },
564 { .parent = NULL },
565};
566
567static const char *clkout2_src_ck_parent_names[] = {
568 "core_ck", "sys_ck", "cm_96m_fck", "omap_54m_fck",
569};
570
571static const struct clk_ops clkout2_src_ck_ops = {
572 .init = &omap2_init_clk_clkdm,
573 .enable = &omap2_dflt_clk_enable,
574 .disable = &omap2_dflt_clk_disable,
575 .is_enabled = &omap2_dflt_clk_is_enabled,
576 .recalc_rate = &omap2_clksel_recalc,
577 .get_parent = &omap2_clksel_find_parent_index,
578 .set_parent = &omap2_clksel_set_parent,
579};
580
581DEFINE_CLK_OMAP_MUX_GATE(clkout2_src_ck, "core_clkdm",
582 clkout2_src_clksel, OMAP3430_CM_CLKOUT_CTRL,
583 OMAP3430_CLKOUT2SOURCE_MASK,
584 OMAP3430_CM_CLKOUT_CTRL, OMAP3430_CLKOUT2_EN_SHIFT,
585 NULL, clkout2_src_ck_parent_names, clkout2_src_ck_ops);
586
587static const struct clksel_rate omap_48m_cm96m_rates[] = {
588 { .div = 2, .val = 0, .flags = RATE_IN_3XXX },
589 { .div = 0 }
590};
591
592static const struct clksel_rate omap_48m_alt_rates[] = {
593 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
594 { .div = 0 }
595};
596
597static const struct clksel omap_48m_clksel[] = {
598 { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates },
599 { .parent = &sys_altclk, .rates = omap_48m_alt_rates },
600 { .parent = NULL },
601};
602
603static const char *omap_48m_fck_parent_names[] = {
604 "cm_96m_fck", "sys_altclk",
605};
606
607static struct clk omap_48m_fck;
608
609static const struct clk_ops omap_48m_fck_ops = {
610 .recalc_rate = &omap2_clksel_recalc,
611 .get_parent = &omap2_clksel_find_parent_index,
612 .set_parent = &omap2_clksel_set_parent,
613};
614
615static struct clk_hw_omap omap_48m_fck_hw = {
616 .hw = {
617 .clk = &omap_48m_fck,
618 },
619 .clksel = omap_48m_clksel,
620 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
621 .clksel_mask = OMAP3430_SOURCE_48M_MASK,
622};
623
624DEFINE_STRUCT_CLK(omap_48m_fck, omap_48m_fck_parent_names, omap_48m_fck_ops);
625
626DEFINE_CLK_FIXED_FACTOR(omap_12m_fck, "omap_48m_fck", &omap_48m_fck, 0x0, 1, 4);
627
628static struct clk core_12m_fck;
629
630static const char *core_12m_fck_parent_names[] = {
631 "omap_12m_fck",
632};
633
634DEFINE_STRUCT_CLK_HW_OMAP(core_12m_fck, "core_l4_clkdm");
635DEFINE_STRUCT_CLK(core_12m_fck, core_12m_fck_parent_names, core_l4_ick_ops);
636
637static struct clk core_48m_fck;
638
639static const char *core_48m_fck_parent_names[] = {
640 "omap_48m_fck",
641};
642
643DEFINE_STRUCT_CLK_HW_OMAP(core_48m_fck, "core_l4_clkdm");
644DEFINE_STRUCT_CLK(core_48m_fck, core_48m_fck_parent_names, core_l4_ick_ops);
645
646static const char *omap_96m_fck_parent_names[] = {
647 "cm_96m_fck", "sys_ck",
648};
649
650DEFINE_CLK_MUX(omap_96m_fck, omap_96m_fck_parent_names, NULL, 0x0,
651 OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
652 OMAP3430_SOURCE_96M_SHIFT, OMAP3430_SOURCE_96M_WIDTH, 0x0, NULL);
653
654static struct clk core_96m_fck;
655
656static const char *core_96m_fck_parent_names[] = {
657 "omap_96m_fck",
658};
659
660DEFINE_STRUCT_CLK_HW_OMAP(core_96m_fck, "core_l4_clkdm");
661DEFINE_STRUCT_CLK(core_96m_fck, core_96m_fck_parent_names, core_l4_ick_ops);
662
663static struct clk core_l3_ick;
664
665static const char *core_l3_ick_parent_names[] = {
666 "l3_ick",
667};
668
669DEFINE_STRUCT_CLK_HW_OMAP(core_l3_ick, "core_l3_clkdm");
670DEFINE_STRUCT_CLK(core_l3_ick, core_l3_ick_parent_names, core_l4_ick_ops);
671
672DEFINE_CLK_FIXED_FACTOR(dpll3_m2x2_ck, "dpll3_m2_ck", &dpll3_m2_ck, 0x0, 2, 1);
673
674static struct clk corex2_fck;
675
676static const char *corex2_fck_parent_names[] = {
677 "dpll3_m2x2_ck",
678};
679
680DEFINE_STRUCT_CLK_HW_OMAP(corex2_fck, NULL);
681DEFINE_STRUCT_CLK(corex2_fck, corex2_fck_parent_names, core_ck_ops);
682
683static struct clk cpefuse_fck;
684
685static struct clk_hw_omap cpefuse_fck_hw = {
686 .hw = {
687 .clk = &cpefuse_fck,
688 },
689 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
690 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
691 .clkdm_name = "core_l4_clkdm",
692};
693
694DEFINE_STRUCT_CLK(cpefuse_fck, dpll3_ck_parent_names, aes2_ick_ops);
695
696static struct clk csi2_96m_fck;
697
698static const char *csi2_96m_fck_parent_names[] = {
699 "core_96m_fck",
700};
701
702static struct clk_hw_omap csi2_96m_fck_hw = {
703 .hw = {
704 .clk = &csi2_96m_fck,
705 },
706 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
707 .enable_bit = OMAP3430_EN_CSI2_SHIFT,
708 .clkdm_name = "cam_clkdm",
709};
710
711DEFINE_STRUCT_CLK(csi2_96m_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
712
713static struct clk d2d_26m_fck;
714
715static struct clk_hw_omap d2d_26m_fck_hw = {
716 .hw = {
717 .clk = &d2d_26m_fck,
718 },
719 .ops = &clkhwops_wait,
720 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
721 .enable_bit = OMAP3430ES1_EN_D2D_SHIFT,
722 .clkdm_name = "d2d_clkdm",
723};
724
725DEFINE_STRUCT_CLK(d2d_26m_fck, dpll3_ck_parent_names, aes2_ick_ops);
726
727static struct clk des1_ick;
728
729static struct clk_hw_omap des1_ick_hw = {
730 .hw = {
731 .clk = &des1_ick,
732 },
733 .ops = &clkhwops_iclk_wait,
734 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
735 .enable_bit = OMAP3430_EN_DES1_SHIFT,
736};
737
738DEFINE_STRUCT_CLK(des1_ick, aes1_ick_parent_names, aes1_ick_ops);
739
740static struct clk des2_ick;
741
742static struct clk_hw_omap des2_ick_hw = {
743 .hw = {
744 .clk = &des2_ick,
745 },
746 .ops = &clkhwops_iclk_wait,
747 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
748 .enable_bit = OMAP3430_EN_DES2_SHIFT,
749 .clkdm_name = "core_l4_clkdm",
750};
751
752DEFINE_STRUCT_CLK(des2_ick, aes2_ick_parent_names, aes2_ick_ops);
753
754DEFINE_CLK_DIVIDER(dpll1_fck, "core_ck", &core_ck, 0x0,
755 OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
756 OMAP3430_MPU_CLK_SRC_SHIFT, OMAP3430_MPU_CLK_SRC_WIDTH,
757 CLK_DIVIDER_ONE_BASED, NULL);
758
759static struct clk dpll2_fck;
760
761static struct dpll_data dpll2_dd = {
762 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
763 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
764 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
765 .clk_bypass = &dpll2_fck,
766 .clk_ref = &sys_ck,
767 .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK,
768 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
769 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
770 .modes = ((1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
771 (1 << DPLL_LOW_POWER_BYPASS)),
772 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
773 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
774 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
775 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
776 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
777 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
778 .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK,
779 .max_multiplier = OMAP3_MAX_DPLL_MULT,
780 .min_divider = 1,
781 .max_divider = OMAP3_MAX_DPLL_DIV,
782};
783
784static struct clk dpll2_ck;
785
786static struct clk_hw_omap dpll2_ck_hw = {
787 .hw = {
788 .clk = &dpll2_ck,
789 },
790 .ops = &clkhwops_omap3_dpll,
791 .dpll_data = &dpll2_dd,
792 .clkdm_name = "dpll2_clkdm",
793};
794
795DEFINE_STRUCT_CLK(dpll2_ck, dpll3_ck_parent_names, dpll1_ck_ops);
796
797DEFINE_CLK_DIVIDER(dpll2_fck, "core_ck", &core_ck, 0x0,
798 OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
799 OMAP3430_IVA2_CLK_SRC_SHIFT, OMAP3430_IVA2_CLK_SRC_WIDTH,
800 CLK_DIVIDER_ONE_BASED, NULL);
801
802DEFINE_CLK_DIVIDER(dpll2_m2_ck, "dpll2_ck", &dpll2_ck, 0x0,
803 OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL2_PLL),
804 OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT,
805 OMAP3430_IVA2_DPLL_CLKOUT_DIV_WIDTH,
806 CLK_DIVIDER_ONE_BASED, NULL);
807
808DEFINE_CLK_DIVIDER(dpll3_m3_ck, "dpll3_ck", &dpll3_ck, 0x0,
809 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
810 OMAP3430_DIV_DPLL3_SHIFT, OMAP3430_DIV_DPLL3_WIDTH,
811 CLK_DIVIDER_ONE_BASED, NULL);
812
813static struct clk dpll3_m3x2_ck;
814
815static const char *dpll3_m3x2_ck_parent_names[] = {
816 "dpll3_m3_ck",
817};
818
819static struct clk_hw_omap dpll3_m3x2_ck_hw = {
820 .hw = {
821 .clk = &dpll3_m3x2_ck,
822 },
823 .ops = &clkhwops_wait,
824 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
825 .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT,
826 .flags = INVERT_ENABLE,
827 .clkdm_name = "dpll3_clkdm",
828};
829
830DEFINE_STRUCT_CLK(dpll3_m3x2_ck, dpll3_m3x2_ck_parent_names, dpll4_m5x2_ck_ops);
831
832static struct clk dpll3_m3x2_ck_3630 = {
833 .name = "dpll3_m3x2_ck",
834 .hw = &dpll3_m3x2_ck_hw.hw,
835 .parent_names = dpll3_m3x2_ck_parent_names,
836 .num_parents = ARRAY_SIZE(dpll3_m3x2_ck_parent_names),
837 .ops = &dpll4_m5x2_ck_3630_ops,
838};
839
840DEFINE_CLK_FIXED_FACTOR(dpll3_x2_ck, "dpll3_ck", &dpll3_ck, 0x0, 2, 1);
841
842DEFINE_CLK_DIVIDER(dpll4_m4_ck, "dpll4_ck", &dpll4_ck, 0x0,
843 OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
844 OMAP3430_CLKSEL_DSS1_SHIFT, OMAP3630_CLKSEL_DSS1_WIDTH,
845 CLK_DIVIDER_ONE_BASED, NULL);
846
847static struct clk dpll4_m4x2_ck;
848
849static const char *dpll4_m4x2_ck_parent_names[] = {
850 "dpll4_m4_ck",
851};
852
853static struct clk_hw_omap dpll4_m4x2_ck_hw = {
854 .hw = {
855 .clk = &dpll4_m4x2_ck,
856 },
857 .ops = &clkhwops_wait,
858 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
859 .enable_bit = OMAP3430_PWRDN_DSS1_SHIFT,
860 .flags = INVERT_ENABLE,
861 .clkdm_name = "dpll4_clkdm",
862};
863
864DEFINE_STRUCT_CLK(dpll4_m4x2_ck, dpll4_m4x2_ck_parent_names, dpll4_m5x2_ck_ops);
865
866static struct clk dpll4_m4x2_ck_3630 = {
867 .name = "dpll4_m4x2_ck",
868 .hw = &dpll4_m4x2_ck_hw.hw,
869 .parent_names = dpll4_m4x2_ck_parent_names,
870 .num_parents = ARRAY_SIZE(dpll4_m4x2_ck_parent_names),
871 .ops = &dpll4_m5x2_ck_3630_ops,
872};
873
874DEFINE_CLK_DIVIDER(dpll4_m6_ck, "dpll4_ck", &dpll4_ck, 0x0,
875 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
876 OMAP3430_DIV_DPLL4_SHIFT, OMAP3630_DIV_DPLL4_WIDTH,
877 CLK_DIVIDER_ONE_BASED, NULL);
878
879static struct clk dpll4_m6x2_ck;
880
881static const char *dpll4_m6x2_ck_parent_names[] = {
882 "dpll4_m6_ck",
883};
884
885static struct clk_hw_omap dpll4_m6x2_ck_hw = {
886 .hw = {
887 .clk = &dpll4_m6x2_ck,
888 },
889 .ops = &clkhwops_wait,
890 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
891 .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
892 .flags = INVERT_ENABLE,
893 .clkdm_name = "dpll4_clkdm",
894};
895
896DEFINE_STRUCT_CLK(dpll4_m6x2_ck, dpll4_m6x2_ck_parent_names, dpll4_m5x2_ck_ops);
897
898static struct clk dpll4_m6x2_ck_3630 = {
899 .name = "dpll4_m6x2_ck",
900 .hw = &dpll4_m6x2_ck_hw.hw,
901 .parent_names = dpll4_m6x2_ck_parent_names,
902 .num_parents = ARRAY_SIZE(dpll4_m6x2_ck_parent_names),
903 .ops = &dpll4_m5x2_ck_3630_ops,
904};
905
906DEFINE_CLK_FIXED_FACTOR(dpll4_x2_ck, "dpll4_ck", &dpll4_ck, 0x0, 2, 1);
907
908static struct dpll_data dpll5_dd = {
909 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
910 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
911 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
912 .clk_bypass = &sys_ck,
913 .clk_ref = &sys_ck,
914 .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK,
915 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
916 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
917 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
918 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
919 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
920 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
921 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
922 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
923 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
924 .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK,
925 .max_multiplier = OMAP3_MAX_DPLL_MULT,
926 .min_divider = 1,
927 .max_divider = OMAP3_MAX_DPLL_DIV,
928};
929
930static struct clk dpll5_ck;
931
932static struct clk_hw_omap dpll5_ck_hw = {
933 .hw = {
934 .clk = &dpll5_ck,
935 },
936 .ops = &clkhwops_omap3_dpll,
937 .dpll_data = &dpll5_dd,
938 .clkdm_name = "dpll5_clkdm",
939};
940
941DEFINE_STRUCT_CLK(dpll5_ck, dpll3_ck_parent_names, dpll1_ck_ops);
942
943DEFINE_CLK_DIVIDER(dpll5_m2_ck, "dpll5_ck", &dpll5_ck, 0x0,
944 OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
945 OMAP3430ES2_DIV_120M_SHIFT, OMAP3430ES2_DIV_120M_WIDTH,
946 CLK_DIVIDER_ONE_BASED, NULL);
947
948static struct clk dss1_alwon_fck_3430es1;
949
950static const char *dss1_alwon_fck_3430es1_parent_names[] = {
951 "dpll4_m4x2_ck",
952};
953
954static struct clk_hw_omap dss1_alwon_fck_3430es1_hw = {
955 .hw = {
956 .clk = &dss1_alwon_fck_3430es1,
957 },
958 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
959 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
960 .clkdm_name = "dss_clkdm",
961};
962
963DEFINE_STRUCT_CLK(dss1_alwon_fck_3430es1, dss1_alwon_fck_3430es1_parent_names,
964 aes2_ick_ops);
965
966static struct clk dss1_alwon_fck_3430es2;
967
968static struct clk_hw_omap dss1_alwon_fck_3430es2_hw = {
969 .hw = {
970 .clk = &dss1_alwon_fck_3430es2,
971 },
972 .ops = &clkhwops_omap3430es2_dss_usbhost_wait,
973 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
974 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
975 .clkdm_name = "dss_clkdm",
976};
977
978DEFINE_STRUCT_CLK(dss1_alwon_fck_3430es2, dss1_alwon_fck_3430es1_parent_names,
979 aes2_ick_ops);
980
981static struct clk dss2_alwon_fck;
982
983static struct clk_hw_omap dss2_alwon_fck_hw = {
984 .hw = {
985 .clk = &dss2_alwon_fck,
986 },
987 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
988 .enable_bit = OMAP3430_EN_DSS2_SHIFT,
989 .clkdm_name = "dss_clkdm",
990};
991
992DEFINE_STRUCT_CLK(dss2_alwon_fck, dpll3_ck_parent_names, aes2_ick_ops);
993
994static struct clk dss_96m_fck;
995
996static struct clk_hw_omap dss_96m_fck_hw = {
997 .hw = {
998 .clk = &dss_96m_fck,
999 },
1000 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
1001 .enable_bit = OMAP3430_EN_TV_SHIFT,
1002 .clkdm_name = "dss_clkdm",
1003};
1004
1005DEFINE_STRUCT_CLK(dss_96m_fck, core_96m_fck_parent_names, aes2_ick_ops);
1006
1007static struct clk dss_ick_3430es1;
1008
1009static struct clk_hw_omap dss_ick_3430es1_hw = {
1010 .hw = {
1011 .clk = &dss_ick_3430es1,
1012 },
1013 .ops = &clkhwops_iclk,
1014 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
1015 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
1016 .clkdm_name = "dss_clkdm",
1017};
1018
1019DEFINE_STRUCT_CLK(dss_ick_3430es1, security_l4_ick2_parent_names, aes2_ick_ops);
1020
1021static struct clk dss_ick_3430es2;
1022
1023static struct clk_hw_omap dss_ick_3430es2_hw = {
1024 .hw = {
1025 .clk = &dss_ick_3430es2,
1026 },
1027 .ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait,
1028 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
1029 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
1030 .clkdm_name = "dss_clkdm",
1031};
1032
1033DEFINE_STRUCT_CLK(dss_ick_3430es2, security_l4_ick2_parent_names, aes2_ick_ops);
1034
1035static struct clk dss_tv_fck;
1036
1037static const char *dss_tv_fck_parent_names[] = {
1038 "omap_54m_fck",
1039};
1040
1041static struct clk_hw_omap dss_tv_fck_hw = {
1042 .hw = {
1043 .clk = &dss_tv_fck,
1044 },
1045 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
1046 .enable_bit = OMAP3430_EN_TV_SHIFT,
1047 .clkdm_name = "dss_clkdm",
1048};
1049
1050DEFINE_STRUCT_CLK(dss_tv_fck, dss_tv_fck_parent_names, aes2_ick_ops);
1051
1052static struct clk emac_fck;
1053
1054static const char *emac_fck_parent_names[] = {
1055 "rmii_ck",
1056};
1057
1058static struct clk_hw_omap emac_fck_hw = {
1059 .hw = {
1060 .clk = &emac_fck,
1061 },
1062 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1063 .enable_bit = AM35XX_CPGMAC_FCLK_SHIFT,
1064};
1065
1066DEFINE_STRUCT_CLK(emac_fck, emac_fck_parent_names, aes1_ick_ops);
1067
1068static struct clk ipss_ick;
1069
1070static const char *ipss_ick_parent_names[] = {
1071 "core_l3_ick",
1072};
1073
1074static struct clk_hw_omap ipss_ick_hw = {
1075 .hw = {
1076 .clk = &ipss_ick,
1077 },
1078 .ops = &clkhwops_am35xx_ipss_wait,
1079 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1080 .enable_bit = AM35XX_EN_IPSS_SHIFT,
1081 .clkdm_name = "core_l3_clkdm",
1082};
1083
1084DEFINE_STRUCT_CLK(ipss_ick, ipss_ick_parent_names, aes2_ick_ops);
1085
1086static struct clk emac_ick;
1087
1088static const char *emac_ick_parent_names[] = {
1089 "ipss_ick",
1090};
1091
1092static struct clk_hw_omap emac_ick_hw = {
1093 .hw = {
1094 .clk = &emac_ick,
1095 },
1096 .ops = &clkhwops_am35xx_ipss_module_wait,
1097 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1098 .enable_bit = AM35XX_CPGMAC_VBUSP_CLK_SHIFT,
1099 .clkdm_name = "core_l3_clkdm",
1100};
1101
1102DEFINE_STRUCT_CLK(emac_ick, emac_ick_parent_names, aes2_ick_ops);
1103
1104static struct clk emu_core_alwon_ck;
1105
1106static const char *emu_core_alwon_ck_parent_names[] = {
1107 "dpll3_m3x2_ck",
1108};
1109
1110DEFINE_STRUCT_CLK_HW_OMAP(emu_core_alwon_ck, "dpll3_clkdm");
1111DEFINE_STRUCT_CLK(emu_core_alwon_ck, emu_core_alwon_ck_parent_names,
1112 core_l4_ick_ops);
1113
1114static struct clk emu_mpu_alwon_ck;
1115
1116static const char *emu_mpu_alwon_ck_parent_names[] = {
1117 "mpu_ck",
1118};
1119
1120DEFINE_STRUCT_CLK_HW_OMAP(emu_mpu_alwon_ck, NULL);
1121DEFINE_STRUCT_CLK(emu_mpu_alwon_ck, emu_mpu_alwon_ck_parent_names, core_ck_ops);
1122
1123static struct clk emu_per_alwon_ck;
1124
1125static const char *emu_per_alwon_ck_parent_names[] = {
1126 "dpll4_m6x2_ck",
1127};
1128
1129DEFINE_STRUCT_CLK_HW_OMAP(emu_per_alwon_ck, "dpll4_clkdm");
1130DEFINE_STRUCT_CLK(emu_per_alwon_ck, emu_per_alwon_ck_parent_names,
1131 core_l4_ick_ops);
1132
1133static const char *emu_src_ck_parent_names[] = {
1134 "sys_ck", "emu_core_alwon_ck", "emu_per_alwon_ck", "emu_mpu_alwon_ck",
1135};
1136
1137static const struct clksel_rate emu_src_sys_rates[] = {
1138 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1139 { .div = 0 },
1140};
1141
1142static const struct clksel_rate emu_src_core_rates[] = {
1143 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1144 { .div = 0 },
1145};
1146
1147static const struct clksel_rate emu_src_per_rates[] = {
1148 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
1149 { .div = 0 },
1150};
1151
1152static const struct clksel_rate emu_src_mpu_rates[] = {
1153 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
1154 { .div = 0 },
1155};
1156
1157static const struct clksel emu_src_clksel[] = {
1158 { .parent = &sys_ck, .rates = emu_src_sys_rates },
1159 { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates },
1160 { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates },
1161 { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates },
1162 { .parent = NULL },
1163};
1164
1165static const struct clk_ops emu_src_ck_ops = {
1166 .init = &omap2_init_clk_clkdm,
1167 .recalc_rate = &omap2_clksel_recalc,
1168 .get_parent = &omap2_clksel_find_parent_index,
1169 .set_parent = &omap2_clksel_set_parent,
1170};
1171
1172static struct clk emu_src_ck;
1173
1174static struct clk_hw_omap emu_src_ck_hw = {
1175 .hw = {
1176 .clk = &emu_src_ck,
1177 },
1178 .clksel = emu_src_clksel,
1179 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
1180 .clksel_mask = OMAP3430_MUX_CTRL_MASK,
1181 .clkdm_name = "emu_clkdm",
1182};
1183
1184DEFINE_STRUCT_CLK(emu_src_ck, emu_src_ck_parent_names, emu_src_ck_ops);
1185
1186DEFINE_CLK_DIVIDER(atclk_fck, "emu_src_ck", &emu_src_ck, 0x0,
1187 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
1188 OMAP3430_CLKSEL_ATCLK_SHIFT, OMAP3430_CLKSEL_ATCLK_WIDTH,
1189 CLK_DIVIDER_ONE_BASED, NULL);
1190
1191static struct clk fac_ick;
1192
1193static struct clk_hw_omap fac_ick_hw = {
1194 .hw = {
1195 .clk = &fac_ick,
1196 },
1197 .ops = &clkhwops_iclk_wait,
1198 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1199 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
1200 .clkdm_name = "core_l4_clkdm",
1201};
1202
1203DEFINE_STRUCT_CLK(fac_ick, aes2_ick_parent_names, aes2_ick_ops);
1204
1205static struct clk fshostusb_fck;
1206
1207static const char *fshostusb_fck_parent_names[] = {
1208 "core_48m_fck",
1209};
1210
1211static struct clk_hw_omap fshostusb_fck_hw = {
1212 .hw = {
1213 .clk = &fshostusb_fck,
1214 },
1215 .ops = &clkhwops_wait,
1216 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1217 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1218 .clkdm_name = "core_l4_clkdm",
1219};
1220
1221DEFINE_STRUCT_CLK(fshostusb_fck, fshostusb_fck_parent_names, aes2_ick_ops);
1222
1223static struct clk gfx_l3_ck;
1224
1225static struct clk_hw_omap gfx_l3_ck_hw = {
1226 .hw = {
1227 .clk = &gfx_l3_ck,
1228 },
1229 .ops = &clkhwops_wait,
1230 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
1231 .enable_bit = OMAP_EN_GFX_SHIFT,
1232 .clkdm_name = "gfx_3430es1_clkdm",
1233};
1234
1235DEFINE_STRUCT_CLK(gfx_l3_ck, core_l3_ick_parent_names, aes1_ick_ops);
1236
1237DEFINE_CLK_DIVIDER(gfx_l3_fck, "l3_ick", &l3_ick, 0x0,
1238 OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
1239 OMAP_CLKSEL_GFX_SHIFT, OMAP_CLKSEL_GFX_WIDTH,
1240 CLK_DIVIDER_ONE_BASED, NULL);
1241
1242static struct clk gfx_cg1_ck;
1243
1244static const char *gfx_cg1_ck_parent_names[] = {
1245 "gfx_l3_fck",
1246};
1247
1248static struct clk_hw_omap gfx_cg1_ck_hw = {
1249 .hw = {
1250 .clk = &gfx_cg1_ck,
1251 },
1252 .ops = &clkhwops_wait,
1253 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1254 .enable_bit = OMAP3430ES1_EN_2D_SHIFT,
1255 .clkdm_name = "gfx_3430es1_clkdm",
1256};
1257
1258DEFINE_STRUCT_CLK(gfx_cg1_ck, gfx_cg1_ck_parent_names, aes2_ick_ops);
1259
1260static struct clk gfx_cg2_ck;
1261
1262static struct clk_hw_omap gfx_cg2_ck_hw = {
1263 .hw = {
1264 .clk = &gfx_cg2_ck,
1265 },
1266 .ops = &clkhwops_wait,
1267 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1268 .enable_bit = OMAP3430ES1_EN_3D_SHIFT,
1269 .clkdm_name = "gfx_3430es1_clkdm",
1270};
1271
1272DEFINE_STRUCT_CLK(gfx_cg2_ck, gfx_cg1_ck_parent_names, aes2_ick_ops);
1273
1274static struct clk gfx_l3_ick;
1275
1276static const char *gfx_l3_ick_parent_names[] = {
1277 "gfx_l3_ck",
1278};
1279
1280DEFINE_STRUCT_CLK_HW_OMAP(gfx_l3_ick, "gfx_3430es1_clkdm");
1281DEFINE_STRUCT_CLK(gfx_l3_ick, gfx_l3_ick_parent_names, core_l4_ick_ops);
1282
1283static struct clk wkup_32k_fck;
1284
1285static const char *wkup_32k_fck_parent_names[] = {
1286 "omap_32k_fck",
1287};
1288
1289DEFINE_STRUCT_CLK_HW_OMAP(wkup_32k_fck, "wkup_clkdm");
1290DEFINE_STRUCT_CLK(wkup_32k_fck, wkup_32k_fck_parent_names, core_l4_ick_ops);
1291
1292static struct clk gpio1_dbck;
1293
1294static const char *gpio1_dbck_parent_names[] = {
1295 "wkup_32k_fck",
1296};
1297
1298static struct clk_hw_omap gpio1_dbck_hw = {
1299 .hw = {
1300 .clk = &gpio1_dbck,
1301 },
1302 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1303 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
1304 .clkdm_name = "wkup_clkdm",
1305};
1306
1307DEFINE_STRUCT_CLK(gpio1_dbck, gpio1_dbck_parent_names, aes2_ick_ops);
1308
1309static struct clk wkup_l4_ick;
1310
1311DEFINE_STRUCT_CLK_HW_OMAP(wkup_l4_ick, "wkup_clkdm");
1312DEFINE_STRUCT_CLK(wkup_l4_ick, dpll3_ck_parent_names, core_l4_ick_ops);
1313
1314static struct clk gpio1_ick;
1315
1316static const char *gpio1_ick_parent_names[] = {
1317 "wkup_l4_ick",
1318};
1319
1320static struct clk_hw_omap gpio1_ick_hw = {
1321 .hw = {
1322 .clk = &gpio1_ick,
1323 },
1324 .ops = &clkhwops_iclk_wait,
1325 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1326 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
1327 .clkdm_name = "wkup_clkdm",
1328};
1329
1330DEFINE_STRUCT_CLK(gpio1_ick, gpio1_ick_parent_names, aes2_ick_ops);
1331
1332static struct clk per_32k_alwon_fck;
1333
1334DEFINE_STRUCT_CLK_HW_OMAP(per_32k_alwon_fck, "per_clkdm");
1335DEFINE_STRUCT_CLK(per_32k_alwon_fck, wkup_32k_fck_parent_names,
1336 core_l4_ick_ops);
1337
1338static struct clk gpio2_dbck;
1339
1340static const char *gpio2_dbck_parent_names[] = {
1341 "per_32k_alwon_fck",
1342};
1343
1344static struct clk_hw_omap gpio2_dbck_hw = {
1345 .hw = {
1346 .clk = &gpio2_dbck,
1347 },
1348 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1349 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
1350 .clkdm_name = "per_clkdm",
1351};
1352
1353DEFINE_STRUCT_CLK(gpio2_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1354
1355static struct clk per_l4_ick;
1356
1357DEFINE_STRUCT_CLK_HW_OMAP(per_l4_ick, "per_clkdm");
1358DEFINE_STRUCT_CLK(per_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
1359
1360static struct clk gpio2_ick;
1361
1362static const char *gpio2_ick_parent_names[] = {
1363 "per_l4_ick",
1364};
1365
1366static struct clk_hw_omap gpio2_ick_hw = {
1367 .hw = {
1368 .clk = &gpio2_ick,
1369 },
1370 .ops = &clkhwops_iclk_wait,
1371 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1372 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
1373 .clkdm_name = "per_clkdm",
1374};
1375
1376DEFINE_STRUCT_CLK(gpio2_ick, gpio2_ick_parent_names, aes2_ick_ops);
1377
1378static struct clk gpio3_dbck;
1379
1380static struct clk_hw_omap gpio3_dbck_hw = {
1381 .hw = {
1382 .clk = &gpio3_dbck,
1383 },
1384 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1385 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
1386 .clkdm_name = "per_clkdm",
1387};
1388
1389DEFINE_STRUCT_CLK(gpio3_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1390
1391static struct clk gpio3_ick;
1392
1393static struct clk_hw_omap gpio3_ick_hw = {
1394 .hw = {
1395 .clk = &gpio3_ick,
1396 },
1397 .ops = &clkhwops_iclk_wait,
1398 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1399 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
1400 .clkdm_name = "per_clkdm",
1401};
1402
1403DEFINE_STRUCT_CLK(gpio3_ick, gpio2_ick_parent_names, aes2_ick_ops);
1404
1405static struct clk gpio4_dbck;
1406
1407static struct clk_hw_omap gpio4_dbck_hw = {
1408 .hw = {
1409 .clk = &gpio4_dbck,
1410 },
1411 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1412 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
1413 .clkdm_name = "per_clkdm",
1414};
1415
1416DEFINE_STRUCT_CLK(gpio4_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1417
1418static struct clk gpio4_ick;
1419
1420static struct clk_hw_omap gpio4_ick_hw = {
1421 .hw = {
1422 .clk = &gpio4_ick,
1423 },
1424 .ops = &clkhwops_iclk_wait,
1425 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1426 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
1427 .clkdm_name = "per_clkdm",
1428};
1429
1430DEFINE_STRUCT_CLK(gpio4_ick, gpio2_ick_parent_names, aes2_ick_ops);
1431
1432static struct clk gpio5_dbck;
1433
1434static struct clk_hw_omap gpio5_dbck_hw = {
1435 .hw = {
1436 .clk = &gpio5_dbck,
1437 },
1438 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1439 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
1440 .clkdm_name = "per_clkdm",
1441};
1442
1443DEFINE_STRUCT_CLK(gpio5_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1444
1445static struct clk gpio5_ick;
1446
1447static struct clk_hw_omap gpio5_ick_hw = {
1448 .hw = {
1449 .clk = &gpio5_ick,
1450 },
1451 .ops = &clkhwops_iclk_wait,
1452 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1453 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
1454 .clkdm_name = "per_clkdm",
1455};
1456
1457DEFINE_STRUCT_CLK(gpio5_ick, gpio2_ick_parent_names, aes2_ick_ops);
1458
1459static struct clk gpio6_dbck;
1460
1461static struct clk_hw_omap gpio6_dbck_hw = {
1462 .hw = {
1463 .clk = &gpio6_dbck,
1464 },
1465 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1466 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
1467 .clkdm_name = "per_clkdm",
1468};
1469
1470DEFINE_STRUCT_CLK(gpio6_dbck, gpio2_dbck_parent_names, aes2_ick_ops);
1471
1472static struct clk gpio6_ick;
1473
1474static struct clk_hw_omap gpio6_ick_hw = {
1475 .hw = {
1476 .clk = &gpio6_ick,
1477 },
1478 .ops = &clkhwops_iclk_wait,
1479 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1480 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
1481 .clkdm_name = "per_clkdm",
1482};
1483
1484DEFINE_STRUCT_CLK(gpio6_ick, gpio2_ick_parent_names, aes2_ick_ops);
1485
1486static struct clk gpmc_fck;
1487
1488static struct clk_hw_omap gpmc_fck_hw = {
1489 .hw = {
1490 .clk = &gpmc_fck,
1491 },
1492 .flags = ENABLE_ON_INIT,
1493 .clkdm_name = "core_l3_clkdm",
1494};
1495
1496DEFINE_STRUCT_CLK(gpmc_fck, ipss_ick_parent_names, core_l4_ick_ops);
1497
1498static const struct clksel omap343x_gpt_clksel[] = {
1499 { .parent = &omap_32k_fck, .rates = gpt_32k_rates },
1500 { .parent = &sys_ck, .rates = gpt_sys_rates },
1501 { .parent = NULL },
1502};
1503
1504static const char *gpt10_fck_parent_names[] = {
1505 "omap_32k_fck", "sys_ck",
1506};
1507
1508DEFINE_CLK_OMAP_MUX_GATE(gpt10_fck, "core_l4_clkdm", omap343x_gpt_clksel,
1509 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1510 OMAP3430_CLKSEL_GPT10_MASK,
1511 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1512 OMAP3430_EN_GPT10_SHIFT, &clkhwops_wait,
1513 gpt10_fck_parent_names, clkout2_src_ck_ops);
1514
1515static struct clk gpt10_ick;
1516
1517static struct clk_hw_omap gpt10_ick_hw = {
1518 .hw = {
1519 .clk = &gpt10_ick,
1520 },
1521 .ops = &clkhwops_iclk_wait,
1522 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1523 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1524 .clkdm_name = "core_l4_clkdm",
1525};
1526
1527DEFINE_STRUCT_CLK(gpt10_ick, aes2_ick_parent_names, aes2_ick_ops);
1528
1529DEFINE_CLK_OMAP_MUX_GATE(gpt11_fck, "core_l4_clkdm", omap343x_gpt_clksel,
1530 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1531 OMAP3430_CLKSEL_GPT11_MASK,
1532 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1533 OMAP3430_EN_GPT11_SHIFT, &clkhwops_wait,
1534 gpt10_fck_parent_names, clkout2_src_ck_ops);
1535
1536static struct clk gpt11_ick;
1537
1538static struct clk_hw_omap gpt11_ick_hw = {
1539 .hw = {
1540 .clk = &gpt11_ick,
1541 },
1542 .ops = &clkhwops_iclk_wait,
1543 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1544 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1545 .clkdm_name = "core_l4_clkdm",
1546};
1547
1548DEFINE_STRUCT_CLK(gpt11_ick, aes2_ick_parent_names, aes2_ick_ops);
1549
1550static struct clk gpt12_fck;
1551
1552static const char *gpt12_fck_parent_names[] = {
1553 "secure_32k_fck",
1554};
1555
1556DEFINE_STRUCT_CLK_HW_OMAP(gpt12_fck, "wkup_clkdm");
1557DEFINE_STRUCT_CLK(gpt12_fck, gpt12_fck_parent_names, core_l4_ick_ops);
1558
1559static struct clk gpt12_ick;
1560
1561static struct clk_hw_omap gpt12_ick_hw = {
1562 .hw = {
1563 .clk = &gpt12_ick,
1564 },
1565 .ops = &clkhwops_iclk_wait,
1566 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1567 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
1568 .clkdm_name = "wkup_clkdm",
1569};
1570
1571DEFINE_STRUCT_CLK(gpt12_ick, gpio1_ick_parent_names, aes2_ick_ops);
1572
1573DEFINE_CLK_OMAP_MUX_GATE(gpt1_fck, "wkup_clkdm", omap343x_gpt_clksel,
1574 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
1575 OMAP3430_CLKSEL_GPT1_MASK,
1576 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1577 OMAP3430_EN_GPT1_SHIFT, &clkhwops_wait,
1578 gpt10_fck_parent_names, clkout2_src_ck_ops);
1579
1580static struct clk gpt1_ick;
1581
1582static struct clk_hw_omap gpt1_ick_hw = {
1583 .hw = {
1584 .clk = &gpt1_ick,
1585 },
1586 .ops = &clkhwops_iclk_wait,
1587 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1588 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
1589 .clkdm_name = "wkup_clkdm",
1590};
1591
1592DEFINE_STRUCT_CLK(gpt1_ick, gpio1_ick_parent_names, aes2_ick_ops);
1593
1594DEFINE_CLK_OMAP_MUX_GATE(gpt2_fck, "per_clkdm", omap343x_gpt_clksel,
1595 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1596 OMAP3430_CLKSEL_GPT2_MASK,
1597 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1598 OMAP3430_EN_GPT2_SHIFT, &clkhwops_wait,
1599 gpt10_fck_parent_names, clkout2_src_ck_ops);
1600
1601static struct clk gpt2_ick;
1602
1603static struct clk_hw_omap gpt2_ick_hw = {
1604 .hw = {
1605 .clk = &gpt2_ick,
1606 },
1607 .ops = &clkhwops_iclk_wait,
1608 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1609 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
1610 .clkdm_name = "per_clkdm",
1611};
1612
1613DEFINE_STRUCT_CLK(gpt2_ick, gpio2_ick_parent_names, aes2_ick_ops);
1614
1615DEFINE_CLK_OMAP_MUX_GATE(gpt3_fck, "per_clkdm", omap343x_gpt_clksel,
1616 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1617 OMAP3430_CLKSEL_GPT3_MASK,
1618 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1619 OMAP3430_EN_GPT3_SHIFT, &clkhwops_wait,
1620 gpt10_fck_parent_names, clkout2_src_ck_ops);
1621
1622static struct clk gpt3_ick;
1623
1624static struct clk_hw_omap gpt3_ick_hw = {
1625 .hw = {
1626 .clk = &gpt3_ick,
1627 },
1628 .ops = &clkhwops_iclk_wait,
1629 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1630 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
1631 .clkdm_name = "per_clkdm",
1632};
1633
1634DEFINE_STRUCT_CLK(gpt3_ick, gpio2_ick_parent_names, aes2_ick_ops);
1635
1636DEFINE_CLK_OMAP_MUX_GATE(gpt4_fck, "per_clkdm", omap343x_gpt_clksel,
1637 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1638 OMAP3430_CLKSEL_GPT4_MASK,
1639 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1640 OMAP3430_EN_GPT4_SHIFT, &clkhwops_wait,
1641 gpt10_fck_parent_names, clkout2_src_ck_ops);
1642
1643static struct clk gpt4_ick;
1644
1645static struct clk_hw_omap gpt4_ick_hw = {
1646 .hw = {
1647 .clk = &gpt4_ick,
1648 },
1649 .ops = &clkhwops_iclk_wait,
1650 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1651 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
1652 .clkdm_name = "per_clkdm",
1653};
1654
1655DEFINE_STRUCT_CLK(gpt4_ick, gpio2_ick_parent_names, aes2_ick_ops);
1656
1657DEFINE_CLK_OMAP_MUX_GATE(gpt5_fck, "per_clkdm", omap343x_gpt_clksel,
1658 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1659 OMAP3430_CLKSEL_GPT5_MASK,
1660 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1661 OMAP3430_EN_GPT5_SHIFT, &clkhwops_wait,
1662 gpt10_fck_parent_names, clkout2_src_ck_ops);
1663
1664static struct clk gpt5_ick;
1665
1666static struct clk_hw_omap gpt5_ick_hw = {
1667 .hw = {
1668 .clk = &gpt5_ick,
1669 },
1670 .ops = &clkhwops_iclk_wait,
1671 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1672 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
1673 .clkdm_name = "per_clkdm",
1674};
1675
1676DEFINE_STRUCT_CLK(gpt5_ick, gpio2_ick_parent_names, aes2_ick_ops);
1677
1678DEFINE_CLK_OMAP_MUX_GATE(gpt6_fck, "per_clkdm", omap343x_gpt_clksel,
1679 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1680 OMAP3430_CLKSEL_GPT6_MASK,
1681 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1682 OMAP3430_EN_GPT6_SHIFT, &clkhwops_wait,
1683 gpt10_fck_parent_names, clkout2_src_ck_ops);
1684
1685static struct clk gpt6_ick;
1686
1687static struct clk_hw_omap gpt6_ick_hw = {
1688 .hw = {
1689 .clk = &gpt6_ick,
1690 },
1691 .ops = &clkhwops_iclk_wait,
1692 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1693 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
1694 .clkdm_name = "per_clkdm",
1695};
1696
1697DEFINE_STRUCT_CLK(gpt6_ick, gpio2_ick_parent_names, aes2_ick_ops);
1698
1699DEFINE_CLK_OMAP_MUX_GATE(gpt7_fck, "per_clkdm", omap343x_gpt_clksel,
1700 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1701 OMAP3430_CLKSEL_GPT7_MASK,
1702 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1703 OMAP3430_EN_GPT7_SHIFT, &clkhwops_wait,
1704 gpt10_fck_parent_names, clkout2_src_ck_ops);
1705
1706static struct clk gpt7_ick;
1707
1708static struct clk_hw_omap gpt7_ick_hw = {
1709 .hw = {
1710 .clk = &gpt7_ick,
1711 },
1712 .ops = &clkhwops_iclk_wait,
1713 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1714 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
1715 .clkdm_name = "per_clkdm",
1716};
1717
1718DEFINE_STRUCT_CLK(gpt7_ick, gpio2_ick_parent_names, aes2_ick_ops);
1719
1720DEFINE_CLK_OMAP_MUX_GATE(gpt8_fck, "per_clkdm", omap343x_gpt_clksel,
1721 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1722 OMAP3430_CLKSEL_GPT8_MASK,
1723 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1724 OMAP3430_EN_GPT8_SHIFT, &clkhwops_wait,
1725 gpt10_fck_parent_names, clkout2_src_ck_ops);
1726
1727static struct clk gpt8_ick;
1728
1729static struct clk_hw_omap gpt8_ick_hw = {
1730 .hw = {
1731 .clk = &gpt8_ick,
1732 },
1733 .ops = &clkhwops_iclk_wait,
1734 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1735 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
1736 .clkdm_name = "per_clkdm",
1737};
1738
1739DEFINE_STRUCT_CLK(gpt8_ick, gpio2_ick_parent_names, aes2_ick_ops);
1740
1741DEFINE_CLK_OMAP_MUX_GATE(gpt9_fck, "per_clkdm", omap343x_gpt_clksel,
1742 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
1743 OMAP3430_CLKSEL_GPT9_MASK,
1744 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
1745 OMAP3430_EN_GPT9_SHIFT, &clkhwops_wait,
1746 gpt10_fck_parent_names, clkout2_src_ck_ops);
1747
1748static struct clk gpt9_ick;
1749
1750static struct clk_hw_omap gpt9_ick_hw = {
1751 .hw = {
1752 .clk = &gpt9_ick,
1753 },
1754 .ops = &clkhwops_iclk_wait,
1755 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
1756 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
1757 .clkdm_name = "per_clkdm",
1758};
1759
1760DEFINE_STRUCT_CLK(gpt9_ick, gpio2_ick_parent_names, aes2_ick_ops);
1761
1762static struct clk hdq_fck;
1763
1764static const char *hdq_fck_parent_names[] = {
1765 "core_12m_fck",
1766};
1767
1768static struct clk_hw_omap hdq_fck_hw = {
1769 .hw = {
1770 .clk = &hdq_fck,
1771 },
1772 .ops = &clkhwops_wait,
1773 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1774 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1775 .clkdm_name = "core_l4_clkdm",
1776};
1777
1778DEFINE_STRUCT_CLK(hdq_fck, hdq_fck_parent_names, aes2_ick_ops);
1779
1780static struct clk hdq_ick;
1781
1782static struct clk_hw_omap hdq_ick_hw = {
1783 .hw = {
1784 .clk = &hdq_ick,
1785 },
1786 .ops = &clkhwops_iclk_wait,
1787 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1788 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1789 .clkdm_name = "core_l4_clkdm",
1790};
1791
1792DEFINE_STRUCT_CLK(hdq_ick, aes2_ick_parent_names, aes2_ick_ops);
1793
1794static struct clk hecc_ck;
1795
1796static struct clk_hw_omap hecc_ck_hw = {
1797 .hw = {
1798 .clk = &hecc_ck,
1799 },
1800 .ops = &clkhwops_am35xx_ipss_module_wait,
1801 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1802 .enable_bit = AM35XX_HECC_VBUSP_CLK_SHIFT,
1803 .clkdm_name = "core_l3_clkdm",
1804};
1805
1806DEFINE_STRUCT_CLK(hecc_ck, dpll3_ck_parent_names, aes2_ick_ops);
1807
1808static struct clk hsotgusb_fck_am35xx;
1809
1810static struct clk_hw_omap hsotgusb_fck_am35xx_hw = {
1811 .hw = {
1812 .clk = &hsotgusb_fck_am35xx,
1813 },
1814 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1815 .enable_bit = AM35XX_USBOTG_FCLK_SHIFT,
1816 .clkdm_name = "core_l3_clkdm",
1817};
1818
1819DEFINE_STRUCT_CLK(hsotgusb_fck_am35xx, dpll3_ck_parent_names, aes2_ick_ops);
1820
1821static struct clk hsotgusb_ick_3430es1;
1822
1823static struct clk_hw_omap hsotgusb_ick_3430es1_hw = {
1824 .hw = {
1825 .clk = &hsotgusb_ick_3430es1,
1826 },
1827 .ops = &clkhwops_iclk,
1828 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1829 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1830 .clkdm_name = "core_l3_clkdm",
1831};
1832
1833DEFINE_STRUCT_CLK(hsotgusb_ick_3430es1, ipss_ick_parent_names, aes2_ick_ops);
1834
1835static struct clk hsotgusb_ick_3430es2;
1836
1837static struct clk_hw_omap hsotgusb_ick_3430es2_hw = {
1838 .hw = {
1839 .clk = &hsotgusb_ick_3430es2,
1840 },
1841 .ops = &clkhwops_omap3430es2_iclk_hsotgusb_wait,
1842 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1843 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1844 .clkdm_name = "core_l3_clkdm",
1845};
1846
1847DEFINE_STRUCT_CLK(hsotgusb_ick_3430es2, ipss_ick_parent_names, aes2_ick_ops);
1848
1849static struct clk hsotgusb_ick_am35xx;
1850
1851static struct clk_hw_omap hsotgusb_ick_am35xx_hw = {
1852 .hw = {
1853 .clk = &hsotgusb_ick_am35xx,
1854 },
1855 .ops = &clkhwops_am35xx_ipss_module_wait,
1856 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
1857 .enable_bit = AM35XX_USBOTG_VBUSP_CLK_SHIFT,
1858 .clkdm_name = "core_l3_clkdm",
1859};
1860
1861DEFINE_STRUCT_CLK(hsotgusb_ick_am35xx, emac_ick_parent_names, aes2_ick_ops);
1862
1863static struct clk i2c1_fck;
1864
1865static struct clk_hw_omap i2c1_fck_hw = {
1866 .hw = {
1867 .clk = &i2c1_fck,
1868 },
1869 .ops = &clkhwops_wait,
1870 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1871 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1872 .clkdm_name = "core_l4_clkdm",
1873};
1874
1875DEFINE_STRUCT_CLK(i2c1_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1876
1877static struct clk i2c1_ick;
1878
1879static struct clk_hw_omap i2c1_ick_hw = {
1880 .hw = {
1881 .clk = &i2c1_ick,
1882 },
1883 .ops = &clkhwops_iclk_wait,
1884 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1885 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1886 .clkdm_name = "core_l4_clkdm",
1887};
1888
1889DEFINE_STRUCT_CLK(i2c1_ick, aes2_ick_parent_names, aes2_ick_ops);
1890
1891static struct clk i2c2_fck;
1892
1893static struct clk_hw_omap i2c2_fck_hw = {
1894 .hw = {
1895 .clk = &i2c2_fck,
1896 },
1897 .ops = &clkhwops_wait,
1898 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1899 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1900 .clkdm_name = "core_l4_clkdm",
1901};
1902
1903DEFINE_STRUCT_CLK(i2c2_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1904
1905static struct clk i2c2_ick;
1906
1907static struct clk_hw_omap i2c2_ick_hw = {
1908 .hw = {
1909 .clk = &i2c2_ick,
1910 },
1911 .ops = &clkhwops_iclk_wait,
1912 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1913 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1914 .clkdm_name = "core_l4_clkdm",
1915};
1916
1917DEFINE_STRUCT_CLK(i2c2_ick, aes2_ick_parent_names, aes2_ick_ops);
1918
1919static struct clk i2c3_fck;
1920
1921static struct clk_hw_omap i2c3_fck_hw = {
1922 .hw = {
1923 .clk = &i2c3_fck,
1924 },
1925 .ops = &clkhwops_wait,
1926 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1927 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1928 .clkdm_name = "core_l4_clkdm",
1929};
1930
1931DEFINE_STRUCT_CLK(i2c3_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
1932
1933static struct clk i2c3_ick;
1934
1935static struct clk_hw_omap i2c3_ick_hw = {
1936 .hw = {
1937 .clk = &i2c3_ick,
1938 },
1939 .ops = &clkhwops_iclk_wait,
1940 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1941 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1942 .clkdm_name = "core_l4_clkdm",
1943};
1944
1945DEFINE_STRUCT_CLK(i2c3_ick, aes2_ick_parent_names, aes2_ick_ops);
1946
1947static struct clk icr_ick;
1948
1949static struct clk_hw_omap icr_ick_hw = {
1950 .hw = {
1951 .clk = &icr_ick,
1952 },
1953 .ops = &clkhwops_iclk_wait,
1954 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1955 .enable_bit = OMAP3430_EN_ICR_SHIFT,
1956 .clkdm_name = "core_l4_clkdm",
1957};
1958
1959DEFINE_STRUCT_CLK(icr_ick, aes2_ick_parent_names, aes2_ick_ops);
1960
1961static struct clk iva2_ck;
1962
1963static const char *iva2_ck_parent_names[] = {
1964 "dpll2_m2_ck",
1965};
1966
1967static struct clk_hw_omap iva2_ck_hw = {
1968 .hw = {
1969 .clk = &iva2_ck,
1970 },
1971 .ops = &clkhwops_wait,
1972 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1973 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1974 .clkdm_name = "iva2_clkdm",
1975};
1976
1977DEFINE_STRUCT_CLK(iva2_ck, iva2_ck_parent_names, aes2_ick_ops);
1978
1979static struct clk mad2d_ick;
1980
1981static struct clk_hw_omap mad2d_ick_hw = {
1982 .hw = {
1983 .clk = &mad2d_ick,
1984 },
1985 .ops = &clkhwops_iclk_wait,
1986 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1987 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
1988 .clkdm_name = "d2d_clkdm",
1989};
1990
1991DEFINE_STRUCT_CLK(mad2d_ick, core_l3_ick_parent_names, aes2_ick_ops);
1992
1993static struct clk mailboxes_ick;
1994
1995static struct clk_hw_omap mailboxes_ick_hw = {
1996 .hw = {
1997 .clk = &mailboxes_ick,
1998 },
1999 .ops = &clkhwops_iclk_wait,
2000 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2001 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
2002 .clkdm_name = "core_l4_clkdm",
2003};
2004
2005DEFINE_STRUCT_CLK(mailboxes_ick, aes2_ick_parent_names, aes2_ick_ops);
2006
2007static const struct clksel_rate common_mcbsp_96m_rates[] = {
2008 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
2009 { .div = 0 }
2010};
2011
2012static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
2013 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2014 { .div = 0 }
2015};
2016
2017static const struct clksel mcbsp_15_clksel[] = {
2018 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
2019 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2020 { .parent = NULL },
2021};
2022
2023static const char *mcbsp1_fck_parent_names[] = {
2024 "core_96m_fck", "mcbsp_clks",
2025};
2026
2027DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "core_l4_clkdm", mcbsp_15_clksel,
2028 OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2029 OMAP2_MCBSP1_CLKS_MASK,
2030 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2031 OMAP3430_EN_MCBSP1_SHIFT, &clkhwops_wait,
2032 mcbsp1_fck_parent_names, clkout2_src_ck_ops);
2033
2034static struct clk mcbsp1_ick;
2035
2036static struct clk_hw_omap mcbsp1_ick_hw = {
2037 .hw = {
2038 .clk = &mcbsp1_ick,
2039 },
2040 .ops = &clkhwops_iclk_wait,
2041 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2042 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
2043 .clkdm_name = "core_l4_clkdm",
2044};
2045
2046DEFINE_STRUCT_CLK(mcbsp1_ick, aes2_ick_parent_names, aes2_ick_ops);
2047
2048static struct clk per_96m_fck;
2049
2050DEFINE_STRUCT_CLK_HW_OMAP(per_96m_fck, "per_clkdm");
2051DEFINE_STRUCT_CLK(per_96m_fck, cm_96m_fck_parent_names, core_l4_ick_ops);
2052
2053static const struct clksel mcbsp_234_clksel[] = {
2054 { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates },
2055 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2056 { .parent = NULL },
2057};
2058
2059static const char *mcbsp2_fck_parent_names[] = {
2060 "per_96m_fck", "mcbsp_clks",
2061};
2062
2063DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "per_clkdm", mcbsp_234_clksel,
2064 OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2065 OMAP2_MCBSP2_CLKS_MASK,
2066 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2067 OMAP3430_EN_MCBSP2_SHIFT, &clkhwops_wait,
2068 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2069
2070static struct clk mcbsp2_ick;
2071
2072static struct clk_hw_omap mcbsp2_ick_hw = {
2073 .hw = {
2074 .clk = &mcbsp2_ick,
2075 },
2076 .ops = &clkhwops_iclk_wait,
2077 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2078 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2079 .clkdm_name = "per_clkdm",
2080};
2081
2082DEFINE_STRUCT_CLK(mcbsp2_ick, gpio2_ick_parent_names, aes2_ick_ops);
2083
2084DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "per_clkdm", mcbsp_234_clksel,
2085 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2086 OMAP2_MCBSP3_CLKS_MASK,
2087 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2088 OMAP3430_EN_MCBSP3_SHIFT, &clkhwops_wait,
2089 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2090
2091static struct clk mcbsp3_ick;
2092
2093static struct clk_hw_omap mcbsp3_ick_hw = {
2094 .hw = {
2095 .clk = &mcbsp3_ick,
2096 },
2097 .ops = &clkhwops_iclk_wait,
2098 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2099 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2100 .clkdm_name = "per_clkdm",
2101};
2102
2103DEFINE_STRUCT_CLK(mcbsp3_ick, gpio2_ick_parent_names, aes2_ick_ops);
2104
2105DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "per_clkdm", mcbsp_234_clksel,
2106 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2107 OMAP2_MCBSP4_CLKS_MASK,
2108 OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2109 OMAP3430_EN_MCBSP4_SHIFT, &clkhwops_wait,
2110 mcbsp2_fck_parent_names, clkout2_src_ck_ops);
2111
2112static struct clk mcbsp4_ick;
2113
2114static struct clk_hw_omap mcbsp4_ick_hw = {
2115 .hw = {
2116 .clk = &mcbsp4_ick,
2117 },
2118 .ops = &clkhwops_iclk_wait,
2119 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2120 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2121 .clkdm_name = "per_clkdm",
2122};
2123
2124DEFINE_STRUCT_CLK(mcbsp4_ick, gpio2_ick_parent_names, aes2_ick_ops);
2125
2126DEFINE_CLK_OMAP_MUX_GATE(mcbsp5_fck, "core_l4_clkdm", mcbsp_15_clksel,
2127 OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2128 OMAP2_MCBSP5_CLKS_MASK,
2129 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2130 OMAP3430_EN_MCBSP5_SHIFT, &clkhwops_wait,
2131 mcbsp1_fck_parent_names, clkout2_src_ck_ops);
2132
2133static struct clk mcbsp5_ick;
2134
2135static struct clk_hw_omap mcbsp5_ick_hw = {
2136 .hw = {
2137 .clk = &mcbsp5_ick,
2138 },
2139 .ops = &clkhwops_iclk_wait,
2140 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2141 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
2142 .clkdm_name = "core_l4_clkdm",
2143};
2144
2145DEFINE_STRUCT_CLK(mcbsp5_ick, aes2_ick_parent_names, aes2_ick_ops);
2146
2147static struct clk mcspi1_fck;
2148
2149static struct clk_hw_omap mcspi1_fck_hw = {
2150 .hw = {
2151 .clk = &mcspi1_fck,
2152 },
2153 .ops = &clkhwops_wait,
2154 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2155 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
2156 .clkdm_name = "core_l4_clkdm",
2157};
2158
2159DEFINE_STRUCT_CLK(mcspi1_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2160
2161static struct clk mcspi1_ick;
2162
2163static struct clk_hw_omap mcspi1_ick_hw = {
2164 .hw = {
2165 .clk = &mcspi1_ick,
2166 },
2167 .ops = &clkhwops_iclk_wait,
2168 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2169 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
2170 .clkdm_name = "core_l4_clkdm",
2171};
2172
2173DEFINE_STRUCT_CLK(mcspi1_ick, aes2_ick_parent_names, aes2_ick_ops);
2174
2175static struct clk mcspi2_fck;
2176
2177static struct clk_hw_omap mcspi2_fck_hw = {
2178 .hw = {
2179 .clk = &mcspi2_fck,
2180 },
2181 .ops = &clkhwops_wait,
2182 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2183 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
2184 .clkdm_name = "core_l4_clkdm",
2185};
2186
2187DEFINE_STRUCT_CLK(mcspi2_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2188
2189static struct clk mcspi2_ick;
2190
2191static struct clk_hw_omap mcspi2_ick_hw = {
2192 .hw = {
2193 .clk = &mcspi2_ick,
2194 },
2195 .ops = &clkhwops_iclk_wait,
2196 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2197 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
2198 .clkdm_name = "core_l4_clkdm",
2199};
2200
2201DEFINE_STRUCT_CLK(mcspi2_ick, aes2_ick_parent_names, aes2_ick_ops);
2202
2203static struct clk mcspi3_fck;
2204
2205static struct clk_hw_omap mcspi3_fck_hw = {
2206 .hw = {
2207 .clk = &mcspi3_fck,
2208 },
2209 .ops = &clkhwops_wait,
2210 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2211 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
2212 .clkdm_name = "core_l4_clkdm",
2213};
2214
2215DEFINE_STRUCT_CLK(mcspi3_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2216
2217static struct clk mcspi3_ick;
2218
2219static struct clk_hw_omap mcspi3_ick_hw = {
2220 .hw = {
2221 .clk = &mcspi3_ick,
2222 },
2223 .ops = &clkhwops_iclk_wait,
2224 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2225 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
2226 .clkdm_name = "core_l4_clkdm",
2227};
2228
2229DEFINE_STRUCT_CLK(mcspi3_ick, aes2_ick_parent_names, aes2_ick_ops);
2230
2231static struct clk mcspi4_fck;
2232
2233static struct clk_hw_omap mcspi4_fck_hw = {
2234 .hw = {
2235 .clk = &mcspi4_fck,
2236 },
2237 .ops = &clkhwops_wait,
2238 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2239 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
2240 .clkdm_name = "core_l4_clkdm",
2241};
2242
2243DEFINE_STRUCT_CLK(mcspi4_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2244
2245static struct clk mcspi4_ick;
2246
2247static struct clk_hw_omap mcspi4_ick_hw = {
2248 .hw = {
2249 .clk = &mcspi4_ick,
2250 },
2251 .ops = &clkhwops_iclk_wait,
2252 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2253 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
2254 .clkdm_name = "core_l4_clkdm",
2255};
2256
2257DEFINE_STRUCT_CLK(mcspi4_ick, aes2_ick_parent_names, aes2_ick_ops);
2258
2259static struct clk mmchs1_fck;
2260
2261static struct clk_hw_omap mmchs1_fck_hw = {
2262 .hw = {
2263 .clk = &mmchs1_fck,
2264 },
2265 .ops = &clkhwops_wait,
2266 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2267 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
2268 .clkdm_name = "core_l4_clkdm",
2269};
2270
2271DEFINE_STRUCT_CLK(mmchs1_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2272
2273static struct clk mmchs1_ick;
2274
2275static struct clk_hw_omap mmchs1_ick_hw = {
2276 .hw = {
2277 .clk = &mmchs1_ick,
2278 },
2279 .ops = &clkhwops_iclk_wait,
2280 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2281 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
2282 .clkdm_name = "core_l4_clkdm",
2283};
2284
2285DEFINE_STRUCT_CLK(mmchs1_ick, aes2_ick_parent_names, aes2_ick_ops);
2286
2287static struct clk mmchs2_fck;
2288
2289static struct clk_hw_omap mmchs2_fck_hw = {
2290 .hw = {
2291 .clk = &mmchs2_fck,
2292 },
2293 .ops = &clkhwops_wait,
2294 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2295 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
2296 .clkdm_name = "core_l4_clkdm",
2297};
2298
2299DEFINE_STRUCT_CLK(mmchs2_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2300
2301static struct clk mmchs2_ick;
2302
2303static struct clk_hw_omap mmchs2_ick_hw = {
2304 .hw = {
2305 .clk = &mmchs2_ick,
2306 },
2307 .ops = &clkhwops_iclk_wait,
2308 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2309 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
2310 .clkdm_name = "core_l4_clkdm",
2311};
2312
2313DEFINE_STRUCT_CLK(mmchs2_ick, aes2_ick_parent_names, aes2_ick_ops);
2314
2315static struct clk mmchs3_fck;
2316
2317static struct clk_hw_omap mmchs3_fck_hw = {
2318 .hw = {
2319 .clk = &mmchs3_fck,
2320 },
2321 .ops = &clkhwops_wait,
2322 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2323 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
2324 .clkdm_name = "core_l4_clkdm",
2325};
2326
2327DEFINE_STRUCT_CLK(mmchs3_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2328
2329static struct clk mmchs3_ick;
2330
2331static struct clk_hw_omap mmchs3_ick_hw = {
2332 .hw = {
2333 .clk = &mmchs3_ick,
2334 },
2335 .ops = &clkhwops_iclk_wait,
2336 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2337 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
2338 .clkdm_name = "core_l4_clkdm",
2339};
2340
2341DEFINE_STRUCT_CLK(mmchs3_ick, aes2_ick_parent_names, aes2_ick_ops);
2342
2343static struct clk modem_fck;
2344
2345static struct clk_hw_omap modem_fck_hw = {
2346 .hw = {
2347 .clk = &modem_fck,
2348 },
2349 .ops = &clkhwops_iclk_wait,
2350 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2351 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
2352 .clkdm_name = "d2d_clkdm",
2353};
2354
2355DEFINE_STRUCT_CLK(modem_fck, dpll3_ck_parent_names, aes2_ick_ops);
2356
2357static struct clk mspro_fck;
2358
2359static struct clk_hw_omap mspro_fck_hw = {
2360 .hw = {
2361 .clk = &mspro_fck,
2362 },
2363 .ops = &clkhwops_wait,
2364 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2365 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
2366 .clkdm_name = "core_l4_clkdm",
2367};
2368
2369DEFINE_STRUCT_CLK(mspro_fck, csi2_96m_fck_parent_names, aes2_ick_ops);
2370
2371static struct clk mspro_ick;
2372
2373static struct clk_hw_omap mspro_ick_hw = {
2374 .hw = {
2375 .clk = &mspro_ick,
2376 },
2377 .ops = &clkhwops_iclk_wait,
2378 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2379 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
2380 .clkdm_name = "core_l4_clkdm",
2381};
2382
2383DEFINE_STRUCT_CLK(mspro_ick, aes2_ick_parent_names, aes2_ick_ops);
2384
2385static struct clk omap_192m_alwon_fck;
2386
2387DEFINE_STRUCT_CLK_HW_OMAP(omap_192m_alwon_fck, NULL);
2388DEFINE_STRUCT_CLK(omap_192m_alwon_fck, omap_96m_alwon_fck_parent_names,
2389 core_ck_ops);
2390
2391static struct clk omap_32ksync_ick;
2392
2393static struct clk_hw_omap omap_32ksync_ick_hw = {
2394 .hw = {
2395 .clk = &omap_32ksync_ick,
2396 },
2397 .ops = &clkhwops_iclk_wait,
2398 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2399 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
2400 .clkdm_name = "wkup_clkdm",
2401};
2402
2403DEFINE_STRUCT_CLK(omap_32ksync_ick, gpio1_ick_parent_names, aes2_ick_ops);
2404
2405static const struct clksel_rate omap_96m_alwon_fck_rates[] = {
2406 { .div = 1, .val = 1, .flags = RATE_IN_36XX },
2407 { .div = 2, .val = 2, .flags = RATE_IN_36XX },
2408 { .div = 0 }
2409};
2410
2411static const struct clksel omap_96m_alwon_fck_clksel[] = {
2412 { .parent = &omap_192m_alwon_fck, .rates = omap_96m_alwon_fck_rates },
2413 { .parent = NULL }
2414};
2415
2416static struct clk omap_96m_alwon_fck_3630;
2417
2418static const char *omap_96m_alwon_fck_3630_parent_names[] = {
2419 "omap_192m_alwon_fck",
2420};
2421
2422static const struct clk_ops omap_96m_alwon_fck_3630_ops = {
2423 .set_rate = &omap2_clksel_set_rate,
2424 .recalc_rate = &omap2_clksel_recalc,
2425 .round_rate = &omap2_clksel_round_rate,
2426};
2427
2428static struct clk_hw_omap omap_96m_alwon_fck_3630_hw = {
2429 .hw = {
2430 .clk = &omap_96m_alwon_fck_3630,
2431 },
2432 .clksel = omap_96m_alwon_fck_clksel,
2433 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2434 .clksel_mask = OMAP3630_CLKSEL_96M_MASK,
2435};
2436
2437static struct clk omap_96m_alwon_fck_3630 = {
2438 .name = "omap_96m_alwon_fck",
2439 .hw = &omap_96m_alwon_fck_3630_hw.hw,
2440 .parent_names = omap_96m_alwon_fck_3630_parent_names,
2441 .num_parents = ARRAY_SIZE(omap_96m_alwon_fck_3630_parent_names),
2442 .ops = &omap_96m_alwon_fck_3630_ops,
2443};
2444
2445static struct clk omapctrl_ick;
2446
2447static struct clk_hw_omap omapctrl_ick_hw = {
2448 .hw = {
2449 .clk = &omapctrl_ick,
2450 },
2451 .ops = &clkhwops_iclk_wait,
2452 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2453 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
2454 .flags = ENABLE_ON_INIT,
2455 .clkdm_name = "core_l4_clkdm",
2456};
2457
2458DEFINE_STRUCT_CLK(omapctrl_ick, aes2_ick_parent_names, aes2_ick_ops);
2459
2460DEFINE_CLK_DIVIDER(pclk_fck, "emu_src_ck", &emu_src_ck, 0x0,
2461 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2462 OMAP3430_CLKSEL_PCLK_SHIFT, OMAP3430_CLKSEL_PCLK_WIDTH,
2463 CLK_DIVIDER_ONE_BASED, NULL);
2464
2465DEFINE_CLK_DIVIDER(pclkx2_fck, "emu_src_ck", &emu_src_ck, 0x0,
2466 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2467 OMAP3430_CLKSEL_PCLKX2_SHIFT, OMAP3430_CLKSEL_PCLKX2_WIDTH,
2468 CLK_DIVIDER_ONE_BASED, NULL);
2469
2470static struct clk per_48m_fck;
2471
2472DEFINE_STRUCT_CLK_HW_OMAP(per_48m_fck, "per_clkdm");
2473DEFINE_STRUCT_CLK(per_48m_fck, core_48m_fck_parent_names, core_l4_ick_ops);
2474
2475static struct clk security_l3_ick;
2476
2477DEFINE_STRUCT_CLK_HW_OMAP(security_l3_ick, NULL);
2478DEFINE_STRUCT_CLK(security_l3_ick, core_l3_ick_parent_names, core_ck_ops);
2479
2480static struct clk pka_ick;
2481
2482static const char *pka_ick_parent_names[] = {
2483 "security_l3_ick",
2484};
2485
2486static struct clk_hw_omap pka_ick_hw = {
2487 .hw = {
2488 .clk = &pka_ick,
2489 },
2490 .ops = &clkhwops_iclk_wait,
2491 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2492 .enable_bit = OMAP3430_EN_PKA_SHIFT,
2493};
2494
2495DEFINE_STRUCT_CLK(pka_ick, pka_ick_parent_names, aes1_ick_ops);
2496
2497DEFINE_CLK_DIVIDER(rm_ick, "l4_ick", &l4_ick, 0x0,
2498 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2499 OMAP3430_CLKSEL_RM_SHIFT, OMAP3430_CLKSEL_RM_WIDTH,
2500 CLK_DIVIDER_ONE_BASED, NULL);
2501
2502static struct clk rng_ick;
2503
2504static struct clk_hw_omap rng_ick_hw = {
2505 .hw = {
2506 .clk = &rng_ick,
2507 },
2508 .ops = &clkhwops_iclk_wait,
2509 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2510 .enable_bit = OMAP3430_EN_RNG_SHIFT,
2511};
2512
2513DEFINE_STRUCT_CLK(rng_ick, aes1_ick_parent_names, aes1_ick_ops);
2514
2515static struct clk sad2d_ick;
2516
2517static struct clk_hw_omap sad2d_ick_hw = {
2518 .hw = {
2519 .clk = &sad2d_ick,
2520 },
2521 .ops = &clkhwops_iclk_wait,
2522 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2523 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
2524 .clkdm_name = "d2d_clkdm",
2525};
2526
2527DEFINE_STRUCT_CLK(sad2d_ick, core_l3_ick_parent_names, aes2_ick_ops);
2528
2529static struct clk sdrc_ick;
2530
2531static struct clk_hw_omap sdrc_ick_hw = {
2532 .hw = {
2533 .clk = &sdrc_ick,
2534 },
2535 .ops = &clkhwops_wait,
2536 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2537 .enable_bit = OMAP3430_EN_SDRC_SHIFT,
2538 .flags = ENABLE_ON_INIT,
2539 .clkdm_name = "core_l3_clkdm",
2540};
2541
2542DEFINE_STRUCT_CLK(sdrc_ick, ipss_ick_parent_names, aes2_ick_ops);
2543
2544static const struct clksel_rate sgx_core_rates[] = {
2545 { .div = 2, .val = 5, .flags = RATE_IN_36XX },
2546 { .div = 3, .val = 0, .flags = RATE_IN_3XXX },
2547 { .div = 4, .val = 1, .flags = RATE_IN_3XXX },
2548 { .div = 6, .val = 2, .flags = RATE_IN_3XXX },
2549 { .div = 0 }
2550};
2551
2552static const struct clksel_rate sgx_96m_rates[] = {
2553 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
2554 { .div = 0 }
2555};
2556
2557static const struct clksel_rate sgx_192m_rates[] = {
2558 { .div = 1, .val = 4, .flags = RATE_IN_36XX },
2559 { .div = 0 }
2560};
2561
2562static const struct clksel_rate sgx_corex2_rates[] = {
2563 { .div = 3, .val = 6, .flags = RATE_IN_36XX },
2564 { .div = 5, .val = 7, .flags = RATE_IN_36XX },
2565 { .div = 0 }
2566};
2567
2568static const struct clksel sgx_clksel[] = {
2569 { .parent = &core_ck, .rates = sgx_core_rates },
2570 { .parent = &cm_96m_fck, .rates = sgx_96m_rates },
2571 { .parent = &omap_192m_alwon_fck, .rates = sgx_192m_rates },
2572 { .parent = &corex2_fck, .rates = sgx_corex2_rates },
2573 { .parent = NULL },
2574};
2575
2576static const char *sgx_fck_parent_names[] = {
2577 "core_ck", "cm_96m_fck", "omap_192m_alwon_fck", "corex2_fck",
2578};
2579
2580static struct clk sgx_fck;
2581
2582static const struct clk_ops sgx_fck_ops = {
2583 .init = &omap2_init_clk_clkdm,
2584 .enable = &omap2_dflt_clk_enable,
2585 .disable = &omap2_dflt_clk_disable,
2586 .is_enabled = &omap2_dflt_clk_is_enabled,
2587 .recalc_rate = &omap2_clksel_recalc,
2588 .set_rate = &omap2_clksel_set_rate,
2589 .round_rate = &omap2_clksel_round_rate,
2590 .get_parent = &omap2_clksel_find_parent_index,
2591 .set_parent = &omap2_clksel_set_parent,
2592};
2593
2594DEFINE_CLK_OMAP_MUX_GATE(sgx_fck, "sgx_clkdm", sgx_clksel,
2595 OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL),
2596 OMAP3430ES2_CLKSEL_SGX_MASK,
2597 OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN),
2598 OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT,
2599 &clkhwops_wait, sgx_fck_parent_names, sgx_fck_ops);
2600
2601static struct clk sgx_ick;
2602
2603static struct clk_hw_omap sgx_ick_hw = {
2604 .hw = {
2605 .clk = &sgx_ick,
2606 },
2607 .ops = &clkhwops_wait,
2608 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN),
2609 .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT,
2610 .clkdm_name = "sgx_clkdm",
2611};
2612
2613DEFINE_STRUCT_CLK(sgx_ick, core_l3_ick_parent_names, aes2_ick_ops);
2614
2615static struct clk sha11_ick;
2616
2617static struct clk_hw_omap sha11_ick_hw = {
2618 .hw = {
2619 .clk = &sha11_ick,
2620 },
2621 .ops = &clkhwops_iclk_wait,
2622 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2623 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
2624};
2625
2626DEFINE_STRUCT_CLK(sha11_ick, aes1_ick_parent_names, aes1_ick_ops);
2627
2628static struct clk sha12_ick;
2629
2630static struct clk_hw_omap sha12_ick_hw = {
2631 .hw = {
2632 .clk = &sha12_ick,
2633 },
2634 .ops = &clkhwops_iclk_wait,
2635 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2636 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
2637 .clkdm_name = "core_l4_clkdm",
2638};
2639
2640DEFINE_STRUCT_CLK(sha12_ick, aes2_ick_parent_names, aes2_ick_ops);
2641
2642static struct clk sr1_fck;
2643
2644static struct clk_hw_omap sr1_fck_hw = {
2645 .hw = {
2646 .clk = &sr1_fck,
2647 },
2648 .ops = &clkhwops_wait,
2649 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2650 .enable_bit = OMAP3430_EN_SR1_SHIFT,
2651 .clkdm_name = "wkup_clkdm",
2652};
2653
2654DEFINE_STRUCT_CLK(sr1_fck, dpll3_ck_parent_names, aes2_ick_ops);
2655
2656static struct clk sr2_fck;
2657
2658static struct clk_hw_omap sr2_fck_hw = {
2659 .hw = {
2660 .clk = &sr2_fck,
2661 },
2662 .ops = &clkhwops_wait,
2663 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2664 .enable_bit = OMAP3430_EN_SR2_SHIFT,
2665 .clkdm_name = "wkup_clkdm",
2666};
2667
2668DEFINE_STRUCT_CLK(sr2_fck, dpll3_ck_parent_names, aes2_ick_ops);
2669
2670static struct clk sr_l4_ick;
2671
2672DEFINE_STRUCT_CLK_HW_OMAP(sr_l4_ick, "core_l4_clkdm");
2673DEFINE_STRUCT_CLK(sr_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
2674
2675static struct clk ssi_l4_ick;
2676
2677DEFINE_STRUCT_CLK_HW_OMAP(ssi_l4_ick, "core_l4_clkdm");
2678DEFINE_STRUCT_CLK(ssi_l4_ick, security_l4_ick2_parent_names, core_l4_ick_ops);
2679
2680static struct clk ssi_ick_3430es1;
2681
2682static const char *ssi_ick_3430es1_parent_names[] = {
2683 "ssi_l4_ick",
2684};
2685
2686static struct clk_hw_omap ssi_ick_3430es1_hw = {
2687 .hw = {
2688 .clk = &ssi_ick_3430es1,
2689 },
2690 .ops = &clkhwops_iclk,
2691 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2692 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2693 .clkdm_name = "core_l4_clkdm",
2694};
2695
2696DEFINE_STRUCT_CLK(ssi_ick_3430es1, ssi_ick_3430es1_parent_names, aes2_ick_ops);
2697
2698static struct clk ssi_ick_3430es2;
2699
2700static struct clk_hw_omap ssi_ick_3430es2_hw = {
2701 .hw = {
2702 .clk = &ssi_ick_3430es2,
2703 },
2704 .ops = &clkhwops_omap3430es2_iclk_ssi_wait,
2705 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2706 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2707 .clkdm_name = "core_l4_clkdm",
2708};
2709
2710DEFINE_STRUCT_CLK(ssi_ick_3430es2, ssi_ick_3430es1_parent_names, aes2_ick_ops);
2711
2712static const struct clksel_rate ssi_ssr_corex2_rates[] = {
2713 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2714 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2715 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2716 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2717 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
2718 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
2719 { .div = 0 }
2720};
2721
2722static const struct clksel ssi_ssr_clksel[] = {
2723 { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates },
2724 { .parent = NULL },
2725};
2726
2727static const char *ssi_ssr_fck_3430es1_parent_names[] = {
2728 "corex2_fck",
2729};
2730
2731static const struct clk_ops ssi_ssr_fck_3430es1_ops = {
2732 .init = &omap2_init_clk_clkdm,
2733 .enable = &omap2_dflt_clk_enable,
2734 .disable = &omap2_dflt_clk_disable,
2735 .is_enabled = &omap2_dflt_clk_is_enabled,
2736 .recalc_rate = &omap2_clksel_recalc,
2737 .set_rate = &omap2_clksel_set_rate,
2738 .round_rate = &omap2_clksel_round_rate,
2739};
2740
2741DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_fck_3430es1, "core_l4_clkdm",
2742 ssi_ssr_clksel, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2743 OMAP3430_CLKSEL_SSI_MASK,
2744 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2745 OMAP3430_EN_SSI_SHIFT,
2746 NULL, ssi_ssr_fck_3430es1_parent_names,
2747 ssi_ssr_fck_3430es1_ops);
2748
2749DEFINE_CLK_OMAP_MUX_GATE(ssi_ssr_fck_3430es2, "core_l4_clkdm",
2750 ssi_ssr_clksel, OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2751 OMAP3430_CLKSEL_SSI_MASK,
2752 OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2753 OMAP3430_EN_SSI_SHIFT,
2754 NULL, ssi_ssr_fck_3430es1_parent_names,
2755 ssi_ssr_fck_3430es1_ops);
2756
2757DEFINE_CLK_FIXED_FACTOR(ssi_sst_fck_3430es1, "ssi_ssr_fck_3430es1",
2758 &ssi_ssr_fck_3430es1, 0x0, 1, 2);
2759
2760DEFINE_CLK_FIXED_FACTOR(ssi_sst_fck_3430es2, "ssi_ssr_fck_3430es2",
2761 &ssi_ssr_fck_3430es2, 0x0, 1, 2);
2762
2763static struct clk sys_clkout1;
2764
2765static const char *sys_clkout1_parent_names[] = {
2766 "osc_sys_ck",
2767};
2768
2769static struct clk_hw_omap sys_clkout1_hw = {
2770 .hw = {
2771 .clk = &sys_clkout1,
2772 },
2773 .enable_reg = OMAP3430_PRM_CLKOUT_CTRL,
2774 .enable_bit = OMAP3430_CLKOUT_EN_SHIFT,
2775};
2776
2777DEFINE_STRUCT_CLK(sys_clkout1, sys_clkout1_parent_names, aes1_ick_ops);
2778
2779DEFINE_CLK_DIVIDER(sys_clkout2, "clkout2_src_ck", &clkout2_src_ck, 0x0,
2780 OMAP3430_CM_CLKOUT_CTRL, OMAP3430_CLKOUT2_DIV_SHIFT,
2781 OMAP3430_CLKOUT2_DIV_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
2782
2783DEFINE_CLK_MUX(traceclk_src_fck, emu_src_ck_parent_names, NULL, 0x0,
2784 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2785 OMAP3430_TRACE_MUX_CTRL_SHIFT, OMAP3430_TRACE_MUX_CTRL_WIDTH,
2786 0x0, NULL);
2787
2788DEFINE_CLK_DIVIDER(traceclk_fck, "traceclk_src_fck", &traceclk_src_fck, 0x0,
2789 OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2790 OMAP3430_CLKSEL_TRACECLK_SHIFT,
2791 OMAP3430_CLKSEL_TRACECLK_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
2792
2793static struct clk ts_fck;
2794
2795static struct clk_hw_omap ts_fck_hw = {
2796 .hw = {
2797 .clk = &ts_fck,
2798 },
2799 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
2800 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
2801 .clkdm_name = "core_l4_clkdm",
2802};
2803
2804DEFINE_STRUCT_CLK(ts_fck, wkup_32k_fck_parent_names, aes2_ick_ops);
2805
2806static struct clk uart1_fck;
2807
2808static struct clk_hw_omap uart1_fck_hw = {
2809 .hw = {
2810 .clk = &uart1_fck,
2811 },
2812 .ops = &clkhwops_wait,
2813 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2814 .enable_bit = OMAP3430_EN_UART1_SHIFT,
2815 .clkdm_name = "core_l4_clkdm",
2816};
2817
2818DEFINE_STRUCT_CLK(uart1_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2819
2820static struct clk uart1_ick;
2821
2822static struct clk_hw_omap uart1_ick_hw = {
2823 .hw = {
2824 .clk = &uart1_ick,
2825 },
2826 .ops = &clkhwops_iclk_wait,
2827 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2828 .enable_bit = OMAP3430_EN_UART1_SHIFT,
2829 .clkdm_name = "core_l4_clkdm",
2830};
2831
2832DEFINE_STRUCT_CLK(uart1_ick, aes2_ick_parent_names, aes2_ick_ops);
2833
2834static struct clk uart2_fck;
2835
2836static struct clk_hw_omap uart2_fck_hw = {
2837 .hw = {
2838 .clk = &uart2_fck,
2839 },
2840 .ops = &clkhwops_wait,
2841 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2842 .enable_bit = OMAP3430_EN_UART2_SHIFT,
2843 .clkdm_name = "core_l4_clkdm",
2844};
2845
2846DEFINE_STRUCT_CLK(uart2_fck, fshostusb_fck_parent_names, aes2_ick_ops);
2847
2848static struct clk uart2_ick;
2849
2850static struct clk_hw_omap uart2_ick_hw = {
2851 .hw = {
2852 .clk = &uart2_ick,
2853 },
2854 .ops = &clkhwops_iclk_wait,
2855 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2856 .enable_bit = OMAP3430_EN_UART2_SHIFT,
2857 .clkdm_name = "core_l4_clkdm",
2858};
2859
2860DEFINE_STRUCT_CLK(uart2_ick, aes2_ick_parent_names, aes2_ick_ops);
2861
2862static struct clk uart3_fck;
2863
2864static const char *uart3_fck_parent_names[] = {
2865 "per_48m_fck",
2866};
2867
2868static struct clk_hw_omap uart3_fck_hw = {
2869 .hw = {
2870 .clk = &uart3_fck,
2871 },
2872 .ops = &clkhwops_wait,
2873 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2874 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2875 .clkdm_name = "per_clkdm",
2876};
2877
2878DEFINE_STRUCT_CLK(uart3_fck, uart3_fck_parent_names, aes2_ick_ops);
2879
2880static struct clk uart3_ick;
2881
2882static struct clk_hw_omap uart3_ick_hw = {
2883 .hw = {
2884 .clk = &uart3_ick,
2885 },
2886 .ops = &clkhwops_iclk_wait,
2887 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2888 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2889 .clkdm_name = "per_clkdm",
2890};
2891
2892DEFINE_STRUCT_CLK(uart3_ick, gpio2_ick_parent_names, aes2_ick_ops);
2893
2894static struct clk uart4_fck;
2895
2896static struct clk_hw_omap uart4_fck_hw = {
2897 .hw = {
2898 .clk = &uart4_fck,
2899 },
2900 .ops = &clkhwops_wait,
2901 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2902 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2903 .clkdm_name = "per_clkdm",
2904};
2905
2906DEFINE_STRUCT_CLK(uart4_fck, uart3_fck_parent_names, aes2_ick_ops);
2907
2908static struct clk uart4_fck_am35xx;
2909
2910static struct clk_hw_omap uart4_fck_am35xx_hw = {
2911 .hw = {
2912 .clk = &uart4_fck_am35xx,
2913 },
2914 .ops = &clkhwops_wait,
2915 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2916 .enable_bit = AM35XX_EN_UART4_SHIFT,
2917 .clkdm_name = "core_l4_clkdm",
2918};
2919
2920DEFINE_STRUCT_CLK(uart4_fck_am35xx, fshostusb_fck_parent_names, aes2_ick_ops);
2921
2922static struct clk uart4_ick;
2923
2924static struct clk_hw_omap uart4_ick_hw = {
2925 .hw = {
2926 .clk = &uart4_ick,
2927 },
2928 .ops = &clkhwops_iclk_wait,
2929 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2930 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2931 .clkdm_name = "per_clkdm",
2932};
2933
2934DEFINE_STRUCT_CLK(uart4_ick, gpio2_ick_parent_names, aes2_ick_ops);
2935
2936static struct clk uart4_ick_am35xx;
2937
2938static struct clk_hw_omap uart4_ick_am35xx_hw = {
2939 .hw = {
2940 .clk = &uart4_ick_am35xx,
2941 },
2942 .ops = &clkhwops_iclk_wait,
2943 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2944 .enable_bit = AM35XX_EN_UART4_SHIFT,
2945 .clkdm_name = "core_l4_clkdm",
2946};
2947
2948DEFINE_STRUCT_CLK(uart4_ick_am35xx, aes2_ick_parent_names, aes2_ick_ops);
2949
2950static const struct clksel_rate div2_rates[] = {
2951 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2952 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2953 { .div = 0 }
2954};
2955
2956static const struct clksel usb_l4_clksel[] = {
2957 { .parent = &l4_ick, .rates = div2_rates },
2958 { .parent = NULL },
2959};
2960
2961static const char *usb_l4_ick_parent_names[] = {
2962 "l4_ick",
2963};
2964
2965DEFINE_CLK_OMAP_MUX_GATE(usb_l4_ick, "core_l4_clkdm", usb_l4_clksel,
2966 OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2967 OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2968 OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2969 OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
2970 &clkhwops_iclk_wait, usb_l4_ick_parent_names,
2971 ssi_ssr_fck_3430es1_ops);
2972
2973static struct clk usbhost_120m_fck;
2974
2975static const char *usbhost_120m_fck_parent_names[] = {
2976 "dpll5_m2_ck",
2977};
2978
2979static struct clk_hw_omap usbhost_120m_fck_hw = {
2980 .hw = {
2981 .clk = &usbhost_120m_fck,
2982 },
2983 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2984 .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT,
2985 .clkdm_name = "usbhost_clkdm",
2986};
2987
2988DEFINE_STRUCT_CLK(usbhost_120m_fck, usbhost_120m_fck_parent_names,
2989 aes2_ick_ops);
2990
2991static struct clk usbhost_48m_fck;
2992
2993static struct clk_hw_omap usbhost_48m_fck_hw = {
2994 .hw = {
2995 .clk = &usbhost_48m_fck,
2996 },
2997 .ops = &clkhwops_omap3430es2_dss_usbhost_wait,
2998 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2999 .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
3000 .clkdm_name = "usbhost_clkdm",
3001};
3002
3003DEFINE_STRUCT_CLK(usbhost_48m_fck, core_48m_fck_parent_names, aes2_ick_ops);
3004
3005static struct clk usbhost_ick;
3006
3007static struct clk_hw_omap usbhost_ick_hw = {
3008 .hw = {
3009 .clk = &usbhost_ick,
3010 },
3011 .ops = &clkhwops_omap3430es2_iclk_dss_usbhost_wait,
3012 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
3013 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
3014 .clkdm_name = "usbhost_clkdm",
3015};
3016
3017DEFINE_STRUCT_CLK(usbhost_ick, security_l4_ick2_parent_names, aes2_ick_ops);
3018
3019static struct clk usbtll_fck;
3020
3021static struct clk_hw_omap usbtll_fck_hw = {
3022 .hw = {
3023 .clk = &usbtll_fck,
3024 },
3025 .ops = &clkhwops_wait,
3026 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
3027 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
3028 .clkdm_name = "core_l4_clkdm",
3029};
3030
3031DEFINE_STRUCT_CLK(usbtll_fck, usbhost_120m_fck_parent_names, aes2_ick_ops);
3032
3033static struct clk usbtll_ick;
3034
3035static struct clk_hw_omap usbtll_ick_hw = {
3036 .hw = {
3037 .clk = &usbtll_ick,
3038 },
3039 .ops = &clkhwops_iclk_wait,
3040 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
3041 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
3042 .clkdm_name = "core_l4_clkdm",
3043};
3044
3045DEFINE_STRUCT_CLK(usbtll_ick, aes2_ick_parent_names, aes2_ick_ops);
3046
3047static const struct clksel_rate usim_96m_rates[] = {
3048 { .div = 2, .val = 3, .flags = RATE_IN_3XXX },
3049 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
3050 { .div = 8, .val = 5, .flags = RATE_IN_3XXX },
3051 { .div = 10, .val = 6, .flags = RATE_IN_3XXX },
3052 { .div = 0 }
3053};
3054
3055static const struct clksel_rate usim_120m_rates[] = {
3056 { .div = 4, .val = 7, .flags = RATE_IN_3XXX },
3057 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
3058 { .div = 16, .val = 9, .flags = RATE_IN_3XXX },
3059 { .div = 20, .val = 10, .flags = RATE_IN_3XXX },
3060 { .div = 0 }
3061};
3062
3063static const struct clksel usim_clksel[] = {
3064 { .parent = &omap_96m_fck, .rates = usim_96m_rates },
3065 { .parent = &dpll5_m2_ck, .rates = usim_120m_rates },
3066 { .parent = &sys_ck, .rates = div2_rates },
3067 { .parent = NULL },
3068};
3069
3070static const char *usim_fck_parent_names[] = {
3071 "omap_96m_fck", "dpll5_m2_ck", "sys_ck",
3072};
3073
3074static struct clk usim_fck;
3075
3076static const struct clk_ops usim_fck_ops = {
3077 .enable = &omap2_dflt_clk_enable,
3078 .disable = &omap2_dflt_clk_disable,
3079 .is_enabled = &omap2_dflt_clk_is_enabled,
3080 .recalc_rate = &omap2_clksel_recalc,
3081 .get_parent = &omap2_clksel_find_parent_index,
3082 .set_parent = &omap2_clksel_set_parent,
3083};
3084
3085DEFINE_CLK_OMAP_MUX_GATE(usim_fck, NULL, usim_clksel,
3086 OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
3087 OMAP3430ES2_CLKSEL_USIMOCP_MASK,
3088 OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3089 OMAP3430ES2_EN_USIMOCP_SHIFT, &clkhwops_wait,
3090 usim_fck_parent_names, usim_fck_ops);
3091
3092static struct clk usim_ick;
3093
3094static struct clk_hw_omap usim_ick_hw = {
3095 .hw = {
3096 .clk = &usim_ick,
3097 },
3098 .ops = &clkhwops_iclk_wait,
3099 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3100 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
3101 .clkdm_name = "wkup_clkdm",
3102};
3103
3104DEFINE_STRUCT_CLK(usim_ick, gpio1_ick_parent_names, aes2_ick_ops);
3105
3106static struct clk vpfe_fck;
3107
3108static const char *vpfe_fck_parent_names[] = {
3109 "pclk_ck",
3110};
3111
3112static struct clk_hw_omap vpfe_fck_hw = {
3113 .hw = {
3114 .clk = &vpfe_fck,
3115 },
3116 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3117 .enable_bit = AM35XX_VPFE_FCLK_SHIFT,
3118};
3119
3120DEFINE_STRUCT_CLK(vpfe_fck, vpfe_fck_parent_names, aes1_ick_ops);
3121
3122static struct clk vpfe_ick;
3123
3124static struct clk_hw_omap vpfe_ick_hw = {
3125 .hw = {
3126 .clk = &vpfe_ick,
3127 },
3128 .ops = &clkhwops_am35xx_ipss_module_wait,
3129 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3130 .enable_bit = AM35XX_VPFE_VBUSP_CLK_SHIFT,
3131 .clkdm_name = "core_l3_clkdm",
3132};
3133
3134DEFINE_STRUCT_CLK(vpfe_ick, emac_ick_parent_names, aes2_ick_ops);
3135
3136static struct clk wdt1_fck;
3137
3138DEFINE_STRUCT_CLK_HW_OMAP(wdt1_fck, "wkup_clkdm");
3139DEFINE_STRUCT_CLK(wdt1_fck, gpt12_fck_parent_names, core_l4_ick_ops);
3140
3141static struct clk wdt1_ick;
3142
3143static struct clk_hw_omap wdt1_ick_hw = {
3144 .hw = {
3145 .clk = &wdt1_ick,
3146 },
3147 .ops = &clkhwops_iclk_wait,
3148 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3149 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
3150 .clkdm_name = "wkup_clkdm",
3151};
3152
3153DEFINE_STRUCT_CLK(wdt1_ick, gpio1_ick_parent_names, aes2_ick_ops);
3154
3155static struct clk wdt2_fck;
3156
3157static struct clk_hw_omap wdt2_fck_hw = {
3158 .hw = {
3159 .clk = &wdt2_fck,
3160 },
3161 .ops = &clkhwops_wait,
3162 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3163 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
3164 .clkdm_name = "wkup_clkdm",
3165};
3166
3167DEFINE_STRUCT_CLK(wdt2_fck, gpio1_dbck_parent_names, aes2_ick_ops);
3168
3169static struct clk wdt2_ick;
3170
3171static struct clk_hw_omap wdt2_ick_hw = {
3172 .hw = {
3173 .clk = &wdt2_ick,
3174 },
3175 .ops = &clkhwops_iclk_wait,
3176 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
3177 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
3178 .clkdm_name = "wkup_clkdm",
3179};
3180
3181DEFINE_STRUCT_CLK(wdt2_ick, gpio1_ick_parent_names, aes2_ick_ops);
3182
3183static struct clk wdt3_fck;
3184
3185static struct clk_hw_omap wdt3_fck_hw = {
3186 .hw = {
3187 .clk = &wdt3_fck,
3188 },
3189 .ops = &clkhwops_wait,
3190 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
3191 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
3192 .clkdm_name = "per_clkdm",
3193};
3194
3195DEFINE_STRUCT_CLK(wdt3_fck, gpio2_dbck_parent_names, aes2_ick_ops);
3196
3197static struct clk wdt3_ick;
3198
3199static struct clk_hw_omap wdt3_ick_hw = {
3200 .hw = {
3201 .clk = &wdt3_ick,
3202 },
3203 .ops = &clkhwops_iclk_wait,
3204 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
3205 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
3206 .clkdm_name = "per_clkdm",
3207};
3208
3209DEFINE_STRUCT_CLK(wdt3_ick, gpio2_ick_parent_names, aes2_ick_ops);
3210
3211/*
3212 * clkdev
3213 */
3214static struct omap_clk omap3xxx_clks[] = {
3215 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3216 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
3217 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3218 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
3219 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3220 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_3XXX),
3221 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_3XXX),
3222 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX),
3223 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX),
3224 CLK("twl", "fck", &osc_sys_ck, CK_3XXX),
3225 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX),
3226 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX),
3227 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX),
3228 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX),
3229 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX),
3230 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_3XXX),
3231 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_3XXX),
3232 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_34XX | CK_36XX),
3233 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_34XX | CK_36XX),
3234 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_3XXX),
3235 CLK(NULL, "core_ck", &core_ck, CK_3XXX),
3236 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_3XXX),
3237 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_3XXX),
3238 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX),
3239 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX),
3240 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX),
3241 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3242 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX),
3243 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX),
3244 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX),
3245 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX),
3246 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX),
3247 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX),
3248 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX),
3249 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_3XXX),
3250 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_3XXX),
3251 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_3XXX),
3252 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_3XXX),
3253 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_3XXX),
3254 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_3XXX),
3255 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_3XXX),
3256 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_3XXX),
3257 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_3XXX),
3258 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX),
3259 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX),
3260 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX),
3261 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3262 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3263 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3264 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_3XXX),
3265 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_3XXX),
3266 CLK(NULL, "corex2_fck", &corex2_fck, CK_3XXX),
3267 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX),
3268 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX),
3269 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX),
3270 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3271 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX),
3272 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX),
3273 CLK(NULL, "l3_ick", &l3_ick, CK_3XXX),
3274 CLK(NULL, "l4_ick", &l4_ick, CK_3XXX),
3275 CLK(NULL, "rm_ick", &rm_ick, CK_3XXX),
3276 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
3277 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
3278 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
3279 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
3280 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
3281 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3282 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3283 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
3284 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX),
3285 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX),
3286 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_34XX | CK_36XX),
3287 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_3XXX),
3288 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_3XXX),
3289 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3290 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3291 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3292 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3293 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3294 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3295 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3296 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
3297 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX),
3298 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_3XXX),
3299 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_3XXX),
3300 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_3XXX),
3301 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_3XXX),
3302 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_3XXX),
3303 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_3XXX),
3304 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX),
3305 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_3XXX),
3306 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_3XXX),
3307 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_3XXX),
3308 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_3XXX),
3309 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX),
3310 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX),
3311 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3312 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX),
3313 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX),
3314 CLK(NULL, "hdq_fck", &hdq_fck, CK_3XXX),
3315 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3316 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3317 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
3318 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3319 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX),
3320 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3321 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3322 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3323 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3324 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX),
3325 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX),
3326 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX),
3327 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX),
3328 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX),
3329 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3330 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3331 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3332 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3333 CLK(NULL, "mmchs3_ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3334 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX),
3335 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX),
3336 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX),
3337 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX),
3338 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX),
3339 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX),
3340 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_3XXX),
3341 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_3XXX),
3342 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX),
3343 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX),
3344 CLK(NULL, "hdq_ick", &hdq_ick, CK_3XXX),
3345 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX),
3346 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX),
3347 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX),
3348 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX),
3349 CLK(NULL, "mcspi4_ick", &mcspi4_ick, CK_3XXX),
3350 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_3XXX),
3351 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_3XXX),
3352 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_3XXX),
3353 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX),
3354 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX),
3355 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX),
3356 CLK(NULL, "i2c3_ick", &i2c3_ick, CK_3XXX),
3357 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_3XXX),
3358 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_3XXX),
3359 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX),
3360 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX),
3361 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX),
3362 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX),
3363 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX),
3364 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX),
3365 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_3XXX),
3366 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_3XXX),
3367 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
3368 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX),
3369 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX),
3370 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_34XX | CK_36XX),
3371 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1),
3372 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3373 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
3374 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_34XX | CK_36XX),
3375 CLK(NULL, "aes1_ick", &aes1_ick, CK_34XX | CK_36XX),
3376 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX),
3377 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX),
3378 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX),
3379 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
3380 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3381 CLK(NULL, "dss_tv_fck", &dss_tv_fck, CK_3XXX),
3382 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX),
3383 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX),
3384 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1),
3385 CLK(NULL, "dss_ick", &dss_ick_3430es1, CK_3430ES1),
3386 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3387 CLK(NULL, "dss_ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3388 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX),
3389 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX),
3390 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX),
3391 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3392 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3393 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3394 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3395 CLK(NULL, "utmi_p1_gfclk", &dummy_ck, CK_3XXX),
3396 CLK(NULL, "utmi_p2_gfclk", &dummy_ck, CK_3XXX),
3397 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck, CK_3XXX),
3398 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck, CK_3XXX),
3399 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX),
3400 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3401 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3402 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3403 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3404 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3405 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3406 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3407 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3408 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
3409 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX),
3410 CLK(NULL, "wdt2_fck", &wdt2_fck, CK_3XXX),
3411 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3412 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3413 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
3414 CLK(NULL, "wdt2_ick", &wdt2_ick, CK_3XXX),
3415 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
3416 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
3417 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
3418 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
3419 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
3420 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3421 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3422 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3423 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3424 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_AM35XX),
3425 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3426 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3427 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
3428 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_3XXX),
3429 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_3XXX),
3430 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_3XXX),
3431 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_3XXX),
3432 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_3XXX),
3433 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
3434 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_3XXX),
3435 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_3XXX),
3436 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_3XXX),
3437 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_3XXX),
3438 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_3XXX),
3439 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_3XXX),
3440 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_3XXX),
3441 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_3XXX),
3442 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_3XXX),
3443 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_3XXX),
3444 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_3XXX),
3445 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX),
3446 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX),
3447 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX),
3448 CLK(NULL, "uart4_ick", &uart4_ick, CK_36XX),
3449 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX),
3450 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX),
3451 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX),
3452 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_3XXX),
3453 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_3XXX),
3454 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_3XXX),
3455 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_3XXX),
3456 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_3XXX),
3457 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3458 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3459 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3460 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick, CK_3XXX),
3461 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_3XXX),
3462 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick, CK_3XXX),
3463 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3464 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3465 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3466 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3467 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_3XXX),
3468 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3469 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
3470 CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX),
3471 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX),
3472 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX),
3473 CLK(NULL, "sr1_fck", &sr1_fck, CK_34XX | CK_36XX),
3474 CLK(NULL, "sr2_fck", &sr2_fck, CK_34XX | CK_36XX),
3475 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX),
3476 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX),
3477 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX),
3478 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_3XXX),
3479 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3480 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3481 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3482 CLK(NULL, "emac_ick", &emac_ick, CK_AM35XX),
3483 CLK(NULL, "emac_fck", &emac_fck, CK_AM35XX),
3484 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3485 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3486 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3487 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3488 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
3489 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3490 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3491 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3492 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3493 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3494 CLK(NULL, "cpufreq_ck", &dpll1_ck, CK_3XXX),
3495};
3496
3497static const char *enable_init_clks[] = {
3498 "sdrc_ick",
3499 "gpmc_fck",
3500 "omapctrl_ick",
3501};
3502
3503int __init omap3xxx_clk_init(void)
3504{
3505 struct omap_clk *c;
3506 u32 cpu_clkflg = 0;
3507
3508 /*
3509 * 3505 must be tested before 3517, since 3517 returns true
3510 * for both AM3517 chips and AM3517 family chips, which
3511 * includes 3505. Unfortunately there's no obvious family
3512 * test for 3517/3505 :-(
3513 */
3514 if (soc_is_am35xx()) {
3515 cpu_mask = RATE_IN_34XX;
3516 cpu_clkflg = CK_AM35XX;
3517 } else if (cpu_is_omap3630()) {
3518 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
3519 cpu_clkflg = CK_36XX;
3520 } else if (cpu_is_ti816x()) {
3521 cpu_mask = RATE_IN_TI816X;
3522 cpu_clkflg = CK_TI816X;
3523 } else if (soc_is_am33xx()) {
3524 cpu_mask = RATE_IN_AM33XX;
3525 } else if (cpu_is_ti814x()) {
3526 cpu_mask = RATE_IN_TI814X;
3527 } else if (cpu_is_omap34xx()) {
3528 if (omap_rev() == OMAP3430_REV_ES1_0) {
3529 cpu_mask = RATE_IN_3430ES1;
3530 cpu_clkflg = CK_3430ES1;
3531 } else {
3532 /*
3533 * Assume that anything that we haven't matched yet
3534 * has 3430ES2-type clocks.
3535 */
3536 cpu_mask = RATE_IN_3430ES2PLUS;
3537 cpu_clkflg = CK_3430ES2PLUS;
3538 }
3539 } else {
3540 WARN(1, "clock: could not identify OMAP3 variant\n");
3541 }
3542
3543 if (omap3_has_192mhz_clk())
3544 omap_96m_alwon_fck = omap_96m_alwon_fck_3630;
3545
3546 if (cpu_is_omap3630()) {
3547 dpll3_m3x2_ck = dpll3_m3x2_ck_3630;
3548 dpll4_m2x2_ck = dpll4_m2x2_ck_3630;
3549 dpll4_m3x2_ck = dpll4_m3x2_ck_3630;
3550 dpll4_m4x2_ck = dpll4_m4x2_ck_3630;
3551 dpll4_m5x2_ck = dpll4_m5x2_ck_3630;
3552 dpll4_m6x2_ck = dpll4_m6x2_ck_3630;
3553 }
3554
3555 /*
3556 * XXX This type of dynamic rewriting of the clock tree is
3557 * deprecated and should be revised soon.
3558 */
3559 if (cpu_is_omap3630())
3560 dpll4_dd = dpll4_dd_3630;
3561 else
3562 dpll4_dd = dpll4_dd_34xx;
3563
3564 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3565 c++)
3566 if (c->cpu & cpu_clkflg) {
3567 clkdev_add(&c->lk);
3568 if (!__clk_init(NULL, c->lk.clk))
3569 omap2_init_clk_hw_omap_clocks(c->lk.clk);
3570 }
3571
3572 omap2_clk_disable_autoidle_all();
3573
3574 omap2_clk_enable_init_clocks(enable_init_clks,
3575 ARRAY_SIZE(enable_init_clks));
3576
3577 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
3578 (clk_get_rate(&osc_sys_ck) / 1000000),
3579 (clk_get_rate(&osc_sys_ck) / 100000) % 10,
3580 (clk_get_rate(&core_ck) / 1000000),
3581 (clk_get_rate(&arm_fck) / 1000000));
3582
3583 /*
3584 * Lock DPLL5 -- here only until other device init code can
3585 * handle this
3586 */
3587 if (!cpu_is_ti81xx() && (omap_rev() >= OMAP3430_REV_ES2_0))
3588 omap3_clk_lock_dpll5();
3589
3590 /* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
3591 sdrc_ick_p = clk_get(NULL, "sdrc_ick");
3592 arm_fck_p = clk_get(NULL, "arm_fck");
3593
3594 return 0;
3595}
diff --git a/arch/arm/mach-omap2/cclock44xx_data.c b/arch/arm/mach-omap2/cclock44xx_data.c
new file mode 100644
index 000000000000..aa56c3e5bb34
--- /dev/null
+++ b/arch/arm/mach-omap2/cclock44xx_data.c
@@ -0,0 +1,1987 @@
1/*
2 * OMAP4 Clock data
3 *
4 * Copyright (C) 2009-2012 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 * Mike Turquette (mturquette@ti.com)
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation.
15 *
16 * XXX Some of the ES1 clocks have been removed/changed; once support
17 * is added for discriminating clocks by ES level, these should be added back
18 * in.
19 */
20
21#include <linux/kernel.h>
22#include <linux/list.h>
23#include <linux/clk-private.h>
24#include <linux/clkdev.h>
25#include <linux/io.h>
26
27#include "soc.h"
28#include "iomap.h"
29#include "clock.h"
30#include "clock44xx.h"
31#include "cm1_44xx.h"
32#include "cm2_44xx.h"
33#include "cm-regbits-44xx.h"
34#include "prm44xx.h"
35#include "prm-regbits-44xx.h"
36#include "control.h"
37#include "scrm44xx.h"
38
39/* OMAP4 modulemode control */
40#define OMAP4430_MODULEMODE_HWCTRL_SHIFT 0
41#define OMAP4430_MODULEMODE_SWCTRL_SHIFT 1
42
43/* Root clocks */
44
45DEFINE_CLK_FIXED_RATE(extalt_clkin_ck, CLK_IS_ROOT, 59000000, 0x0);
46
47DEFINE_CLK_FIXED_RATE(pad_clks_src_ck, CLK_IS_ROOT, 12000000, 0x0);
48
49DEFINE_CLK_GATE(pad_clks_ck, "pad_clks_src_ck", &pad_clks_src_ck, 0x0,
50 OMAP4430_CM_CLKSEL_ABE, OMAP4430_PAD_CLKS_GATE_SHIFT,
51 0x0, NULL);
52
53DEFINE_CLK_FIXED_RATE(pad_slimbus_core_clks_ck, CLK_IS_ROOT, 12000000, 0x0);
54
55DEFINE_CLK_FIXED_RATE(secure_32k_clk_src_ck, CLK_IS_ROOT, 32768, 0x0);
56
57DEFINE_CLK_FIXED_RATE(slimbus_src_clk, CLK_IS_ROOT, 12000000, 0x0);
58
59DEFINE_CLK_GATE(slimbus_clk, "slimbus_src_clk", &slimbus_src_clk, 0x0,
60 OMAP4430_CM_CLKSEL_ABE, OMAP4430_SLIMBUS_CLK_GATE_SHIFT,
61 0x0, NULL);
62
63DEFINE_CLK_FIXED_RATE(sys_32k_ck, CLK_IS_ROOT, 32768, 0x0);
64
65DEFINE_CLK_FIXED_RATE(virt_12000000_ck, CLK_IS_ROOT, 12000000, 0x0);
66
67DEFINE_CLK_FIXED_RATE(virt_13000000_ck, CLK_IS_ROOT, 13000000, 0x0);
68
69DEFINE_CLK_FIXED_RATE(virt_16800000_ck, CLK_IS_ROOT, 16800000, 0x0);
70
71DEFINE_CLK_FIXED_RATE(virt_19200000_ck, CLK_IS_ROOT, 19200000, 0x0);
72
73DEFINE_CLK_FIXED_RATE(virt_26000000_ck, CLK_IS_ROOT, 26000000, 0x0);
74
75DEFINE_CLK_FIXED_RATE(virt_27000000_ck, CLK_IS_ROOT, 27000000, 0x0);
76
77DEFINE_CLK_FIXED_RATE(virt_38400000_ck, CLK_IS_ROOT, 38400000, 0x0);
78
79static const char *sys_clkin_ck_parents[] = {
80 "virt_12000000_ck", "virt_13000000_ck", "virt_16800000_ck",
81 "virt_19200000_ck", "virt_26000000_ck", "virt_27000000_ck",
82 "virt_38400000_ck",
83};
84
85DEFINE_CLK_MUX(sys_clkin_ck, sys_clkin_ck_parents, NULL, 0x0,
86 OMAP4430_CM_SYS_CLKSEL, OMAP4430_SYS_CLKSEL_SHIFT,
87 OMAP4430_SYS_CLKSEL_WIDTH, CLK_MUX_INDEX_ONE, NULL);
88
89DEFINE_CLK_FIXED_RATE(tie_low_clock_ck, CLK_IS_ROOT, 0, 0x0);
90
91DEFINE_CLK_FIXED_RATE(utmi_phy_clkout_ck, CLK_IS_ROOT, 60000000, 0x0);
92
93DEFINE_CLK_FIXED_RATE(xclk60mhsp1_ck, CLK_IS_ROOT, 60000000, 0x0);
94
95DEFINE_CLK_FIXED_RATE(xclk60mhsp2_ck, CLK_IS_ROOT, 60000000, 0x0);
96
97DEFINE_CLK_FIXED_RATE(xclk60motg_ck, CLK_IS_ROOT, 60000000, 0x0);
98
99/* Module clocks and DPLL outputs */
100
101static const char *abe_dpll_bypass_clk_mux_ck_parents[] = {
102 "sys_clkin_ck", "sys_32k_ck",
103};
104
105DEFINE_CLK_MUX(abe_dpll_bypass_clk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents,
106 NULL, 0x0, OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_SHIFT,
107 OMAP4430_CLKSEL_WIDTH, 0x0, NULL);
108
109DEFINE_CLK_MUX(abe_dpll_refclk_mux_ck, abe_dpll_bypass_clk_mux_ck_parents, NULL,
110 0x0, OMAP4430_CM_ABE_PLL_REF_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
111 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
112
113/* DPLL_ABE */
114static struct dpll_data dpll_abe_dd = {
115 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
116 .clk_bypass = &abe_dpll_bypass_clk_mux_ck,
117 .clk_ref = &abe_dpll_refclk_mux_ck,
118 .control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
119 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
120 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
121 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
122 .mult_mask = OMAP4430_DPLL_MULT_MASK,
123 .div1_mask = OMAP4430_DPLL_DIV_MASK,
124 .enable_mask = OMAP4430_DPLL_EN_MASK,
125 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
126 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
127 .max_multiplier = 2047,
128 .max_divider = 128,
129 .min_divider = 1,
130};
131
132
133static const char *dpll_abe_ck_parents[] = {
134 "abe_dpll_refclk_mux_ck",
135};
136
137static struct clk dpll_abe_ck;
138
139static const struct clk_ops dpll_abe_ck_ops = {
140 .enable = &omap3_noncore_dpll_enable,
141 .disable = &omap3_noncore_dpll_disable,
142 .recalc_rate = &omap4_dpll_regm4xen_recalc,
143 .round_rate = &omap4_dpll_regm4xen_round_rate,
144 .set_rate = &omap3_noncore_dpll_set_rate,
145 .get_parent = &omap2_init_dpll_parent,
146};
147
148static struct clk_hw_omap dpll_abe_ck_hw = {
149 .hw = {
150 .clk = &dpll_abe_ck,
151 },
152 .dpll_data = &dpll_abe_dd,
153 .ops = &clkhwops_omap3_dpll,
154};
155
156DEFINE_STRUCT_CLK(dpll_abe_ck, dpll_abe_ck_parents, dpll_abe_ck_ops);
157
158static const char *dpll_abe_x2_ck_parents[] = {
159 "dpll_abe_ck",
160};
161
162static struct clk dpll_abe_x2_ck;
163
164static const struct clk_ops dpll_abe_x2_ck_ops = {
165 .recalc_rate = &omap3_clkoutx2_recalc,
166};
167
168static struct clk_hw_omap dpll_abe_x2_ck_hw = {
169 .hw = {
170 .clk = &dpll_abe_x2_ck,
171 },
172 .flags = CLOCK_CLKOUTX2,
173 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
174 .ops = &clkhwops_omap4_dpllmx,
175};
176
177DEFINE_STRUCT_CLK(dpll_abe_x2_ck, dpll_abe_x2_ck_parents, dpll_abe_x2_ck_ops);
178
179static const struct clk_ops omap_hsdivider_ops = {
180 .set_rate = &omap2_clksel_set_rate,
181 .recalc_rate = &omap2_clksel_recalc,
182 .round_rate = &omap2_clksel_round_rate,
183};
184
185DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m2x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
186 0x0, OMAP4430_CM_DIV_M2_DPLL_ABE,
187 OMAP4430_DPLL_CLKOUT_DIV_MASK);
188
189DEFINE_CLK_FIXED_FACTOR(abe_24m_fclk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
190 0x0, 1, 8);
191
192DEFINE_CLK_DIVIDER(abe_clk, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, 0x0,
193 OMAP4430_CM_CLKSEL_ABE, OMAP4430_CLKSEL_OPP_SHIFT,
194 OMAP4430_CLKSEL_OPP_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
195
196DEFINE_CLK_DIVIDER(aess_fclk, "abe_clk", &abe_clk, 0x0,
197 OMAP4430_CM1_ABE_AESS_CLKCTRL,
198 OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
199 OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
200 0x0, NULL);
201
202DEFINE_CLK_OMAP_HSDIVIDER(dpll_abe_m3x2_ck, "dpll_abe_x2_ck", &dpll_abe_x2_ck,
203 0x0, OMAP4430_CM_DIV_M3_DPLL_ABE,
204 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK);
205
206static const char *core_hsd_byp_clk_mux_ck_parents[] = {
207 "sys_clkin_ck", "dpll_abe_m3x2_ck",
208};
209
210DEFINE_CLK_MUX(core_hsd_byp_clk_mux_ck, core_hsd_byp_clk_mux_ck_parents, NULL,
211 0x0, OMAP4430_CM_CLKSEL_DPLL_CORE,
212 OMAP4430_DPLL_BYP_CLKSEL_SHIFT, OMAP4430_DPLL_BYP_CLKSEL_WIDTH,
213 0x0, NULL);
214
215/* DPLL_CORE */
216static struct dpll_data dpll_core_dd = {
217 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
218 .clk_bypass = &core_hsd_byp_clk_mux_ck,
219 .clk_ref = &sys_clkin_ck,
220 .control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
221 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
222 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
223 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
224 .mult_mask = OMAP4430_DPLL_MULT_MASK,
225 .div1_mask = OMAP4430_DPLL_DIV_MASK,
226 .enable_mask = OMAP4430_DPLL_EN_MASK,
227 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
228 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
229 .max_multiplier = 2047,
230 .max_divider = 128,
231 .min_divider = 1,
232};
233
234
235static const char *dpll_core_ck_parents[] = {
236 "sys_clkin_ck",
237};
238
239static struct clk dpll_core_ck;
240
241static const struct clk_ops dpll_core_ck_ops = {
242 .recalc_rate = &omap3_dpll_recalc,
243 .get_parent = &omap2_init_dpll_parent,
244};
245
246static struct clk_hw_omap dpll_core_ck_hw = {
247 .hw = {
248 .clk = &dpll_core_ck,
249 },
250 .dpll_data = &dpll_core_dd,
251 .ops = &clkhwops_omap3_dpll,
252};
253
254DEFINE_STRUCT_CLK(dpll_core_ck, dpll_core_ck_parents, dpll_core_ck_ops);
255
256static const char *dpll_core_x2_ck_parents[] = {
257 "dpll_core_ck",
258};
259
260static struct clk dpll_core_x2_ck;
261
262static struct clk_hw_omap dpll_core_x2_ck_hw = {
263 .hw = {
264 .clk = &dpll_core_x2_ck,
265 },
266};
267
268DEFINE_STRUCT_CLK(dpll_core_x2_ck, dpll_core_x2_ck_parents, dpll_abe_x2_ck_ops);
269
270DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m6x2_ck, "dpll_core_x2_ck",
271 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M6_DPLL_CORE,
272 OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
273
274DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m2_ck, "dpll_core_ck", &dpll_core_ck, 0x0,
275 OMAP4430_CM_DIV_M2_DPLL_CORE,
276 OMAP4430_DPLL_CLKOUT_DIV_MASK);
277
278DEFINE_CLK_FIXED_FACTOR(ddrphy_ck, "dpll_core_m2_ck", &dpll_core_m2_ck, 0x0, 1,
279 2);
280
281DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m5x2_ck, "dpll_core_x2_ck",
282 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M5_DPLL_CORE,
283 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
284
285DEFINE_CLK_DIVIDER(div_core_ck, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, 0x0,
286 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_CORE_SHIFT,
287 OMAP4430_CLKSEL_CORE_WIDTH, 0x0, NULL);
288
289DEFINE_CLK_OMAP_HSDIVIDER(div_iva_hs_clk, "dpll_core_m5x2_ck",
290 &dpll_core_m5x2_ck, 0x0, OMAP4430_CM_BYPCLK_DPLL_IVA,
291 OMAP4430_CLKSEL_0_1_MASK);
292
293DEFINE_CLK_DIVIDER(div_mpu_hs_clk, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck,
294 0x0, OMAP4430_CM_BYPCLK_DPLL_MPU, OMAP4430_CLKSEL_0_1_SHIFT,
295 OMAP4430_CLKSEL_0_1_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
296
297DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m4x2_ck, "dpll_core_x2_ck",
298 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M4_DPLL_CORE,
299 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
300
301DEFINE_CLK_FIXED_FACTOR(dll_clk_div_ck, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck,
302 0x0, 1, 2);
303
304DEFINE_CLK_DIVIDER(dpll_abe_m2_ck, "dpll_abe_ck", &dpll_abe_ck, 0x0,
305 OMAP4430_CM_DIV_M2_DPLL_ABE, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
306 OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
307
308static const struct clk_ops dmic_fck_ops = {
309 .enable = &omap2_dflt_clk_enable,
310 .disable = &omap2_dflt_clk_disable,
311 .is_enabled = &omap2_dflt_clk_is_enabled,
312 .recalc_rate = &omap2_clksel_recalc,
313 .get_parent = &omap2_clksel_find_parent_index,
314 .set_parent = &omap2_clksel_set_parent,
315 .init = &omap2_init_clk_clkdm,
316};
317
318static const char *dpll_core_m3x2_ck_parents[] = {
319 "dpll_core_x2_ck",
320};
321
322static const struct clksel dpll_core_m3x2_div[] = {
323 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
324 { .parent = NULL },
325};
326
327/* XXX Missing round_rate, set_rate in ops */
328DEFINE_CLK_OMAP_MUX_GATE(dpll_core_m3x2_ck, NULL, dpll_core_m3x2_div,
329 OMAP4430_CM_DIV_M3_DPLL_CORE,
330 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
331 OMAP4430_CM_DIV_M3_DPLL_CORE,
332 OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
333 dpll_core_m3x2_ck_parents, dmic_fck_ops);
334
335DEFINE_CLK_OMAP_HSDIVIDER(dpll_core_m7x2_ck, "dpll_core_x2_ck",
336 &dpll_core_x2_ck, 0x0, OMAP4430_CM_DIV_M7_DPLL_CORE,
337 OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
338
339static const char *iva_hsd_byp_clk_mux_ck_parents[] = {
340 "sys_clkin_ck", "div_iva_hs_clk",
341};
342
343DEFINE_CLK_MUX(iva_hsd_byp_clk_mux_ck, iva_hsd_byp_clk_mux_ck_parents, NULL,
344 0x0, OMAP4430_CM_CLKSEL_DPLL_IVA, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
345 OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
346
347/* DPLL_IVA */
348static struct dpll_data dpll_iva_dd = {
349 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
350 .clk_bypass = &iva_hsd_byp_clk_mux_ck,
351 .clk_ref = &sys_clkin_ck,
352 .control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
353 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
354 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
355 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
356 .mult_mask = OMAP4430_DPLL_MULT_MASK,
357 .div1_mask = OMAP4430_DPLL_DIV_MASK,
358 .enable_mask = OMAP4430_DPLL_EN_MASK,
359 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
360 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
361 .max_multiplier = 2047,
362 .max_divider = 128,
363 .min_divider = 1,
364};
365
366static struct clk dpll_iva_ck;
367
368static struct clk_hw_omap dpll_iva_ck_hw = {
369 .hw = {
370 .clk = &dpll_iva_ck,
371 },
372 .dpll_data = &dpll_iva_dd,
373 .ops = &clkhwops_omap3_dpll,
374};
375
376DEFINE_STRUCT_CLK(dpll_iva_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
377
378static const char *dpll_iva_x2_ck_parents[] = {
379 "dpll_iva_ck",
380};
381
382static struct clk dpll_iva_x2_ck;
383
384static struct clk_hw_omap dpll_iva_x2_ck_hw = {
385 .hw = {
386 .clk = &dpll_iva_x2_ck,
387 },
388};
389
390DEFINE_STRUCT_CLK(dpll_iva_x2_ck, dpll_iva_x2_ck_parents, dpll_abe_x2_ck_ops);
391
392DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m4x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
393 0x0, OMAP4430_CM_DIV_M4_DPLL_IVA,
394 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
395
396DEFINE_CLK_OMAP_HSDIVIDER(dpll_iva_m5x2_ck, "dpll_iva_x2_ck", &dpll_iva_x2_ck,
397 0x0, OMAP4430_CM_DIV_M5_DPLL_IVA,
398 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
399
400/* DPLL_MPU */
401static struct dpll_data dpll_mpu_dd = {
402 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
403 .clk_bypass = &div_mpu_hs_clk,
404 .clk_ref = &sys_clkin_ck,
405 .control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
406 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
407 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
408 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
409 .mult_mask = OMAP4430_DPLL_MULT_MASK,
410 .div1_mask = OMAP4430_DPLL_DIV_MASK,
411 .enable_mask = OMAP4430_DPLL_EN_MASK,
412 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
413 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
414 .max_multiplier = 2047,
415 .max_divider = 128,
416 .min_divider = 1,
417};
418
419static struct clk dpll_mpu_ck;
420
421static struct clk_hw_omap dpll_mpu_ck_hw = {
422 .hw = {
423 .clk = &dpll_mpu_ck,
424 },
425 .dpll_data = &dpll_mpu_dd,
426 .ops = &clkhwops_omap3_dpll,
427};
428
429DEFINE_STRUCT_CLK(dpll_mpu_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
430
431DEFINE_CLK_FIXED_FACTOR(mpu_periphclk, "dpll_mpu_ck", &dpll_mpu_ck, 0x0, 1, 2);
432
433DEFINE_CLK_OMAP_HSDIVIDER(dpll_mpu_m2_ck, "dpll_mpu_ck", &dpll_mpu_ck, 0x0,
434 OMAP4430_CM_DIV_M2_DPLL_MPU,
435 OMAP4430_DPLL_CLKOUT_DIV_MASK);
436
437DEFINE_CLK_FIXED_FACTOR(per_hs_clk_div_ck, "dpll_abe_m3x2_ck",
438 &dpll_abe_m3x2_ck, 0x0, 1, 2);
439
440static const char *per_hsd_byp_clk_mux_ck_parents[] = {
441 "sys_clkin_ck", "per_hs_clk_div_ck",
442};
443
444DEFINE_CLK_MUX(per_hsd_byp_clk_mux_ck, per_hsd_byp_clk_mux_ck_parents, NULL,
445 0x0, OMAP4430_CM_CLKSEL_DPLL_PER, OMAP4430_DPLL_BYP_CLKSEL_SHIFT,
446 OMAP4430_DPLL_BYP_CLKSEL_WIDTH, 0x0, NULL);
447
448/* DPLL_PER */
449static struct dpll_data dpll_per_dd = {
450 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
451 .clk_bypass = &per_hsd_byp_clk_mux_ck,
452 .clk_ref = &sys_clkin_ck,
453 .control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
454 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
455 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
456 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
457 .mult_mask = OMAP4430_DPLL_MULT_MASK,
458 .div1_mask = OMAP4430_DPLL_DIV_MASK,
459 .enable_mask = OMAP4430_DPLL_EN_MASK,
460 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
461 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
462 .max_multiplier = 2047,
463 .max_divider = 128,
464 .min_divider = 1,
465};
466
467
468static struct clk dpll_per_ck;
469
470static struct clk_hw_omap dpll_per_ck_hw = {
471 .hw = {
472 .clk = &dpll_per_ck,
473 },
474 .dpll_data = &dpll_per_dd,
475 .ops = &clkhwops_omap3_dpll,
476};
477
478DEFINE_STRUCT_CLK(dpll_per_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
479
480DEFINE_CLK_DIVIDER(dpll_per_m2_ck, "dpll_per_ck", &dpll_per_ck, 0x0,
481 OMAP4430_CM_DIV_M2_DPLL_PER, OMAP4430_DPLL_CLKOUT_DIV_SHIFT,
482 OMAP4430_DPLL_CLKOUT_DIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
483
484static const char *dpll_per_x2_ck_parents[] = {
485 "dpll_per_ck",
486};
487
488static struct clk dpll_per_x2_ck;
489
490static struct clk_hw_omap dpll_per_x2_ck_hw = {
491 .hw = {
492 .clk = &dpll_per_x2_ck,
493 },
494 .flags = CLOCK_CLKOUTX2,
495 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
496 .ops = &clkhwops_omap4_dpllmx,
497};
498
499DEFINE_STRUCT_CLK(dpll_per_x2_ck, dpll_per_x2_ck_parents, dpll_abe_x2_ck_ops);
500
501DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m2x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
502 0x0, OMAP4430_CM_DIV_M2_DPLL_PER,
503 OMAP4430_DPLL_CLKOUT_DIV_MASK);
504
505static const char *dpll_per_m3x2_ck_parents[] = {
506 "dpll_per_x2_ck",
507};
508
509static const struct clksel dpll_per_m3x2_div[] = {
510 { .parent = &dpll_per_x2_ck, .rates = div31_1to31_rates },
511 { .parent = NULL },
512};
513
514/* XXX Missing round_rate, set_rate in ops */
515DEFINE_CLK_OMAP_MUX_GATE(dpll_per_m3x2_ck, NULL, dpll_per_m3x2_div,
516 OMAP4430_CM_DIV_M3_DPLL_PER,
517 OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
518 OMAP4430_CM_DIV_M3_DPLL_PER,
519 OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT, NULL,
520 dpll_per_m3x2_ck_parents, dmic_fck_ops);
521
522DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m4x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
523 0x0, OMAP4430_CM_DIV_M4_DPLL_PER,
524 OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK);
525
526DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m5x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
527 0x0, OMAP4430_CM_DIV_M5_DPLL_PER,
528 OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK);
529
530DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m6x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
531 0x0, OMAP4430_CM_DIV_M6_DPLL_PER,
532 OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK);
533
534DEFINE_CLK_OMAP_HSDIVIDER(dpll_per_m7x2_ck, "dpll_per_x2_ck", &dpll_per_x2_ck,
535 0x0, OMAP4430_CM_DIV_M7_DPLL_PER,
536 OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK);
537
538DEFINE_CLK_FIXED_FACTOR(usb_hs_clk_div_ck, "dpll_abe_m3x2_ck",
539 &dpll_abe_m3x2_ck, 0x0, 1, 3);
540
541/* DPLL_USB */
542static struct dpll_data dpll_usb_dd = {
543 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
544 .clk_bypass = &usb_hs_clk_div_ck,
545 .flags = DPLL_J_TYPE,
546 .clk_ref = &sys_clkin_ck,
547 .control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
548 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
549 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
550 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
551 .mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
552 .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
553 .enable_mask = OMAP4430_DPLL_EN_MASK,
554 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
555 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
556 .sddiv_mask = OMAP4430_DPLL_SD_DIV_MASK,
557 .max_multiplier = 4095,
558 .max_divider = 256,
559 .min_divider = 1,
560};
561
562static struct clk dpll_usb_ck;
563
564static struct clk_hw_omap dpll_usb_ck_hw = {
565 .hw = {
566 .clk = &dpll_usb_ck,
567 },
568 .dpll_data = &dpll_usb_dd,
569 .ops = &clkhwops_omap3_dpll,
570};
571
572DEFINE_STRUCT_CLK(dpll_usb_ck, dpll_core_ck_parents, dpll_abe_ck_ops);
573
574static const char *dpll_usb_clkdcoldo_ck_parents[] = {
575 "dpll_usb_ck",
576};
577
578static struct clk dpll_usb_clkdcoldo_ck;
579
580static const struct clk_ops dpll_usb_clkdcoldo_ck_ops = {
581};
582
583static struct clk_hw_omap dpll_usb_clkdcoldo_ck_hw = {
584 .hw = {
585 .clk = &dpll_usb_clkdcoldo_ck,
586 },
587 .clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
588 .ops = &clkhwops_omap4_dpllmx,
589};
590
591DEFINE_STRUCT_CLK(dpll_usb_clkdcoldo_ck, dpll_usb_clkdcoldo_ck_parents,
592 dpll_usb_clkdcoldo_ck_ops);
593
594DEFINE_CLK_OMAP_HSDIVIDER(dpll_usb_m2_ck, "dpll_usb_ck", &dpll_usb_ck, 0x0,
595 OMAP4430_CM_DIV_M2_DPLL_USB,
596 OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK);
597
598static const char *ducati_clk_mux_ck_parents[] = {
599 "div_core_ck", "dpll_per_m6x2_ck",
600};
601
602DEFINE_CLK_MUX(ducati_clk_mux_ck, ducati_clk_mux_ck_parents, NULL, 0x0,
603 OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT, OMAP4430_CLKSEL_0_0_SHIFT,
604 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
605
606DEFINE_CLK_FIXED_FACTOR(func_12m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
607 0x0, 1, 16);
608
609DEFINE_CLK_FIXED_FACTOR(func_24m_clk, "dpll_per_m2_ck", &dpll_per_m2_ck, 0x0,
610 1, 4);
611
612DEFINE_CLK_FIXED_FACTOR(func_24mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
613 0x0, 1, 8);
614
615static const struct clk_div_table func_48m_fclk_rates[] = {
616 { .div = 4, .val = 0 },
617 { .div = 8, .val = 1 },
618 { .div = 0 },
619};
620DEFINE_CLK_DIVIDER_TABLE(func_48m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
621 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
622 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_48m_fclk_rates,
623 NULL);
624
625DEFINE_CLK_FIXED_FACTOR(func_48mc_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
626 0x0, 1, 4);
627
628static const struct clk_div_table func_64m_fclk_rates[] = {
629 { .div = 2, .val = 0 },
630 { .div = 4, .val = 1 },
631 { .div = 0 },
632};
633DEFINE_CLK_DIVIDER_TABLE(func_64m_fclk, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck,
634 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
635 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_64m_fclk_rates,
636 NULL);
637
638static const struct clk_div_table func_96m_fclk_rates[] = {
639 { .div = 2, .val = 0 },
640 { .div = 4, .val = 1 },
641 { .div = 0 },
642};
643DEFINE_CLK_DIVIDER_TABLE(func_96m_fclk, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck,
644 0x0, OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
645 OMAP4430_SCALE_FCLK_WIDTH, 0x0, func_96m_fclk_rates,
646 NULL);
647
648static const struct clk_div_table init_60m_fclk_rates[] = {
649 { .div = 1, .val = 0 },
650 { .div = 8, .val = 1 },
651 { .div = 0 },
652};
653DEFINE_CLK_DIVIDER_TABLE(init_60m_fclk, "dpll_usb_m2_ck", &dpll_usb_m2_ck,
654 0x0, OMAP4430_CM_CLKSEL_USB_60MHZ,
655 OMAP4430_CLKSEL_0_0_SHIFT, OMAP4430_CLKSEL_0_0_WIDTH,
656 0x0, init_60m_fclk_rates, NULL);
657
658DEFINE_CLK_DIVIDER(l3_div_ck, "div_core_ck", &div_core_ck, 0x0,
659 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L3_SHIFT,
660 OMAP4430_CLKSEL_L3_WIDTH, 0x0, NULL);
661
662DEFINE_CLK_DIVIDER(l4_div_ck, "l3_div_ck", &l3_div_ck, 0x0,
663 OMAP4430_CM_CLKSEL_CORE, OMAP4430_CLKSEL_L4_SHIFT,
664 OMAP4430_CLKSEL_L4_WIDTH, 0x0, NULL);
665
666DEFINE_CLK_FIXED_FACTOR(lp_clk_div_ck, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck,
667 0x0, 1, 16);
668
669static const char *l4_wkup_clk_mux_ck_parents[] = {
670 "sys_clkin_ck", "lp_clk_div_ck",
671};
672
673DEFINE_CLK_MUX(l4_wkup_clk_mux_ck, l4_wkup_clk_mux_ck_parents, NULL, 0x0,
674 OMAP4430_CM_L4_WKUP_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
675 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
676
677static const struct clk_div_table ocp_abe_iclk_rates[] = {
678 { .div = 2, .val = 0 },
679 { .div = 1, .val = 1 },
680 { .div = 0 },
681};
682DEFINE_CLK_DIVIDER_TABLE(ocp_abe_iclk, "aess_fclk", &aess_fclk, 0x0,
683 OMAP4430_CM1_ABE_AESS_CLKCTRL,
684 OMAP4430_CLKSEL_AESS_FCLK_SHIFT,
685 OMAP4430_CLKSEL_AESS_FCLK_WIDTH,
686 0x0, ocp_abe_iclk_rates, NULL);
687
688DEFINE_CLK_FIXED_FACTOR(per_abe_24m_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck,
689 0x0, 1, 4);
690
691DEFINE_CLK_DIVIDER(per_abe_nc_fclk, "dpll_abe_m2_ck", &dpll_abe_m2_ck, 0x0,
692 OMAP4430_CM_SCALE_FCLK, OMAP4430_SCALE_FCLK_SHIFT,
693 OMAP4430_SCALE_FCLK_WIDTH, 0x0, NULL);
694
695DEFINE_CLK_DIVIDER(syc_clk_div_ck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
696 OMAP4430_CM_ABE_DSS_SYS_CLKSEL, OMAP4430_CLKSEL_0_0_SHIFT,
697 OMAP4430_CLKSEL_0_0_WIDTH, 0x0, NULL);
698
699static struct clk dbgclk_mux_ck;
700DEFINE_STRUCT_CLK_HW_OMAP(dbgclk_mux_ck, NULL);
701DEFINE_STRUCT_CLK(dbgclk_mux_ck, dpll_core_ck_parents,
702 dpll_usb_clkdcoldo_ck_ops);
703
704/* Leaf clocks controlled by modules */
705
706DEFINE_CLK_GATE(aes1_fck, "l3_div_ck", &l3_div_ck, 0x0,
707 OMAP4430_CM_L4SEC_AES1_CLKCTRL,
708 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
709
710DEFINE_CLK_GATE(aes2_fck, "l3_div_ck", &l3_div_ck, 0x0,
711 OMAP4430_CM_L4SEC_AES2_CLKCTRL,
712 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
713
714DEFINE_CLK_GATE(aess_fck, "aess_fclk", &aess_fclk, 0x0,
715 OMAP4430_CM1_ABE_AESS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
716 0x0, NULL);
717
718DEFINE_CLK_GATE(bandgap_fclk, "sys_32k_ck", &sys_32k_ck, 0x0,
719 OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
720 OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT, 0x0, NULL);
721
722static const struct clk_div_table div_ts_ck_rates[] = {
723 { .div = 8, .val = 0 },
724 { .div = 16, .val = 1 },
725 { .div = 32, .val = 2 },
726 { .div = 0 },
727};
728DEFINE_CLK_DIVIDER_TABLE(div_ts_ck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
729 0x0, OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
730 OMAP4430_CLKSEL_24_25_SHIFT,
731 OMAP4430_CLKSEL_24_25_WIDTH, 0x0, div_ts_ck_rates,
732 NULL);
733
734DEFINE_CLK_GATE(bandgap_ts_fclk, "div_ts_ck", &div_ts_ck, 0x0,
735 OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
736 OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
737 0x0, NULL);
738
739DEFINE_CLK_GATE(des3des_fck, "l4_div_ck", &l4_div_ck, 0x0,
740 OMAP4430_CM_L4SEC_DES3DES_CLKCTRL,
741 OMAP4430_MODULEMODE_SWCTRL_SHIFT,
742 0x0, NULL);
743
744static const char *dmic_sync_mux_ck_parents[] = {
745 "abe_24m_fclk", "syc_clk_div_ck", "func_24m_clk",
746};
747
748DEFINE_CLK_MUX(dmic_sync_mux_ck, dmic_sync_mux_ck_parents, NULL,
749 0x0, OMAP4430_CM1_ABE_DMIC_CLKCTRL,
750 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
751 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
752
753static const struct clksel func_dmic_abe_gfclk_sel[] = {
754 { .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
755 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
756 { .parent = &slimbus_clk, .rates = div_1_2_rates },
757 { .parent = NULL },
758};
759
760static const char *dmic_fck_parents[] = {
761 "dmic_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
762};
763
764/* Merged func_dmic_abe_gfclk into dmic */
765static struct clk dmic_fck;
766
767DEFINE_CLK_OMAP_MUX_GATE(dmic_fck, "abe_clkdm", func_dmic_abe_gfclk_sel,
768 OMAP4430_CM1_ABE_DMIC_CLKCTRL,
769 OMAP4430_CLKSEL_SOURCE_MASK,
770 OMAP4430_CM1_ABE_DMIC_CLKCTRL,
771 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
772 dmic_fck_parents, dmic_fck_ops);
773
774DEFINE_CLK_GATE(dsp_fck, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, 0x0,
775 OMAP4430_CM_TESLA_TESLA_CLKCTRL,
776 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
777
778DEFINE_CLK_GATE(dss_sys_clk, "syc_clk_div_ck", &syc_clk_div_ck, 0x0,
779 OMAP4430_CM_DSS_DSS_CLKCTRL,
780 OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT, 0x0, NULL);
781
782DEFINE_CLK_GATE(dss_tv_clk, "extalt_clkin_ck", &extalt_clkin_ck, 0x0,
783 OMAP4430_CM_DSS_DSS_CLKCTRL,
784 OMAP4430_OPTFCLKEN_TV_CLK_SHIFT, 0x0, NULL);
785
786DEFINE_CLK_GATE(dss_dss_clk, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, 0x0,
787 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_DSSCLK_SHIFT,
788 0x0, NULL);
789
790DEFINE_CLK_GATE(dss_48mhz_clk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
791 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT,
792 0x0, NULL);
793
794DEFINE_CLK_GATE(dss_fck, "l3_div_ck", &l3_div_ck, 0x0,
795 OMAP4430_CM_DSS_DSS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
796 0x0, NULL);
797
798DEFINE_CLK_GATE(efuse_ctrl_cust_fck, "sys_clkin_ck", &sys_clkin_ck, 0x0,
799 OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL,
800 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
801
802DEFINE_CLK_GATE(emif1_fck, "ddrphy_ck", &ddrphy_ck, 0x0,
803 OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
804 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
805
806DEFINE_CLK_GATE(emif2_fck, "ddrphy_ck", &ddrphy_ck, 0x0,
807 OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
808 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
809
810DEFINE_CLK_DIVIDER(fdif_fck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
811 OMAP4430_CM_CAM_FDIF_CLKCTRL, OMAP4430_CLKSEL_FCLK_SHIFT,
812 OMAP4430_CLKSEL_FCLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO, NULL);
813
814DEFINE_CLK_GATE(fpka_fck, "l4_div_ck", &l4_div_ck, 0x0,
815 OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL,
816 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
817
818DEFINE_CLK_GATE(gpio1_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
819 OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
820 OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
821
822DEFINE_CLK_GATE(gpio1_ick, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, 0x0,
823 OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
824 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
825
826DEFINE_CLK_GATE(gpio2_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
827 OMAP4430_CM_L4PER_GPIO2_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
828 0x0, NULL);
829
830DEFINE_CLK_GATE(gpio2_ick, "l4_div_ck", &l4_div_ck, 0x0,
831 OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
832 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
833
834DEFINE_CLK_GATE(gpio3_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
835 OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
836 OMAP4430_OPTFCLKEN_DBCLK_SHIFT, 0x0, NULL);
837
838DEFINE_CLK_GATE(gpio3_ick, "l4_div_ck", &l4_div_ck, 0x0,
839 OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
840 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
841
842DEFINE_CLK_GATE(gpio4_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
843 OMAP4430_CM_L4PER_GPIO4_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
844 0x0, NULL);
845
846DEFINE_CLK_GATE(gpio4_ick, "l4_div_ck", &l4_div_ck, 0x0,
847 OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
848 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
849
850DEFINE_CLK_GATE(gpio5_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
851 OMAP4430_CM_L4PER_GPIO5_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
852 0x0, NULL);
853
854DEFINE_CLK_GATE(gpio5_ick, "l4_div_ck", &l4_div_ck, 0x0,
855 OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
856 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
857
858DEFINE_CLK_GATE(gpio6_dbclk, "sys_32k_ck", &sys_32k_ck, 0x0,
859 OMAP4430_CM_L4PER_GPIO6_CLKCTRL, OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
860 0x0, NULL);
861
862DEFINE_CLK_GATE(gpio6_ick, "l4_div_ck", &l4_div_ck, 0x0,
863 OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
864 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
865
866DEFINE_CLK_GATE(gpmc_ick, "l3_div_ck", &l3_div_ck, 0x0,
867 OMAP4430_CM_L3_2_GPMC_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
868 0x0, NULL);
869
870static const struct clksel sgx_clk_mux_sel[] = {
871 { .parent = &dpll_core_m7x2_ck, .rates = div_1_0_rates },
872 { .parent = &dpll_per_m7x2_ck, .rates = div_1_1_rates },
873 { .parent = NULL },
874};
875
876static const char *gpu_fck_parents[] = {
877 "dpll_core_m7x2_ck", "dpll_per_m7x2_ck",
878};
879
880/* Merged sgx_clk_mux into gpu */
881DEFINE_CLK_OMAP_MUX_GATE(gpu_fck, "l3_gfx_clkdm", sgx_clk_mux_sel,
882 OMAP4430_CM_GFX_GFX_CLKCTRL,
883 OMAP4430_CLKSEL_SGX_FCLK_MASK,
884 OMAP4430_CM_GFX_GFX_CLKCTRL,
885 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
886 gpu_fck_parents, dmic_fck_ops);
887
888DEFINE_CLK_GATE(hdq1w_fck, "func_12m_fclk", &func_12m_fclk, 0x0,
889 OMAP4430_CM_L4PER_HDQ1W_CLKCTRL,
890 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
891
892DEFINE_CLK_DIVIDER(hsi_fck, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, 0x0,
893 OMAP4430_CM_L3INIT_HSI_CLKCTRL, OMAP4430_CLKSEL_24_25_SHIFT,
894 OMAP4430_CLKSEL_24_25_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
895 NULL);
896
897DEFINE_CLK_GATE(i2c1_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
898 OMAP4430_CM_L4PER_I2C1_CLKCTRL,
899 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
900
901DEFINE_CLK_GATE(i2c2_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
902 OMAP4430_CM_L4PER_I2C2_CLKCTRL,
903 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
904
905DEFINE_CLK_GATE(i2c3_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
906 OMAP4430_CM_L4PER_I2C3_CLKCTRL,
907 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
908
909DEFINE_CLK_GATE(i2c4_fck, "func_96m_fclk", &func_96m_fclk, 0x0,
910 OMAP4430_CM_L4PER_I2C4_CLKCTRL,
911 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
912
913DEFINE_CLK_GATE(ipu_fck, "ducati_clk_mux_ck", &ducati_clk_mux_ck, 0x0,
914 OMAP4430_CM_DUCATI_DUCATI_CLKCTRL,
915 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
916
917DEFINE_CLK_GATE(iss_ctrlclk, "func_96m_fclk", &func_96m_fclk, 0x0,
918 OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT,
919 0x0, NULL);
920
921DEFINE_CLK_GATE(iss_fck, "ducati_clk_mux_ck", &ducati_clk_mux_ck, 0x0,
922 OMAP4430_CM_CAM_ISS_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
923 0x0, NULL);
924
925DEFINE_CLK_GATE(iva_fck, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, 0x0,
926 OMAP4430_CM_IVAHD_IVAHD_CLKCTRL,
927 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
928
929DEFINE_CLK_GATE(kbd_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
930 OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
931 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
932
933static struct clk l3_instr_ick;
934
935static const char *l3_instr_ick_parent_names[] = {
936 "l3_div_ck",
937};
938
939static const struct clk_ops l3_instr_ick_ops = {
940 .enable = &omap2_dflt_clk_enable,
941 .disable = &omap2_dflt_clk_disable,
942 .is_enabled = &omap2_dflt_clk_is_enabled,
943 .init = &omap2_init_clk_clkdm,
944};
945
946static struct clk_hw_omap l3_instr_ick_hw = {
947 .hw = {
948 .clk = &l3_instr_ick,
949 },
950 .enable_reg = OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL,
951 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
952 .clkdm_name = "l3_instr_clkdm",
953};
954
955DEFINE_STRUCT_CLK(l3_instr_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
956
957static struct clk l3_main_3_ick;
958static struct clk_hw_omap l3_main_3_ick_hw = {
959 .hw = {
960 .clk = &l3_main_3_ick,
961 },
962 .enable_reg = OMAP4430_CM_L3INSTR_L3_3_CLKCTRL,
963 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
964 .clkdm_name = "l3_instr_clkdm",
965};
966
967DEFINE_STRUCT_CLK(l3_main_3_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
968
969DEFINE_CLK_MUX(mcasp_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
970 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
971 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
972 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
973
974static const struct clksel func_mcasp_abe_gfclk_sel[] = {
975 { .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
976 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
977 { .parent = &slimbus_clk, .rates = div_1_2_rates },
978 { .parent = NULL },
979};
980
981static const char *mcasp_fck_parents[] = {
982 "mcasp_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
983};
984
985/* Merged func_mcasp_abe_gfclk into mcasp */
986DEFINE_CLK_OMAP_MUX_GATE(mcasp_fck, "abe_clkdm", func_mcasp_abe_gfclk_sel,
987 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
988 OMAP4430_CLKSEL_SOURCE_MASK,
989 OMAP4430_CM1_ABE_MCASP_CLKCTRL,
990 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
991 mcasp_fck_parents, dmic_fck_ops);
992
993DEFINE_CLK_MUX(mcbsp1_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
994 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
995 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
996 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
997
998static const struct clksel func_mcbsp1_gfclk_sel[] = {
999 { .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
1000 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1001 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1002 { .parent = NULL },
1003};
1004
1005static const char *mcbsp1_fck_parents[] = {
1006 "mcbsp1_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1007};
1008
1009/* Merged func_mcbsp1_gfclk into mcbsp1 */
1010DEFINE_CLK_OMAP_MUX_GATE(mcbsp1_fck, "abe_clkdm", func_mcbsp1_gfclk_sel,
1011 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1012 OMAP4430_CLKSEL_SOURCE_MASK,
1013 OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1014 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1015 mcbsp1_fck_parents, dmic_fck_ops);
1016
1017DEFINE_CLK_MUX(mcbsp2_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
1018 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1019 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1020 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1021
1022static const struct clksel func_mcbsp2_gfclk_sel[] = {
1023 { .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
1024 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1025 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1026 { .parent = NULL },
1027};
1028
1029static const char *mcbsp2_fck_parents[] = {
1030 "mcbsp2_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1031};
1032
1033/* Merged func_mcbsp2_gfclk into mcbsp2 */
1034DEFINE_CLK_OMAP_MUX_GATE(mcbsp2_fck, "abe_clkdm", func_mcbsp2_gfclk_sel,
1035 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1036 OMAP4430_CLKSEL_SOURCE_MASK,
1037 OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1038 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1039 mcbsp2_fck_parents, dmic_fck_ops);
1040
1041DEFINE_CLK_MUX(mcbsp3_sync_mux_ck, dmic_sync_mux_ck_parents, NULL, 0x0,
1042 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1043 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1044 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1045
1046static const struct clksel func_mcbsp3_gfclk_sel[] = {
1047 { .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
1048 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1049 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1050 { .parent = NULL },
1051};
1052
1053static const char *mcbsp3_fck_parents[] = {
1054 "mcbsp3_sync_mux_ck", "pad_clks_ck", "slimbus_clk",
1055};
1056
1057/* Merged func_mcbsp3_gfclk into mcbsp3 */
1058DEFINE_CLK_OMAP_MUX_GATE(mcbsp3_fck, "abe_clkdm", func_mcbsp3_gfclk_sel,
1059 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1060 OMAP4430_CLKSEL_SOURCE_MASK,
1061 OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1062 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1063 mcbsp3_fck_parents, dmic_fck_ops);
1064
1065static const char *mcbsp4_sync_mux_ck_parents[] = {
1066 "func_96m_fclk", "per_abe_nc_fclk",
1067};
1068
1069DEFINE_CLK_MUX(mcbsp4_sync_mux_ck, mcbsp4_sync_mux_ck_parents, NULL, 0x0,
1070 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1071 OMAP4430_CLKSEL_INTERNAL_SOURCE_SHIFT,
1072 OMAP4430_CLKSEL_INTERNAL_SOURCE_WIDTH, 0x0, NULL);
1073
1074static const struct clksel per_mcbsp4_gfclk_sel[] = {
1075 { .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
1076 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1077 { .parent = NULL },
1078};
1079
1080static const char *mcbsp4_fck_parents[] = {
1081 "mcbsp4_sync_mux_ck", "pad_clks_ck",
1082};
1083
1084/* Merged per_mcbsp4_gfclk into mcbsp4 */
1085DEFINE_CLK_OMAP_MUX_GATE(mcbsp4_fck, "l4_per_clkdm", per_mcbsp4_gfclk_sel,
1086 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1087 OMAP4430_CLKSEL_SOURCE_24_24_MASK,
1088 OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1089 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1090 mcbsp4_fck_parents, dmic_fck_ops);
1091
1092DEFINE_CLK_GATE(mcpdm_fck, "pad_clks_ck", &pad_clks_ck, 0x0,
1093 OMAP4430_CM1_ABE_PDM_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1094 0x0, NULL);
1095
1096DEFINE_CLK_GATE(mcspi1_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1097 OMAP4430_CM_L4PER_MCSPI1_CLKCTRL,
1098 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1099
1100DEFINE_CLK_GATE(mcspi2_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1101 OMAP4430_CM_L4PER_MCSPI2_CLKCTRL,
1102 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1103
1104DEFINE_CLK_GATE(mcspi3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1105 OMAP4430_CM_L4PER_MCSPI3_CLKCTRL,
1106 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1107
1108DEFINE_CLK_GATE(mcspi4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1109 OMAP4430_CM_L4PER_MCSPI4_CLKCTRL,
1110 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1111
1112static const struct clksel hsmmc1_fclk_sel[] = {
1113 { .parent = &func_64m_fclk, .rates = div_1_0_rates },
1114 { .parent = &func_96m_fclk, .rates = div_1_1_rates },
1115 { .parent = NULL },
1116};
1117
1118static const char *mmc1_fck_parents[] = {
1119 "func_64m_fclk", "func_96m_fclk",
1120};
1121
1122/* Merged hsmmc1_fclk into mmc1 */
1123DEFINE_CLK_OMAP_MUX_GATE(mmc1_fck, "l3_init_clkdm", hsmmc1_fclk_sel,
1124 OMAP4430_CM_L3INIT_MMC1_CLKCTRL, OMAP4430_CLKSEL_MASK,
1125 OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
1126 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1127 mmc1_fck_parents, dmic_fck_ops);
1128
1129/* Merged hsmmc2_fclk into mmc2 */
1130DEFINE_CLK_OMAP_MUX_GATE(mmc2_fck, "l3_init_clkdm", hsmmc1_fclk_sel,
1131 OMAP4430_CM_L3INIT_MMC2_CLKCTRL, OMAP4430_CLKSEL_MASK,
1132 OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
1133 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1134 mmc1_fck_parents, dmic_fck_ops);
1135
1136DEFINE_CLK_GATE(mmc3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1137 OMAP4430_CM_L4PER_MMCSD3_CLKCTRL,
1138 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1139
1140DEFINE_CLK_GATE(mmc4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1141 OMAP4430_CM_L4PER_MMCSD4_CLKCTRL,
1142 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1143
1144DEFINE_CLK_GATE(mmc5_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1145 OMAP4430_CM_L4PER_MMCSD5_CLKCTRL,
1146 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1147
1148DEFINE_CLK_GATE(ocp2scp_usb_phy_phy_48m, "func_48m_fclk", &func_48m_fclk, 0x0,
1149 OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1150 OMAP4430_OPTFCLKEN_PHY_48M_SHIFT, 0x0, NULL);
1151
1152DEFINE_CLK_GATE(ocp2scp_usb_phy_ick, "l4_div_ck", &l4_div_ck, 0x0,
1153 OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
1154 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1155
1156static struct clk ocp_wp_noc_ick;
1157
1158static struct clk_hw_omap ocp_wp_noc_ick_hw = {
1159 .hw = {
1160 .clk = &ocp_wp_noc_ick,
1161 },
1162 .enable_reg = OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL,
1163 .enable_bit = OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1164 .clkdm_name = "l3_instr_clkdm",
1165};
1166
1167DEFINE_STRUCT_CLK(ocp_wp_noc_ick, l3_instr_ick_parent_names, l3_instr_ick_ops);
1168
1169DEFINE_CLK_GATE(rng_ick, "l4_div_ck", &l4_div_ck, 0x0,
1170 OMAP4430_CM_L4SEC_RNG_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1171 0x0, NULL);
1172
1173DEFINE_CLK_GATE(sha2md5_fck, "l3_div_ck", &l3_div_ck, 0x0,
1174 OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
1175 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1176
1177DEFINE_CLK_GATE(sl2if_ick, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, 0x0,
1178 OMAP4430_CM_IVAHD_SL2_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1179 0x0, NULL);
1180
1181DEFINE_CLK_GATE(slimbus1_fclk_1, "func_24m_clk", &func_24m_clk, 0x0,
1182 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1183 OMAP4430_OPTFCLKEN_FCLK1_SHIFT, 0x0, NULL);
1184
1185DEFINE_CLK_GATE(slimbus1_fclk_0, "abe_24m_fclk", &abe_24m_fclk, 0x0,
1186 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1187 OMAP4430_OPTFCLKEN_FCLK0_SHIFT, 0x0, NULL);
1188
1189DEFINE_CLK_GATE(slimbus1_fclk_2, "pad_clks_ck", &pad_clks_ck, 0x0,
1190 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1191 OMAP4430_OPTFCLKEN_FCLK2_SHIFT, 0x0, NULL);
1192
1193DEFINE_CLK_GATE(slimbus1_slimbus_clk, "slimbus_clk", &slimbus_clk, 0x0,
1194 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1195 OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT, 0x0, NULL);
1196
1197DEFINE_CLK_GATE(slimbus1_fck, "ocp_abe_iclk", &ocp_abe_iclk, 0x0,
1198 OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
1199 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1200
1201DEFINE_CLK_GATE(slimbus2_fclk_1, "per_abe_24m_fclk", &per_abe_24m_fclk, 0x0,
1202 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1203 OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT, 0x0, NULL);
1204
1205DEFINE_CLK_GATE(slimbus2_fclk_0, "func_24mc_fclk", &func_24mc_fclk, 0x0,
1206 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1207 OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT, 0x0, NULL);
1208
1209DEFINE_CLK_GATE(slimbus2_slimbus_clk, "pad_slimbus_core_clks_ck",
1210 &pad_slimbus_core_clks_ck, 0x0,
1211 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1212 OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT, 0x0, NULL);
1213
1214DEFINE_CLK_GATE(slimbus2_fck, "l4_div_ck", &l4_div_ck, 0x0,
1215 OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
1216 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1217
1218DEFINE_CLK_GATE(smartreflex_core_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1219 0x0, OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
1220 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1221
1222DEFINE_CLK_GATE(smartreflex_iva_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1223 0x0, OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
1224 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1225
1226DEFINE_CLK_GATE(smartreflex_mpu_fck, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck,
1227 0x0, OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
1228 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1229
1230static const struct clksel dmt1_clk_mux_sel[] = {
1231 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1232 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1233 { .parent = NULL },
1234};
1235
1236/* Merged dmt1_clk_mux into timer1 */
1237DEFINE_CLK_OMAP_MUX_GATE(timer1_fck, "l4_wkup_clkdm", dmt1_clk_mux_sel,
1238 OMAP4430_CM_WKUP_TIMER1_CLKCTRL, OMAP4430_CLKSEL_MASK,
1239 OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
1240 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1241 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1242
1243/* Merged cm2_dm10_mux into timer10 */
1244DEFINE_CLK_OMAP_MUX_GATE(timer10_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1245 OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
1246 OMAP4430_CLKSEL_MASK,
1247 OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
1248 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1249 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1250
1251/* Merged cm2_dm11_mux into timer11 */
1252DEFINE_CLK_OMAP_MUX_GATE(timer11_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1253 OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
1254 OMAP4430_CLKSEL_MASK,
1255 OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
1256 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1257 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1258
1259/* Merged cm2_dm2_mux into timer2 */
1260DEFINE_CLK_OMAP_MUX_GATE(timer2_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1261 OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
1262 OMAP4430_CLKSEL_MASK,
1263 OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
1264 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1265 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1266
1267/* Merged cm2_dm3_mux into timer3 */
1268DEFINE_CLK_OMAP_MUX_GATE(timer3_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1269 OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
1270 OMAP4430_CLKSEL_MASK,
1271 OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
1272 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1273 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1274
1275/* Merged cm2_dm4_mux into timer4 */
1276DEFINE_CLK_OMAP_MUX_GATE(timer4_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1277 OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
1278 OMAP4430_CLKSEL_MASK,
1279 OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
1280 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1281 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1282
1283static const struct clksel timer5_sync_mux_sel[] = {
1284 { .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
1285 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
1286 { .parent = NULL },
1287};
1288
1289static const char *timer5_fck_parents[] = {
1290 "syc_clk_div_ck", "sys_32k_ck",
1291};
1292
1293/* Merged timer5_sync_mux into timer5 */
1294DEFINE_CLK_OMAP_MUX_GATE(timer5_fck, "abe_clkdm", timer5_sync_mux_sel,
1295 OMAP4430_CM1_ABE_TIMER5_CLKCTRL, OMAP4430_CLKSEL_MASK,
1296 OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
1297 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1298 timer5_fck_parents, dmic_fck_ops);
1299
1300/* Merged timer6_sync_mux into timer6 */
1301DEFINE_CLK_OMAP_MUX_GATE(timer6_fck, "abe_clkdm", timer5_sync_mux_sel,
1302 OMAP4430_CM1_ABE_TIMER6_CLKCTRL, OMAP4430_CLKSEL_MASK,
1303 OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
1304 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1305 timer5_fck_parents, dmic_fck_ops);
1306
1307/* Merged timer7_sync_mux into timer7 */
1308DEFINE_CLK_OMAP_MUX_GATE(timer7_fck, "abe_clkdm", timer5_sync_mux_sel,
1309 OMAP4430_CM1_ABE_TIMER7_CLKCTRL, OMAP4430_CLKSEL_MASK,
1310 OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
1311 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1312 timer5_fck_parents, dmic_fck_ops);
1313
1314/* Merged timer8_sync_mux into timer8 */
1315DEFINE_CLK_OMAP_MUX_GATE(timer8_fck, "abe_clkdm", timer5_sync_mux_sel,
1316 OMAP4430_CM1_ABE_TIMER8_CLKCTRL, OMAP4430_CLKSEL_MASK,
1317 OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
1318 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1319 timer5_fck_parents, dmic_fck_ops);
1320
1321/* Merged cm2_dm9_mux into timer9 */
1322DEFINE_CLK_OMAP_MUX_GATE(timer9_fck, "l4_per_clkdm", dmt1_clk_mux_sel,
1323 OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
1324 OMAP4430_CLKSEL_MASK,
1325 OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
1326 OMAP4430_MODULEMODE_SWCTRL_SHIFT, NULL,
1327 abe_dpll_bypass_clk_mux_ck_parents, dmic_fck_ops);
1328
1329DEFINE_CLK_GATE(uart1_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1330 OMAP4430_CM_L4PER_UART1_CLKCTRL,
1331 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1332
1333DEFINE_CLK_GATE(uart2_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1334 OMAP4430_CM_L4PER_UART2_CLKCTRL,
1335 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1336
1337DEFINE_CLK_GATE(uart3_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1338 OMAP4430_CM_L4PER_UART3_CLKCTRL,
1339 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1340
1341DEFINE_CLK_GATE(uart4_fck, "func_48m_fclk", &func_48m_fclk, 0x0,
1342 OMAP4430_CM_L4PER_UART4_CLKCTRL,
1343 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1344
1345static struct clk usb_host_fs_fck;
1346
1347static const char *usb_host_fs_fck_parent_names[] = {
1348 "func_48mc_fclk",
1349};
1350
1351static const struct clk_ops usb_host_fs_fck_ops = {
1352 .enable = &omap2_dflt_clk_enable,
1353 .disable = &omap2_dflt_clk_disable,
1354 .is_enabled = &omap2_dflt_clk_is_enabled,
1355};
1356
1357static struct clk_hw_omap usb_host_fs_fck_hw = {
1358 .hw = {
1359 .clk = &usb_host_fs_fck,
1360 },
1361 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
1362 .enable_bit = OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1363 .clkdm_name = "l3_init_clkdm",
1364};
1365
1366DEFINE_STRUCT_CLK(usb_host_fs_fck, usb_host_fs_fck_parent_names,
1367 usb_host_fs_fck_ops);
1368
1369static const char *utmi_p1_gfclk_parents[] = {
1370 "init_60m_fclk", "xclk60mhsp1_ck",
1371};
1372
1373DEFINE_CLK_MUX(utmi_p1_gfclk, utmi_p1_gfclk_parents, NULL, 0x0,
1374 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1375 OMAP4430_CLKSEL_UTMI_P1_SHIFT, OMAP4430_CLKSEL_UTMI_P1_WIDTH,
1376 0x0, NULL);
1377
1378DEFINE_CLK_GATE(usb_host_hs_utmi_p1_clk, "utmi_p1_gfclk", &utmi_p1_gfclk, 0x0,
1379 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1380 OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT, 0x0, NULL);
1381
1382static const char *utmi_p2_gfclk_parents[] = {
1383 "init_60m_fclk", "xclk60mhsp2_ck",
1384};
1385
1386DEFINE_CLK_MUX(utmi_p2_gfclk, utmi_p2_gfclk_parents, NULL, 0x0,
1387 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1388 OMAP4430_CLKSEL_UTMI_P2_SHIFT, OMAP4430_CLKSEL_UTMI_P2_WIDTH,
1389 0x0, NULL);
1390
1391DEFINE_CLK_GATE(usb_host_hs_utmi_p2_clk, "utmi_p2_gfclk", &utmi_p2_gfclk, 0x0,
1392 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1393 OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT, 0x0, NULL);
1394
1395DEFINE_CLK_GATE(usb_host_hs_utmi_p3_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1396 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1397 OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT, 0x0, NULL);
1398
1399DEFINE_CLK_GATE(usb_host_hs_hsic480m_p1_clk, "dpll_usb_m2_ck",
1400 &dpll_usb_m2_ck, 0x0,
1401 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1402 OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT, 0x0, NULL);
1403
1404DEFINE_CLK_GATE(usb_host_hs_hsic60m_p1_clk, "init_60m_fclk",
1405 &init_60m_fclk, 0x0,
1406 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1407 OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT, 0x0, NULL);
1408
1409DEFINE_CLK_GATE(usb_host_hs_hsic60m_p2_clk, "init_60m_fclk",
1410 &init_60m_fclk, 0x0,
1411 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1412 OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT, 0x0, NULL);
1413
1414DEFINE_CLK_GATE(usb_host_hs_hsic480m_p2_clk, "dpll_usb_m2_ck",
1415 &dpll_usb_m2_ck, 0x0,
1416 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1417 OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT, 0x0, NULL);
1418
1419DEFINE_CLK_GATE(usb_host_hs_func48mclk, "func_48mc_fclk", &func_48mc_fclk, 0x0,
1420 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1421 OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT, 0x0, NULL);
1422
1423DEFINE_CLK_GATE(usb_host_hs_fck, "init_60m_fclk", &init_60m_fclk, 0x0,
1424 OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
1425 OMAP4430_MODULEMODE_SWCTRL_SHIFT, 0x0, NULL);
1426
1427static const char *otg_60m_gfclk_parents[] = {
1428 "utmi_phy_clkout_ck", "xclk60motg_ck",
1429};
1430
1431DEFINE_CLK_MUX(otg_60m_gfclk, otg_60m_gfclk_parents, NULL, 0x0,
1432 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL, OMAP4430_CLKSEL_60M_SHIFT,
1433 OMAP4430_CLKSEL_60M_WIDTH, 0x0, NULL);
1434
1435DEFINE_CLK_GATE(usb_otg_hs_xclk, "otg_60m_gfclk", &otg_60m_gfclk, 0x0,
1436 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
1437 OMAP4430_OPTFCLKEN_XCLK_SHIFT, 0x0, NULL);
1438
1439DEFINE_CLK_GATE(usb_otg_hs_ick, "l3_div_ck", &l3_div_ck, 0x0,
1440 OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
1441 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1442
1443DEFINE_CLK_GATE(usb_phy_cm_clk32k, "sys_32k_ck", &sys_32k_ck, 0x0,
1444 OMAP4430_CM_ALWON_USBPHY_CLKCTRL,
1445 OMAP4430_OPTFCLKEN_CLK32K_SHIFT, 0x0, NULL);
1446
1447DEFINE_CLK_GATE(usb_tll_hs_usb_ch2_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1448 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1449 OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT, 0x0, NULL);
1450
1451DEFINE_CLK_GATE(usb_tll_hs_usb_ch0_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1452 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1453 OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT, 0x0, NULL);
1454
1455DEFINE_CLK_GATE(usb_tll_hs_usb_ch1_clk, "init_60m_fclk", &init_60m_fclk, 0x0,
1456 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1457 OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT, 0x0, NULL);
1458
1459DEFINE_CLK_GATE(usb_tll_hs_ick, "l4_div_ck", &l4_div_ck, 0x0,
1460 OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
1461 OMAP4430_MODULEMODE_HWCTRL_SHIFT, 0x0, NULL);
1462
1463static const struct clk_div_table usim_ck_rates[] = {
1464 { .div = 14, .val = 0 },
1465 { .div = 18, .val = 1 },
1466 { .div = 0 },
1467};
1468DEFINE_CLK_DIVIDER_TABLE(usim_ck, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, 0x0,
1469 OMAP4430_CM_WKUP_USIM_CLKCTRL,
1470 OMAP4430_CLKSEL_DIV_SHIFT, OMAP4430_CLKSEL_DIV_WIDTH,
1471 0x0, usim_ck_rates, NULL);
1472
1473DEFINE_CLK_GATE(usim_fclk, "usim_ck", &usim_ck, 0x0,
1474 OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_OPTFCLKEN_FCLK_SHIFT,
1475 0x0, NULL);
1476
1477DEFINE_CLK_GATE(usim_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1478 OMAP4430_CM_WKUP_USIM_CLKCTRL, OMAP4430_MODULEMODE_HWCTRL_SHIFT,
1479 0x0, NULL);
1480
1481DEFINE_CLK_GATE(wd_timer2_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1482 OMAP4430_CM_WKUP_WDT2_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1483 0x0, NULL);
1484
1485DEFINE_CLK_GATE(wd_timer3_fck, "sys_32k_ck", &sys_32k_ck, 0x0,
1486 OMAP4430_CM1_ABE_WDT3_CLKCTRL, OMAP4430_MODULEMODE_SWCTRL_SHIFT,
1487 0x0, NULL);
1488
1489/* Remaining optional clocks */
1490static const char *pmd_stm_clock_mux_ck_parents[] = {
1491 "sys_clkin_ck", "dpll_core_m6x2_ck", "tie_low_clock_ck",
1492};
1493
1494DEFINE_CLK_MUX(pmd_stm_clock_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
1495 OMAP4430_CM_EMU_DEBUGSS_CLKCTRL, OMAP4430_PMD_STM_MUX_CTRL_SHIFT,
1496 OMAP4430_PMD_STM_MUX_CTRL_WIDTH, 0x0, NULL);
1497
1498DEFINE_CLK_MUX(pmd_trace_clk_mux_ck, pmd_stm_clock_mux_ck_parents, NULL, 0x0,
1499 OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1500 OMAP4430_PMD_TRACE_MUX_CTRL_SHIFT,
1501 OMAP4430_PMD_TRACE_MUX_CTRL_WIDTH, 0x0, NULL);
1502
1503DEFINE_CLK_DIVIDER(stm_clk_div_ck, "pmd_stm_clock_mux_ck",
1504 &pmd_stm_clock_mux_ck, 0x0, OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1505 OMAP4430_CLKSEL_PMD_STM_CLK_SHIFT,
1506 OMAP4430_CLKSEL_PMD_STM_CLK_WIDTH, CLK_DIVIDER_POWER_OF_TWO,
1507 NULL);
1508
1509static const char *trace_clk_div_ck_parents[] = {
1510 "pmd_trace_clk_mux_ck",
1511};
1512
1513static const struct clksel trace_clk_div_div[] = {
1514 { .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
1515 { .parent = NULL },
1516};
1517
1518static struct clk trace_clk_div_ck;
1519
1520static const struct clk_ops trace_clk_div_ck_ops = {
1521 .recalc_rate = &omap2_clksel_recalc,
1522 .set_rate = &omap2_clksel_set_rate,
1523 .round_rate = &omap2_clksel_round_rate,
1524 .init = &omap2_init_clk_clkdm,
1525 .enable = &omap2_clkops_enable_clkdm,
1526 .disable = &omap2_clkops_disable_clkdm,
1527};
1528
1529static struct clk_hw_omap trace_clk_div_ck_hw = {
1530 .hw = {
1531 .clk = &trace_clk_div_ck,
1532 },
1533 .clkdm_name = "emu_sys_clkdm",
1534 .clksel = trace_clk_div_div,
1535 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
1536 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
1537};
1538
1539DEFINE_STRUCT_CLK(trace_clk_div_ck, trace_clk_div_ck_parents,
1540 trace_clk_div_ck_ops);
1541
1542/* SCRM aux clk nodes */
1543
1544static const struct clksel auxclk_src_sel[] = {
1545 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1546 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
1547 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
1548 { .parent = NULL },
1549};
1550
1551static const char *auxclk_src_ck_parents[] = {
1552 "sys_clkin_ck", "dpll_core_m3x2_ck", "dpll_per_m3x2_ck",
1553};
1554
1555static const struct clk_ops auxclk_src_ck_ops = {
1556 .enable = &omap2_dflt_clk_enable,
1557 .disable = &omap2_dflt_clk_disable,
1558 .is_enabled = &omap2_dflt_clk_is_enabled,
1559 .recalc_rate = &omap2_clksel_recalc,
1560 .get_parent = &omap2_clksel_find_parent_index,
1561};
1562
1563DEFINE_CLK_OMAP_MUX_GATE(auxclk0_src_ck, NULL, auxclk_src_sel,
1564 OMAP4_SCRM_AUXCLK0, OMAP4_SRCSELECT_MASK,
1565 OMAP4_SCRM_AUXCLK0, OMAP4_ENABLE_SHIFT, NULL,
1566 auxclk_src_ck_parents, auxclk_src_ck_ops);
1567
1568DEFINE_CLK_DIVIDER(auxclk0_ck, "auxclk0_src_ck", &auxclk0_src_ck, 0x0,
1569 OMAP4_SCRM_AUXCLK0, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1570 0x0, NULL);
1571
1572DEFINE_CLK_OMAP_MUX_GATE(auxclk1_src_ck, NULL, auxclk_src_sel,
1573 OMAP4_SCRM_AUXCLK1, OMAP4_SRCSELECT_MASK,
1574 OMAP4_SCRM_AUXCLK1, OMAP4_ENABLE_SHIFT, NULL,
1575 auxclk_src_ck_parents, auxclk_src_ck_ops);
1576
1577DEFINE_CLK_DIVIDER(auxclk1_ck, "auxclk1_src_ck", &auxclk1_src_ck, 0x0,
1578 OMAP4_SCRM_AUXCLK1, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1579 0x0, NULL);
1580
1581DEFINE_CLK_OMAP_MUX_GATE(auxclk2_src_ck, NULL, auxclk_src_sel,
1582 OMAP4_SCRM_AUXCLK2, OMAP4_SRCSELECT_MASK,
1583 OMAP4_SCRM_AUXCLK2, OMAP4_ENABLE_SHIFT, NULL,
1584 auxclk_src_ck_parents, auxclk_src_ck_ops);
1585
1586DEFINE_CLK_DIVIDER(auxclk2_ck, "auxclk2_src_ck", &auxclk2_src_ck, 0x0,
1587 OMAP4_SCRM_AUXCLK2, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1588 0x0, NULL);
1589
1590DEFINE_CLK_OMAP_MUX_GATE(auxclk3_src_ck, NULL, auxclk_src_sel,
1591 OMAP4_SCRM_AUXCLK3, OMAP4_SRCSELECT_MASK,
1592 OMAP4_SCRM_AUXCLK3, OMAP4_ENABLE_SHIFT, NULL,
1593 auxclk_src_ck_parents, auxclk_src_ck_ops);
1594
1595DEFINE_CLK_DIVIDER(auxclk3_ck, "auxclk3_src_ck", &auxclk3_src_ck, 0x0,
1596 OMAP4_SCRM_AUXCLK3, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1597 0x0, NULL);
1598
1599DEFINE_CLK_OMAP_MUX_GATE(auxclk4_src_ck, NULL, auxclk_src_sel,
1600 OMAP4_SCRM_AUXCLK4, OMAP4_SRCSELECT_MASK,
1601 OMAP4_SCRM_AUXCLK4, OMAP4_ENABLE_SHIFT, NULL,
1602 auxclk_src_ck_parents, auxclk_src_ck_ops);
1603
1604DEFINE_CLK_DIVIDER(auxclk4_ck, "auxclk4_src_ck", &auxclk4_src_ck, 0x0,
1605 OMAP4_SCRM_AUXCLK4, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1606 0x0, NULL);
1607
1608DEFINE_CLK_OMAP_MUX_GATE(auxclk5_src_ck, NULL, auxclk_src_sel,
1609 OMAP4_SCRM_AUXCLK5, OMAP4_SRCSELECT_MASK,
1610 OMAP4_SCRM_AUXCLK5, OMAP4_ENABLE_SHIFT, NULL,
1611 auxclk_src_ck_parents, auxclk_src_ck_ops);
1612
1613DEFINE_CLK_DIVIDER(auxclk5_ck, "auxclk5_src_ck", &auxclk5_src_ck, 0x0,
1614 OMAP4_SCRM_AUXCLK5, OMAP4_CLKDIV_SHIFT, OMAP4_CLKDIV_WIDTH,
1615 0x0, NULL);
1616
1617static const char *auxclkreq_ck_parents[] = {
1618 "auxclk0_ck", "auxclk1_ck", "auxclk2_ck", "auxclk3_ck", "auxclk4_ck",
1619 "auxclk5_ck",
1620};
1621
1622DEFINE_CLK_MUX(auxclkreq0_ck, auxclkreq_ck_parents, NULL, 0x0,
1623 OMAP4_SCRM_AUXCLKREQ0, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1624 0x0, NULL);
1625
1626DEFINE_CLK_MUX(auxclkreq1_ck, auxclkreq_ck_parents, NULL, 0x0,
1627 OMAP4_SCRM_AUXCLKREQ1, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1628 0x0, NULL);
1629
1630DEFINE_CLK_MUX(auxclkreq2_ck, auxclkreq_ck_parents, NULL, 0x0,
1631 OMAP4_SCRM_AUXCLKREQ2, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1632 0x0, NULL);
1633
1634DEFINE_CLK_MUX(auxclkreq3_ck, auxclkreq_ck_parents, NULL, 0x0,
1635 OMAP4_SCRM_AUXCLKREQ3, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1636 0x0, NULL);
1637
1638DEFINE_CLK_MUX(auxclkreq4_ck, auxclkreq_ck_parents, NULL, 0x0,
1639 OMAP4_SCRM_AUXCLKREQ4, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1640 0x0, NULL);
1641
1642DEFINE_CLK_MUX(auxclkreq5_ck, auxclkreq_ck_parents, NULL, 0x0,
1643 OMAP4_SCRM_AUXCLKREQ5, OMAP4_MAPPING_SHIFT, OMAP4_MAPPING_WIDTH,
1644 0x0, NULL);
1645
1646/*
1647 * clkdev
1648 */
1649
1650static struct omap_clk omap44xx_clks[] = {
1651 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X),
1652 CLK(NULL, "pad_clks_src_ck", &pad_clks_src_ck, CK_443X),
1653 CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X),
1654 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X),
1655 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X),
1656 CLK(NULL, "slimbus_src_clk", &slimbus_src_clk, CK_443X),
1657 CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X),
1658 CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X),
1659 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X),
1660 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X),
1661 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X),
1662 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X),
1663 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X),
1664 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X),
1665 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X),
1666 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X),
1667 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck, CK_443X),
1668 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X),
1669 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X),
1670 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X),
1671 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X),
1672 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck, CK_443X),
1673 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X),
1674 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X),
1675 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck, CK_443X),
1676 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X),
1677 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X),
1678 CLK(NULL, "abe_clk", &abe_clk, CK_443X),
1679 CLK(NULL, "aess_fclk", &aess_fclk, CK_443X),
1680 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck, CK_443X),
1681 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X),
1682 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X),
1683 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_443X),
1684 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck, CK_443X),
1685 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X),
1686 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X),
1687 CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X),
1688 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, CK_443X),
1689 CLK(NULL, "div_core_ck", &div_core_ck, CK_443X),
1690 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X),
1691 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X),
1692 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck, CK_443X),
1693 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X),
1694 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X),
1695 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck, CK_443X),
1696 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck, CK_443X),
1697 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X),
1698 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X),
1699 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck, CK_443X),
1700 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, CK_443X),
1701 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, CK_443X),
1702 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X),
1703 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X),
1704 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X),
1705 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X),
1706 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X),
1707 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X),
1708 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck, CK_443X),
1709 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X),
1710 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck, CK_443X),
1711 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, CK_443X),
1712 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, CK_443X),
1713 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck, CK_443X),
1714 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck, CK_443X),
1715 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X),
1716 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X),
1717 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X),
1718 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X),
1719 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X),
1720 CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X),
1721 CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X),
1722 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X),
1723 CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X),
1724 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X),
1725 CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X),
1726 CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X),
1727 CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X),
1728 CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X),
1729 CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
1730 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
1731 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
1732 CLK("smp_twd", NULL, &mpu_periphclk, CK_443X),
1733 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
1734 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
1735 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
1736 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X),
1737 CLK(NULL, "aes1_fck", &aes1_fck, CK_443X),
1738 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X),
1739 CLK(NULL, "aess_fck", &aess_fck, CK_443X),
1740 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X),
1741 CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X),
1742 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X),
1743 CLK(NULL, "des3des_fck", &des3des_fck, CK_443X),
1744 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
1745 CLK(NULL, "dmic_fck", &dmic_fck, CK_443X),
1746 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
1747 CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X),
1748 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
1749 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
1750 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
1751 CLK(NULL, "dss_fck", &dss_fck, CK_443X),
1752 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
1753 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
1754 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
1755 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
1756 CLK(NULL, "fdif_fck", &fdif_fck, CK_443X),
1757 CLK(NULL, "fpka_fck", &fpka_fck, CK_443X),
1758 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_443X),
1759 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_443X),
1760 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_443X),
1761 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_443X),
1762 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_443X),
1763 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_443X),
1764 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk, CK_443X),
1765 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_443X),
1766 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk, CK_443X),
1767 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_443X),
1768 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk, CK_443X),
1769 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X),
1770 CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X),
1771 CLK(NULL, "gpu_fck", &gpu_fck, CK_443X),
1772 CLK(NULL, "hdq1w_fck", &hdq1w_fck, CK_443X),
1773 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X),
1774 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_443X),
1775 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_443X),
1776 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_443X),
1777 CLK(NULL, "i2c4_fck", &i2c4_fck, CK_443X),
1778 CLK(NULL, "ipu_fck", &ipu_fck, CK_443X),
1779 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X),
1780 CLK(NULL, "iss_fck", &iss_fck, CK_443X),
1781 CLK(NULL, "iva_fck", &iva_fck, CK_443X),
1782 CLK(NULL, "kbd_fck", &kbd_fck, CK_443X),
1783 CLK(NULL, "l3_instr_ick", &l3_instr_ick, CK_443X),
1784 CLK(NULL, "l3_main_3_ick", &l3_main_3_ick, CK_443X),
1785 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
1786 CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X),
1787 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
1788 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_443X),
1789 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
1790 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_443X),
1791 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
1792 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_443X),
1793 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
1794 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_443X),
1795 CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X),
1796 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_443X),
1797 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_443X),
1798 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_443X),
1799 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_443X),
1800 CLK(NULL, "mmc1_fck", &mmc1_fck, CK_443X),
1801 CLK(NULL, "mmc2_fck", &mmc2_fck, CK_443X),
1802 CLK(NULL, "mmc3_fck", &mmc3_fck, CK_443X),
1803 CLK(NULL, "mmc4_fck", &mmc4_fck, CK_443X),
1804 CLK(NULL, "mmc5_fck", &mmc5_fck, CK_443X),
1805 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
1806 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
1807 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
1808 CLK(NULL, "rng_ick", &rng_ick, CK_443X),
1809 CLK("omap_rng", "ick", &rng_ick, CK_443X),
1810 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
1811 CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X),
1812 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X),
1813 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X),
1814 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2, CK_443X),
1815 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk, CK_443X),
1816 CLK(NULL, "slimbus1_fck", &slimbus1_fck, CK_443X),
1817 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1, CK_443X),
1818 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X),
1819 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X),
1820 CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X),
1821 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X),
1822 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X),
1823 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X),
1824 CLK(NULL, "timer1_fck", &timer1_fck, CK_443X),
1825 CLK(NULL, "timer10_fck", &timer10_fck, CK_443X),
1826 CLK(NULL, "timer11_fck", &timer11_fck, CK_443X),
1827 CLK(NULL, "timer2_fck", &timer2_fck, CK_443X),
1828 CLK(NULL, "timer3_fck", &timer3_fck, CK_443X),
1829 CLK(NULL, "timer4_fck", &timer4_fck, CK_443X),
1830 CLK(NULL, "timer5_fck", &timer5_fck, CK_443X),
1831 CLK(NULL, "timer6_fck", &timer6_fck, CK_443X),
1832 CLK(NULL, "timer7_fck", &timer7_fck, CK_443X),
1833 CLK(NULL, "timer8_fck", &timer8_fck, CK_443X),
1834 CLK(NULL, "timer9_fck", &timer9_fck, CK_443X),
1835 CLK(NULL, "uart1_fck", &uart1_fck, CK_443X),
1836 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
1837 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
1838 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
1839 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X),
1840 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
1841 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
1842 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
1843 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
1844 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk, CK_443X),
1845 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk, CK_443X),
1846 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk, CK_443X),
1847 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk, CK_443X),
1848 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
1849 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
1850 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
1851 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X),
1852 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
1853 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
1854 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
1855 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X),
1856 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
1857 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
1858 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
1859 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
1860 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
1861 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X),
1862 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
1863 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
1864 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
1865 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
1866 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
1867 CLK(NULL, "wd_timer2_fck", &wd_timer2_fck, CK_443X),
1868 CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X),
1869 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X),
1870 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X),
1871 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
1872 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
1873 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X),
1874 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X),
1875 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X),
1876 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X),
1877 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
1878 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X),
1879 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X),
1880 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
1881 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X),
1882 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X),
1883 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
1884 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X),
1885 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X),
1886 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
1887 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X),
1888 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
1889 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
1890 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
1891 CLK("omap-gpmc", "fck", &dummy_ck, CK_443X),
1892 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
1893 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
1894 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
1895 CLK("omap_i2c.4", "ick", &dummy_ck, CK_443X),
1896 CLK(NULL, "mailboxes_ick", &dummy_ck, CK_443X),
1897 CLK("omap_hsmmc.0", "ick", &dummy_ck, CK_443X),
1898 CLK("omap_hsmmc.1", "ick", &dummy_ck, CK_443X),
1899 CLK("omap_hsmmc.2", "ick", &dummy_ck, CK_443X),
1900 CLK("omap_hsmmc.3", "ick", &dummy_ck, CK_443X),
1901 CLK("omap_hsmmc.4", "ick", &dummy_ck, CK_443X),
1902 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_443X),
1903 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X),
1904 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X),
1905 CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X),
1906 CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X),
1907 CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X),
1908 CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X),
1909 CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X),
1910 CLK(NULL, "uart1_ick", &dummy_ck, CK_443X),
1911 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X),
1912 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X),
1913 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
1914 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
1915 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
1916 CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
1917 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
1918 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
1919 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
1920 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1921 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1922 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1923 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1924 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1925 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1926 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1927 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1928 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1929 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1930 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1931 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1932 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1933 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1934 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1935 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1936 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1937 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
1938 CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1939 CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1940 CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1941 CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
1942 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X),
1943};
1944
1945static const char *enable_init_clks[] = {
1946 "emif1_fck",
1947 "emif2_fck",
1948 "gpmc_ick",
1949 "l3_instr_ick",
1950 "l3_main_3_ick",
1951 "ocp_wp_noc_ick",
1952};
1953
1954int __init omap4xxx_clk_init(void)
1955{
1956 u32 cpu_clkflg;
1957 struct omap_clk *c;
1958
1959 if (cpu_is_omap443x()) {
1960 cpu_mask = RATE_IN_4430;
1961 cpu_clkflg = CK_443X;
1962 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
1963 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
1964 cpu_clkflg = CK_446X | CK_443X;
1965
1966 if (cpu_is_omap447x())
1967 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
1968 } else {
1969 return 0;
1970 }
1971
1972 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
1973 c++) {
1974 if (c->cpu & cpu_clkflg) {
1975 clkdev_add(&c->lk);
1976 if (!__clk_init(NULL, c->lk.clk))
1977 omap2_init_clk_hw_omap_clocks(c->lk.clk);
1978 }
1979 }
1980
1981 omap2_clk_disable_autoidle_all();
1982
1983 omap2_clk_enable_init_clocks(enable_init_clks,
1984 ARRAY_SIZE(enable_init_clks));
1985
1986 return 0;
1987}
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c
index 73a1414b89b0..25b1feed480d 100644
--- a/arch/arm/mach-omap2/clkt2xxx_apll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_apll.c
@@ -21,11 +21,10 @@
21#include <linux/clk.h> 21#include <linux/clk.h>
22#include <linux/io.h> 22#include <linux/io.h>
23 23
24#include <plat/prcm.h>
25 24
26#include "clock.h" 25#include "clock.h"
27#include "clock2xxx.h" 26#include "clock2xxx.h"
28#include "cm2xxx_3xxx.h" 27#include "cm2xxx.h"
29#include "cm-regbits-24xx.h" 28#include "cm-regbits-24xx.h"
30 29
31/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ 30/* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */
@@ -37,92 +36,90 @@
37#define APLLS_CLKIN_13MHZ 2 36#define APLLS_CLKIN_13MHZ 2
38#define APLLS_CLKIN_12MHZ 3 37#define APLLS_CLKIN_12MHZ 3
39 38
40void __iomem *cm_idlest_pll;
41
42/* Private functions */ 39/* Private functions */
43 40
44/* Enable an APLL if off */ 41/**
45static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask) 42 * omap2xxx_clk_apll_locked - is the APLL locked?
43 * @hw: struct clk_hw * of the APLL to check
44 *
45 * If the APLL IP block referred to by @hw indicates that it's locked,
46 * return true; otherwise, return false.
47 */
48static bool omap2xxx_clk_apll_locked(struct clk_hw *hw)
46{ 49{
47 u32 cval, apll_mask; 50 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
51 u32 r, apll_mask;
48 52
49 apll_mask = EN_APLL_LOCKED << clk->enable_bit; 53 apll_mask = EN_APLL_LOCKED << clk->enable_bit;
50 54
51 cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 55 r = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
52
53 if ((cval & apll_mask) == apll_mask)
54 return 0; /* apll already enabled */
55
56 cval &= ~apll_mask;
57 cval |= apll_mask;
58 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN);
59
60 omap2_cm_wait_idlest(cm_idlest_pll, status_mask,
61 OMAP24XX_CM_IDLEST_VAL, __clk_get_name(clk));
62 56
63 /* 57 return ((r & apll_mask) == apll_mask) ? true : false;
64 * REVISIT: Should we return an error code if omap2_wait_clock_ready()
65 * fails?
66 */
67 return 0;
68} 58}
69 59
70static int omap2_clk_apll96_enable(struct clk *clk) 60int omap2_clk_apll96_enable(struct clk_hw *hw)
71{ 61{
72 return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL_MASK); 62 return omap2xxx_cm_apll96_enable();
73} 63}
74 64
75static int omap2_clk_apll54_enable(struct clk *clk) 65int omap2_clk_apll54_enable(struct clk_hw *hw)
76{ 66{
77 return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL_MASK); 67 return omap2xxx_cm_apll54_enable();
78} 68}
79 69
80static void _apll96_allow_idle(struct clk *clk) 70static void _apll96_allow_idle(struct clk_hw_omap *clk)
81{ 71{
82 omap2xxx_cm_set_apll96_auto_low_power_stop(); 72 omap2xxx_cm_set_apll96_auto_low_power_stop();
83} 73}
84 74
85static void _apll96_deny_idle(struct clk *clk) 75static void _apll96_deny_idle(struct clk_hw_omap *clk)
86{ 76{
87 omap2xxx_cm_set_apll96_disable_autoidle(); 77 omap2xxx_cm_set_apll96_disable_autoidle();
88} 78}
89 79
90static void _apll54_allow_idle(struct clk *clk) 80static void _apll54_allow_idle(struct clk_hw_omap *clk)
91{ 81{
92 omap2xxx_cm_set_apll54_auto_low_power_stop(); 82 omap2xxx_cm_set_apll54_auto_low_power_stop();
93} 83}
94 84
95static void _apll54_deny_idle(struct clk *clk) 85static void _apll54_deny_idle(struct clk_hw_omap *clk)
96{ 86{
97 omap2xxx_cm_set_apll54_disable_autoidle(); 87 omap2xxx_cm_set_apll54_disable_autoidle();
98} 88}
99 89
100/* Stop APLL */ 90void omap2_clk_apll96_disable(struct clk_hw *hw)
101static void omap2_clk_apll_disable(struct clk *clk)
102{ 91{
103 u32 cval; 92 omap2xxx_cm_apll96_disable();
93}
104 94
105 cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 95void omap2_clk_apll54_disable(struct clk_hw *hw)
106 cval &= ~(EN_APLL_LOCKED << clk->enable_bit); 96{
107 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); 97 omap2xxx_cm_apll54_disable();
108} 98}
109 99
110/* Public data */ 100unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw,
101 unsigned long parent_rate)
102{
103 return (omap2xxx_clk_apll_locked(hw)) ? 54000000 : 0;
104}
111 105
112const struct clkops clkops_apll96 = { 106unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw,
113 .enable = omap2_clk_apll96_enable, 107 unsigned long parent_rate)
114 .disable = omap2_clk_apll_disable, 108{
115 .allow_idle = _apll96_allow_idle, 109 return (omap2xxx_clk_apll_locked(hw)) ? 96000000 : 0;
116 .deny_idle = _apll96_deny_idle, 110}
117};
118 111
119const struct clkops clkops_apll54 = { 112/* Public data */
120 .enable = omap2_clk_apll54_enable, 113const struct clk_hw_omap_ops clkhwops_apll54 = {
121 .disable = omap2_clk_apll_disable,
122 .allow_idle = _apll54_allow_idle, 114 .allow_idle = _apll54_allow_idle,
123 .deny_idle = _apll54_deny_idle, 115 .deny_idle = _apll54_deny_idle,
124}; 116};
125 117
118const struct clk_hw_omap_ops clkhwops_apll96 = {
119 .allow_idle = _apll96_allow_idle,
120 .deny_idle = _apll96_deny_idle,
121};
122
126/* Public functions */ 123/* Public functions */
127 124
128u32 omap2xxx_get_apll_clkin(void) 125u32 omap2xxx_get_apll_clkin(void)
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpll.c b/arch/arm/mach-omap2/clkt2xxx_dpll.c
index 0890ba94a282..82572e277b97 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpll.c
@@ -15,7 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17#include "clock.h" 17#include "clock.h"
18#include "cm2xxx_3xxx.h" 18#include "cm2xxx.h"
19#include "cm-regbits-24xx.h" 19#include "cm-regbits-24xx.h"
20 20
21/* Private functions */ 21/* Private functions */
@@ -29,7 +29,7 @@
29 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1 29 * REVISIT: DPLL can optionally enter low-power bypass by writing 0x1
30 * instead. Add some mechanism to optionally enter this mode. 30 * instead. Add some mechanism to optionally enter this mode.
31 */ 31 */
32static void _allow_idle(struct clk *clk) 32static void _allow_idle(struct clk_hw_omap *clk)
33{ 33{
34 if (!clk || !clk->dpll_data) 34 if (!clk || !clk->dpll_data)
35 return; 35 return;
@@ -43,7 +43,7 @@ static void _allow_idle(struct clk *clk)
43 * 43 *
44 * Disable DPLL automatic idle control. No return value. 44 * Disable DPLL automatic idle control. No return value.
45 */ 45 */
46static void _deny_idle(struct clk *clk) 46static void _deny_idle(struct clk_hw_omap *clk)
47{ 47{
48 if (!clk || !clk->dpll_data) 48 if (!clk || !clk->dpll_data)
49 return; 49 return;
@@ -53,9 +53,7 @@ static void _deny_idle(struct clk *clk)
53 53
54 54
55/* Public data */ 55/* Public data */
56 56const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll = {
57const struct clkops clkops_omap2xxx_dpll_ops = {
58 .allow_idle = _allow_idle, 57 .allow_idle = _allow_idle,
59 .deny_idle = _deny_idle, 58 .deny_idle = _deny_idle,
60}; 59};
61
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 0d2f14c2dcce..d8620105c42a 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -28,16 +28,22 @@
28#include "clock.h" 28#include "clock.h"
29#include "clock2xxx.h" 29#include "clock2xxx.h"
30#include "opp2xxx.h" 30#include "opp2xxx.h"
31#include "cm2xxx_3xxx.h" 31#include "cm2xxx.h"
32#include "cm-regbits-24xx.h" 32#include "cm-regbits-24xx.h"
33#include "sdrc.h" 33#include "sdrc.h"
34#include "sram.h" 34#include "sram.h"
35 35
36/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ 36/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
37 37
38/*
39 * dpll_core_ck: pointer to the combined dpll_ck + core_ck on OMAP2xxx
40 * (currently defined as "dpll_ck" in the OMAP2xxx clock tree). Set
41 * during dpll_ck init and used later by omap2xxx_clk_get_core_rate().
42 */
43static struct clk_hw_omap *dpll_core_ck;
44
38/** 45/**
39 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate 46 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
40 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
41 * 47 *
42 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate 48 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate
43 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz 49 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
@@ -45,12 +51,14 @@
45 * struct clk *dpll_ck, which is a composite clock of dpll_ck and 51 * struct clk *dpll_ck, which is a composite clock of dpll_ck and
46 * core_ck. 52 * core_ck.
47 */ 53 */
48unsigned long omap2xxx_clk_get_core_rate(struct clk *clk) 54unsigned long omap2xxx_clk_get_core_rate(void)
49{ 55{
50 long long core_clk; 56 long long core_clk;
51 u32 v; 57 u32 v;
52 58
53 core_clk = omap2_get_dpll_rate(clk); 59 WARN_ON(!dpll_core_ck);
60
61 core_clk = omap2_get_dpll_rate(dpll_core_ck);
54 62
55 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 63 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
56 v &= OMAP24XX_CORE_CLK_SRC_MASK; 64 v &= OMAP24XX_CORE_CLK_SRC_MASK;
@@ -96,19 +104,22 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
96 104
97} 105}
98 106
99unsigned long omap2_dpllcore_recalc(struct clk *clk) 107unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
108 unsigned long parent_rate)
100{ 109{
101 return omap2xxx_clk_get_core_rate(clk); 110 return omap2xxx_clk_get_core_rate();
102} 111}
103 112
104int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) 113int omap2_reprogram_dpllcore(struct clk_hw *hw, unsigned long rate,
114 unsigned long parent_rate)
105{ 115{
116 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
106 u32 cur_rate, low, mult, div, valid_rate, done_rate; 117 u32 cur_rate, low, mult, div, valid_rate, done_rate;
107 u32 bypass = 0; 118 u32 bypass = 0;
108 struct prcm_config tmpset; 119 struct prcm_config tmpset;
109 const struct dpll_data *dd; 120 const struct dpll_data *dd;
110 121
111 cur_rate = omap2xxx_clk_get_core_rate(dclk); 122 cur_rate = omap2xxx_clk_get_core_rate();
112 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 123 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
113 mult &= OMAP24XX_CORE_CLK_SRC_MASK; 124 mult &= OMAP24XX_CORE_CLK_SRC_MASK;
114 125
@@ -169,3 +180,19 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
169 return 0; 180 return 0;
170} 181}
171 182
183/**
184 * omap2xxx_clkt_dpllcore_init - clk init function for dpll_ck
185 * @clk: struct clk *dpll_ck
186 *
187 * Store a local copy of @clk in dpll_core_ck so other code can query
188 * the core rate without having to clk_get(), which can sleep. Must
189 * only be called once. No return value. XXX If the clock
190 * registration process is ever changed such that dpll_ck is no longer
191 * statically defined, this code may need to change to increment some
192 * kind of use count on dpll_ck.
193 */
194void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw)
195{
196 WARN(dpll_core_ck, "dpll_core_ck already set - should never happen");
197 dpll_core_ck = to_clk_hw_omap(hw);
198}
diff --git a/arch/arm/mach-omap2/clkt2xxx_osc.c b/arch/arm/mach-omap2/clkt2xxx_osc.c
index e1777371bb5e..19f54d433490 100644
--- a/arch/arm/mach-omap2/clkt2xxx_osc.c
+++ b/arch/arm/mach-omap2/clkt2xxx_osc.c
@@ -35,7 +35,7 @@
35 * clk_enable/clk_disable()-based usecounting for osc_ck should be 35 * clk_enable/clk_disable()-based usecounting for osc_ck should be
36 * replaced with autoidle-based usecounting. 36 * replaced with autoidle-based usecounting.
37 */ 37 */
38static int omap2_enable_osc_ck(struct clk *clk) 38int omap2_enable_osc_ck(struct clk_hw *clk)
39{ 39{
40 u32 pcc; 40 u32 pcc;
41 41
@@ -53,7 +53,7 @@ static int omap2_enable_osc_ck(struct clk *clk)
53 * clk_enable/clk_disable()-based usecounting for osc_ck should be 53 * clk_enable/clk_disable()-based usecounting for osc_ck should be
54 * replaced with autoidle-based usecounting. 54 * replaced with autoidle-based usecounting.
55 */ 55 */
56static void omap2_disable_osc_ck(struct clk *clk) 56void omap2_disable_osc_ck(struct clk_hw *clk)
57{ 57{
58 u32 pcc; 58 u32 pcc;
59 59
@@ -62,13 +62,8 @@ static void omap2_disable_osc_ck(struct clk *clk)
62 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl); 62 __raw_writel(pcc | OMAP_AUTOEXTCLKMODE_MASK, prcm_clksrc_ctrl);
63} 63}
64 64
65const struct clkops clkops_oscck = { 65unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
66 .enable = omap2_enable_osc_ck, 66 unsigned long parent_rate)
67 .disable = omap2_disable_osc_ck,
68};
69
70unsigned long omap2_osc_clk_recalc(struct clk *clk)
71{ 67{
72 return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv(); 68 return omap2xxx_get_apll_clkin() * omap2xxx_get_sysclkdiv();
73} 69}
74
diff --git a/arch/arm/mach-omap2/clkt2xxx_sys.c b/arch/arm/mach-omap2/clkt2xxx_sys.c
index 46683b3c2461..f467d072cd02 100644
--- a/arch/arm/mach-omap2/clkt2xxx_sys.c
+++ b/arch/arm/mach-omap2/clkt2xxx_sys.c
@@ -40,9 +40,8 @@ u32 omap2xxx_get_sysclkdiv(void)
40 return div; 40 return div;
41} 41}
42 42
43unsigned long omap2xxx_sys_clk_recalc(struct clk *clk) 43unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
44 unsigned long parent_rate)
44{ 45{
45 return clk->parent->rate / omap2xxx_get_sysclkdiv(); 46 return parent_rate / omap2xxx_get_sysclkdiv();
46} 47}
47
48
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index a38ebb209721..ae2b35e76dc8 100644
--- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
+++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2xxx DVFS virtual clock functions 2 * OMAP2xxx DVFS virtual clock functions
3 * 3 *
4 * Copyright (C) 2005-2008 Texas Instruments, Inc. 4 * Copyright (C) 2005-2008, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2010 Nokia Corporation 5 * Copyright (C) 2004-2010 Nokia Corporation
6 * 6 *
7 * Contacts: 7 * Contacts:
@@ -37,7 +37,7 @@
37#include "clock.h" 37#include "clock.h"
38#include "clock2xxx.h" 38#include "clock2xxx.h"
39#include "opp2xxx.h" 39#include "opp2xxx.h"
40#include "cm2xxx_3xxx.h" 40#include "cm2xxx.h"
41#include "cm-regbits-24xx.h" 41#include "cm-regbits-24xx.h"
42#include "sdrc.h" 42#include "sdrc.h"
43#include "sram.h" 43#include "sram.h"
@@ -45,13 +45,21 @@
45const struct prcm_config *curr_prcm_set; 45const struct prcm_config *curr_prcm_set;
46const struct prcm_config *rate_table; 46const struct prcm_config *rate_table;
47 47
48/*
49 * sys_ck_rate: the rate of the external high-frequency clock
50 * oscillator on the board. Set by the SoC-specific clock init code.
51 * Once set during a boot, will not change.
52 */
53static unsigned long sys_ck_rate;
54
48/** 55/**
49 * omap2_table_mpu_recalc - just return the MPU speed 56 * omap2_table_mpu_recalc - just return the MPU speed
50 * @clk: virt_prcm_set struct clk 57 * @clk: virt_prcm_set struct clk
51 * 58 *
52 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set. 59 * Set virt_prcm_set's rate to the mpu_speed field of the current PRCM set.
53 */ 60 */
54unsigned long omap2_table_mpu_recalc(struct clk *clk) 61unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
62 unsigned long parent_rate)
55{ 63{
56 return curr_prcm_set->mpu_speed; 64 return curr_prcm_set->mpu_speed;
57} 65}
@@ -63,18 +71,18 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk)
63 * Some might argue L3-DDR, others ARM, others IVA. This code is simple and 71 * Some might argue L3-DDR, others ARM, others IVA. This code is simple and
64 * just uses the ARM rates. 72 * just uses the ARM rates.
65 */ 73 */
66long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) 74long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
75 unsigned long *parent_rate)
67{ 76{
68 const struct prcm_config *ptr; 77 const struct prcm_config *ptr;
69 long highest_rate, sys_clk_rate; 78 long highest_rate;
70 79
71 highest_rate = -EINVAL; 80 highest_rate = -EINVAL;
72 sys_clk_rate = __clk_get_rate(sclk);
73 81
74 for (ptr = rate_table; ptr->mpu_speed; ptr++) { 82 for (ptr = rate_table; ptr->mpu_speed; ptr++) {
75 if (!(ptr->flags & cpu_mask)) 83 if (!(ptr->flags & cpu_mask))
76 continue; 84 continue;
77 if (ptr->xtal_speed != sys_clk_rate) 85 if (ptr->xtal_speed != sys_ck_rate)
78 continue; 86 continue;
79 87
80 highest_rate = ptr->mpu_speed; 88 highest_rate = ptr->mpu_speed;
@@ -87,21 +95,19 @@ long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
87} 95}
88 96
89/* Sets basic clocks based on the specified rate */ 97/* Sets basic clocks based on the specified rate */
90int omap2_select_table_rate(struct clk *clk, unsigned long rate) 98int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
99 unsigned long parent_rate)
91{ 100{
92 u32 cur_rate, done_rate, bypass = 0, tmp; 101 u32 cur_rate, done_rate, bypass = 0, tmp;
93 const struct prcm_config *prcm; 102 const struct prcm_config *prcm;
94 unsigned long found_speed = 0; 103 unsigned long found_speed = 0;
95 unsigned long flags; 104 unsigned long flags;
96 long sys_clk_rate;
97
98 sys_clk_rate = __clk_get_rate(sclk);
99 105
100 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 106 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
101 if (!(prcm->flags & cpu_mask)) 107 if (!(prcm->flags & cpu_mask))
102 continue; 108 continue;
103 109
104 if (prcm->xtal_speed != sys_clk_rate) 110 if (prcm->xtal_speed != sys_ck_rate)
105 continue; 111 continue;
106 112
107 if (prcm->mpu_speed <= rate) { 113 if (prcm->mpu_speed <= rate) {
@@ -117,7 +123,7 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
117 } 123 }
118 124
119 curr_prcm_set = prcm; 125 curr_prcm_set = prcm;
120 cur_rate = omap2xxx_clk_get_core_rate(dclk); 126 cur_rate = omap2xxx_clk_get_core_rate();
121 127
122 if (prcm->dpll_speed == cur_rate / 2) { 128 if (prcm->dpll_speed == cur_rate / 2) {
123 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1); 129 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
@@ -167,3 +173,50 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
167 173
168 return 0; 174 return 0;
169} 175}
176
177/**
178 * omap2xxx_clkt_vps_check_bootloader_rate - determine which of the rate
179 * table sets matches the current CORE DPLL hardware rate
180 *
181 * Check the MPU rate set by bootloader. Sets the 'curr_prcm_set'
182 * global to point to the active rate set when found; otherwise, sets
183 * it to NULL. No return value;
184 */
185void omap2xxx_clkt_vps_check_bootloader_rates(void)
186{
187 const struct prcm_config *prcm = NULL;
188 unsigned long rate;
189
190 rate = omap2xxx_clk_get_core_rate();
191 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
192 if (!(prcm->flags & cpu_mask))
193 continue;
194 if (prcm->xtal_speed != sys_ck_rate)
195 continue;
196 if (prcm->dpll_speed <= rate)
197 break;
198 }
199 curr_prcm_set = prcm;
200}
201
202/**
203 * omap2xxx_clkt_vps_late_init - store a copy of the sys_ck rate
204 *
205 * Store a copy of the sys_ck rate for later use by the OMAP2xxx DVFS
206 * code. (The sys_ck rate does not -- or rather, must not -- change
207 * during kernel runtime.) Must be called after we have a valid
208 * sys_ck rate, but before the virt_prcm_set clock rate is
209 * recalculated. No return value.
210 */
211void omap2xxx_clkt_vps_late_init(void)
212{
213 struct clk *c;
214
215 c = clk_get(NULL, "sys_ck");
216 if (IS_ERR(c)) {
217 WARN(1, "could not locate sys_ck\n");
218 } else {
219 sys_ck_rate = clk_get_rate(c);
220 clk_put(c);
221 }
222}
diff --git a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
index 6cf298e262f6..eb69acf21014 100644
--- a/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
+++ b/arch/arm/mach-omap2/clkt34xx_dpll3m2.c
@@ -44,8 +44,10 @@
44 * Program the DPLL M2 divider with the rounded target rate. Returns 44 * Program the DPLL M2 divider with the rounded target rate. Returns
45 * -EINVAL upon error, or 0 upon success. 45 * -EINVAL upon error, or 0 upon success.
46 */ 46 */
47int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate) 47int omap3_core_dpll_m2_set_rate(struct clk_hw *hw, unsigned long rate,
48 unsigned long parent_rate)
48{ 49{
50 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
49 u32 new_div = 0; 51 u32 new_div = 0;
50 u32 unlock_dll = 0; 52 u32 unlock_dll = 0;
51 u32 c; 53 u32 c;
@@ -63,7 +65,7 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
63 return -EINVAL; 65 return -EINVAL;
64 66
65 sdrcrate = __clk_get_rate(sdrc_ick_p); 67 sdrcrate = __clk_get_rate(sdrc_ick_p);
66 clkrate = __clk_get_rate(clk); 68 clkrate = __clk_get_rate(hw->clk);
67 if (rate > clkrate) 69 if (rate > clkrate)
68 sdrcrate <<= ((rate / clkrate) >> 1); 70 sdrcrate <<= ((rate / clkrate) >> 1);
69 else 71 else
@@ -112,8 +114,6 @@ int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate)
112 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla, 114 sdrc_cs0->rfr_ctrl, sdrc_cs0->actim_ctrla,
113 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr, 115 sdrc_cs0->actim_ctrlb, sdrc_cs0->mr,
114 0, 0, 0, 0); 116 0, 0, 0, 0);
115 clk->rate = rate;
116
117 return 0; 117 return 0;
118} 118}
119 119
diff --git a/arch/arm/mach-omap2/clkt_clksel.c b/arch/arm/mach-omap2/clkt_clksel.c
index 53646facda45..0ec9f6fdf046 100644
--- a/arch/arm/mach-omap2/clkt_clksel.c
+++ b/arch/arm/mach-omap2/clkt_clksel.c
@@ -41,7 +41,7 @@
41 41
42#include <linux/kernel.h> 42#include <linux/kernel.h>
43#include <linux/errno.h> 43#include <linux/errno.h>
44#include <linux/clk.h> 44#include <linux/clk-provider.h>
45#include <linux/io.h> 45#include <linux/io.h>
46#include <linux/bug.h> 46#include <linux/bug.h>
47 47
@@ -58,11 +58,14 @@
58 * the element associated with the supplied parent clock address. 58 * the element associated with the supplied parent clock address.
59 * Returns a pointer to the struct clksel on success or NULL on error. 59 * Returns a pointer to the struct clksel on success or NULL on error.
60 */ 60 */
61static const struct clksel *_get_clksel_by_parent(struct clk *clk, 61static const struct clksel *_get_clksel_by_parent(struct clk_hw_omap *clk,
62 struct clk *src_clk) 62 struct clk *src_clk)
63{ 63{
64 const struct clksel *clks; 64 const struct clksel *clks;
65 65
66 if (!src_clk)
67 return NULL;
68
66 for (clks = clk->clksel; clks->parent; clks++) 69 for (clks = clk->clksel; clks->parent; clks++)
67 if (clks->parent == src_clk) 70 if (clks->parent == src_clk)
68 break; /* Found the requested parent */ 71 break; /* Found the requested parent */
@@ -70,7 +73,7 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk,
70 if (!clks->parent) { 73 if (!clks->parent) {
71 /* This indicates a data problem */ 74 /* This indicates a data problem */
72 WARN(1, "clock: %s: could not find parent clock %s in clksel array\n", 75 WARN(1, "clock: %s: could not find parent clock %s in clksel array\n",
73 __clk_get_name(clk), __clk_get_name(src_clk)); 76 __clk_get_name(clk->hw.clk), __clk_get_name(src_clk));
74 return NULL; 77 return NULL;
75 } 78 }
76 79
@@ -78,64 +81,6 @@ static const struct clksel *_get_clksel_by_parent(struct clk *clk,
78} 81}
79 82
80/** 83/**
81 * _get_div_and_fieldval() - find the new clksel divisor and field value to use
82 * @src_clk: planned new parent struct clk *
83 * @clk: struct clk * that is being reparented
84 * @field_val: pointer to a u32 to contain the register data for the divisor
85 *
86 * Given an intended new parent struct clk * @src_clk, and the struct
87 * clk * @clk to the clock that is being reparented, find the
88 * appropriate rate divisor for the new clock (returned as the return
89 * value), and the corresponding register bitfield data to program to
90 * reach that divisor (returned in the u32 pointed to by @field_val).
91 * Returns 0 on error, or returns the newly-selected divisor upon
92 * success (in this latter case, the corresponding register bitfield
93 * value is passed back in the variable pointed to by @field_val)
94 */
95static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
96 u32 *field_val)
97{
98 const struct clksel *clks;
99 const struct clksel_rate *clkr, *max_clkr = NULL;
100 u8 max_div = 0;
101
102 clks = _get_clksel_by_parent(clk, src_clk);
103 if (!clks)
104 return 0;
105
106 /*
107 * Find the highest divisor (e.g., the one resulting in the
108 * lowest rate) to use as the default. This should avoid
109 * clock rates that are too high for the device. XXX A better
110 * solution here would be to try to determine if there is a
111 * divisor matching the original clock rate before the parent
112 * switch, and if it cannot be found, to fall back to the
113 * highest divisor.
114 */
115 for (clkr = clks->rates; clkr->div; clkr++) {
116 if (!(clkr->flags & cpu_mask))
117 continue;
118
119 if (clkr->div > max_div) {
120 max_div = clkr->div;
121 max_clkr = clkr;
122 }
123 }
124
125 if (max_div == 0) {
126 /* This indicates an error in the clksel data */
127 WARN(1, "clock: %s: could not find divisor for parent %s\n",
128 __clk_get_name(clk),
129 __clk_get_name(__clk_get_parent(src_clk)));
130 return 0;
131 }
132
133 *field_val = max_clkr->val;
134
135 return max_div;
136}
137
138/**
139 * _write_clksel_reg() - program a clock's clksel register in hardware 84 * _write_clksel_reg() - program a clock's clksel register in hardware
140 * @clk: struct clk * to program 85 * @clk: struct clk * to program
141 * @v: clksel bitfield value to program (with LSB at bit 0) 86 * @v: clksel bitfield value to program (with LSB at bit 0)
@@ -148,7 +93,7 @@ static u8 _get_div_and_fieldval(struct clk *src_clk, struct clk *clk,
148 * take into account any time the hardware might take to switch the 93 * take into account any time the hardware might take to switch the
149 * clock source. 94 * clock source.
150 */ 95 */
151static void _write_clksel_reg(struct clk *clk, u32 field_val) 96static void _write_clksel_reg(struct clk_hw_omap *clk, u32 field_val)
152{ 97{
153 u32 v; 98 u32 v;
154 99
@@ -171,13 +116,14 @@ static void _write_clksel_reg(struct clk *clk, u32 field_val)
171 * before calling. Returns 0 on error or returns the actual integer divisor 116 * before calling. Returns 0 on error or returns the actual integer divisor
172 * upon success. 117 * upon success.
173 */ 118 */
174static u32 _clksel_to_divisor(struct clk *clk, u32 field_val) 119static u32 _clksel_to_divisor(struct clk_hw_omap *clk, u32 field_val)
175{ 120{
176 const struct clksel *clks; 121 const struct clksel *clks;
177 const struct clksel_rate *clkr; 122 const struct clksel_rate *clkr;
178 struct clk *parent; 123 struct clk *parent;
179 124
180 parent = __clk_get_parent(clk); 125 parent = __clk_get_parent(clk->hw.clk);
126
181 clks = _get_clksel_by_parent(clk, parent); 127 clks = _get_clksel_by_parent(clk, parent);
182 if (!clks) 128 if (!clks)
183 return 0; 129 return 0;
@@ -193,7 +139,8 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
193 if (!clkr->div) { 139 if (!clkr->div) {
194 /* This indicates a data error */ 140 /* This indicates a data error */
195 WARN(1, "clock: %s: could not find fieldval %d for parent %s\n", 141 WARN(1, "clock: %s: could not find fieldval %d for parent %s\n",
196 __clk_get_name(clk), field_val, __clk_get_name(parent)); 142 __clk_get_name(clk->hw.clk), field_val,
143 __clk_get_name(parent));
197 return 0; 144 return 0;
198 } 145 }
199 146
@@ -210,7 +157,7 @@ static u32 _clksel_to_divisor(struct clk *clk, u32 field_val)
210 * register field value _before_ left-shifting (i.e., LSB is at bit 157 * register field value _before_ left-shifting (i.e., LSB is at bit
211 * 0); or returns 0xFFFFFFFF (~0) upon error. 158 * 0); or returns 0xFFFFFFFF (~0) upon error.
212 */ 159 */
213static u32 _divisor_to_clksel(struct clk *clk, u32 div) 160static u32 _divisor_to_clksel(struct clk_hw_omap *clk, u32 div)
214{ 161{
215 const struct clksel *clks; 162 const struct clksel *clks;
216 const struct clksel_rate *clkr; 163 const struct clksel_rate *clkr;
@@ -219,7 +166,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
219 /* should never happen */ 166 /* should never happen */
220 WARN_ON(div == 0); 167 WARN_ON(div == 0);
221 168
222 parent = __clk_get_parent(clk); 169 parent = __clk_get_parent(clk->hw.clk);
223 clks = _get_clksel_by_parent(clk, parent); 170 clks = _get_clksel_by_parent(clk, parent);
224 if (!clks) 171 if (!clks)
225 return ~0; 172 return ~0;
@@ -234,7 +181,8 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
234 181
235 if (!clkr->div) { 182 if (!clkr->div) {
236 pr_err("clock: %s: could not find divisor %d for parent %s\n", 183 pr_err("clock: %s: could not find divisor %d for parent %s\n",
237 __clk_get_name(clk), div, __clk_get_name(parent)); 184 __clk_get_name(clk->hw.clk), div,
185 __clk_get_name(parent));
238 return ~0; 186 return ~0;
239 } 187 }
240 188
@@ -249,7 +197,7 @@ static u32 _divisor_to_clksel(struct clk *clk, u32 div)
249 * into the hardware, convert it into the actual divisor value, and 197 * into the hardware, convert it into the actual divisor value, and
250 * return it; or return 0 on error. 198 * return it; or return 0 on error.
251 */ 199 */
252static u32 _read_divisor(struct clk *clk) 200static u32 _read_divisor(struct clk_hw_omap *clk)
253{ 201{
254 u32 v; 202 u32 v;
255 203
@@ -277,7 +225,8 @@ static u32 _read_divisor(struct clk *clk)
277 * 225 *
278 * Returns the rounded clock rate or returns 0xffffffff on error. 226 * Returns the rounded clock rate or returns 0xffffffff on error.
279 */ 227 */
280u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, 228u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk,
229 unsigned long target_rate,
281 u32 *new_div) 230 u32 *new_div)
282{ 231{
283 unsigned long test_rate; 232 unsigned long test_rate;
@@ -288,9 +237,9 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
288 unsigned long parent_rate; 237 unsigned long parent_rate;
289 const char *clk_name; 238 const char *clk_name;
290 239
291 parent = __clk_get_parent(clk); 240 parent = __clk_get_parent(clk->hw.clk);
241 clk_name = __clk_get_name(clk->hw.clk);
292 parent_rate = __clk_get_rate(parent); 242 parent_rate = __clk_get_rate(parent);
293 clk_name = __clk_get_name(clk);
294 243
295 if (!clk->clksel || !clk->clksel_mask) 244 if (!clk->clksel || !clk->clksel_mask)
296 return ~0; 245 return ~0;
@@ -341,27 +290,35 @@ u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
341 */ 290 */
342 291
343/** 292/**
344 * omap2_init_clksel_parent() - set a clksel clk's parent field from the hdwr 293 * omap2_clksel_find_parent_index() - return the array index of the current
345 * @clk: OMAP clock struct ptr to use 294 * hardware parent of @hw
295 * @hw: struct clk_hw * to find the current hardware parent of
346 * 296 *
347 * Given a pointer @clk to a source-selectable struct clk, read the 297 * Given a struct clk_hw pointer @hw to the 'hw' member of a struct
348 * hardware register and determine what its parent is currently set 298 * clk_hw_omap record representing a source-selectable hardware clock,
349 * to. Update @clk's .parent field with the appropriate clk ptr. No 299 * read the hardware register and determine what its parent is
350 * return value. 300 * currently set to. Intended to be called only by the common clock
301 * framework struct clk_hw_ops.get_parent function pointer. Return
302 * the array index of this parent clock upon success -- there is no
303 * way to return an error, so if we encounter an error, just WARN()
304 * and pretend that we know that we're doing.
351 */ 305 */
352void omap2_init_clksel_parent(struct clk *clk) 306u8 omap2_clksel_find_parent_index(struct clk_hw *hw)
353{ 307{
308 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
354 const struct clksel *clks; 309 const struct clksel *clks;
355 const struct clksel_rate *clkr; 310 const struct clksel_rate *clkr;
356 u32 r, found = 0; 311 u32 r, found = 0;
357 struct clk *parent; 312 struct clk *parent;
358 const char *clk_name; 313 const char *clk_name;
314 int ret = 0, f = 0;
359 315
360 if (!clk->clksel || !clk->clksel_mask) 316 parent = __clk_get_parent(hw->clk);
361 return; 317 clk_name = __clk_get_name(hw->clk);
362 318
363 parent = __clk_get_parent(clk); 319 /* XXX should be able to return an error */
364 clk_name = __clk_get_name(clk); 320 WARN((!clk->clksel || !clk->clksel_mask),
321 "clock: %s: attempt to call on a non-clksel clock", clk_name);
365 322
366 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask; 323 r = __raw_readl(clk->clksel_reg) & clk->clksel_mask;
367 r >>= __ffs(clk->clksel_mask); 324 r >>= __ffs(clk->clksel_mask);
@@ -372,27 +329,21 @@ void omap2_init_clksel_parent(struct clk *clk)
372 continue; 329 continue;
373 330
374 if (clkr->val == r) { 331 if (clkr->val == r) {
375 if (parent != clks->parent) {
376 pr_debug("clock: %s: inited parent to %s (was %s)\n",
377 clk_name,
378 __clk_get_name(clks->parent),
379 ((parent) ?
380 __clk_get_name(parent) :
381 "NULL"));
382 clk_reparent(clk, clks->parent);
383 }
384 found = 1; 332 found = 1;
333 ret = f;
385 } 334 }
386 } 335 }
336 f++;
387 } 337 }
388 338
389 /* This indicates a data error */ 339 /* This indicates a data error */
390 WARN(!found, "clock: %s: init parent: could not find regval %0x\n", 340 WARN(!found, "clock: %s: init parent: could not find regval %0x\n",
391 clk_name, r); 341 clk_name, r);
392 342
393 return; 343 return ret;
394} 344}
395 345
346
396/** 347/**
397 * omap2_clksel_recalc() - function ptr to pass via struct clk .recalc field 348 * omap2_clksel_recalc() - function ptr to pass via struct clk .recalc field
398 * @clk: struct clk * 349 * @clk: struct clk *
@@ -402,21 +353,23 @@ void omap2_init_clksel_parent(struct clk *clk)
402 * function. Returns the clock's current rate, based on its parent's rate 353 * function. Returns the clock's current rate, based on its parent's rate
403 * and its current divisor setting in the hardware. 354 * and its current divisor setting in the hardware.
404 */ 355 */
405unsigned long omap2_clksel_recalc(struct clk *clk) 356unsigned long omap2_clksel_recalc(struct clk_hw *hw, unsigned long parent_rate)
406{ 357{
407 unsigned long rate; 358 unsigned long rate;
408 u32 div = 0; 359 u32 div = 0;
409 struct clk *parent; 360 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
410 361
411 div = _read_divisor(clk); 362 if (!parent_rate)
412 if (div == 0) 363 return 0;
413 return __clk_get_rate(clk);
414 364
415 parent = __clk_get_parent(clk); 365 div = _read_divisor(clk);
416 rate = __clk_get_rate(parent) / div; 366 if (!div)
367 rate = parent_rate;
368 else
369 rate = parent_rate / div;
417 370
418 pr_debug("clock: %s: recalc'd rate is %ld (div %d)\n", 371 pr_debug("%s: recalc'd %s's rate to %lu (div %d)\n", __func__,
419 __clk_get_name(clk), rate, div); 372 __clk_get_name(hw->clk), rate, div);
420 373
421 return rate; 374 return rate;
422} 375}
@@ -432,8 +385,10 @@ unsigned long omap2_clksel_recalc(struct clk *clk)
432 * 385 *
433 * Returns the rounded clock rate or returns 0xffffffff on error. 386 * Returns the rounded clock rate or returns 0xffffffff on error.
434 */ 387 */
435long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate) 388long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate,
389 unsigned long *parent_rate)
436{ 390{
391 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
437 u32 new_div; 392 u32 new_div;
438 393
439 return omap2_clksel_round_rate_div(clk, target_rate, &new_div); 394 return omap2_clksel_round_rate_div(clk, target_rate, &new_div);
@@ -454,8 +409,10 @@ long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate)
454 * is changed, they will all be affected without any notification. 409 * is changed, they will all be affected without any notification.
455 * Returns -EINVAL upon error, or 0 upon success. 410 * Returns -EINVAL upon error, or 0 upon success.
456 */ 411 */
457int omap2_clksel_set_rate(struct clk *clk, unsigned long rate) 412int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate,
413 unsigned long parent_rate)
458{ 414{
415 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
459 u32 field_val, validrate, new_div = 0; 416 u32 field_val, validrate, new_div = 0;
460 417
461 if (!clk->clksel || !clk->clksel_mask) 418 if (!clk->clksel || !clk->clksel_mask)
@@ -471,10 +428,8 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
471 428
472 _write_clksel_reg(clk, field_val); 429 _write_clksel_reg(clk, field_val);
473 430
474 clk->rate = __clk_get_rate(__clk_get_parent(clk)) / new_div; 431 pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(hw->clk),
475 432 __clk_get_rate(hw->clk));
476 pr_debug("clock: %s: set rate to %ld\n", __clk_get_name(clk),
477 __clk_get_rate(clk));
478 433
479 return 0; 434 return 0;
480} 435}
@@ -499,32 +454,13 @@ int omap2_clksel_set_rate(struct clk *clk, unsigned long rate)
499 * affected without any notification. Returns -EINVAL upon error, or 454 * affected without any notification. Returns -EINVAL upon error, or
500 * 0 upon success. 455 * 0 upon success.
501 */ 456 */
502int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent) 457int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val)
503{ 458{
504 u32 field_val = 0; 459 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
505 u32 parent_div;
506 460
507 if (!clk->clksel || !clk->clksel_mask) 461 if (!clk->clksel || !clk->clksel_mask)
508 return -EINVAL; 462 return -EINVAL;
509 463
510 parent_div = _get_div_and_fieldval(new_parent, clk, &field_val);
511 if (!parent_div)
512 return -EINVAL;
513
514 _write_clksel_reg(clk, field_val); 464 _write_clksel_reg(clk, field_val);
515
516 clk_reparent(clk, new_parent);
517
518 /* CLKSEL clocks follow their parents' rates, divided by a divisor */
519 clk->rate = __clk_get_rate(new_parent);
520
521 if (parent_div > 0)
522 __clk_get_rate(clk) /= parent_div;
523
524 pr_debug("clock: %s: set parent to %s (new rate %ld)\n",
525 __clk_get_name(clk),
526 __clk_get_name(__clk_get_parent(clk)),
527 __clk_get_rate(clk));
528
529 return 0; 465 return 0;
530} 466}
diff --git a/arch/arm/mach-omap2/clkt_dpll.c b/arch/arm/mach-omap2/clkt_dpll.c
index 8463cc356245..924c230f8948 100644
--- a/arch/arm/mach-omap2/clkt_dpll.c
+++ b/arch/arm/mach-omap2/clkt_dpll.c
@@ -16,7 +16,7 @@
16 16
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/clk.h> 19#include <linux/clk-provider.h>
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include <asm/div64.h> 22#include <asm/div64.h>
@@ -76,7 +76,7 @@
76 * (assuming that it is counting N upwards), or -2 if the enclosing loop 76 * (assuming that it is counting N upwards), or -2 if the enclosing loop
77 * should skip to the next iteration (again assuming N is increasing). 77 * should skip to the next iteration (again assuming N is increasing).
78 */ 78 */
79static int _dpll_test_fint(struct clk *clk, u8 n) 79static int _dpll_test_fint(struct clk_hw_omap *clk, u8 n)
80{ 80{
81 struct dpll_data *dd; 81 struct dpll_data *dd;
82 long fint, fint_min, fint_max; 82 long fint, fint_min, fint_max;
@@ -85,7 +85,7 @@ static int _dpll_test_fint(struct clk *clk, u8 n)
85 dd = clk->dpll_data; 85 dd = clk->dpll_data;
86 86
87 /* DPLL divider must result in a valid jitter correction val */ 87 /* DPLL divider must result in a valid jitter correction val */
88 fint = __clk_get_rate(__clk_get_parent(clk)) / n; 88 fint = __clk_get_rate(__clk_get_parent(clk->hw.clk)) / n;
89 89
90 if (cpu_is_omap24xx()) { 90 if (cpu_is_omap24xx()) {
91 /* Should not be called for OMAP2, so warn if it is called */ 91 /* Should not be called for OMAP2, so warn if it is called */
@@ -186,15 +186,15 @@ static int _dpll_test_mult(int *m, int n, unsigned long *new_rate,
186} 186}
187 187
188/* Public functions */ 188/* Public functions */
189 189u8 omap2_init_dpll_parent(struct clk_hw *hw)
190void omap2_init_dpll_parent(struct clk *clk)
191{ 190{
191 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
192 u32 v; 192 u32 v;
193 struct dpll_data *dd; 193 struct dpll_data *dd;
194 194
195 dd = clk->dpll_data; 195 dd = clk->dpll_data;
196 if (!dd) 196 if (!dd)
197 return; 197 return -EINVAL;
198 198
199 v = __raw_readl(dd->control_reg); 199 v = __raw_readl(dd->control_reg);
200 v &= dd->enable_mask; 200 v &= dd->enable_mask;
@@ -204,18 +204,18 @@ void omap2_init_dpll_parent(struct clk *clk)
204 if (cpu_is_omap24xx()) { 204 if (cpu_is_omap24xx()) {
205 if (v == OMAP2XXX_EN_DPLL_LPBYPASS || 205 if (v == OMAP2XXX_EN_DPLL_LPBYPASS ||
206 v == OMAP2XXX_EN_DPLL_FRBYPASS) 206 v == OMAP2XXX_EN_DPLL_FRBYPASS)
207 clk_reparent(clk, dd->clk_bypass); 207 return 1;
208 } else if (cpu_is_omap34xx()) { 208 } else if (cpu_is_omap34xx()) {
209 if (v == OMAP3XXX_EN_DPLL_LPBYPASS || 209 if (v == OMAP3XXX_EN_DPLL_LPBYPASS ||
210 v == OMAP3XXX_EN_DPLL_FRBYPASS) 210 v == OMAP3XXX_EN_DPLL_FRBYPASS)
211 clk_reparent(clk, dd->clk_bypass); 211 return 1;
212 } else if (soc_is_am33xx() || cpu_is_omap44xx()) { 212 } else if (soc_is_am33xx() || cpu_is_omap44xx()) {
213 if (v == OMAP4XXX_EN_DPLL_LPBYPASS || 213 if (v == OMAP4XXX_EN_DPLL_LPBYPASS ||
214 v == OMAP4XXX_EN_DPLL_FRBYPASS || 214 v == OMAP4XXX_EN_DPLL_FRBYPASS ||
215 v == OMAP4XXX_EN_DPLL_MNBYPASS) 215 v == OMAP4XXX_EN_DPLL_MNBYPASS)
216 clk_reparent(clk, dd->clk_bypass); 216 return 1;
217 } 217 }
218 return; 218 return 0;
219} 219}
220 220
221/** 221/**
@@ -232,7 +232,7 @@ void omap2_init_dpll_parent(struct clk *clk)
232 * locked, or the appropriate bypass rate if the DPLL is bypassed, or 0 232 * locked, or the appropriate bypass rate if the DPLL is bypassed, or 0
233 * if the clock @clk is not a DPLL. 233 * if the clock @clk is not a DPLL.
234 */ 234 */
235u32 omap2_get_dpll_rate(struct clk *clk) 235unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk)
236{ 236{
237 long long dpll_clk; 237 long long dpll_clk;
238 u32 dpll_mult, dpll_div, v; 238 u32 dpll_mult, dpll_div, v;
@@ -288,8 +288,10 @@ u32 omap2_get_dpll_rate(struct clk *clk)
288 * (expensive) function again. Returns ~0 if the target rate cannot 288 * (expensive) function again. Returns ~0 if the target rate cannot
289 * be rounded, or the rounded rate upon success. 289 * be rounded, or the rounded rate upon success.
290 */ 290 */
291long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate) 291long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
292 unsigned long *parent_rate)
292{ 293{
294 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
293 int m, n, r, scaled_max_m; 295 int m, n, r, scaled_max_m;
294 unsigned long scaled_rt_rp; 296 unsigned long scaled_rt_rp;
295 unsigned long new_rate = 0; 297 unsigned long new_rate = 0;
@@ -303,7 +305,7 @@ long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate)
303 dd = clk->dpll_data; 305 dd = clk->dpll_data;
304 306
305 ref_rate = __clk_get_rate(dd->clk_ref); 307 ref_rate = __clk_get_rate(dd->clk_ref);
306 clk_name = __clk_get_name(clk); 308 clk_name = __clk_get_name(hw->clk);
307 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n", 309 pr_debug("clock: %s: starting DPLL round_rate, target rate %ld\n",
308 clk_name, target_rate); 310 clk_name, target_rate);
309 311
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
index 7c8d41e49834..f10eb03ce3e2 100644
--- a/arch/arm/mach-omap2/clkt_iclk.c
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -11,10 +11,9 @@
11#undef DEBUG 11#undef DEBUG
12 12
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/clk.h> 14#include <linux/clk-provider.h>
15#include <linux/io.h> 15#include <linux/io.h>
16 16
17#include <plat/prcm.h>
18 17
19#include "clock.h" 18#include "clock.h"
20#include "clock2xxx.h" 19#include "clock2xxx.h"
@@ -24,7 +23,7 @@
24/* Private functions */ 23/* Private functions */
25 24
26/* XXX */ 25/* XXX */
27void omap2_clkt_iclk_allow_idle(struct clk *clk) 26void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk)
28{ 27{
29 u32 v, r; 28 u32 v, r;
30 29
@@ -36,7 +35,7 @@ void omap2_clkt_iclk_allow_idle(struct clk *clk)
36} 35}
37 36
38/* XXX */ 37/* XXX */
39void omap2_clkt_iclk_deny_idle(struct clk *clk) 38void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk)
40{ 39{
41 u32 v, r; 40 u32 v, r;
42 41
@@ -49,33 +48,17 @@ void omap2_clkt_iclk_deny_idle(struct clk *clk)
49 48
50/* Public data */ 49/* Public data */
51 50
52const struct clkops clkops_omap2_iclk_dflt_wait = { 51const struct clk_hw_omap_ops clkhwops_iclk = {
53 .enable = omap2_dflt_clk_enable,
54 .disable = omap2_dflt_clk_disable,
55 .find_companion = omap2_clk_dflt_find_companion,
56 .find_idlest = omap2_clk_dflt_find_idlest,
57 .allow_idle = omap2_clkt_iclk_allow_idle, 52 .allow_idle = omap2_clkt_iclk_allow_idle,
58 .deny_idle = omap2_clkt_iclk_deny_idle, 53 .deny_idle = omap2_clkt_iclk_deny_idle,
59}; 54};
60 55
61const struct clkops clkops_omap2_iclk_dflt = { 56const struct clk_hw_omap_ops clkhwops_iclk_wait = {
62 .enable = omap2_dflt_clk_enable,
63 .disable = omap2_dflt_clk_disable,
64 .allow_idle = omap2_clkt_iclk_allow_idle, 57 .allow_idle = omap2_clkt_iclk_allow_idle,
65 .deny_idle = omap2_clkt_iclk_deny_idle, 58 .deny_idle = omap2_clkt_iclk_deny_idle,
59 .find_idlest = omap2_clk_dflt_find_idlest,
60 .find_companion = omap2_clk_dflt_find_companion,
66}; 61};
67 62
68const struct clkops clkops_omap2_iclk_idle_only = {
69 .allow_idle = omap2_clkt_iclk_allow_idle,
70 .deny_idle = omap2_clkt_iclk_deny_idle,
71};
72 63
73const struct clkops clkops_omap2_mdmclk_dflt_wait = {
74 .enable = omap2_dflt_clk_enable,
75 .disable = omap2_dflt_clk_disable,
76 .find_companion = omap2_clk_dflt_find_companion,
77 .find_idlest = omap2_clk_dflt_find_idlest,
78 .allow_idle = omap2_clkt_iclk_allow_idle,
79 .deny_idle = omap2_clkt_iclk_deny_idle,
80};
81 64
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 8b30759f8f9e..e4ec3a69ee2e 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -20,22 +20,30 @@
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/delay.h> 22#include <linux/delay.h>
23#include <linux/clk.h> 23#include <linux/clk-provider.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26 26
27#include <asm/cpu.h> 27#include <asm/cpu.h>
28 28
29#include <plat/prcm.h>
30 29
31#include <trace/events/power.h> 30#include <trace/events/power.h>
32 31
33#include "soc.h" 32#include "soc.h"
34#include "clockdomain.h" 33#include "clockdomain.h"
35#include "clock.h" 34#include "clock.h"
36#include "cm2xxx_3xxx.h" 35#include "cm.h"
36#include "cm2xxx.h"
37#include "cm3xxx.h"
37#include "cm-regbits-24xx.h" 38#include "cm-regbits-24xx.h"
38#include "cm-regbits-34xx.h" 39#include "cm-regbits-34xx.h"
40#include "common.h"
41
42/*
43 * MAX_MODULE_ENABLE_WAIT: maximum of number of microseconds to wait
44 * for a module to indicate that it is no longer in idle
45 */
46#define MAX_MODULE_ENABLE_WAIT 100000
39 47
40u16 cpu_mask; 48u16 cpu_mask;
41 49
@@ -47,9 +55,28 @@ u16 cpu_mask;
47 */ 55 */
48static bool clkdm_control = true; 56static bool clkdm_control = true;
49 57
50static LIST_HEAD(clocks); 58static LIST_HEAD(clk_hw_omap_clocks);
51static DEFINE_MUTEX(clocks_mutex); 59
52static DEFINE_SPINLOCK(clockfw_lock); 60/*
61 * Used for clocks that have the same value as the parent clock,
62 * divided by some factor
63 */
64unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
65 unsigned long parent_rate)
66{
67 struct clk_hw_omap *oclk;
68
69 if (!hw) {
70 pr_warn("%s: hw is NULL\n", __func__);
71 return -EINVAL;
72 }
73
74 oclk = to_clk_hw_omap(hw);
75
76 WARN_ON(!oclk->fixed_div);
77
78 return parent_rate / oclk->fixed_div;
79}
53 80
54/* 81/*
55 * OMAP2+ specific clock functions 82 * OMAP2+ specific clock functions
@@ -57,6 +84,40 @@ static DEFINE_SPINLOCK(clockfw_lock);
57 84
58/* Private functions */ 85/* Private functions */
59 86
87
88/**
89 * _wait_idlest_generic - wait for a module to leave the idle state
90 * @reg: virtual address of module IDLEST register
91 * @mask: value to mask against to determine if the module is active
92 * @idlest: idle state indicator (0 or 1) for the clock
93 * @name: name of the clock (for printk)
94 *
95 * Wait for a module to leave idle, where its idle-status register is
96 * not inside the CM module. Returns 1 if the module left idle
97 * promptly, or 0 if the module did not leave idle before the timeout
98 * elapsed. XXX Deprecated - should be moved into drivers for the
99 * individual IP block that the IDLEST register exists in.
100 */
101static int _wait_idlest_generic(void __iomem *reg, u32 mask, u8 idlest,
102 const char *name)
103{
104 int i = 0, ena = 0;
105
106 ena = (idlest) ? 0 : mask;
107
108 omap_test_timeout(((__raw_readl(reg) & mask) == ena),
109 MAX_MODULE_ENABLE_WAIT, i);
110
111 if (i < MAX_MODULE_ENABLE_WAIT)
112 pr_debug("omap clock: module associated with clock %s ready after %d loops\n",
113 name, i);
114 else
115 pr_err("omap clock: module associated with clock %s didn't enable in %d tries\n",
116 name, MAX_MODULE_ENABLE_WAIT);
117
118 return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
119};
120
60/** 121/**
61 * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE 122 * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE
62 * @clk: struct clk * belonging to the module 123 * @clk: struct clk * belonging to the module
@@ -67,10 +128,12 @@ static DEFINE_SPINLOCK(clockfw_lock);
67 * belong in the clock code and will be moved in the medium term to 128 * belong in the clock code and will be moved in the medium term to
68 * module-dependent code. No return value. 129 * module-dependent code. No return value.
69 */ 130 */
70static void _omap2_module_wait_ready(struct clk *clk) 131static void _omap2_module_wait_ready(struct clk_hw_omap *clk)
71{ 132{
72 void __iomem *companion_reg, *idlest_reg; 133 void __iomem *companion_reg, *idlest_reg;
73 u8 other_bit, idlest_bit, idlest_val; 134 u8 other_bit, idlest_bit, idlest_val, idlest_reg_id;
135 s16 prcm_mod;
136 int r;
74 137
75 /* Not all modules have multiple clocks that their IDLEST depends on */ 138 /* Not all modules have multiple clocks that their IDLEST depends on */
76 if (clk->ops->find_companion) { 139 if (clk->ops->find_companion) {
@@ -80,9 +143,14 @@ static void _omap2_module_wait_ready(struct clk *clk)
80 } 143 }
81 144
82 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); 145 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val);
83 146 r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id);
84 omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val, 147 if (r) {
85 __clk_get_name(clk)); 148 /* IDLEST register not in the CM module */
149 _wait_idlest_generic(idlest_reg, (1 << idlest_bit), idlest_val,
150 __clk_get_name(clk->hw.clk));
151 } else {
152 cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit);
153 };
86} 154}
87 155
88/* Public functions */ 156/* Public functions */
@@ -95,15 +163,16 @@ static void _omap2_module_wait_ready(struct clk *clk)
95 * clockdomain pointer, and save it into the struct clk. Intended to be 163 * clockdomain pointer, and save it into the struct clk. Intended to be
96 * called during clk_register(). No return value. 164 * called during clk_register(). No return value.
97 */ 165 */
98void omap2_init_clk_clkdm(struct clk *clk) 166void omap2_init_clk_clkdm(struct clk_hw *hw)
99{ 167{
168 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
100 struct clockdomain *clkdm; 169 struct clockdomain *clkdm;
101 const char *clk_name; 170 const char *clk_name;
102 171
103 if (!clk->clkdm_name) 172 if (!clk->clkdm_name)
104 return; 173 return;
105 174
106 clk_name = __clk_get_name(clk); 175 clk_name = __clk_get_name(hw->clk);
107 176
108 clkdm = clkdm_lookup(clk->clkdm_name); 177 clkdm = clkdm_lookup(clk->clkdm_name);
109 if (clkdm) { 178 if (clkdm) {
@@ -150,8 +219,8 @@ void __init omap2_clk_disable_clkdm_control(void)
150 * associate this type of code with per-module data structures to 219 * associate this type of code with per-module data structures to
151 * avoid this issue, and remove the casts. No return value. 220 * avoid this issue, and remove the casts. No return value.
152 */ 221 */
153void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, 222void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
154 u8 *other_bit) 223 void __iomem **other_reg, u8 *other_bit)
155{ 224{
156 u32 r; 225 u32 r;
157 226
@@ -179,8 +248,8 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
179 * register address ID (e.g., that CM_FCLKEN2 corresponds to 248 * register address ID (e.g., that CM_FCLKEN2 corresponds to
180 * CM_IDLEST2). This is not true for all modules. No return value. 249 * CM_IDLEST2). This is not true for all modules. No return value.
181 */ 250 */
182void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, 251void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
183 u8 *idlest_bit, u8 *idlest_val) 252 void __iomem **idlest_reg, u8 *idlest_bit, u8 *idlest_val)
184{ 253{
185 u32 r; 254 u32 r;
186 255
@@ -202,16 +271,44 @@ void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg,
202 271
203} 272}
204 273
205int omap2_dflt_clk_enable(struct clk *clk) 274/**
275 * omap2_dflt_clk_enable - enable a clock in the hardware
276 * @hw: struct clk_hw * of the clock to enable
277 *
278 * Enable the clock @hw in the hardware. We first call into the OMAP
279 * clockdomain code to "enable" the corresponding clockdomain if this
280 * is the first enabled user of the clockdomain. Then program the
281 * hardware to enable the clock. Then wait for the IP block that uses
282 * this clock to leave idle (if applicable). Returns the error value
283 * from clkdm_clk_enable() if it terminated with an error, or -EINVAL
284 * if @hw has a null clock enable_reg, or zero upon success.
285 */
286int omap2_dflt_clk_enable(struct clk_hw *hw)
206{ 287{
288 struct clk_hw_omap *clk;
207 u32 v; 289 u32 v;
290 int ret = 0;
291
292 clk = to_clk_hw_omap(hw);
293
294 if (clkdm_control && clk->clkdm) {
295 ret = clkdm_clk_enable(clk->clkdm, hw->clk);
296 if (ret) {
297 WARN(1, "%s: could not enable %s's clockdomain %s: %d\n",
298 __func__, __clk_get_name(hw->clk),
299 clk->clkdm->name, ret);
300 return ret;
301 }
302 }
208 303
209 if (unlikely(clk->enable_reg == NULL)) { 304 if (unlikely(clk->enable_reg == NULL)) {
210 pr_err("clock.c: Enable for %s without enable code\n", 305 pr_err("%s: %s missing enable_reg\n", __func__,
211 clk->name); 306 __clk_get_name(hw->clk));
212 return 0; /* REVISIT: -EINVAL */ 307 ret = -EINVAL;
308 goto err;
213 } 309 }
214 310
311 /* FIXME should not have INVERT_ENABLE bit here */
215 v = __raw_readl(clk->enable_reg); 312 v = __raw_readl(clk->enable_reg);
216 if (clk->flags & INVERT_ENABLE) 313 if (clk->flags & INVERT_ENABLE)
217 v &= ~(1 << clk->enable_bit); 314 v &= ~(1 << clk->enable_bit);
@@ -220,22 +317,39 @@ int omap2_dflt_clk_enable(struct clk *clk)
220 __raw_writel(v, clk->enable_reg); 317 __raw_writel(v, clk->enable_reg);
221 v = __raw_readl(clk->enable_reg); /* OCP barrier */ 318 v = __raw_readl(clk->enable_reg); /* OCP barrier */
222 319
223 if (clk->ops->find_idlest) 320 if (clk->ops && clk->ops->find_idlest)
224 _omap2_module_wait_ready(clk); 321 _omap2_module_wait_ready(clk);
225 322
226 return 0; 323 return 0;
324
325err:
326 if (clkdm_control && clk->clkdm)
327 clkdm_clk_disable(clk->clkdm, hw->clk);
328 return ret;
227} 329}
228 330
229void omap2_dflt_clk_disable(struct clk *clk) 331/**
332 * omap2_dflt_clk_disable - disable a clock in the hardware
333 * @hw: struct clk_hw * of the clock to disable
334 *
335 * Disable the clock @hw in the hardware, and call into the OMAP
336 * clockdomain code to "disable" the corresponding clockdomain if all
337 * clocks/hwmods in that clockdomain are now disabled. No return
338 * value.
339 */
340void omap2_dflt_clk_disable(struct clk_hw *hw)
230{ 341{
342 struct clk_hw_omap *clk;
231 u32 v; 343 u32 v;
232 344
345 clk = to_clk_hw_omap(hw);
233 if (!clk->enable_reg) { 346 if (!clk->enable_reg) {
234 /* 347 /*
235 * 'Independent' here refers to a clock which is not 348 * 'independent' here refers to a clock which is not
236 * controlled by its parent. 349 * controlled by its parent.
237 */ 350 */
238 pr_err("clock: clk_disable called on independent clock %s which has no enable_reg\n", clk->name); 351 pr_err("%s: independent clock %s has no enable_reg\n",
352 __func__, __clk_get_name(hw->clk));
239 return; 353 return;
240 } 354 }
241 355
@@ -246,191 +360,213 @@ void omap2_dflt_clk_disable(struct clk *clk)
246 v &= ~(1 << clk->enable_bit); 360 v &= ~(1 << clk->enable_bit);
247 __raw_writel(v, clk->enable_reg); 361 __raw_writel(v, clk->enable_reg);
248 /* No OCP barrier needed here since it is a disable operation */ 362 /* No OCP barrier needed here since it is a disable operation */
249}
250 363
251const struct clkops clkops_omap2_dflt_wait = { 364 if (clkdm_control && clk->clkdm)
252 .enable = omap2_dflt_clk_enable, 365 clkdm_clk_disable(clk->clkdm, hw->clk);
253 .disable = omap2_dflt_clk_disable, 366}
254 .find_companion = omap2_clk_dflt_find_companion,
255 .find_idlest = omap2_clk_dflt_find_idlest,
256};
257
258const struct clkops clkops_omap2_dflt = {
259 .enable = omap2_dflt_clk_enable,
260 .disable = omap2_dflt_clk_disable,
261};
262 367
263/** 368/**
264 * omap2_clk_disable - disable a clock, if the system is not using it 369 * omap2_clkops_enable_clkdm - increment usecount on clkdm of @hw
265 * @clk: struct clk * to disable 370 * @hw: struct clk_hw * of the clock being enabled
266 * 371 *
267 * Decrements the usecount on struct clk @clk. If there are no users 372 * Increment the usecount of the clockdomain of the clock pointed to
268 * left, call the clkops-specific clock disable function to disable it 373 * by @hw; if the usecount is 1, the clockdomain will be "enabled."
269 * in hardware. If the clock is part of a clockdomain (which they all 374 * Only needed for clocks that don't use omap2_dflt_clk_enable() as
270 * should be), request that the clockdomain be disabled. (It too has 375 * their enable function pointer. Passes along the return value of
271 * a usecount, and so will not be disabled in the hardware until it no 376 * clkdm_clk_enable(), -EINVAL if @hw is not associated with a
272 * longer has any users.) If the clock has a parent clock (most of 377 * clockdomain, or 0 if clock framework-based clockdomain control is
273 * them do), then call ourselves, recursing on the parent clock. This 378 * not implemented.
274 * can cause an entire branch of the clock tree to be powered off by
275 * simply disabling one clock. Intended to be called with the clockfw_lock
276 * spinlock held. No return value.
277 */ 379 */
278void omap2_clk_disable(struct clk *clk) 380int omap2_clkops_enable_clkdm(struct clk_hw *hw)
279{ 381{
280 if (clk->usecount == 0) { 382 struct clk_hw_omap *clk;
281 WARN(1, "clock: %s: omap2_clk_disable() called, but usecount already 0?", clk->name); 383 int ret = 0;
282 return;
283 }
284
285 pr_debug("clock: %s: decrementing usecount\n", clk->name);
286 384
287 clk->usecount--; 385 clk = to_clk_hw_omap(hw);
288 386
289 if (clk->usecount > 0) 387 if (unlikely(!clk->clkdm)) {
290 return; 388 pr_err("%s: %s: no clkdm set ?!\n", __func__,
389 __clk_get_name(hw->clk));
390 return -EINVAL;
391 }
291 392
292 pr_debug("clock: %s: disabling in hardware\n", clk->name); 393 if (unlikely(clk->enable_reg))
394 pr_err("%s: %s: should use dflt_clk_enable ?!\n", __func__,
395 __clk_get_name(hw->clk));
293 396
294 if (clk->ops && clk->ops->disable) { 397 if (!clkdm_control) {
295 trace_clock_disable(clk->name, 0, smp_processor_id()); 398 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
296 clk->ops->disable(clk); 399 __func__, __clk_get_name(hw->clk));
400 return 0;
297 } 401 }
298 402
299 if (clkdm_control && clk->clkdm) 403 ret = clkdm_clk_enable(clk->clkdm, hw->clk);
300 clkdm_clk_disable(clk->clkdm, clk); 404 WARN(ret, "%s: could not enable %s's clockdomain %s: %d\n",
405 __func__, __clk_get_name(hw->clk), clk->clkdm->name, ret);
301 406
302 if (clk->parent) 407 return ret;
303 omap2_clk_disable(clk->parent);
304} 408}
305 409
306/** 410/**
307 * omap2_clk_enable - request that the system enable a clock 411 * omap2_clkops_disable_clkdm - decrement usecount on clkdm of @hw
308 * @clk: struct clk * to enable 412 * @hw: struct clk_hw * of the clock being disabled
309 * 413 *
310 * Increments the usecount on struct clk @clk. If there were no users 414 * Decrement the usecount of the clockdomain of the clock pointed to
311 * previously, then recurse up the clock tree, enabling all of the 415 * by @hw; if the usecount is 0, the clockdomain will be "disabled."
312 * clock's parents and all of the parent clockdomains, and finally, 416 * Only needed for clocks that don't use omap2_dflt_clk_disable() as their
313 * enabling @clk's clockdomain, and @clk itself. Intended to be 417 * disable function pointer. No return value.
314 * called with the clockfw_lock spinlock held. Returns 0 upon success
315 * or a negative error code upon failure.
316 */ 418 */
317int omap2_clk_enable(struct clk *clk) 419void omap2_clkops_disable_clkdm(struct clk_hw *hw)
318{ 420{
319 int ret; 421 struct clk_hw_omap *clk;
320
321 pr_debug("clock: %s: incrementing usecount\n", clk->name);
322
323 clk->usecount++;
324
325 if (clk->usecount > 1)
326 return 0;
327 422
328 pr_debug("clock: %s: enabling in hardware\n", clk->name); 423 clk = to_clk_hw_omap(hw);
329 424
330 if (clk->parent) { 425 if (unlikely(!clk->clkdm)) {
331 ret = omap2_clk_enable(clk->parent); 426 pr_err("%s: %s: no clkdm set ?!\n", __func__,
332 if (ret) { 427 __clk_get_name(hw->clk));
333 WARN(1, "clock: %s: could not enable parent %s: %d\n", 428 return;
334 clk->name, clk->parent->name, ret);
335 goto oce_err1;
336 }
337 } 429 }
338 430
339 if (clkdm_control && clk->clkdm) { 431 if (unlikely(clk->enable_reg))
340 ret = clkdm_clk_enable(clk->clkdm, clk); 432 pr_err("%s: %s: should use dflt_clk_disable ?!\n", __func__,
341 if (ret) { 433 __clk_get_name(hw->clk));
342 WARN(1, "clock: %s: could not enable clockdomain %s: %d\n",
343 clk->name, clk->clkdm->name, ret);
344 goto oce_err2;
345 }
346 }
347 434
348 if (clk->ops && clk->ops->enable) { 435 if (!clkdm_control) {
349 trace_clock_enable(clk->name, 1, smp_processor_id()); 436 pr_err("%s: %s: clkfw-based clockdomain control disabled ?!\n",
350 ret = clk->ops->enable(clk); 437 __func__, __clk_get_name(hw->clk));
351 if (ret) { 438 return;
352 WARN(1, "clock: %s: could not enable: %d\n",
353 clk->name, ret);
354 goto oce_err3;
355 }
356 } 439 }
357 440
358 return 0; 441 clkdm_clk_disable(clk->clkdm, hw->clk);
359
360oce_err3:
361 if (clkdm_control && clk->clkdm)
362 clkdm_clk_disable(clk->clkdm, clk);
363oce_err2:
364 if (clk->parent)
365 omap2_clk_disable(clk->parent);
366oce_err1:
367 clk->usecount--;
368
369 return ret;
370} 442}
371 443
372/* Given a clock and a rate apply a clock specific rounding function */ 444/**
373long omap2_clk_round_rate(struct clk *clk, unsigned long rate) 445 * omap2_dflt_clk_is_enabled - is clock enabled in the hardware?
446 * @hw: struct clk_hw * to check
447 *
448 * Return 1 if the clock represented by @hw is enabled in the
449 * hardware, or 0 otherwise. Intended for use in the struct
450 * clk_ops.is_enabled function pointer.
451 */
452int omap2_dflt_clk_is_enabled(struct clk_hw *hw)
374{ 453{
375 if (clk->round_rate) 454 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
376 return clk->round_rate(clk, rate); 455 u32 v;
456
457 v = __raw_readl(clk->enable_reg);
458
459 if (clk->flags & INVERT_ENABLE)
460 v ^= BIT(clk->enable_bit);
377 461
378 return clk->rate; 462 v &= BIT(clk->enable_bit);
463
464 return v ? 1 : 0;
379} 465}
380 466
381/* Set the clock rate for a clock source */ 467static int __initdata mpurate;
382int omap2_clk_set_rate(struct clk *clk, unsigned long rate) 468
469/*
470 * By default we use the rate set by the bootloader.
471 * You can override this with mpurate= cmdline option.
472 */
473static int __init omap_clk_setup(char *str)
383{ 474{
384 int ret = -EINVAL; 475 get_option(&str, &mpurate);
385 476
386 pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate); 477 if (!mpurate)
478 return 1;
387 479
388 /* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */ 480 if (mpurate < 1000)
389 if (clk->set_rate) { 481 mpurate *= 1000000;
390 trace_clock_set_rate(clk->name, rate, smp_processor_id());
391 ret = clk->set_rate(clk, rate);
392 }
393 482
394 return ret; 483 return 1;
395} 484}
485__setup("mpurate=", omap_clk_setup);
396 486
397int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent) 487/**
488 * omap2_init_clk_hw_omap_clocks - initialize an OMAP clock
489 * @clk: struct clk * to initialize
490 *
491 * Add an OMAP clock @clk to the internal list of OMAP clocks. Used
492 * temporarily for autoidle handling, until this support can be
493 * integrated into the common clock framework code in some way. No
494 * return value.
495 */
496void omap2_init_clk_hw_omap_clocks(struct clk *clk)
398{ 497{
399 if (!clk->clksel) 498 struct clk_hw_omap *c;
400 return -EINVAL;
401 499
402 if (clk->parent == new_parent) 500 if (__clk_get_flags(clk) & CLK_IS_BASIC)
403 return 0; 501 return;
404 502
405 return omap2_clksel_set_parent(clk, new_parent); 503 c = to_clk_hw_omap(__clk_get_hw(clk));
504 list_add(&c->node, &clk_hw_omap_clocks);
406} 505}
407 506
408/* 507/**
409 * OMAP2+ clock reset and init functions 508 * omap2_clk_enable_autoidle_all - enable autoidle on all OMAP clocks that
509 * support it
510 *
511 * Enable clock autoidle on all OMAP clocks that have allow_idle
512 * function pointers associated with them. This function is intended
513 * to be temporary until support for this is added to the common clock
514 * code. Returns 0.
410 */ 515 */
516int omap2_clk_enable_autoidle_all(void)
517{
518 struct clk_hw_omap *c;
519
520 list_for_each_entry(c, &clk_hw_omap_clocks, node)
521 if (c->ops && c->ops->allow_idle)
522 c->ops->allow_idle(c);
523 return 0;
524}
411 525
412#ifdef CONFIG_OMAP_RESET_CLOCKS 526/**
413void omap2_clk_disable_unused(struct clk *clk) 527 * omap2_clk_disable_autoidle_all - disable autoidle on all OMAP clocks that
528 * support it
529 *
530 * Disable clock autoidle on all OMAP clocks that have allow_idle
531 * function pointers associated with them. This function is intended
532 * to be temporary until support for this is added to the common clock
533 * code. Returns 0.
534 */
535int omap2_clk_disable_autoidle_all(void)
414{ 536{
415 u32 regval32, v; 537 struct clk_hw_omap *c;
416 538
417 v = (clk->flags & INVERT_ENABLE) ? (1 << clk->enable_bit) : 0; 539 list_for_each_entry(c, &clk_hw_omap_clocks, node)
540 if (c->ops && c->ops->deny_idle)
541 c->ops->deny_idle(c);
542 return 0;
543}
418 544
419 regval32 = __raw_readl(clk->enable_reg); 545/**
420 if ((regval32 & (1 << clk->enable_bit)) == v) 546 * omap2_clk_enable_init_clocks - prepare & enable a list of clocks
421 return; 547 * @clk_names: ptr to an array of strings of clock names to enable
548 * @num_clocks: number of clock names in @clk_names
549 *
550 * Prepare and enable a list of clocks, named by @clk_names. No
551 * return value. XXX Deprecated; only needed until these clocks are
552 * properly claimed and enabled by the drivers or core code that uses
553 * them. XXX What code disables & calls clk_put on these clocks?
554 */
555void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks)
556{
557 struct clk *init_clk;
558 int i;
422 559
423 pr_debug("Disabling unused clock \"%s\"\n", clk->name); 560 for (i = 0; i < num_clocks; i++) {
424 if (cpu_is_omap34xx()) { 561 init_clk = clk_get(NULL, clk_names[i]);
425 omap2_clk_enable(clk); 562 clk_prepare_enable(init_clk);
426 omap2_clk_disable(clk);
427 } else {
428 clk->ops->disable(clk);
429 } 563 }
430 if (clk->clkdm != NULL)
431 pwrdm_state_switch(clk->clkdm->pwrdm.ptr);
432} 564}
433#endif 565
566const struct clk_hw_omap_ops clkhwops_wait = {
567 .find_idlest = omap2_clk_dflt_find_idlest,
568 .find_companion = omap2_clk_dflt_find_companion,
569};
434 570
435/** 571/**
436 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument 572 * omap2_clk_switch_mpurate_at_boot - switch ARM MPU rate by boot-time argument
@@ -462,14 +598,12 @@ int __init omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name)
462 r = clk_set_rate(mpurate_ck, mpurate); 598 r = clk_set_rate(mpurate_ck, mpurate);
463 if (IS_ERR_VALUE(r)) { 599 if (IS_ERR_VALUE(r)) {
464 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n", 600 WARN(1, "clock: %s: unable to set MPU rate to %d: %d\n",
465 mpurate_ck->name, mpurate, r); 601 mpurate_ck_name, mpurate, r);
466 clk_put(mpurate_ck); 602 clk_put(mpurate_ck);
467 return -EINVAL; 603 return -EINVAL;
468 } 604 }
469 605
470 calibrate_delay(); 606 calibrate_delay();
471 recalculate_root_clocks();
472
473 clk_put(mpurate_ck); 607 clk_put(mpurate_ck);
474 608
475 return 0; 609 return 0;
@@ -513,513 +647,3 @@ void __init omap2_clk_print_new_rates(const char *hfclkin_ck_name,
513 (clk_get_rate(core_ck) / 1000000), 647 (clk_get_rate(core_ck) / 1000000),
514 (clk_get_rate(mpu_ck) / 1000000)); 648 (clk_get_rate(mpu_ck) / 1000000));
515} 649}
516
517/* Common data */
518
519int clk_enable(struct clk *clk)
520{
521 unsigned long flags;
522 int ret;
523
524 if (clk == NULL || IS_ERR(clk))
525 return -EINVAL;
526
527 spin_lock_irqsave(&clockfw_lock, flags);
528 ret = omap2_clk_enable(clk);
529 spin_unlock_irqrestore(&clockfw_lock, flags);
530
531 return ret;
532}
533EXPORT_SYMBOL(clk_enable);
534
535void clk_disable(struct clk *clk)
536{
537 unsigned long flags;
538
539 if (clk == NULL || IS_ERR(clk))
540 return;
541
542 spin_lock_irqsave(&clockfw_lock, flags);
543 if (clk->usecount == 0) {
544 pr_err("Trying disable clock %s with 0 usecount\n",
545 clk->name);
546 WARN_ON(1);
547 goto out;
548 }
549
550 omap2_clk_disable(clk);
551
552out:
553 spin_unlock_irqrestore(&clockfw_lock, flags);
554}
555EXPORT_SYMBOL(clk_disable);
556
557unsigned long clk_get_rate(struct clk *clk)
558{
559 unsigned long flags;
560 unsigned long ret;
561
562 if (clk == NULL || IS_ERR(clk))
563 return 0;
564
565 spin_lock_irqsave(&clockfw_lock, flags);
566 ret = clk->rate;
567 spin_unlock_irqrestore(&clockfw_lock, flags);
568
569 return ret;
570}
571EXPORT_SYMBOL(clk_get_rate);
572
573/*
574 * Optional clock functions defined in include/linux/clk.h
575 */
576
577long clk_round_rate(struct clk *clk, unsigned long rate)
578{
579 unsigned long flags;
580 long ret;
581
582 if (clk == NULL || IS_ERR(clk))
583 return 0;
584
585 spin_lock_irqsave(&clockfw_lock, flags);
586 ret = omap2_clk_round_rate(clk, rate);
587 spin_unlock_irqrestore(&clockfw_lock, flags);
588
589 return ret;
590}
591EXPORT_SYMBOL(clk_round_rate);
592
593int clk_set_rate(struct clk *clk, unsigned long rate)
594{
595 unsigned long flags;
596 int ret = -EINVAL;
597
598 if (clk == NULL || IS_ERR(clk))
599 return ret;
600
601 spin_lock_irqsave(&clockfw_lock, flags);
602 ret = omap2_clk_set_rate(clk, rate);
603 if (ret == 0)
604 propagate_rate(clk);
605 spin_unlock_irqrestore(&clockfw_lock, flags);
606
607 return ret;
608}
609EXPORT_SYMBOL(clk_set_rate);
610
611int clk_set_parent(struct clk *clk, struct clk *parent)
612{
613 unsigned long flags;
614 int ret = -EINVAL;
615
616 if (clk == NULL || IS_ERR(clk) || parent == NULL || IS_ERR(parent))
617 return ret;
618
619 spin_lock_irqsave(&clockfw_lock, flags);
620 if (clk->usecount == 0) {
621 ret = omap2_clk_set_parent(clk, parent);
622 if (ret == 0)
623 propagate_rate(clk);
624 } else {
625 ret = -EBUSY;
626 }
627 spin_unlock_irqrestore(&clockfw_lock, flags);
628
629 return ret;
630}
631EXPORT_SYMBOL(clk_set_parent);
632
633struct clk *clk_get_parent(struct clk *clk)
634{
635 return clk->parent;
636}
637EXPORT_SYMBOL(clk_get_parent);
638
639/*
640 * OMAP specific clock functions shared between omap1 and omap2
641 */
642
643int __initdata mpurate;
644
645/*
646 * By default we use the rate set by the bootloader.
647 * You can override this with mpurate= cmdline option.
648 */
649static int __init omap_clk_setup(char *str)
650{
651 get_option(&str, &mpurate);
652
653 if (!mpurate)
654 return 1;
655
656 if (mpurate < 1000)
657 mpurate *= 1000000;
658
659 return 1;
660}
661__setup("mpurate=", omap_clk_setup);
662
663/* Used for clocks that always have same value as the parent clock */
664unsigned long followparent_recalc(struct clk *clk)
665{
666 return clk->parent->rate;
667}
668
669/*
670 * Used for clocks that have the same value as the parent clock,
671 * divided by some factor
672 */
673unsigned long omap_fixed_divisor_recalc(struct clk *clk)
674{
675 WARN_ON(!clk->fixed_div);
676
677 return clk->parent->rate / clk->fixed_div;
678}
679
680void clk_reparent(struct clk *child, struct clk *parent)
681{
682 list_del_init(&child->sibling);
683 if (parent)
684 list_add(&child->sibling, &parent->children);
685 child->parent = parent;
686
687 /* now do the debugfs renaming to reattach the child
688 to the proper parent */
689}
690
691/* Propagate rate to children */
692void propagate_rate(struct clk *tclk)
693{
694 struct clk *clkp;
695
696 list_for_each_entry(clkp, &tclk->children, sibling) {
697 if (clkp->recalc)
698 clkp->rate = clkp->recalc(clkp);
699 propagate_rate(clkp);
700 }
701}
702
703static LIST_HEAD(root_clks);
704
705/**
706 * recalculate_root_clocks - recalculate and propagate all root clocks
707 *
708 * Recalculates all root clocks (clocks with no parent), which if the
709 * clock's .recalc is set correctly, should also propagate their rates.
710 * Called at init.
711 */
712void recalculate_root_clocks(void)
713{
714 struct clk *clkp;
715
716 list_for_each_entry(clkp, &root_clks, sibling) {
717 if (clkp->recalc)
718 clkp->rate = clkp->recalc(clkp);
719 propagate_rate(clkp);
720 }
721}
722
723/**
724 * clk_preinit - initialize any fields in the struct clk before clk init
725 * @clk: struct clk * to initialize
726 *
727 * Initialize any struct clk fields needed before normal clk initialization
728 * can run. No return value.
729 */
730void clk_preinit(struct clk *clk)
731{
732 INIT_LIST_HEAD(&clk->children);
733}
734
735int clk_register(struct clk *clk)
736{
737 if (clk == NULL || IS_ERR(clk))
738 return -EINVAL;
739
740 /*
741 * trap out already registered clocks
742 */
743 if (clk->node.next || clk->node.prev)
744 return 0;
745
746 mutex_lock(&clocks_mutex);
747 if (clk->parent)
748 list_add(&clk->sibling, &clk->parent->children);
749 else
750 list_add(&clk->sibling, &root_clks);
751
752 list_add(&clk->node, &clocks);
753 if (clk->init)
754 clk->init(clk);
755 mutex_unlock(&clocks_mutex);
756
757 return 0;
758}
759EXPORT_SYMBOL(clk_register);
760
761void clk_unregister(struct clk *clk)
762{
763 if (clk == NULL || IS_ERR(clk))
764 return;
765
766 mutex_lock(&clocks_mutex);
767 list_del(&clk->sibling);
768 list_del(&clk->node);
769 mutex_unlock(&clocks_mutex);
770}
771EXPORT_SYMBOL(clk_unregister);
772
773void clk_enable_init_clocks(void)
774{
775 struct clk *clkp;
776
777 list_for_each_entry(clkp, &clocks, node)
778 if (clkp->flags & ENABLE_ON_INIT)
779 clk_enable(clkp);
780}
781
782/**
783 * omap_clk_get_by_name - locate OMAP struct clk by its name
784 * @name: name of the struct clk to locate
785 *
786 * Locate an OMAP struct clk by its name. Assumes that struct clk
787 * names are unique. Returns NULL if not found or a pointer to the
788 * struct clk if found.
789 */
790struct clk *omap_clk_get_by_name(const char *name)
791{
792 struct clk *c;
793 struct clk *ret = NULL;
794
795 mutex_lock(&clocks_mutex);
796
797 list_for_each_entry(c, &clocks, node) {
798 if (!strcmp(c->name, name)) {
799 ret = c;
800 break;
801 }
802 }
803
804 mutex_unlock(&clocks_mutex);
805
806 return ret;
807}
808
809int omap_clk_enable_autoidle_all(void)
810{
811 struct clk *c;
812 unsigned long flags;
813
814 spin_lock_irqsave(&clockfw_lock, flags);
815
816 list_for_each_entry(c, &clocks, node)
817 if (c->ops->allow_idle)
818 c->ops->allow_idle(c);
819
820 spin_unlock_irqrestore(&clockfw_lock, flags);
821
822 return 0;
823}
824
825int omap_clk_disable_autoidle_all(void)
826{
827 struct clk *c;
828 unsigned long flags;
829
830 spin_lock_irqsave(&clockfw_lock, flags);
831
832 list_for_each_entry(c, &clocks, node)
833 if (c->ops->deny_idle)
834 c->ops->deny_idle(c);
835
836 spin_unlock_irqrestore(&clockfw_lock, flags);
837
838 return 0;
839}
840
841/*
842 * Low level helpers
843 */
844static int clkll_enable_null(struct clk *clk)
845{
846 return 0;
847}
848
849static void clkll_disable_null(struct clk *clk)
850{
851}
852
853const struct clkops clkops_null = {
854 .enable = clkll_enable_null,
855 .disable = clkll_disable_null,
856};
857
858/*
859 * Dummy clock
860 *
861 * Used for clock aliases that are needed on some OMAPs, but not others
862 */
863struct clk dummy_ck = {
864 .name = "dummy",
865 .ops = &clkops_null,
866};
867
868/*
869 *
870 */
871
872#ifdef CONFIG_OMAP_RESET_CLOCKS
873/*
874 * Disable any unused clocks left on by the bootloader
875 */
876static int __init clk_disable_unused(void)
877{
878 struct clk *ck;
879 unsigned long flags;
880
881 pr_info("clock: disabling unused clocks to save power\n");
882
883 spin_lock_irqsave(&clockfw_lock, flags);
884 list_for_each_entry(ck, &clocks, node) {
885 if (ck->ops == &clkops_null)
886 continue;
887
888 if (ck->usecount > 0 || !ck->enable_reg)
889 continue;
890
891 omap2_clk_disable_unused(ck);
892 }
893 spin_unlock_irqrestore(&clockfw_lock, flags);
894
895 return 0;
896}
897late_initcall(clk_disable_unused);
898late_initcall(omap_clk_enable_autoidle_all);
899#endif
900
901#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
902/*
903 * debugfs support to trace clock tree hierarchy and attributes
904 */
905
906#include <linux/debugfs.h>
907#include <linux/seq_file.h>
908
909static struct dentry *clk_debugfs_root;
910
911static int clk_dbg_show_summary(struct seq_file *s, void *unused)
912{
913 struct clk *c;
914 struct clk *pa;
915
916 mutex_lock(&clocks_mutex);
917 seq_printf(s, "%-30s %-30s %-10s %s\n",
918 "clock-name", "parent-name", "rate", "use-count");
919
920 list_for_each_entry(c, &clocks, node) {
921 pa = c->parent;
922 seq_printf(s, "%-30s %-30s %-10lu %d\n",
923 c->name, pa ? pa->name : "none", c->rate,
924 c->usecount);
925 }
926 mutex_unlock(&clocks_mutex);
927
928 return 0;
929}
930
931static int clk_dbg_open(struct inode *inode, struct file *file)
932{
933 return single_open(file, clk_dbg_show_summary, inode->i_private);
934}
935
936static const struct file_operations debug_clock_fops = {
937 .open = clk_dbg_open,
938 .read = seq_read,
939 .llseek = seq_lseek,
940 .release = single_release,
941};
942
943static int clk_debugfs_register_one(struct clk *c)
944{
945 int err;
946 struct dentry *d;
947 struct clk *pa = c->parent;
948
949 d = debugfs_create_dir(c->name, pa ? pa->dent : clk_debugfs_root);
950 if (!d)
951 return -ENOMEM;
952 c->dent = d;
953
954 d = debugfs_create_u8("usecount", S_IRUGO, c->dent, (u8 *)&c->usecount);
955 if (!d) {
956 err = -ENOMEM;
957 goto err_out;
958 }
959 d = debugfs_create_u32("rate", S_IRUGO, c->dent, (u32 *)&c->rate);
960 if (!d) {
961 err = -ENOMEM;
962 goto err_out;
963 }
964 d = debugfs_create_x32("flags", S_IRUGO, c->dent, (u32 *)&c->flags);
965 if (!d) {
966 err = -ENOMEM;
967 goto err_out;
968 }
969 return 0;
970
971err_out:
972 debugfs_remove_recursive(c->dent);
973 return err;
974}
975
976static int clk_debugfs_register(struct clk *c)
977{
978 int err;
979 struct clk *pa = c->parent;
980
981 if (pa && !pa->dent) {
982 err = clk_debugfs_register(pa);
983 if (err)
984 return err;
985 }
986
987 if (!c->dent) {
988 err = clk_debugfs_register_one(c);
989 if (err)
990 return err;
991 }
992 return 0;
993}
994
995static int __init clk_debugfs_init(void)
996{
997 struct clk *c;
998 struct dentry *d;
999 int err;
1000
1001 d = debugfs_create_dir("clock", NULL);
1002 if (!d)
1003 return -ENOMEM;
1004 clk_debugfs_root = d;
1005
1006 list_for_each_entry(c, &clocks, node) {
1007 err = clk_debugfs_register(c);
1008 if (err)
1009 goto err_out;
1010 }
1011
1012 d = debugfs_create_file("summary", S_IRUGO,
1013 d, NULL, &debug_clock_fops);
1014 if (!d)
1015 return -ENOMEM;
1016
1017 return 0;
1018err_out:
1019 debugfs_remove_recursive(clk_debugfs_root);
1020 return err;
1021}
1022late_initcall(clk_debugfs_init);
1023
1024#endif /* defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) */
1025
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index cfba1ffe5cc2..9917f793c3b6 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -20,6 +20,7 @@
20#include <linux/list.h> 20#include <linux/list.h>
21 21
22#include <linux/clkdev.h> 22#include <linux/clkdev.h>
23#include <linux/clk-provider.h>
23 24
24struct omap_clk { 25struct omap_clk {
25 u16 cpu; 26 u16 cpu;
@@ -52,43 +53,84 @@ struct omap_clk {
52#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS) 53#define CK_34XX (CK_3430ES1 | CK_3430ES2PLUS)
53#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX) 54#define CK_3XXX (CK_34XX | CK_AM35XX | CK_36XX)
54 55
55struct module;
56struct clk;
57struct clockdomain; 56struct clockdomain;
58 57#define to_clk_hw_omap(_hw) container_of(_hw, struct clk_hw_omap, hw)
59/* Temporary, needed during the common clock framework conversion */ 58
60#define __clk_get_name(clk) (clk->name) 59#define DEFINE_STRUCT_CLK(_name, _parent_array_name, _clkops_name) \
61#define __clk_get_parent(clk) (clk->parent) 60 static struct clk _name = { \
62#define __clk_get_rate(clk) (clk->rate) 61 .name = #_name, \
63 62 .hw = &_name##_hw.hw, \
64/** 63 .parent_names = _parent_array_name, \
65 * struct clkops - some clock function pointers 64 .num_parents = ARRAY_SIZE(_parent_array_name), \
66 * @enable: fn ptr that enables the current clock in hardware 65 .ops = &_clkops_name, \
67 * @disable: fn ptr that enables the current clock in hardware 66 };
68 * @find_idlest: function returning the IDLEST register for the clock's IP blk 67
69 * @find_companion: function returning the "companion" clk reg for the clock 68#define DEFINE_STRUCT_CLK_HW_OMAP(_name, _clkdm_name) \
70 * @allow_idle: fn ptr that enables autoidle for the current clock in hardware 69 static struct clk_hw_omap _name##_hw = { \
71 * @deny_idle: fn ptr that disables autoidle for the current clock in hardware 70 .hw = { \
72 * 71 .clk = &_name, \
73 * A "companion" clk is an accompanying clock to the one being queried 72 }, \
74 * that must be enabled for the IP module connected to the clock to 73 .clkdm_name = _clkdm_name, \
75 * become accessible by the hardware. Neither @find_idlest nor 74 };
76 * @find_companion should be needed; that information is IP 75
77 * block-specific; the hwmod code has been created to handle this, but 76#define DEFINE_CLK_OMAP_MUX(_name, _clkdm_name, _clksel, \
78 * until hwmod data is ready and drivers have been converted to use PM 77 _clksel_reg, _clksel_mask, \
79 * runtime calls in place of clk_enable()/clk_disable(), @find_idlest and 78 _parent_names, _ops) \
80 * @find_companion must, unfortunately, remain. 79 static struct clk _name; \
81 */ 80 static struct clk_hw_omap _name##_hw = { \
82struct clkops { 81 .hw = { \
83 int (*enable)(struct clk *); 82 .clk = &_name, \
84 void (*disable)(struct clk *); 83 }, \
85 void (*find_idlest)(struct clk *, void __iomem **, 84 .clksel = _clksel, \
86 u8 *, u8 *); 85 .clksel_reg = _clksel_reg, \
87 void (*find_companion)(struct clk *, void __iomem **, 86 .clksel_mask = _clksel_mask, \
88 u8 *); 87 .clkdm_name = _clkdm_name, \
89 void (*allow_idle)(struct clk *); 88 }; \
90 void (*deny_idle)(struct clk *); 89 DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
91}; 90
91#define DEFINE_CLK_OMAP_MUX_GATE(_name, _clkdm_name, _clksel, \
92 _clksel_reg, _clksel_mask, \
93 _enable_reg, _enable_bit, \
94 _hwops, _parent_names, _ops) \
95 static struct clk _name; \
96 static struct clk_hw_omap _name##_hw = { \
97 .hw = { \
98 .clk = &_name, \
99 }, \
100 .ops = _hwops, \
101 .enable_reg = _enable_reg, \
102 .enable_bit = _enable_bit, \
103 .clksel = _clksel, \
104 .clksel_reg = _clksel_reg, \
105 .clksel_mask = _clksel_mask, \
106 .clkdm_name = _clkdm_name, \
107 }; \
108 DEFINE_STRUCT_CLK(_name, _parent_names, _ops);
109
110#define DEFINE_CLK_OMAP_HSDIVIDER(_name, _parent_name, \
111 _parent_ptr, _flags, \
112 _clksel_reg, _clksel_mask) \
113 static const struct clksel _name##_div[] = { \
114 { \
115 .parent = _parent_ptr, \
116 .rates = div31_1to31_rates \
117 }, \
118 { .parent = NULL }, \
119 }; \
120 static struct clk _name; \
121 static const char *_name##_parent_names[] = { \
122 _parent_name, \
123 }; \
124 static struct clk_hw_omap _name##_hw = { \
125 .hw = { \
126 .clk = &_name, \
127 }, \
128 .clksel = _name##_div, \
129 .clksel_reg = _clksel_reg, \
130 .clksel_mask = _clksel_mask, \
131 .ops = &clkhwops_omap4_dpllmx, \
132 }; \
133 DEFINE_STRUCT_CLK(_name, _name##_parent_names, omap_hsdivider_ops);
92 134
93/* struct clksel_rate.flags possibilities */ 135/* struct clksel_rate.flags possibilities */
94#define RATE_IN_242X (1 << 0) 136#define RATE_IN_242X (1 << 0)
@@ -229,22 +271,10 @@ struct dpll_data {
229#define CLOCK_CLKOUTX2 (1 << 5) 271#define CLOCK_CLKOUTX2 (1 << 5)
230 272
231/** 273/**
232 * struct clk - OMAP struct clk 274 * struct clk_hw_omap - OMAP struct clk
233 * @node: list_head connecting this clock into the full clock list 275 * @node: list_head connecting this clock into the full clock list
234 * @ops: struct clkops * for this clock
235 * @name: the name of the clock in the hardware (used in hwmod data and debug)
236 * @parent: pointer to this clock's parent struct clk
237 * @children: list_head connecting to the child clks' @sibling list_heads
238 * @sibling: list_head connecting this clk to its parent clk's @children
239 * @rate: current clock rate
240 * @enable_reg: register to write to enable the clock (see @enable_bit) 276 * @enable_reg: register to write to enable the clock (see @enable_bit)
241 * @recalc: fn ptr that returns the clock's current rate
242 * @set_rate: fn ptr that can change the clock's current rate
243 * @round_rate: fn ptr that can round the clock's current rate
244 * @init: fn ptr to do clock-specific initialization
245 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg) 277 * @enable_bit: bitshift to write to enable/disable the clock (see @enable_reg)
246 * @usecount: number of users that have requested this clock to be enabled
247 * @fixed_div: when > 0, this clock's rate is its parent's rate / @fixed_div
248 * @flags: see "struct clk.flags possibilities" above 278 * @flags: see "struct clk.flags possibilities" above
249 * @clksel_reg: for clksel clks, register va containing src/divisor select 279 * @clksel_reg: for clksel clks, register va containing src/divisor select
250 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector 280 * @clksel_mask: bitmask in @clksel_reg for the src/divisor selector
@@ -258,39 +288,17 @@ struct dpll_data {
258 * XXX @rate_offset, @src_offset should probably be removed and OMAP1 288 * XXX @rate_offset, @src_offset should probably be removed and OMAP1
259 * clock code converted to use clksel. 289 * clock code converted to use clksel.
260 * 290 *
261 * XXX @usecount is poorly named. It should be "enable_count" or
262 * something similar. "users" in the description refers to kernel
263 * code (core code or drivers) that have called clk_enable() and not
264 * yet called clk_disable(); the usecount of parent clocks is also
265 * incremented by the clock code when clk_enable() is called on child
266 * clocks and decremented by the clock code when clk_disable() is
267 * called on child clocks.
268 *
269 * XXX @clkdm, @usecount, @children, @sibling should be marked for
270 * internal use only.
271 *
272 * @children and @sibling are used to optimize parent-to-child clock
273 * tree traversals. (child-to-parent traversals use @parent.)
274 *
275 * XXX The notion of the clock's current rate probably needs to be
276 * separated from the clock's target rate.
277 */ 291 */
278struct clk { 292
293struct clk_hw_omap_ops;
294
295struct clk_hw_omap {
296 struct clk_hw hw;
279 struct list_head node; 297 struct list_head node;
280 const struct clkops *ops; 298 unsigned long fixed_rate;
281 const char *name; 299 u8 fixed_div;
282 struct clk *parent;
283 struct list_head children;
284 struct list_head sibling; /* node for children */
285 unsigned long rate;
286 void __iomem *enable_reg; 300 void __iomem *enable_reg;
287 unsigned long (*recalc)(struct clk *);
288 int (*set_rate)(struct clk *, unsigned long);
289 long (*round_rate)(struct clk *, unsigned long);
290 void (*init)(struct clk *);
291 u8 enable_bit; 301 u8 enable_bit;
292 s8 usecount;
293 u8 fixed_div;
294 u8 flags; 302 u8 flags;
295 void __iomem *clksel_reg; 303 void __iomem *clksel_reg;
296 u32 clksel_mask; 304 u32 clksel_mask;
@@ -298,42 +306,22 @@ struct clk {
298 struct dpll_data *dpll_data; 306 struct dpll_data *dpll_data;
299 const char *clkdm_name; 307 const char *clkdm_name;
300 struct clockdomain *clkdm; 308 struct clockdomain *clkdm;
301#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) 309 const struct clk_hw_omap_ops *ops;
302 struct dentry *dent; /* For visible tree hierarchy */
303#endif
304}; 310};
305 311
306struct clk_functions { 312struct clk_hw_omap_ops {
307 int (*clk_enable)(struct clk *clk); 313 void (*find_idlest)(struct clk_hw_omap *oclk,
308 void (*clk_disable)(struct clk *clk); 314 void __iomem **idlest_reg,
309 long (*clk_round_rate)(struct clk *clk, unsigned long rate); 315 u8 *idlest_bit, u8 *idlest_val);
310 int (*clk_set_rate)(struct clk *clk, unsigned long rate); 316 void (*find_companion)(struct clk_hw_omap *oclk,
311 int (*clk_set_parent)(struct clk *clk, struct clk *parent); 317 void __iomem **other_reg,
312 void (*clk_allow_idle)(struct clk *clk); 318 u8 *other_bit);
313 void (*clk_deny_idle)(struct clk *clk); 319 void (*allow_idle)(struct clk_hw_omap *oclk);
314 void (*clk_disable_unused)(struct clk *clk); 320 void (*deny_idle)(struct clk_hw_omap *oclk);
315}; 321};
316 322
317extern int mpurate; 323unsigned long omap_fixed_divisor_recalc(struct clk_hw *hw,
318 324 unsigned long parent_rate);
319extern int clk_init(struct clk_functions *custom_clocks);
320extern void clk_preinit(struct clk *clk);
321extern int clk_register(struct clk *clk);
322extern void clk_reparent(struct clk *child, struct clk *parent);
323extern void clk_unregister(struct clk *clk);
324extern void propagate_rate(struct clk *clk);
325extern void recalculate_root_clocks(void);
326extern unsigned long followparent_recalc(struct clk *clk);
327extern void clk_enable_init_clocks(void);
328unsigned long omap_fixed_divisor_recalc(struct clk *clk);
329extern struct clk *omap_clk_get_by_name(const char *name);
330extern int omap_clk_enable_autoidle_all(void);
331extern int omap_clk_disable_autoidle_all(void);
332
333extern const struct clkops clkops_null;
334
335extern struct clk dummy_ck;
336
337 325
338/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */ 326/* CM_CLKSEL2_PLL.CORE_CLK_SRC bits (2XXX) */
339#define CORE_CLK_SRC_32K 0x0 327#define CORE_CLK_SRC_32K 0x0
@@ -364,84 +352,62 @@ extern struct clk dummy_ck;
364/* DPLL Type and DCO Selection Flags */ 352/* DPLL Type and DCO Selection Flags */
365#define DPLL_J_TYPE 0x1 353#define DPLL_J_TYPE 0x1
366 354
367int omap2_clk_enable(struct clk *clk); 355long omap2_dpll_round_rate(struct clk_hw *hw, unsigned long target_rate,
368void omap2_clk_disable(struct clk *clk); 356 unsigned long *parent_rate);
369long omap2_clk_round_rate(struct clk *clk, unsigned long rate); 357unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate);
370int omap2_clk_set_rate(struct clk *clk, unsigned long rate); 358int omap3_noncore_dpll_enable(struct clk_hw *hw);
371int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent); 359void omap3_noncore_dpll_disable(struct clk_hw *hw);
372long omap2_dpll_round_rate(struct clk *clk, unsigned long target_rate); 360int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
373unsigned long omap3_dpll_recalc(struct clk *clk); 361 unsigned long parent_rate);
374unsigned long omap3_clkoutx2_recalc(struct clk *clk); 362u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk);
375void omap3_dpll_allow_idle(struct clk *clk); 363void omap3_dpll_allow_idle(struct clk_hw_omap *clk);
376void omap3_dpll_deny_idle(struct clk *clk); 364void omap3_dpll_deny_idle(struct clk_hw_omap *clk);
377u32 omap3_dpll_autoidle_read(struct clk *clk); 365unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
378int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate); 366 unsigned long parent_rate);
379int omap3_noncore_dpll_enable(struct clk *clk); 367int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk);
380void omap3_noncore_dpll_disable(struct clk *clk); 368void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk);
381int omap4_dpllmx_gatectrl_read(struct clk *clk); 369void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk);
382void omap4_dpllmx_allow_gatectrl(struct clk *clk); 370unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
383void omap4_dpllmx_deny_gatectrl(struct clk *clk); 371 unsigned long parent_rate);
384long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate); 372long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
385unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk); 373 unsigned long target_rate,
386 374 unsigned long *parent_rate);
387#ifdef CONFIG_OMAP_RESET_CLOCKS 375
388void omap2_clk_disable_unused(struct clk *clk); 376void omap2_init_clk_clkdm(struct clk_hw *clk);
389#else
390#define omap2_clk_disable_unused NULL
391#endif
392
393void omap2_init_clk_clkdm(struct clk *clk);
394void __init omap2_clk_disable_clkdm_control(void); 377void __init omap2_clk_disable_clkdm_control(void);
395 378
396/* clkt_clksel.c public functions */ 379/* clkt_clksel.c public functions */
397u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate, 380u32 omap2_clksel_round_rate_div(struct clk_hw_omap *clk,
381 unsigned long target_rate,
398 u32 *new_div); 382 u32 *new_div);
399void omap2_init_clksel_parent(struct clk *clk); 383u8 omap2_clksel_find_parent_index(struct clk_hw *hw);
400unsigned long omap2_clksel_recalc(struct clk *clk); 384unsigned long omap2_clksel_recalc(struct clk_hw *hw, unsigned long parent_rate);
401long omap2_clksel_round_rate(struct clk *clk, unsigned long target_rate); 385long omap2_clksel_round_rate(struct clk_hw *hw, unsigned long target_rate,
402int omap2_clksel_set_rate(struct clk *clk, unsigned long rate); 386 unsigned long *parent_rate);
403int omap2_clksel_set_parent(struct clk *clk, struct clk *new_parent); 387int omap2_clksel_set_rate(struct clk_hw *hw, unsigned long rate,
388 unsigned long parent_rate);
389int omap2_clksel_set_parent(struct clk_hw *hw, u8 field_val);
404 390
405/* clkt_iclk.c public functions */ 391/* clkt_iclk.c public functions */
406extern void omap2_clkt_iclk_allow_idle(struct clk *clk); 392extern void omap2_clkt_iclk_allow_idle(struct clk_hw_omap *clk);
407extern void omap2_clkt_iclk_deny_idle(struct clk *clk); 393extern void omap2_clkt_iclk_deny_idle(struct clk_hw_omap *clk);
408
409u32 omap2_get_dpll_rate(struct clk *clk);
410void omap2_init_dpll_parent(struct clk *clk);
411
412int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
413
414 394
415#ifdef CONFIG_ARCH_OMAP2 395u8 omap2_init_dpll_parent(struct clk_hw *hw);
416void omap2xxx_clk_prepare_for_reboot(void); 396unsigned long omap2_get_dpll_rate(struct clk_hw_omap *clk);
417#else
418static inline void omap2xxx_clk_prepare_for_reboot(void)
419{
420}
421#endif
422
423#ifdef CONFIG_ARCH_OMAP3
424void omap3_clk_prepare_for_reboot(void);
425#else
426static inline void omap3_clk_prepare_for_reboot(void)
427{
428}
429#endif
430
431#ifdef CONFIG_ARCH_OMAP4
432void omap4_clk_prepare_for_reboot(void);
433#else
434static inline void omap4_clk_prepare_for_reboot(void)
435{
436}
437#endif
438 397
439int omap2_dflt_clk_enable(struct clk *clk); 398int omap2_dflt_clk_enable(struct clk_hw *hw);
440void omap2_dflt_clk_disable(struct clk *clk); 399void omap2_dflt_clk_disable(struct clk_hw *hw);
441void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, 400int omap2_dflt_clk_is_enabled(struct clk_hw *hw);
401void omap2_clk_dflt_find_companion(struct clk_hw_omap *clk,
402 void __iomem **other_reg,
442 u8 *other_bit); 403 u8 *other_bit);
443void omap2_clk_dflt_find_idlest(struct clk *clk, void __iomem **idlest_reg, 404void omap2_clk_dflt_find_idlest(struct clk_hw_omap *clk,
405 void __iomem **idlest_reg,
444 u8 *idlest_bit, u8 *idlest_val); 406 u8 *idlest_bit, u8 *idlest_val);
407void omap2_init_clk_hw_omap_clocks(struct clk *clk);
408int omap2_clk_enable_autoidle_all(void);
409int omap2_clk_disable_autoidle_all(void);
410void omap2_clk_enable_init_clocks(const char **clk_names, u8 num_clocks);
445int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name); 411int omap2_clk_switch_mpurate_at_boot(const char *mpurate_ck_name);
446void omap2_clk_print_new_rates(const char *hfclkin_ck_name, 412void omap2_clk_print_new_rates(const char *hfclkin_ck_name,
447 const char *core_ck_name, 413 const char *core_ck_name,
@@ -454,34 +420,43 @@ extern const struct clkops clkops_dummy;
454extern const struct clkops clkops_omap2_dflt; 420extern const struct clkops clkops_omap2_dflt;
455 421
456extern struct clk_functions omap2_clk_functions; 422extern struct clk_functions omap2_clk_functions;
457extern struct clk *vclk, *sclk;
458 423
459extern const struct clksel_rate gpt_32k_rates[]; 424extern const struct clksel_rate gpt_32k_rates[];
460extern const struct clksel_rate gpt_sys_rates[]; 425extern const struct clksel_rate gpt_sys_rates[];
461extern const struct clksel_rate gfx_l3_rates[]; 426extern const struct clksel_rate gfx_l3_rates[];
462extern const struct clksel_rate dsp_ick_rates[]; 427extern const struct clksel_rate dsp_ick_rates[];
428extern struct clk dummy_ck;
463 429
464extern const struct clkops clkops_omap2_iclk_dflt_wait; 430extern const struct clk_hw_omap_ops clkhwops_omap3_dpll;
465extern const struct clkops clkops_omap2_iclk_dflt; 431extern const struct clk_hw_omap_ops clkhwops_iclk_wait;
466extern const struct clkops clkops_omap2_iclk_idle_only; 432extern const struct clk_hw_omap_ops clkhwops_wait;
467extern const struct clkops clkops_omap2_mdmclk_dflt_wait; 433extern const struct clk_hw_omap_ops clkhwops_omap4_dpllmx;
468extern const struct clkops clkops_omap2xxx_dpll_ops; 434extern const struct clk_hw_omap_ops clkhwops_iclk;
469extern const struct clkops clkops_omap3_noncore_dpll_ops; 435extern const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait;
470extern const struct clkops clkops_omap3_core_dpll_ops; 436extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait;
471extern const struct clkops clkops_omap4_dpllmx_ops; 437extern const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait;
438extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait;
439extern const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait;
440extern const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait;
441extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait;
442extern const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait;
443extern const struct clk_hw_omap_ops clkhwops_apll54;
444extern const struct clk_hw_omap_ops clkhwops_apll96;
445extern const struct clk_hw_omap_ops clkhwops_omap2xxx_dpll;
446extern const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait;
472 447
473/* clksel_rate blocks shared between OMAP44xx and AM33xx */ 448/* clksel_rate blocks shared between OMAP44xx and AM33xx */
474extern const struct clksel_rate div_1_0_rates[]; 449extern const struct clksel_rate div_1_0_rates[];
450extern const struct clksel_rate div3_1to4_rates[];
475extern const struct clksel_rate div_1_1_rates[]; 451extern const struct clksel_rate div_1_1_rates[];
476extern const struct clksel_rate div_1_2_rates[]; 452extern const struct clksel_rate div_1_2_rates[];
477extern const struct clksel_rate div_1_3_rates[]; 453extern const struct clksel_rate div_1_3_rates[];
478extern const struct clksel_rate div_1_4_rates[]; 454extern const struct clksel_rate div_1_4_rates[];
479extern const struct clksel_rate div31_1to31_rates[]; 455extern const struct clksel_rate div31_1to31_rates[];
480 456
481/* clocks shared between various OMAP SoCs */
482extern struct clk virt_19200000_ck;
483extern struct clk virt_26000000_ck;
484
485extern int am33xx_clk_init(void); 457extern int am33xx_clk_init(void);
486 458
459extern int omap2_clkops_enable_clkdm(struct clk_hw *hw);
460extern void omap2_clkops_disable_clkdm(struct clk_hw *hw);
461
487#endif 462#endif
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
deleted file mode 100644
index ff47a6c2611d..000000000000
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ /dev/null
@@ -1,1986 +0,0 @@
1/*
2 * OMAP2420 clock data
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <linux/clk.h>
19#include <linux/list.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "clock.h"
24#include "clock2xxx.h"
25#include "opp2xxx.h"
26#include "cm2xxx_3xxx.h"
27#include "prm2xxx_3xxx.h"
28#include "prm-regbits-24xx.h"
29#include "cm-regbits-24xx.h"
30#include "sdrc.h"
31#include "control.h"
32
33#define OMAP_CM_REGADDR OMAP2420_CM_REGADDR
34
35/*
36 * 2420 clock tree.
37 *
38 * NOTE:In many cases here we are assigning a 'default' parent. In
39 * many cases the parent is selectable. The set parent calls will
40 * also switch sources.
41 *
42 * Several sources are given initial rates which may be wrong, this will
43 * be fixed up in the init func.
44 *
45 * Things are broadly separated below by clock domains. It is
46 * noteworthy that most peripherals have dependencies on multiple clock
47 * domains. Many get their interface clocks from the L4 domain, but get
48 * functional clocks from fixed sources or other core domain derived
49 * clocks.
50 */
51
52/* Base external input clocks */
53static struct clk func_32k_ck = {
54 .name = "func_32k_ck",
55 .ops = &clkops_null,
56 .rate = 32768,
57 .clkdm_name = "wkup_clkdm",
58};
59
60static struct clk secure_32k_ck = {
61 .name = "secure_32k_ck",
62 .ops = &clkops_null,
63 .rate = 32768,
64 .clkdm_name = "wkup_clkdm",
65};
66
67/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
68static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
69 .name = "osc_ck",
70 .ops = &clkops_oscck,
71 .clkdm_name = "wkup_clkdm",
72 .recalc = &omap2_osc_clk_recalc,
73};
74
75/* Without modem likely 12MHz, with modem likely 13MHz */
76static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
77 .name = "sys_ck", /* ~ ref_clk also */
78 .ops = &clkops_null,
79 .parent = &osc_ck,
80 .clkdm_name = "wkup_clkdm",
81 .recalc = &omap2xxx_sys_clk_recalc,
82};
83
84static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
85 .name = "alt_ck",
86 .ops = &clkops_null,
87 .rate = 54000000,
88 .clkdm_name = "wkup_clkdm",
89};
90
91/* Optional external clock input for McBSP CLKS */
92static struct clk mcbsp_clks = {
93 .name = "mcbsp_clks",
94 .ops = &clkops_null,
95};
96
97/*
98 * Analog domain root source clocks
99 */
100
101/* dpll_ck, is broken out in to special cases through clksel */
102/* REVISIT: Rate changes on dpll_ck trigger a full set change. ...
103 * deal with this
104 */
105
106static struct dpll_data dpll_dd = {
107 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
108 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
109 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
110 .clk_bypass = &sys_ck,
111 .clk_ref = &sys_ck,
112 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
113 .enable_mask = OMAP24XX_EN_DPLL_MASK,
114 .max_multiplier = 1023,
115 .min_divider = 1,
116 .max_divider = 16,
117};
118
119/*
120 * XXX Cannot add round_rate here yet, as this is still a composite clock,
121 * not just a DPLL
122 */
123static struct clk dpll_ck = {
124 .name = "dpll_ck",
125 .ops = &clkops_omap2xxx_dpll_ops,
126 .parent = &sys_ck, /* Can be func_32k also */
127 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm",
129 .recalc = &omap2_dpllcore_recalc,
130 .set_rate = &omap2_reprogram_dpllcore,
131};
132
133static struct clk apll96_ck = {
134 .name = "apll96_ck",
135 .ops = &clkops_apll96,
136 .parent = &sys_ck,
137 .rate = 96000000,
138 .flags = ENABLE_ON_INIT,
139 .clkdm_name = "wkup_clkdm",
140 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
141 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
142};
143
144static struct clk apll54_ck = {
145 .name = "apll54_ck",
146 .ops = &clkops_apll54,
147 .parent = &sys_ck,
148 .rate = 54000000,
149 .flags = ENABLE_ON_INIT,
150 .clkdm_name = "wkup_clkdm",
151 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
152 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
153};
154
155/*
156 * PRCM digital base sources
157 */
158
159/* func_54m_ck */
160
161static const struct clksel_rate func_54m_apll54_rates[] = {
162 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
163 { .div = 0 },
164};
165
166static const struct clksel_rate func_54m_alt_rates[] = {
167 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
168 { .div = 0 },
169};
170
171static const struct clksel func_54m_clksel[] = {
172 { .parent = &apll54_ck, .rates = func_54m_apll54_rates, },
173 { .parent = &alt_ck, .rates = func_54m_alt_rates, },
174 { .parent = NULL },
175};
176
177static struct clk func_54m_ck = {
178 .name = "func_54m_ck",
179 .ops = &clkops_null,
180 .parent = &apll54_ck, /* can also be alt_clk */
181 .clkdm_name = "wkup_clkdm",
182 .init = &omap2_init_clksel_parent,
183 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
184 .clksel_mask = OMAP24XX_54M_SOURCE_MASK,
185 .clksel = func_54m_clksel,
186 .recalc = &omap2_clksel_recalc,
187};
188
189static struct clk core_ck = {
190 .name = "core_ck",
191 .ops = &clkops_null,
192 .parent = &dpll_ck, /* can also be 32k */
193 .clkdm_name = "wkup_clkdm",
194 .recalc = &followparent_recalc,
195};
196
197static struct clk func_96m_ck = {
198 .name = "func_96m_ck",
199 .ops = &clkops_null,
200 .parent = &apll96_ck,
201 .clkdm_name = "wkup_clkdm",
202 .recalc = &followparent_recalc,
203};
204
205/* func_48m_ck */
206
207static const struct clksel_rate func_48m_apll96_rates[] = {
208 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
209 { .div = 0 },
210};
211
212static const struct clksel_rate func_48m_alt_rates[] = {
213 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
214 { .div = 0 },
215};
216
217static const struct clksel func_48m_clksel[] = {
218 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
219 { .parent = &alt_ck, .rates = func_48m_alt_rates },
220 { .parent = NULL }
221};
222
223static struct clk func_48m_ck = {
224 .name = "func_48m_ck",
225 .ops = &clkops_null,
226 .parent = &apll96_ck, /* 96M or Alt */
227 .clkdm_name = "wkup_clkdm",
228 .init = &omap2_init_clksel_parent,
229 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
230 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
231 .clksel = func_48m_clksel,
232 .recalc = &omap2_clksel_recalc,
233 .round_rate = &omap2_clksel_round_rate,
234 .set_rate = &omap2_clksel_set_rate
235};
236
237static struct clk func_12m_ck = {
238 .name = "func_12m_ck",
239 .ops = &clkops_null,
240 .parent = &func_48m_ck,
241 .fixed_div = 4,
242 .clkdm_name = "wkup_clkdm",
243 .recalc = &omap_fixed_divisor_recalc,
244};
245
246/* Secure timer, only available in secure mode */
247static struct clk wdt1_osc_ck = {
248 .name = "ck_wdt1_osc",
249 .ops = &clkops_null, /* RMK: missing? */
250 .parent = &osc_ck,
251 .recalc = &followparent_recalc,
252};
253
254/*
255 * The common_clkout* clksel_rate structs are common to
256 * sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src.
257 * sys_clkout2_* are 2420-only, so the
258 * clksel_rate flags fields are inaccurate for those clocks. This is
259 * harmless since access to those clocks are gated by the struct clk
260 * flags fields, which mark them as 2420-only.
261 */
262static const struct clksel_rate common_clkout_src_core_rates[] = {
263 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
264 { .div = 0 }
265};
266
267static const struct clksel_rate common_clkout_src_sys_rates[] = {
268 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
269 { .div = 0 }
270};
271
272static const struct clksel_rate common_clkout_src_96m_rates[] = {
273 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
274 { .div = 0 }
275};
276
277static const struct clksel_rate common_clkout_src_54m_rates[] = {
278 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
279 { .div = 0 }
280};
281
282static const struct clksel common_clkout_src_clksel[] = {
283 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
284 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
285 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
286 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
287 { .parent = NULL }
288};
289
290static struct clk sys_clkout_src = {
291 .name = "sys_clkout_src",
292 .ops = &clkops_omap2_dflt,
293 .parent = &func_54m_ck,
294 .clkdm_name = "wkup_clkdm",
295 .enable_reg = OMAP2420_PRCM_CLKOUT_CTRL,
296 .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
297 .init = &omap2_init_clksel_parent,
298 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
299 .clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK,
300 .clksel = common_clkout_src_clksel,
301 .recalc = &omap2_clksel_recalc,
302 .round_rate = &omap2_clksel_round_rate,
303 .set_rate = &omap2_clksel_set_rate
304};
305
306static const struct clksel_rate common_clkout_rates[] = {
307 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
308 { .div = 2, .val = 1, .flags = RATE_IN_24XX },
309 { .div = 4, .val = 2, .flags = RATE_IN_24XX },
310 { .div = 8, .val = 3, .flags = RATE_IN_24XX },
311 { .div = 16, .val = 4, .flags = RATE_IN_24XX },
312 { .div = 0 },
313};
314
315static const struct clksel sys_clkout_clksel[] = {
316 { .parent = &sys_clkout_src, .rates = common_clkout_rates },
317 { .parent = NULL }
318};
319
320static struct clk sys_clkout = {
321 .name = "sys_clkout",
322 .ops = &clkops_null,
323 .parent = &sys_clkout_src,
324 .clkdm_name = "wkup_clkdm",
325 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
326 .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK,
327 .clksel = sys_clkout_clksel,
328 .recalc = &omap2_clksel_recalc,
329 .round_rate = &omap2_clksel_round_rate,
330 .set_rate = &omap2_clksel_set_rate
331};
332
333/* In 2430, new in 2420 ES2 */
334static struct clk sys_clkout2_src = {
335 .name = "sys_clkout2_src",
336 .ops = &clkops_omap2_dflt,
337 .parent = &func_54m_ck,
338 .clkdm_name = "wkup_clkdm",
339 .enable_reg = OMAP2420_PRCM_CLKOUT_CTRL,
340 .enable_bit = OMAP2420_CLKOUT2_EN_SHIFT,
341 .init = &omap2_init_clksel_parent,
342 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
343 .clksel_mask = OMAP2420_CLKOUT2_SOURCE_MASK,
344 .clksel = common_clkout_src_clksel,
345 .recalc = &omap2_clksel_recalc,
346 .round_rate = &omap2_clksel_round_rate,
347 .set_rate = &omap2_clksel_set_rate
348};
349
350static const struct clksel sys_clkout2_clksel[] = {
351 { .parent = &sys_clkout2_src, .rates = common_clkout_rates },
352 { .parent = NULL }
353};
354
355/* In 2430, new in 2420 ES2 */
356static struct clk sys_clkout2 = {
357 .name = "sys_clkout2",
358 .ops = &clkops_null,
359 .parent = &sys_clkout2_src,
360 .clkdm_name = "wkup_clkdm",
361 .clksel_reg = OMAP2420_PRCM_CLKOUT_CTRL,
362 .clksel_mask = OMAP2420_CLKOUT2_DIV_MASK,
363 .clksel = sys_clkout2_clksel,
364 .recalc = &omap2_clksel_recalc,
365 .round_rate = &omap2_clksel_round_rate,
366 .set_rate = &omap2_clksel_set_rate
367};
368
369static struct clk emul_ck = {
370 .name = "emul_ck",
371 .ops = &clkops_omap2_dflt,
372 .parent = &func_54m_ck,
373 .clkdm_name = "wkup_clkdm",
374 .enable_reg = OMAP2420_PRCM_CLKEMUL_CTRL,
375 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
376 .recalc = &followparent_recalc,
377
378};
379
380/*
381 * MPU clock domain
382 * Clocks:
383 * MPU_FCLK, MPU_ICLK
384 * INT_M_FCLK, INT_M_I_CLK
385 *
386 * - Individual clocks are hardware managed.
387 * - Base divider comes from: CM_CLKSEL_MPU
388 *
389 */
390static const struct clksel_rate mpu_core_rates[] = {
391 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
392 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
393 { .div = 4, .val = 4, .flags = RATE_IN_242X },
394 { .div = 6, .val = 6, .flags = RATE_IN_242X },
395 { .div = 8, .val = 8, .flags = RATE_IN_242X },
396 { .div = 0 },
397};
398
399static const struct clksel mpu_clksel[] = {
400 { .parent = &core_ck, .rates = mpu_core_rates },
401 { .parent = NULL }
402};
403
404static struct clk mpu_ck = { /* Control cpu */
405 .name = "mpu_ck",
406 .ops = &clkops_null,
407 .parent = &core_ck,
408 .clkdm_name = "mpu_clkdm",
409 .init = &omap2_init_clksel_parent,
410 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
411 .clksel_mask = OMAP24XX_CLKSEL_MPU_MASK,
412 .clksel = mpu_clksel,
413 .recalc = &omap2_clksel_recalc,
414};
415
416/*
417 * DSP (2420-UMA+IVA1) clock domain
418 * Clocks:
419 * 2420: UMA_FCLK, UMA_ICLK, IVA_MPU, IVA_COP
420 *
421 * Won't be too specific here. The core clock comes into this block
422 * it is divided then tee'ed. One branch goes directly to xyz enable
423 * controls. The other branch gets further divided by 2 then possibly
424 * routed into a synchronizer and out of clocks abc.
425 */
426static const struct clksel_rate dsp_fck_core_rates[] = {
427 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
428 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
429 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
430 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
431 { .div = 6, .val = 6, .flags = RATE_IN_242X },
432 { .div = 8, .val = 8, .flags = RATE_IN_242X },
433 { .div = 12, .val = 12, .flags = RATE_IN_242X },
434 { .div = 0 },
435};
436
437static const struct clksel dsp_fck_clksel[] = {
438 { .parent = &core_ck, .rates = dsp_fck_core_rates },
439 { .parent = NULL }
440};
441
442static struct clk dsp_fck = {
443 .name = "dsp_fck",
444 .ops = &clkops_omap2_dflt_wait,
445 .parent = &core_ck,
446 .clkdm_name = "dsp_clkdm",
447 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
448 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
449 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
450 .clksel_mask = OMAP24XX_CLKSEL_DSP_MASK,
451 .clksel = dsp_fck_clksel,
452 .recalc = &omap2_clksel_recalc,
453};
454
455static const struct clksel dsp_ick_clksel[] = {
456 { .parent = &dsp_fck, .rates = dsp_ick_rates },
457 { .parent = NULL }
458};
459
460static struct clk dsp_ick = {
461 .name = "dsp_ick", /* apparently ipi and isp */
462 .ops = &clkops_omap2_iclk_dflt_wait,
463 .parent = &dsp_fck,
464 .clkdm_name = "dsp_clkdm",
465 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_ICLKEN),
466 .enable_bit = OMAP2420_EN_DSP_IPI_SHIFT, /* for ipi */
467 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
468 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
469 .clksel = dsp_ick_clksel,
470 .recalc = &omap2_clksel_recalc,
471};
472
473/*
474 * The IVA1 is an ARM7 core on the 2420 that has nothing to do with
475 * the C54x, but which is contained in the DSP powerdomain. Does not
476 * exist on later OMAPs.
477 */
478static struct clk iva1_ifck = {
479 .name = "iva1_ifck",
480 .ops = &clkops_omap2_dflt_wait,
481 .parent = &core_ck,
482 .clkdm_name = "iva1_clkdm",
483 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
484 .enable_bit = OMAP2420_EN_IVA_COP_SHIFT,
485 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
486 .clksel_mask = OMAP2420_CLKSEL_IVA_MASK,
487 .clksel = dsp_fck_clksel,
488 .recalc = &omap2_clksel_recalc,
489};
490
491/* IVA1 mpu/int/i/f clocks are /2 of parent */
492static struct clk iva1_mpu_int_ifck = {
493 .name = "iva1_mpu_int_ifck",
494 .ops = &clkops_omap2_dflt_wait,
495 .parent = &iva1_ifck,
496 .clkdm_name = "iva1_clkdm",
497 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
498 .enable_bit = OMAP2420_EN_IVA_MPU_SHIFT,
499 .fixed_div = 2,
500 .recalc = &omap_fixed_divisor_recalc,
501};
502
503/*
504 * L3 clock domain
505 * L3 clocks are used for both interface and functional clocks to
506 * multiple entities. Some of these clocks are completely managed
507 * by hardware, and some others allow software control. Hardware
508 * managed ones general are based on directly CLK_REQ signals and
509 * various auto idle settings. The functional spec sets many of these
510 * as 'tie-high' for their enables.
511 *
512 * I-CLOCKS:
513 * L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
514 * CAM, HS-USB.
515 * F-CLOCK
516 * SSI.
517 *
518 * GPMC memories and SDRC have timing and clock sensitive registers which
519 * may very well need notification when the clock changes. Currently for low
520 * operating points, these are taken care of in sleep.S.
521 */
522static const struct clksel_rate core_l3_core_rates[] = {
523 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
524 { .div = 2, .val = 2, .flags = RATE_IN_242X },
525 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
526 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
527 { .div = 8, .val = 8, .flags = RATE_IN_242X },
528 { .div = 12, .val = 12, .flags = RATE_IN_242X },
529 { .div = 16, .val = 16, .flags = RATE_IN_242X },
530 { .div = 0 }
531};
532
533static const struct clksel core_l3_clksel[] = {
534 { .parent = &core_ck, .rates = core_l3_core_rates },
535 { .parent = NULL }
536};
537
538static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */
539 .name = "core_l3_ck",
540 .ops = &clkops_null,
541 .parent = &core_ck,
542 .clkdm_name = "core_l3_clkdm",
543 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
544 .clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
545 .clksel = core_l3_clksel,
546 .recalc = &omap2_clksel_recalc,
547};
548
549/* usb_l4_ick */
550static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
551 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
552 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
553 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
554 { .div = 0 }
555};
556
557static const struct clksel usb_l4_ick_clksel[] = {
558 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
559 { .parent = NULL },
560};
561
562/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
563static struct clk usb_l4_ick = { /* FS-USB interface clock */
564 .name = "usb_l4_ick",
565 .ops = &clkops_omap2_iclk_dflt_wait,
566 .parent = &core_l3_ck,
567 .clkdm_name = "core_l4_clkdm",
568 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
569 .enable_bit = OMAP24XX_EN_USB_SHIFT,
570 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
571 .clksel_mask = OMAP24XX_CLKSEL_USB_MASK,
572 .clksel = usb_l4_ick_clksel,
573 .recalc = &omap2_clksel_recalc,
574};
575
576/*
577 * L4 clock management domain
578 *
579 * This domain contains lots of interface clocks from the L4 interface, some
580 * functional clocks. Fixed APLL functional source clocks are managed in
581 * this domain.
582 */
583static const struct clksel_rate l4_core_l3_rates[] = {
584 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
585 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
586 { .div = 0 }
587};
588
589static const struct clksel l4_clksel[] = {
590 { .parent = &core_l3_ck, .rates = l4_core_l3_rates },
591 { .parent = NULL }
592};
593
594static struct clk l4_ck = { /* used both as an ick and fck */
595 .name = "l4_ck",
596 .ops = &clkops_null,
597 .parent = &core_l3_ck,
598 .clkdm_name = "core_l4_clkdm",
599 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
600 .clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
601 .clksel = l4_clksel,
602 .recalc = &omap2_clksel_recalc,
603};
604
605/*
606 * SSI is in L3 management domain, its direct parent is core not l3,
607 * many core power domain entities are grouped into the L3 clock
608 * domain.
609 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
610 *
611 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
612 */
613static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
614 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
615 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
616 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
617 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
618 { .div = 6, .val = 6, .flags = RATE_IN_242X },
619 { .div = 8, .val = 8, .flags = RATE_IN_242X },
620 { .div = 0 }
621};
622
623static const struct clksel ssi_ssr_sst_fck_clksel[] = {
624 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
625 { .parent = NULL }
626};
627
628static struct clk ssi_ssr_sst_fck = {
629 .name = "ssi_fck",
630 .ops = &clkops_omap2_dflt_wait,
631 .parent = &core_ck,
632 .clkdm_name = "core_l3_clkdm",
633 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
634 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
635 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
636 .clksel_mask = OMAP24XX_CLKSEL_SSI_MASK,
637 .clksel = ssi_ssr_sst_fck_clksel,
638 .recalc = &omap2_clksel_recalc,
639};
640
641/*
642 * Presumably this is the same as SSI_ICLK.
643 * TRM contradicts itself on what clockdomain SSI_ICLK is in
644 */
645static struct clk ssi_l4_ick = {
646 .name = "ssi_l4_ick",
647 .ops = &clkops_omap2_iclk_dflt_wait,
648 .parent = &l4_ck,
649 .clkdm_name = "core_l4_clkdm",
650 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
651 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
652 .recalc = &followparent_recalc,
653};
654
655
656/*
657 * GFX clock domain
658 * Clocks:
659 * GFX_FCLK, GFX_ICLK
660 * GFX_CG1(2d), GFX_CG2(3d)
661 *
662 * GFX_FCLK runs from L3, and is divided by (1,2,3,4)
663 * The 2d and 3d clocks run at a hardware determined
664 * divided value of fclk.
665 *
666 */
667
668/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */
669static const struct clksel gfx_fck_clksel[] = {
670 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
671 { .parent = NULL },
672};
673
674static struct clk gfx_3d_fck = {
675 .name = "gfx_3d_fck",
676 .ops = &clkops_omap2_dflt_wait,
677 .parent = &core_l3_ck,
678 .clkdm_name = "gfx_clkdm",
679 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
680 .enable_bit = OMAP24XX_EN_3D_SHIFT,
681 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
682 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
683 .clksel = gfx_fck_clksel,
684 .recalc = &omap2_clksel_recalc,
685 .round_rate = &omap2_clksel_round_rate,
686 .set_rate = &omap2_clksel_set_rate
687};
688
689static struct clk gfx_2d_fck = {
690 .name = "gfx_2d_fck",
691 .ops = &clkops_omap2_dflt_wait,
692 .parent = &core_l3_ck,
693 .clkdm_name = "gfx_clkdm",
694 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
695 .enable_bit = OMAP24XX_EN_2D_SHIFT,
696 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
697 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
698 .clksel = gfx_fck_clksel,
699 .recalc = &omap2_clksel_recalc,
700};
701
702/* This interface clock does not have a CM_AUTOIDLE bit */
703static struct clk gfx_ick = {
704 .name = "gfx_ick", /* From l3 */
705 .ops = &clkops_omap2_dflt_wait,
706 .parent = &core_l3_ck,
707 .clkdm_name = "gfx_clkdm",
708 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
709 .enable_bit = OMAP_EN_GFX_SHIFT,
710 .recalc = &followparent_recalc,
711};
712
713/*
714 * DSS clock domain
715 * CLOCKs:
716 * DSS_L4_ICLK, DSS_L3_ICLK,
717 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
718 *
719 * DSS is both initiator and target.
720 */
721/* XXX Add RATE_NOT_VALIDATED */
722
723static const struct clksel_rate dss1_fck_sys_rates[] = {
724 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
725 { .div = 0 }
726};
727
728static const struct clksel_rate dss1_fck_core_rates[] = {
729 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
730 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
731 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
732 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
733 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
734 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
735 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
736 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
737 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
738 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
739 { .div = 0 }
740};
741
742static const struct clksel dss1_fck_clksel[] = {
743 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
744 { .parent = &core_ck, .rates = dss1_fck_core_rates },
745 { .parent = NULL },
746};
747
748static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
749 .name = "dss_ick",
750 .ops = &clkops_omap2_iclk_dflt,
751 .parent = &l4_ck, /* really both l3 and l4 */
752 .clkdm_name = "dss_clkdm",
753 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
754 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
755 .recalc = &followparent_recalc,
756};
757
758static struct clk dss1_fck = {
759 .name = "dss1_fck",
760 .ops = &clkops_omap2_dflt,
761 .parent = &core_ck, /* Core or sys */
762 .clkdm_name = "dss_clkdm",
763 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
764 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
765 .init = &omap2_init_clksel_parent,
766 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
767 .clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK,
768 .clksel = dss1_fck_clksel,
769 .recalc = &omap2_clksel_recalc,
770};
771
772static const struct clksel_rate dss2_fck_sys_rates[] = {
773 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
774 { .div = 0 }
775};
776
777static const struct clksel_rate dss2_fck_48m_rates[] = {
778 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
779 { .div = 0 }
780};
781
782static const struct clksel dss2_fck_clksel[] = {
783 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
784 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
785 { .parent = NULL }
786};
787
788static struct clk dss2_fck = { /* Alt clk used in power management */
789 .name = "dss2_fck",
790 .ops = &clkops_omap2_dflt,
791 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */
792 .clkdm_name = "dss_clkdm",
793 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
794 .enable_bit = OMAP24XX_EN_DSS2_SHIFT,
795 .init = &omap2_init_clksel_parent,
796 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
797 .clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK,
798 .clksel = dss2_fck_clksel,
799 .recalc = &omap2_clksel_recalc,
800};
801
802static struct clk dss_54m_fck = { /* Alt clk used in power management */
803 .name = "dss_54m_fck", /* 54m tv clk */
804 .ops = &clkops_omap2_dflt_wait,
805 .parent = &func_54m_ck,
806 .clkdm_name = "dss_clkdm",
807 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
808 .enable_bit = OMAP24XX_EN_TV_SHIFT,
809 .recalc = &followparent_recalc,
810};
811
812static struct clk wu_l4_ick = {
813 .name = "wu_l4_ick",
814 .ops = &clkops_null,
815 .parent = &sys_ck,
816 .clkdm_name = "wkup_clkdm",
817 .recalc = &followparent_recalc,
818};
819
820/*
821 * CORE power domain ICLK & FCLK defines.
822 * Many of the these can have more than one possible parent. Entries
823 * here will likely have an L4 interface parent, and may have multiple
824 * functional clock parents.
825 */
826static const struct clksel_rate gpt_alt_rates[] = {
827 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
828 { .div = 0 }
829};
830
831static const struct clksel omap24xx_gpt_clksel[] = {
832 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
833 { .parent = &sys_ck, .rates = gpt_sys_rates },
834 { .parent = &alt_ck, .rates = gpt_alt_rates },
835 { .parent = NULL },
836};
837
838static struct clk gpt1_ick = {
839 .name = "gpt1_ick",
840 .ops = &clkops_omap2_iclk_dflt_wait,
841 .parent = &wu_l4_ick,
842 .clkdm_name = "wkup_clkdm",
843 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
844 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
845 .recalc = &followparent_recalc,
846};
847
848static struct clk gpt1_fck = {
849 .name = "gpt1_fck",
850 .ops = &clkops_omap2_dflt_wait,
851 .parent = &func_32k_ck,
852 .clkdm_name = "core_l4_clkdm",
853 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
854 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
855 .init = &omap2_init_clksel_parent,
856 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
857 .clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK,
858 .clksel = omap24xx_gpt_clksel,
859 .recalc = &omap2_clksel_recalc,
860 .round_rate = &omap2_clksel_round_rate,
861 .set_rate = &omap2_clksel_set_rate
862};
863
864static struct clk gpt2_ick = {
865 .name = "gpt2_ick",
866 .ops = &clkops_omap2_iclk_dflt_wait,
867 .parent = &l4_ck,
868 .clkdm_name = "core_l4_clkdm",
869 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
870 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
871 .recalc = &followparent_recalc,
872};
873
874static struct clk gpt2_fck = {
875 .name = "gpt2_fck",
876 .ops = &clkops_omap2_dflt_wait,
877 .parent = &func_32k_ck,
878 .clkdm_name = "core_l4_clkdm",
879 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
880 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
881 .init = &omap2_init_clksel_parent,
882 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
883 .clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK,
884 .clksel = omap24xx_gpt_clksel,
885 .recalc = &omap2_clksel_recalc,
886};
887
888static struct clk gpt3_ick = {
889 .name = "gpt3_ick",
890 .ops = &clkops_omap2_iclk_dflt_wait,
891 .parent = &l4_ck,
892 .clkdm_name = "core_l4_clkdm",
893 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
894 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
895 .recalc = &followparent_recalc,
896};
897
898static struct clk gpt3_fck = {
899 .name = "gpt3_fck",
900 .ops = &clkops_omap2_dflt_wait,
901 .parent = &func_32k_ck,
902 .clkdm_name = "core_l4_clkdm",
903 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
904 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
905 .init = &omap2_init_clksel_parent,
906 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
907 .clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK,
908 .clksel = omap24xx_gpt_clksel,
909 .recalc = &omap2_clksel_recalc,
910};
911
912static struct clk gpt4_ick = {
913 .name = "gpt4_ick",
914 .ops = &clkops_omap2_iclk_dflt_wait,
915 .parent = &l4_ck,
916 .clkdm_name = "core_l4_clkdm",
917 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
918 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
919 .recalc = &followparent_recalc,
920};
921
922static struct clk gpt4_fck = {
923 .name = "gpt4_fck",
924 .ops = &clkops_omap2_dflt_wait,
925 .parent = &func_32k_ck,
926 .clkdm_name = "core_l4_clkdm",
927 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
928 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
929 .init = &omap2_init_clksel_parent,
930 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
931 .clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK,
932 .clksel = omap24xx_gpt_clksel,
933 .recalc = &omap2_clksel_recalc,
934};
935
936static struct clk gpt5_ick = {
937 .name = "gpt5_ick",
938 .ops = &clkops_omap2_iclk_dflt_wait,
939 .parent = &l4_ck,
940 .clkdm_name = "core_l4_clkdm",
941 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
942 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
943 .recalc = &followparent_recalc,
944};
945
946static struct clk gpt5_fck = {
947 .name = "gpt5_fck",
948 .ops = &clkops_omap2_dflt_wait,
949 .parent = &func_32k_ck,
950 .clkdm_name = "core_l4_clkdm",
951 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
952 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
953 .init = &omap2_init_clksel_parent,
954 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
955 .clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK,
956 .clksel = omap24xx_gpt_clksel,
957 .recalc = &omap2_clksel_recalc,
958};
959
960static struct clk gpt6_ick = {
961 .name = "gpt6_ick",
962 .ops = &clkops_omap2_iclk_dflt_wait,
963 .parent = &l4_ck,
964 .clkdm_name = "core_l4_clkdm",
965 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
966 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
967 .recalc = &followparent_recalc,
968};
969
970static struct clk gpt6_fck = {
971 .name = "gpt6_fck",
972 .ops = &clkops_omap2_dflt_wait,
973 .parent = &func_32k_ck,
974 .clkdm_name = "core_l4_clkdm",
975 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
976 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
977 .init = &omap2_init_clksel_parent,
978 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
979 .clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK,
980 .clksel = omap24xx_gpt_clksel,
981 .recalc = &omap2_clksel_recalc,
982};
983
984static struct clk gpt7_ick = {
985 .name = "gpt7_ick",
986 .ops = &clkops_omap2_iclk_dflt_wait,
987 .parent = &l4_ck,
988 .clkdm_name = "core_l4_clkdm",
989 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
990 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
991 .recalc = &followparent_recalc,
992};
993
994static struct clk gpt7_fck = {
995 .name = "gpt7_fck",
996 .ops = &clkops_omap2_dflt_wait,
997 .parent = &func_32k_ck,
998 .clkdm_name = "core_l4_clkdm",
999 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1000 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
1001 .init = &omap2_init_clksel_parent,
1002 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1003 .clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK,
1004 .clksel = omap24xx_gpt_clksel,
1005 .recalc = &omap2_clksel_recalc,
1006};
1007
1008static struct clk gpt8_ick = {
1009 .name = "gpt8_ick",
1010 .ops = &clkops_omap2_iclk_dflt_wait,
1011 .parent = &l4_ck,
1012 .clkdm_name = "core_l4_clkdm",
1013 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1014 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1015 .recalc = &followparent_recalc,
1016};
1017
1018static struct clk gpt8_fck = {
1019 .name = "gpt8_fck",
1020 .ops = &clkops_omap2_dflt_wait,
1021 .parent = &func_32k_ck,
1022 .clkdm_name = "core_l4_clkdm",
1023 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1024 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1025 .init = &omap2_init_clksel_parent,
1026 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1027 .clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK,
1028 .clksel = omap24xx_gpt_clksel,
1029 .recalc = &omap2_clksel_recalc,
1030};
1031
1032static struct clk gpt9_ick = {
1033 .name = "gpt9_ick",
1034 .ops = &clkops_omap2_iclk_dflt_wait,
1035 .parent = &l4_ck,
1036 .clkdm_name = "core_l4_clkdm",
1037 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1038 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1039 .recalc = &followparent_recalc,
1040};
1041
1042static struct clk gpt9_fck = {
1043 .name = "gpt9_fck",
1044 .ops = &clkops_omap2_dflt_wait,
1045 .parent = &func_32k_ck,
1046 .clkdm_name = "core_l4_clkdm",
1047 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1048 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1049 .init = &omap2_init_clksel_parent,
1050 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1051 .clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK,
1052 .clksel = omap24xx_gpt_clksel,
1053 .recalc = &omap2_clksel_recalc,
1054};
1055
1056static struct clk gpt10_ick = {
1057 .name = "gpt10_ick",
1058 .ops = &clkops_omap2_iclk_dflt_wait,
1059 .parent = &l4_ck,
1060 .clkdm_name = "core_l4_clkdm",
1061 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1062 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1063 .recalc = &followparent_recalc,
1064};
1065
1066static struct clk gpt10_fck = {
1067 .name = "gpt10_fck",
1068 .ops = &clkops_omap2_dflt_wait,
1069 .parent = &func_32k_ck,
1070 .clkdm_name = "core_l4_clkdm",
1071 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1072 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1073 .init = &omap2_init_clksel_parent,
1074 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1075 .clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK,
1076 .clksel = omap24xx_gpt_clksel,
1077 .recalc = &omap2_clksel_recalc,
1078};
1079
1080static struct clk gpt11_ick = {
1081 .name = "gpt11_ick",
1082 .ops = &clkops_omap2_iclk_dflt_wait,
1083 .parent = &l4_ck,
1084 .clkdm_name = "core_l4_clkdm",
1085 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1086 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1087 .recalc = &followparent_recalc,
1088};
1089
1090static struct clk gpt11_fck = {
1091 .name = "gpt11_fck",
1092 .ops = &clkops_omap2_dflt_wait,
1093 .parent = &func_32k_ck,
1094 .clkdm_name = "core_l4_clkdm",
1095 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1096 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1097 .init = &omap2_init_clksel_parent,
1098 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1099 .clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK,
1100 .clksel = omap24xx_gpt_clksel,
1101 .recalc = &omap2_clksel_recalc,
1102};
1103
1104static struct clk gpt12_ick = {
1105 .name = "gpt12_ick",
1106 .ops = &clkops_omap2_iclk_dflt_wait,
1107 .parent = &l4_ck,
1108 .clkdm_name = "core_l4_clkdm",
1109 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1110 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1111 .recalc = &followparent_recalc,
1112};
1113
1114static struct clk gpt12_fck = {
1115 .name = "gpt12_fck",
1116 .ops = &clkops_omap2_dflt_wait,
1117 .parent = &secure_32k_ck,
1118 .clkdm_name = "core_l4_clkdm",
1119 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1120 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1121 .init = &omap2_init_clksel_parent,
1122 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1123 .clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK,
1124 .clksel = omap24xx_gpt_clksel,
1125 .recalc = &omap2_clksel_recalc,
1126};
1127
1128static struct clk mcbsp1_ick = {
1129 .name = "mcbsp1_ick",
1130 .ops = &clkops_omap2_iclk_dflt_wait,
1131 .parent = &l4_ck,
1132 .clkdm_name = "core_l4_clkdm",
1133 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1134 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1135 .recalc = &followparent_recalc,
1136};
1137
1138static const struct clksel_rate common_mcbsp_96m_rates[] = {
1139 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1140 { .div = 0 }
1141};
1142
1143static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1144 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1145 { .div = 0 }
1146};
1147
1148static const struct clksel mcbsp_fck_clksel[] = {
1149 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1150 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1151 { .parent = NULL }
1152};
1153
1154static struct clk mcbsp1_fck = {
1155 .name = "mcbsp1_fck",
1156 .ops = &clkops_omap2_dflt_wait,
1157 .parent = &func_96m_ck,
1158 .init = &omap2_init_clksel_parent,
1159 .clkdm_name = "core_l4_clkdm",
1160 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1161 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1162 .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1163 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1164 .clksel = mcbsp_fck_clksel,
1165 .recalc = &omap2_clksel_recalc,
1166};
1167
1168static struct clk mcbsp2_ick = {
1169 .name = "mcbsp2_ick",
1170 .ops = &clkops_omap2_iclk_dflt_wait,
1171 .parent = &l4_ck,
1172 .clkdm_name = "core_l4_clkdm",
1173 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1174 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1175 .recalc = &followparent_recalc,
1176};
1177
1178static struct clk mcbsp2_fck = {
1179 .name = "mcbsp2_fck",
1180 .ops = &clkops_omap2_dflt_wait,
1181 .parent = &func_96m_ck,
1182 .init = &omap2_init_clksel_parent,
1183 .clkdm_name = "core_l4_clkdm",
1184 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1185 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1186 .clksel_reg = OMAP242X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1187 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
1188 .clksel = mcbsp_fck_clksel,
1189 .recalc = &omap2_clksel_recalc,
1190};
1191
1192static struct clk mcspi1_ick = {
1193 .name = "mcspi1_ick",
1194 .ops = &clkops_omap2_iclk_dflt_wait,
1195 .parent = &l4_ck,
1196 .clkdm_name = "core_l4_clkdm",
1197 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1198 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1199 .recalc = &followparent_recalc,
1200};
1201
1202static struct clk mcspi1_fck = {
1203 .name = "mcspi1_fck",
1204 .ops = &clkops_omap2_dflt_wait,
1205 .parent = &func_48m_ck,
1206 .clkdm_name = "core_l4_clkdm",
1207 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1208 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1209 .recalc = &followparent_recalc,
1210};
1211
1212static struct clk mcspi2_ick = {
1213 .name = "mcspi2_ick",
1214 .ops = &clkops_omap2_iclk_dflt_wait,
1215 .parent = &l4_ck,
1216 .clkdm_name = "core_l4_clkdm",
1217 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1218 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1219 .recalc = &followparent_recalc,
1220};
1221
1222static struct clk mcspi2_fck = {
1223 .name = "mcspi2_fck",
1224 .ops = &clkops_omap2_dflt_wait,
1225 .parent = &func_48m_ck,
1226 .clkdm_name = "core_l4_clkdm",
1227 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1228 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1229 .recalc = &followparent_recalc,
1230};
1231
1232static struct clk uart1_ick = {
1233 .name = "uart1_ick",
1234 .ops = &clkops_omap2_iclk_dflt_wait,
1235 .parent = &l4_ck,
1236 .clkdm_name = "core_l4_clkdm",
1237 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1238 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1239 .recalc = &followparent_recalc,
1240};
1241
1242static struct clk uart1_fck = {
1243 .name = "uart1_fck",
1244 .ops = &clkops_omap2_dflt_wait,
1245 .parent = &func_48m_ck,
1246 .clkdm_name = "core_l4_clkdm",
1247 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1248 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1249 .recalc = &followparent_recalc,
1250};
1251
1252static struct clk uart2_ick = {
1253 .name = "uart2_ick",
1254 .ops = &clkops_omap2_iclk_dflt_wait,
1255 .parent = &l4_ck,
1256 .clkdm_name = "core_l4_clkdm",
1257 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1258 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1259 .recalc = &followparent_recalc,
1260};
1261
1262static struct clk uart2_fck = {
1263 .name = "uart2_fck",
1264 .ops = &clkops_omap2_dflt_wait,
1265 .parent = &func_48m_ck,
1266 .clkdm_name = "core_l4_clkdm",
1267 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1268 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1269 .recalc = &followparent_recalc,
1270};
1271
1272static struct clk uart3_ick = {
1273 .name = "uart3_ick",
1274 .ops = &clkops_omap2_iclk_dflt_wait,
1275 .parent = &l4_ck,
1276 .clkdm_name = "core_l4_clkdm",
1277 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1278 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1279 .recalc = &followparent_recalc,
1280};
1281
1282static struct clk uart3_fck = {
1283 .name = "uart3_fck",
1284 .ops = &clkops_omap2_dflt_wait,
1285 .parent = &func_48m_ck,
1286 .clkdm_name = "core_l4_clkdm",
1287 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1288 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1289 .recalc = &followparent_recalc,
1290};
1291
1292static struct clk gpios_ick = {
1293 .name = "gpios_ick",
1294 .ops = &clkops_omap2_iclk_dflt_wait,
1295 .parent = &wu_l4_ick,
1296 .clkdm_name = "wkup_clkdm",
1297 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1298 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1299 .recalc = &followparent_recalc,
1300};
1301
1302static struct clk gpios_fck = {
1303 .name = "gpios_fck",
1304 .ops = &clkops_omap2_dflt_wait,
1305 .parent = &func_32k_ck,
1306 .clkdm_name = "wkup_clkdm",
1307 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1308 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1309 .recalc = &followparent_recalc,
1310};
1311
1312static struct clk mpu_wdt_ick = {
1313 .name = "mpu_wdt_ick",
1314 .ops = &clkops_omap2_iclk_dflt_wait,
1315 .parent = &wu_l4_ick,
1316 .clkdm_name = "wkup_clkdm",
1317 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1318 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1319 .recalc = &followparent_recalc,
1320};
1321
1322static struct clk mpu_wdt_fck = {
1323 .name = "mpu_wdt_fck",
1324 .ops = &clkops_omap2_dflt_wait,
1325 .parent = &func_32k_ck,
1326 .clkdm_name = "wkup_clkdm",
1327 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1328 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1329 .recalc = &followparent_recalc,
1330};
1331
1332static struct clk sync_32k_ick = {
1333 .name = "sync_32k_ick",
1334 .ops = &clkops_omap2_iclk_dflt_wait,
1335 .parent = &wu_l4_ick,
1336 .clkdm_name = "wkup_clkdm",
1337 .flags = ENABLE_ON_INIT,
1338 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1339 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1340 .recalc = &followparent_recalc,
1341};
1342
1343static struct clk wdt1_ick = {
1344 .name = "wdt1_ick",
1345 .ops = &clkops_omap2_iclk_dflt_wait,
1346 .parent = &wu_l4_ick,
1347 .clkdm_name = "wkup_clkdm",
1348 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1349 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1350 .recalc = &followparent_recalc,
1351};
1352
1353static struct clk omapctrl_ick = {
1354 .name = "omapctrl_ick",
1355 .ops = &clkops_omap2_iclk_dflt_wait,
1356 .parent = &wu_l4_ick,
1357 .clkdm_name = "wkup_clkdm",
1358 .flags = ENABLE_ON_INIT,
1359 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1360 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1361 .recalc = &followparent_recalc,
1362};
1363
1364static struct clk cam_ick = {
1365 .name = "cam_ick",
1366 .ops = &clkops_omap2_iclk_dflt,
1367 .parent = &l4_ck,
1368 .clkdm_name = "core_l4_clkdm",
1369 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1370 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1371 .recalc = &followparent_recalc,
1372};
1373
1374/*
1375 * cam_fck controls both CAM_MCLK and CAM_FCLK. It should probably be
1376 * split into two separate clocks, since the parent clocks are different
1377 * and the clockdomains are also different.
1378 */
1379static struct clk cam_fck = {
1380 .name = "cam_fck",
1381 .ops = &clkops_omap2_dflt,
1382 .parent = &func_96m_ck,
1383 .clkdm_name = "core_l3_clkdm",
1384 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1385 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1386 .recalc = &followparent_recalc,
1387};
1388
1389static struct clk mailboxes_ick = {
1390 .name = "mailboxes_ick",
1391 .ops = &clkops_omap2_iclk_dflt_wait,
1392 .parent = &l4_ck,
1393 .clkdm_name = "core_l4_clkdm",
1394 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1395 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1396 .recalc = &followparent_recalc,
1397};
1398
1399static struct clk wdt4_ick = {
1400 .name = "wdt4_ick",
1401 .ops = &clkops_omap2_iclk_dflt_wait,
1402 .parent = &l4_ck,
1403 .clkdm_name = "core_l4_clkdm",
1404 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1405 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1406 .recalc = &followparent_recalc,
1407};
1408
1409static struct clk wdt4_fck = {
1410 .name = "wdt4_fck",
1411 .ops = &clkops_omap2_dflt_wait,
1412 .parent = &func_32k_ck,
1413 .clkdm_name = "core_l4_clkdm",
1414 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1415 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1416 .recalc = &followparent_recalc,
1417};
1418
1419static struct clk wdt3_ick = {
1420 .name = "wdt3_ick",
1421 .ops = &clkops_omap2_iclk_dflt_wait,
1422 .parent = &l4_ck,
1423 .clkdm_name = "core_l4_clkdm",
1424 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1425 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1426 .recalc = &followparent_recalc,
1427};
1428
1429static struct clk wdt3_fck = {
1430 .name = "wdt3_fck",
1431 .ops = &clkops_omap2_dflt_wait,
1432 .parent = &func_32k_ck,
1433 .clkdm_name = "core_l4_clkdm",
1434 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1435 .enable_bit = OMAP2420_EN_WDT3_SHIFT,
1436 .recalc = &followparent_recalc,
1437};
1438
1439static struct clk mspro_ick = {
1440 .name = "mspro_ick",
1441 .ops = &clkops_omap2_iclk_dflt_wait,
1442 .parent = &l4_ck,
1443 .clkdm_name = "core_l4_clkdm",
1444 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1445 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1446 .recalc = &followparent_recalc,
1447};
1448
1449static struct clk mspro_fck = {
1450 .name = "mspro_fck",
1451 .ops = &clkops_omap2_dflt_wait,
1452 .parent = &func_96m_ck,
1453 .clkdm_name = "core_l4_clkdm",
1454 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1455 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1456 .recalc = &followparent_recalc,
1457};
1458
1459static struct clk mmc_ick = {
1460 .name = "mmc_ick",
1461 .ops = &clkops_omap2_iclk_dflt_wait,
1462 .parent = &l4_ck,
1463 .clkdm_name = "core_l4_clkdm",
1464 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1465 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1466 .recalc = &followparent_recalc,
1467};
1468
1469static struct clk mmc_fck = {
1470 .name = "mmc_fck",
1471 .ops = &clkops_omap2_dflt_wait,
1472 .parent = &func_96m_ck,
1473 .clkdm_name = "core_l4_clkdm",
1474 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1475 .enable_bit = OMAP2420_EN_MMC_SHIFT,
1476 .recalc = &followparent_recalc,
1477};
1478
1479static struct clk fac_ick = {
1480 .name = "fac_ick",
1481 .ops = &clkops_omap2_iclk_dflt_wait,
1482 .parent = &l4_ck,
1483 .clkdm_name = "core_l4_clkdm",
1484 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1485 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1486 .recalc = &followparent_recalc,
1487};
1488
1489static struct clk fac_fck = {
1490 .name = "fac_fck",
1491 .ops = &clkops_omap2_dflt_wait,
1492 .parent = &func_12m_ck,
1493 .clkdm_name = "core_l4_clkdm",
1494 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1495 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1496 .recalc = &followparent_recalc,
1497};
1498
1499static struct clk eac_ick = {
1500 .name = "eac_ick",
1501 .ops = &clkops_omap2_iclk_dflt_wait,
1502 .parent = &l4_ck,
1503 .clkdm_name = "core_l4_clkdm",
1504 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1505 .enable_bit = OMAP2420_EN_EAC_SHIFT,
1506 .recalc = &followparent_recalc,
1507};
1508
1509static struct clk eac_fck = {
1510 .name = "eac_fck",
1511 .ops = &clkops_omap2_dflt_wait,
1512 .parent = &func_96m_ck,
1513 .clkdm_name = "core_l4_clkdm",
1514 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1515 .enable_bit = OMAP2420_EN_EAC_SHIFT,
1516 .recalc = &followparent_recalc,
1517};
1518
1519static struct clk hdq_ick = {
1520 .name = "hdq_ick",
1521 .ops = &clkops_omap2_iclk_dflt_wait,
1522 .parent = &l4_ck,
1523 .clkdm_name = "core_l4_clkdm",
1524 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1525 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1526 .recalc = &followparent_recalc,
1527};
1528
1529static struct clk hdq_fck = {
1530 .name = "hdq_fck",
1531 .ops = &clkops_omap2_dflt_wait,
1532 .parent = &func_12m_ck,
1533 .clkdm_name = "core_l4_clkdm",
1534 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1535 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1536 .recalc = &followparent_recalc,
1537};
1538
1539static struct clk i2c2_ick = {
1540 .name = "i2c2_ick",
1541 .ops = &clkops_omap2_iclk_dflt_wait,
1542 .parent = &l4_ck,
1543 .clkdm_name = "core_l4_clkdm",
1544 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1545 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1546 .recalc = &followparent_recalc,
1547};
1548
1549static struct clk i2c2_fck = {
1550 .name = "i2c2_fck",
1551 .ops = &clkops_omap2_dflt_wait,
1552 .parent = &func_12m_ck,
1553 .clkdm_name = "core_l4_clkdm",
1554 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1555 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1556 .recalc = &followparent_recalc,
1557};
1558
1559static struct clk i2c1_ick = {
1560 .name = "i2c1_ick",
1561 .ops = &clkops_omap2_iclk_dflt_wait,
1562 .parent = &l4_ck,
1563 .clkdm_name = "core_l4_clkdm",
1564 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1565 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1566 .recalc = &followparent_recalc,
1567};
1568
1569static struct clk i2c1_fck = {
1570 .name = "i2c1_fck",
1571 .ops = &clkops_omap2_dflt_wait,
1572 .parent = &func_12m_ck,
1573 .clkdm_name = "core_l4_clkdm",
1574 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1575 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1576 .recalc = &followparent_recalc,
1577};
1578
1579/*
1580 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1581 * accesses derived from this data.
1582 */
1583static struct clk gpmc_fck = {
1584 .name = "gpmc_fck",
1585 .ops = &clkops_omap2_iclk_idle_only,
1586 .parent = &core_l3_ck,
1587 .flags = ENABLE_ON_INIT,
1588 .clkdm_name = "core_l3_clkdm",
1589 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1590 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
1591 .recalc = &followparent_recalc,
1592};
1593
1594static struct clk sdma_fck = {
1595 .name = "sdma_fck",
1596 .ops = &clkops_null, /* RMK: missing? */
1597 .parent = &core_l3_ck,
1598 .clkdm_name = "core_l3_clkdm",
1599 .recalc = &followparent_recalc,
1600};
1601
1602/*
1603 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1604 * accesses derived from this data.
1605 */
1606static struct clk sdma_ick = {
1607 .name = "sdma_ick",
1608 .ops = &clkops_omap2_iclk_idle_only,
1609 .parent = &core_l3_ck,
1610 .clkdm_name = "core_l3_clkdm",
1611 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1612 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1613 .recalc = &followparent_recalc,
1614};
1615
1616/*
1617 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1618 * accesses derived from this data.
1619 */
1620static struct clk sdrc_ick = {
1621 .name = "sdrc_ick",
1622 .ops = &clkops_omap2_iclk_idle_only,
1623 .parent = &core_l3_ck,
1624 .flags = ENABLE_ON_INIT,
1625 .clkdm_name = "core_l3_clkdm",
1626 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1627 .enable_bit = OMAP24XX_AUTO_SDRC_SHIFT,
1628 .recalc = &followparent_recalc,
1629};
1630
1631static struct clk vlynq_ick = {
1632 .name = "vlynq_ick",
1633 .ops = &clkops_omap2_iclk_dflt_wait,
1634 .parent = &core_l3_ck,
1635 .clkdm_name = "core_l3_clkdm",
1636 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1637 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1638 .recalc = &followparent_recalc,
1639};
1640
1641static const struct clksel_rate vlynq_fck_96m_rates[] = {
1642 { .div = 1, .val = 0, .flags = RATE_IN_242X },
1643 { .div = 0 }
1644};
1645
1646static const struct clksel_rate vlynq_fck_core_rates[] = {
1647 { .div = 1, .val = 1, .flags = RATE_IN_242X },
1648 { .div = 2, .val = 2, .flags = RATE_IN_242X },
1649 { .div = 3, .val = 3, .flags = RATE_IN_242X },
1650 { .div = 4, .val = 4, .flags = RATE_IN_242X },
1651 { .div = 6, .val = 6, .flags = RATE_IN_242X },
1652 { .div = 8, .val = 8, .flags = RATE_IN_242X },
1653 { .div = 9, .val = 9, .flags = RATE_IN_242X },
1654 { .div = 12, .val = 12, .flags = RATE_IN_242X },
1655 { .div = 16, .val = 16, .flags = RATE_IN_242X },
1656 { .div = 18, .val = 18, .flags = RATE_IN_242X },
1657 { .div = 0 }
1658};
1659
1660static const struct clksel vlynq_fck_clksel[] = {
1661 { .parent = &func_96m_ck, .rates = vlynq_fck_96m_rates },
1662 { .parent = &core_ck, .rates = vlynq_fck_core_rates },
1663 { .parent = NULL }
1664};
1665
1666static struct clk vlynq_fck = {
1667 .name = "vlynq_fck",
1668 .ops = &clkops_omap2_dflt_wait,
1669 .parent = &func_96m_ck,
1670 .clkdm_name = "core_l3_clkdm",
1671 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1672 .enable_bit = OMAP2420_EN_VLYNQ_SHIFT,
1673 .init = &omap2_init_clksel_parent,
1674 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
1675 .clksel_mask = OMAP2420_CLKSEL_VLYNQ_MASK,
1676 .clksel = vlynq_fck_clksel,
1677 .recalc = &omap2_clksel_recalc,
1678};
1679
1680static struct clk des_ick = {
1681 .name = "des_ick",
1682 .ops = &clkops_omap2_iclk_dflt_wait,
1683 .parent = &l4_ck,
1684 .clkdm_name = "core_l4_clkdm",
1685 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1686 .enable_bit = OMAP24XX_EN_DES_SHIFT,
1687 .recalc = &followparent_recalc,
1688};
1689
1690static struct clk sha_ick = {
1691 .name = "sha_ick",
1692 .ops = &clkops_omap2_iclk_dflt_wait,
1693 .parent = &l4_ck,
1694 .clkdm_name = "core_l4_clkdm",
1695 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1696 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1697 .recalc = &followparent_recalc,
1698};
1699
1700static struct clk rng_ick = {
1701 .name = "rng_ick",
1702 .ops = &clkops_omap2_iclk_dflt_wait,
1703 .parent = &l4_ck,
1704 .clkdm_name = "core_l4_clkdm",
1705 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1706 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1707 .recalc = &followparent_recalc,
1708};
1709
1710static struct clk aes_ick = {
1711 .name = "aes_ick",
1712 .ops = &clkops_omap2_iclk_dflt_wait,
1713 .parent = &l4_ck,
1714 .clkdm_name = "core_l4_clkdm",
1715 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1716 .enable_bit = OMAP24XX_EN_AES_SHIFT,
1717 .recalc = &followparent_recalc,
1718};
1719
1720static struct clk pka_ick = {
1721 .name = "pka_ick",
1722 .ops = &clkops_omap2_iclk_dflt_wait,
1723 .parent = &l4_ck,
1724 .clkdm_name = "core_l4_clkdm",
1725 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1726 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1727 .recalc = &followparent_recalc,
1728};
1729
1730static struct clk usb_fck = {
1731 .name = "usb_fck",
1732 .ops = &clkops_omap2_dflt_wait,
1733 .parent = &func_48m_ck,
1734 .clkdm_name = "core_l3_clkdm",
1735 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1736 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1737 .recalc = &followparent_recalc,
1738};
1739
1740/*
1741 * This clock is a composite clock which does entire set changes then
1742 * forces a rebalance. It keys on the MPU speed, but it really could
1743 * be any key speed part of a set in the rate table.
1744 *
1745 * to really change a set, you need memory table sets which get changed
1746 * in sram, pre-notifiers & post notifiers, changing the top set, without
1747 * having low level display recalc's won't work... this is why dpm notifiers
1748 * work, isr's off, walk a list of clocks already _off_ and not messing with
1749 * the bus.
1750 *
1751 * This clock should have no parent. It embodies the entire upper level
1752 * active set. A parent will mess up some of the init also.
1753 */
1754static struct clk virt_prcm_set = {
1755 .name = "virt_prcm_set",
1756 .ops = &clkops_null,
1757 .parent = &mpu_ck, /* Indexed by mpu speed, no parent */
1758 .recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */
1759 .set_rate = &omap2_select_table_rate,
1760 .round_rate = &omap2_round_to_table_rate,
1761};
1762
1763
1764/*
1765 * clkdev integration
1766 */
1767
1768static struct omap_clk omap2420_clks[] = {
1769 /* external root sources */
1770 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_242X),
1771 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_242X),
1772 CLK(NULL, "osc_ck", &osc_ck, CK_242X),
1773 CLK(NULL, "sys_ck", &sys_ck, CK_242X),
1774 CLK(NULL, "alt_ck", &alt_ck, CK_242X),
1775 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_242X),
1776 /* internal analog sources */
1777 CLK(NULL, "dpll_ck", &dpll_ck, CK_242X),
1778 CLK(NULL, "apll96_ck", &apll96_ck, CK_242X),
1779 CLK(NULL, "apll54_ck", &apll54_ck, CK_242X),
1780 /* internal prcm root sources */
1781 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_242X),
1782 CLK(NULL, "core_ck", &core_ck, CK_242X),
1783 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_242X),
1784 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_242X),
1785 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_242X),
1786 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_242X),
1787 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_242X),
1788 CLK(NULL, "sys_clkout", &sys_clkout, CK_242X),
1789 CLK(NULL, "sys_clkout2_src", &sys_clkout2_src, CK_242X),
1790 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_242X),
1791 CLK(NULL, "emul_ck", &emul_ck, CK_242X),
1792 /* mpu domain clocks */
1793 CLK(NULL, "mpu_ck", &mpu_ck, CK_242X),
1794 /* dsp domain clocks */
1795 CLK(NULL, "dsp_fck", &dsp_fck, CK_242X),
1796 CLK(NULL, "dsp_ick", &dsp_ick, CK_242X),
1797 CLK(NULL, "iva1_ifck", &iva1_ifck, CK_242X),
1798 CLK(NULL, "iva1_mpu_int_ifck", &iva1_mpu_int_ifck, CK_242X),
1799 /* GFX domain clocks */
1800 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_242X),
1801 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_242X),
1802 CLK(NULL, "gfx_ick", &gfx_ick, CK_242X),
1803 /* DSS domain clocks */
1804 CLK("omapdss_dss", "ick", &dss_ick, CK_242X),
1805 CLK(NULL, "dss_ick", &dss_ick, CK_242X),
1806 CLK(NULL, "dss1_fck", &dss1_fck, CK_242X),
1807 CLK(NULL, "dss2_fck", &dss2_fck, CK_242X),
1808 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_242X),
1809 /* L3 domain clocks */
1810 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_242X),
1811 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_242X),
1812 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_242X),
1813 /* L4 domain clocks */
1814 CLK(NULL, "l4_ck", &l4_ck, CK_242X),
1815 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_242X),
1816 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_242X),
1817 /* virtual meta-group clock */
1818 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_242X),
1819 /* general l4 interface ck, multi-parent functional clk */
1820 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_242X),
1821 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_242X),
1822 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_242X),
1823 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_242X),
1824 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_242X),
1825 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_242X),
1826 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_242X),
1827 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_242X),
1828 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_242X),
1829 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_242X),
1830 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_242X),
1831 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_242X),
1832 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_242X),
1833 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_242X),
1834 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_242X),
1835 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_242X),
1836 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_242X),
1837 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_242X),
1838 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_242X),
1839 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_242X),
1840 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_242X),
1841 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_242X),
1842 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_242X),
1843 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_242X),
1844 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_242X),
1845 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_242X),
1846 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_242X),
1847 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_242X),
1848 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_242X),
1849 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_242X),
1850 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_242X),
1851 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_242X),
1852 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_242X),
1853 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_242X),
1854 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_242X),
1855 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_242X),
1856 CLK(NULL, "uart1_ick", &uart1_ick, CK_242X),
1857 CLK(NULL, "uart1_fck", &uart1_fck, CK_242X),
1858 CLK(NULL, "uart2_ick", &uart2_ick, CK_242X),
1859 CLK(NULL, "uart2_fck", &uart2_fck, CK_242X),
1860 CLK(NULL, "uart3_ick", &uart3_ick, CK_242X),
1861 CLK(NULL, "uart3_fck", &uart3_fck, CK_242X),
1862 CLK(NULL, "gpios_ick", &gpios_ick, CK_242X),
1863 CLK(NULL, "gpios_fck", &gpios_fck, CK_242X),
1864 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_242X),
1865 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_242X),
1866 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_242X),
1867 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_242X),
1868 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_242X),
1869 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_242X),
1870 CLK("omap24xxcam", "fck", &cam_fck, CK_242X),
1871 CLK(NULL, "cam_fck", &cam_fck, CK_242X),
1872 CLK("omap24xxcam", "ick", &cam_ick, CK_242X),
1873 CLK(NULL, "cam_ick", &cam_ick, CK_242X),
1874 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_242X),
1875 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_242X),
1876 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_242X),
1877 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_242X),
1878 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_242X),
1879 CLK(NULL, "mspro_ick", &mspro_ick, CK_242X),
1880 CLK(NULL, "mspro_fck", &mspro_fck, CK_242X),
1881 CLK("mmci-omap.0", "ick", &mmc_ick, CK_242X),
1882 CLK(NULL, "mmc_ick", &mmc_ick, CK_242X),
1883 CLK("mmci-omap.0", "fck", &mmc_fck, CK_242X),
1884 CLK(NULL, "mmc_fck", &mmc_fck, CK_242X),
1885 CLK(NULL, "fac_ick", &fac_ick, CK_242X),
1886 CLK(NULL, "fac_fck", &fac_fck, CK_242X),
1887 CLK(NULL, "eac_ick", &eac_ick, CK_242X),
1888 CLK(NULL, "eac_fck", &eac_fck, CK_242X),
1889 CLK("omap_hdq.0", "ick", &hdq_ick, CK_242X),
1890 CLK(NULL, "hdq_ick", &hdq_ick, CK_242X),
1891 CLK("omap_hdq.0", "fck", &hdq_fck, CK_242X),
1892 CLK(NULL, "hdq_fck", &hdq_fck, CK_242X),
1893 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_242X),
1894 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_242X),
1895 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_242X),
1896 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_242X),
1897 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_242X),
1898 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_242X),
1899 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_242X),
1900 CLK(NULL, "sdma_fck", &sdma_fck, CK_242X),
1901 CLK(NULL, "sdma_ick", &sdma_ick, CK_242X),
1902 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_242X),
1903 CLK(NULL, "vlynq_ick", &vlynq_ick, CK_242X),
1904 CLK(NULL, "vlynq_fck", &vlynq_fck, CK_242X),
1905 CLK(NULL, "des_ick", &des_ick, CK_242X),
1906 CLK("omap-sham", "ick", &sha_ick, CK_242X),
1907 CLK(NULL, "sha_ick", &sha_ick, CK_242X),
1908 CLK("omap_rng", "ick", &rng_ick, CK_242X),
1909 CLK(NULL, "rng_ick", &rng_ick, CK_242X),
1910 CLK("omap-aes", "ick", &aes_ick, CK_242X),
1911 CLK(NULL, "aes_ick", &aes_ick, CK_242X),
1912 CLK(NULL, "pka_ick", &pka_ick, CK_242X),
1913 CLK(NULL, "usb_fck", &usb_fck, CK_242X),
1914 CLK("musb-hdrc", "fck", &osc_ck, CK_242X),
1915 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_242X),
1916 CLK(NULL, "timer_sys_ck", &sys_ck, CK_242X),
1917 CLK(NULL, "timer_ext_ck", &alt_ck, CK_242X),
1918 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_242X),
1919};
1920
1921/*
1922 * init code
1923 */
1924
1925int __init omap2420_clk_init(void)
1926{
1927 const struct prcm_config *prcm;
1928 struct omap_clk *c;
1929 u32 clkrate;
1930
1931 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1932 cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
1933 cpu_mask = RATE_IN_242X;
1934 rate_table = omap2420_rate_table;
1935
1936 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1937 c++)
1938 clk_preinit(c->lk.clk);
1939
1940 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
1941 propagate_rate(&osc_ck);
1942 sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
1943 propagate_rate(&sys_ck);
1944
1945 for (c = omap2420_clks; c < omap2420_clks + ARRAY_SIZE(omap2420_clks);
1946 c++) {
1947 clkdev_add(&c->lk);
1948 clk_register(c->lk.clk);
1949 omap2_init_clk_clkdm(c->lk.clk);
1950 }
1951
1952 /* Disable autoidle on all clocks; let the PM code enable it later */
1953 omap_clk_disable_autoidle_all();
1954
1955 /* Check the MPU rate set by bootloader */
1956 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
1957 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
1958 if (!(prcm->flags & cpu_mask))
1959 continue;
1960 if (prcm->xtal_speed != sys_ck.rate)
1961 continue;
1962 if (prcm->dpll_speed <= clkrate)
1963 break;
1964 }
1965 curr_prcm_set = prcm;
1966
1967 recalculate_root_clocks();
1968
1969 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
1970 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
1971 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
1972
1973 /*
1974 * Only enable those clocks we will need, let the drivers
1975 * enable other clocks as necessary
1976 */
1977 clk_enable_init_clocks();
1978
1979 /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
1980 vclk = clk_get(NULL, "virt_prcm_set");
1981 sclk = clk_get(NULL, "sys_ck");
1982 dclk = clk_get(NULL, "dpll_ck");
1983
1984 return 0;
1985}
1986
diff --git a/arch/arm/mach-omap2/clock2430.c b/arch/arm/mach-omap2/clock2430.c
index 850f83e8954f..cef0c8d1de52 100644
--- a/arch/arm/mach-omap2/clock2430.c
+++ b/arch/arm/mach-omap2/clock2430.c
@@ -25,7 +25,7 @@
25#include "iomap.h" 25#include "iomap.h"
26#include "clock.h" 26#include "clock.h"
27#include "clock2xxx.h" 27#include "clock2xxx.h"
28#include "cm2xxx_3xxx.h" 28#include "cm2xxx.h"
29#include "cm-regbits-24xx.h" 29#include "cm-regbits-24xx.h"
30 30
31/** 31/**
@@ -40,7 +40,7 @@
40 * passes back the correct CM_IDLEST register address for I2CHS 40 * passes back the correct CM_IDLEST register address for I2CHS
41 * modules. No return value. 41 * modules. No return value.
42 */ 42 */
43static void omap2430_clk_i2chs_find_idlest(struct clk *clk, 43static void omap2430_clk_i2chs_find_idlest(struct clk_hw_omap *clk,
44 void __iomem **idlest_reg, 44 void __iomem **idlest_reg,
45 u8 *idlest_bit, 45 u8 *idlest_bit,
46 u8 *idlest_val) 46 u8 *idlest_val)
@@ -51,9 +51,7 @@ static void omap2430_clk_i2chs_find_idlest(struct clk *clk,
51} 51}
52 52
53/* 2430 I2CHS has non-standard IDLEST register */ 53/* 2430 I2CHS has non-standard IDLEST register */
54const struct clkops clkops_omap2430_i2chs_wait = { 54const struct clk_hw_omap_ops clkhwops_omap2430_i2chs_wait = {
55 .enable = omap2_dflt_clk_enable,
56 .disable = omap2_dflt_clk_disable,
57 .find_idlest = omap2430_clk_i2chs_find_idlest, 55 .find_idlest = omap2430_clk_i2chs_find_idlest,
58 .find_companion = omap2_clk_dflt_find_companion, 56 .find_companion = omap2_clk_dflt_find_companion,
59}; 57};
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
deleted file mode 100644
index cab8e9c52d6e..000000000000
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ /dev/null
@@ -1,2085 +0,0 @@
1/*
2 * OMAP2430 clock data
3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation
6 *
7 * Contacts:
8 * Richard Woodruff <r-woodruff2@ti.com>
9 * Paul Walmsley
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/clk.h>
18#include <linux/list.h>
19
20#include "soc.h"
21#include "iomap.h"
22#include "clock.h"
23#include "clock2xxx.h"
24#include "opp2xxx.h"
25#include "cm2xxx_3xxx.h"
26#include "prm2xxx_3xxx.h"
27#include "prm-regbits-24xx.h"
28#include "cm-regbits-24xx.h"
29#include "sdrc.h"
30#include "control.h"
31
32#define OMAP_CM_REGADDR OMAP2430_CM_REGADDR
33
34/*
35 * 2430 clock tree.
36 *
37 * NOTE:In many cases here we are assigning a 'default' parent. In
38 * many cases the parent is selectable. The set parent calls will
39 * also switch sources.
40 *
41 * Several sources are given initial rates which may be wrong, this will
42 * be fixed up in the init func.
43 *
44 * Things are broadly separated below by clock domains. It is
45 * noteworthy that most peripherals have dependencies on multiple clock
46 * domains. Many get their interface clocks from the L4 domain, but get
47 * functional clocks from fixed sources or other core domain derived
48 * clocks.
49 */
50
51/* Base external input clocks */
52static struct clk func_32k_ck = {
53 .name = "func_32k_ck",
54 .ops = &clkops_null,
55 .rate = 32768,
56 .clkdm_name = "wkup_clkdm",
57};
58
59static struct clk secure_32k_ck = {
60 .name = "secure_32k_ck",
61 .ops = &clkops_null,
62 .rate = 32768,
63 .clkdm_name = "wkup_clkdm",
64};
65
66/* Typical 12/13MHz in standalone mode, will be 26Mhz in chassis mode */
67static struct clk osc_ck = { /* (*12, *13, 19.2, *26, 38.4)MHz */
68 .name = "osc_ck",
69 .ops = &clkops_oscck,
70 .clkdm_name = "wkup_clkdm",
71 .recalc = &omap2_osc_clk_recalc,
72};
73
74/* Without modem likely 12MHz, with modem likely 13MHz */
75static struct clk sys_ck = { /* (*12, *13, 19.2, 26, 38.4)MHz */
76 .name = "sys_ck", /* ~ ref_clk also */
77 .ops = &clkops_null,
78 .parent = &osc_ck,
79 .clkdm_name = "wkup_clkdm",
80 .recalc = &omap2xxx_sys_clk_recalc,
81};
82
83static struct clk alt_ck = { /* Typical 54M or 48M, may not exist */
84 .name = "alt_ck",
85 .ops = &clkops_null,
86 .rate = 54000000,
87 .clkdm_name = "wkup_clkdm",
88};
89
90/* Optional external clock input for McBSP CLKS */
91static struct clk mcbsp_clks = {
92 .name = "mcbsp_clks",
93 .ops = &clkops_null,
94};
95
96/*
97 * Analog domain root source clocks
98 */
99
100/* dpll_ck, is broken out in to special cases through clksel */
101/* REVISIT: Rate changes on dpll_ck trigger a full set change. ...
102 * deal with this
103 */
104
105static struct dpll_data dpll_dd = {
106 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
107 .mult_mask = OMAP24XX_DPLL_MULT_MASK,
108 .div1_mask = OMAP24XX_DPLL_DIV_MASK,
109 .clk_bypass = &sys_ck,
110 .clk_ref = &sys_ck,
111 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
112 .enable_mask = OMAP24XX_EN_DPLL_MASK,
113 .max_multiplier = 1023,
114 .min_divider = 1,
115 .max_divider = 16,
116};
117
118/*
119 * XXX Cannot add round_rate here yet, as this is still a composite clock,
120 * not just a DPLL
121 */
122static struct clk dpll_ck = {
123 .name = "dpll_ck",
124 .ops = &clkops_omap2xxx_dpll_ops,
125 .parent = &sys_ck, /* Can be func_32k also */
126 .dpll_data = &dpll_dd,
127 .clkdm_name = "wkup_clkdm",
128 .recalc = &omap2_dpllcore_recalc,
129 .set_rate = &omap2_reprogram_dpllcore,
130};
131
132static struct clk apll96_ck = {
133 .name = "apll96_ck",
134 .ops = &clkops_apll96,
135 .parent = &sys_ck,
136 .rate = 96000000,
137 .flags = ENABLE_ON_INIT,
138 .clkdm_name = "wkup_clkdm",
139 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
140 .enable_bit = OMAP24XX_EN_96M_PLL_SHIFT,
141};
142
143static struct clk apll54_ck = {
144 .name = "apll54_ck",
145 .ops = &clkops_apll54,
146 .parent = &sys_ck,
147 .rate = 54000000,
148 .flags = ENABLE_ON_INIT,
149 .clkdm_name = "wkup_clkdm",
150 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
151 .enable_bit = OMAP24XX_EN_54M_PLL_SHIFT,
152};
153
154/*
155 * PRCM digital base sources
156 */
157
158/* func_54m_ck */
159
160static const struct clksel_rate func_54m_apll54_rates[] = {
161 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
162 { .div = 0 },
163};
164
165static const struct clksel_rate func_54m_alt_rates[] = {
166 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
167 { .div = 0 },
168};
169
170static const struct clksel func_54m_clksel[] = {
171 { .parent = &apll54_ck, .rates = func_54m_apll54_rates, },
172 { .parent = &alt_ck, .rates = func_54m_alt_rates, },
173 { .parent = NULL },
174};
175
176static struct clk func_54m_ck = {
177 .name = "func_54m_ck",
178 .ops = &clkops_null,
179 .parent = &apll54_ck, /* can also be alt_clk */
180 .clkdm_name = "wkup_clkdm",
181 .init = &omap2_init_clksel_parent,
182 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
183 .clksel_mask = OMAP24XX_54M_SOURCE_MASK,
184 .clksel = func_54m_clksel,
185 .recalc = &omap2_clksel_recalc,
186};
187
188static struct clk core_ck = {
189 .name = "core_ck",
190 .ops = &clkops_null,
191 .parent = &dpll_ck, /* can also be 32k */
192 .clkdm_name = "wkup_clkdm",
193 .recalc = &followparent_recalc,
194};
195
196/* func_96m_ck */
197static const struct clksel_rate func_96m_apll96_rates[] = {
198 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
199 { .div = 0 },
200};
201
202static const struct clksel_rate func_96m_alt_rates[] = {
203 { .div = 1, .val = 1, .flags = RATE_IN_243X },
204 { .div = 0 },
205};
206
207static const struct clksel func_96m_clksel[] = {
208 { .parent = &apll96_ck, .rates = func_96m_apll96_rates },
209 { .parent = &alt_ck, .rates = func_96m_alt_rates },
210 { .parent = NULL }
211};
212
213static struct clk func_96m_ck = {
214 .name = "func_96m_ck",
215 .ops = &clkops_null,
216 .parent = &apll96_ck,
217 .clkdm_name = "wkup_clkdm",
218 .init = &omap2_init_clksel_parent,
219 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
220 .clksel_mask = OMAP2430_96M_SOURCE_MASK,
221 .clksel = func_96m_clksel,
222 .recalc = &omap2_clksel_recalc,
223};
224
225/* func_48m_ck */
226
227static const struct clksel_rate func_48m_apll96_rates[] = {
228 { .div = 2, .val = 0, .flags = RATE_IN_24XX },
229 { .div = 0 },
230};
231
232static const struct clksel_rate func_48m_alt_rates[] = {
233 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
234 { .div = 0 },
235};
236
237static const struct clksel func_48m_clksel[] = {
238 { .parent = &apll96_ck, .rates = func_48m_apll96_rates },
239 { .parent = &alt_ck, .rates = func_48m_alt_rates },
240 { .parent = NULL }
241};
242
243static struct clk func_48m_ck = {
244 .name = "func_48m_ck",
245 .ops = &clkops_null,
246 .parent = &apll96_ck, /* 96M or Alt */
247 .clkdm_name = "wkup_clkdm",
248 .init = &omap2_init_clksel_parent,
249 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
250 .clksel_mask = OMAP24XX_48M_SOURCE_MASK,
251 .clksel = func_48m_clksel,
252 .recalc = &omap2_clksel_recalc,
253 .round_rate = &omap2_clksel_round_rate,
254 .set_rate = &omap2_clksel_set_rate
255};
256
257static struct clk func_12m_ck = {
258 .name = "func_12m_ck",
259 .ops = &clkops_null,
260 .parent = &func_48m_ck,
261 .fixed_div = 4,
262 .clkdm_name = "wkup_clkdm",
263 .recalc = &omap_fixed_divisor_recalc,
264};
265
266/* Secure timer, only available in secure mode */
267static struct clk wdt1_osc_ck = {
268 .name = "ck_wdt1_osc",
269 .ops = &clkops_null, /* RMK: missing? */
270 .parent = &osc_ck,
271 .recalc = &followparent_recalc,
272};
273
274/*
275 * The common_clkout* clksel_rate structs are common to
276 * sys_clkout, sys_clkout_src, sys_clkout2, and sys_clkout2_src.
277 * sys_clkout2_* are 2420-only, so the
278 * clksel_rate flags fields are inaccurate for those clocks. This is
279 * harmless since access to those clocks are gated by the struct clk
280 * flags fields, which mark them as 2420-only.
281 */
282static const struct clksel_rate common_clkout_src_core_rates[] = {
283 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
284 { .div = 0 }
285};
286
287static const struct clksel_rate common_clkout_src_sys_rates[] = {
288 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
289 { .div = 0 }
290};
291
292static const struct clksel_rate common_clkout_src_96m_rates[] = {
293 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
294 { .div = 0 }
295};
296
297static const struct clksel_rate common_clkout_src_54m_rates[] = {
298 { .div = 1, .val = 3, .flags = RATE_IN_24XX },
299 { .div = 0 }
300};
301
302static const struct clksel common_clkout_src_clksel[] = {
303 { .parent = &core_ck, .rates = common_clkout_src_core_rates },
304 { .parent = &sys_ck, .rates = common_clkout_src_sys_rates },
305 { .parent = &func_96m_ck, .rates = common_clkout_src_96m_rates },
306 { .parent = &func_54m_ck, .rates = common_clkout_src_54m_rates },
307 { .parent = NULL }
308};
309
310static struct clk sys_clkout_src = {
311 .name = "sys_clkout_src",
312 .ops = &clkops_omap2_dflt,
313 .parent = &func_54m_ck,
314 .clkdm_name = "wkup_clkdm",
315 .enable_reg = OMAP2430_PRCM_CLKOUT_CTRL,
316 .enable_bit = OMAP24XX_CLKOUT_EN_SHIFT,
317 .init = &omap2_init_clksel_parent,
318 .clksel_reg = OMAP2430_PRCM_CLKOUT_CTRL,
319 .clksel_mask = OMAP24XX_CLKOUT_SOURCE_MASK,
320 .clksel = common_clkout_src_clksel,
321 .recalc = &omap2_clksel_recalc,
322 .round_rate = &omap2_clksel_round_rate,
323 .set_rate = &omap2_clksel_set_rate
324};
325
326static const struct clksel_rate common_clkout_rates[] = {
327 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
328 { .div = 2, .val = 1, .flags = RATE_IN_24XX },
329 { .div = 4, .val = 2, .flags = RATE_IN_24XX },
330 { .div = 8, .val = 3, .flags = RATE_IN_24XX },
331 { .div = 16, .val = 4, .flags = RATE_IN_24XX },
332 { .div = 0 },
333};
334
335static const struct clksel sys_clkout_clksel[] = {
336 { .parent = &sys_clkout_src, .rates = common_clkout_rates },
337 { .parent = NULL }
338};
339
340static struct clk sys_clkout = {
341 .name = "sys_clkout",
342 .ops = &clkops_null,
343 .parent = &sys_clkout_src,
344 .clkdm_name = "wkup_clkdm",
345 .clksel_reg = OMAP2430_PRCM_CLKOUT_CTRL,
346 .clksel_mask = OMAP24XX_CLKOUT_DIV_MASK,
347 .clksel = sys_clkout_clksel,
348 .recalc = &omap2_clksel_recalc,
349 .round_rate = &omap2_clksel_round_rate,
350 .set_rate = &omap2_clksel_set_rate
351};
352
353static struct clk emul_ck = {
354 .name = "emul_ck",
355 .ops = &clkops_omap2_dflt,
356 .parent = &func_54m_ck,
357 .clkdm_name = "wkup_clkdm",
358 .enable_reg = OMAP2430_PRCM_CLKEMUL_CTRL,
359 .enable_bit = OMAP24XX_EMULATION_EN_SHIFT,
360 .recalc = &followparent_recalc,
361
362};
363
364/*
365 * MPU clock domain
366 * Clocks:
367 * MPU_FCLK, MPU_ICLK
368 * INT_M_FCLK, INT_M_I_CLK
369 *
370 * - Individual clocks are hardware managed.
371 * - Base divider comes from: CM_CLKSEL_MPU
372 *
373 */
374static const struct clksel_rate mpu_core_rates[] = {
375 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
376 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
377 { .div = 0 },
378};
379
380static const struct clksel mpu_clksel[] = {
381 { .parent = &core_ck, .rates = mpu_core_rates },
382 { .parent = NULL }
383};
384
385static struct clk mpu_ck = { /* Control cpu */
386 .name = "mpu_ck",
387 .ops = &clkops_null,
388 .parent = &core_ck,
389 .clkdm_name = "mpu_clkdm",
390 .init = &omap2_init_clksel_parent,
391 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, CM_CLKSEL),
392 .clksel_mask = OMAP24XX_CLKSEL_MPU_MASK,
393 .clksel = mpu_clksel,
394 .recalc = &omap2_clksel_recalc,
395};
396
397/*
398 * DSP (2430-IVA2.1) clock domain
399 * Clocks:
400 * 2430: IVA2.1_FCLK (really just DSP_FCLK), IVA2.1_ICLK
401 *
402 * Won't be too specific here. The core clock comes into this block
403 * it is divided then tee'ed. One branch goes directly to xyz enable
404 * controls. The other branch gets further divided by 2 then possibly
405 * routed into a synchronizer and out of clocks abc.
406 */
407static const struct clksel_rate dsp_fck_core_rates[] = {
408 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
409 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
410 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
411 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
412 { .div = 0 },
413};
414
415static const struct clksel dsp_fck_clksel[] = {
416 { .parent = &core_ck, .rates = dsp_fck_core_rates },
417 { .parent = NULL }
418};
419
420static struct clk dsp_fck = {
421 .name = "dsp_fck",
422 .ops = &clkops_omap2_dflt_wait,
423 .parent = &core_ck,
424 .clkdm_name = "dsp_clkdm",
425 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
426 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
427 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
428 .clksel_mask = OMAP24XX_CLKSEL_DSP_MASK,
429 .clksel = dsp_fck_clksel,
430 .recalc = &omap2_clksel_recalc,
431};
432
433static const struct clksel dsp_ick_clksel[] = {
434 { .parent = &dsp_fck, .rates = dsp_ick_rates },
435 { .parent = NULL }
436};
437
438/* 2430 only - EN_DSP controls both dsp fclk and iclk on 2430 */
439static struct clk iva2_1_ick = {
440 .name = "iva2_1_ick",
441 .ops = &clkops_omap2_dflt_wait,
442 .parent = &dsp_fck,
443 .clkdm_name = "dsp_clkdm",
444 .enable_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_FCLKEN),
445 .enable_bit = OMAP24XX_CM_FCLKEN_DSP_EN_DSP_SHIFT,
446 .clksel_reg = OMAP_CM_REGADDR(OMAP24XX_DSP_MOD, CM_CLKSEL),
447 .clksel_mask = OMAP24XX_CLKSEL_DSP_IF_MASK,
448 .clksel = dsp_ick_clksel,
449 .recalc = &omap2_clksel_recalc,
450};
451
452/*
453 * L3 clock domain
454 * L3 clocks are used for both interface and functional clocks to
455 * multiple entities. Some of these clocks are completely managed
456 * by hardware, and some others allow software control. Hardware
457 * managed ones general are based on directly CLK_REQ signals and
458 * various auto idle settings. The functional spec sets many of these
459 * as 'tie-high' for their enables.
460 *
461 * I-CLOCKS:
462 * L3-Interconnect, SMS, GPMC, SDRC, OCM_RAM, OCM_ROM, SDMA
463 * CAM, HS-USB.
464 * F-CLOCK
465 * SSI.
466 *
467 * GPMC memories and SDRC have timing and clock sensitive registers which
468 * may very well need notification when the clock changes. Currently for low
469 * operating points, these are taken care of in sleep.S.
470 */
471static const struct clksel_rate core_l3_core_rates[] = {
472 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
473 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
474 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
475 { .div = 0 }
476};
477
478static const struct clksel core_l3_clksel[] = {
479 { .parent = &core_ck, .rates = core_l3_core_rates },
480 { .parent = NULL }
481};
482
483static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */
484 .name = "core_l3_ck",
485 .ops = &clkops_null,
486 .parent = &core_ck,
487 .clkdm_name = "core_l3_clkdm",
488 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
489 .clksel_mask = OMAP24XX_CLKSEL_L3_MASK,
490 .clksel = core_l3_clksel,
491 .recalc = &omap2_clksel_recalc,
492};
493
494/* usb_l4_ick */
495static const struct clksel_rate usb_l4_ick_core_l3_rates[] = {
496 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
497 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
498 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
499 { .div = 0 }
500};
501
502static const struct clksel usb_l4_ick_clksel[] = {
503 { .parent = &core_l3_ck, .rates = usb_l4_ick_core_l3_rates },
504 { .parent = NULL },
505};
506
507/* It is unclear from TRM whether usb_l4_ick is really in L3 or L4 clkdm */
508static struct clk usb_l4_ick = { /* FS-USB interface clock */
509 .name = "usb_l4_ick",
510 .ops = &clkops_omap2_iclk_dflt_wait,
511 .parent = &core_l3_ck,
512 .clkdm_name = "core_l4_clkdm",
513 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
514 .enable_bit = OMAP24XX_EN_USB_SHIFT,
515 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
516 .clksel_mask = OMAP24XX_CLKSEL_USB_MASK,
517 .clksel = usb_l4_ick_clksel,
518 .recalc = &omap2_clksel_recalc,
519};
520
521/*
522 * L4 clock management domain
523 *
524 * This domain contains lots of interface clocks from the L4 interface, some
525 * functional clocks. Fixed APLL functional source clocks are managed in
526 * this domain.
527 */
528static const struct clksel_rate l4_core_l3_rates[] = {
529 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
530 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
531 { .div = 0 }
532};
533
534static const struct clksel l4_clksel[] = {
535 { .parent = &core_l3_ck, .rates = l4_core_l3_rates },
536 { .parent = NULL }
537};
538
539static struct clk l4_ck = { /* used both as an ick and fck */
540 .name = "l4_ck",
541 .ops = &clkops_null,
542 .parent = &core_l3_ck,
543 .clkdm_name = "core_l4_clkdm",
544 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
545 .clksel_mask = OMAP24XX_CLKSEL_L4_MASK,
546 .clksel = l4_clksel,
547 .recalc = &omap2_clksel_recalc,
548};
549
550/*
551 * SSI is in L3 management domain, its direct parent is core not l3,
552 * many core power domain entities are grouped into the L3 clock
553 * domain.
554 * SSI_SSR_FCLK, SSI_SST_FCLK, SSI_L4_ICLK
555 *
556 * ssr = core/1/2/3/4/5, sst = 1/2 ssr.
557 */
558static const struct clksel_rate ssi_ssr_sst_fck_core_rates[] = {
559 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
560 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
561 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
562 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
563 { .div = 5, .val = 5, .flags = RATE_IN_243X },
564 { .div = 0 }
565};
566
567static const struct clksel ssi_ssr_sst_fck_clksel[] = {
568 { .parent = &core_ck, .rates = ssi_ssr_sst_fck_core_rates },
569 { .parent = NULL }
570};
571
572static struct clk ssi_ssr_sst_fck = {
573 .name = "ssi_fck",
574 .ops = &clkops_omap2_dflt_wait,
575 .parent = &core_ck,
576 .clkdm_name = "core_l3_clkdm",
577 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
578 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
579 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
580 .clksel_mask = OMAP24XX_CLKSEL_SSI_MASK,
581 .clksel = ssi_ssr_sst_fck_clksel,
582 .recalc = &omap2_clksel_recalc,
583};
584
585/*
586 * Presumably this is the same as SSI_ICLK.
587 * TRM contradicts itself on what clockdomain SSI_ICLK is in
588 */
589static struct clk ssi_l4_ick = {
590 .name = "ssi_l4_ick",
591 .ops = &clkops_omap2_iclk_dflt_wait,
592 .parent = &l4_ck,
593 .clkdm_name = "core_l4_clkdm",
594 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
595 .enable_bit = OMAP24XX_EN_SSI_SHIFT,
596 .recalc = &followparent_recalc,
597};
598
599
600/*
601 * GFX clock domain
602 * Clocks:
603 * GFX_FCLK, GFX_ICLK
604 * GFX_CG1(2d), GFX_CG2(3d)
605 *
606 * GFX_FCLK runs from L3, and is divided by (1,2,3,4)
607 * The 2d and 3d clocks run at a hardware determined
608 * divided value of fclk.
609 *
610 */
611
612/* This clksel struct is shared between gfx_3d_fck and gfx_2d_fck */
613static const struct clksel gfx_fck_clksel[] = {
614 { .parent = &core_l3_ck, .rates = gfx_l3_rates },
615 { .parent = NULL },
616};
617
618static struct clk gfx_3d_fck = {
619 .name = "gfx_3d_fck",
620 .ops = &clkops_omap2_dflt_wait,
621 .parent = &core_l3_ck,
622 .clkdm_name = "gfx_clkdm",
623 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
624 .enable_bit = OMAP24XX_EN_3D_SHIFT,
625 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
626 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
627 .clksel = gfx_fck_clksel,
628 .recalc = &omap2_clksel_recalc,
629 .round_rate = &omap2_clksel_round_rate,
630 .set_rate = &omap2_clksel_set_rate
631};
632
633static struct clk gfx_2d_fck = {
634 .name = "gfx_2d_fck",
635 .ops = &clkops_omap2_dflt_wait,
636 .parent = &core_l3_ck,
637 .clkdm_name = "gfx_clkdm",
638 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
639 .enable_bit = OMAP24XX_EN_2D_SHIFT,
640 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
641 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
642 .clksel = gfx_fck_clksel,
643 .recalc = &omap2_clksel_recalc,
644};
645
646/* This interface clock does not have a CM_AUTOIDLE bit */
647static struct clk gfx_ick = {
648 .name = "gfx_ick", /* From l3 */
649 .ops = &clkops_omap2_dflt_wait,
650 .parent = &core_l3_ck,
651 .clkdm_name = "gfx_clkdm",
652 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
653 .enable_bit = OMAP_EN_GFX_SHIFT,
654 .recalc = &followparent_recalc,
655};
656
657/*
658 * Modem clock domain (2430)
659 * CLOCKS:
660 * MDM_OSC_CLK
661 * MDM_ICLK
662 * These clocks are usable in chassis mode only.
663 */
664static const struct clksel_rate mdm_ick_core_rates[] = {
665 { .div = 1, .val = 1, .flags = RATE_IN_243X },
666 { .div = 4, .val = 4, .flags = RATE_IN_243X },
667 { .div = 6, .val = 6, .flags = RATE_IN_243X },
668 { .div = 9, .val = 9, .flags = RATE_IN_243X },
669 { .div = 0 }
670};
671
672static const struct clksel mdm_ick_clksel[] = {
673 { .parent = &core_ck, .rates = mdm_ick_core_rates },
674 { .parent = NULL }
675};
676
677static struct clk mdm_ick = { /* used both as a ick and fck */
678 .name = "mdm_ick",
679 .ops = &clkops_omap2_iclk_dflt_wait,
680 .parent = &core_ck,
681 .clkdm_name = "mdm_clkdm",
682 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_ICLKEN),
683 .enable_bit = OMAP2430_CM_ICLKEN_MDM_EN_MDM_SHIFT,
684 .clksel_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_CLKSEL),
685 .clksel_mask = OMAP2430_CLKSEL_MDM_MASK,
686 .clksel = mdm_ick_clksel,
687 .recalc = &omap2_clksel_recalc,
688};
689
690static struct clk mdm_osc_ck = {
691 .name = "mdm_osc_ck",
692 .ops = &clkops_omap2_mdmclk_dflt_wait,
693 .parent = &osc_ck,
694 .clkdm_name = "mdm_clkdm",
695 .enable_reg = OMAP_CM_REGADDR(OMAP2430_MDM_MOD, CM_FCLKEN),
696 .enable_bit = OMAP2430_EN_OSC_SHIFT,
697 .recalc = &followparent_recalc,
698};
699
700/*
701 * DSS clock domain
702 * CLOCKs:
703 * DSS_L4_ICLK, DSS_L3_ICLK,
704 * DSS_CLK1, DSS_CLK2, DSS_54MHz_CLK
705 *
706 * DSS is both initiator and target.
707 */
708/* XXX Add RATE_NOT_VALIDATED */
709
710static const struct clksel_rate dss1_fck_sys_rates[] = {
711 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
712 { .div = 0 }
713};
714
715static const struct clksel_rate dss1_fck_core_rates[] = {
716 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
717 { .div = 2, .val = 2, .flags = RATE_IN_24XX },
718 { .div = 3, .val = 3, .flags = RATE_IN_24XX },
719 { .div = 4, .val = 4, .flags = RATE_IN_24XX },
720 { .div = 5, .val = 5, .flags = RATE_IN_24XX },
721 { .div = 6, .val = 6, .flags = RATE_IN_24XX },
722 { .div = 8, .val = 8, .flags = RATE_IN_24XX },
723 { .div = 9, .val = 9, .flags = RATE_IN_24XX },
724 { .div = 12, .val = 12, .flags = RATE_IN_24XX },
725 { .div = 16, .val = 16, .flags = RATE_IN_24XX },
726 { .div = 0 }
727};
728
729static const struct clksel dss1_fck_clksel[] = {
730 { .parent = &sys_ck, .rates = dss1_fck_sys_rates },
731 { .parent = &core_ck, .rates = dss1_fck_core_rates },
732 { .parent = NULL },
733};
734
735static struct clk dss_ick = { /* Enables both L3,L4 ICLK's */
736 .name = "dss_ick",
737 .ops = &clkops_omap2_iclk_dflt,
738 .parent = &l4_ck, /* really both l3 and l4 */
739 .clkdm_name = "dss_clkdm",
740 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
741 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
742 .recalc = &followparent_recalc,
743};
744
745static struct clk dss1_fck = {
746 .name = "dss1_fck",
747 .ops = &clkops_omap2_dflt,
748 .parent = &core_ck, /* Core or sys */
749 .clkdm_name = "dss_clkdm",
750 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
751 .enable_bit = OMAP24XX_EN_DSS1_SHIFT,
752 .init = &omap2_init_clksel_parent,
753 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
754 .clksel_mask = OMAP24XX_CLKSEL_DSS1_MASK,
755 .clksel = dss1_fck_clksel,
756 .recalc = &omap2_clksel_recalc,
757};
758
759static const struct clksel_rate dss2_fck_sys_rates[] = {
760 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
761 { .div = 0 }
762};
763
764static const struct clksel_rate dss2_fck_48m_rates[] = {
765 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
766 { .div = 0 }
767};
768
769static const struct clksel dss2_fck_clksel[] = {
770 { .parent = &sys_ck, .rates = dss2_fck_sys_rates },
771 { .parent = &func_48m_ck, .rates = dss2_fck_48m_rates },
772 { .parent = NULL }
773};
774
775static struct clk dss2_fck = { /* Alt clk used in power management */
776 .name = "dss2_fck",
777 .ops = &clkops_omap2_dflt,
778 .parent = &sys_ck, /* fixed at sys_ck or 48MHz */
779 .clkdm_name = "dss_clkdm",
780 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
781 .enable_bit = OMAP24XX_EN_DSS2_SHIFT,
782 .init = &omap2_init_clksel_parent,
783 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL1),
784 .clksel_mask = OMAP24XX_CLKSEL_DSS2_MASK,
785 .clksel = dss2_fck_clksel,
786 .recalc = &omap2_clksel_recalc,
787};
788
789static struct clk dss_54m_fck = { /* Alt clk used in power management */
790 .name = "dss_54m_fck", /* 54m tv clk */
791 .ops = &clkops_omap2_dflt_wait,
792 .parent = &func_54m_ck,
793 .clkdm_name = "dss_clkdm",
794 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
795 .enable_bit = OMAP24XX_EN_TV_SHIFT,
796 .recalc = &followparent_recalc,
797};
798
799static struct clk wu_l4_ick = {
800 .name = "wu_l4_ick",
801 .ops = &clkops_null,
802 .parent = &sys_ck,
803 .clkdm_name = "wkup_clkdm",
804 .recalc = &followparent_recalc,
805};
806
807/*
808 * CORE power domain ICLK & FCLK defines.
809 * Many of the these can have more than one possible parent. Entries
810 * here will likely have an L4 interface parent, and may have multiple
811 * functional clock parents.
812 */
813static const struct clksel_rate gpt_alt_rates[] = {
814 { .div = 1, .val = 2, .flags = RATE_IN_24XX },
815 { .div = 0 }
816};
817
818static const struct clksel omap24xx_gpt_clksel[] = {
819 { .parent = &func_32k_ck, .rates = gpt_32k_rates },
820 { .parent = &sys_ck, .rates = gpt_sys_rates },
821 { .parent = &alt_ck, .rates = gpt_alt_rates },
822 { .parent = NULL },
823};
824
825static struct clk gpt1_ick = {
826 .name = "gpt1_ick",
827 .ops = &clkops_omap2_iclk_dflt_wait,
828 .parent = &wu_l4_ick,
829 .clkdm_name = "wkup_clkdm",
830 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
831 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
832 .recalc = &followparent_recalc,
833};
834
835static struct clk gpt1_fck = {
836 .name = "gpt1_fck",
837 .ops = &clkops_omap2_dflt_wait,
838 .parent = &func_32k_ck,
839 .clkdm_name = "core_l4_clkdm",
840 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
841 .enable_bit = OMAP24XX_EN_GPT1_SHIFT,
842 .init = &omap2_init_clksel_parent,
843 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL1),
844 .clksel_mask = OMAP24XX_CLKSEL_GPT1_MASK,
845 .clksel = omap24xx_gpt_clksel,
846 .recalc = &omap2_clksel_recalc,
847 .round_rate = &omap2_clksel_round_rate,
848 .set_rate = &omap2_clksel_set_rate
849};
850
851static struct clk gpt2_ick = {
852 .name = "gpt2_ick",
853 .ops = &clkops_omap2_iclk_dflt_wait,
854 .parent = &l4_ck,
855 .clkdm_name = "core_l4_clkdm",
856 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
857 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
858 .recalc = &followparent_recalc,
859};
860
861static struct clk gpt2_fck = {
862 .name = "gpt2_fck",
863 .ops = &clkops_omap2_dflt_wait,
864 .parent = &func_32k_ck,
865 .clkdm_name = "core_l4_clkdm",
866 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
867 .enable_bit = OMAP24XX_EN_GPT2_SHIFT,
868 .init = &omap2_init_clksel_parent,
869 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
870 .clksel_mask = OMAP24XX_CLKSEL_GPT2_MASK,
871 .clksel = omap24xx_gpt_clksel,
872 .recalc = &omap2_clksel_recalc,
873};
874
875static struct clk gpt3_ick = {
876 .name = "gpt3_ick",
877 .ops = &clkops_omap2_iclk_dflt_wait,
878 .parent = &l4_ck,
879 .clkdm_name = "core_l4_clkdm",
880 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
881 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
882 .recalc = &followparent_recalc,
883};
884
885static struct clk gpt3_fck = {
886 .name = "gpt3_fck",
887 .ops = &clkops_omap2_dflt_wait,
888 .parent = &func_32k_ck,
889 .clkdm_name = "core_l4_clkdm",
890 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
891 .enable_bit = OMAP24XX_EN_GPT3_SHIFT,
892 .init = &omap2_init_clksel_parent,
893 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
894 .clksel_mask = OMAP24XX_CLKSEL_GPT3_MASK,
895 .clksel = omap24xx_gpt_clksel,
896 .recalc = &omap2_clksel_recalc,
897};
898
899static struct clk gpt4_ick = {
900 .name = "gpt4_ick",
901 .ops = &clkops_omap2_iclk_dflt_wait,
902 .parent = &l4_ck,
903 .clkdm_name = "core_l4_clkdm",
904 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
905 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
906 .recalc = &followparent_recalc,
907};
908
909static struct clk gpt4_fck = {
910 .name = "gpt4_fck",
911 .ops = &clkops_omap2_dflt_wait,
912 .parent = &func_32k_ck,
913 .clkdm_name = "core_l4_clkdm",
914 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
915 .enable_bit = OMAP24XX_EN_GPT4_SHIFT,
916 .init = &omap2_init_clksel_parent,
917 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
918 .clksel_mask = OMAP24XX_CLKSEL_GPT4_MASK,
919 .clksel = omap24xx_gpt_clksel,
920 .recalc = &omap2_clksel_recalc,
921};
922
923static struct clk gpt5_ick = {
924 .name = "gpt5_ick",
925 .ops = &clkops_omap2_iclk_dflt_wait,
926 .parent = &l4_ck,
927 .clkdm_name = "core_l4_clkdm",
928 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
929 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
930 .recalc = &followparent_recalc,
931};
932
933static struct clk gpt5_fck = {
934 .name = "gpt5_fck",
935 .ops = &clkops_omap2_dflt_wait,
936 .parent = &func_32k_ck,
937 .clkdm_name = "core_l4_clkdm",
938 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
939 .enable_bit = OMAP24XX_EN_GPT5_SHIFT,
940 .init = &omap2_init_clksel_parent,
941 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
942 .clksel_mask = OMAP24XX_CLKSEL_GPT5_MASK,
943 .clksel = omap24xx_gpt_clksel,
944 .recalc = &omap2_clksel_recalc,
945};
946
947static struct clk gpt6_ick = {
948 .name = "gpt6_ick",
949 .ops = &clkops_omap2_iclk_dflt_wait,
950 .parent = &l4_ck,
951 .clkdm_name = "core_l4_clkdm",
952 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
953 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
954 .recalc = &followparent_recalc,
955};
956
957static struct clk gpt6_fck = {
958 .name = "gpt6_fck",
959 .ops = &clkops_omap2_dflt_wait,
960 .parent = &func_32k_ck,
961 .clkdm_name = "core_l4_clkdm",
962 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
963 .enable_bit = OMAP24XX_EN_GPT6_SHIFT,
964 .init = &omap2_init_clksel_parent,
965 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
966 .clksel_mask = OMAP24XX_CLKSEL_GPT6_MASK,
967 .clksel = omap24xx_gpt_clksel,
968 .recalc = &omap2_clksel_recalc,
969};
970
971static struct clk gpt7_ick = {
972 .name = "gpt7_ick",
973 .ops = &clkops_omap2_iclk_dflt_wait,
974 .parent = &l4_ck,
975 .clkdm_name = "core_l4_clkdm",
976 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
977 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
978 .recalc = &followparent_recalc,
979};
980
981static struct clk gpt7_fck = {
982 .name = "gpt7_fck",
983 .ops = &clkops_omap2_dflt_wait,
984 .parent = &func_32k_ck,
985 .clkdm_name = "core_l4_clkdm",
986 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
987 .enable_bit = OMAP24XX_EN_GPT7_SHIFT,
988 .init = &omap2_init_clksel_parent,
989 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
990 .clksel_mask = OMAP24XX_CLKSEL_GPT7_MASK,
991 .clksel = omap24xx_gpt_clksel,
992 .recalc = &omap2_clksel_recalc,
993};
994
995static struct clk gpt8_ick = {
996 .name = "gpt8_ick",
997 .ops = &clkops_omap2_iclk_dflt_wait,
998 .parent = &l4_ck,
999 .clkdm_name = "core_l4_clkdm",
1000 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1001 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1002 .recalc = &followparent_recalc,
1003};
1004
1005static struct clk gpt8_fck = {
1006 .name = "gpt8_fck",
1007 .ops = &clkops_omap2_dflt_wait,
1008 .parent = &func_32k_ck,
1009 .clkdm_name = "core_l4_clkdm",
1010 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1011 .enable_bit = OMAP24XX_EN_GPT8_SHIFT,
1012 .init = &omap2_init_clksel_parent,
1013 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1014 .clksel_mask = OMAP24XX_CLKSEL_GPT8_MASK,
1015 .clksel = omap24xx_gpt_clksel,
1016 .recalc = &omap2_clksel_recalc,
1017};
1018
1019static struct clk gpt9_ick = {
1020 .name = "gpt9_ick",
1021 .ops = &clkops_omap2_iclk_dflt_wait,
1022 .parent = &l4_ck,
1023 .clkdm_name = "core_l4_clkdm",
1024 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1025 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1026 .recalc = &followparent_recalc,
1027};
1028
1029static struct clk gpt9_fck = {
1030 .name = "gpt9_fck",
1031 .ops = &clkops_omap2_dflt_wait,
1032 .parent = &func_32k_ck,
1033 .clkdm_name = "core_l4_clkdm",
1034 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1035 .enable_bit = OMAP24XX_EN_GPT9_SHIFT,
1036 .init = &omap2_init_clksel_parent,
1037 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1038 .clksel_mask = OMAP24XX_CLKSEL_GPT9_MASK,
1039 .clksel = omap24xx_gpt_clksel,
1040 .recalc = &omap2_clksel_recalc,
1041};
1042
1043static struct clk gpt10_ick = {
1044 .name = "gpt10_ick",
1045 .ops = &clkops_omap2_iclk_dflt_wait,
1046 .parent = &l4_ck,
1047 .clkdm_name = "core_l4_clkdm",
1048 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1049 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1050 .recalc = &followparent_recalc,
1051};
1052
1053static struct clk gpt10_fck = {
1054 .name = "gpt10_fck",
1055 .ops = &clkops_omap2_dflt_wait,
1056 .parent = &func_32k_ck,
1057 .clkdm_name = "core_l4_clkdm",
1058 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1059 .enable_bit = OMAP24XX_EN_GPT10_SHIFT,
1060 .init = &omap2_init_clksel_parent,
1061 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1062 .clksel_mask = OMAP24XX_CLKSEL_GPT10_MASK,
1063 .clksel = omap24xx_gpt_clksel,
1064 .recalc = &omap2_clksel_recalc,
1065};
1066
1067static struct clk gpt11_ick = {
1068 .name = "gpt11_ick",
1069 .ops = &clkops_omap2_iclk_dflt_wait,
1070 .parent = &l4_ck,
1071 .clkdm_name = "core_l4_clkdm",
1072 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1073 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1074 .recalc = &followparent_recalc,
1075};
1076
1077static struct clk gpt11_fck = {
1078 .name = "gpt11_fck",
1079 .ops = &clkops_omap2_dflt_wait,
1080 .parent = &func_32k_ck,
1081 .clkdm_name = "core_l4_clkdm",
1082 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1083 .enable_bit = OMAP24XX_EN_GPT11_SHIFT,
1084 .init = &omap2_init_clksel_parent,
1085 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1086 .clksel_mask = OMAP24XX_CLKSEL_GPT11_MASK,
1087 .clksel = omap24xx_gpt_clksel,
1088 .recalc = &omap2_clksel_recalc,
1089};
1090
1091static struct clk gpt12_ick = {
1092 .name = "gpt12_ick",
1093 .ops = &clkops_omap2_iclk_dflt_wait,
1094 .parent = &l4_ck,
1095 .clkdm_name = "core_l4_clkdm",
1096 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1097 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1098 .recalc = &followparent_recalc,
1099};
1100
1101static struct clk gpt12_fck = {
1102 .name = "gpt12_fck",
1103 .ops = &clkops_omap2_dflt_wait,
1104 .parent = &secure_32k_ck,
1105 .clkdm_name = "core_l4_clkdm",
1106 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1107 .enable_bit = OMAP24XX_EN_GPT12_SHIFT,
1108 .init = &omap2_init_clksel_parent,
1109 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL2),
1110 .clksel_mask = OMAP24XX_CLKSEL_GPT12_MASK,
1111 .clksel = omap24xx_gpt_clksel,
1112 .recalc = &omap2_clksel_recalc,
1113};
1114
1115static struct clk mcbsp1_ick = {
1116 .name = "mcbsp1_ick",
1117 .ops = &clkops_omap2_iclk_dflt_wait,
1118 .parent = &l4_ck,
1119 .clkdm_name = "core_l4_clkdm",
1120 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1121 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1122 .recalc = &followparent_recalc,
1123};
1124
1125static const struct clksel_rate common_mcbsp_96m_rates[] = {
1126 { .div = 1, .val = 0, .flags = RATE_IN_24XX },
1127 { .div = 0 }
1128};
1129
1130static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1131 { .div = 1, .val = 1, .flags = RATE_IN_24XX },
1132 { .div = 0 }
1133};
1134
1135static const struct clksel mcbsp_fck_clksel[] = {
1136 { .parent = &func_96m_ck, .rates = common_mcbsp_96m_rates },
1137 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1138 { .parent = NULL }
1139};
1140
1141static struct clk mcbsp1_fck = {
1142 .name = "mcbsp1_fck",
1143 .ops = &clkops_omap2_dflt_wait,
1144 .parent = &func_96m_ck,
1145 .init = &omap2_init_clksel_parent,
1146 .clkdm_name = "core_l4_clkdm",
1147 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1148 .enable_bit = OMAP24XX_EN_MCBSP1_SHIFT,
1149 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1150 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1151 .clksel = mcbsp_fck_clksel,
1152 .recalc = &omap2_clksel_recalc,
1153};
1154
1155static struct clk mcbsp2_ick = {
1156 .name = "mcbsp2_ick",
1157 .ops = &clkops_omap2_iclk_dflt_wait,
1158 .parent = &l4_ck,
1159 .clkdm_name = "core_l4_clkdm",
1160 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1161 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1162 .recalc = &followparent_recalc,
1163};
1164
1165static struct clk mcbsp2_fck = {
1166 .name = "mcbsp2_fck",
1167 .ops = &clkops_omap2_dflt_wait,
1168 .parent = &func_96m_ck,
1169 .init = &omap2_init_clksel_parent,
1170 .clkdm_name = "core_l4_clkdm",
1171 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1172 .enable_bit = OMAP24XX_EN_MCBSP2_SHIFT,
1173 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1174 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
1175 .clksel = mcbsp_fck_clksel,
1176 .recalc = &omap2_clksel_recalc,
1177};
1178
1179static struct clk mcbsp3_ick = {
1180 .name = "mcbsp3_ick",
1181 .ops = &clkops_omap2_iclk_dflt_wait,
1182 .parent = &l4_ck,
1183 .clkdm_name = "core_l4_clkdm",
1184 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1185 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1186 .recalc = &followparent_recalc,
1187};
1188
1189static struct clk mcbsp3_fck = {
1190 .name = "mcbsp3_fck",
1191 .ops = &clkops_omap2_dflt_wait,
1192 .parent = &func_96m_ck,
1193 .init = &omap2_init_clksel_parent,
1194 .clkdm_name = "core_l4_clkdm",
1195 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1196 .enable_bit = OMAP2430_EN_MCBSP3_SHIFT,
1197 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1198 .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
1199 .clksel = mcbsp_fck_clksel,
1200 .recalc = &omap2_clksel_recalc,
1201};
1202
1203static struct clk mcbsp4_ick = {
1204 .name = "mcbsp4_ick",
1205 .ops = &clkops_omap2_iclk_dflt_wait,
1206 .parent = &l4_ck,
1207 .clkdm_name = "core_l4_clkdm",
1208 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1209 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1210 .recalc = &followparent_recalc,
1211};
1212
1213static struct clk mcbsp4_fck = {
1214 .name = "mcbsp4_fck",
1215 .ops = &clkops_omap2_dflt_wait,
1216 .parent = &func_96m_ck,
1217 .init = &omap2_init_clksel_parent,
1218 .clkdm_name = "core_l4_clkdm",
1219 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1220 .enable_bit = OMAP2430_EN_MCBSP4_SHIFT,
1221 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1222 .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
1223 .clksel = mcbsp_fck_clksel,
1224 .recalc = &omap2_clksel_recalc,
1225};
1226
1227static struct clk mcbsp5_ick = {
1228 .name = "mcbsp5_ick",
1229 .ops = &clkops_omap2_iclk_dflt_wait,
1230 .parent = &l4_ck,
1231 .clkdm_name = "core_l4_clkdm",
1232 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1233 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1234 .recalc = &followparent_recalc,
1235};
1236
1237static struct clk mcbsp5_fck = {
1238 .name = "mcbsp5_fck",
1239 .ops = &clkops_omap2_dflt_wait,
1240 .parent = &func_96m_ck,
1241 .init = &omap2_init_clksel_parent,
1242 .clkdm_name = "core_l4_clkdm",
1243 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1244 .enable_bit = OMAP2430_EN_MCBSP5_SHIFT,
1245 .clksel_reg = OMAP243X_CTRL_REGADDR(OMAP243X_CONTROL_DEVCONF1),
1246 .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
1247 .clksel = mcbsp_fck_clksel,
1248 .recalc = &omap2_clksel_recalc,
1249};
1250
1251static struct clk mcspi1_ick = {
1252 .name = "mcspi1_ick",
1253 .ops = &clkops_omap2_iclk_dflt_wait,
1254 .parent = &l4_ck,
1255 .clkdm_name = "core_l4_clkdm",
1256 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1257 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1258 .recalc = &followparent_recalc,
1259};
1260
1261static struct clk mcspi1_fck = {
1262 .name = "mcspi1_fck",
1263 .ops = &clkops_omap2_dflt_wait,
1264 .parent = &func_48m_ck,
1265 .clkdm_name = "core_l4_clkdm",
1266 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1267 .enable_bit = OMAP24XX_EN_MCSPI1_SHIFT,
1268 .recalc = &followparent_recalc,
1269};
1270
1271static struct clk mcspi2_ick = {
1272 .name = "mcspi2_ick",
1273 .ops = &clkops_omap2_iclk_dflt_wait,
1274 .parent = &l4_ck,
1275 .clkdm_name = "core_l4_clkdm",
1276 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1277 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1278 .recalc = &followparent_recalc,
1279};
1280
1281static struct clk mcspi2_fck = {
1282 .name = "mcspi2_fck",
1283 .ops = &clkops_omap2_dflt_wait,
1284 .parent = &func_48m_ck,
1285 .clkdm_name = "core_l4_clkdm",
1286 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1287 .enable_bit = OMAP24XX_EN_MCSPI2_SHIFT,
1288 .recalc = &followparent_recalc,
1289};
1290
1291static struct clk mcspi3_ick = {
1292 .name = "mcspi3_ick",
1293 .ops = &clkops_omap2_iclk_dflt_wait,
1294 .parent = &l4_ck,
1295 .clkdm_name = "core_l4_clkdm",
1296 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1297 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1298 .recalc = &followparent_recalc,
1299};
1300
1301static struct clk mcspi3_fck = {
1302 .name = "mcspi3_fck",
1303 .ops = &clkops_omap2_dflt_wait,
1304 .parent = &func_48m_ck,
1305 .clkdm_name = "core_l4_clkdm",
1306 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1307 .enable_bit = OMAP2430_EN_MCSPI3_SHIFT,
1308 .recalc = &followparent_recalc,
1309};
1310
1311static struct clk uart1_ick = {
1312 .name = "uart1_ick",
1313 .ops = &clkops_omap2_iclk_dflt_wait,
1314 .parent = &l4_ck,
1315 .clkdm_name = "core_l4_clkdm",
1316 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1317 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1318 .recalc = &followparent_recalc,
1319};
1320
1321static struct clk uart1_fck = {
1322 .name = "uart1_fck",
1323 .ops = &clkops_omap2_dflt_wait,
1324 .parent = &func_48m_ck,
1325 .clkdm_name = "core_l4_clkdm",
1326 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1327 .enable_bit = OMAP24XX_EN_UART1_SHIFT,
1328 .recalc = &followparent_recalc,
1329};
1330
1331static struct clk uart2_ick = {
1332 .name = "uart2_ick",
1333 .ops = &clkops_omap2_iclk_dflt_wait,
1334 .parent = &l4_ck,
1335 .clkdm_name = "core_l4_clkdm",
1336 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1337 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1338 .recalc = &followparent_recalc,
1339};
1340
1341static struct clk uart2_fck = {
1342 .name = "uart2_fck",
1343 .ops = &clkops_omap2_dflt_wait,
1344 .parent = &func_48m_ck,
1345 .clkdm_name = "core_l4_clkdm",
1346 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1347 .enable_bit = OMAP24XX_EN_UART2_SHIFT,
1348 .recalc = &followparent_recalc,
1349};
1350
1351static struct clk uart3_ick = {
1352 .name = "uart3_ick",
1353 .ops = &clkops_omap2_iclk_dflt_wait,
1354 .parent = &l4_ck,
1355 .clkdm_name = "core_l4_clkdm",
1356 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1357 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1358 .recalc = &followparent_recalc,
1359};
1360
1361static struct clk uart3_fck = {
1362 .name = "uart3_fck",
1363 .ops = &clkops_omap2_dflt_wait,
1364 .parent = &func_48m_ck,
1365 .clkdm_name = "core_l4_clkdm",
1366 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1367 .enable_bit = OMAP24XX_EN_UART3_SHIFT,
1368 .recalc = &followparent_recalc,
1369};
1370
1371static struct clk gpios_ick = {
1372 .name = "gpios_ick",
1373 .ops = &clkops_omap2_iclk_dflt_wait,
1374 .parent = &wu_l4_ick,
1375 .clkdm_name = "wkup_clkdm",
1376 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1377 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1378 .recalc = &followparent_recalc,
1379};
1380
1381static struct clk gpios_fck = {
1382 .name = "gpios_fck",
1383 .ops = &clkops_omap2_dflt_wait,
1384 .parent = &func_32k_ck,
1385 .clkdm_name = "wkup_clkdm",
1386 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1387 .enable_bit = OMAP24XX_EN_GPIOS_SHIFT,
1388 .recalc = &followparent_recalc,
1389};
1390
1391static struct clk mpu_wdt_ick = {
1392 .name = "mpu_wdt_ick",
1393 .ops = &clkops_omap2_iclk_dflt_wait,
1394 .parent = &wu_l4_ick,
1395 .clkdm_name = "wkup_clkdm",
1396 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1397 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1398 .recalc = &followparent_recalc,
1399};
1400
1401static struct clk mpu_wdt_fck = {
1402 .name = "mpu_wdt_fck",
1403 .ops = &clkops_omap2_dflt_wait,
1404 .parent = &func_32k_ck,
1405 .clkdm_name = "wkup_clkdm",
1406 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
1407 .enable_bit = OMAP24XX_EN_MPU_WDT_SHIFT,
1408 .recalc = &followparent_recalc,
1409};
1410
1411static struct clk sync_32k_ick = {
1412 .name = "sync_32k_ick",
1413 .ops = &clkops_omap2_iclk_dflt_wait,
1414 .flags = ENABLE_ON_INIT,
1415 .parent = &wu_l4_ick,
1416 .clkdm_name = "wkup_clkdm",
1417 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1418 .enable_bit = OMAP24XX_EN_32KSYNC_SHIFT,
1419 .recalc = &followparent_recalc,
1420};
1421
1422static struct clk wdt1_ick = {
1423 .name = "wdt1_ick",
1424 .ops = &clkops_omap2_iclk_dflt_wait,
1425 .parent = &wu_l4_ick,
1426 .clkdm_name = "wkup_clkdm",
1427 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1428 .enable_bit = OMAP24XX_EN_WDT1_SHIFT,
1429 .recalc = &followparent_recalc,
1430};
1431
1432static struct clk omapctrl_ick = {
1433 .name = "omapctrl_ick",
1434 .ops = &clkops_omap2_iclk_dflt_wait,
1435 .flags = ENABLE_ON_INIT,
1436 .parent = &wu_l4_ick,
1437 .clkdm_name = "wkup_clkdm",
1438 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1439 .enable_bit = OMAP24XX_EN_OMAPCTRL_SHIFT,
1440 .recalc = &followparent_recalc,
1441};
1442
1443static struct clk icr_ick = {
1444 .name = "icr_ick",
1445 .ops = &clkops_omap2_iclk_dflt_wait,
1446 .parent = &wu_l4_ick,
1447 .clkdm_name = "wkup_clkdm",
1448 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
1449 .enable_bit = OMAP2430_EN_ICR_SHIFT,
1450 .recalc = &followparent_recalc,
1451};
1452
1453static struct clk cam_ick = {
1454 .name = "cam_ick",
1455 .ops = &clkops_omap2_iclk_dflt,
1456 .parent = &l4_ck,
1457 .clkdm_name = "core_l4_clkdm",
1458 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1459 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1460 .recalc = &followparent_recalc,
1461};
1462
1463/*
1464 * cam_fck controls both CAM_MCLK and CAM_FCLK. It should probably be
1465 * split into two separate clocks, since the parent clocks are different
1466 * and the clockdomains are also different.
1467 */
1468static struct clk cam_fck = {
1469 .name = "cam_fck",
1470 .ops = &clkops_omap2_dflt,
1471 .parent = &func_96m_ck,
1472 .clkdm_name = "core_l3_clkdm",
1473 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1474 .enable_bit = OMAP24XX_EN_CAM_SHIFT,
1475 .recalc = &followparent_recalc,
1476};
1477
1478static struct clk mailboxes_ick = {
1479 .name = "mailboxes_ick",
1480 .ops = &clkops_omap2_iclk_dflt_wait,
1481 .parent = &l4_ck,
1482 .clkdm_name = "core_l4_clkdm",
1483 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1484 .enable_bit = OMAP24XX_EN_MAILBOXES_SHIFT,
1485 .recalc = &followparent_recalc,
1486};
1487
1488static struct clk wdt4_ick = {
1489 .name = "wdt4_ick",
1490 .ops = &clkops_omap2_iclk_dflt_wait,
1491 .parent = &l4_ck,
1492 .clkdm_name = "core_l4_clkdm",
1493 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1494 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1495 .recalc = &followparent_recalc,
1496};
1497
1498static struct clk wdt4_fck = {
1499 .name = "wdt4_fck",
1500 .ops = &clkops_omap2_dflt_wait,
1501 .parent = &func_32k_ck,
1502 .clkdm_name = "core_l4_clkdm",
1503 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1504 .enable_bit = OMAP24XX_EN_WDT4_SHIFT,
1505 .recalc = &followparent_recalc,
1506};
1507
1508static struct clk mspro_ick = {
1509 .name = "mspro_ick",
1510 .ops = &clkops_omap2_iclk_dflt_wait,
1511 .parent = &l4_ck,
1512 .clkdm_name = "core_l4_clkdm",
1513 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1514 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1515 .recalc = &followparent_recalc,
1516};
1517
1518static struct clk mspro_fck = {
1519 .name = "mspro_fck",
1520 .ops = &clkops_omap2_dflt_wait,
1521 .parent = &func_96m_ck,
1522 .clkdm_name = "core_l4_clkdm",
1523 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1524 .enable_bit = OMAP24XX_EN_MSPRO_SHIFT,
1525 .recalc = &followparent_recalc,
1526};
1527
1528static struct clk fac_ick = {
1529 .name = "fac_ick",
1530 .ops = &clkops_omap2_iclk_dflt_wait,
1531 .parent = &l4_ck,
1532 .clkdm_name = "core_l4_clkdm",
1533 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1534 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1535 .recalc = &followparent_recalc,
1536};
1537
1538static struct clk fac_fck = {
1539 .name = "fac_fck",
1540 .ops = &clkops_omap2_dflt_wait,
1541 .parent = &func_12m_ck,
1542 .clkdm_name = "core_l4_clkdm",
1543 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1544 .enable_bit = OMAP24XX_EN_FAC_SHIFT,
1545 .recalc = &followparent_recalc,
1546};
1547
1548static struct clk hdq_ick = {
1549 .name = "hdq_ick",
1550 .ops = &clkops_omap2_iclk_dflt_wait,
1551 .parent = &l4_ck,
1552 .clkdm_name = "core_l4_clkdm",
1553 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1554 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1555 .recalc = &followparent_recalc,
1556};
1557
1558static struct clk hdq_fck = {
1559 .name = "hdq_fck",
1560 .ops = &clkops_omap2_dflt_wait,
1561 .parent = &func_12m_ck,
1562 .clkdm_name = "core_l4_clkdm",
1563 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1564 .enable_bit = OMAP24XX_EN_HDQ_SHIFT,
1565 .recalc = &followparent_recalc,
1566};
1567
1568/*
1569 * XXX This is marked as a 2420-only define, but it claims to be present
1570 * on 2430 also. Double-check.
1571 */
1572static struct clk i2c2_ick = {
1573 .name = "i2c2_ick",
1574 .ops = &clkops_omap2_iclk_dflt_wait,
1575 .parent = &l4_ck,
1576 .clkdm_name = "core_l4_clkdm",
1577 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1578 .enable_bit = OMAP2420_EN_I2C2_SHIFT,
1579 .recalc = &followparent_recalc,
1580};
1581
1582static struct clk i2chs2_fck = {
1583 .name = "i2chs2_fck",
1584 .ops = &clkops_omap2430_i2chs_wait,
1585 .parent = &func_96m_ck,
1586 .clkdm_name = "core_l4_clkdm",
1587 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1588 .enable_bit = OMAP2430_EN_I2CHS2_SHIFT,
1589 .recalc = &followparent_recalc,
1590};
1591
1592/*
1593 * XXX This is marked as a 2420-only define, but it claims to be present
1594 * on 2430 also. Double-check.
1595 */
1596static struct clk i2c1_ick = {
1597 .name = "i2c1_ick",
1598 .ops = &clkops_omap2_iclk_dflt_wait,
1599 .parent = &l4_ck,
1600 .clkdm_name = "core_l4_clkdm",
1601 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1602 .enable_bit = OMAP2420_EN_I2C1_SHIFT,
1603 .recalc = &followparent_recalc,
1604};
1605
1606static struct clk i2chs1_fck = {
1607 .name = "i2chs1_fck",
1608 .ops = &clkops_omap2430_i2chs_wait,
1609 .parent = &func_96m_ck,
1610 .clkdm_name = "core_l4_clkdm",
1611 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1612 .enable_bit = OMAP2430_EN_I2CHS1_SHIFT,
1613 .recalc = &followparent_recalc,
1614};
1615
1616/*
1617 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1618 * accesses derived from this data.
1619 */
1620static struct clk gpmc_fck = {
1621 .name = "gpmc_fck",
1622 .ops = &clkops_omap2_iclk_idle_only,
1623 .parent = &core_l3_ck,
1624 .flags = ENABLE_ON_INIT,
1625 .clkdm_name = "core_l3_clkdm",
1626 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1627 .enable_bit = OMAP24XX_AUTO_GPMC_SHIFT,
1628 .recalc = &followparent_recalc,
1629};
1630
1631static struct clk sdma_fck = {
1632 .name = "sdma_fck",
1633 .ops = &clkops_null, /* RMK: missing? */
1634 .parent = &core_l3_ck,
1635 .clkdm_name = "core_l3_clkdm",
1636 .recalc = &followparent_recalc,
1637};
1638
1639/*
1640 * The enable_reg/enable_bit in this clock is only used for CM_AUTOIDLE
1641 * accesses derived from this data.
1642 */
1643static struct clk sdma_ick = {
1644 .name = "sdma_ick",
1645 .ops = &clkops_omap2_iclk_idle_only,
1646 .parent = &core_l3_ck,
1647 .clkdm_name = "core_l3_clkdm",
1648 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1649 .enable_bit = OMAP24XX_AUTO_SDMA_SHIFT,
1650 .recalc = &followparent_recalc,
1651};
1652
1653static struct clk sdrc_ick = {
1654 .name = "sdrc_ick",
1655 .ops = &clkops_omap2_iclk_idle_only,
1656 .parent = &core_l3_ck,
1657 .flags = ENABLE_ON_INIT,
1658 .clkdm_name = "core_l3_clkdm",
1659 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1660 .enable_bit = OMAP2430_EN_SDRC_SHIFT,
1661 .recalc = &followparent_recalc,
1662};
1663
1664static struct clk des_ick = {
1665 .name = "des_ick",
1666 .ops = &clkops_omap2_iclk_dflt_wait,
1667 .parent = &l4_ck,
1668 .clkdm_name = "core_l4_clkdm",
1669 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1670 .enable_bit = OMAP24XX_EN_DES_SHIFT,
1671 .recalc = &followparent_recalc,
1672};
1673
1674static struct clk sha_ick = {
1675 .name = "sha_ick",
1676 .ops = &clkops_omap2_iclk_dflt_wait,
1677 .parent = &l4_ck,
1678 .clkdm_name = "core_l4_clkdm",
1679 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1680 .enable_bit = OMAP24XX_EN_SHA_SHIFT,
1681 .recalc = &followparent_recalc,
1682};
1683
1684static struct clk rng_ick = {
1685 .name = "rng_ick",
1686 .ops = &clkops_omap2_iclk_dflt_wait,
1687 .parent = &l4_ck,
1688 .clkdm_name = "core_l4_clkdm",
1689 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1690 .enable_bit = OMAP24XX_EN_RNG_SHIFT,
1691 .recalc = &followparent_recalc,
1692};
1693
1694static struct clk aes_ick = {
1695 .name = "aes_ick",
1696 .ops = &clkops_omap2_iclk_dflt_wait,
1697 .parent = &l4_ck,
1698 .clkdm_name = "core_l4_clkdm",
1699 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1700 .enable_bit = OMAP24XX_EN_AES_SHIFT,
1701 .recalc = &followparent_recalc,
1702};
1703
1704static struct clk pka_ick = {
1705 .name = "pka_ick",
1706 .ops = &clkops_omap2_iclk_dflt_wait,
1707 .parent = &l4_ck,
1708 .clkdm_name = "core_l4_clkdm",
1709 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_ICLKEN4),
1710 .enable_bit = OMAP24XX_EN_PKA_SHIFT,
1711 .recalc = &followparent_recalc,
1712};
1713
1714static struct clk usb_fck = {
1715 .name = "usb_fck",
1716 .ops = &clkops_omap2_dflt_wait,
1717 .parent = &func_48m_ck,
1718 .clkdm_name = "core_l3_clkdm",
1719 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1720 .enable_bit = OMAP24XX_EN_USB_SHIFT,
1721 .recalc = &followparent_recalc,
1722};
1723
1724static struct clk usbhs_ick = {
1725 .name = "usbhs_ick",
1726 .ops = &clkops_omap2_iclk_dflt_wait,
1727 .parent = &core_l3_ck,
1728 .clkdm_name = "core_l3_clkdm",
1729 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1730 .enable_bit = OMAP2430_EN_USBHS_SHIFT,
1731 .recalc = &followparent_recalc,
1732};
1733
1734static struct clk mmchs1_ick = {
1735 .name = "mmchs1_ick",
1736 .ops = &clkops_omap2_iclk_dflt_wait,
1737 .parent = &l4_ck,
1738 .clkdm_name = "core_l4_clkdm",
1739 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1740 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1741 .recalc = &followparent_recalc,
1742};
1743
1744static struct clk mmchs1_fck = {
1745 .name = "mmchs1_fck",
1746 .ops = &clkops_omap2_dflt_wait,
1747 .parent = &func_96m_ck,
1748 .clkdm_name = "core_l4_clkdm",
1749 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1750 .enable_bit = OMAP2430_EN_MMCHS1_SHIFT,
1751 .recalc = &followparent_recalc,
1752};
1753
1754static struct clk mmchs2_ick = {
1755 .name = "mmchs2_ick",
1756 .ops = &clkops_omap2_iclk_dflt_wait,
1757 .parent = &l4_ck,
1758 .clkdm_name = "core_l4_clkdm",
1759 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1760 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1761 .recalc = &followparent_recalc,
1762};
1763
1764static struct clk mmchs2_fck = {
1765 .name = "mmchs2_fck",
1766 .ops = &clkops_omap2_dflt_wait,
1767 .parent = &func_96m_ck,
1768 .clkdm_name = "core_l4_clkdm",
1769 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1770 .enable_bit = OMAP2430_EN_MMCHS2_SHIFT,
1771 .recalc = &followparent_recalc,
1772};
1773
1774static struct clk gpio5_ick = {
1775 .name = "gpio5_ick",
1776 .ops = &clkops_omap2_iclk_dflt_wait,
1777 .parent = &l4_ck,
1778 .clkdm_name = "core_l4_clkdm",
1779 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1780 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
1781 .recalc = &followparent_recalc,
1782};
1783
1784static struct clk gpio5_fck = {
1785 .name = "gpio5_fck",
1786 .ops = &clkops_omap2_dflt_wait,
1787 .parent = &func_32k_ck,
1788 .clkdm_name = "core_l4_clkdm",
1789 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1790 .enable_bit = OMAP2430_EN_GPIO5_SHIFT,
1791 .recalc = &followparent_recalc,
1792};
1793
1794static struct clk mdm_intc_ick = {
1795 .name = "mdm_intc_ick",
1796 .ops = &clkops_omap2_iclk_dflt_wait,
1797 .parent = &l4_ck,
1798 .clkdm_name = "core_l4_clkdm",
1799 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1800 .enable_bit = OMAP2430_EN_MDM_INTC_SHIFT,
1801 .recalc = &followparent_recalc,
1802};
1803
1804static struct clk mmchsdb1_fck = {
1805 .name = "mmchsdb1_fck",
1806 .ops = &clkops_omap2_dflt_wait,
1807 .parent = &func_32k_ck,
1808 .clkdm_name = "core_l4_clkdm",
1809 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1810 .enable_bit = OMAP2430_EN_MMCHSDB1_SHIFT,
1811 .recalc = &followparent_recalc,
1812};
1813
1814static struct clk mmchsdb2_fck = {
1815 .name = "mmchsdb2_fck",
1816 .ops = &clkops_omap2_dflt_wait,
1817 .parent = &func_32k_ck,
1818 .clkdm_name = "core_l4_clkdm",
1819 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP24XX_CM_FCLKEN2),
1820 .enable_bit = OMAP2430_EN_MMCHSDB2_SHIFT,
1821 .recalc = &followparent_recalc,
1822};
1823
1824/*
1825 * This clock is a composite clock which does entire set changes then
1826 * forces a rebalance. It keys on the MPU speed, but it really could
1827 * be any key speed part of a set in the rate table.
1828 *
1829 * to really change a set, you need memory table sets which get changed
1830 * in sram, pre-notifiers & post notifiers, changing the top set, without
1831 * having low level display recalc's won't work... this is why dpm notifiers
1832 * work, isr's off, walk a list of clocks already _off_ and not messing with
1833 * the bus.
1834 *
1835 * This clock should have no parent. It embodies the entire upper level
1836 * active set. A parent will mess up some of the init also.
1837 */
1838static struct clk virt_prcm_set = {
1839 .name = "virt_prcm_set",
1840 .ops = &clkops_null,
1841 .parent = &mpu_ck, /* Indexed by mpu speed, no parent */
1842 .recalc = &omap2_table_mpu_recalc, /* sets are keyed on mpu rate */
1843 .set_rate = &omap2_select_table_rate,
1844 .round_rate = &omap2_round_to_table_rate,
1845};
1846
1847
1848/*
1849 * clkdev integration
1850 */
1851
1852static struct omap_clk omap2430_clks[] = {
1853 /* external root sources */
1854 CLK(NULL, "func_32k_ck", &func_32k_ck, CK_243X),
1855 CLK(NULL, "secure_32k_ck", &secure_32k_ck, CK_243X),
1856 CLK(NULL, "osc_ck", &osc_ck, CK_243X),
1857 CLK("twl", "fck", &osc_ck, CK_243X),
1858 CLK(NULL, "sys_ck", &sys_ck, CK_243X),
1859 CLK(NULL, "alt_ck", &alt_ck, CK_243X),
1860 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_243X),
1861 /* internal analog sources */
1862 CLK(NULL, "dpll_ck", &dpll_ck, CK_243X),
1863 CLK(NULL, "apll96_ck", &apll96_ck, CK_243X),
1864 CLK(NULL, "apll54_ck", &apll54_ck, CK_243X),
1865 /* internal prcm root sources */
1866 CLK(NULL, "func_54m_ck", &func_54m_ck, CK_243X),
1867 CLK(NULL, "core_ck", &core_ck, CK_243X),
1868 CLK(NULL, "func_96m_ck", &func_96m_ck, CK_243X),
1869 CLK(NULL, "func_48m_ck", &func_48m_ck, CK_243X),
1870 CLK(NULL, "func_12m_ck", &func_12m_ck, CK_243X),
1871 CLK(NULL, "ck_wdt1_osc", &wdt1_osc_ck, CK_243X),
1872 CLK(NULL, "sys_clkout_src", &sys_clkout_src, CK_243X),
1873 CLK(NULL, "sys_clkout", &sys_clkout, CK_243X),
1874 CLK(NULL, "emul_ck", &emul_ck, CK_243X),
1875 /* mpu domain clocks */
1876 CLK(NULL, "mpu_ck", &mpu_ck, CK_243X),
1877 /* dsp domain clocks */
1878 CLK(NULL, "dsp_fck", &dsp_fck, CK_243X),
1879 CLK(NULL, "iva2_1_ick", &iva2_1_ick, CK_243X),
1880 /* GFX domain clocks */
1881 CLK(NULL, "gfx_3d_fck", &gfx_3d_fck, CK_243X),
1882 CLK(NULL, "gfx_2d_fck", &gfx_2d_fck, CK_243X),
1883 CLK(NULL, "gfx_ick", &gfx_ick, CK_243X),
1884 /* Modem domain clocks */
1885 CLK(NULL, "mdm_ick", &mdm_ick, CK_243X),
1886 CLK(NULL, "mdm_osc_ck", &mdm_osc_ck, CK_243X),
1887 /* DSS domain clocks */
1888 CLK("omapdss_dss", "ick", &dss_ick, CK_243X),
1889 CLK(NULL, "dss_ick", &dss_ick, CK_243X),
1890 CLK(NULL, "dss1_fck", &dss1_fck, CK_243X),
1891 CLK(NULL, "dss2_fck", &dss2_fck, CK_243X),
1892 CLK(NULL, "dss_54m_fck", &dss_54m_fck, CK_243X),
1893 /* L3 domain clocks */
1894 CLK(NULL, "core_l3_ck", &core_l3_ck, CK_243X),
1895 CLK(NULL, "ssi_fck", &ssi_ssr_sst_fck, CK_243X),
1896 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_243X),
1897 /* L4 domain clocks */
1898 CLK(NULL, "l4_ck", &l4_ck, CK_243X),
1899 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_243X),
1900 CLK(NULL, "wu_l4_ick", &wu_l4_ick, CK_243X),
1901 /* virtual meta-group clock */
1902 CLK(NULL, "virt_prcm_set", &virt_prcm_set, CK_243X),
1903 /* general l4 interface ck, multi-parent functional clk */
1904 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_243X),
1905 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_243X),
1906 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_243X),
1907 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_243X),
1908 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_243X),
1909 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_243X),
1910 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_243X),
1911 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_243X),
1912 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_243X),
1913 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_243X),
1914 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_243X),
1915 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_243X),
1916 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_243X),
1917 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_243X),
1918 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_243X),
1919 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_243X),
1920 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_243X),
1921 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_243X),
1922 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_243X),
1923 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_243X),
1924 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_243X),
1925 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_243X),
1926 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_243X),
1927 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_243X),
1928 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_243X),
1929 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_243X),
1930 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_243X),
1931 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_243X),
1932 CLK(NULL, "mcbsp2_ick", &mcbsp2_ick, CK_243X),
1933 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_243X),
1934 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_243X),
1935 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_243X),
1936 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_243X),
1937 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_243X),
1938 CLK(NULL, "mcbsp4_ick", &mcbsp4_ick, CK_243X),
1939 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_243X),
1940 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_243X),
1941 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_243X),
1942 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_243X),
1943 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_243X),
1944 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_243X),
1945 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_243X),
1946 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_243X),
1947 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_243X),
1948 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_243X),
1949 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_243X),
1950 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_243X),
1951 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_243X),
1952 CLK(NULL, "uart1_ick", &uart1_ick, CK_243X),
1953 CLK(NULL, "uart1_fck", &uart1_fck, CK_243X),
1954 CLK(NULL, "uart2_ick", &uart2_ick, CK_243X),
1955 CLK(NULL, "uart2_fck", &uart2_fck, CK_243X),
1956 CLK(NULL, "uart3_ick", &uart3_ick, CK_243X),
1957 CLK(NULL, "uart3_fck", &uart3_fck, CK_243X),
1958 CLK(NULL, "gpios_ick", &gpios_ick, CK_243X),
1959 CLK(NULL, "gpios_fck", &gpios_fck, CK_243X),
1960 CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X),
1961 CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X),
1962 CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X),
1963 CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X),
1964 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X),
1965 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X),
1966 CLK(NULL, "icr_ick", &icr_ick, CK_243X),
1967 CLK("omap24xxcam", "fck", &cam_fck, CK_243X),
1968 CLK(NULL, "cam_fck", &cam_fck, CK_243X),
1969 CLK("omap24xxcam", "ick", &cam_ick, CK_243X),
1970 CLK(NULL, "cam_ick", &cam_ick, CK_243X),
1971 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_243X),
1972 CLK(NULL, "wdt4_ick", &wdt4_ick, CK_243X),
1973 CLK(NULL, "wdt4_fck", &wdt4_fck, CK_243X),
1974 CLK(NULL, "mspro_ick", &mspro_ick, CK_243X),
1975 CLK(NULL, "mspro_fck", &mspro_fck, CK_243X),
1976 CLK(NULL, "fac_ick", &fac_ick, CK_243X),
1977 CLK(NULL, "fac_fck", &fac_fck, CK_243X),
1978 CLK("omap_hdq.0", "ick", &hdq_ick, CK_243X),
1979 CLK(NULL, "hdq_ick", &hdq_ick, CK_243X),
1980 CLK("omap_hdq.1", "fck", &hdq_fck, CK_243X),
1981 CLK(NULL, "hdq_fck", &hdq_fck, CK_243X),
1982 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_243X),
1983 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_243X),
1984 CLK(NULL, "i2chs1_fck", &i2chs1_fck, CK_243X),
1985 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_243X),
1986 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_243X),
1987 CLK(NULL, "i2chs2_fck", &i2chs2_fck, CK_243X),
1988 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_243X),
1989 CLK(NULL, "sdma_fck", &sdma_fck, CK_243X),
1990 CLK(NULL, "sdma_ick", &sdma_ick, CK_243X),
1991 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_243X),
1992 CLK(NULL, "des_ick", &des_ick, CK_243X),
1993 CLK("omap-sham", "ick", &sha_ick, CK_243X),
1994 CLK("omap_rng", "ick", &rng_ick, CK_243X),
1995 CLK(NULL, "rng_ick", &rng_ick, CK_243X),
1996 CLK("omap-aes", "ick", &aes_ick, CK_243X),
1997 CLK(NULL, "pka_ick", &pka_ick, CK_243X),
1998 CLK(NULL, "usb_fck", &usb_fck, CK_243X),
1999 CLK("musb-omap2430", "ick", &usbhs_ick, CK_243X),
2000 CLK(NULL, "usbhs_ick", &usbhs_ick, CK_243X),
2001 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_243X),
2002 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_243X),
2003 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_243X),
2004 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_243X),
2005 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_243X),
2006 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_243X),
2007 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_243X),
2008 CLK(NULL, "gpio5_fck", &gpio5_fck, CK_243X),
2009 CLK(NULL, "mdm_intc_ick", &mdm_intc_ick, CK_243X),
2010 CLK("omap_hsmmc.0", "mmchsdb_fck", &mmchsdb1_fck, CK_243X),
2011 CLK(NULL, "mmchsdb1_fck", &mmchsdb1_fck, CK_243X),
2012 CLK("omap_hsmmc.1", "mmchsdb_fck", &mmchsdb2_fck, CK_243X),
2013 CLK(NULL, "mmchsdb2_fck", &mmchsdb2_fck, CK_243X),
2014 CLK(NULL, "timer_32k_ck", &func_32k_ck, CK_243X),
2015 CLK(NULL, "timer_sys_ck", &sys_ck, CK_243X),
2016 CLK(NULL, "timer_ext_ck", &alt_ck, CK_243X),
2017 CLK(NULL, "cpufreq_ck", &virt_prcm_set, CK_243X),
2018};
2019
2020/*
2021 * init code
2022 */
2023
2024int __init omap2430_clk_init(void)
2025{
2026 const struct prcm_config *prcm;
2027 struct omap_clk *c;
2028 u32 clkrate;
2029
2030 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2031 cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
2032 cpu_mask = RATE_IN_243X;
2033 rate_table = omap2430_rate_table;
2034
2035 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2036 c++)
2037 clk_preinit(c->lk.clk);
2038
2039 osc_ck.rate = omap2_osc_clk_recalc(&osc_ck);
2040 propagate_rate(&osc_ck);
2041 sys_ck.rate = omap2xxx_sys_clk_recalc(&sys_ck);
2042 propagate_rate(&sys_ck);
2043
2044 for (c = omap2430_clks; c < omap2430_clks + ARRAY_SIZE(omap2430_clks);
2045 c++) {
2046 clkdev_add(&c->lk);
2047 clk_register(c->lk.clk);
2048 omap2_init_clk_clkdm(c->lk.clk);
2049 }
2050
2051 /* Disable autoidle on all clocks; let the PM code enable it later */
2052 omap_clk_disable_autoidle_all();
2053
2054 /* Check the MPU rate set by bootloader */
2055 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck);
2056 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
2057 if (!(prcm->flags & cpu_mask))
2058 continue;
2059 if (prcm->xtal_speed != sys_ck.rate)
2060 continue;
2061 if (prcm->dpll_speed <= clkrate)
2062 break;
2063 }
2064 curr_prcm_set = prcm;
2065
2066 recalculate_root_clocks();
2067
2068 pr_info("Clocking rate (Crystal/DPLL/MPU): %ld.%01ld/%ld/%ld MHz\n",
2069 (sys_ck.rate / 1000000), (sys_ck.rate / 100000) % 10,
2070 (dpll_ck.rate / 1000000), (mpu_ck.rate / 1000000)) ;
2071
2072 /*
2073 * Only enable those clocks we will need, let the drivers
2074 * enable other clocks as necessary
2075 */
2076 clk_enable_init_clocks();
2077
2078 /* Avoid sleeping sleeping during omap2_clk_prepare_for_reboot() */
2079 vclk = clk_get(NULL, "virt_prcm_set");
2080 sclk = clk_get(NULL, "sys_ck");
2081 dclk = clk_get(NULL, "dpll_ck");
2082
2083 return 0;
2084}
2085
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index 5feee16fee0e..1ff646908627 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -28,27 +28,12 @@
28#include "cm.h" 28#include "cm.h"
29#include "cm-regbits-24xx.h" 29#include "cm-regbits-24xx.h"
30 30
31struct clk *vclk, *sclk, *dclk; 31struct clk_hw *dclk_hw;
32
33/* 32/*
34 * Omap24xx specific clock functions 33 * Omap24xx specific clock functions
35 */ 34 */
36 35
37/* 36/*
38 * Set clocks for bypass mode for reboot to work.
39 */
40void omap2xxx_clk_prepare_for_reboot(void)
41{
42 u32 rate;
43
44 if (vclk == NULL || sclk == NULL)
45 return;
46
47 rate = clk_get_rate(sclk);
48 clk_set_rate(vclk, rate);
49}
50
51/*
52 * Switch the MPU rate if specified on cmdline. We cannot do this 37 * Switch the MPU rate if specified on cmdline. We cannot do this
53 * early until cmdline is parsed. XXX This should be removed from the 38 * early until cmdline is parsed. XXX This should be removed from the
54 * clock code and handled by the OPP layer code in the near future. 39 * clock code and handled by the OPP layer code in the near future.
diff --git a/arch/arm/mach-omap2/clock2xxx.h b/arch/arm/mach-omap2/clock2xxx.h
index cb6df8ca9e4a..539dc08afbba 100644
--- a/arch/arm/mach-omap2/clock2xxx.h
+++ b/arch/arm/mach-omap2/clock2xxx.h
@@ -8,17 +8,34 @@
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK2XXX_H
10 10
11unsigned long omap2_table_mpu_recalc(struct clk *clk); 11#include <linux/clk-provider.h>
12int omap2_select_table_rate(struct clk *clk, unsigned long rate); 12#include "clock.h"
13long omap2_round_to_table_rate(struct clk *clk, unsigned long rate); 13
14unsigned long omap2xxx_sys_clk_recalc(struct clk *clk); 14unsigned long omap2_table_mpu_recalc(struct clk_hw *clk,
15unsigned long omap2_osc_clk_recalc(struct clk *clk); 15 unsigned long parent_rate);
16unsigned long omap2_dpllcore_recalc(struct clk *clk); 16int omap2_select_table_rate(struct clk_hw *hw, unsigned long rate,
17int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); 17 unsigned long parent_rate);
18unsigned long omap2xxx_clk_get_core_rate(struct clk *clk); 18long omap2_round_to_table_rate(struct clk_hw *hw, unsigned long rate,
19 unsigned long *parent_rate);
20unsigned long omap2xxx_sys_clk_recalc(struct clk_hw *clk,
21 unsigned long parent_rate);
22unsigned long omap2_osc_clk_recalc(struct clk_hw *clk,
23 unsigned long parent_rate);
24unsigned long omap2_dpllcore_recalc(struct clk_hw *hw,
25 unsigned long parent_rate);
26int omap2_reprogram_dpllcore(struct clk_hw *clk, unsigned long rate,
27 unsigned long parent_rate);
28void omap2xxx_clkt_dpllcore_init(struct clk_hw *hw);
29unsigned long omap2_clk_apll54_recalc(struct clk_hw *hw,
30 unsigned long parent_rate);
31unsigned long omap2_clk_apll96_recalc(struct clk_hw *hw,
32 unsigned long parent_rate);
33unsigned long omap2xxx_clk_get_core_rate(void);
19u32 omap2xxx_get_apll_clkin(void); 34u32 omap2xxx_get_apll_clkin(void);
20u32 omap2xxx_get_sysclkdiv(void); 35u32 omap2xxx_get_sysclkdiv(void);
21void omap2xxx_clk_prepare_for_reboot(void); 36void omap2xxx_clk_prepare_for_reboot(void);
37void omap2xxx_clkt_vps_check_bootloader_rates(void);
38void omap2xxx_clkt_vps_late_init(void);
22 39
23#ifdef CONFIG_SOC_OMAP2420 40#ifdef CONFIG_SOC_OMAP2420
24int omap2420_clk_init(void); 41int omap2420_clk_init(void);
@@ -32,13 +49,14 @@ int omap2430_clk_init(void);
32#define omap2430_clk_init() do { } while(0) 49#define omap2430_clk_init() do { } while(0)
33#endif 50#endif
34 51
35extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll; 52extern void __iomem *prcm_clksrc_ctrl;
36 53
37extern struct clk *dclk; 54extern struct clk_hw *dclk_hw;
38 55int omap2_enable_osc_ck(struct clk_hw *hw);
39extern const struct clkops clkops_omap2430_i2chs_wait; 56void omap2_disable_osc_ck(struct clk_hw *hw);
40extern const struct clkops clkops_oscck; 57int omap2_clk_apll96_enable(struct clk_hw *hw);
41extern const struct clkops clkops_apll96; 58int omap2_clk_apll54_enable(struct clk_hw *hw);
42extern const struct clkops clkops_apll54; 59void omap2_clk_apll96_disable(struct clk_hw *hw);
60void omap2_clk_apll54_disable(struct clk_hw *hw);
43 61
44#endif 62#endif
diff --git a/arch/arm/mach-omap2/clock33xx_data.c b/arch/arm/mach-omap2/clock33xx_data.c
deleted file mode 100644
index 17e3de51bcba..000000000000
--- a/arch/arm/mach-omap2/clock33xx_data.c
+++ /dev/null
@@ -1,1109 +0,0 @@
1/*
2 * AM33XX Clock data
3 *
4 * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation version 2.
10 *
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
12 * kind, whether express or implied; without even the implied warranty
13 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#include <linux/kernel.h>
18#include <linux/list.h>
19#include <linux/clk.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "control.h"
24#include "clock.h"
25#include "cm.h"
26#include "cm33xx.h"
27#include "cm-regbits-33xx.h"
28#include "prm.h"
29
30/* Maximum DPLL multiplier, divider values for AM33XX */
31#define AM33XX_MAX_DPLL_MULT 2047
32#define AM33XX_MAX_DPLL_DIV 128
33
34/* Modulemode control */
35#define AM33XX_MODULEMODE_HWCTRL 0
36#define AM33XX_MODULEMODE_SWCTRL 1
37
38/* TRM ERRATA: Timer 3 & 6 default parent (TCLKIN) may not be always
39 * physically present, in such a case HWMOD enabling of
40 * clock would be failure with default parent. And timer
41 * probe thinks clock is already enabled, this leads to
42 * crash upon accessing timer 3 & 6 registers in probe.
43 * Fix by setting parent of both these timers to master
44 * oscillator clock.
45 */
46static inline void am33xx_init_timer_parent(struct clk *clk)
47{
48 omap2_clksel_set_parent(clk, clk->parent);
49}
50
51/* Root clocks */
52
53/* RTC 32k */
54static struct clk clk_32768_ck = {
55 .name = "clk_32768_ck",
56 .clkdm_name = "l4_rtc_clkdm",
57 .rate = 32768,
58 .ops = &clkops_null,
59};
60
61/* On-Chip 32KHz RC OSC */
62static struct clk clk_rc32k_ck = {
63 .name = "clk_rc32k_ck",
64 .rate = 32000,
65 .ops = &clkops_null,
66};
67
68/* Crystal input clks */
69static struct clk virt_24000000_ck = {
70 .name = "virt_24000000_ck",
71 .rate = 24000000,
72 .ops = &clkops_null,
73};
74
75static struct clk virt_25000000_ck = {
76 .name = "virt_25000000_ck",
77 .rate = 25000000,
78 .ops = &clkops_null,
79};
80
81/* Oscillator clock */
82/* 19.2, 24, 25 or 26 MHz */
83static const struct clksel sys_clkin_sel[] = {
84 { .parent = &virt_19200000_ck, .rates = div_1_0_rates },
85 { .parent = &virt_24000000_ck, .rates = div_1_1_rates },
86 { .parent = &virt_25000000_ck, .rates = div_1_2_rates },
87 { .parent = &virt_26000000_ck, .rates = div_1_3_rates },
88 { .parent = NULL },
89};
90
91/* External clock - 12 MHz */
92static struct clk tclkin_ck = {
93 .name = "tclkin_ck",
94 .rate = 12000000,
95 .ops = &clkops_null,
96};
97
98/*
99 * sys_clk in: input to the dpll and also used as funtional clock for,
100 * adc_tsc, smartreflex0-1, timer1-7, mcasp0-1, dcan0-1, cefuse
101 *
102 */
103static struct clk sys_clkin_ck = {
104 .name = "sys_clkin_ck",
105 .parent = &virt_24000000_ck,
106 .init = &omap2_init_clksel_parent,
107 .clksel_reg = AM33XX_CTRL_REGADDR(AM33XX_CONTROL_STATUS),
108 .clksel_mask = AM33XX_CONTROL_STATUS_SYSBOOT1_MASK,
109 .clksel = sys_clkin_sel,
110 .ops = &clkops_null,
111 .recalc = &omap2_clksel_recalc,
112};
113
114/* DPLL_CORE */
115static struct dpll_data dpll_core_dd = {
116 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_CORE,
117 .clk_bypass = &sys_clkin_ck,
118 .clk_ref = &sys_clkin_ck,
119 .control_reg = AM33XX_CM_CLKMODE_DPLL_CORE,
120 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
121 .idlest_reg = AM33XX_CM_IDLEST_DPLL_CORE,
122 .mult_mask = AM33XX_DPLL_MULT_MASK,
123 .div1_mask = AM33XX_DPLL_DIV_MASK,
124 .enable_mask = AM33XX_DPLL_EN_MASK,
125 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
126 .max_multiplier = AM33XX_MAX_DPLL_MULT,
127 .max_divider = AM33XX_MAX_DPLL_DIV,
128 .min_divider = 1,
129};
130
131/* CLKDCOLDO output */
132static struct clk dpll_core_ck = {
133 .name = "dpll_core_ck",
134 .parent = &sys_clkin_ck,
135 .dpll_data = &dpll_core_dd,
136 .init = &omap2_init_dpll_parent,
137 .ops = &clkops_omap3_core_dpll_ops,
138 .recalc = &omap3_dpll_recalc,
139};
140
141static struct clk dpll_core_x2_ck = {
142 .name = "dpll_core_x2_ck",
143 .parent = &dpll_core_ck,
144 .flags = CLOCK_CLKOUTX2,
145 .ops = &clkops_null,
146 .recalc = &omap3_clkoutx2_recalc,
147};
148
149
150static const struct clksel dpll_core_m4_div[] = {
151 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
152 { .parent = NULL },
153};
154
155static struct clk dpll_core_m4_ck = {
156 .name = "dpll_core_m4_ck",
157 .parent = &dpll_core_x2_ck,
158 .init = &omap2_init_clksel_parent,
159 .clksel = dpll_core_m4_div,
160 .clksel_reg = AM33XX_CM_DIV_M4_DPLL_CORE,
161 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT1_DIV_MASK,
162 .ops = &clkops_null,
163 .recalc = &omap2_clksel_recalc,
164 .round_rate = &omap2_clksel_round_rate,
165 .set_rate = &omap2_clksel_set_rate,
166};
167
168static const struct clksel dpll_core_m5_div[] = {
169 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
170 { .parent = NULL },
171};
172
173static struct clk dpll_core_m5_ck = {
174 .name = "dpll_core_m5_ck",
175 .parent = &dpll_core_x2_ck,
176 .init = &omap2_init_clksel_parent,
177 .clksel = dpll_core_m5_div,
178 .clksel_reg = AM33XX_CM_DIV_M5_DPLL_CORE,
179 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT2_DIV_MASK,
180 .ops = &clkops_null,
181 .recalc = &omap2_clksel_recalc,
182 .round_rate = &omap2_clksel_round_rate,
183 .set_rate = &omap2_clksel_set_rate,
184};
185
186static const struct clksel dpll_core_m6_div[] = {
187 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
188 { .parent = NULL },
189};
190
191static struct clk dpll_core_m6_ck = {
192 .name = "dpll_core_m6_ck",
193 .parent = &dpll_core_x2_ck,
194 .init = &omap2_init_clksel_parent,
195 .clksel = dpll_core_m6_div,
196 .clksel_reg = AM33XX_CM_DIV_M6_DPLL_CORE,
197 .clksel_mask = AM33XX_HSDIVIDER_CLKOUT3_DIV_MASK,
198 .ops = &clkops_null,
199 .recalc = &omap2_clksel_recalc,
200 .round_rate = &omap2_clksel_round_rate,
201 .set_rate = &omap2_clksel_set_rate,
202};
203
204/* DPLL_MPU */
205static struct dpll_data dpll_mpu_dd = {
206 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_MPU,
207 .clk_bypass = &sys_clkin_ck,
208 .clk_ref = &sys_clkin_ck,
209 .control_reg = AM33XX_CM_CLKMODE_DPLL_MPU,
210 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
211 .idlest_reg = AM33XX_CM_IDLEST_DPLL_MPU,
212 .mult_mask = AM33XX_DPLL_MULT_MASK,
213 .div1_mask = AM33XX_DPLL_DIV_MASK,
214 .enable_mask = AM33XX_DPLL_EN_MASK,
215 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
216 .max_multiplier = AM33XX_MAX_DPLL_MULT,
217 .max_divider = AM33XX_MAX_DPLL_DIV,
218 .min_divider = 1,
219};
220
221/* CLKOUT: fdpll/M2 */
222static struct clk dpll_mpu_ck = {
223 .name = "dpll_mpu_ck",
224 .parent = &sys_clkin_ck,
225 .dpll_data = &dpll_mpu_dd,
226 .init = &omap2_init_dpll_parent,
227 .ops = &clkops_omap3_noncore_dpll_ops,
228 .recalc = &omap3_dpll_recalc,
229 .round_rate = &omap2_dpll_round_rate,
230 .set_rate = &omap3_noncore_dpll_set_rate,
231};
232
233/*
234 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
235 * and ALT_CLK1/2)
236 */
237static const struct clksel dpll_mpu_m2_div[] = {
238 { .parent = &dpll_mpu_ck, .rates = div31_1to31_rates },
239 { .parent = NULL },
240};
241
242static struct clk dpll_mpu_m2_ck = {
243 .name = "dpll_mpu_m2_ck",
244 .clkdm_name = "mpu_clkdm",
245 .parent = &dpll_mpu_ck,
246 .clksel = dpll_mpu_m2_div,
247 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_MPU,
248 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
249 .ops = &clkops_null,
250 .recalc = &omap2_clksel_recalc,
251 .round_rate = &omap2_clksel_round_rate,
252 .set_rate = &omap2_clksel_set_rate,
253};
254
255/* DPLL_DDR */
256static struct dpll_data dpll_ddr_dd = {
257 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DDR,
258 .clk_bypass = &sys_clkin_ck,
259 .clk_ref = &sys_clkin_ck,
260 .control_reg = AM33XX_CM_CLKMODE_DPLL_DDR,
261 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
262 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DDR,
263 .mult_mask = AM33XX_DPLL_MULT_MASK,
264 .div1_mask = AM33XX_DPLL_DIV_MASK,
265 .enable_mask = AM33XX_DPLL_EN_MASK,
266 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
267 .max_multiplier = AM33XX_MAX_DPLL_MULT,
268 .max_divider = AM33XX_MAX_DPLL_DIV,
269 .min_divider = 1,
270};
271
272/* CLKOUT: fdpll/M2 */
273static struct clk dpll_ddr_ck = {
274 .name = "dpll_ddr_ck",
275 .parent = &sys_clkin_ck,
276 .dpll_data = &dpll_ddr_dd,
277 .init = &omap2_init_dpll_parent,
278 .ops = &clkops_null,
279 .recalc = &omap3_dpll_recalc,
280};
281
282/*
283 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
284 * and ALT_CLK1/2)
285 */
286static const struct clksel dpll_ddr_m2_div[] = {
287 { .parent = &dpll_ddr_ck, .rates = div31_1to31_rates },
288 { .parent = NULL },
289};
290
291static struct clk dpll_ddr_m2_ck = {
292 .name = "dpll_ddr_m2_ck",
293 .parent = &dpll_ddr_ck,
294 .clksel = dpll_ddr_m2_div,
295 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_DDR,
296 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
297 .ops = &clkops_null,
298 .recalc = &omap2_clksel_recalc,
299 .round_rate = &omap2_clksel_round_rate,
300 .set_rate = &omap2_clksel_set_rate,
301};
302
303/* emif_fck functional clock */
304static struct clk dpll_ddr_m2_div2_ck = {
305 .name = "dpll_ddr_m2_div2_ck",
306 .clkdm_name = "l3_clkdm",
307 .parent = &dpll_ddr_m2_ck,
308 .ops = &clkops_null,
309 .fixed_div = 2,
310 .recalc = &omap_fixed_divisor_recalc,
311};
312
313/* DPLL_DISP */
314static struct dpll_data dpll_disp_dd = {
315 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_DISP,
316 .clk_bypass = &sys_clkin_ck,
317 .clk_ref = &sys_clkin_ck,
318 .control_reg = AM33XX_CM_CLKMODE_DPLL_DISP,
319 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
320 .idlest_reg = AM33XX_CM_IDLEST_DPLL_DISP,
321 .mult_mask = AM33XX_DPLL_MULT_MASK,
322 .div1_mask = AM33XX_DPLL_DIV_MASK,
323 .enable_mask = AM33XX_DPLL_EN_MASK,
324 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
325 .max_multiplier = AM33XX_MAX_DPLL_MULT,
326 .max_divider = AM33XX_MAX_DPLL_DIV,
327 .min_divider = 1,
328};
329
330/* CLKOUT: fdpll/M2 */
331static struct clk dpll_disp_ck = {
332 .name = "dpll_disp_ck",
333 .parent = &sys_clkin_ck,
334 .dpll_data = &dpll_disp_dd,
335 .init = &omap2_init_dpll_parent,
336 .ops = &clkops_null,
337 .recalc = &omap3_dpll_recalc,
338 .round_rate = &omap2_dpll_round_rate,
339 .set_rate = &omap3_noncore_dpll_set_rate,
340};
341
342/*
343 * TODO: Add clksel here (sys_clkin, CORE_CLKOUTM6, PER_CLKOUTM2
344 * and ALT_CLK1/2)
345 */
346static const struct clksel dpll_disp_m2_div[] = {
347 { .parent = &dpll_disp_ck, .rates = div31_1to31_rates },
348 { .parent = NULL },
349};
350
351static struct clk dpll_disp_m2_ck = {
352 .name = "dpll_disp_m2_ck",
353 .parent = &dpll_disp_ck,
354 .clksel = dpll_disp_m2_div,
355 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_DISP,
356 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
357 .ops = &clkops_null,
358 .recalc = &omap2_clksel_recalc,
359 .round_rate = &omap2_clksel_round_rate,
360 .set_rate = &omap2_clksel_set_rate,
361};
362
363/* DPLL_PER */
364static struct dpll_data dpll_per_dd = {
365 .mult_div1_reg = AM33XX_CM_CLKSEL_DPLL_PERIPH,
366 .clk_bypass = &sys_clkin_ck,
367 .clk_ref = &sys_clkin_ck,
368 .control_reg = AM33XX_CM_CLKMODE_DPLL_PER,
369 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
370 .idlest_reg = AM33XX_CM_IDLEST_DPLL_PER,
371 .mult_mask = AM33XX_DPLL_MULT_PERIPH_MASK,
372 .div1_mask = AM33XX_DPLL_PER_DIV_MASK,
373 .enable_mask = AM33XX_DPLL_EN_MASK,
374 .idlest_mask = AM33XX_ST_DPLL_CLK_MASK,
375 .max_multiplier = AM33XX_MAX_DPLL_MULT,
376 .max_divider = AM33XX_MAX_DPLL_DIV,
377 .min_divider = 1,
378 .flags = DPLL_J_TYPE,
379};
380
381/* CLKDCOLDO */
382static struct clk dpll_per_ck = {
383 .name = "dpll_per_ck",
384 .parent = &sys_clkin_ck,
385 .dpll_data = &dpll_per_dd,
386 .init = &omap2_init_dpll_parent,
387 .ops = &clkops_null,
388 .recalc = &omap3_dpll_recalc,
389 .round_rate = &omap2_dpll_round_rate,
390 .set_rate = &omap3_noncore_dpll_set_rate,
391};
392
393/* CLKOUT: fdpll/M2 */
394static const struct clksel dpll_per_m2_div[] = {
395 { .parent = &dpll_per_ck, .rates = div31_1to31_rates },
396 { .parent = NULL },
397};
398
399static struct clk dpll_per_m2_ck = {
400 .name = "dpll_per_m2_ck",
401 .parent = &dpll_per_ck,
402 .clksel = dpll_per_m2_div,
403 .clksel_reg = AM33XX_CM_DIV_M2_DPLL_PER,
404 .clksel_mask = AM33XX_DPLL_CLKOUT_DIV_MASK,
405 .ops = &clkops_null,
406 .recalc = &omap2_clksel_recalc,
407 .round_rate = &omap2_clksel_round_rate,
408 .set_rate = &omap2_clksel_set_rate,
409};
410
411static struct clk dpll_per_m2_div4_wkupdm_ck = {
412 .name = "dpll_per_m2_div4_wkupdm_ck",
413 .clkdm_name = "l4_wkup_clkdm",
414 .parent = &dpll_per_m2_ck,
415 .fixed_div = 4,
416 .ops = &clkops_null,
417 .recalc = &omap_fixed_divisor_recalc,
418};
419
420static struct clk dpll_per_m2_div4_ck = {
421 .name = "dpll_per_m2_div4_ck",
422 .clkdm_name = "l4ls_clkdm",
423 .parent = &dpll_per_m2_ck,
424 .fixed_div = 4,
425 .ops = &clkops_null,
426 .recalc = &omap_fixed_divisor_recalc,
427};
428
429static struct clk l3_gclk = {
430 .name = "l3_gclk",
431 .clkdm_name = "l3_clkdm",
432 .parent = &dpll_core_m4_ck,
433 .ops = &clkops_null,
434 .recalc = &followparent_recalc,
435};
436
437static struct clk dpll_core_m4_div2_ck = {
438 .name = "dpll_core_m4_div2_ck",
439 .clkdm_name = "l4_wkup_clkdm",
440 .parent = &dpll_core_m4_ck,
441 .ops = &clkops_null,
442 .fixed_div = 2,
443 .recalc = &omap_fixed_divisor_recalc,
444};
445
446static struct clk l4_rtc_gclk = {
447 .name = "l4_rtc_gclk",
448 .parent = &dpll_core_m4_ck,
449 .ops = &clkops_null,
450 .fixed_div = 2,
451 .recalc = &omap_fixed_divisor_recalc,
452};
453
454static struct clk clk_24mhz = {
455 .name = "clk_24mhz",
456 .parent = &dpll_per_m2_ck,
457 .fixed_div = 8,
458 .ops = &clkops_null,
459 .recalc = &omap_fixed_divisor_recalc,
460};
461
462/*
463 * Below clock nodes describes clockdomains derived out
464 * of core clock.
465 */
466static struct clk l4hs_gclk = {
467 .name = "l4hs_gclk",
468 .clkdm_name = "l4hs_clkdm",
469 .parent = &dpll_core_m4_ck,
470 .ops = &clkops_null,
471 .recalc = &followparent_recalc,
472};
473
474static struct clk l3s_gclk = {
475 .name = "l3s_gclk",
476 .clkdm_name = "l3s_clkdm",
477 .parent = &dpll_core_m4_div2_ck,
478 .ops = &clkops_null,
479 .recalc = &followparent_recalc,
480};
481
482static struct clk l4fw_gclk = {
483 .name = "l4fw_gclk",
484 .clkdm_name = "l4fw_clkdm",
485 .parent = &dpll_core_m4_div2_ck,
486 .ops = &clkops_null,
487 .recalc = &followparent_recalc,
488};
489
490static struct clk l4ls_gclk = {
491 .name = "l4ls_gclk",
492 .clkdm_name = "l4ls_clkdm",
493 .parent = &dpll_core_m4_div2_ck,
494 .ops = &clkops_null,
495 .recalc = &followparent_recalc,
496};
497
498static struct clk sysclk_div_ck = {
499 .name = "sysclk_div_ck",
500 .parent = &dpll_core_m4_ck,
501 .ops = &clkops_null,
502 .recalc = &followparent_recalc,
503};
504
505/*
506 * In order to match the clock domain with hwmod clockdomain entry,
507 * separate clock nodes is required for the modules which are
508 * directly getting their funtioncal clock from sys_clkin.
509 */
510static struct clk adc_tsc_fck = {
511 .name = "adc_tsc_fck",
512 .clkdm_name = "l4_wkup_clkdm",
513 .parent = &sys_clkin_ck,
514 .ops = &clkops_null,
515 .recalc = &followparent_recalc,
516};
517
518static struct clk dcan0_fck = {
519 .name = "dcan0_fck",
520 .clkdm_name = "l4ls_clkdm",
521 .parent = &sys_clkin_ck,
522 .ops = &clkops_null,
523 .recalc = &followparent_recalc,
524};
525
526static struct clk dcan1_fck = {
527 .name = "dcan1_fck",
528 .clkdm_name = "l4ls_clkdm",
529 .parent = &sys_clkin_ck,
530 .ops = &clkops_null,
531 .recalc = &followparent_recalc,
532};
533
534static struct clk mcasp0_fck = {
535 .name = "mcasp0_fck",
536 .clkdm_name = "l3s_clkdm",
537 .parent = &sys_clkin_ck,
538 .ops = &clkops_null,
539 .recalc = &followparent_recalc,
540};
541
542static struct clk mcasp1_fck = {
543 .name = "mcasp1_fck",
544 .clkdm_name = "l3s_clkdm",
545 .parent = &sys_clkin_ck,
546 .ops = &clkops_null,
547 .recalc = &followparent_recalc,
548};
549
550static struct clk smartreflex0_fck = {
551 .name = "smartreflex0_fck",
552 .clkdm_name = "l4_wkup_clkdm",
553 .parent = &sys_clkin_ck,
554 .ops = &clkops_null,
555 .recalc = &followparent_recalc,
556};
557
558static struct clk smartreflex1_fck = {
559 .name = "smartreflex1_fck",
560 .clkdm_name = "l4_wkup_clkdm",
561 .parent = &sys_clkin_ck,
562 .ops = &clkops_null,
563 .recalc = &followparent_recalc,
564};
565
566/*
567 * Modules clock nodes
568 *
569 * The following clock leaf nodes are added for the moment because:
570 *
571 * - hwmod data is not present for these modules, either hwmod
572 * control is not required or its not populated.
573 * - Driver code is not yet migrated to use hwmod/runtime pm
574 * - Modules outside kernel access (to disable them by default)
575 *
576 * - debugss
577 * - mmu (gfx domain)
578 * - cefuse
579 * - usbotg_fck (its additional clock and not really a modulemode)
580 * - ieee5000
581 */
582static struct clk debugss_ick = {
583 .name = "debugss_ick",
584 .clkdm_name = "l3_aon_clkdm",
585 .parent = &dpll_core_m4_ck,
586 .ops = &clkops_omap2_dflt,
587 .enable_reg = AM33XX_CM_WKUP_DEBUGSS_CLKCTRL,
588 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
589 .recalc = &followparent_recalc,
590};
591
592static struct clk mmu_fck = {
593 .name = "mmu_fck",
594 .clkdm_name = "gfx_l3_clkdm",
595 .parent = &dpll_core_m4_ck,
596 .ops = &clkops_omap2_dflt,
597 .enable_reg = AM33XX_CM_GFX_MMUDATA_CLKCTRL,
598 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
599 .recalc = &followparent_recalc,
600};
601
602static struct clk cefuse_fck = {
603 .name = "cefuse_fck",
604 .clkdm_name = "l4_cefuse_clkdm",
605 .parent = &sys_clkin_ck,
606 .enable_reg = AM33XX_CM_CEFUSE_CEFUSE_CLKCTRL,
607 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
608 .ops = &clkops_omap2_dflt,
609 .recalc = &followparent_recalc,
610};
611
612/*
613 * clkdiv32 is generated from fixed division of 732.4219
614 */
615static struct clk clkdiv32k_ick = {
616 .name = "clkdiv32k_ick",
617 .clkdm_name = "clk_24mhz_clkdm",
618 .rate = 32768,
619 .parent = &clk_24mhz,
620 .enable_reg = AM33XX_CM_PER_CLKDIV32K_CLKCTRL,
621 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
622 .ops = &clkops_omap2_dflt,
623};
624
625static struct clk usbotg_fck = {
626 .name = "usbotg_fck",
627 .clkdm_name = "l3s_clkdm",
628 .parent = &dpll_per_ck,
629 .enable_reg = AM33XX_CM_CLKDCOLDO_DPLL_PER,
630 .enable_bit = AM33XX_ST_DPLL_CLKDCOLDO_SHIFT,
631 .ops = &clkops_omap2_dflt,
632 .recalc = &followparent_recalc,
633};
634
635static struct clk ieee5000_fck = {
636 .name = "ieee5000_fck",
637 .clkdm_name = "l3s_clkdm",
638 .parent = &dpll_core_m4_div2_ck,
639 .enable_reg = AM33XX_CM_PER_IEEE5000_CLKCTRL,
640 .enable_bit = AM33XX_MODULEMODE_SWCTRL,
641 .ops = &clkops_omap2_dflt,
642 .recalc = &followparent_recalc,
643};
644
645/* Timers */
646static const struct clksel timer1_clkmux_sel[] = {
647 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
648 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
649 { .parent = &tclkin_ck, .rates = div_1_2_rates },
650 { .parent = &clk_rc32k_ck, .rates = div_1_3_rates },
651 { .parent = &clk_32768_ck, .rates = div_1_4_rates },
652 { .parent = NULL },
653};
654
655static struct clk timer1_fck = {
656 .name = "timer1_fck",
657 .clkdm_name = "l4ls_clkdm",
658 .parent = &sys_clkin_ck,
659 .init = &omap2_init_clksel_parent,
660 .clksel = timer1_clkmux_sel,
661 .clksel_reg = AM33XX_CLKSEL_TIMER1MS_CLK,
662 .clksel_mask = AM33XX_CLKSEL_0_2_MASK,
663 .ops = &clkops_null,
664 .recalc = &omap2_clksel_recalc,
665};
666
667static const struct clksel timer2_to_7_clk_sel[] = {
668 { .parent = &tclkin_ck, .rates = div_1_0_rates },
669 { .parent = &sys_clkin_ck, .rates = div_1_1_rates },
670 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
671 { .parent = NULL },
672};
673
674static struct clk timer2_fck = {
675 .name = "timer2_fck",
676 .clkdm_name = "l4ls_clkdm",
677 .parent = &sys_clkin_ck,
678 .init = &omap2_init_clksel_parent,
679 .clksel = timer2_to_7_clk_sel,
680 .clksel_reg = AM33XX_CLKSEL_TIMER2_CLK,
681 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
682 .ops = &clkops_null,
683 .recalc = &omap2_clksel_recalc,
684};
685
686static struct clk timer3_fck = {
687 .name = "timer3_fck",
688 .clkdm_name = "l4ls_clkdm",
689 .parent = &sys_clkin_ck,
690 .init = &am33xx_init_timer_parent,
691 .clksel = timer2_to_7_clk_sel,
692 .clksel_reg = AM33XX_CLKSEL_TIMER3_CLK,
693 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
694 .ops = &clkops_null,
695 .recalc = &omap2_clksel_recalc,
696};
697
698static struct clk timer4_fck = {
699 .name = "timer4_fck",
700 .clkdm_name = "l4ls_clkdm",
701 .parent = &sys_clkin_ck,
702 .init = &omap2_init_clksel_parent,
703 .clksel = timer2_to_7_clk_sel,
704 .clksel_reg = AM33XX_CLKSEL_TIMER4_CLK,
705 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
706 .ops = &clkops_null,
707 .recalc = &omap2_clksel_recalc,
708};
709
710static struct clk timer5_fck = {
711 .name = "timer5_fck",
712 .clkdm_name = "l4ls_clkdm",
713 .parent = &sys_clkin_ck,
714 .init = &omap2_init_clksel_parent,
715 .clksel = timer2_to_7_clk_sel,
716 .clksel_reg = AM33XX_CLKSEL_TIMER5_CLK,
717 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
718 .ops = &clkops_null,
719 .recalc = &omap2_clksel_recalc,
720};
721
722static struct clk timer6_fck = {
723 .name = "timer6_fck",
724 .clkdm_name = "l4ls_clkdm",
725 .parent = &sys_clkin_ck,
726 .init = &am33xx_init_timer_parent,
727 .clksel = timer2_to_7_clk_sel,
728 .clksel_reg = AM33XX_CLKSEL_TIMER6_CLK,
729 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
730 .ops = &clkops_null,
731 .recalc = &omap2_clksel_recalc,
732};
733
734static struct clk timer7_fck = {
735 .name = "timer7_fck",
736 .clkdm_name = "l4ls_clkdm",
737 .parent = &sys_clkin_ck,
738 .init = &omap2_init_clksel_parent,
739 .clksel = timer2_to_7_clk_sel,
740 .clksel_reg = AM33XX_CLKSEL_TIMER7_CLK,
741 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
742 .ops = &clkops_null,
743 .recalc = &omap2_clksel_recalc,
744};
745
746static struct clk cpsw_125mhz_gclk = {
747 .name = "cpsw_125mhz_gclk",
748 .clkdm_name = "cpsw_125mhz_clkdm",
749 .parent = &dpll_core_m5_ck,
750 .ops = &clkops_null,
751 .fixed_div = 2,
752 .recalc = &omap_fixed_divisor_recalc,
753};
754
755static const struct clksel cpsw_cpts_rft_clkmux_sel[] = {
756 { .parent = &dpll_core_m5_ck, .rates = div_1_0_rates },
757 { .parent = &dpll_core_m4_ck, .rates = div_1_1_rates },
758 { .parent = NULL },
759};
760
761static struct clk cpsw_cpts_rft_clk = {
762 .name = "cpsw_cpts_rft_clk",
763 .clkdm_name = "cpsw_125mhz_clkdm",
764 .parent = &dpll_core_m5_ck,
765 .clksel = cpsw_cpts_rft_clkmux_sel,
766 .clksel_reg = AM33XX_CM_CPTS_RFT_CLKSEL,
767 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
768 .ops = &clkops_null,
769 .recalc = &followparent_recalc,
770};
771
772/* gpio */
773static const struct clksel gpio0_dbclk_mux_sel[] = {
774 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
775 { .parent = &clk_32768_ck, .rates = div_1_1_rates },
776 { .parent = &clkdiv32k_ick, .rates = div_1_2_rates },
777 { .parent = NULL },
778};
779
780static struct clk gpio0_dbclk_mux_ck = {
781 .name = "gpio0_dbclk_mux_ck",
782 .clkdm_name = "l4_wkup_clkdm",
783 .parent = &clk_rc32k_ck,
784 .init = &omap2_init_clksel_parent,
785 .clksel = gpio0_dbclk_mux_sel,
786 .clksel_reg = AM33XX_CLKSEL_GPIO0_DBCLK,
787 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
788 .ops = &clkops_null,
789 .recalc = &omap2_clksel_recalc,
790};
791
792static struct clk gpio0_dbclk = {
793 .name = "gpio0_dbclk",
794 .clkdm_name = "l4_wkup_clkdm",
795 .parent = &gpio0_dbclk_mux_ck,
796 .enable_reg = AM33XX_CM_WKUP_GPIO0_CLKCTRL,
797 .enable_bit = AM33XX_OPTFCLKEN_GPIO0_GDBCLK_SHIFT,
798 .ops = &clkops_omap2_dflt,
799 .recalc = &followparent_recalc,
800};
801
802static struct clk gpio1_dbclk = {
803 .name = "gpio1_dbclk",
804 .clkdm_name = "l4ls_clkdm",
805 .parent = &clkdiv32k_ick,
806 .enable_reg = AM33XX_CM_PER_GPIO1_CLKCTRL,
807 .enable_bit = AM33XX_OPTFCLKEN_GPIO_1_GDBCLK_SHIFT,
808 .ops = &clkops_omap2_dflt,
809 .recalc = &followparent_recalc,
810};
811
812static struct clk gpio2_dbclk = {
813 .name = "gpio2_dbclk",
814 .clkdm_name = "l4ls_clkdm",
815 .parent = &clkdiv32k_ick,
816 .enable_reg = AM33XX_CM_PER_GPIO2_CLKCTRL,
817 .enable_bit = AM33XX_OPTFCLKEN_GPIO_2_GDBCLK_SHIFT,
818 .ops = &clkops_omap2_dflt,
819 .recalc = &followparent_recalc,
820};
821
822static struct clk gpio3_dbclk = {
823 .name = "gpio3_dbclk",
824 .clkdm_name = "l4ls_clkdm",
825 .parent = &clkdiv32k_ick,
826 .enable_reg = AM33XX_CM_PER_GPIO3_CLKCTRL,
827 .enable_bit = AM33XX_OPTFCLKEN_GPIO_3_GDBCLK_SHIFT,
828 .ops = &clkops_omap2_dflt,
829 .recalc = &followparent_recalc,
830};
831
832static const struct clksel pruss_ocp_clk_mux_sel[] = {
833 { .parent = &l3_gclk, .rates = div_1_0_rates },
834 { .parent = &dpll_disp_m2_ck, .rates = div_1_1_rates },
835 { .parent = NULL },
836};
837
838static struct clk pruss_ocp_gclk = {
839 .name = "pruss_ocp_gclk",
840 .clkdm_name = "pruss_ocp_clkdm",
841 .parent = &l3_gclk,
842 .init = &omap2_init_clksel_parent,
843 .clksel = pruss_ocp_clk_mux_sel,
844 .clksel_reg = AM33XX_CLKSEL_PRUSS_OCP_CLK,
845 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
846 .ops = &clkops_null,
847 .recalc = &followparent_recalc,
848};
849
850static const struct clksel lcd_clk_mux_sel[] = {
851 { .parent = &dpll_disp_m2_ck, .rates = div_1_0_rates },
852 { .parent = &dpll_core_m5_ck, .rates = div_1_1_rates },
853 { .parent = &dpll_per_m2_ck, .rates = div_1_2_rates },
854 { .parent = NULL },
855};
856
857static struct clk lcd_gclk = {
858 .name = "lcd_gclk",
859 .clkdm_name = "lcdc_clkdm",
860 .parent = &dpll_disp_m2_ck,
861 .init = &omap2_init_clksel_parent,
862 .clksel = lcd_clk_mux_sel,
863 .clksel_reg = AM33XX_CLKSEL_LCDC_PIXEL_CLK,
864 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
865 .ops = &clkops_null,
866 .recalc = &followparent_recalc,
867};
868
869static struct clk mmc_clk = {
870 .name = "mmc_clk",
871 .clkdm_name = "l4ls_clkdm",
872 .parent = &dpll_per_m2_ck,
873 .ops = &clkops_null,
874 .fixed_div = 2,
875 .recalc = &omap_fixed_divisor_recalc,
876};
877
878static struct clk mmc2_fck = {
879 .name = "mmc2_fck",
880 .clkdm_name = "l3s_clkdm",
881 .parent = &mmc_clk,
882 .ops = &clkops_null,
883 .recalc = &followparent_recalc,
884};
885
886static const struct clksel gfx_clksel_sel[] = {
887 { .parent = &dpll_core_m4_ck, .rates = div_1_0_rates },
888 { .parent = &dpll_per_m2_ck, .rates = div_1_1_rates },
889 { .parent = NULL },
890};
891
892static struct clk gfx_fclk_clksel_ck = {
893 .name = "gfx_fclk_clksel_ck",
894 .parent = &dpll_core_m4_ck,
895 .clksel = gfx_clksel_sel,
896 .ops = &clkops_null,
897 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
898 .clksel_mask = AM33XX_CLKSEL_GFX_FCLK_MASK,
899 .recalc = &omap2_clksel_recalc,
900};
901
902static const struct clksel_rate div_1_0_2_1_rates[] = {
903 { .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
904 { .div = 2, .val = 1, .flags = RATE_IN_AM33XX },
905 { .div = 0 },
906};
907
908static const struct clksel gfx_div_sel[] = {
909 { .parent = &gfx_fclk_clksel_ck, .rates = div_1_0_2_1_rates },
910 { .parent = NULL },
911};
912
913static struct clk gfx_fck_div_ck = {
914 .name = "gfx_fck_div_ck",
915 .clkdm_name = "gfx_l3_clkdm",
916 .parent = &gfx_fclk_clksel_ck,
917 .init = &omap2_init_clksel_parent,
918 .clksel = gfx_div_sel,
919 .clksel_reg = AM33XX_CLKSEL_GFX_FCLK,
920 .clksel_mask = AM33XX_CLKSEL_0_0_MASK,
921 .recalc = &omap2_clksel_recalc,
922 .round_rate = &omap2_clksel_round_rate,
923 .set_rate = &omap2_clksel_set_rate,
924 .ops = &clkops_null,
925};
926
927static const struct clksel sysclkout_pre_sel[] = {
928 { .parent = &clk_32768_ck, .rates = div_1_0_rates },
929 { .parent = &l3_gclk, .rates = div_1_1_rates },
930 { .parent = &dpll_ddr_m2_ck, .rates = div_1_2_rates },
931 { .parent = &dpll_per_m2_ck, .rates = div_1_3_rates },
932 { .parent = &lcd_gclk, .rates = div_1_4_rates },
933 { .parent = NULL },
934};
935
936static struct clk sysclkout_pre_ck = {
937 .name = "sysclkout_pre_ck",
938 .parent = &clk_32768_ck,
939 .init = &omap2_init_clksel_parent,
940 .clksel = sysclkout_pre_sel,
941 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
942 .clksel_mask = AM33XX_CLKOUT2SOURCE_MASK,
943 .ops = &clkops_null,
944 .recalc = &omap2_clksel_recalc,
945};
946
947/* Divide by 8 clock rates with default clock is 1/1*/
948static const struct clksel_rate div8_rates[] = {
949 { .div = 1, .val = 0, .flags = RATE_IN_AM33XX },
950 { .div = 2, .val = 1, .flags = RATE_IN_AM33XX },
951 { .div = 3, .val = 2, .flags = RATE_IN_AM33XX },
952 { .div = 4, .val = 3, .flags = RATE_IN_AM33XX },
953 { .div = 5, .val = 4, .flags = RATE_IN_AM33XX },
954 { .div = 6, .val = 5, .flags = RATE_IN_AM33XX },
955 { .div = 7, .val = 6, .flags = RATE_IN_AM33XX },
956 { .div = 8, .val = 7, .flags = RATE_IN_AM33XX },
957 { .div = 0 },
958};
959
960static const struct clksel clkout2_div[] = {
961 { .parent = &sysclkout_pre_ck, .rates = div8_rates },
962 { .parent = NULL },
963};
964
965static struct clk clkout2_ck = {
966 .name = "clkout2_ck",
967 .parent = &sysclkout_pre_ck,
968 .ops = &clkops_omap2_dflt,
969 .clksel = clkout2_div,
970 .clksel_reg = AM33XX_CM_CLKOUT_CTRL,
971 .clksel_mask = AM33XX_CLKOUT2DIV_MASK,
972 .enable_reg = AM33XX_CM_CLKOUT_CTRL,
973 .enable_bit = AM33XX_CLKOUT2EN_SHIFT,
974 .recalc = &omap2_clksel_recalc,
975 .round_rate = &omap2_clksel_round_rate,
976 .set_rate = &omap2_clksel_set_rate,
977};
978
979static const struct clksel wdt_clkmux_sel[] = {
980 { .parent = &clk_rc32k_ck, .rates = div_1_0_rates },
981 { .parent = &clkdiv32k_ick, .rates = div_1_1_rates },
982 { .parent = NULL },
983};
984
985static struct clk wdt1_fck = {
986 .name = "wdt1_fck",
987 .clkdm_name = "l4_wkup_clkdm",
988 .parent = &clk_rc32k_ck,
989 .init = &omap2_init_clksel_parent,
990 .clksel = wdt_clkmux_sel,
991 .clksel_reg = AM33XX_CLKSEL_WDT1_CLK,
992 .clksel_mask = AM33XX_CLKSEL_0_1_MASK,
993 .ops = &clkops_null,
994 .recalc = &omap2_clksel_recalc,
995};
996
997/*
998 * clkdev
999 */
1000static struct omap_clk am33xx_clks[] = {
1001 CLK(NULL, "clk_32768_ck", &clk_32768_ck, CK_AM33XX),
1002 CLK(NULL, "clk_rc32k_ck", &clk_rc32k_ck, CK_AM33XX),
1003 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_AM33XX),
1004 CLK(NULL, "virt_24000000_ck", &virt_24000000_ck, CK_AM33XX),
1005 CLK(NULL, "virt_25000000_ck", &virt_25000000_ck, CK_AM33XX),
1006 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_AM33XX),
1007 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_AM33XX),
1008 CLK(NULL, "tclkin_ck", &tclkin_ck, CK_AM33XX),
1009 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_AM33XX),
1010 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_AM33XX),
1011 CLK(NULL, "dpll_core_m4_ck", &dpll_core_m4_ck, CK_AM33XX),
1012 CLK(NULL, "dpll_core_m5_ck", &dpll_core_m5_ck, CK_AM33XX),
1013 CLK(NULL, "dpll_core_m6_ck", &dpll_core_m6_ck, CK_AM33XX),
1014 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_AM33XX),
1015 CLK("cpu0", NULL, &dpll_mpu_ck, CK_AM33XX),
1016 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_AM33XX),
1017 CLK(NULL, "dpll_ddr_ck", &dpll_ddr_ck, CK_AM33XX),
1018 CLK(NULL, "dpll_ddr_m2_ck", &dpll_ddr_m2_ck, CK_AM33XX),
1019 CLK(NULL, "dpll_ddr_m2_div2_ck", &dpll_ddr_m2_div2_ck, CK_AM33XX),
1020 CLK(NULL, "dpll_disp_ck", &dpll_disp_ck, CK_AM33XX),
1021 CLK(NULL, "dpll_disp_m2_ck", &dpll_disp_m2_ck, CK_AM33XX),
1022 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_AM33XX),
1023 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_AM33XX),
1024 CLK(NULL, "dpll_per_m2_div4_wkupdm_ck", &dpll_per_m2_div4_wkupdm_ck, CK_AM33XX),
1025 CLK(NULL, "dpll_per_m2_div4_ck", &dpll_per_m2_div4_ck, CK_AM33XX),
1026 CLK(NULL, "adc_tsc_fck", &adc_tsc_fck, CK_AM33XX),
1027 CLK(NULL, "cefuse_fck", &cefuse_fck, CK_AM33XX),
1028 CLK(NULL, "clkdiv32k_ick", &clkdiv32k_ick, CK_AM33XX),
1029 CLK(NULL, "dcan0_fck", &dcan0_fck, CK_AM33XX),
1030 CLK("481cc000.d_can", NULL, &dcan0_fck, CK_AM33XX),
1031 CLK(NULL, "dcan1_fck", &dcan1_fck, CK_AM33XX),
1032 CLK("481d0000.d_can", NULL, &dcan1_fck, CK_AM33XX),
1033 CLK(NULL, "debugss_ick", &debugss_ick, CK_AM33XX),
1034 CLK(NULL, "pruss_ocp_gclk", &pruss_ocp_gclk, CK_AM33XX),
1035 CLK("davinci-mcasp.0", NULL, &mcasp0_fck, CK_AM33XX),
1036 CLK("davinci-mcasp.1", NULL, &mcasp1_fck, CK_AM33XX),
1037 CLK(NULL, "mcasp0_fck", &mcasp0_fck, CK_AM33XX),
1038 CLK(NULL, "mcasp1_fck", &mcasp1_fck, CK_AM33XX),
1039 CLK("NULL", "mmc2_fck", &mmc2_fck, CK_AM33XX),
1040 CLK(NULL, "mmu_fck", &mmu_fck, CK_AM33XX),
1041 CLK(NULL, "smartreflex0_fck", &smartreflex0_fck, CK_AM33XX),
1042 CLK(NULL, "smartreflex1_fck", &smartreflex1_fck, CK_AM33XX),
1043 CLK(NULL, "timer1_fck", &timer1_fck, CK_AM33XX),
1044 CLK(NULL, "timer2_fck", &timer2_fck, CK_AM33XX),
1045 CLK(NULL, "timer3_fck", &timer3_fck, CK_AM33XX),
1046 CLK(NULL, "timer4_fck", &timer4_fck, CK_AM33XX),
1047 CLK(NULL, "timer5_fck", &timer5_fck, CK_AM33XX),
1048 CLK(NULL, "timer6_fck", &timer6_fck, CK_AM33XX),
1049 CLK(NULL, "timer7_fck", &timer7_fck, CK_AM33XX),
1050 CLK(NULL, "usbotg_fck", &usbotg_fck, CK_AM33XX),
1051 CLK(NULL, "ieee5000_fck", &ieee5000_fck, CK_AM33XX),
1052 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_AM33XX),
1053 CLK(NULL, "l4_rtc_gclk", &l4_rtc_gclk, CK_AM33XX),
1054 CLK(NULL, "l3_gclk", &l3_gclk, CK_AM33XX),
1055 CLK(NULL, "dpll_core_m4_div2_ck", &dpll_core_m4_div2_ck, CK_AM33XX),
1056 CLK(NULL, "l4hs_gclk", &l4hs_gclk, CK_AM33XX),
1057 CLK(NULL, "l3s_gclk", &l3s_gclk, CK_AM33XX),
1058 CLK(NULL, "l4fw_gclk", &l4fw_gclk, CK_AM33XX),
1059 CLK(NULL, "l4ls_gclk", &l4ls_gclk, CK_AM33XX),
1060 CLK(NULL, "clk_24mhz", &clk_24mhz, CK_AM33XX),
1061 CLK(NULL, "sysclk_div_ck", &sysclk_div_ck, CK_AM33XX),
1062 CLK(NULL, "cpsw_125mhz_gclk", &cpsw_125mhz_gclk, CK_AM33XX),
1063 CLK(NULL, "cpsw_cpts_rft_clk", &cpsw_cpts_rft_clk, CK_AM33XX),
1064 CLK(NULL, "gpio0_dbclk_mux_ck", &gpio0_dbclk_mux_ck, CK_AM33XX),
1065 CLK(NULL, "gpio0_dbclk", &gpio0_dbclk, CK_AM33XX),
1066 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_AM33XX),
1067 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_AM33XX),
1068 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_AM33XX),
1069 CLK(NULL, "lcd_gclk", &lcd_gclk, CK_AM33XX),
1070 CLK(NULL, "mmc_clk", &mmc_clk, CK_AM33XX),
1071 CLK(NULL, "gfx_fclk_clksel_ck", &gfx_fclk_clksel_ck, CK_AM33XX),
1072 CLK(NULL, "gfx_fck_div_ck", &gfx_fck_div_ck, CK_AM33XX),
1073 CLK(NULL, "sysclkout_pre_ck", &sysclkout_pre_ck, CK_AM33XX),
1074 CLK(NULL, "clkout2_ck", &clkout2_ck, CK_AM33XX),
1075 CLK(NULL, "timer_32k_ck", &clkdiv32k_ick, CK_AM33XX),
1076 CLK(NULL, "timer_sys_ck", &sys_clkin_ck, CK_AM33XX),
1077};
1078
1079int __init am33xx_clk_init(void)
1080{
1081 struct omap_clk *c;
1082 u32 cpu_clkflg;
1083
1084 if (soc_is_am33xx()) {
1085 cpu_mask = RATE_IN_AM33XX;
1086 cpu_clkflg = CK_AM33XX;
1087 }
1088
1089 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++)
1090 clk_preinit(c->lk.clk);
1091
1092 for (c = am33xx_clks; c < am33xx_clks + ARRAY_SIZE(am33xx_clks); c++) {
1093 if (c->cpu & cpu_clkflg) {
1094 clkdev_add(&c->lk);
1095 clk_register(c->lk.clk);
1096 omap2_init_clk_clkdm(c->lk.clk);
1097 }
1098 }
1099
1100 recalculate_root_clocks();
1101
1102 /*
1103 * Only enable those clocks we will need, let the drivers
1104 * enable other clocks as necessary
1105 */
1106 clk_enable_init_clocks();
1107
1108 return 0;
1109}
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c
index baaaa4258708..4596468e50ab 100644
--- a/arch/arm/mach-omap2/clock34xx.c
+++ b/arch/arm/mach-omap2/clock34xx.c
@@ -23,7 +23,7 @@
23 23
24#include "clock.h" 24#include "clock.h"
25#include "clock34xx.h" 25#include "clock34xx.h"
26#include "cm2xxx_3xxx.h" 26#include "cm3xxx.h"
27#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
28 28
29/** 29/**
@@ -37,7 +37,7 @@
37 * from the CM_{I,F}CLKEN bit. Pass back the correct info via 37 * from the CM_{I,F}CLKEN bit. Pass back the correct info via
38 * @idlest_reg and @idlest_bit. No return value. 38 * @idlest_reg and @idlest_bit. No return value.
39 */ 39 */
40static void omap3430es2_clk_ssi_find_idlest(struct clk *clk, 40static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
41 void __iomem **idlest_reg, 41 void __iomem **idlest_reg,
42 u8 *idlest_bit, 42 u8 *idlest_bit,
43 u8 *idlest_val) 43 u8 *idlest_val)
@@ -49,21 +49,16 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk *clk,
49 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT; 49 *idlest_bit = OMAP3430ES2_ST_SSI_IDLE_SHIFT;
50 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 50 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
51} 51}
52 52const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
53const struct clkops clkops_omap3430es2_ssi_wait = {
54 .enable = omap2_dflt_clk_enable,
55 .disable = omap2_dflt_clk_disable,
56 .find_idlest = omap3430es2_clk_ssi_find_idlest, 53 .find_idlest = omap3430es2_clk_ssi_find_idlest,
57 .find_companion = omap2_clk_dflt_find_companion, 54 .find_companion = omap2_clk_dflt_find_companion,
58}; 55};
59 56
60const struct clkops clkops_omap3430es2_iclk_ssi_wait = { 57const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
61 .enable = omap2_dflt_clk_enable,
62 .disable = omap2_dflt_clk_disable,
63 .find_idlest = omap3430es2_clk_ssi_find_idlest,
64 .find_companion = omap2_clk_dflt_find_companion,
65 .allow_idle = omap2_clkt_iclk_allow_idle, 58 .allow_idle = omap2_clkt_iclk_allow_idle,
66 .deny_idle = omap2_clkt_iclk_deny_idle, 59 .deny_idle = omap2_clkt_iclk_deny_idle,
60 .find_idlest = omap3430es2_clk_ssi_find_idlest,
61 .find_companion = omap2_clk_dflt_find_companion,
67}; 62};
68 63
69/** 64/**
@@ -80,7 +75,7 @@ const struct clkops clkops_omap3430es2_iclk_ssi_wait = {
80 * default find_idlest code assumes that they are at the same 75 * default find_idlest code assumes that they are at the same
81 * position.) No return value. 76 * position.) No return value.
82 */ 77 */
83static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, 78static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk_hw_omap *clk,
84 void __iomem **idlest_reg, 79 void __iomem **idlest_reg,
85 u8 *idlest_bit, 80 u8 *idlest_bit,
86 u8 *idlest_val) 81 u8 *idlest_val)
@@ -94,20 +89,16 @@ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk,
94 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 89 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
95} 90}
96 91
97const struct clkops clkops_omap3430es2_dss_usbhost_wait = { 92const struct clk_hw_omap_ops clkhwops_omap3430es2_dss_usbhost_wait = {
98 .enable = omap2_dflt_clk_enable,
99 .disable = omap2_dflt_clk_disable,
100 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest, 93 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
101 .find_companion = omap2_clk_dflt_find_companion, 94 .find_companion = omap2_clk_dflt_find_companion,
102}; 95};
103 96
104const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = { 97const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_dss_usbhost_wait = {
105 .enable = omap2_dflt_clk_enable,
106 .disable = omap2_dflt_clk_disable,
107 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
108 .find_companion = omap2_clk_dflt_find_companion,
109 .allow_idle = omap2_clkt_iclk_allow_idle, 98 .allow_idle = omap2_clkt_iclk_allow_idle,
110 .deny_idle = omap2_clkt_iclk_deny_idle, 99 .deny_idle = omap2_clkt_iclk_deny_idle,
100 .find_idlest = omap3430es2_clk_dss_usbhost_find_idlest,
101 .find_companion = omap2_clk_dflt_find_companion,
111}; 102};
112 103
113/** 104/**
@@ -121,7 +112,7 @@ const struct clkops clkops_omap3430es2_iclk_dss_usbhost_wait = {
121 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via 112 * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
122 * @idlest_reg and @idlest_bit. No return value. 113 * @idlest_reg and @idlest_bit. No return value.
123 */ 114 */
124static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk, 115static void omap3430es2_clk_hsotgusb_find_idlest(struct clk_hw_omap *clk,
125 void __iomem **idlest_reg, 116 void __iomem **idlest_reg,
126 u8 *idlest_bit, 117 u8 *idlest_bit,
127 u8 *idlest_val) 118 u8 *idlest_val)
@@ -134,18 +125,14 @@ static void omap3430es2_clk_hsotgusb_find_idlest(struct clk *clk,
134 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 125 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
135} 126}
136 127
137const struct clkops clkops_omap3430es2_hsotgusb_wait = { 128const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
138 .enable = omap2_dflt_clk_enable, 129 .allow_idle = omap2_clkt_iclk_allow_idle,
139 .disable = omap2_dflt_clk_disable, 130 .deny_idle = omap2_clkt_iclk_deny_idle,
140 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest, 131 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
141 .find_companion = omap2_clk_dflt_find_companion, 132 .find_companion = omap2_clk_dflt_find_companion,
142}; 133};
143 134
144const struct clkops clkops_omap3430es2_iclk_hsotgusb_wait = { 135const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
145 .enable = omap2_dflt_clk_enable,
146 .disable = omap2_dflt_clk_disable,
147 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest, 136 .find_idlest = omap3430es2_clk_hsotgusb_find_idlest,
148 .find_companion = omap2_clk_dflt_find_companion, 137 .find_companion = omap2_clk_dflt_find_companion,
149 .allow_idle = omap2_clkt_iclk_allow_idle,
150 .deny_idle = omap2_clkt_iclk_deny_idle,
151}; 138};
diff --git a/arch/arm/mach-omap2/clock3517.c b/arch/arm/mach-omap2/clock3517.c
index 80209050cd7a..4d79ae2c0241 100644
--- a/arch/arm/mach-omap2/clock3517.c
+++ b/arch/arm/mach-omap2/clock3517.c
@@ -23,7 +23,7 @@
23 23
24#include "clock.h" 24#include "clock.h"
25#include "clock3517.h" 25#include "clock3517.h"
26#include "cm2xxx_3xxx.h" 26#include "cm3xxx.h"
27#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
28 28
29/* 29/*
@@ -47,7 +47,7 @@
47 * in the enable register itsel at a bit offset of 4 from the enable 47 * in the enable register itsel at a bit offset of 4 from the enable
48 * bit. A value of 1 indicates that clock is enabled. 48 * bit. A value of 1 indicates that clock is enabled.
49 */ 49 */
50static void am35xx_clk_find_idlest(struct clk *clk, 50static void am35xx_clk_find_idlest(struct clk_hw_omap *clk,
51 void __iomem **idlest_reg, 51 void __iomem **idlest_reg,
52 u8 *idlest_bit, 52 u8 *idlest_bit,
53 u8 *idlest_val) 53 u8 *idlest_val)
@@ -71,8 +71,9 @@ static void am35xx_clk_find_idlest(struct clk *clk,
71 * associate this type of code with per-module data structures to 71 * associate this type of code with per-module data structures to
72 * avoid this issue, and remove the casts. No return value. 72 * avoid this issue, and remove the casts. No return value.
73 */ 73 */
74static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg, 74static void am35xx_clk_find_companion(struct clk_hw_omap *clk,
75 u8 *other_bit) 75 void __iomem **other_reg,
76 u8 *other_bit)
76{ 77{
77 *other_reg = (__force void __iomem *)(clk->enable_reg); 78 *other_reg = (__force void __iomem *)(clk->enable_reg);
78 if (clk->enable_bit & AM35XX_IPSS_ICK_MASK) 79 if (clk->enable_bit & AM35XX_IPSS_ICK_MASK)
@@ -80,10 +81,7 @@ static void am35xx_clk_find_companion(struct clk *clk, void __iomem **other_reg,
80 else 81 else
81 *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET; 82 *other_bit = clk->enable_bit - AM35XX_IPSS_ICK_FCK_OFFSET;
82} 83}
83 84const struct clk_hw_omap_ops clkhwops_am35xx_ipss_module_wait = {
84const struct clkops clkops_am35xx_ipss_module_wait = {
85 .enable = omap2_dflt_clk_enable,
86 .disable = omap2_dflt_clk_disable,
87 .find_idlest = am35xx_clk_find_idlest, 85 .find_idlest = am35xx_clk_find_idlest,
88 .find_companion = am35xx_clk_find_companion, 86 .find_companion = am35xx_clk_find_companion,
89}; 87};
@@ -99,7 +97,7 @@ const struct clkops clkops_am35xx_ipss_module_wait = {
99 * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg 97 * CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg
100 * and @idlest_bit. No return value. 98 * and @idlest_bit. No return value.
101 */ 99 */
102static void am35xx_clk_ipss_find_idlest(struct clk *clk, 100static void am35xx_clk_ipss_find_idlest(struct clk_hw_omap *clk,
103 void __iomem **idlest_reg, 101 void __iomem **idlest_reg,
104 u8 *idlest_bit, 102 u8 *idlest_bit,
105 u8 *idlest_val) 103 u8 *idlest_val)
@@ -112,13 +110,9 @@ static void am35xx_clk_ipss_find_idlest(struct clk *clk,
112 *idlest_val = OMAP34XX_CM_IDLEST_VAL; 110 *idlest_val = OMAP34XX_CM_IDLEST_VAL;
113} 111}
114 112
115const struct clkops clkops_am35xx_ipss_wait = { 113const struct clk_hw_omap_ops clkhwops_am35xx_ipss_wait = {
116 .enable = omap2_dflt_clk_enable,
117 .disable = omap2_dflt_clk_disable,
118 .find_idlest = am35xx_clk_ipss_find_idlest,
119 .find_companion = omap2_clk_dflt_find_companion,
120 .allow_idle = omap2_clkt_iclk_allow_idle, 114 .allow_idle = omap2_clkt_iclk_allow_idle,
121 .deny_idle = omap2_clkt_iclk_deny_idle, 115 .deny_idle = omap2_clkt_iclk_deny_idle,
116 .find_idlest = am35xx_clk_ipss_find_idlest,
117 .find_companion = omap2_clk_dflt_find_companion,
122}; 118};
123
124
diff --git a/arch/arm/mach-omap2/clock36xx.c b/arch/arm/mach-omap2/clock36xx.c
index 0e1e9e4e2fa4..8f3bf4e50908 100644
--- a/arch/arm/mach-omap2/clock36xx.c
+++ b/arch/arm/mach-omap2/clock36xx.c
@@ -37,34 +37,32 @@
37 * (Any other value different from the Read value) to the 37 * (Any other value different from the Read value) to the
38 * corresponding CM_CLKSEL register will refresh the dividers. 38 * corresponding CM_CLKSEL register will refresh the dividers.
39 */ 39 */
40static int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk *clk) 40int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *clk)
41{ 41{
42 struct clk_hw_omap *parent;
43 struct clk_hw *parent_hw;
42 u32 dummy_v, orig_v, clksel_shift; 44 u32 dummy_v, orig_v, clksel_shift;
43 int ret; 45 int ret;
44 46
45 /* Clear PWRDN bit of HSDIVIDER */ 47 /* Clear PWRDN bit of HSDIVIDER */
46 ret = omap2_dflt_clk_enable(clk); 48 ret = omap2_dflt_clk_enable(clk);
47 49
50 parent_hw = __clk_get_hw(__clk_get_parent(clk->clk));
51 parent = to_clk_hw_omap(parent_hw);
52
48 /* Restore the dividers */ 53 /* Restore the dividers */
49 if (!ret) { 54 if (!ret) {
50 clksel_shift = __ffs(clk->parent->clksel_mask); 55 clksel_shift = __ffs(parent->clksel_mask);
51 orig_v = __raw_readl(clk->parent->clksel_reg); 56 orig_v = __raw_readl(parent->clksel_reg);
52 dummy_v = orig_v; 57 dummy_v = orig_v;
53 58
54 /* Write any other value different from the Read value */ 59 /* Write any other value different from the Read value */
55 dummy_v ^= (1 << clksel_shift); 60 dummy_v ^= (1 << clksel_shift);
56 __raw_writel(dummy_v, clk->parent->clksel_reg); 61 __raw_writel(dummy_v, parent->clksel_reg);
57 62
58 /* Write the original divider */ 63 /* Write the original divider */
59 __raw_writel(orig_v, clk->parent->clksel_reg); 64 __raw_writel(orig_v, parent->clksel_reg);
60 } 65 }
61 66
62 return ret; 67 return ret;
63} 68}
64
65const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore = {
66 .enable = omap36xx_pwrdn_clk_enable_with_hsdiv_restore,
67 .disable = omap2_dflt_clk_disable,
68 .find_companion = omap2_clk_dflt_find_companion,
69 .find_idlest = omap2_clk_dflt_find_idlest,
70};
diff --git a/arch/arm/mach-omap2/clock36xx.h b/arch/arm/mach-omap2/clock36xx.h
index a7dee5bc6364..945bb7f083e9 100644
--- a/arch/arm/mach-omap2/clock36xx.h
+++ b/arch/arm/mach-omap2/clock36xx.h
@@ -8,6 +8,6 @@
8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H 8#ifndef __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
9#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK36XX_H
10 10
11extern const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; 11extern int omap36xx_pwrdn_clk_enable_with_hsdiv_restore(struct clk_hw *hw);
12 12
13#endif 13#endif
diff --git a/arch/arm/mach-omap2/clock3xxx.c b/arch/arm/mach-omap2/clock3xxx.c
index 3e8aca2b1b61..4eacab8f1176 100644
--- a/arch/arm/mach-omap2/clock3xxx.c
+++ b/arch/arm/mach-omap2/clock3xxx.c
@@ -38,8 +38,8 @@
38 38
39/* needed by omap3_core_dpll_m2_set_rate() */ 39/* needed by omap3_core_dpll_m2_set_rate() */
40struct clk *sdrc_ick_p, *arm_fck_p; 40struct clk *sdrc_ick_p, *arm_fck_p;
41 41int omap3_dpll4_set_rate(struct clk_hw *hw, unsigned long rate,
42int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate) 42 unsigned long parent_rate)
43{ 43{
44 /* 44 /*
45 * According to the 12-5 CDP code from TI, "Limitation 2.5" 45 * According to the 12-5 CDP code from TI, "Limitation 2.5"
@@ -51,7 +51,7 @@ int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate)
51 return -EINVAL; 51 return -EINVAL;
52 } 52 }
53 53
54 return omap3_noncore_dpll_set_rate(clk, rate); 54 return omap3_noncore_dpll_set_rate(hw, rate, parent_rate);
55} 55}
56 56
57void __init omap3_clk_lock_dpll5(void) 57void __init omap3_clk_lock_dpll5(void)
diff --git a/arch/arm/mach-omap2/clock3xxx.h b/arch/arm/mach-omap2/clock3xxx.h
index 8bbeeaf399e2..8cd4b0a882ae 100644
--- a/arch/arm/mach-omap2/clock3xxx.h
+++ b/arch/arm/mach-omap2/clock3xxx.h
@@ -9,8 +9,10 @@
9#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H 9#define __ARCH_ARM_MACH_OMAP2_CLOCK3XXX_H
10 10
11int omap3xxx_clk_init(void); 11int omap3xxx_clk_init(void);
12int omap3_dpll4_set_rate(struct clk *clk, unsigned long rate); 12int omap3_dpll4_set_rate(struct clk_hw *clk, unsigned long rate,
13int omap3_core_dpll_m2_set_rate(struct clk *clk, unsigned long rate); 13 unsigned long parent_rate);
14int omap3_core_dpll_m2_set_rate(struct clk_hw *clk, unsigned long rate,
15 unsigned long parent_rate);
14void omap3_clk_lock_dpll5(void); 16void omap3_clk_lock_dpll5(void);
15 17
16extern struct clk *sdrc_ick_p; 18extern struct clk *sdrc_ick_p;
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
deleted file mode 100644
index a02d158568e8..000000000000
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ /dev/null
@@ -1,3613 +0,0 @@
1/*
2 * OMAP3 clock data
3 *
4 * Copyright (C) 2007-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2011 Nokia Corporation
6 *
7 * Written by Paul Walmsley
8 * With many device clock fixes by Kevin Hilman and Jouni Högander
9 * DPLL bypass clock support added by Roman Tereshonkov
10 *
11 */
12
13/*
14 * Virtual clocks are introduced as convenient tools.
15 * They are sources for other clocks and not supposed
16 * to be requested from drivers directly.
17 */
18
19#include <linux/kernel.h>
20#include <linux/clk.h>
21#include <linux/list.h>
22#include <linux/io.h>
23
24#include "soc.h"
25#include "iomap.h"
26#include "clock.h"
27#include "clock3xxx.h"
28#include "clock34xx.h"
29#include "clock36xx.h"
30#include "clock3517.h"
31#include "cm2xxx_3xxx.h"
32#include "cm-regbits-34xx.h"
33#include "prm2xxx_3xxx.h"
34#include "prm-regbits-34xx.h"
35#include "control.h"
36
37/*
38 * clocks
39 */
40
41#define OMAP_CM_REGADDR OMAP34XX_CM_REGADDR
42
43/* Maximum DPLL multiplier, divider values for OMAP3 */
44#define OMAP3_MAX_DPLL_MULT 2047
45#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095
46#define OMAP3_MAX_DPLL_DIV 128
47
48/*
49 * DPLL1 supplies clock to the MPU.
50 * DPLL2 supplies clock to the IVA2.
51 * DPLL3 supplies CORE domain clocks.
52 * DPLL4 supplies peripheral clocks.
53 * DPLL5 supplies other peripheral clocks (USBHOST, USIM).
54 */
55
56/* Forward declarations for DPLL bypass clocks */
57static struct clk dpll1_fck;
58static struct clk dpll2_fck;
59
60/* PRM CLOCKS */
61
62/* According to timer32k.c, this is a 32768Hz clock, not a 32000Hz clock. */
63static struct clk omap_32k_fck = {
64 .name = "omap_32k_fck",
65 .ops = &clkops_null,
66 .rate = 32768,
67};
68
69static struct clk secure_32k_fck = {
70 .name = "secure_32k_fck",
71 .ops = &clkops_null,
72 .rate = 32768,
73};
74
75/* Virtual source clocks for osc_sys_ck */
76static struct clk virt_12m_ck = {
77 .name = "virt_12m_ck",
78 .ops = &clkops_null,
79 .rate = 12000000,
80};
81
82static struct clk virt_13m_ck = {
83 .name = "virt_13m_ck",
84 .ops = &clkops_null,
85 .rate = 13000000,
86};
87
88static struct clk virt_16_8m_ck = {
89 .name = "virt_16_8m_ck",
90 .ops = &clkops_null,
91 .rate = 16800000,
92};
93
94static struct clk virt_38_4m_ck = {
95 .name = "virt_38_4m_ck",
96 .ops = &clkops_null,
97 .rate = 38400000,
98};
99
100static const struct clksel_rate osc_sys_12m_rates[] = {
101 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
102 { .div = 0 }
103};
104
105static const struct clksel_rate osc_sys_13m_rates[] = {
106 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
107 { .div = 0 }
108};
109
110static const struct clksel_rate osc_sys_16_8m_rates[] = {
111 { .div = 1, .val = 5, .flags = RATE_IN_3430ES2PLUS_36XX },
112 { .div = 0 }
113};
114
115static const struct clksel_rate osc_sys_19_2m_rates[] = {
116 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
117 { .div = 0 }
118};
119
120static const struct clksel_rate osc_sys_26m_rates[] = {
121 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
122 { .div = 0 }
123};
124
125static const struct clksel_rate osc_sys_38_4m_rates[] = {
126 { .div = 1, .val = 4, .flags = RATE_IN_3XXX },
127 { .div = 0 }
128};
129
130static const struct clksel osc_sys_clksel[] = {
131 { .parent = &virt_12m_ck, .rates = osc_sys_12m_rates },
132 { .parent = &virt_13m_ck, .rates = osc_sys_13m_rates },
133 { .parent = &virt_16_8m_ck, .rates = osc_sys_16_8m_rates },
134 { .parent = &virt_19200000_ck, .rates = osc_sys_19_2m_rates },
135 { .parent = &virt_26000000_ck, .rates = osc_sys_26m_rates },
136 { .parent = &virt_38_4m_ck, .rates = osc_sys_38_4m_rates },
137 { .parent = NULL },
138};
139
140/* Oscillator clock */
141/* 12, 13, 16.8, 19.2, 26, or 38.4 MHz */
142static struct clk osc_sys_ck = {
143 .name = "osc_sys_ck",
144 .ops = &clkops_null,
145 .init = &omap2_init_clksel_parent,
146 .clksel_reg = OMAP3430_PRM_CLKSEL,
147 .clksel_mask = OMAP3430_SYS_CLKIN_SEL_MASK,
148 .clksel = osc_sys_clksel,
149 /* REVISIT: deal with autoextclkmode? */
150 .recalc = &omap2_clksel_recalc,
151};
152
153static const struct clksel_rate div2_rates[] = {
154 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
155 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
156 { .div = 0 }
157};
158
159static const struct clksel sys_clksel[] = {
160 { .parent = &osc_sys_ck, .rates = div2_rates },
161 { .parent = NULL }
162};
163
164/* Latency: this clock is only enabled after PRM_CLKSETUP.SETUP_TIME */
165/* Feeds DPLLs - divided first by PRM_CLKSRC_CTRL.SYSCLKDIV? */
166static struct clk sys_ck = {
167 .name = "sys_ck",
168 .ops = &clkops_null,
169 .parent = &osc_sys_ck,
170 .init = &omap2_init_clksel_parent,
171 .clksel_reg = OMAP3430_PRM_CLKSRC_CTRL,
172 .clksel_mask = OMAP_SYSCLKDIV_MASK,
173 .clksel = sys_clksel,
174 .recalc = &omap2_clksel_recalc,
175};
176
177static struct clk sys_altclk = {
178 .name = "sys_altclk",
179 .ops = &clkops_null,
180};
181
182/* Optional external clock input for some McBSPs */
183static struct clk mcbsp_clks = {
184 .name = "mcbsp_clks",
185 .ops = &clkops_null,
186};
187
188/* PRM EXTERNAL CLOCK OUTPUT */
189
190static struct clk sys_clkout1 = {
191 .name = "sys_clkout1",
192 .ops = &clkops_omap2_dflt,
193 .parent = &osc_sys_ck,
194 .enable_reg = OMAP3430_PRM_CLKOUT_CTRL,
195 .enable_bit = OMAP3430_CLKOUT_EN_SHIFT,
196 .recalc = &followparent_recalc,
197};
198
199/* DPLLS */
200
201/* CM CLOCKS */
202
203static const struct clksel_rate div16_dpll_rates[] = {
204 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
205 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
206 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
207 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
208 { .div = 5, .val = 5, .flags = RATE_IN_3XXX },
209 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
210 { .div = 7, .val = 7, .flags = RATE_IN_3XXX },
211 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
212 { .div = 9, .val = 9, .flags = RATE_IN_3XXX },
213 { .div = 10, .val = 10, .flags = RATE_IN_3XXX },
214 { .div = 11, .val = 11, .flags = RATE_IN_3XXX },
215 { .div = 12, .val = 12, .flags = RATE_IN_3XXX },
216 { .div = 13, .val = 13, .flags = RATE_IN_3XXX },
217 { .div = 14, .val = 14, .flags = RATE_IN_3XXX },
218 { .div = 15, .val = 15, .flags = RATE_IN_3XXX },
219 { .div = 16, .val = 16, .flags = RATE_IN_3XXX },
220 { .div = 0 }
221};
222
223static const struct clksel_rate dpll4_rates[] = {
224 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
225 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
226 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
227 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
228 { .div = 5, .val = 5, .flags = RATE_IN_3XXX },
229 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
230 { .div = 7, .val = 7, .flags = RATE_IN_3XXX },
231 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
232 { .div = 9, .val = 9, .flags = RATE_IN_3XXX },
233 { .div = 10, .val = 10, .flags = RATE_IN_3XXX },
234 { .div = 11, .val = 11, .flags = RATE_IN_3XXX },
235 { .div = 12, .val = 12, .flags = RATE_IN_3XXX },
236 { .div = 13, .val = 13, .flags = RATE_IN_3XXX },
237 { .div = 14, .val = 14, .flags = RATE_IN_3XXX },
238 { .div = 15, .val = 15, .flags = RATE_IN_3XXX },
239 { .div = 16, .val = 16, .flags = RATE_IN_3XXX },
240 { .div = 17, .val = 17, .flags = RATE_IN_36XX },
241 { .div = 18, .val = 18, .flags = RATE_IN_36XX },
242 { .div = 19, .val = 19, .flags = RATE_IN_36XX },
243 { .div = 20, .val = 20, .flags = RATE_IN_36XX },
244 { .div = 21, .val = 21, .flags = RATE_IN_36XX },
245 { .div = 22, .val = 22, .flags = RATE_IN_36XX },
246 { .div = 23, .val = 23, .flags = RATE_IN_36XX },
247 { .div = 24, .val = 24, .flags = RATE_IN_36XX },
248 { .div = 25, .val = 25, .flags = RATE_IN_36XX },
249 { .div = 26, .val = 26, .flags = RATE_IN_36XX },
250 { .div = 27, .val = 27, .flags = RATE_IN_36XX },
251 { .div = 28, .val = 28, .flags = RATE_IN_36XX },
252 { .div = 29, .val = 29, .flags = RATE_IN_36XX },
253 { .div = 30, .val = 30, .flags = RATE_IN_36XX },
254 { .div = 31, .val = 31, .flags = RATE_IN_36XX },
255 { .div = 32, .val = 32, .flags = RATE_IN_36XX },
256 { .div = 0 }
257};
258
259/* DPLL1 */
260/* MPU clock source */
261/* Type: DPLL */
262static struct dpll_data dpll1_dd = {
263 .mult_div1_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
264 .mult_mask = OMAP3430_MPU_DPLL_MULT_MASK,
265 .div1_mask = OMAP3430_MPU_DPLL_DIV_MASK,
266 .clk_bypass = &dpll1_fck,
267 .clk_ref = &sys_ck,
268 .freqsel_mask = OMAP3430_MPU_DPLL_FREQSEL_MASK,
269 .control_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKEN_PLL),
270 .enable_mask = OMAP3430_EN_MPU_DPLL_MASK,
271 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
272 .auto_recal_bit = OMAP3430_EN_MPU_DPLL_DRIFTGUARD_SHIFT,
273 .recal_en_bit = OMAP3430_MPU_DPLL_RECAL_EN_SHIFT,
274 .recal_st_bit = OMAP3430_MPU_DPLL_ST_SHIFT,
275 .autoidle_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_AUTOIDLE_PLL),
276 .autoidle_mask = OMAP3430_AUTO_MPU_DPLL_MASK,
277 .idlest_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
278 .idlest_mask = OMAP3430_ST_MPU_CLK_MASK,
279 .max_multiplier = OMAP3_MAX_DPLL_MULT,
280 .min_divider = 1,
281 .max_divider = OMAP3_MAX_DPLL_DIV,
282};
283
284static struct clk dpll1_ck = {
285 .name = "dpll1_ck",
286 .ops = &clkops_omap3_noncore_dpll_ops,
287 .parent = &sys_ck,
288 .dpll_data = &dpll1_dd,
289 .round_rate = &omap2_dpll_round_rate,
290 .set_rate = &omap3_noncore_dpll_set_rate,
291 .clkdm_name = "dpll1_clkdm",
292 .recalc = &omap3_dpll_recalc,
293};
294
295/*
296 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
297 * DPLL isn't bypassed.
298 */
299static struct clk dpll1_x2_ck = {
300 .name = "dpll1_x2_ck",
301 .ops = &clkops_null,
302 .parent = &dpll1_ck,
303 .clkdm_name = "dpll1_clkdm",
304 .recalc = &omap3_clkoutx2_recalc,
305};
306
307/* On DPLL1, unlike other DPLLs, the divider is downstream from CLKOUTX2 */
308static const struct clksel div16_dpll1_x2m2_clksel[] = {
309 { .parent = &dpll1_x2_ck, .rates = div16_dpll_rates },
310 { .parent = NULL }
311};
312
313/*
314 * Does not exist in the TRM - needed to separate the M2 divider from
315 * bypass selection in mpu_ck
316 */
317static struct clk dpll1_x2m2_ck = {
318 .name = "dpll1_x2m2_ck",
319 .ops = &clkops_null,
320 .parent = &dpll1_x2_ck,
321 .init = &omap2_init_clksel_parent,
322 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
323 .clksel_mask = OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK,
324 .clksel = div16_dpll1_x2m2_clksel,
325 .clkdm_name = "dpll1_clkdm",
326 .recalc = &omap2_clksel_recalc,
327};
328
329/* DPLL2 */
330/* IVA2 clock source */
331/* Type: DPLL */
332
333static struct dpll_data dpll2_dd = {
334 .mult_div1_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
335 .mult_mask = OMAP3430_IVA2_DPLL_MULT_MASK,
336 .div1_mask = OMAP3430_IVA2_DPLL_DIV_MASK,
337 .clk_bypass = &dpll2_fck,
338 .clk_ref = &sys_ck,
339 .freqsel_mask = OMAP3430_IVA2_DPLL_FREQSEL_MASK,
340 .control_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKEN_PLL),
341 .enable_mask = OMAP3430_EN_IVA2_DPLL_MASK,
342 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED) |
343 (1 << DPLL_LOW_POWER_BYPASS),
344 .auto_recal_bit = OMAP3430_EN_IVA2_DPLL_DRIFTGUARD_SHIFT,
345 .recal_en_bit = OMAP3430_PRM_IRQENABLE_MPU_IVA2_DPLL_RECAL_EN_SHIFT,
346 .recal_st_bit = OMAP3430_PRM_IRQSTATUS_MPU_IVA2_DPLL_ST_SHIFT,
347 .autoidle_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_AUTOIDLE_PLL),
348 .autoidle_mask = OMAP3430_AUTO_IVA2_DPLL_MASK,
349 .idlest_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_IDLEST_PLL),
350 .idlest_mask = OMAP3430_ST_IVA2_CLK_MASK,
351 .max_multiplier = OMAP3_MAX_DPLL_MULT,
352 .min_divider = 1,
353 .max_divider = OMAP3_MAX_DPLL_DIV,
354};
355
356static struct clk dpll2_ck = {
357 .name = "dpll2_ck",
358 .ops = &clkops_omap3_noncore_dpll_ops,
359 .parent = &sys_ck,
360 .dpll_data = &dpll2_dd,
361 .round_rate = &omap2_dpll_round_rate,
362 .set_rate = &omap3_noncore_dpll_set_rate,
363 .clkdm_name = "dpll2_clkdm",
364 .recalc = &omap3_dpll_recalc,
365};
366
367static const struct clksel div16_dpll2_m2x2_clksel[] = {
368 { .parent = &dpll2_ck, .rates = div16_dpll_rates },
369 { .parent = NULL }
370};
371
372/*
373 * The TRM is conflicted on whether IVA2 clock comes from DPLL2 CLKOUT
374 * or CLKOUTX2. CLKOUT seems most plausible.
375 */
376static struct clk dpll2_m2_ck = {
377 .name = "dpll2_m2_ck",
378 .ops = &clkops_null,
379 .parent = &dpll2_ck,
380 .init = &omap2_init_clksel_parent,
381 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD,
382 OMAP3430_CM_CLKSEL2_PLL),
383 .clksel_mask = OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK,
384 .clksel = div16_dpll2_m2x2_clksel,
385 .clkdm_name = "dpll2_clkdm",
386 .recalc = &omap2_clksel_recalc,
387};
388
389/*
390 * DPLL3
391 * Source clock for all interfaces and for some device fclks
392 * REVISIT: Also supports fast relock bypass - not included below
393 */
394static struct dpll_data dpll3_dd = {
395 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
396 .mult_mask = OMAP3430_CORE_DPLL_MULT_MASK,
397 .div1_mask = OMAP3430_CORE_DPLL_DIV_MASK,
398 .clk_bypass = &sys_ck,
399 .clk_ref = &sys_ck,
400 .freqsel_mask = OMAP3430_CORE_DPLL_FREQSEL_MASK,
401 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
402 .enable_mask = OMAP3430_EN_CORE_DPLL_MASK,
403 .auto_recal_bit = OMAP3430_EN_CORE_DPLL_DRIFTGUARD_SHIFT,
404 .recal_en_bit = OMAP3430_CORE_DPLL_RECAL_EN_SHIFT,
405 .recal_st_bit = OMAP3430_CORE_DPLL_ST_SHIFT,
406 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
407 .autoidle_mask = OMAP3430_AUTO_CORE_DPLL_MASK,
408 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
409 .idlest_mask = OMAP3430_ST_CORE_CLK_MASK,
410 .max_multiplier = OMAP3_MAX_DPLL_MULT,
411 .min_divider = 1,
412 .max_divider = OMAP3_MAX_DPLL_DIV,
413};
414
415static struct clk dpll3_ck = {
416 .name = "dpll3_ck",
417 .ops = &clkops_omap3_core_dpll_ops,
418 .parent = &sys_ck,
419 .dpll_data = &dpll3_dd,
420 .round_rate = &omap2_dpll_round_rate,
421 .clkdm_name = "dpll3_clkdm",
422 .recalc = &omap3_dpll_recalc,
423};
424
425/*
426 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
427 * DPLL isn't bypassed
428 */
429static struct clk dpll3_x2_ck = {
430 .name = "dpll3_x2_ck",
431 .ops = &clkops_null,
432 .parent = &dpll3_ck,
433 .clkdm_name = "dpll3_clkdm",
434 .recalc = &omap3_clkoutx2_recalc,
435};
436
437static const struct clksel_rate div31_dpll3_rates[] = {
438 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
439 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
440 { .div = 3, .val = 3, .flags = RATE_IN_3430ES2PLUS_36XX },
441 { .div = 4, .val = 4, .flags = RATE_IN_3430ES2PLUS_36XX },
442 { .div = 5, .val = 5, .flags = RATE_IN_3430ES2PLUS_36XX },
443 { .div = 6, .val = 6, .flags = RATE_IN_3430ES2PLUS_36XX },
444 { .div = 7, .val = 7, .flags = RATE_IN_3430ES2PLUS_36XX },
445 { .div = 8, .val = 8, .flags = RATE_IN_3430ES2PLUS_36XX },
446 { .div = 9, .val = 9, .flags = RATE_IN_3430ES2PLUS_36XX },
447 { .div = 10, .val = 10, .flags = RATE_IN_3430ES2PLUS_36XX },
448 { .div = 11, .val = 11, .flags = RATE_IN_3430ES2PLUS_36XX },
449 { .div = 12, .val = 12, .flags = RATE_IN_3430ES2PLUS_36XX },
450 { .div = 13, .val = 13, .flags = RATE_IN_3430ES2PLUS_36XX },
451 { .div = 14, .val = 14, .flags = RATE_IN_3430ES2PLUS_36XX },
452 { .div = 15, .val = 15, .flags = RATE_IN_3430ES2PLUS_36XX },
453 { .div = 16, .val = 16, .flags = RATE_IN_3430ES2PLUS_36XX },
454 { .div = 17, .val = 17, .flags = RATE_IN_3430ES2PLUS_36XX },
455 { .div = 18, .val = 18, .flags = RATE_IN_3430ES2PLUS_36XX },
456 { .div = 19, .val = 19, .flags = RATE_IN_3430ES2PLUS_36XX },
457 { .div = 20, .val = 20, .flags = RATE_IN_3430ES2PLUS_36XX },
458 { .div = 21, .val = 21, .flags = RATE_IN_3430ES2PLUS_36XX },
459 { .div = 22, .val = 22, .flags = RATE_IN_3430ES2PLUS_36XX },
460 { .div = 23, .val = 23, .flags = RATE_IN_3430ES2PLUS_36XX },
461 { .div = 24, .val = 24, .flags = RATE_IN_3430ES2PLUS_36XX },
462 { .div = 25, .val = 25, .flags = RATE_IN_3430ES2PLUS_36XX },
463 { .div = 26, .val = 26, .flags = RATE_IN_3430ES2PLUS_36XX },
464 { .div = 27, .val = 27, .flags = RATE_IN_3430ES2PLUS_36XX },
465 { .div = 28, .val = 28, .flags = RATE_IN_3430ES2PLUS_36XX },
466 { .div = 29, .val = 29, .flags = RATE_IN_3430ES2PLUS_36XX },
467 { .div = 30, .val = 30, .flags = RATE_IN_3430ES2PLUS_36XX },
468 { .div = 31, .val = 31, .flags = RATE_IN_3430ES2PLUS_36XX },
469 { .div = 0 },
470};
471
472static const struct clksel div31_dpll3m2_clksel[] = {
473 { .parent = &dpll3_ck, .rates = div31_dpll3_rates },
474 { .parent = NULL }
475};
476
477/* DPLL3 output M2 - primary control point for CORE speed */
478static struct clk dpll3_m2_ck = {
479 .name = "dpll3_m2_ck",
480 .ops = &clkops_null,
481 .parent = &dpll3_ck,
482 .init = &omap2_init_clksel_parent,
483 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
484 .clksel_mask = OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK,
485 .clksel = div31_dpll3m2_clksel,
486 .clkdm_name = "dpll3_clkdm",
487 .round_rate = &omap2_clksel_round_rate,
488 .set_rate = &omap3_core_dpll_m2_set_rate,
489 .recalc = &omap2_clksel_recalc,
490};
491
492static struct clk core_ck = {
493 .name = "core_ck",
494 .ops = &clkops_null,
495 .parent = &dpll3_m2_ck,
496 .recalc = &followparent_recalc,
497};
498
499static struct clk dpll3_m2x2_ck = {
500 .name = "dpll3_m2x2_ck",
501 .ops = &clkops_null,
502 .parent = &dpll3_m2_ck,
503 .clkdm_name = "dpll3_clkdm",
504 .recalc = &omap3_clkoutx2_recalc,
505};
506
507/* The PWRDN bit is apparently only available on 3430ES2 and above */
508static const struct clksel div16_dpll3_clksel[] = {
509 { .parent = &dpll3_ck, .rates = div16_dpll_rates },
510 { .parent = NULL }
511};
512
513/* This virtual clock is the source for dpll3_m3x2_ck */
514static struct clk dpll3_m3_ck = {
515 .name = "dpll3_m3_ck",
516 .ops = &clkops_null,
517 .parent = &dpll3_ck,
518 .init = &omap2_init_clksel_parent,
519 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
520 .clksel_mask = OMAP3430_DIV_DPLL3_MASK,
521 .clksel = div16_dpll3_clksel,
522 .clkdm_name = "dpll3_clkdm",
523 .recalc = &omap2_clksel_recalc,
524};
525
526/* The PWRDN bit is apparently only available on 3430ES2 and above */
527static struct clk dpll3_m3x2_ck = {
528 .name = "dpll3_m3x2_ck",
529 .ops = &clkops_omap2_dflt_wait,
530 .parent = &dpll3_m3_ck,
531 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
532 .enable_bit = OMAP3430_PWRDN_EMU_CORE_SHIFT,
533 .flags = INVERT_ENABLE,
534 .clkdm_name = "dpll3_clkdm",
535 .recalc = &omap3_clkoutx2_recalc,
536};
537
538static struct clk emu_core_alwon_ck = {
539 .name = "emu_core_alwon_ck",
540 .ops = &clkops_null,
541 .parent = &dpll3_m3x2_ck,
542 .clkdm_name = "dpll3_clkdm",
543 .recalc = &followparent_recalc,
544};
545
546/* DPLL4 */
547/* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */
548/* Type: DPLL */
549static struct dpll_data dpll4_dd;
550
551static struct dpll_data dpll4_dd_34xx __initdata = {
552 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
553 .mult_mask = OMAP3430_PERIPH_DPLL_MULT_MASK,
554 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
555 .clk_bypass = &sys_ck,
556 .clk_ref = &sys_ck,
557 .freqsel_mask = OMAP3430_PERIPH_DPLL_FREQSEL_MASK,
558 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
559 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
560 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
561 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
562 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
563 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
564 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
565 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
566 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
567 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
568 .max_multiplier = OMAP3_MAX_DPLL_MULT,
569 .min_divider = 1,
570 .max_divider = OMAP3_MAX_DPLL_DIV,
571};
572
573static struct dpll_data dpll4_dd_3630 __initdata = {
574 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL2),
575 .mult_mask = OMAP3630_PERIPH_DPLL_MULT_MASK,
576 .div1_mask = OMAP3430_PERIPH_DPLL_DIV_MASK,
577 .clk_bypass = &sys_ck,
578 .clk_ref = &sys_ck,
579 .control_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
580 .enable_mask = OMAP3430_EN_PERIPH_DPLL_MASK,
581 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
582 .auto_recal_bit = OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT,
583 .recal_en_bit = OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT,
584 .recal_st_bit = OMAP3430_PERIPH_DPLL_ST_SHIFT,
585 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, CM_AUTOIDLE),
586 .autoidle_mask = OMAP3430_AUTO_PERIPH_DPLL_MASK,
587 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST),
588 .idlest_mask = OMAP3430_ST_PERIPH_CLK_MASK,
589 .dco_mask = OMAP3630_PERIPH_DPLL_DCO_SEL_MASK,
590 .sddiv_mask = OMAP3630_PERIPH_DPLL_SD_DIV_MASK,
591 .max_multiplier = OMAP3630_MAX_JTYPE_DPLL_MULT,
592 .min_divider = 1,
593 .max_divider = OMAP3_MAX_DPLL_DIV,
594 .flags = DPLL_J_TYPE
595};
596
597static struct clk dpll4_ck = {
598 .name = "dpll4_ck",
599 .ops = &clkops_omap3_noncore_dpll_ops,
600 .parent = &sys_ck,
601 .dpll_data = &dpll4_dd,
602 .round_rate = &omap2_dpll_round_rate,
603 .set_rate = &omap3_dpll4_set_rate,
604 .clkdm_name = "dpll4_clkdm",
605 .recalc = &omap3_dpll_recalc,
606};
607
608/*
609 * This virtual clock provides the CLKOUTX2 output from the DPLL if the
610 * DPLL isn't bypassed --
611 * XXX does this serve any downstream clocks?
612 */
613static struct clk dpll4_x2_ck = {
614 .name = "dpll4_x2_ck",
615 .ops = &clkops_null,
616 .parent = &dpll4_ck,
617 .clkdm_name = "dpll4_clkdm",
618 .recalc = &omap3_clkoutx2_recalc,
619};
620
621static const struct clksel dpll4_clksel[] = {
622 { .parent = &dpll4_ck, .rates = dpll4_rates },
623 { .parent = NULL }
624};
625
626/* This virtual clock is the source for dpll4_m2x2_ck */
627static struct clk dpll4_m2_ck = {
628 .name = "dpll4_m2_ck",
629 .ops = &clkops_null,
630 .parent = &dpll4_ck,
631 .init = &omap2_init_clksel_parent,
632 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430_CM_CLKSEL3),
633 .clksel_mask = OMAP3630_DIV_96M_MASK,
634 .clksel = dpll4_clksel,
635 .clkdm_name = "dpll4_clkdm",
636 .recalc = &omap2_clksel_recalc,
637};
638
639/* The PWRDN bit is apparently only available on 3430ES2 and above */
640static struct clk dpll4_m2x2_ck = {
641 .name = "dpll4_m2x2_ck",
642 .ops = &clkops_omap2_dflt_wait,
643 .parent = &dpll4_m2_ck,
644 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
645 .enable_bit = OMAP3430_PWRDN_96M_SHIFT,
646 .flags = INVERT_ENABLE,
647 .clkdm_name = "dpll4_clkdm",
648 .recalc = &omap3_clkoutx2_recalc,
649};
650
651/*
652 * DPLL4 generates DPLL4_M2X2_CLK which is then routed into the PRM as
653 * PRM_96M_ALWON_(F)CLK. Two clocks then emerge from the PRM:
654 * 96M_ALWON_FCLK (called "omap_96m_alwon_fck" below) and
655 * CM_96K_(F)CLK.
656 */
657
658/* Adding 192MHz Clock node needed by SGX */
659static struct clk omap_192m_alwon_fck = {
660 .name = "omap_192m_alwon_fck",
661 .ops = &clkops_null,
662 .parent = &dpll4_m2x2_ck,
663 .recalc = &followparent_recalc,
664};
665
666static const struct clksel_rate omap_96m_alwon_fck_rates[] = {
667 { .div = 1, .val = 1, .flags = RATE_IN_36XX },
668 { .div = 2, .val = 2, .flags = RATE_IN_36XX },
669 { .div = 0 }
670};
671
672static const struct clksel omap_96m_alwon_fck_clksel[] = {
673 { .parent = &omap_192m_alwon_fck, .rates = omap_96m_alwon_fck_rates },
674 { .parent = NULL }
675};
676
677static const struct clksel_rate omap_96m_dpll_rates[] = {
678 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
679 { .div = 0 }
680};
681
682static const struct clksel_rate omap_96m_sys_rates[] = {
683 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
684 { .div = 0 }
685};
686
687static struct clk omap_96m_alwon_fck = {
688 .name = "omap_96m_alwon_fck",
689 .ops = &clkops_null,
690 .parent = &dpll4_m2x2_ck,
691 .recalc = &followparent_recalc,
692};
693
694static struct clk omap_96m_alwon_fck_3630 = {
695 .name = "omap_96m_alwon_fck",
696 .parent = &omap_192m_alwon_fck,
697 .init = &omap2_init_clksel_parent,
698 .ops = &clkops_null,
699 .recalc = &omap2_clksel_recalc,
700 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
701 .clksel_mask = OMAP3630_CLKSEL_96M_MASK,
702 .clksel = omap_96m_alwon_fck_clksel
703};
704
705static struct clk cm_96m_fck = {
706 .name = "cm_96m_fck",
707 .ops = &clkops_null,
708 .parent = &omap_96m_alwon_fck,
709 .recalc = &followparent_recalc,
710};
711
712static const struct clksel omap_96m_fck_clksel[] = {
713 { .parent = &cm_96m_fck, .rates = omap_96m_dpll_rates },
714 { .parent = &sys_ck, .rates = omap_96m_sys_rates },
715 { .parent = NULL }
716};
717
718static struct clk omap_96m_fck = {
719 .name = "omap_96m_fck",
720 .ops = &clkops_null,
721 .parent = &sys_ck,
722 .init = &omap2_init_clksel_parent,
723 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
724 .clksel_mask = OMAP3430_SOURCE_96M_MASK,
725 .clksel = omap_96m_fck_clksel,
726 .recalc = &omap2_clksel_recalc,
727};
728
729/* This virtual clock is the source for dpll4_m3x2_ck */
730static struct clk dpll4_m3_ck = {
731 .name = "dpll4_m3_ck",
732 .ops = &clkops_null,
733 .parent = &dpll4_ck,
734 .init = &omap2_init_clksel_parent,
735 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
736 .clksel_mask = OMAP3630_CLKSEL_TV_MASK,
737 .clksel = dpll4_clksel,
738 .clkdm_name = "dpll4_clkdm",
739 .recalc = &omap2_clksel_recalc,
740};
741
742/* The PWRDN bit is apparently only available on 3430ES2 and above */
743static struct clk dpll4_m3x2_ck = {
744 .name = "dpll4_m3x2_ck",
745 .ops = &clkops_omap2_dflt_wait,
746 .parent = &dpll4_m3_ck,
747 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
748 .enable_bit = OMAP3430_PWRDN_TV_SHIFT,
749 .flags = INVERT_ENABLE,
750 .clkdm_name = "dpll4_clkdm",
751 .recalc = &omap3_clkoutx2_recalc,
752};
753
754static const struct clksel_rate omap_54m_d4m3x2_rates[] = {
755 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
756 { .div = 0 }
757};
758
759static const struct clksel_rate omap_54m_alt_rates[] = {
760 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
761 { .div = 0 }
762};
763
764static const struct clksel omap_54m_clksel[] = {
765 { .parent = &dpll4_m3x2_ck, .rates = omap_54m_d4m3x2_rates },
766 { .parent = &sys_altclk, .rates = omap_54m_alt_rates },
767 { .parent = NULL }
768};
769
770static struct clk omap_54m_fck = {
771 .name = "omap_54m_fck",
772 .ops = &clkops_null,
773 .init = &omap2_init_clksel_parent,
774 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
775 .clksel_mask = OMAP3430_SOURCE_54M_MASK,
776 .clksel = omap_54m_clksel,
777 .recalc = &omap2_clksel_recalc,
778};
779
780static const struct clksel_rate omap_48m_cm96m_rates[] = {
781 { .div = 2, .val = 0, .flags = RATE_IN_3XXX },
782 { .div = 0 }
783};
784
785static const struct clksel_rate omap_48m_alt_rates[] = {
786 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
787 { .div = 0 }
788};
789
790static const struct clksel omap_48m_clksel[] = {
791 { .parent = &cm_96m_fck, .rates = omap_48m_cm96m_rates },
792 { .parent = &sys_altclk, .rates = omap_48m_alt_rates },
793 { .parent = NULL }
794};
795
796static struct clk omap_48m_fck = {
797 .name = "omap_48m_fck",
798 .ops = &clkops_null,
799 .init = &omap2_init_clksel_parent,
800 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
801 .clksel_mask = OMAP3430_SOURCE_48M_MASK,
802 .clksel = omap_48m_clksel,
803 .recalc = &omap2_clksel_recalc,
804};
805
806static struct clk omap_12m_fck = {
807 .name = "omap_12m_fck",
808 .ops = &clkops_null,
809 .parent = &omap_48m_fck,
810 .fixed_div = 4,
811 .recalc = &omap_fixed_divisor_recalc,
812};
813
814/* This virtual clock is the source for dpll4_m4x2_ck */
815static struct clk dpll4_m4_ck = {
816 .name = "dpll4_m4_ck",
817 .ops = &clkops_null,
818 .parent = &dpll4_ck,
819 .init = &omap2_init_clksel_parent,
820 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_CLKSEL),
821 .clksel_mask = OMAP3630_CLKSEL_DSS1_MASK,
822 .clksel = dpll4_clksel,
823 .clkdm_name = "dpll4_clkdm",
824 .recalc = &omap2_clksel_recalc,
825 .set_rate = &omap2_clksel_set_rate,
826 .round_rate = &omap2_clksel_round_rate,
827};
828
829/* The PWRDN bit is apparently only available on 3430ES2 and above */
830static struct clk dpll4_m4x2_ck = {
831 .name = "dpll4_m4x2_ck",
832 .ops = &clkops_omap2_dflt_wait,
833 .parent = &dpll4_m4_ck,
834 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
835 .enable_bit = OMAP3430_PWRDN_DSS1_SHIFT,
836 .flags = INVERT_ENABLE,
837 .clkdm_name = "dpll4_clkdm",
838 .recalc = &omap3_clkoutx2_recalc,
839};
840
841/* This virtual clock is the source for dpll4_m5x2_ck */
842static struct clk dpll4_m5_ck = {
843 .name = "dpll4_m5_ck",
844 .ops = &clkops_null,
845 .parent = &dpll4_ck,
846 .init = &omap2_init_clksel_parent,
847 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
848 .clksel_mask = OMAP3630_CLKSEL_CAM_MASK,
849 .clksel = dpll4_clksel,
850 .clkdm_name = "dpll4_clkdm",
851 .set_rate = &omap2_clksel_set_rate,
852 .round_rate = &omap2_clksel_round_rate,
853 .recalc = &omap2_clksel_recalc,
854};
855
856/* The PWRDN bit is apparently only available on 3430ES2 and above */
857static struct clk dpll4_m5x2_ck = {
858 .name = "dpll4_m5x2_ck",
859 .ops = &clkops_omap2_dflt_wait,
860 .parent = &dpll4_m5_ck,
861 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
862 .enable_bit = OMAP3430_PWRDN_CAM_SHIFT,
863 .flags = INVERT_ENABLE,
864 .clkdm_name = "dpll4_clkdm",
865 .recalc = &omap3_clkoutx2_recalc,
866};
867
868/* This virtual clock is the source for dpll4_m6x2_ck */
869static struct clk dpll4_m6_ck = {
870 .name = "dpll4_m6_ck",
871 .ops = &clkops_null,
872 .parent = &dpll4_ck,
873 .init = &omap2_init_clksel_parent,
874 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
875 .clksel_mask = OMAP3630_DIV_DPLL4_MASK,
876 .clksel = dpll4_clksel,
877 .clkdm_name = "dpll4_clkdm",
878 .recalc = &omap2_clksel_recalc,
879};
880
881/* The PWRDN bit is apparently only available on 3430ES2 and above */
882static struct clk dpll4_m6x2_ck = {
883 .name = "dpll4_m6x2_ck",
884 .ops = &clkops_omap2_dflt_wait,
885 .parent = &dpll4_m6_ck,
886 .enable_reg = OMAP_CM_REGADDR(PLL_MOD, CM_CLKEN),
887 .enable_bit = OMAP3430_PWRDN_EMU_PERIPH_SHIFT,
888 .flags = INVERT_ENABLE,
889 .clkdm_name = "dpll4_clkdm",
890 .recalc = &omap3_clkoutx2_recalc,
891};
892
893static struct clk emu_per_alwon_ck = {
894 .name = "emu_per_alwon_ck",
895 .ops = &clkops_null,
896 .parent = &dpll4_m6x2_ck,
897 .clkdm_name = "dpll4_clkdm",
898 .recalc = &followparent_recalc,
899};
900
901/* DPLL5 */
902/* Supplies 120MHz clock, USIM source clock */
903/* Type: DPLL */
904/* 3430ES2 only */
905static struct dpll_data dpll5_dd = {
906 .mult_div1_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL4),
907 .mult_mask = OMAP3430ES2_PERIPH2_DPLL_MULT_MASK,
908 .div1_mask = OMAP3430ES2_PERIPH2_DPLL_DIV_MASK,
909 .clk_bypass = &sys_ck,
910 .clk_ref = &sys_ck,
911 .freqsel_mask = OMAP3430ES2_PERIPH2_DPLL_FREQSEL_MASK,
912 .control_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKEN2),
913 .enable_mask = OMAP3430ES2_EN_PERIPH2_DPLL_MASK,
914 .modes = (1 << DPLL_LOW_POWER_STOP) | (1 << DPLL_LOCKED),
915 .auto_recal_bit = OMAP3430ES2_EN_PERIPH2_DPLL_DRIFTGUARD_SHIFT,
916 .recal_en_bit = OMAP3430ES2_SND_PERIPH_DPLL_RECAL_EN_SHIFT,
917 .recal_st_bit = OMAP3430ES2_SND_PERIPH_DPLL_ST_SHIFT,
918 .autoidle_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_AUTOIDLE2_PLL),
919 .autoidle_mask = OMAP3430ES2_AUTO_PERIPH2_DPLL_MASK,
920 .idlest_reg = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST2),
921 .idlest_mask = OMAP3430ES2_ST_PERIPH2_CLK_MASK,
922 .max_multiplier = OMAP3_MAX_DPLL_MULT,
923 .min_divider = 1,
924 .max_divider = OMAP3_MAX_DPLL_DIV,
925};
926
927static struct clk dpll5_ck = {
928 .name = "dpll5_ck",
929 .ops = &clkops_omap3_noncore_dpll_ops,
930 .parent = &sys_ck,
931 .dpll_data = &dpll5_dd,
932 .round_rate = &omap2_dpll_round_rate,
933 .set_rate = &omap3_noncore_dpll_set_rate,
934 .clkdm_name = "dpll5_clkdm",
935 .recalc = &omap3_dpll_recalc,
936};
937
938static const struct clksel div16_dpll5_clksel[] = {
939 { .parent = &dpll5_ck, .rates = div16_dpll_rates },
940 { .parent = NULL }
941};
942
943static struct clk dpll5_m2_ck = {
944 .name = "dpll5_m2_ck",
945 .ops = &clkops_null,
946 .parent = &dpll5_ck,
947 .init = &omap2_init_clksel_parent,
948 .clksel_reg = OMAP_CM_REGADDR(PLL_MOD, OMAP3430ES2_CM_CLKSEL5),
949 .clksel_mask = OMAP3430ES2_DIV_120M_MASK,
950 .clksel = div16_dpll5_clksel,
951 .clkdm_name = "dpll5_clkdm",
952 .recalc = &omap2_clksel_recalc,
953};
954
955/* CM EXTERNAL CLOCK OUTPUTS */
956
957static const struct clksel_rate clkout2_src_core_rates[] = {
958 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
959 { .div = 0 }
960};
961
962static const struct clksel_rate clkout2_src_sys_rates[] = {
963 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
964 { .div = 0 }
965};
966
967static const struct clksel_rate clkout2_src_96m_rates[] = {
968 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
969 { .div = 0 }
970};
971
972static const struct clksel_rate clkout2_src_54m_rates[] = {
973 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
974 { .div = 0 }
975};
976
977static const struct clksel clkout2_src_clksel[] = {
978 { .parent = &core_ck, .rates = clkout2_src_core_rates },
979 { .parent = &sys_ck, .rates = clkout2_src_sys_rates },
980 { .parent = &cm_96m_fck, .rates = clkout2_src_96m_rates },
981 { .parent = &omap_54m_fck, .rates = clkout2_src_54m_rates },
982 { .parent = NULL }
983};
984
985static struct clk clkout2_src_ck = {
986 .name = "clkout2_src_ck",
987 .ops = &clkops_omap2_dflt,
988 .init = &omap2_init_clksel_parent,
989 .enable_reg = OMAP3430_CM_CLKOUT_CTRL,
990 .enable_bit = OMAP3430_CLKOUT2_EN_SHIFT,
991 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
992 .clksel_mask = OMAP3430_CLKOUT2SOURCE_MASK,
993 .clksel = clkout2_src_clksel,
994 .clkdm_name = "core_clkdm",
995 .recalc = &omap2_clksel_recalc,
996};
997
998static const struct clksel_rate sys_clkout2_rates[] = {
999 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1000 { .div = 2, .val = 1, .flags = RATE_IN_3XXX },
1001 { .div = 4, .val = 2, .flags = RATE_IN_3XXX },
1002 { .div = 8, .val = 3, .flags = RATE_IN_3XXX },
1003 { .div = 16, .val = 4, .flags = RATE_IN_3XXX },
1004 { .div = 0 },
1005};
1006
1007static const struct clksel sys_clkout2_clksel[] = {
1008 { .parent = &clkout2_src_ck, .rates = sys_clkout2_rates },
1009 { .parent = NULL },
1010};
1011
1012static struct clk sys_clkout2 = {
1013 .name = "sys_clkout2",
1014 .ops = &clkops_null,
1015 .init = &omap2_init_clksel_parent,
1016 .clksel_reg = OMAP3430_CM_CLKOUT_CTRL,
1017 .clksel_mask = OMAP3430_CLKOUT2_DIV_MASK,
1018 .clksel = sys_clkout2_clksel,
1019 .recalc = &omap2_clksel_recalc,
1020 .round_rate = &omap2_clksel_round_rate,
1021 .set_rate = &omap2_clksel_set_rate
1022};
1023
1024/* CM OUTPUT CLOCKS */
1025
1026static struct clk corex2_fck = {
1027 .name = "corex2_fck",
1028 .ops = &clkops_null,
1029 .parent = &dpll3_m2x2_ck,
1030 .recalc = &followparent_recalc,
1031};
1032
1033/* DPLL power domain clock controls */
1034
1035static const struct clksel_rate div4_rates[] = {
1036 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1037 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
1038 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
1039 { .div = 0 }
1040};
1041
1042static const struct clksel div4_core_clksel[] = {
1043 { .parent = &core_ck, .rates = div4_rates },
1044 { .parent = NULL }
1045};
1046
1047/*
1048 * REVISIT: Are these in DPLL power domain or CM power domain? docs
1049 * may be inconsistent here?
1050 */
1051static struct clk dpll1_fck = {
1052 .name = "dpll1_fck",
1053 .ops = &clkops_null,
1054 .parent = &core_ck,
1055 .init = &omap2_init_clksel_parent,
1056 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL1_PLL),
1057 .clksel_mask = OMAP3430_MPU_CLK_SRC_MASK,
1058 .clksel = div4_core_clksel,
1059 .recalc = &omap2_clksel_recalc,
1060};
1061
1062static struct clk mpu_ck = {
1063 .name = "mpu_ck",
1064 .ops = &clkops_null,
1065 .parent = &dpll1_x2m2_ck,
1066 .clkdm_name = "mpu_clkdm",
1067 .recalc = &followparent_recalc,
1068};
1069
1070/* arm_fck is divided by two when DPLL1 locked; otherwise, passthrough mpu_ck */
1071static const struct clksel_rate arm_fck_rates[] = {
1072 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1073 { .div = 2, .val = 1, .flags = RATE_IN_3XXX },
1074 { .div = 0 },
1075};
1076
1077static const struct clksel arm_fck_clksel[] = {
1078 { .parent = &mpu_ck, .rates = arm_fck_rates },
1079 { .parent = NULL }
1080};
1081
1082static struct clk arm_fck = {
1083 .name = "arm_fck",
1084 .ops = &clkops_null,
1085 .parent = &mpu_ck,
1086 .init = &omap2_init_clksel_parent,
1087 .clksel_reg = OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
1088 .clksel_mask = OMAP3430_ST_MPU_CLK_MASK,
1089 .clksel = arm_fck_clksel,
1090 .clkdm_name = "mpu_clkdm",
1091 .recalc = &omap2_clksel_recalc,
1092};
1093
1094/* XXX What about neon_clkdm ? */
1095
1096/*
1097 * REVISIT: This clock is never specifically defined in the 3430 TRM,
1098 * although it is referenced - so this is a guess
1099 */
1100static struct clk emu_mpu_alwon_ck = {
1101 .name = "emu_mpu_alwon_ck",
1102 .ops = &clkops_null,
1103 .parent = &mpu_ck,
1104 .recalc = &followparent_recalc,
1105};
1106
1107static struct clk dpll2_fck = {
1108 .name = "dpll2_fck",
1109 .ops = &clkops_null,
1110 .parent = &core_ck,
1111 .init = &omap2_init_clksel_parent,
1112 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, OMAP3430_CM_CLKSEL1_PLL),
1113 .clksel_mask = OMAP3430_IVA2_CLK_SRC_MASK,
1114 .clksel = div4_core_clksel,
1115 .recalc = &omap2_clksel_recalc,
1116};
1117
1118static struct clk iva2_ck = {
1119 .name = "iva2_ck",
1120 .ops = &clkops_omap2_dflt_wait,
1121 .parent = &dpll2_m2_ck,
1122 .enable_reg = OMAP_CM_REGADDR(OMAP3430_IVA2_MOD, CM_FCLKEN),
1123 .enable_bit = OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT,
1124 .clkdm_name = "iva2_clkdm",
1125 .recalc = &followparent_recalc,
1126};
1127
1128/* Common interface clocks */
1129
1130static const struct clksel div2_core_clksel[] = {
1131 { .parent = &core_ck, .rates = div2_rates },
1132 { .parent = NULL }
1133};
1134
1135static struct clk l3_ick = {
1136 .name = "l3_ick",
1137 .ops = &clkops_null,
1138 .parent = &core_ck,
1139 .init = &omap2_init_clksel_parent,
1140 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1141 .clksel_mask = OMAP3430_CLKSEL_L3_MASK,
1142 .clksel = div2_core_clksel,
1143 .clkdm_name = "core_l3_clkdm",
1144 .recalc = &omap2_clksel_recalc,
1145};
1146
1147static const struct clksel div2_l3_clksel[] = {
1148 { .parent = &l3_ick, .rates = div2_rates },
1149 { .parent = NULL }
1150};
1151
1152static struct clk l4_ick = {
1153 .name = "l4_ick",
1154 .ops = &clkops_null,
1155 .parent = &l3_ick,
1156 .init = &omap2_init_clksel_parent,
1157 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1158 .clksel_mask = OMAP3430_CLKSEL_L4_MASK,
1159 .clksel = div2_l3_clksel,
1160 .clkdm_name = "core_l4_clkdm",
1161 .recalc = &omap2_clksel_recalc,
1162
1163};
1164
1165static const struct clksel div2_l4_clksel[] = {
1166 { .parent = &l4_ick, .rates = div2_rates },
1167 { .parent = NULL }
1168};
1169
1170static struct clk rm_ick = {
1171 .name = "rm_ick",
1172 .ops = &clkops_null,
1173 .parent = &l4_ick,
1174 .init = &omap2_init_clksel_parent,
1175 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
1176 .clksel_mask = OMAP3430_CLKSEL_RM_MASK,
1177 .clksel = div2_l4_clksel,
1178 .recalc = &omap2_clksel_recalc,
1179};
1180
1181/* GFX power domain */
1182
1183/* GFX clocks are in 3430ES1 only. 3430ES2 and later uses the SGX instead */
1184
1185static const struct clksel gfx_l3_clksel[] = {
1186 { .parent = &l3_ick, .rates = gfx_l3_rates },
1187 { .parent = NULL }
1188};
1189
1190/*
1191 * Virtual parent clock for gfx_l3_ick and gfx_l3_fck
1192 * This interface clock does not have a CM_AUTOIDLE bit
1193 */
1194static struct clk gfx_l3_ck = {
1195 .name = "gfx_l3_ck",
1196 .ops = &clkops_omap2_dflt_wait,
1197 .parent = &l3_ick,
1198 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_ICLKEN),
1199 .enable_bit = OMAP_EN_GFX_SHIFT,
1200 .recalc = &followparent_recalc,
1201};
1202
1203static struct clk gfx_l3_fck = {
1204 .name = "gfx_l3_fck",
1205 .ops = &clkops_null,
1206 .parent = &gfx_l3_ck,
1207 .init = &omap2_init_clksel_parent,
1208 .clksel_reg = OMAP_CM_REGADDR(GFX_MOD, CM_CLKSEL),
1209 .clksel_mask = OMAP_CLKSEL_GFX_MASK,
1210 .clksel = gfx_l3_clksel,
1211 .clkdm_name = "gfx_3430es1_clkdm",
1212 .recalc = &omap2_clksel_recalc,
1213};
1214
1215static struct clk gfx_l3_ick = {
1216 .name = "gfx_l3_ick",
1217 .ops = &clkops_null,
1218 .parent = &gfx_l3_ck,
1219 .clkdm_name = "gfx_3430es1_clkdm",
1220 .recalc = &followparent_recalc,
1221};
1222
1223static struct clk gfx_cg1_ck = {
1224 .name = "gfx_cg1_ck",
1225 .ops = &clkops_omap2_dflt_wait,
1226 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1227 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1228 .enable_bit = OMAP3430ES1_EN_2D_SHIFT,
1229 .clkdm_name = "gfx_3430es1_clkdm",
1230 .recalc = &followparent_recalc,
1231};
1232
1233static struct clk gfx_cg2_ck = {
1234 .name = "gfx_cg2_ck",
1235 .ops = &clkops_omap2_dflt_wait,
1236 .parent = &gfx_l3_fck, /* REVISIT: correct? */
1237 .enable_reg = OMAP_CM_REGADDR(GFX_MOD, CM_FCLKEN),
1238 .enable_bit = OMAP3430ES1_EN_3D_SHIFT,
1239 .clkdm_name = "gfx_3430es1_clkdm",
1240 .recalc = &followparent_recalc,
1241};
1242
1243/* SGX power domain - 3430ES2 only */
1244
1245static const struct clksel_rate sgx_core_rates[] = {
1246 { .div = 2, .val = 5, .flags = RATE_IN_36XX },
1247 { .div = 3, .val = 0, .flags = RATE_IN_3XXX },
1248 { .div = 4, .val = 1, .flags = RATE_IN_3XXX },
1249 { .div = 6, .val = 2, .flags = RATE_IN_3XXX },
1250 { .div = 0 },
1251};
1252
1253static const struct clksel_rate sgx_192m_rates[] = {
1254 { .div = 1, .val = 4, .flags = RATE_IN_36XX },
1255 { .div = 0 },
1256};
1257
1258static const struct clksel_rate sgx_corex2_rates[] = {
1259 { .div = 3, .val = 6, .flags = RATE_IN_36XX },
1260 { .div = 5, .val = 7, .flags = RATE_IN_36XX },
1261 { .div = 0 },
1262};
1263
1264static const struct clksel_rate sgx_96m_rates[] = {
1265 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
1266 { .div = 0 },
1267};
1268
1269static const struct clksel sgx_clksel[] = {
1270 { .parent = &core_ck, .rates = sgx_core_rates },
1271 { .parent = &cm_96m_fck, .rates = sgx_96m_rates },
1272 { .parent = &omap_192m_alwon_fck, .rates = sgx_192m_rates },
1273 { .parent = &corex2_fck, .rates = sgx_corex2_rates },
1274 { .parent = NULL }
1275};
1276
1277static struct clk sgx_fck = {
1278 .name = "sgx_fck",
1279 .ops = &clkops_omap2_dflt_wait,
1280 .init = &omap2_init_clksel_parent,
1281 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_FCLKEN),
1282 .enable_bit = OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT,
1283 .clksel_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_CLKSEL),
1284 .clksel_mask = OMAP3430ES2_CLKSEL_SGX_MASK,
1285 .clksel = sgx_clksel,
1286 .clkdm_name = "sgx_clkdm",
1287 .recalc = &omap2_clksel_recalc,
1288 .set_rate = &omap2_clksel_set_rate,
1289 .round_rate = &omap2_clksel_round_rate
1290};
1291
1292/* This interface clock does not have a CM_AUTOIDLE bit */
1293static struct clk sgx_ick = {
1294 .name = "sgx_ick",
1295 .ops = &clkops_omap2_dflt_wait,
1296 .parent = &l3_ick,
1297 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_SGX_MOD, CM_ICLKEN),
1298 .enable_bit = OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT,
1299 .clkdm_name = "sgx_clkdm",
1300 .recalc = &followparent_recalc,
1301};
1302
1303/* CORE power domain */
1304
1305static struct clk d2d_26m_fck = {
1306 .name = "d2d_26m_fck",
1307 .ops = &clkops_omap2_dflt_wait,
1308 .parent = &sys_ck,
1309 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1310 .enable_bit = OMAP3430ES1_EN_D2D_SHIFT,
1311 .clkdm_name = "d2d_clkdm",
1312 .recalc = &followparent_recalc,
1313};
1314
1315static struct clk modem_fck = {
1316 .name = "modem_fck",
1317 .ops = &clkops_omap2_mdmclk_dflt_wait,
1318 .parent = &sys_ck,
1319 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1320 .enable_bit = OMAP3430_EN_MODEM_SHIFT,
1321 .clkdm_name = "d2d_clkdm",
1322 .recalc = &followparent_recalc,
1323};
1324
1325static struct clk sad2d_ick = {
1326 .name = "sad2d_ick",
1327 .ops = &clkops_omap2_iclk_dflt_wait,
1328 .parent = &l3_ick,
1329 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1330 .enable_bit = OMAP3430_EN_SAD2D_SHIFT,
1331 .clkdm_name = "d2d_clkdm",
1332 .recalc = &followparent_recalc,
1333};
1334
1335static struct clk mad2d_ick = {
1336 .name = "mad2d_ick",
1337 .ops = &clkops_omap2_iclk_dflt_wait,
1338 .parent = &l3_ick,
1339 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1340 .enable_bit = OMAP3430_EN_MAD2D_SHIFT,
1341 .clkdm_name = "d2d_clkdm",
1342 .recalc = &followparent_recalc,
1343};
1344
1345static const struct clksel omap343x_gpt_clksel[] = {
1346 { .parent = &omap_32k_fck, .rates = gpt_32k_rates },
1347 { .parent = &sys_ck, .rates = gpt_sys_rates },
1348 { .parent = NULL}
1349};
1350
1351static struct clk gpt10_fck = {
1352 .name = "gpt10_fck",
1353 .ops = &clkops_omap2_dflt_wait,
1354 .parent = &sys_ck,
1355 .init = &omap2_init_clksel_parent,
1356 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1357 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1358 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1359 .clksel_mask = OMAP3430_CLKSEL_GPT10_MASK,
1360 .clksel = omap343x_gpt_clksel,
1361 .clkdm_name = "core_l4_clkdm",
1362 .recalc = &omap2_clksel_recalc,
1363};
1364
1365static struct clk gpt11_fck = {
1366 .name = "gpt11_fck",
1367 .ops = &clkops_omap2_dflt_wait,
1368 .parent = &sys_ck,
1369 .init = &omap2_init_clksel_parent,
1370 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1371 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1372 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1373 .clksel_mask = OMAP3430_CLKSEL_GPT11_MASK,
1374 .clksel = omap343x_gpt_clksel,
1375 .clkdm_name = "core_l4_clkdm",
1376 .recalc = &omap2_clksel_recalc,
1377};
1378
1379static struct clk cpefuse_fck = {
1380 .name = "cpefuse_fck",
1381 .ops = &clkops_omap2_dflt,
1382 .parent = &sys_ck,
1383 .clkdm_name = "core_l4_clkdm",
1384 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1385 .enable_bit = OMAP3430ES2_EN_CPEFUSE_SHIFT,
1386 .recalc = &followparent_recalc,
1387};
1388
1389static struct clk ts_fck = {
1390 .name = "ts_fck",
1391 .ops = &clkops_omap2_dflt,
1392 .parent = &omap_32k_fck,
1393 .clkdm_name = "core_l4_clkdm",
1394 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1395 .enable_bit = OMAP3430ES2_EN_TS_SHIFT,
1396 .recalc = &followparent_recalc,
1397};
1398
1399static struct clk usbtll_fck = {
1400 .name = "usbtll_fck",
1401 .ops = &clkops_omap2_dflt_wait,
1402 .parent = &dpll5_m2_ck,
1403 .clkdm_name = "core_l4_clkdm",
1404 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, OMAP3430ES2_CM_FCLKEN3),
1405 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1406 .recalc = &followparent_recalc,
1407};
1408
1409/* CORE 96M FCLK-derived clocks */
1410
1411static struct clk core_96m_fck = {
1412 .name = "core_96m_fck",
1413 .ops = &clkops_null,
1414 .parent = &omap_96m_fck,
1415 .clkdm_name = "core_l4_clkdm",
1416 .recalc = &followparent_recalc,
1417};
1418
1419static struct clk mmchs3_fck = {
1420 .name = "mmchs3_fck",
1421 .ops = &clkops_omap2_dflt_wait,
1422 .parent = &core_96m_fck,
1423 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1424 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1425 .clkdm_name = "core_l4_clkdm",
1426 .recalc = &followparent_recalc,
1427};
1428
1429static struct clk mmchs2_fck = {
1430 .name = "mmchs2_fck",
1431 .ops = &clkops_omap2_dflt_wait,
1432 .parent = &core_96m_fck,
1433 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1434 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1435 .clkdm_name = "core_l4_clkdm",
1436 .recalc = &followparent_recalc,
1437};
1438
1439static struct clk mspro_fck = {
1440 .name = "mspro_fck",
1441 .ops = &clkops_omap2_dflt_wait,
1442 .parent = &core_96m_fck,
1443 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1444 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1445 .clkdm_name = "core_l4_clkdm",
1446 .recalc = &followparent_recalc,
1447};
1448
1449static struct clk mmchs1_fck = {
1450 .name = "mmchs1_fck",
1451 .ops = &clkops_omap2_dflt_wait,
1452 .parent = &core_96m_fck,
1453 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1454 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1455 .clkdm_name = "core_l4_clkdm",
1456 .recalc = &followparent_recalc,
1457};
1458
1459static struct clk i2c3_fck = {
1460 .name = "i2c3_fck",
1461 .ops = &clkops_omap2_dflt_wait,
1462 .parent = &core_96m_fck,
1463 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1464 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1465 .clkdm_name = "core_l4_clkdm",
1466 .recalc = &followparent_recalc,
1467};
1468
1469static struct clk i2c2_fck = {
1470 .name = "i2c2_fck",
1471 .ops = &clkops_omap2_dflt_wait,
1472 .parent = &core_96m_fck,
1473 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1474 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1475 .clkdm_name = "core_l4_clkdm",
1476 .recalc = &followparent_recalc,
1477};
1478
1479static struct clk i2c1_fck = {
1480 .name = "i2c1_fck",
1481 .ops = &clkops_omap2_dflt_wait,
1482 .parent = &core_96m_fck,
1483 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1484 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1485 .clkdm_name = "core_l4_clkdm",
1486 .recalc = &followparent_recalc,
1487};
1488
1489/*
1490 * MCBSP 1 & 5 get their 96MHz clock from core_96m_fck;
1491 * MCBSP 2, 3, 4 get their 96MHz clock from per_96m_fck.
1492 */
1493static const struct clksel_rate common_mcbsp_96m_rates[] = {
1494 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
1495 { .div = 0 }
1496};
1497
1498static const struct clksel_rate common_mcbsp_mcbsp_rates[] = {
1499 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1500 { .div = 0 }
1501};
1502
1503static const struct clksel mcbsp_15_clksel[] = {
1504 { .parent = &core_96m_fck, .rates = common_mcbsp_96m_rates },
1505 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
1506 { .parent = NULL }
1507};
1508
1509static struct clk mcbsp5_fck = {
1510 .name = "mcbsp5_fck",
1511 .ops = &clkops_omap2_dflt_wait,
1512 .init = &omap2_init_clksel_parent,
1513 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1514 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1515 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
1516 .clksel_mask = OMAP2_MCBSP5_CLKS_MASK,
1517 .clksel = mcbsp_15_clksel,
1518 .clkdm_name = "core_l4_clkdm",
1519 .recalc = &omap2_clksel_recalc,
1520};
1521
1522static struct clk mcbsp1_fck = {
1523 .name = "mcbsp1_fck",
1524 .ops = &clkops_omap2_dflt_wait,
1525 .init = &omap2_init_clksel_parent,
1526 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1527 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
1528 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
1529 .clksel_mask = OMAP2_MCBSP1_CLKS_MASK,
1530 .clksel = mcbsp_15_clksel,
1531 .clkdm_name = "core_l4_clkdm",
1532 .recalc = &omap2_clksel_recalc,
1533};
1534
1535/* CORE_48M_FCK-derived clocks */
1536
1537static struct clk core_48m_fck = {
1538 .name = "core_48m_fck",
1539 .ops = &clkops_null,
1540 .parent = &omap_48m_fck,
1541 .clkdm_name = "core_l4_clkdm",
1542 .recalc = &followparent_recalc,
1543};
1544
1545static struct clk mcspi4_fck = {
1546 .name = "mcspi4_fck",
1547 .ops = &clkops_omap2_dflt_wait,
1548 .parent = &core_48m_fck,
1549 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1550 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1551 .recalc = &followparent_recalc,
1552 .clkdm_name = "core_l4_clkdm",
1553};
1554
1555static struct clk mcspi3_fck = {
1556 .name = "mcspi3_fck",
1557 .ops = &clkops_omap2_dflt_wait,
1558 .parent = &core_48m_fck,
1559 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1560 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1561 .recalc = &followparent_recalc,
1562 .clkdm_name = "core_l4_clkdm",
1563};
1564
1565static struct clk mcspi2_fck = {
1566 .name = "mcspi2_fck",
1567 .ops = &clkops_omap2_dflt_wait,
1568 .parent = &core_48m_fck,
1569 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1570 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1571 .recalc = &followparent_recalc,
1572 .clkdm_name = "core_l4_clkdm",
1573};
1574
1575static struct clk mcspi1_fck = {
1576 .name = "mcspi1_fck",
1577 .ops = &clkops_omap2_dflt_wait,
1578 .parent = &core_48m_fck,
1579 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1580 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1581 .recalc = &followparent_recalc,
1582 .clkdm_name = "core_l4_clkdm",
1583};
1584
1585static struct clk uart2_fck = {
1586 .name = "uart2_fck",
1587 .ops = &clkops_omap2_dflt_wait,
1588 .parent = &core_48m_fck,
1589 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1590 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1591 .clkdm_name = "core_l4_clkdm",
1592 .recalc = &followparent_recalc,
1593};
1594
1595static struct clk uart1_fck = {
1596 .name = "uart1_fck",
1597 .ops = &clkops_omap2_dflt_wait,
1598 .parent = &core_48m_fck,
1599 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1600 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1601 .clkdm_name = "core_l4_clkdm",
1602 .recalc = &followparent_recalc,
1603};
1604
1605static struct clk fshostusb_fck = {
1606 .name = "fshostusb_fck",
1607 .ops = &clkops_omap2_dflt_wait,
1608 .parent = &core_48m_fck,
1609 .clkdm_name = "core_l4_clkdm",
1610 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1611 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
1612 .recalc = &followparent_recalc,
1613};
1614
1615/* CORE_12M_FCK based clocks */
1616
1617static struct clk core_12m_fck = {
1618 .name = "core_12m_fck",
1619 .ops = &clkops_null,
1620 .parent = &omap_12m_fck,
1621 .clkdm_name = "core_l4_clkdm",
1622 .recalc = &followparent_recalc,
1623};
1624
1625static struct clk hdq_fck = {
1626 .name = "hdq_fck",
1627 .ops = &clkops_omap2_dflt_wait,
1628 .parent = &core_12m_fck,
1629 .clkdm_name = "core_l4_clkdm",
1630 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1631 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1632 .recalc = &followparent_recalc,
1633};
1634
1635/* DPLL3-derived clock */
1636
1637static const struct clksel_rate ssi_ssr_corex2_rates[] = {
1638 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
1639 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
1640 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
1641 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
1642 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
1643 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
1644 { .div = 0 }
1645};
1646
1647static const struct clksel ssi_ssr_clksel[] = {
1648 { .parent = &corex2_fck, .rates = ssi_ssr_corex2_rates },
1649 { .parent = NULL }
1650};
1651
1652static struct clk ssi_ssr_fck_3430es1 = {
1653 .name = "ssi_ssr_fck",
1654 .ops = &clkops_omap2_dflt,
1655 .init = &omap2_init_clksel_parent,
1656 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1657 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1658 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1659 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1660 .clksel = ssi_ssr_clksel,
1661 .clkdm_name = "core_l4_clkdm",
1662 .recalc = &omap2_clksel_recalc,
1663};
1664
1665static struct clk ssi_ssr_fck_3430es2 = {
1666 .name = "ssi_ssr_fck",
1667 .ops = &clkops_omap3430es2_ssi_wait,
1668 .init = &omap2_init_clksel_parent,
1669 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
1670 .enable_bit = OMAP3430_EN_SSI_SHIFT,
1671 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
1672 .clksel_mask = OMAP3430_CLKSEL_SSI_MASK,
1673 .clksel = ssi_ssr_clksel,
1674 .clkdm_name = "core_l4_clkdm",
1675 .recalc = &omap2_clksel_recalc,
1676};
1677
1678static struct clk ssi_sst_fck_3430es1 = {
1679 .name = "ssi_sst_fck",
1680 .ops = &clkops_null,
1681 .parent = &ssi_ssr_fck_3430es1,
1682 .fixed_div = 2,
1683 .recalc = &omap_fixed_divisor_recalc,
1684};
1685
1686static struct clk ssi_sst_fck_3430es2 = {
1687 .name = "ssi_sst_fck",
1688 .ops = &clkops_null,
1689 .parent = &ssi_ssr_fck_3430es2,
1690 .fixed_div = 2,
1691 .recalc = &omap_fixed_divisor_recalc,
1692};
1693
1694
1695
1696/* CORE_L3_ICK based clocks */
1697
1698/*
1699 * XXX must add clk_enable/clk_disable for these if standard code won't
1700 * handle it
1701 */
1702static struct clk core_l3_ick = {
1703 .name = "core_l3_ick",
1704 .ops = &clkops_null,
1705 .parent = &l3_ick,
1706 .clkdm_name = "core_l3_clkdm",
1707 .recalc = &followparent_recalc,
1708};
1709
1710static struct clk hsotgusb_ick_3430es1 = {
1711 .name = "hsotgusb_ick",
1712 .ops = &clkops_omap2_iclk_dflt,
1713 .parent = &core_l3_ick,
1714 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1715 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1716 .clkdm_name = "core_l3_clkdm",
1717 .recalc = &followparent_recalc,
1718};
1719
1720static struct clk hsotgusb_ick_3430es2 = {
1721 .name = "hsotgusb_ick",
1722 .ops = &clkops_omap3430es2_iclk_hsotgusb_wait,
1723 .parent = &core_l3_ick,
1724 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1725 .enable_bit = OMAP3430_EN_HSOTGUSB_SHIFT,
1726 .clkdm_name = "core_l3_clkdm",
1727 .recalc = &followparent_recalc,
1728};
1729
1730/* This interface clock does not have a CM_AUTOIDLE bit */
1731static struct clk sdrc_ick = {
1732 .name = "sdrc_ick",
1733 .ops = &clkops_omap2_dflt_wait,
1734 .parent = &core_l3_ick,
1735 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1736 .enable_bit = OMAP3430_EN_SDRC_SHIFT,
1737 .flags = ENABLE_ON_INIT,
1738 .clkdm_name = "core_l3_clkdm",
1739 .recalc = &followparent_recalc,
1740};
1741
1742static struct clk gpmc_fck = {
1743 .name = "gpmc_fck",
1744 .ops = &clkops_null,
1745 .parent = &core_l3_ick,
1746 .flags = ENABLE_ON_INIT, /* huh? */
1747 .clkdm_name = "core_l3_clkdm",
1748 .recalc = &followparent_recalc,
1749};
1750
1751/* SECURITY_L3_ICK based clocks */
1752
1753static struct clk security_l3_ick = {
1754 .name = "security_l3_ick",
1755 .ops = &clkops_null,
1756 .parent = &l3_ick,
1757 .recalc = &followparent_recalc,
1758};
1759
1760static struct clk pka_ick = {
1761 .name = "pka_ick",
1762 .ops = &clkops_omap2_iclk_dflt_wait,
1763 .parent = &security_l3_ick,
1764 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
1765 .enable_bit = OMAP3430_EN_PKA_SHIFT,
1766 .recalc = &followparent_recalc,
1767};
1768
1769/* CORE_L4_ICK based clocks */
1770
1771static struct clk core_l4_ick = {
1772 .name = "core_l4_ick",
1773 .ops = &clkops_null,
1774 .parent = &l4_ick,
1775 .clkdm_name = "core_l4_clkdm",
1776 .recalc = &followparent_recalc,
1777};
1778
1779static struct clk usbtll_ick = {
1780 .name = "usbtll_ick",
1781 .ops = &clkops_omap2_iclk_dflt_wait,
1782 .parent = &core_l4_ick,
1783 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN3),
1784 .enable_bit = OMAP3430ES2_EN_USBTLL_SHIFT,
1785 .clkdm_name = "core_l4_clkdm",
1786 .recalc = &followparent_recalc,
1787};
1788
1789static struct clk mmchs3_ick = {
1790 .name = "mmchs3_ick",
1791 .ops = &clkops_omap2_iclk_dflt_wait,
1792 .parent = &core_l4_ick,
1793 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1794 .enable_bit = OMAP3430ES2_EN_MMC3_SHIFT,
1795 .clkdm_name = "core_l4_clkdm",
1796 .recalc = &followparent_recalc,
1797};
1798
1799/* Intersystem Communication Registers - chassis mode only */
1800static struct clk icr_ick = {
1801 .name = "icr_ick",
1802 .ops = &clkops_omap2_iclk_dflt_wait,
1803 .parent = &core_l4_ick,
1804 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1805 .enable_bit = OMAP3430_EN_ICR_SHIFT,
1806 .clkdm_name = "core_l4_clkdm",
1807 .recalc = &followparent_recalc,
1808};
1809
1810static struct clk aes2_ick = {
1811 .name = "aes2_ick",
1812 .ops = &clkops_omap2_iclk_dflt_wait,
1813 .parent = &core_l4_ick,
1814 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1815 .enable_bit = OMAP3430_EN_AES2_SHIFT,
1816 .clkdm_name = "core_l4_clkdm",
1817 .recalc = &followparent_recalc,
1818};
1819
1820static struct clk sha12_ick = {
1821 .name = "sha12_ick",
1822 .ops = &clkops_omap2_iclk_dflt_wait,
1823 .parent = &core_l4_ick,
1824 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1825 .enable_bit = OMAP3430_EN_SHA12_SHIFT,
1826 .clkdm_name = "core_l4_clkdm",
1827 .recalc = &followparent_recalc,
1828};
1829
1830static struct clk des2_ick = {
1831 .name = "des2_ick",
1832 .ops = &clkops_omap2_iclk_dflt_wait,
1833 .parent = &core_l4_ick,
1834 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1835 .enable_bit = OMAP3430_EN_DES2_SHIFT,
1836 .clkdm_name = "core_l4_clkdm",
1837 .recalc = &followparent_recalc,
1838};
1839
1840static struct clk mmchs2_ick = {
1841 .name = "mmchs2_ick",
1842 .ops = &clkops_omap2_iclk_dflt_wait,
1843 .parent = &core_l4_ick,
1844 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1845 .enable_bit = OMAP3430_EN_MMC2_SHIFT,
1846 .clkdm_name = "core_l4_clkdm",
1847 .recalc = &followparent_recalc,
1848};
1849
1850static struct clk mmchs1_ick = {
1851 .name = "mmchs1_ick",
1852 .ops = &clkops_omap2_iclk_dflt_wait,
1853 .parent = &core_l4_ick,
1854 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1855 .enable_bit = OMAP3430_EN_MMC1_SHIFT,
1856 .clkdm_name = "core_l4_clkdm",
1857 .recalc = &followparent_recalc,
1858};
1859
1860static struct clk mspro_ick = {
1861 .name = "mspro_ick",
1862 .ops = &clkops_omap2_iclk_dflt_wait,
1863 .parent = &core_l4_ick,
1864 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1865 .enable_bit = OMAP3430_EN_MSPRO_SHIFT,
1866 .clkdm_name = "core_l4_clkdm",
1867 .recalc = &followparent_recalc,
1868};
1869
1870static struct clk hdq_ick = {
1871 .name = "hdq_ick",
1872 .ops = &clkops_omap2_iclk_dflt_wait,
1873 .parent = &core_l4_ick,
1874 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1875 .enable_bit = OMAP3430_EN_HDQ_SHIFT,
1876 .clkdm_name = "core_l4_clkdm",
1877 .recalc = &followparent_recalc,
1878};
1879
1880static struct clk mcspi4_ick = {
1881 .name = "mcspi4_ick",
1882 .ops = &clkops_omap2_iclk_dflt_wait,
1883 .parent = &core_l4_ick,
1884 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1885 .enable_bit = OMAP3430_EN_MCSPI4_SHIFT,
1886 .clkdm_name = "core_l4_clkdm",
1887 .recalc = &followparent_recalc,
1888};
1889
1890static struct clk mcspi3_ick = {
1891 .name = "mcspi3_ick",
1892 .ops = &clkops_omap2_iclk_dflt_wait,
1893 .parent = &core_l4_ick,
1894 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1895 .enable_bit = OMAP3430_EN_MCSPI3_SHIFT,
1896 .clkdm_name = "core_l4_clkdm",
1897 .recalc = &followparent_recalc,
1898};
1899
1900static struct clk mcspi2_ick = {
1901 .name = "mcspi2_ick",
1902 .ops = &clkops_omap2_iclk_dflt_wait,
1903 .parent = &core_l4_ick,
1904 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1905 .enable_bit = OMAP3430_EN_MCSPI2_SHIFT,
1906 .clkdm_name = "core_l4_clkdm",
1907 .recalc = &followparent_recalc,
1908};
1909
1910static struct clk mcspi1_ick = {
1911 .name = "mcspi1_ick",
1912 .ops = &clkops_omap2_iclk_dflt_wait,
1913 .parent = &core_l4_ick,
1914 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1915 .enable_bit = OMAP3430_EN_MCSPI1_SHIFT,
1916 .clkdm_name = "core_l4_clkdm",
1917 .recalc = &followparent_recalc,
1918};
1919
1920static struct clk i2c3_ick = {
1921 .name = "i2c3_ick",
1922 .ops = &clkops_omap2_iclk_dflt_wait,
1923 .parent = &core_l4_ick,
1924 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1925 .enable_bit = OMAP3430_EN_I2C3_SHIFT,
1926 .clkdm_name = "core_l4_clkdm",
1927 .recalc = &followparent_recalc,
1928};
1929
1930static struct clk i2c2_ick = {
1931 .name = "i2c2_ick",
1932 .ops = &clkops_omap2_iclk_dflt_wait,
1933 .parent = &core_l4_ick,
1934 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1935 .enable_bit = OMAP3430_EN_I2C2_SHIFT,
1936 .clkdm_name = "core_l4_clkdm",
1937 .recalc = &followparent_recalc,
1938};
1939
1940static struct clk i2c1_ick = {
1941 .name = "i2c1_ick",
1942 .ops = &clkops_omap2_iclk_dflt_wait,
1943 .parent = &core_l4_ick,
1944 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1945 .enable_bit = OMAP3430_EN_I2C1_SHIFT,
1946 .clkdm_name = "core_l4_clkdm",
1947 .recalc = &followparent_recalc,
1948};
1949
1950static struct clk uart2_ick = {
1951 .name = "uart2_ick",
1952 .ops = &clkops_omap2_iclk_dflt_wait,
1953 .parent = &core_l4_ick,
1954 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1955 .enable_bit = OMAP3430_EN_UART2_SHIFT,
1956 .clkdm_name = "core_l4_clkdm",
1957 .recalc = &followparent_recalc,
1958};
1959
1960static struct clk uart1_ick = {
1961 .name = "uart1_ick",
1962 .ops = &clkops_omap2_iclk_dflt_wait,
1963 .parent = &core_l4_ick,
1964 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1965 .enable_bit = OMAP3430_EN_UART1_SHIFT,
1966 .clkdm_name = "core_l4_clkdm",
1967 .recalc = &followparent_recalc,
1968};
1969
1970static struct clk gpt11_ick = {
1971 .name = "gpt11_ick",
1972 .ops = &clkops_omap2_iclk_dflt_wait,
1973 .parent = &core_l4_ick,
1974 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1975 .enable_bit = OMAP3430_EN_GPT11_SHIFT,
1976 .clkdm_name = "core_l4_clkdm",
1977 .recalc = &followparent_recalc,
1978};
1979
1980static struct clk gpt10_ick = {
1981 .name = "gpt10_ick",
1982 .ops = &clkops_omap2_iclk_dflt_wait,
1983 .parent = &core_l4_ick,
1984 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1985 .enable_bit = OMAP3430_EN_GPT10_SHIFT,
1986 .clkdm_name = "core_l4_clkdm",
1987 .recalc = &followparent_recalc,
1988};
1989
1990static struct clk mcbsp5_ick = {
1991 .name = "mcbsp5_ick",
1992 .ops = &clkops_omap2_iclk_dflt_wait,
1993 .parent = &core_l4_ick,
1994 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
1995 .enable_bit = OMAP3430_EN_MCBSP5_SHIFT,
1996 .clkdm_name = "core_l4_clkdm",
1997 .recalc = &followparent_recalc,
1998};
1999
2000static struct clk mcbsp1_ick = {
2001 .name = "mcbsp1_ick",
2002 .ops = &clkops_omap2_iclk_dflt_wait,
2003 .parent = &core_l4_ick,
2004 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2005 .enable_bit = OMAP3430_EN_MCBSP1_SHIFT,
2006 .clkdm_name = "core_l4_clkdm",
2007 .recalc = &followparent_recalc,
2008};
2009
2010static struct clk fac_ick = {
2011 .name = "fac_ick",
2012 .ops = &clkops_omap2_iclk_dflt_wait,
2013 .parent = &core_l4_ick,
2014 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2015 .enable_bit = OMAP3430ES1_EN_FAC_SHIFT,
2016 .clkdm_name = "core_l4_clkdm",
2017 .recalc = &followparent_recalc,
2018};
2019
2020static struct clk mailboxes_ick = {
2021 .name = "mailboxes_ick",
2022 .ops = &clkops_omap2_iclk_dflt_wait,
2023 .parent = &core_l4_ick,
2024 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2025 .enable_bit = OMAP3430_EN_MAILBOXES_SHIFT,
2026 .clkdm_name = "core_l4_clkdm",
2027 .recalc = &followparent_recalc,
2028};
2029
2030static struct clk omapctrl_ick = {
2031 .name = "omapctrl_ick",
2032 .ops = &clkops_omap2_iclk_dflt_wait,
2033 .parent = &core_l4_ick,
2034 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2035 .enable_bit = OMAP3430_EN_OMAPCTRL_SHIFT,
2036 .flags = ENABLE_ON_INIT,
2037 .clkdm_name = "core_l4_clkdm",
2038 .recalc = &followparent_recalc,
2039};
2040
2041/* SSI_L4_ICK based clocks */
2042
2043static struct clk ssi_l4_ick = {
2044 .name = "ssi_l4_ick",
2045 .ops = &clkops_null,
2046 .parent = &l4_ick,
2047 .clkdm_name = "core_l4_clkdm",
2048 .recalc = &followparent_recalc,
2049};
2050
2051static struct clk ssi_ick_3430es1 = {
2052 .name = "ssi_ick",
2053 .ops = &clkops_omap2_iclk_dflt,
2054 .parent = &ssi_l4_ick,
2055 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2056 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2057 .clkdm_name = "core_l4_clkdm",
2058 .recalc = &followparent_recalc,
2059};
2060
2061static struct clk ssi_ick_3430es2 = {
2062 .name = "ssi_ick",
2063 .ops = &clkops_omap3430es2_iclk_ssi_wait,
2064 .parent = &ssi_l4_ick,
2065 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2066 .enable_bit = OMAP3430_EN_SSI_SHIFT,
2067 .clkdm_name = "core_l4_clkdm",
2068 .recalc = &followparent_recalc,
2069};
2070
2071/* REVISIT: Technically the TRM claims that this is CORE_CLK based,
2072 * but l4_ick makes more sense to me */
2073
2074static const struct clksel usb_l4_clksel[] = {
2075 { .parent = &l4_ick, .rates = div2_rates },
2076 { .parent = NULL },
2077};
2078
2079static struct clk usb_l4_ick = {
2080 .name = "usb_l4_ick",
2081 .ops = &clkops_omap2_iclk_dflt_wait,
2082 .parent = &l4_ick,
2083 .init = &omap2_init_clksel_parent,
2084 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
2085 .enable_bit = OMAP3430ES1_EN_FSHOSTUSB_SHIFT,
2086 .clksel_reg = OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
2087 .clksel_mask = OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK,
2088 .clksel = usb_l4_clksel,
2089 .clkdm_name = "core_l4_clkdm",
2090 .recalc = &omap2_clksel_recalc,
2091};
2092
2093/* SECURITY_L4_ICK2 based clocks */
2094
2095static struct clk security_l4_ick2 = {
2096 .name = "security_l4_ick2",
2097 .ops = &clkops_null,
2098 .parent = &l4_ick,
2099 .recalc = &followparent_recalc,
2100};
2101
2102static struct clk aes1_ick = {
2103 .name = "aes1_ick",
2104 .ops = &clkops_omap2_iclk_dflt_wait,
2105 .parent = &security_l4_ick2,
2106 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2107 .enable_bit = OMAP3430_EN_AES1_SHIFT,
2108 .recalc = &followparent_recalc,
2109};
2110
2111static struct clk rng_ick = {
2112 .name = "rng_ick",
2113 .ops = &clkops_omap2_iclk_dflt_wait,
2114 .parent = &security_l4_ick2,
2115 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2116 .enable_bit = OMAP3430_EN_RNG_SHIFT,
2117 .recalc = &followparent_recalc,
2118};
2119
2120static struct clk sha11_ick = {
2121 .name = "sha11_ick",
2122 .ops = &clkops_omap2_iclk_dflt_wait,
2123 .parent = &security_l4_ick2,
2124 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2125 .enable_bit = OMAP3430_EN_SHA11_SHIFT,
2126 .recalc = &followparent_recalc,
2127};
2128
2129static struct clk des1_ick = {
2130 .name = "des1_ick",
2131 .ops = &clkops_omap2_iclk_dflt_wait,
2132 .parent = &security_l4_ick2,
2133 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN2),
2134 .enable_bit = OMAP3430_EN_DES1_SHIFT,
2135 .recalc = &followparent_recalc,
2136};
2137
2138/* DSS */
2139static struct clk dss1_alwon_fck_3430es1 = {
2140 .name = "dss1_alwon_fck",
2141 .ops = &clkops_omap2_dflt,
2142 .parent = &dpll4_m4x2_ck,
2143 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2144 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2145 .clkdm_name = "dss_clkdm",
2146 .recalc = &followparent_recalc,
2147};
2148
2149static struct clk dss1_alwon_fck_3430es2 = {
2150 .name = "dss1_alwon_fck",
2151 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2152 .parent = &dpll4_m4x2_ck,
2153 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2154 .enable_bit = OMAP3430_EN_DSS1_SHIFT,
2155 .clkdm_name = "dss_clkdm",
2156 .recalc = &followparent_recalc,
2157};
2158
2159static struct clk dss_tv_fck = {
2160 .name = "dss_tv_fck",
2161 .ops = &clkops_omap2_dflt,
2162 .parent = &omap_54m_fck,
2163 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2164 .enable_bit = OMAP3430_EN_TV_SHIFT,
2165 .clkdm_name = "dss_clkdm",
2166 .recalc = &followparent_recalc,
2167};
2168
2169static struct clk dss_96m_fck = {
2170 .name = "dss_96m_fck",
2171 .ops = &clkops_omap2_dflt,
2172 .parent = &omap_96m_fck,
2173 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2174 .enable_bit = OMAP3430_EN_TV_SHIFT,
2175 .clkdm_name = "dss_clkdm",
2176 .recalc = &followparent_recalc,
2177};
2178
2179static struct clk dss2_alwon_fck = {
2180 .name = "dss2_alwon_fck",
2181 .ops = &clkops_omap2_dflt,
2182 .parent = &sys_ck,
2183 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_FCLKEN),
2184 .enable_bit = OMAP3430_EN_DSS2_SHIFT,
2185 .clkdm_name = "dss_clkdm",
2186 .recalc = &followparent_recalc,
2187};
2188
2189static struct clk dss_ick_3430es1 = {
2190 /* Handles both L3 and L4 clocks */
2191 .name = "dss_ick",
2192 .ops = &clkops_omap2_iclk_dflt,
2193 .parent = &l4_ick,
2194 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2195 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2196 .clkdm_name = "dss_clkdm",
2197 .recalc = &followparent_recalc,
2198};
2199
2200static struct clk dss_ick_3430es2 = {
2201 /* Handles both L3 and L4 clocks */
2202 .name = "dss_ick",
2203 .ops = &clkops_omap3430es2_iclk_dss_usbhost_wait,
2204 .parent = &l4_ick,
2205 .enable_reg = OMAP_CM_REGADDR(OMAP3430_DSS_MOD, CM_ICLKEN),
2206 .enable_bit = OMAP3430_CM_ICLKEN_DSS_EN_DSS_SHIFT,
2207 .clkdm_name = "dss_clkdm",
2208 .recalc = &followparent_recalc,
2209};
2210
2211/* CAM */
2212
2213static struct clk cam_mclk = {
2214 .name = "cam_mclk",
2215 .ops = &clkops_omap2_dflt,
2216 .parent = &dpll4_m5x2_ck,
2217 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2218 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2219 .clkdm_name = "cam_clkdm",
2220 .recalc = &followparent_recalc,
2221};
2222
2223static struct clk cam_ick = {
2224 /* Handles both L3 and L4 clocks */
2225 .name = "cam_ick",
2226 .ops = &clkops_omap2_iclk_dflt,
2227 .parent = &l4_ick,
2228 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_ICLKEN),
2229 .enable_bit = OMAP3430_EN_CAM_SHIFT,
2230 .clkdm_name = "cam_clkdm",
2231 .recalc = &followparent_recalc,
2232};
2233
2234static struct clk csi2_96m_fck = {
2235 .name = "csi2_96m_fck",
2236 .ops = &clkops_omap2_dflt,
2237 .parent = &core_96m_fck,
2238 .enable_reg = OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_FCLKEN),
2239 .enable_bit = OMAP3430_EN_CSI2_SHIFT,
2240 .clkdm_name = "cam_clkdm",
2241 .recalc = &followparent_recalc,
2242};
2243
2244/* USBHOST - 3430ES2 only */
2245
2246static struct clk usbhost_120m_fck = {
2247 .name = "usbhost_120m_fck",
2248 .ops = &clkops_omap2_dflt,
2249 .parent = &dpll5_m2_ck,
2250 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2251 .enable_bit = OMAP3430ES2_EN_USBHOST2_SHIFT,
2252 .clkdm_name = "usbhost_clkdm",
2253 .recalc = &followparent_recalc,
2254};
2255
2256static struct clk usbhost_48m_fck = {
2257 .name = "usbhost_48m_fck",
2258 .ops = &clkops_omap3430es2_dss_usbhost_wait,
2259 .parent = &omap_48m_fck,
2260 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_FCLKEN),
2261 .enable_bit = OMAP3430ES2_EN_USBHOST1_SHIFT,
2262 .clkdm_name = "usbhost_clkdm",
2263 .recalc = &followparent_recalc,
2264};
2265
2266static struct clk usbhost_ick = {
2267 /* Handles both L3 and L4 clocks */
2268 .name = "usbhost_ick",
2269 .ops = &clkops_omap3430es2_iclk_dss_usbhost_wait,
2270 .parent = &l4_ick,
2271 .enable_reg = OMAP_CM_REGADDR(OMAP3430ES2_USBHOST_MOD, CM_ICLKEN),
2272 .enable_bit = OMAP3430ES2_EN_USBHOST_SHIFT,
2273 .clkdm_name = "usbhost_clkdm",
2274 .recalc = &followparent_recalc,
2275};
2276
2277/* WKUP */
2278
2279static const struct clksel_rate usim_96m_rates[] = {
2280 { .div = 2, .val = 3, .flags = RATE_IN_3XXX },
2281 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2282 { .div = 8, .val = 5, .flags = RATE_IN_3XXX },
2283 { .div = 10, .val = 6, .flags = RATE_IN_3XXX },
2284 { .div = 0 },
2285};
2286
2287static const struct clksel_rate usim_120m_rates[] = {
2288 { .div = 4, .val = 7, .flags = RATE_IN_3XXX },
2289 { .div = 8, .val = 8, .flags = RATE_IN_3XXX },
2290 { .div = 16, .val = 9, .flags = RATE_IN_3XXX },
2291 { .div = 20, .val = 10, .flags = RATE_IN_3XXX },
2292 { .div = 0 },
2293};
2294
2295static const struct clksel usim_clksel[] = {
2296 { .parent = &omap_96m_fck, .rates = usim_96m_rates },
2297 { .parent = &dpll5_m2_ck, .rates = usim_120m_rates },
2298 { .parent = &sys_ck, .rates = div2_rates },
2299 { .parent = NULL },
2300};
2301
2302/* 3430ES2 only */
2303static struct clk usim_fck = {
2304 .name = "usim_fck",
2305 .ops = &clkops_omap2_dflt_wait,
2306 .init = &omap2_init_clksel_parent,
2307 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2308 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2309 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2310 .clksel_mask = OMAP3430ES2_CLKSEL_USIMOCP_MASK,
2311 .clksel = usim_clksel,
2312 .recalc = &omap2_clksel_recalc,
2313};
2314
2315/* XXX should gpt1's clksel have wkup_32k_fck as the 32k opt? */
2316static struct clk gpt1_fck = {
2317 .name = "gpt1_fck",
2318 .ops = &clkops_omap2_dflt_wait,
2319 .init = &omap2_init_clksel_parent,
2320 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2321 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2322 .clksel_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_CLKSEL),
2323 .clksel_mask = OMAP3430_CLKSEL_GPT1_MASK,
2324 .clksel = omap343x_gpt_clksel,
2325 .clkdm_name = "wkup_clkdm",
2326 .recalc = &omap2_clksel_recalc,
2327};
2328
2329static struct clk wkup_32k_fck = {
2330 .name = "wkup_32k_fck",
2331 .ops = &clkops_null,
2332 .parent = &omap_32k_fck,
2333 .clkdm_name = "wkup_clkdm",
2334 .recalc = &followparent_recalc,
2335};
2336
2337static struct clk gpio1_dbck = {
2338 .name = "gpio1_dbck",
2339 .ops = &clkops_omap2_dflt,
2340 .parent = &wkup_32k_fck,
2341 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2342 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2343 .clkdm_name = "wkup_clkdm",
2344 .recalc = &followparent_recalc,
2345};
2346
2347static struct clk wdt2_fck = {
2348 .name = "wdt2_fck",
2349 .ops = &clkops_omap2_dflt_wait,
2350 .parent = &wkup_32k_fck,
2351 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
2352 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2353 .clkdm_name = "wkup_clkdm",
2354 .recalc = &followparent_recalc,
2355};
2356
2357static struct clk wkup_l4_ick = {
2358 .name = "wkup_l4_ick",
2359 .ops = &clkops_null,
2360 .parent = &sys_ck,
2361 .clkdm_name = "wkup_clkdm",
2362 .recalc = &followparent_recalc,
2363};
2364
2365/* 3430ES2 only */
2366/* Never specifically named in the TRM, so we have to infer a likely name */
2367static struct clk usim_ick = {
2368 .name = "usim_ick",
2369 .ops = &clkops_omap2_iclk_dflt_wait,
2370 .parent = &wkup_l4_ick,
2371 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2372 .enable_bit = OMAP3430ES2_EN_USIMOCP_SHIFT,
2373 .clkdm_name = "wkup_clkdm",
2374 .recalc = &followparent_recalc,
2375};
2376
2377static struct clk wdt2_ick = {
2378 .name = "wdt2_ick",
2379 .ops = &clkops_omap2_iclk_dflt_wait,
2380 .parent = &wkup_l4_ick,
2381 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2382 .enable_bit = OMAP3430_EN_WDT2_SHIFT,
2383 .clkdm_name = "wkup_clkdm",
2384 .recalc = &followparent_recalc,
2385};
2386
2387static struct clk wdt1_ick = {
2388 .name = "wdt1_ick",
2389 .ops = &clkops_omap2_iclk_dflt_wait,
2390 .parent = &wkup_l4_ick,
2391 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2392 .enable_bit = OMAP3430_EN_WDT1_SHIFT,
2393 .clkdm_name = "wkup_clkdm",
2394 .recalc = &followparent_recalc,
2395};
2396
2397static struct clk gpio1_ick = {
2398 .name = "gpio1_ick",
2399 .ops = &clkops_omap2_iclk_dflt_wait,
2400 .parent = &wkup_l4_ick,
2401 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2402 .enable_bit = OMAP3430_EN_GPIO1_SHIFT,
2403 .clkdm_name = "wkup_clkdm",
2404 .recalc = &followparent_recalc,
2405};
2406
2407static struct clk omap_32ksync_ick = {
2408 .name = "omap_32ksync_ick",
2409 .ops = &clkops_omap2_iclk_dflt_wait,
2410 .parent = &wkup_l4_ick,
2411 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2412 .enable_bit = OMAP3430_EN_32KSYNC_SHIFT,
2413 .clkdm_name = "wkup_clkdm",
2414 .recalc = &followparent_recalc,
2415};
2416
2417/* XXX This clock no longer exists in 3430 TRM rev F */
2418static struct clk gpt12_ick = {
2419 .name = "gpt12_ick",
2420 .ops = &clkops_omap2_iclk_dflt_wait,
2421 .parent = &wkup_l4_ick,
2422 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2423 .enable_bit = OMAP3430_EN_GPT12_SHIFT,
2424 .clkdm_name = "wkup_clkdm",
2425 .recalc = &followparent_recalc,
2426};
2427
2428static struct clk gpt1_ick = {
2429 .name = "gpt1_ick",
2430 .ops = &clkops_omap2_iclk_dflt_wait,
2431 .parent = &wkup_l4_ick,
2432 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_ICLKEN),
2433 .enable_bit = OMAP3430_EN_GPT1_SHIFT,
2434 .clkdm_name = "wkup_clkdm",
2435 .recalc = &followparent_recalc,
2436};
2437
2438
2439
2440/* PER clock domain */
2441
2442static struct clk per_96m_fck = {
2443 .name = "per_96m_fck",
2444 .ops = &clkops_null,
2445 .parent = &omap_96m_alwon_fck,
2446 .clkdm_name = "per_clkdm",
2447 .recalc = &followparent_recalc,
2448};
2449
2450static struct clk per_48m_fck = {
2451 .name = "per_48m_fck",
2452 .ops = &clkops_null,
2453 .parent = &omap_48m_fck,
2454 .clkdm_name = "per_clkdm",
2455 .recalc = &followparent_recalc,
2456};
2457
2458static struct clk uart3_fck = {
2459 .name = "uart3_fck",
2460 .ops = &clkops_omap2_dflt_wait,
2461 .parent = &per_48m_fck,
2462 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2463 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2464 .clkdm_name = "per_clkdm",
2465 .recalc = &followparent_recalc,
2466};
2467
2468static struct clk uart4_fck = {
2469 .name = "uart4_fck",
2470 .ops = &clkops_omap2_dflt_wait,
2471 .parent = &per_48m_fck,
2472 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2473 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2474 .clkdm_name = "per_clkdm",
2475 .recalc = &followparent_recalc,
2476};
2477
2478static struct clk uart4_fck_am35xx = {
2479 .name = "uart4_fck",
2480 .ops = &clkops_omap2_dflt_wait,
2481 .parent = &core_48m_fck,
2482 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_FCLKEN1),
2483 .enable_bit = AM35XX_EN_UART4_SHIFT,
2484 .clkdm_name = "core_l4_clkdm",
2485 .recalc = &followparent_recalc,
2486};
2487
2488static struct clk gpt2_fck = {
2489 .name = "gpt2_fck",
2490 .ops = &clkops_omap2_dflt_wait,
2491 .init = &omap2_init_clksel_parent,
2492 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2493 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2494 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2495 .clksel_mask = OMAP3430_CLKSEL_GPT2_MASK,
2496 .clksel = omap343x_gpt_clksel,
2497 .clkdm_name = "per_clkdm",
2498 .recalc = &omap2_clksel_recalc,
2499};
2500
2501static struct clk gpt3_fck = {
2502 .name = "gpt3_fck",
2503 .ops = &clkops_omap2_dflt_wait,
2504 .init = &omap2_init_clksel_parent,
2505 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2506 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2507 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2508 .clksel_mask = OMAP3430_CLKSEL_GPT3_MASK,
2509 .clksel = omap343x_gpt_clksel,
2510 .clkdm_name = "per_clkdm",
2511 .recalc = &omap2_clksel_recalc,
2512};
2513
2514static struct clk gpt4_fck = {
2515 .name = "gpt4_fck",
2516 .ops = &clkops_omap2_dflt_wait,
2517 .init = &omap2_init_clksel_parent,
2518 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2519 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2520 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2521 .clksel_mask = OMAP3430_CLKSEL_GPT4_MASK,
2522 .clksel = omap343x_gpt_clksel,
2523 .clkdm_name = "per_clkdm",
2524 .recalc = &omap2_clksel_recalc,
2525};
2526
2527static struct clk gpt5_fck = {
2528 .name = "gpt5_fck",
2529 .ops = &clkops_omap2_dflt_wait,
2530 .init = &omap2_init_clksel_parent,
2531 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2532 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2533 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2534 .clksel_mask = OMAP3430_CLKSEL_GPT5_MASK,
2535 .clksel = omap343x_gpt_clksel,
2536 .clkdm_name = "per_clkdm",
2537 .recalc = &omap2_clksel_recalc,
2538};
2539
2540static struct clk gpt6_fck = {
2541 .name = "gpt6_fck",
2542 .ops = &clkops_omap2_dflt_wait,
2543 .init = &omap2_init_clksel_parent,
2544 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2545 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2546 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2547 .clksel_mask = OMAP3430_CLKSEL_GPT6_MASK,
2548 .clksel = omap343x_gpt_clksel,
2549 .clkdm_name = "per_clkdm",
2550 .recalc = &omap2_clksel_recalc,
2551};
2552
2553static struct clk gpt7_fck = {
2554 .name = "gpt7_fck",
2555 .ops = &clkops_omap2_dflt_wait,
2556 .init = &omap2_init_clksel_parent,
2557 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2558 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2559 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2560 .clksel_mask = OMAP3430_CLKSEL_GPT7_MASK,
2561 .clksel = omap343x_gpt_clksel,
2562 .clkdm_name = "per_clkdm",
2563 .recalc = &omap2_clksel_recalc,
2564};
2565
2566static struct clk gpt8_fck = {
2567 .name = "gpt8_fck",
2568 .ops = &clkops_omap2_dflt_wait,
2569 .init = &omap2_init_clksel_parent,
2570 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2571 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2572 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2573 .clksel_mask = OMAP3430_CLKSEL_GPT8_MASK,
2574 .clksel = omap343x_gpt_clksel,
2575 .clkdm_name = "per_clkdm",
2576 .recalc = &omap2_clksel_recalc,
2577};
2578
2579static struct clk gpt9_fck = {
2580 .name = "gpt9_fck",
2581 .ops = &clkops_omap2_dflt_wait,
2582 .init = &omap2_init_clksel_parent,
2583 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2584 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2585 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_CLKSEL),
2586 .clksel_mask = OMAP3430_CLKSEL_GPT9_MASK,
2587 .clksel = omap343x_gpt_clksel,
2588 .clkdm_name = "per_clkdm",
2589 .recalc = &omap2_clksel_recalc,
2590};
2591
2592static struct clk per_32k_alwon_fck = {
2593 .name = "per_32k_alwon_fck",
2594 .ops = &clkops_null,
2595 .parent = &omap_32k_fck,
2596 .clkdm_name = "per_clkdm",
2597 .recalc = &followparent_recalc,
2598};
2599
2600static struct clk gpio6_dbck = {
2601 .name = "gpio6_dbck",
2602 .ops = &clkops_omap2_dflt,
2603 .parent = &per_32k_alwon_fck,
2604 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2605 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2606 .clkdm_name = "per_clkdm",
2607 .recalc = &followparent_recalc,
2608};
2609
2610static struct clk gpio5_dbck = {
2611 .name = "gpio5_dbck",
2612 .ops = &clkops_omap2_dflt,
2613 .parent = &per_32k_alwon_fck,
2614 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2615 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2616 .clkdm_name = "per_clkdm",
2617 .recalc = &followparent_recalc,
2618};
2619
2620static struct clk gpio4_dbck = {
2621 .name = "gpio4_dbck",
2622 .ops = &clkops_omap2_dflt,
2623 .parent = &per_32k_alwon_fck,
2624 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2625 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2626 .clkdm_name = "per_clkdm",
2627 .recalc = &followparent_recalc,
2628};
2629
2630static struct clk gpio3_dbck = {
2631 .name = "gpio3_dbck",
2632 .ops = &clkops_omap2_dflt,
2633 .parent = &per_32k_alwon_fck,
2634 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2635 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2636 .clkdm_name = "per_clkdm",
2637 .recalc = &followparent_recalc,
2638};
2639
2640static struct clk gpio2_dbck = {
2641 .name = "gpio2_dbck",
2642 .ops = &clkops_omap2_dflt,
2643 .parent = &per_32k_alwon_fck,
2644 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2645 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2646 .clkdm_name = "per_clkdm",
2647 .recalc = &followparent_recalc,
2648};
2649
2650static struct clk wdt3_fck = {
2651 .name = "wdt3_fck",
2652 .ops = &clkops_omap2_dflt_wait,
2653 .parent = &per_32k_alwon_fck,
2654 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2655 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2656 .clkdm_name = "per_clkdm",
2657 .recalc = &followparent_recalc,
2658};
2659
2660static struct clk per_l4_ick = {
2661 .name = "per_l4_ick",
2662 .ops = &clkops_null,
2663 .parent = &l4_ick,
2664 .clkdm_name = "per_clkdm",
2665 .recalc = &followparent_recalc,
2666};
2667
2668static struct clk gpio6_ick = {
2669 .name = "gpio6_ick",
2670 .ops = &clkops_omap2_iclk_dflt_wait,
2671 .parent = &per_l4_ick,
2672 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2673 .enable_bit = OMAP3430_EN_GPIO6_SHIFT,
2674 .clkdm_name = "per_clkdm",
2675 .recalc = &followparent_recalc,
2676};
2677
2678static struct clk gpio5_ick = {
2679 .name = "gpio5_ick",
2680 .ops = &clkops_omap2_iclk_dflt_wait,
2681 .parent = &per_l4_ick,
2682 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2683 .enable_bit = OMAP3430_EN_GPIO5_SHIFT,
2684 .clkdm_name = "per_clkdm",
2685 .recalc = &followparent_recalc,
2686};
2687
2688static struct clk gpio4_ick = {
2689 .name = "gpio4_ick",
2690 .ops = &clkops_omap2_iclk_dflt_wait,
2691 .parent = &per_l4_ick,
2692 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2693 .enable_bit = OMAP3430_EN_GPIO4_SHIFT,
2694 .clkdm_name = "per_clkdm",
2695 .recalc = &followparent_recalc,
2696};
2697
2698static struct clk gpio3_ick = {
2699 .name = "gpio3_ick",
2700 .ops = &clkops_omap2_iclk_dflt_wait,
2701 .parent = &per_l4_ick,
2702 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2703 .enable_bit = OMAP3430_EN_GPIO3_SHIFT,
2704 .clkdm_name = "per_clkdm",
2705 .recalc = &followparent_recalc,
2706};
2707
2708static struct clk gpio2_ick = {
2709 .name = "gpio2_ick",
2710 .ops = &clkops_omap2_iclk_dflt_wait,
2711 .parent = &per_l4_ick,
2712 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2713 .enable_bit = OMAP3430_EN_GPIO2_SHIFT,
2714 .clkdm_name = "per_clkdm",
2715 .recalc = &followparent_recalc,
2716};
2717
2718static struct clk wdt3_ick = {
2719 .name = "wdt3_ick",
2720 .ops = &clkops_omap2_iclk_dflt_wait,
2721 .parent = &per_l4_ick,
2722 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2723 .enable_bit = OMAP3430_EN_WDT3_SHIFT,
2724 .clkdm_name = "per_clkdm",
2725 .recalc = &followparent_recalc,
2726};
2727
2728static struct clk uart3_ick = {
2729 .name = "uart3_ick",
2730 .ops = &clkops_omap2_iclk_dflt_wait,
2731 .parent = &per_l4_ick,
2732 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2733 .enable_bit = OMAP3430_EN_UART3_SHIFT,
2734 .clkdm_name = "per_clkdm",
2735 .recalc = &followparent_recalc,
2736};
2737
2738static struct clk uart4_ick = {
2739 .name = "uart4_ick",
2740 .ops = &clkops_omap2_iclk_dflt_wait,
2741 .parent = &per_l4_ick,
2742 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2743 .enable_bit = OMAP3630_EN_UART4_SHIFT,
2744 .clkdm_name = "per_clkdm",
2745 .recalc = &followparent_recalc,
2746};
2747
2748static struct clk gpt9_ick = {
2749 .name = "gpt9_ick",
2750 .ops = &clkops_omap2_iclk_dflt_wait,
2751 .parent = &per_l4_ick,
2752 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2753 .enable_bit = OMAP3430_EN_GPT9_SHIFT,
2754 .clkdm_name = "per_clkdm",
2755 .recalc = &followparent_recalc,
2756};
2757
2758static struct clk gpt8_ick = {
2759 .name = "gpt8_ick",
2760 .ops = &clkops_omap2_iclk_dflt_wait,
2761 .parent = &per_l4_ick,
2762 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2763 .enable_bit = OMAP3430_EN_GPT8_SHIFT,
2764 .clkdm_name = "per_clkdm",
2765 .recalc = &followparent_recalc,
2766};
2767
2768static struct clk gpt7_ick = {
2769 .name = "gpt7_ick",
2770 .ops = &clkops_omap2_iclk_dflt_wait,
2771 .parent = &per_l4_ick,
2772 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2773 .enable_bit = OMAP3430_EN_GPT7_SHIFT,
2774 .clkdm_name = "per_clkdm",
2775 .recalc = &followparent_recalc,
2776};
2777
2778static struct clk gpt6_ick = {
2779 .name = "gpt6_ick",
2780 .ops = &clkops_omap2_iclk_dflt_wait,
2781 .parent = &per_l4_ick,
2782 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2783 .enable_bit = OMAP3430_EN_GPT6_SHIFT,
2784 .clkdm_name = "per_clkdm",
2785 .recalc = &followparent_recalc,
2786};
2787
2788static struct clk gpt5_ick = {
2789 .name = "gpt5_ick",
2790 .ops = &clkops_omap2_iclk_dflt_wait,
2791 .parent = &per_l4_ick,
2792 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2793 .enable_bit = OMAP3430_EN_GPT5_SHIFT,
2794 .clkdm_name = "per_clkdm",
2795 .recalc = &followparent_recalc,
2796};
2797
2798static struct clk gpt4_ick = {
2799 .name = "gpt4_ick",
2800 .ops = &clkops_omap2_iclk_dflt_wait,
2801 .parent = &per_l4_ick,
2802 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2803 .enable_bit = OMAP3430_EN_GPT4_SHIFT,
2804 .clkdm_name = "per_clkdm",
2805 .recalc = &followparent_recalc,
2806};
2807
2808static struct clk gpt3_ick = {
2809 .name = "gpt3_ick",
2810 .ops = &clkops_omap2_iclk_dflt_wait,
2811 .parent = &per_l4_ick,
2812 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2813 .enable_bit = OMAP3430_EN_GPT3_SHIFT,
2814 .clkdm_name = "per_clkdm",
2815 .recalc = &followparent_recalc,
2816};
2817
2818static struct clk gpt2_ick = {
2819 .name = "gpt2_ick",
2820 .ops = &clkops_omap2_iclk_dflt_wait,
2821 .parent = &per_l4_ick,
2822 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2823 .enable_bit = OMAP3430_EN_GPT2_SHIFT,
2824 .clkdm_name = "per_clkdm",
2825 .recalc = &followparent_recalc,
2826};
2827
2828static struct clk mcbsp2_ick = {
2829 .name = "mcbsp2_ick",
2830 .ops = &clkops_omap2_iclk_dflt_wait,
2831 .parent = &per_l4_ick,
2832 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2833 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2834 .clkdm_name = "per_clkdm",
2835 .recalc = &followparent_recalc,
2836};
2837
2838static struct clk mcbsp3_ick = {
2839 .name = "mcbsp3_ick",
2840 .ops = &clkops_omap2_iclk_dflt_wait,
2841 .parent = &per_l4_ick,
2842 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2843 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2844 .clkdm_name = "per_clkdm",
2845 .recalc = &followparent_recalc,
2846};
2847
2848static struct clk mcbsp4_ick = {
2849 .name = "mcbsp4_ick",
2850 .ops = &clkops_omap2_iclk_dflt_wait,
2851 .parent = &per_l4_ick,
2852 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_ICLKEN),
2853 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2854 .clkdm_name = "per_clkdm",
2855 .recalc = &followparent_recalc,
2856};
2857
2858static const struct clksel mcbsp_234_clksel[] = {
2859 { .parent = &per_96m_fck, .rates = common_mcbsp_96m_rates },
2860 { .parent = &mcbsp_clks, .rates = common_mcbsp_mcbsp_rates },
2861 { .parent = NULL }
2862};
2863
2864static struct clk mcbsp2_fck = {
2865 .name = "mcbsp2_fck",
2866 .ops = &clkops_omap2_dflt_wait,
2867 .init = &omap2_init_clksel_parent,
2868 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2869 .enable_bit = OMAP3430_EN_MCBSP2_SHIFT,
2870 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP2_CONTROL_DEVCONF0),
2871 .clksel_mask = OMAP2_MCBSP2_CLKS_MASK,
2872 .clksel = mcbsp_234_clksel,
2873 .clkdm_name = "per_clkdm",
2874 .recalc = &omap2_clksel_recalc,
2875};
2876
2877static struct clk mcbsp3_fck = {
2878 .name = "mcbsp3_fck",
2879 .ops = &clkops_omap2_dflt_wait,
2880 .init = &omap2_init_clksel_parent,
2881 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2882 .enable_bit = OMAP3430_EN_MCBSP3_SHIFT,
2883 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2884 .clksel_mask = OMAP2_MCBSP3_CLKS_MASK,
2885 .clksel = mcbsp_234_clksel,
2886 .clkdm_name = "per_clkdm",
2887 .recalc = &omap2_clksel_recalc,
2888};
2889
2890static struct clk mcbsp4_fck = {
2891 .name = "mcbsp4_fck",
2892 .ops = &clkops_omap2_dflt_wait,
2893 .init = &omap2_init_clksel_parent,
2894 .enable_reg = OMAP_CM_REGADDR(OMAP3430_PER_MOD, CM_FCLKEN),
2895 .enable_bit = OMAP3430_EN_MCBSP4_SHIFT,
2896 .clksel_reg = OMAP343X_CTRL_REGADDR(OMAP343X_CONTROL_DEVCONF1),
2897 .clksel_mask = OMAP2_MCBSP4_CLKS_MASK,
2898 .clksel = mcbsp_234_clksel,
2899 .clkdm_name = "per_clkdm",
2900 .recalc = &omap2_clksel_recalc,
2901};
2902
2903/* EMU clocks */
2904
2905/* More information: ARM Cortex-A8 Technical Reference Manual, sect 10.1 */
2906
2907static const struct clksel_rate emu_src_sys_rates[] = {
2908 { .div = 1, .val = 0, .flags = RATE_IN_3XXX },
2909 { .div = 0 },
2910};
2911
2912static const struct clksel_rate emu_src_core_rates[] = {
2913 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2914 { .div = 0 },
2915};
2916
2917static const struct clksel_rate emu_src_per_rates[] = {
2918 { .div = 1, .val = 2, .flags = RATE_IN_3XXX },
2919 { .div = 0 },
2920};
2921
2922static const struct clksel_rate emu_src_mpu_rates[] = {
2923 { .div = 1, .val = 3, .flags = RATE_IN_3XXX },
2924 { .div = 0 },
2925};
2926
2927static const struct clksel emu_src_clksel[] = {
2928 { .parent = &sys_ck, .rates = emu_src_sys_rates },
2929 { .parent = &emu_core_alwon_ck, .rates = emu_src_core_rates },
2930 { .parent = &emu_per_alwon_ck, .rates = emu_src_per_rates },
2931 { .parent = &emu_mpu_alwon_ck, .rates = emu_src_mpu_rates },
2932 { .parent = NULL },
2933};
2934
2935/*
2936 * Like the clkout_src clocks, emu_src_clk is a virtual clock, existing only
2937 * to switch the source of some of the EMU clocks.
2938 * XXX Are there CLKEN bits for these EMU clks?
2939 */
2940static struct clk emu_src_ck = {
2941 .name = "emu_src_ck",
2942 .ops = &clkops_null,
2943 .init = &omap2_init_clksel_parent,
2944 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2945 .clksel_mask = OMAP3430_MUX_CTRL_MASK,
2946 .clksel = emu_src_clksel,
2947 .clkdm_name = "emu_clkdm",
2948 .recalc = &omap2_clksel_recalc,
2949};
2950
2951static const struct clksel_rate pclk_emu_rates[] = {
2952 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2953 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2954 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
2955 { .div = 6, .val = 6, .flags = RATE_IN_3XXX },
2956 { .div = 0 },
2957};
2958
2959static const struct clksel pclk_emu_clksel[] = {
2960 { .parent = &emu_src_ck, .rates = pclk_emu_rates },
2961 { .parent = NULL },
2962};
2963
2964static struct clk pclk_fck = {
2965 .name = "pclk_fck",
2966 .ops = &clkops_null,
2967 .init = &omap2_init_clksel_parent,
2968 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2969 .clksel_mask = OMAP3430_CLKSEL_PCLK_MASK,
2970 .clksel = pclk_emu_clksel,
2971 .clkdm_name = "emu_clkdm",
2972 .recalc = &omap2_clksel_recalc,
2973};
2974
2975static const struct clksel_rate pclkx2_emu_rates[] = {
2976 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
2977 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
2978 { .div = 3, .val = 3, .flags = RATE_IN_3XXX },
2979 { .div = 0 },
2980};
2981
2982static const struct clksel pclkx2_emu_clksel[] = {
2983 { .parent = &emu_src_ck, .rates = pclkx2_emu_rates },
2984 { .parent = NULL },
2985};
2986
2987static struct clk pclkx2_fck = {
2988 .name = "pclkx2_fck",
2989 .ops = &clkops_null,
2990 .init = &omap2_init_clksel_parent,
2991 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
2992 .clksel_mask = OMAP3430_CLKSEL_PCLKX2_MASK,
2993 .clksel = pclkx2_emu_clksel,
2994 .clkdm_name = "emu_clkdm",
2995 .recalc = &omap2_clksel_recalc,
2996};
2997
2998static const struct clksel atclk_emu_clksel[] = {
2999 { .parent = &emu_src_ck, .rates = div2_rates },
3000 { .parent = NULL },
3001};
3002
3003static struct clk atclk_fck = {
3004 .name = "atclk_fck",
3005 .ops = &clkops_null,
3006 .init = &omap2_init_clksel_parent,
3007 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3008 .clksel_mask = OMAP3430_CLKSEL_ATCLK_MASK,
3009 .clksel = atclk_emu_clksel,
3010 .clkdm_name = "emu_clkdm",
3011 .recalc = &omap2_clksel_recalc,
3012};
3013
3014static struct clk traceclk_src_fck = {
3015 .name = "traceclk_src_fck",
3016 .ops = &clkops_null,
3017 .init = &omap2_init_clksel_parent,
3018 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3019 .clksel_mask = OMAP3430_TRACE_MUX_CTRL_MASK,
3020 .clksel = emu_src_clksel,
3021 .clkdm_name = "emu_clkdm",
3022 .recalc = &omap2_clksel_recalc,
3023};
3024
3025static const struct clksel_rate traceclk_rates[] = {
3026 { .div = 1, .val = 1, .flags = RATE_IN_3XXX },
3027 { .div = 2, .val = 2, .flags = RATE_IN_3XXX },
3028 { .div = 4, .val = 4, .flags = RATE_IN_3XXX },
3029 { .div = 0 },
3030};
3031
3032static const struct clksel traceclk_clksel[] = {
3033 { .parent = &traceclk_src_fck, .rates = traceclk_rates },
3034 { .parent = NULL },
3035};
3036
3037static struct clk traceclk_fck = {
3038 .name = "traceclk_fck",
3039 .ops = &clkops_null,
3040 .init = &omap2_init_clksel_parent,
3041 .clksel_reg = OMAP_CM_REGADDR(OMAP3430_EMU_MOD, CM_CLKSEL1),
3042 .clksel_mask = OMAP3430_CLKSEL_TRACECLK_MASK,
3043 .clksel = traceclk_clksel,
3044 .clkdm_name = "emu_clkdm",
3045 .recalc = &omap2_clksel_recalc,
3046};
3047
3048/* SR clocks */
3049
3050/* SmartReflex fclk (VDD1) */
3051static struct clk sr1_fck = {
3052 .name = "sr1_fck",
3053 .ops = &clkops_omap2_dflt_wait,
3054 .parent = &sys_ck,
3055 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3056 .enable_bit = OMAP3430_EN_SR1_SHIFT,
3057 .clkdm_name = "wkup_clkdm",
3058 .recalc = &followparent_recalc,
3059};
3060
3061/* SmartReflex fclk (VDD2) */
3062static struct clk sr2_fck = {
3063 .name = "sr2_fck",
3064 .ops = &clkops_omap2_dflt_wait,
3065 .parent = &sys_ck,
3066 .enable_reg = OMAP_CM_REGADDR(WKUP_MOD, CM_FCLKEN),
3067 .enable_bit = OMAP3430_EN_SR2_SHIFT,
3068 .clkdm_name = "wkup_clkdm",
3069 .recalc = &followparent_recalc,
3070};
3071
3072static struct clk sr_l4_ick = {
3073 .name = "sr_l4_ick",
3074 .ops = &clkops_null, /* RMK: missing? */
3075 .parent = &l4_ick,
3076 .clkdm_name = "core_l4_clkdm",
3077 .recalc = &followparent_recalc,
3078};
3079
3080/* SECURE_32K_FCK clocks */
3081
3082static struct clk gpt12_fck = {
3083 .name = "gpt12_fck",
3084 .ops = &clkops_null,
3085 .parent = &secure_32k_fck,
3086 .clkdm_name = "wkup_clkdm",
3087 .recalc = &followparent_recalc,
3088};
3089
3090static struct clk wdt1_fck = {
3091 .name = "wdt1_fck",
3092 .ops = &clkops_null,
3093 .parent = &secure_32k_fck,
3094 .clkdm_name = "wkup_clkdm",
3095 .recalc = &followparent_recalc,
3096};
3097
3098/* Clocks for AM35XX */
3099static struct clk ipss_ick = {
3100 .name = "ipss_ick",
3101 .ops = &clkops_am35xx_ipss_wait,
3102 .parent = &core_l3_ick,
3103 .clkdm_name = "core_l3_clkdm",
3104 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
3105 .enable_bit = AM35XX_EN_IPSS_SHIFT,
3106 .recalc = &followparent_recalc,
3107};
3108
3109static struct clk emac_ick = {
3110 .name = "emac_ick",
3111 .ops = &clkops_am35xx_ipss_module_wait,
3112 .parent = &ipss_ick,
3113 .clkdm_name = "core_l3_clkdm",
3114 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3115 .enable_bit = AM35XX_CPGMAC_VBUSP_CLK_SHIFT,
3116 .recalc = &followparent_recalc,
3117};
3118
3119static struct clk rmii_ck = {
3120 .name = "rmii_ck",
3121 .ops = &clkops_null,
3122 .rate = 50000000,
3123};
3124
3125static struct clk emac_fck = {
3126 .name = "emac_fck",
3127 .ops = &clkops_omap2_dflt,
3128 .parent = &rmii_ck,
3129 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3130 .enable_bit = AM35XX_CPGMAC_FCLK_SHIFT,
3131 .recalc = &followparent_recalc,
3132};
3133
3134static struct clk hsotgusb_ick_am35xx = {
3135 .name = "hsotgusb_ick",
3136 .ops = &clkops_am35xx_ipss_module_wait,
3137 .parent = &ipss_ick,
3138 .clkdm_name = "core_l3_clkdm",
3139 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3140 .enable_bit = AM35XX_USBOTG_VBUSP_CLK_SHIFT,
3141 .recalc = &followparent_recalc,
3142};
3143
3144static struct clk hsotgusb_fck_am35xx = {
3145 .name = "hsotgusb_fck",
3146 .ops = &clkops_omap2_dflt,
3147 .parent = &sys_ck,
3148 .clkdm_name = "core_l3_clkdm",
3149 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3150 .enable_bit = AM35XX_USBOTG_FCLK_SHIFT,
3151 .recalc = &followparent_recalc,
3152};
3153
3154static struct clk hecc_ck = {
3155 .name = "hecc_ck",
3156 .ops = &clkops_am35xx_ipss_module_wait,
3157 .parent = &sys_ck,
3158 .clkdm_name = "core_l3_clkdm",
3159 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3160 .enable_bit = AM35XX_HECC_VBUSP_CLK_SHIFT,
3161 .recalc = &followparent_recalc,
3162};
3163
3164static struct clk vpfe_ick = {
3165 .name = "vpfe_ick",
3166 .ops = &clkops_am35xx_ipss_module_wait,
3167 .parent = &ipss_ick,
3168 .clkdm_name = "core_l3_clkdm",
3169 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3170 .enable_bit = AM35XX_VPFE_VBUSP_CLK_SHIFT,
3171 .recalc = &followparent_recalc,
3172};
3173
3174static struct clk pclk_ck = {
3175 .name = "pclk_ck",
3176 .ops = &clkops_null,
3177 .rate = 27000000,
3178};
3179
3180static struct clk vpfe_fck = {
3181 .name = "vpfe_fck",
3182 .ops = &clkops_omap2_dflt,
3183 .parent = &pclk_ck,
3184 .enable_reg = OMAP343X_CTRL_REGADDR(AM35XX_CONTROL_IPSS_CLK_CTRL),
3185 .enable_bit = AM35XX_VPFE_FCLK_SHIFT,
3186 .recalc = &followparent_recalc,
3187};
3188
3189/*
3190 * The UART1/2 functional clock acts as the functional clock for
3191 * UART4. No separate fclk control available. XXX Well now we have a
3192 * uart4_fck that is apparently used as the UART4 functional clock,
3193 * but it also seems that uart1_fck or uart2_fck are still needed, at
3194 * least for UART4 softresets to complete. This really needs
3195 * clarification.
3196 */
3197static struct clk uart4_ick_am35xx = {
3198 .name = "uart4_ick",
3199 .ops = &clkops_omap2_iclk_dflt_wait,
3200 .parent = &core_l4_ick,
3201 .enable_reg = OMAP_CM_REGADDR(CORE_MOD, CM_ICLKEN1),
3202 .enable_bit = AM35XX_EN_UART4_SHIFT,
3203 .clkdm_name = "core_l4_clkdm",
3204 .recalc = &followparent_recalc,
3205};
3206
3207static struct clk dummy_apb_pclk = {
3208 .name = "apb_pclk",
3209 .ops = &clkops_null,
3210};
3211
3212/*
3213 * clkdev
3214 */
3215
3216static struct omap_clk omap3xxx_clks[] = {
3217 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3218 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
3219 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3220 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
3221 CLK(NULL, "virt_16_8m_ck", &virt_16_8m_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3222 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_3XXX),
3223 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_3XXX),
3224 CLK(NULL, "virt_38_4m_ck", &virt_38_4m_ck, CK_3XXX),
3225 CLK(NULL, "osc_sys_ck", &osc_sys_ck, CK_3XXX),
3226 CLK("twl", "fck", &osc_sys_ck, CK_3XXX),
3227 CLK(NULL, "sys_ck", &sys_ck, CK_3XXX),
3228 CLK(NULL, "sys_altclk", &sys_altclk, CK_3XXX),
3229 CLK(NULL, "mcbsp_clks", &mcbsp_clks, CK_3XXX),
3230 CLK(NULL, "sys_clkout1", &sys_clkout1, CK_3XXX),
3231 CLK(NULL, "dpll1_ck", &dpll1_ck, CK_3XXX),
3232 CLK(NULL, "dpll1_x2_ck", &dpll1_x2_ck, CK_3XXX),
3233 CLK(NULL, "dpll1_x2m2_ck", &dpll1_x2m2_ck, CK_3XXX),
3234 CLK(NULL, "dpll2_ck", &dpll2_ck, CK_34XX | CK_36XX),
3235 CLK(NULL, "dpll2_m2_ck", &dpll2_m2_ck, CK_34XX | CK_36XX),
3236 CLK(NULL, "dpll3_ck", &dpll3_ck, CK_3XXX),
3237 CLK(NULL, "core_ck", &core_ck, CK_3XXX),
3238 CLK(NULL, "dpll3_x2_ck", &dpll3_x2_ck, CK_3XXX),
3239 CLK(NULL, "dpll3_m2_ck", &dpll3_m2_ck, CK_3XXX),
3240 CLK(NULL, "dpll3_m2x2_ck", &dpll3_m2x2_ck, CK_3XXX),
3241 CLK(NULL, "dpll3_m3_ck", &dpll3_m3_ck, CK_3XXX),
3242 CLK(NULL, "dpll3_m3x2_ck", &dpll3_m3x2_ck, CK_3XXX),
3243 CLK(NULL, "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3244 CLK("etb", "emu_core_alwon_ck", &emu_core_alwon_ck, CK_3XXX),
3245 CLK(NULL, "dpll4_ck", &dpll4_ck, CK_3XXX),
3246 CLK(NULL, "dpll4_x2_ck", &dpll4_x2_ck, CK_3XXX),
3247 CLK(NULL, "omap_192m_alwon_fck", &omap_192m_alwon_fck, CK_36XX),
3248 CLK(NULL, "omap_96m_alwon_fck", &omap_96m_alwon_fck, CK_3XXX),
3249 CLK(NULL, "omap_96m_alwon_fck_3630", &omap_96m_alwon_fck_3630, CK_36XX),
3250 CLK(NULL, "omap_96m_fck", &omap_96m_fck, CK_3XXX),
3251 CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX),
3252 CLK(NULL, "omap_54m_fck", &omap_54m_fck, CK_3XXX),
3253 CLK(NULL, "omap_48m_fck", &omap_48m_fck, CK_3XXX),
3254 CLK(NULL, "omap_12m_fck", &omap_12m_fck, CK_3XXX),
3255 CLK(NULL, "dpll4_m2_ck", &dpll4_m2_ck, CK_3XXX),
3256 CLK(NULL, "dpll4_m2x2_ck", &dpll4_m2x2_ck, CK_3XXX),
3257 CLK(NULL, "dpll4_m3_ck", &dpll4_m3_ck, CK_3XXX),
3258 CLK(NULL, "dpll4_m3x2_ck", &dpll4_m3x2_ck, CK_3XXX),
3259 CLK(NULL, "dpll4_m4_ck", &dpll4_m4_ck, CK_3XXX),
3260 CLK(NULL, "dpll4_m4x2_ck", &dpll4_m4x2_ck, CK_3XXX),
3261 CLK(NULL, "dpll4_m5_ck", &dpll4_m5_ck, CK_3XXX),
3262 CLK(NULL, "dpll4_m5x2_ck", &dpll4_m5x2_ck, CK_3XXX),
3263 CLK(NULL, "dpll4_m6_ck", &dpll4_m6_ck, CK_3XXX),
3264 CLK(NULL, "dpll4_m6x2_ck", &dpll4_m6x2_ck, CK_3XXX),
3265 CLK(NULL, "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3266 CLK("etb", "emu_per_alwon_ck", &emu_per_alwon_ck, CK_3XXX),
3267 CLK(NULL, "dpll5_ck", &dpll5_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3268 CLK(NULL, "dpll5_m2_ck", &dpll5_m2_ck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3269 CLK(NULL, "clkout2_src_ck", &clkout2_src_ck, CK_3XXX),
3270 CLK(NULL, "sys_clkout2", &sys_clkout2, CK_3XXX),
3271 CLK(NULL, "corex2_fck", &corex2_fck, CK_3XXX),
3272 CLK(NULL, "dpll1_fck", &dpll1_fck, CK_3XXX),
3273 CLK(NULL, "mpu_ck", &mpu_ck, CK_3XXX),
3274 CLK(NULL, "arm_fck", &arm_fck, CK_3XXX),
3275 CLK(NULL, "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3276 CLK("etb", "emu_mpu_alwon_ck", &emu_mpu_alwon_ck, CK_3XXX),
3277 CLK(NULL, "dpll2_fck", &dpll2_fck, CK_34XX | CK_36XX),
3278 CLK(NULL, "iva2_ck", &iva2_ck, CK_34XX | CK_36XX),
3279 CLK(NULL, "l3_ick", &l3_ick, CK_3XXX),
3280 CLK(NULL, "l4_ick", &l4_ick, CK_3XXX),
3281 CLK(NULL, "rm_ick", &rm_ick, CK_3XXX),
3282 CLK(NULL, "gfx_l3_ck", &gfx_l3_ck, CK_3430ES1),
3283 CLK(NULL, "gfx_l3_fck", &gfx_l3_fck, CK_3430ES1),
3284 CLK(NULL, "gfx_l3_ick", &gfx_l3_ick, CK_3430ES1),
3285 CLK(NULL, "gfx_cg1_ck", &gfx_cg1_ck, CK_3430ES1),
3286 CLK(NULL, "gfx_cg2_ck", &gfx_cg2_ck, CK_3430ES1),
3287 CLK(NULL, "sgx_fck", &sgx_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3288 CLK(NULL, "sgx_ick", &sgx_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3289 CLK(NULL, "d2d_26m_fck", &d2d_26m_fck, CK_3430ES1),
3290 CLK(NULL, "modem_fck", &modem_fck, CK_34XX | CK_36XX),
3291 CLK(NULL, "sad2d_ick", &sad2d_ick, CK_34XX | CK_36XX),
3292 CLK(NULL, "mad2d_ick", &mad2d_ick, CK_34XX | CK_36XX),
3293 CLK(NULL, "gpt10_fck", &gpt10_fck, CK_3XXX),
3294 CLK(NULL, "gpt11_fck", &gpt11_fck, CK_3XXX),
3295 CLK(NULL, "cpefuse_fck", &cpefuse_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3296 CLK(NULL, "ts_fck", &ts_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3297 CLK(NULL, "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3298 CLK("usbhs_omap", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3299 CLK("usbhs_tll", "usbtll_fck", &usbtll_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3300 CLK(NULL, "core_96m_fck", &core_96m_fck, CK_3XXX),
3301 CLK(NULL, "mmchs3_fck", &mmchs3_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3302 CLK(NULL, "mmchs2_fck", &mmchs2_fck, CK_3XXX),
3303 CLK(NULL, "mspro_fck", &mspro_fck, CK_34XX | CK_36XX),
3304 CLK(NULL, "mmchs1_fck", &mmchs1_fck, CK_3XXX),
3305 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_3XXX),
3306 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_3XXX),
3307 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_3XXX),
3308 CLK(NULL, "mcbsp5_fck", &mcbsp5_fck, CK_3XXX),
3309 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_3XXX),
3310 CLK(NULL, "core_48m_fck", &core_48m_fck, CK_3XXX),
3311 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_3XXX),
3312 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_3XXX),
3313 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_3XXX),
3314 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_3XXX),
3315 CLK(NULL, "uart2_fck", &uart2_fck, CK_3XXX),
3316 CLK(NULL, "uart1_fck", &uart1_fck, CK_3XXX),
3317 CLK(NULL, "fshostusb_fck", &fshostusb_fck, CK_3430ES1),
3318 CLK(NULL, "core_12m_fck", &core_12m_fck, CK_3XXX),
3319 CLK("omap_hdq.0", "fck", &hdq_fck, CK_3XXX),
3320 CLK(NULL, "hdq_fck", &hdq_fck, CK_3XXX),
3321 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es1, CK_3430ES1),
3322 CLK(NULL, "ssi_ssr_fck", &ssi_ssr_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3323 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es1, CK_3430ES1),
3324 CLK(NULL, "ssi_sst_fck", &ssi_sst_fck_3430es2, CK_3430ES2PLUS | CK_36XX),
3325 CLK(NULL, "core_l3_ick", &core_l3_ick, CK_3XXX),
3326 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3327 CLK("musb-omap2430", "ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3328 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es1, CK_3430ES1),
3329 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3330 CLK(NULL, "sdrc_ick", &sdrc_ick, CK_3XXX),
3331 CLK(NULL, "gpmc_fck", &gpmc_fck, CK_3XXX),
3332 CLK(NULL, "security_l3_ick", &security_l3_ick, CK_34XX | CK_36XX),
3333 CLK(NULL, "pka_ick", &pka_ick, CK_34XX | CK_36XX),
3334 CLK(NULL, "core_l4_ick", &core_l4_ick, CK_3XXX),
3335 CLK(NULL, "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3336 CLK("usbhs_omap", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3337 CLK("usbhs_tll", "usbtll_ick", &usbtll_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3338 CLK("omap_hsmmc.2", "ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3339 CLK(NULL, "mmchs3_ick", &mmchs3_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3340 CLK(NULL, "icr_ick", &icr_ick, CK_34XX | CK_36XX),
3341 CLK("omap-aes", "ick", &aes2_ick, CK_34XX | CK_36XX),
3342 CLK("omap-sham", "ick", &sha12_ick, CK_34XX | CK_36XX),
3343 CLK(NULL, "des2_ick", &des2_ick, CK_34XX | CK_36XX),
3344 CLK("omap_hsmmc.1", "ick", &mmchs2_ick, CK_3XXX),
3345 CLK("omap_hsmmc.0", "ick", &mmchs1_ick, CK_3XXX),
3346 CLK(NULL, "mmchs2_ick", &mmchs2_ick, CK_3XXX),
3347 CLK(NULL, "mmchs1_ick", &mmchs1_ick, CK_3XXX),
3348 CLK(NULL, "mspro_ick", &mspro_ick, CK_34XX | CK_36XX),
3349 CLK("omap_hdq.0", "ick", &hdq_ick, CK_3XXX),
3350 CLK(NULL, "hdq_ick", &hdq_ick, CK_3XXX),
3351 CLK("omap2_mcspi.4", "ick", &mcspi4_ick, CK_3XXX),
3352 CLK("omap2_mcspi.3", "ick", &mcspi3_ick, CK_3XXX),
3353 CLK("omap2_mcspi.2", "ick", &mcspi2_ick, CK_3XXX),
3354 CLK("omap2_mcspi.1", "ick", &mcspi1_ick, CK_3XXX),
3355 CLK(NULL, "mcspi4_ick", &mcspi4_ick, CK_3XXX),
3356 CLK(NULL, "mcspi3_ick", &mcspi3_ick, CK_3XXX),
3357 CLK(NULL, "mcspi2_ick", &mcspi2_ick, CK_3XXX),
3358 CLK(NULL, "mcspi1_ick", &mcspi1_ick, CK_3XXX),
3359 CLK("omap_i2c.3", "ick", &i2c3_ick, CK_3XXX),
3360 CLK("omap_i2c.2", "ick", &i2c2_ick, CK_3XXX),
3361 CLK("omap_i2c.1", "ick", &i2c1_ick, CK_3XXX),
3362 CLK(NULL, "i2c3_ick", &i2c3_ick, CK_3XXX),
3363 CLK(NULL, "i2c2_ick", &i2c2_ick, CK_3XXX),
3364 CLK(NULL, "i2c1_ick", &i2c1_ick, CK_3XXX),
3365 CLK(NULL, "uart2_ick", &uart2_ick, CK_3XXX),
3366 CLK(NULL, "uart1_ick", &uart1_ick, CK_3XXX),
3367 CLK(NULL, "gpt11_ick", &gpt11_ick, CK_3XXX),
3368 CLK(NULL, "gpt10_ick", &gpt10_ick, CK_3XXX),
3369 CLK("omap-mcbsp.5", "ick", &mcbsp5_ick, CK_3XXX),
3370 CLK("omap-mcbsp.1", "ick", &mcbsp1_ick, CK_3XXX),
3371 CLK(NULL, "mcbsp5_ick", &mcbsp5_ick, CK_3XXX),
3372 CLK(NULL, "mcbsp1_ick", &mcbsp1_ick, CK_3XXX),
3373 CLK(NULL, "fac_ick", &fac_ick, CK_3430ES1),
3374 CLK(NULL, "mailboxes_ick", &mailboxes_ick, CK_34XX | CK_36XX),
3375 CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_3XXX),
3376 CLK(NULL, "ssi_l4_ick", &ssi_l4_ick, CK_34XX | CK_36XX),
3377 CLK(NULL, "ssi_ick", &ssi_ick_3430es1, CK_3430ES1),
3378 CLK(NULL, "ssi_ick", &ssi_ick_3430es2, CK_3430ES2PLUS | CK_36XX),
3379 CLK(NULL, "usb_l4_ick", &usb_l4_ick, CK_3430ES1),
3380 CLK(NULL, "security_l4_ick2", &security_l4_ick2, CK_34XX | CK_36XX),
3381 CLK(NULL, "aes1_ick", &aes1_ick, CK_34XX | CK_36XX),
3382 CLK("omap_rng", "ick", &rng_ick, CK_34XX | CK_36XX),
3383 CLK(NULL, "sha11_ick", &sha11_ick, CK_34XX | CK_36XX),
3384 CLK(NULL, "des1_ick", &des1_ick, CK_34XX | CK_36XX),
3385 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es1, CK_3430ES1),
3386 CLK(NULL, "dss1_alwon_fck", &dss1_alwon_fck_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3387 CLK(NULL, "dss_tv_fck", &dss_tv_fck, CK_3XXX),
3388 CLK(NULL, "dss_96m_fck", &dss_96m_fck, CK_3XXX),
3389 CLK(NULL, "dss2_alwon_fck", &dss2_alwon_fck, CK_3XXX),
3390 CLK("omapdss_dss", "ick", &dss_ick_3430es1, CK_3430ES1),
3391 CLK(NULL, "dss_ick", &dss_ick_3430es1, CK_3430ES1),
3392 CLK("omapdss_dss", "ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3393 CLK(NULL, "dss_ick", &dss_ick_3430es2, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3394 CLK(NULL, "cam_mclk", &cam_mclk, CK_34XX | CK_36XX),
3395 CLK(NULL, "cam_ick", &cam_ick, CK_34XX | CK_36XX),
3396 CLK(NULL, "csi2_96m_fck", &csi2_96m_fck, CK_34XX | CK_36XX),
3397 CLK(NULL, "usbhost_120m_fck", &usbhost_120m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3398 CLK(NULL, "usbhost_48m_fck", &usbhost_48m_fck, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3399 CLK(NULL, "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3400 CLK("usbhs_omap", "usbhost_ick", &usbhost_ick, CK_3430ES2PLUS | CK_AM35XX | CK_36XX),
3401 CLK(NULL, "utmi_p1_gfclk", &dummy_ck, CK_3XXX),
3402 CLK(NULL, "utmi_p2_gfclk", &dummy_ck, CK_3XXX),
3403 CLK(NULL, "xclk60mhsp1_ck", &dummy_ck, CK_3XXX),
3404 CLK(NULL, "xclk60mhsp2_ck", &dummy_ck, CK_3XXX),
3405 CLK(NULL, "usb_host_hs_utmi_p1_clk", &dummy_ck, CK_3XXX),
3406 CLK(NULL, "usb_host_hs_utmi_p2_clk", &dummy_ck, CK_3XXX),
3407 CLK("usbhs_omap", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3408 CLK("usbhs_omap", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3409 CLK("usbhs_tll", "usb_tll_hs_usb_ch0_clk", &dummy_ck, CK_3XXX),
3410 CLK("usbhs_tll", "usb_tll_hs_usb_ch1_clk", &dummy_ck, CK_3XXX),
3411 CLK(NULL, "init_60m_fclk", &dummy_ck, CK_3XXX),
3412 CLK(NULL, "usim_fck", &usim_fck, CK_3430ES2PLUS | CK_36XX),
3413 CLK(NULL, "gpt1_fck", &gpt1_fck, CK_3XXX),
3414 CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_3XXX),
3415 CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_3XXX),
3416 CLK(NULL, "wdt2_fck", &wdt2_fck, CK_3XXX),
3417 CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_34XX | CK_36XX),
3418 CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2PLUS | CK_36XX),
3419 CLK("omap_wdt", "ick", &wdt2_ick, CK_3XXX),
3420 CLK(NULL, "wdt2_ick", &wdt2_ick, CK_3XXX),
3421 CLK(NULL, "wdt1_ick", &wdt1_ick, CK_3XXX),
3422 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_3XXX),
3423 CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_3XXX),
3424 CLK(NULL, "gpt12_ick", &gpt12_ick, CK_3XXX),
3425 CLK(NULL, "gpt1_ick", &gpt1_ick, CK_3XXX),
3426 CLK(NULL, "per_96m_fck", &per_96m_fck, CK_3XXX),
3427 CLK(NULL, "per_48m_fck", &per_48m_fck, CK_3XXX),
3428 CLK(NULL, "uart3_fck", &uart3_fck, CK_3XXX),
3429 CLK(NULL, "uart4_fck", &uart4_fck, CK_36XX),
3430 CLK(NULL, "uart4_fck", &uart4_fck_am35xx, CK_AM35XX),
3431 CLK(NULL, "gpt2_fck", &gpt2_fck, CK_3XXX),
3432 CLK(NULL, "gpt3_fck", &gpt3_fck, CK_3XXX),
3433 CLK(NULL, "gpt4_fck", &gpt4_fck, CK_3XXX),
3434 CLK(NULL, "gpt5_fck", &gpt5_fck, CK_3XXX),
3435 CLK(NULL, "gpt6_fck", &gpt6_fck, CK_3XXX),
3436 CLK(NULL, "gpt7_fck", &gpt7_fck, CK_3XXX),
3437 CLK(NULL, "gpt8_fck", &gpt8_fck, CK_3XXX),
3438 CLK(NULL, "gpt9_fck", &gpt9_fck, CK_3XXX),
3439 CLK(NULL, "per_32k_alwon_fck", &per_32k_alwon_fck, CK_3XXX),
3440 CLK(NULL, "gpio6_dbck", &gpio6_dbck, CK_3XXX),
3441 CLK(NULL, "gpio5_dbck", &gpio5_dbck, CK_3XXX),
3442 CLK(NULL, "gpio4_dbck", &gpio4_dbck, CK_3XXX),
3443 CLK(NULL, "gpio3_dbck", &gpio3_dbck, CK_3XXX),
3444 CLK(NULL, "gpio2_dbck", &gpio2_dbck, CK_3XXX),
3445 CLK(NULL, "wdt3_fck", &wdt3_fck, CK_3XXX),
3446 CLK(NULL, "per_l4_ick", &per_l4_ick, CK_3XXX),
3447 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_3XXX),
3448 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_3XXX),
3449 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_3XXX),
3450 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_3XXX),
3451 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_3XXX),
3452 CLK(NULL, "wdt3_ick", &wdt3_ick, CK_3XXX),
3453 CLK(NULL, "uart3_ick", &uart3_ick, CK_3XXX),
3454 CLK(NULL, "uart4_ick", &uart4_ick, CK_36XX),
3455 CLK(NULL, "gpt9_ick", &gpt9_ick, CK_3XXX),
3456 CLK(NULL, "gpt8_ick", &gpt8_ick, CK_3XXX),
3457 CLK(NULL, "gpt7_ick", &gpt7_ick, CK_3XXX),
3458 CLK(NULL, "gpt6_ick", &gpt6_ick, CK_3XXX),
3459 CLK(NULL, "gpt5_ick", &gpt5_ick, CK_3XXX),
3460 CLK(NULL, "gpt4_ick", &gpt4_ick, CK_3XXX),
3461 CLK(NULL, "gpt3_ick", &gpt3_ick, CK_3XXX),
3462 CLK(NULL, "gpt2_ick", &gpt2_ick, CK_3XXX),
3463 CLK("omap-mcbsp.2", "ick", &mcbsp2_ick, CK_3XXX),
3464 CLK("omap-mcbsp.3", "ick", &mcbsp3_ick, CK_3XXX),
3465 CLK("omap-mcbsp.4", "ick", &mcbsp4_ick, CK_3XXX),
3466 CLK(NULL, "mcbsp4_ick", &mcbsp2_ick, CK_3XXX),
3467 CLK(NULL, "mcbsp3_ick", &mcbsp3_ick, CK_3XXX),
3468 CLK(NULL, "mcbsp2_ick", &mcbsp4_ick, CK_3XXX),
3469 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_3XXX),
3470 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_3XXX),
3471 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_3XXX),
3472 CLK(NULL, "emu_src_ck", &emu_src_ck, CK_3XXX),
3473 CLK("etb", "emu_src_ck", &emu_src_ck, CK_3XXX),
3474 CLK(NULL, "pclk_fck", &pclk_fck, CK_3XXX),
3475 CLK(NULL, "pclkx2_fck", &pclkx2_fck, CK_3XXX),
3476 CLK(NULL, "atclk_fck", &atclk_fck, CK_3XXX),
3477 CLK(NULL, "traceclk_src_fck", &traceclk_src_fck, CK_3XXX),
3478 CLK(NULL, "traceclk_fck", &traceclk_fck, CK_3XXX),
3479 CLK(NULL, "sr1_fck", &sr1_fck, CK_34XX | CK_36XX),
3480 CLK(NULL, "sr2_fck", &sr2_fck, CK_34XX | CK_36XX),
3481 CLK(NULL, "sr_l4_ick", &sr_l4_ick, CK_34XX | CK_36XX),
3482 CLK(NULL, "secure_32k_fck", &secure_32k_fck, CK_3XXX),
3483 CLK(NULL, "gpt12_fck", &gpt12_fck, CK_3XXX),
3484 CLK(NULL, "wdt1_fck", &wdt1_fck, CK_3XXX),
3485 CLK(NULL, "ipss_ick", &ipss_ick, CK_AM35XX),
3486 CLK(NULL, "rmii_ck", &rmii_ck, CK_AM35XX),
3487 CLK(NULL, "pclk_ck", &pclk_ck, CK_AM35XX),
3488 CLK(NULL, "emac_ick", &emac_ick, CK_AM35XX),
3489 CLK(NULL, "emac_fck", &emac_fck, CK_AM35XX),
3490 CLK("davinci_emac.0", NULL, &emac_ick, CK_AM35XX),
3491 CLK("davinci_mdio.0", NULL, &emac_fck, CK_AM35XX),
3492 CLK(NULL, "vpfe_ick", &emac_ick, CK_AM35XX),
3493 CLK(NULL, "vpfe_fck", &emac_fck, CK_AM35XX),
3494 CLK("vpfe-capture", "master", &vpfe_ick, CK_AM35XX),
3495 CLK("vpfe-capture", "slave", &vpfe_fck, CK_AM35XX),
3496 CLK(NULL, "hsotgusb_ick", &hsotgusb_ick_am35xx, CK_AM35XX),
3497 CLK(NULL, "hsotgusb_fck", &hsotgusb_fck_am35xx, CK_AM35XX),
3498 CLK(NULL, "hecc_ck", &hecc_ck, CK_AM35XX),
3499 CLK(NULL, "uart4_ick", &uart4_ick_am35xx, CK_AM35XX),
3500 CLK(NULL, "timer_32k_ck", &omap_32k_fck, CK_3XXX),
3501 CLK(NULL, "timer_sys_ck", &sys_ck, CK_3XXX),
3502 CLK(NULL, "cpufreq_ck", &dpll1_ck, CK_3XXX),
3503};
3504
3505
3506int __init omap3xxx_clk_init(void)
3507{
3508 struct omap_clk *c;
3509 u32 cpu_clkflg = 0;
3510
3511 if (soc_is_am35xx()) {
3512 cpu_mask = RATE_IN_34XX;
3513 cpu_clkflg = CK_AM35XX;
3514 } else if (cpu_is_omap3630()) {
3515 cpu_mask = (RATE_IN_34XX | RATE_IN_36XX);
3516 cpu_clkflg = CK_36XX;
3517 } else if (cpu_is_ti816x()) {
3518 cpu_mask = RATE_IN_TI816X;
3519 cpu_clkflg = CK_TI816X;
3520 } else if (soc_is_am33xx()) {
3521 cpu_mask = RATE_IN_AM33XX;
3522 } else if (cpu_is_ti814x()) {
3523 cpu_mask = RATE_IN_TI814X;
3524 } else if (cpu_is_omap34xx()) {
3525 if (omap_rev() == OMAP3430_REV_ES1_0) {
3526 cpu_mask = RATE_IN_3430ES1;
3527 cpu_clkflg = CK_3430ES1;
3528 } else {
3529 /*
3530 * Assume that anything that we haven't matched yet
3531 * has 3430ES2-type clocks.
3532 */
3533 cpu_mask = RATE_IN_3430ES2PLUS;
3534 cpu_clkflg = CK_3430ES2PLUS;
3535 }
3536 } else {
3537 WARN(1, "clock: could not identify OMAP3 variant\n");
3538 }
3539
3540 if (omap3_has_192mhz_clk())
3541 omap_96m_alwon_fck = omap_96m_alwon_fck_3630;
3542
3543 if (cpu_is_omap3630()) {
3544 /*
3545 * XXX This type of dynamic rewriting of the clock tree is
3546 * deprecated and should be revised soon.
3547 *
3548 * For 3630: override clkops_omap2_dflt_wait for the
3549 * clocks affected from PWRDN reset Limitation
3550 */
3551 dpll3_m3x2_ck.ops =
3552 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3553 dpll4_m2x2_ck.ops =
3554 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3555 dpll4_m3x2_ck.ops =
3556 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3557 dpll4_m4x2_ck.ops =
3558 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3559 dpll4_m5x2_ck.ops =
3560 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3561 dpll4_m6x2_ck.ops =
3562 &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore;
3563 }
3564
3565 /*
3566 * XXX This type of dynamic rewriting of the clock tree is
3567 * deprecated and should be revised soon.
3568 */
3569 if (cpu_is_omap3630())
3570 dpll4_dd = dpll4_dd_3630;
3571 else
3572 dpll4_dd = dpll4_dd_34xx;
3573
3574 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3575 c++)
3576 clk_preinit(c->lk.clk);
3577
3578 for (c = omap3xxx_clks; c < omap3xxx_clks + ARRAY_SIZE(omap3xxx_clks);
3579 c++)
3580 if (c->cpu & cpu_clkflg) {
3581 clkdev_add(&c->lk);
3582 clk_register(c->lk.clk);
3583 omap2_init_clk_clkdm(c->lk.clk);
3584 }
3585
3586 /* Disable autoidle on all clocks; let the PM code enable it later */
3587 omap_clk_disable_autoidle_all();
3588
3589 recalculate_root_clocks();
3590
3591 pr_info("Clocking rate (Crystal/Core/MPU): %ld.%01ld/%ld/%ld MHz\n",
3592 (osc_sys_ck.rate / 1000000), (osc_sys_ck.rate / 100000) % 10,
3593 (core_ck.rate / 1000000), (arm_fck.rate / 1000000));
3594
3595 /*
3596 * Only enable those clocks we will need, let the drivers
3597 * enable other clocks as necessary
3598 */
3599 clk_enable_init_clocks();
3600
3601 /*
3602 * Lock DPLL5 -- here only until other device init code can
3603 * handle this
3604 */
3605 if (!cpu_is_ti81xx() && (omap_rev() >= OMAP3430_REV_ES2_0))
3606 omap3_clk_lock_dpll5();
3607
3608 /* Avoid sleeping during omap3_core_dpll_m2_set_rate() */
3609 sdrc_ick_p = clk_get(NULL, "sdrc_ick");
3610 arm_fck_p = clk_get(NULL, "arm_fck");
3611
3612 return 0;
3613}
diff --git a/arch/arm/mach-omap2/clock44xx_data.c b/arch/arm/mach-omap2/clock44xx_data.c
deleted file mode 100644
index 2a450c9b9a7b..000000000000
--- a/arch/arm/mach-omap2/clock44xx_data.c
+++ /dev/null
@@ -1,3398 +0,0 @@
1/*
2 * OMAP4 Clock data
3 *
4 * Copyright (C) 2009-2010 Texas Instruments, Inc.
5 * Copyright (C) 2009-2010 Nokia Corporation
6 *
7 * Paul Walmsley (paul@pwsan.com)
8 * Rajendra Nayak (rnayak@ti.com)
9 * Benoit Cousson (b-cousson@ti.com)
10 *
11 * This file is automatically generated from the OMAP hardware databases.
12 * We respectfully ask that any modifications to this file be coordinated
13 * with the public linux-omap@vger.kernel.org mailing list and the
14 * authors above to ensure that the autogeneration scripts are kept
15 * up-to-date with the file contents.
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 *
21 * XXX Some of the ES1 clocks have been removed/changed; once support
22 * is added for discriminating clocks by ES level, these should be added back
23 * in.
24 */
25
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/clk.h>
29#include <linux/io.h>
30
31#include "soc.h"
32#include "iomap.h"
33#include "clock.h"
34#include "clock44xx.h"
35#include "cm1_44xx.h"
36#include "cm2_44xx.h"
37#include "cm-regbits-44xx.h"
38#include "prm44xx.h"
39#include "prm-regbits-44xx.h"
40#include "control.h"
41#include "scrm44xx.h"
42
43/* OMAP4 modulemode control */
44#define OMAP4430_MODULEMODE_HWCTRL 0
45#define OMAP4430_MODULEMODE_SWCTRL 1
46
47/* Root clocks */
48
49static struct clk extalt_clkin_ck = {
50 .name = "extalt_clkin_ck",
51 .rate = 59000000,
52 .ops = &clkops_null,
53};
54
55static struct clk pad_clks_ck = {
56 .name = "pad_clks_ck",
57 .rate = 12000000,
58 .ops = &clkops_omap2_dflt,
59 .enable_reg = OMAP4430_CM_CLKSEL_ABE,
60 .enable_bit = OMAP4430_PAD_CLKS_GATE_SHIFT,
61};
62
63static struct clk pad_slimbus_core_clks_ck = {
64 .name = "pad_slimbus_core_clks_ck",
65 .rate = 12000000,
66 .ops = &clkops_null,
67};
68
69static struct clk secure_32k_clk_src_ck = {
70 .name = "secure_32k_clk_src_ck",
71 .rate = 32768,
72 .ops = &clkops_null,
73};
74
75static struct clk slimbus_clk = {
76 .name = "slimbus_clk",
77 .rate = 12000000,
78 .ops = &clkops_omap2_dflt,
79 .enable_reg = OMAP4430_CM_CLKSEL_ABE,
80 .enable_bit = OMAP4430_SLIMBUS_CLK_GATE_SHIFT,
81};
82
83static struct clk sys_32k_ck = {
84 .name = "sys_32k_ck",
85 .clkdm_name = "prm_clkdm",
86 .rate = 32768,
87 .ops = &clkops_null,
88};
89
90static struct clk virt_12000000_ck = {
91 .name = "virt_12000000_ck",
92 .ops = &clkops_null,
93 .rate = 12000000,
94};
95
96static struct clk virt_13000000_ck = {
97 .name = "virt_13000000_ck",
98 .ops = &clkops_null,
99 .rate = 13000000,
100};
101
102static struct clk virt_16800000_ck = {
103 .name = "virt_16800000_ck",
104 .ops = &clkops_null,
105 .rate = 16800000,
106};
107
108static struct clk virt_27000000_ck = {
109 .name = "virt_27000000_ck",
110 .ops = &clkops_null,
111 .rate = 27000000,
112};
113
114static struct clk virt_38400000_ck = {
115 .name = "virt_38400000_ck",
116 .ops = &clkops_null,
117 .rate = 38400000,
118};
119
120static const struct clksel_rate div_1_5_rates[] = {
121 { .div = 1, .val = 5, .flags = RATE_IN_4430 },
122 { .div = 0 },
123};
124
125static const struct clksel_rate div_1_6_rates[] = {
126 { .div = 1, .val = 6, .flags = RATE_IN_4430 },
127 { .div = 0 },
128};
129
130static const struct clksel_rate div_1_7_rates[] = {
131 { .div = 1, .val = 7, .flags = RATE_IN_4430 },
132 { .div = 0 },
133};
134
135static const struct clksel sys_clkin_sel[] = {
136 { .parent = &virt_12000000_ck, .rates = div_1_1_rates },
137 { .parent = &virt_13000000_ck, .rates = div_1_2_rates },
138 { .parent = &virt_16800000_ck, .rates = div_1_3_rates },
139 { .parent = &virt_19200000_ck, .rates = div_1_4_rates },
140 { .parent = &virt_26000000_ck, .rates = div_1_5_rates },
141 { .parent = &virt_27000000_ck, .rates = div_1_6_rates },
142 { .parent = &virt_38400000_ck, .rates = div_1_7_rates },
143 { .parent = NULL },
144};
145
146static struct clk sys_clkin_ck = {
147 .name = "sys_clkin_ck",
148 .rate = 38400000,
149 .clksel = sys_clkin_sel,
150 .init = &omap2_init_clksel_parent,
151 .clksel_reg = OMAP4430_CM_SYS_CLKSEL,
152 .clksel_mask = OMAP4430_SYS_CLKSEL_MASK,
153 .ops = &clkops_null,
154 .recalc = &omap2_clksel_recalc,
155};
156
157static struct clk tie_low_clock_ck = {
158 .name = "tie_low_clock_ck",
159 .rate = 0,
160 .ops = &clkops_null,
161};
162
163static struct clk utmi_phy_clkout_ck = {
164 .name = "utmi_phy_clkout_ck",
165 .rate = 60000000,
166 .ops = &clkops_null,
167};
168
169static struct clk xclk60mhsp1_ck = {
170 .name = "xclk60mhsp1_ck",
171 .rate = 60000000,
172 .ops = &clkops_null,
173};
174
175static struct clk xclk60mhsp2_ck = {
176 .name = "xclk60mhsp2_ck",
177 .rate = 60000000,
178 .ops = &clkops_null,
179};
180
181static struct clk xclk60motg_ck = {
182 .name = "xclk60motg_ck",
183 .rate = 60000000,
184 .ops = &clkops_null,
185};
186
187/* Module clocks and DPLL outputs */
188
189static const struct clksel abe_dpll_bypass_clk_mux_sel[] = {
190 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
191 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
192 { .parent = NULL },
193};
194
195static struct clk abe_dpll_bypass_clk_mux_ck = {
196 .name = "abe_dpll_bypass_clk_mux_ck",
197 .parent = &sys_clkin_ck,
198 .ops = &clkops_null,
199 .recalc = &followparent_recalc,
200};
201
202static struct clk abe_dpll_refclk_mux_ck = {
203 .name = "abe_dpll_refclk_mux_ck",
204 .parent = &sys_clkin_ck,
205 .clksel = abe_dpll_bypass_clk_mux_sel,
206 .init = &omap2_init_clksel_parent,
207 .clksel_reg = OMAP4430_CM_ABE_PLL_REF_CLKSEL,
208 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
209 .ops = &clkops_null,
210 .recalc = &omap2_clksel_recalc,
211};
212
213/* DPLL_ABE */
214static struct dpll_data dpll_abe_dd = {
215 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_ABE,
216 .clk_bypass = &abe_dpll_bypass_clk_mux_ck,
217 .clk_ref = &abe_dpll_refclk_mux_ck,
218 .control_reg = OMAP4430_CM_CLKMODE_DPLL_ABE,
219 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
220 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_ABE,
221 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_ABE,
222 .mult_mask = OMAP4430_DPLL_MULT_MASK,
223 .div1_mask = OMAP4430_DPLL_DIV_MASK,
224 .enable_mask = OMAP4430_DPLL_EN_MASK,
225 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
226 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
227 .max_multiplier = 2047,
228 .max_divider = 128,
229 .min_divider = 1,
230};
231
232
233static struct clk dpll_abe_ck = {
234 .name = "dpll_abe_ck",
235 .parent = &abe_dpll_refclk_mux_ck,
236 .dpll_data = &dpll_abe_dd,
237 .init = &omap2_init_dpll_parent,
238 .ops = &clkops_omap3_noncore_dpll_ops,
239 .recalc = &omap4_dpll_regm4xen_recalc,
240 .round_rate = &omap4_dpll_regm4xen_round_rate,
241 .set_rate = &omap3_noncore_dpll_set_rate,
242};
243
244static struct clk dpll_abe_x2_ck = {
245 .name = "dpll_abe_x2_ck",
246 .parent = &dpll_abe_ck,
247 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
248 .flags = CLOCK_CLKOUTX2,
249 .ops = &clkops_omap4_dpllmx_ops,
250 .recalc = &omap3_clkoutx2_recalc,
251};
252
253static const struct clksel dpll_abe_m2x2_div[] = {
254 { .parent = &dpll_abe_x2_ck, .rates = div31_1to31_rates },
255 { .parent = NULL },
256};
257
258static struct clk dpll_abe_m2x2_ck = {
259 .name = "dpll_abe_m2x2_ck",
260 .parent = &dpll_abe_x2_ck,
261 .clksel = dpll_abe_m2x2_div,
262 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
263 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
264 .ops = &clkops_omap4_dpllmx_ops,
265 .recalc = &omap2_clksel_recalc,
266 .round_rate = &omap2_clksel_round_rate,
267 .set_rate = &omap2_clksel_set_rate,
268};
269
270static struct clk abe_24m_fclk = {
271 .name = "abe_24m_fclk",
272 .parent = &dpll_abe_m2x2_ck,
273 .ops = &clkops_null,
274 .fixed_div = 8,
275 .recalc = &omap_fixed_divisor_recalc,
276};
277
278static const struct clksel_rate div3_1to4_rates[] = {
279 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
280 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
281 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
282 { .div = 0 },
283};
284
285static const struct clksel abe_clk_div[] = {
286 { .parent = &dpll_abe_m2x2_ck, .rates = div3_1to4_rates },
287 { .parent = NULL },
288};
289
290static struct clk abe_clk = {
291 .name = "abe_clk",
292 .parent = &dpll_abe_m2x2_ck,
293 .clksel = abe_clk_div,
294 .clksel_reg = OMAP4430_CM_CLKSEL_ABE,
295 .clksel_mask = OMAP4430_CLKSEL_OPP_MASK,
296 .ops = &clkops_null,
297 .recalc = &omap2_clksel_recalc,
298 .round_rate = &omap2_clksel_round_rate,
299 .set_rate = &omap2_clksel_set_rate,
300};
301
302static const struct clksel_rate div2_1to2_rates[] = {
303 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
304 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
305 { .div = 0 },
306};
307
308static const struct clksel aess_fclk_div[] = {
309 { .parent = &abe_clk, .rates = div2_1to2_rates },
310 { .parent = NULL },
311};
312
313static struct clk aess_fclk = {
314 .name = "aess_fclk",
315 .parent = &abe_clk,
316 .clksel = aess_fclk_div,
317 .clksel_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
318 .clksel_mask = OMAP4430_CLKSEL_AESS_FCLK_MASK,
319 .ops = &clkops_null,
320 .recalc = &omap2_clksel_recalc,
321 .round_rate = &omap2_clksel_round_rate,
322 .set_rate = &omap2_clksel_set_rate,
323};
324
325static struct clk dpll_abe_m3x2_ck = {
326 .name = "dpll_abe_m3x2_ck",
327 .parent = &dpll_abe_x2_ck,
328 .clksel = dpll_abe_m2x2_div,
329 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_ABE,
330 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
331 .ops = &clkops_omap4_dpllmx_ops,
332 .recalc = &omap2_clksel_recalc,
333 .round_rate = &omap2_clksel_round_rate,
334 .set_rate = &omap2_clksel_set_rate,
335};
336
337static const struct clksel core_hsd_byp_clk_mux_sel[] = {
338 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
339 { .parent = &dpll_abe_m3x2_ck, .rates = div_1_1_rates },
340 { .parent = NULL },
341};
342
343static struct clk core_hsd_byp_clk_mux_ck = {
344 .name = "core_hsd_byp_clk_mux_ck",
345 .parent = &sys_clkin_ck,
346 .clksel = core_hsd_byp_clk_mux_sel,
347 .init = &omap2_init_clksel_parent,
348 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
349 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
350 .ops = &clkops_null,
351 .recalc = &omap2_clksel_recalc,
352};
353
354/* DPLL_CORE */
355static struct dpll_data dpll_core_dd = {
356 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_CORE,
357 .clk_bypass = &core_hsd_byp_clk_mux_ck,
358 .clk_ref = &sys_clkin_ck,
359 .control_reg = OMAP4430_CM_CLKMODE_DPLL_CORE,
360 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
361 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_CORE,
362 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_CORE,
363 .mult_mask = OMAP4430_DPLL_MULT_MASK,
364 .div1_mask = OMAP4430_DPLL_DIV_MASK,
365 .enable_mask = OMAP4430_DPLL_EN_MASK,
366 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
367 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
368 .max_multiplier = 2047,
369 .max_divider = 128,
370 .min_divider = 1,
371};
372
373
374static struct clk dpll_core_ck = {
375 .name = "dpll_core_ck",
376 .parent = &sys_clkin_ck,
377 .dpll_data = &dpll_core_dd,
378 .init = &omap2_init_dpll_parent,
379 .ops = &clkops_omap3_core_dpll_ops,
380 .recalc = &omap3_dpll_recalc,
381};
382
383static struct clk dpll_core_x2_ck = {
384 .name = "dpll_core_x2_ck",
385 .parent = &dpll_core_ck,
386 .flags = CLOCK_CLKOUTX2,
387 .ops = &clkops_null,
388 .recalc = &omap3_clkoutx2_recalc,
389};
390
391static const struct clksel dpll_core_m6x2_div[] = {
392 { .parent = &dpll_core_x2_ck, .rates = div31_1to31_rates },
393 { .parent = NULL },
394};
395
396static struct clk dpll_core_m6x2_ck = {
397 .name = "dpll_core_m6x2_ck",
398 .parent = &dpll_core_x2_ck,
399 .clksel = dpll_core_m6x2_div,
400 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_CORE,
401 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
402 .ops = &clkops_omap4_dpllmx_ops,
403 .recalc = &omap2_clksel_recalc,
404 .round_rate = &omap2_clksel_round_rate,
405 .set_rate = &omap2_clksel_set_rate,
406};
407
408static const struct clksel dbgclk_mux_sel[] = {
409 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
410 { .parent = &dpll_core_m6x2_ck, .rates = div_1_1_rates },
411 { .parent = NULL },
412};
413
414static struct clk dbgclk_mux_ck = {
415 .name = "dbgclk_mux_ck",
416 .parent = &sys_clkin_ck,
417 .ops = &clkops_null,
418 .recalc = &followparent_recalc,
419};
420
421static const struct clksel dpll_core_m2_div[] = {
422 { .parent = &dpll_core_ck, .rates = div31_1to31_rates },
423 { .parent = NULL },
424};
425
426static struct clk dpll_core_m2_ck = {
427 .name = "dpll_core_m2_ck",
428 .parent = &dpll_core_ck,
429 .clksel = dpll_core_m2_div,
430 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_CORE,
431 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
432 .ops = &clkops_omap4_dpllmx_ops,
433 .recalc = &omap2_clksel_recalc,
434 .round_rate = &omap2_clksel_round_rate,
435 .set_rate = &omap2_clksel_set_rate,
436};
437
438static struct clk ddrphy_ck = {
439 .name = "ddrphy_ck",
440 .parent = &dpll_core_m2_ck,
441 .ops = &clkops_null,
442 .clkdm_name = "l3_emif_clkdm",
443 .fixed_div = 2,
444 .recalc = &omap_fixed_divisor_recalc,
445};
446
447static struct clk dpll_core_m5x2_ck = {
448 .name = "dpll_core_m5x2_ck",
449 .parent = &dpll_core_x2_ck,
450 .clksel = dpll_core_m6x2_div,
451 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_CORE,
452 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
453 .ops = &clkops_omap4_dpllmx_ops,
454 .recalc = &omap2_clksel_recalc,
455 .round_rate = &omap2_clksel_round_rate,
456 .set_rate = &omap2_clksel_set_rate,
457};
458
459static const struct clksel div_core_div[] = {
460 { .parent = &dpll_core_m5x2_ck, .rates = div2_1to2_rates },
461 { .parent = NULL },
462};
463
464static struct clk div_core_ck = {
465 .name = "div_core_ck",
466 .parent = &dpll_core_m5x2_ck,
467 .clksel = div_core_div,
468 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
469 .clksel_mask = OMAP4430_CLKSEL_CORE_MASK,
470 .ops = &clkops_null,
471 .recalc = &omap2_clksel_recalc,
472 .round_rate = &omap2_clksel_round_rate,
473 .set_rate = &omap2_clksel_set_rate,
474};
475
476static const struct clksel_rate div4_1to8_rates[] = {
477 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
478 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
479 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
480 { .div = 8, .val = 3, .flags = RATE_IN_4430 },
481 { .div = 0 },
482};
483
484static const struct clksel div_iva_hs_clk_div[] = {
485 { .parent = &dpll_core_m5x2_ck, .rates = div4_1to8_rates },
486 { .parent = NULL },
487};
488
489static struct clk div_iva_hs_clk = {
490 .name = "div_iva_hs_clk",
491 .parent = &dpll_core_m5x2_ck,
492 .clksel = div_iva_hs_clk_div,
493 .clksel_reg = OMAP4430_CM_BYPCLK_DPLL_IVA,
494 .clksel_mask = OMAP4430_CLKSEL_0_1_MASK,
495 .ops = &clkops_null,
496 .recalc = &omap2_clksel_recalc,
497 .round_rate = &omap2_clksel_round_rate,
498 .set_rate = &omap2_clksel_set_rate,
499};
500
501static struct clk div_mpu_hs_clk = {
502 .name = "div_mpu_hs_clk",
503 .parent = &dpll_core_m5x2_ck,
504 .clksel = div_iva_hs_clk_div,
505 .clksel_reg = OMAP4430_CM_BYPCLK_DPLL_MPU,
506 .clksel_mask = OMAP4430_CLKSEL_0_1_MASK,
507 .ops = &clkops_null,
508 .recalc = &omap2_clksel_recalc,
509 .round_rate = &omap2_clksel_round_rate,
510 .set_rate = &omap2_clksel_set_rate,
511};
512
513static struct clk dpll_core_m4x2_ck = {
514 .name = "dpll_core_m4x2_ck",
515 .parent = &dpll_core_x2_ck,
516 .clksel = dpll_core_m6x2_div,
517 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_CORE,
518 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
519 .ops = &clkops_omap4_dpllmx_ops,
520 .recalc = &omap2_clksel_recalc,
521 .round_rate = &omap2_clksel_round_rate,
522 .set_rate = &omap2_clksel_set_rate,
523};
524
525static struct clk dll_clk_div_ck = {
526 .name = "dll_clk_div_ck",
527 .parent = &dpll_core_m4x2_ck,
528 .ops = &clkops_null,
529 .fixed_div = 2,
530 .recalc = &omap_fixed_divisor_recalc,
531};
532
533static const struct clksel dpll_abe_m2_div[] = {
534 { .parent = &dpll_abe_ck, .rates = div31_1to31_rates },
535 { .parent = NULL },
536};
537
538static struct clk dpll_abe_m2_ck = {
539 .name = "dpll_abe_m2_ck",
540 .parent = &dpll_abe_ck,
541 .clksel = dpll_abe_m2_div,
542 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_ABE,
543 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
544 .ops = &clkops_omap4_dpllmx_ops,
545 .recalc = &omap2_clksel_recalc,
546 .round_rate = &omap2_clksel_round_rate,
547 .set_rate = &omap2_clksel_set_rate,
548};
549
550static struct clk dpll_core_m3x2_ck = {
551 .name = "dpll_core_m3x2_ck",
552 .parent = &dpll_core_x2_ck,
553 .clksel = dpll_core_m6x2_div,
554 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_CORE,
555 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
556 .ops = &clkops_omap2_dflt,
557 .recalc = &omap2_clksel_recalc,
558 .round_rate = &omap2_clksel_round_rate,
559 .set_rate = &omap2_clksel_set_rate,
560 .enable_reg = OMAP4430_CM_DIV_M3_DPLL_CORE,
561 .enable_bit = OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT,
562};
563
564static struct clk dpll_core_m7x2_ck = {
565 .name = "dpll_core_m7x2_ck",
566 .parent = &dpll_core_x2_ck,
567 .clksel = dpll_core_m6x2_div,
568 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_CORE,
569 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
570 .ops = &clkops_omap4_dpllmx_ops,
571 .recalc = &omap2_clksel_recalc,
572 .round_rate = &omap2_clksel_round_rate,
573 .set_rate = &omap2_clksel_set_rate,
574};
575
576static const struct clksel iva_hsd_byp_clk_mux_sel[] = {
577 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
578 { .parent = &div_iva_hs_clk, .rates = div_1_1_rates },
579 { .parent = NULL },
580};
581
582static struct clk iva_hsd_byp_clk_mux_ck = {
583 .name = "iva_hsd_byp_clk_mux_ck",
584 .parent = &sys_clkin_ck,
585 .clksel = iva_hsd_byp_clk_mux_sel,
586 .init = &omap2_init_clksel_parent,
587 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
588 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
589 .ops = &clkops_null,
590 .recalc = &omap2_clksel_recalc,
591};
592
593/* DPLL_IVA */
594static struct dpll_data dpll_iva_dd = {
595 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_IVA,
596 .clk_bypass = &iva_hsd_byp_clk_mux_ck,
597 .clk_ref = &sys_clkin_ck,
598 .control_reg = OMAP4430_CM_CLKMODE_DPLL_IVA,
599 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
600 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_IVA,
601 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_IVA,
602 .mult_mask = OMAP4430_DPLL_MULT_MASK,
603 .div1_mask = OMAP4430_DPLL_DIV_MASK,
604 .enable_mask = OMAP4430_DPLL_EN_MASK,
605 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
606 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
607 .max_multiplier = 2047,
608 .max_divider = 128,
609 .min_divider = 1,
610};
611
612
613static struct clk dpll_iva_ck = {
614 .name = "dpll_iva_ck",
615 .parent = &sys_clkin_ck,
616 .dpll_data = &dpll_iva_dd,
617 .init = &omap2_init_dpll_parent,
618 .ops = &clkops_omap3_noncore_dpll_ops,
619 .recalc = &omap3_dpll_recalc,
620 .round_rate = &omap2_dpll_round_rate,
621 .set_rate = &omap3_noncore_dpll_set_rate,
622};
623
624static struct clk dpll_iva_x2_ck = {
625 .name = "dpll_iva_x2_ck",
626 .parent = &dpll_iva_ck,
627 .flags = CLOCK_CLKOUTX2,
628 .ops = &clkops_null,
629 .recalc = &omap3_clkoutx2_recalc,
630};
631
632static const struct clksel dpll_iva_m4x2_div[] = {
633 { .parent = &dpll_iva_x2_ck, .rates = div31_1to31_rates },
634 { .parent = NULL },
635};
636
637static struct clk dpll_iva_m4x2_ck = {
638 .name = "dpll_iva_m4x2_ck",
639 .parent = &dpll_iva_x2_ck,
640 .clksel = dpll_iva_m4x2_div,
641 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_IVA,
642 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
643 .ops = &clkops_omap4_dpllmx_ops,
644 .recalc = &omap2_clksel_recalc,
645 .round_rate = &omap2_clksel_round_rate,
646 .set_rate = &omap2_clksel_set_rate,
647};
648
649static struct clk dpll_iva_m5x2_ck = {
650 .name = "dpll_iva_m5x2_ck",
651 .parent = &dpll_iva_x2_ck,
652 .clksel = dpll_iva_m4x2_div,
653 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_IVA,
654 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
655 .ops = &clkops_omap4_dpllmx_ops,
656 .recalc = &omap2_clksel_recalc,
657 .round_rate = &omap2_clksel_round_rate,
658 .set_rate = &omap2_clksel_set_rate,
659};
660
661/* DPLL_MPU */
662static struct dpll_data dpll_mpu_dd = {
663 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_MPU,
664 .clk_bypass = &div_mpu_hs_clk,
665 .clk_ref = &sys_clkin_ck,
666 .control_reg = OMAP4430_CM_CLKMODE_DPLL_MPU,
667 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
668 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_MPU,
669 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_MPU,
670 .mult_mask = OMAP4430_DPLL_MULT_MASK,
671 .div1_mask = OMAP4430_DPLL_DIV_MASK,
672 .enable_mask = OMAP4430_DPLL_EN_MASK,
673 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
674 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
675 .max_multiplier = 2047,
676 .max_divider = 128,
677 .min_divider = 1,
678};
679
680
681static struct clk dpll_mpu_ck = {
682 .name = "dpll_mpu_ck",
683 .parent = &sys_clkin_ck,
684 .dpll_data = &dpll_mpu_dd,
685 .init = &omap2_init_dpll_parent,
686 .ops = &clkops_omap3_noncore_dpll_ops,
687 .recalc = &omap3_dpll_recalc,
688 .round_rate = &omap2_dpll_round_rate,
689 .set_rate = &omap3_noncore_dpll_set_rate,
690};
691
692static const struct clksel dpll_mpu_m2_div[] = {
693 { .parent = &dpll_mpu_ck, .rates = div31_1to31_rates },
694 { .parent = NULL },
695};
696
697static struct clk dpll_mpu_m2_ck = {
698 .name = "dpll_mpu_m2_ck",
699 .parent = &dpll_mpu_ck,
700 .clkdm_name = "cm_clkdm",
701 .clksel = dpll_mpu_m2_div,
702 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_MPU,
703 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
704 .ops = &clkops_omap4_dpllmx_ops,
705 .recalc = &omap2_clksel_recalc,
706 .round_rate = &omap2_clksel_round_rate,
707 .set_rate = &omap2_clksel_set_rate,
708};
709
710static struct clk per_hs_clk_div_ck = {
711 .name = "per_hs_clk_div_ck",
712 .parent = &dpll_abe_m3x2_ck,
713 .ops = &clkops_null,
714 .fixed_div = 2,
715 .recalc = &omap_fixed_divisor_recalc,
716};
717
718static const struct clksel per_hsd_byp_clk_mux_sel[] = {
719 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
720 { .parent = &per_hs_clk_div_ck, .rates = div_1_1_rates },
721 { .parent = NULL },
722};
723
724static struct clk per_hsd_byp_clk_mux_ck = {
725 .name = "per_hsd_byp_clk_mux_ck",
726 .parent = &sys_clkin_ck,
727 .clksel = per_hsd_byp_clk_mux_sel,
728 .init = &omap2_init_clksel_parent,
729 .clksel_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
730 .clksel_mask = OMAP4430_DPLL_BYP_CLKSEL_MASK,
731 .ops = &clkops_null,
732 .recalc = &omap2_clksel_recalc,
733};
734
735/* DPLL_PER */
736static struct dpll_data dpll_per_dd = {
737 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_PER,
738 .clk_bypass = &per_hsd_byp_clk_mux_ck,
739 .clk_ref = &sys_clkin_ck,
740 .control_reg = OMAP4430_CM_CLKMODE_DPLL_PER,
741 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
742 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_PER,
743 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_PER,
744 .mult_mask = OMAP4430_DPLL_MULT_MASK,
745 .div1_mask = OMAP4430_DPLL_DIV_MASK,
746 .enable_mask = OMAP4430_DPLL_EN_MASK,
747 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
748 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
749 .max_multiplier = 2047,
750 .max_divider = 128,
751 .min_divider = 1,
752};
753
754
755static struct clk dpll_per_ck = {
756 .name = "dpll_per_ck",
757 .parent = &sys_clkin_ck,
758 .dpll_data = &dpll_per_dd,
759 .init = &omap2_init_dpll_parent,
760 .ops = &clkops_omap3_noncore_dpll_ops,
761 .recalc = &omap3_dpll_recalc,
762 .round_rate = &omap2_dpll_round_rate,
763 .set_rate = &omap3_noncore_dpll_set_rate,
764};
765
766static const struct clksel dpll_per_m2_div[] = {
767 { .parent = &dpll_per_ck, .rates = div31_1to31_rates },
768 { .parent = NULL },
769};
770
771static struct clk dpll_per_m2_ck = {
772 .name = "dpll_per_m2_ck",
773 .parent = &dpll_per_ck,
774 .clksel = dpll_per_m2_div,
775 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
776 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
777 .ops = &clkops_omap4_dpllmx_ops,
778 .recalc = &omap2_clksel_recalc,
779 .round_rate = &omap2_clksel_round_rate,
780 .set_rate = &omap2_clksel_set_rate,
781};
782
783static struct clk dpll_per_x2_ck = {
784 .name = "dpll_per_x2_ck",
785 .parent = &dpll_per_ck,
786 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
787 .flags = CLOCK_CLKOUTX2,
788 .ops = &clkops_omap4_dpllmx_ops,
789 .recalc = &omap3_clkoutx2_recalc,
790};
791
792static const struct clksel dpll_per_m2x2_div[] = {
793 { .parent = &dpll_per_x2_ck, .rates = div31_1to31_rates },
794 { .parent = NULL },
795};
796
797static struct clk dpll_per_m2x2_ck = {
798 .name = "dpll_per_m2x2_ck",
799 .parent = &dpll_per_x2_ck,
800 .clksel = dpll_per_m2x2_div,
801 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_PER,
802 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_MASK,
803 .ops = &clkops_omap4_dpllmx_ops,
804 .recalc = &omap2_clksel_recalc,
805 .round_rate = &omap2_clksel_round_rate,
806 .set_rate = &omap2_clksel_set_rate,
807};
808
809static struct clk dpll_per_m3x2_ck = {
810 .name = "dpll_per_m3x2_ck",
811 .parent = &dpll_per_x2_ck,
812 .clksel = dpll_per_m2x2_div,
813 .clksel_reg = OMAP4430_CM_DIV_M3_DPLL_PER,
814 .clksel_mask = OMAP4430_DPLL_CLKOUTHIF_DIV_MASK,
815 .ops = &clkops_omap2_dflt,
816 .recalc = &omap2_clksel_recalc,
817 .round_rate = &omap2_clksel_round_rate,
818 .set_rate = &omap2_clksel_set_rate,
819 .enable_reg = OMAP4430_CM_DIV_M3_DPLL_PER,
820 .enable_bit = OMAP4430_DPLL_CLKOUTHIF_GATE_CTRL_SHIFT,
821};
822
823static struct clk dpll_per_m4x2_ck = {
824 .name = "dpll_per_m4x2_ck",
825 .parent = &dpll_per_x2_ck,
826 .clksel = dpll_per_m2x2_div,
827 .clksel_reg = OMAP4430_CM_DIV_M4_DPLL_PER,
828 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT1_DIV_MASK,
829 .ops = &clkops_omap4_dpllmx_ops,
830 .recalc = &omap2_clksel_recalc,
831 .round_rate = &omap2_clksel_round_rate,
832 .set_rate = &omap2_clksel_set_rate,
833};
834
835static struct clk dpll_per_m5x2_ck = {
836 .name = "dpll_per_m5x2_ck",
837 .parent = &dpll_per_x2_ck,
838 .clksel = dpll_per_m2x2_div,
839 .clksel_reg = OMAP4430_CM_DIV_M5_DPLL_PER,
840 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT2_DIV_MASK,
841 .ops = &clkops_omap4_dpllmx_ops,
842 .recalc = &omap2_clksel_recalc,
843 .round_rate = &omap2_clksel_round_rate,
844 .set_rate = &omap2_clksel_set_rate,
845};
846
847static struct clk dpll_per_m6x2_ck = {
848 .name = "dpll_per_m6x2_ck",
849 .parent = &dpll_per_x2_ck,
850 .clksel = dpll_per_m2x2_div,
851 .clksel_reg = OMAP4430_CM_DIV_M6_DPLL_PER,
852 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT3_DIV_MASK,
853 .ops = &clkops_omap4_dpllmx_ops,
854 .recalc = &omap2_clksel_recalc,
855 .round_rate = &omap2_clksel_round_rate,
856 .set_rate = &omap2_clksel_set_rate,
857};
858
859static struct clk dpll_per_m7x2_ck = {
860 .name = "dpll_per_m7x2_ck",
861 .parent = &dpll_per_x2_ck,
862 .clksel = dpll_per_m2x2_div,
863 .clksel_reg = OMAP4430_CM_DIV_M7_DPLL_PER,
864 .clksel_mask = OMAP4430_HSDIVIDER_CLKOUT4_DIV_MASK,
865 .ops = &clkops_omap4_dpllmx_ops,
866 .recalc = &omap2_clksel_recalc,
867 .round_rate = &omap2_clksel_round_rate,
868 .set_rate = &omap2_clksel_set_rate,
869};
870
871static struct clk usb_hs_clk_div_ck = {
872 .name = "usb_hs_clk_div_ck",
873 .parent = &dpll_abe_m3x2_ck,
874 .ops = &clkops_null,
875 .fixed_div = 3,
876 .recalc = &omap_fixed_divisor_recalc,
877};
878
879/* DPLL_USB */
880static struct dpll_data dpll_usb_dd = {
881 .mult_div1_reg = OMAP4430_CM_CLKSEL_DPLL_USB,
882 .clk_bypass = &usb_hs_clk_div_ck,
883 .flags = DPLL_J_TYPE,
884 .clk_ref = &sys_clkin_ck,
885 .control_reg = OMAP4430_CM_CLKMODE_DPLL_USB,
886 .modes = (1 << DPLL_LOW_POWER_BYPASS) | (1 << DPLL_LOCKED),
887 .autoidle_reg = OMAP4430_CM_AUTOIDLE_DPLL_USB,
888 .idlest_reg = OMAP4430_CM_IDLEST_DPLL_USB,
889 .mult_mask = OMAP4430_DPLL_MULT_USB_MASK,
890 .div1_mask = OMAP4430_DPLL_DIV_0_7_MASK,
891 .enable_mask = OMAP4430_DPLL_EN_MASK,
892 .autoidle_mask = OMAP4430_AUTO_DPLL_MODE_MASK,
893 .idlest_mask = OMAP4430_ST_DPLL_CLK_MASK,
894 .sddiv_mask = OMAP4430_DPLL_SD_DIV_MASK,
895 .max_multiplier = 4095,
896 .max_divider = 256,
897 .min_divider = 1,
898};
899
900
901static struct clk dpll_usb_ck = {
902 .name = "dpll_usb_ck",
903 .parent = &sys_clkin_ck,
904 .dpll_data = &dpll_usb_dd,
905 .init = &omap2_init_dpll_parent,
906 .ops = &clkops_omap3_noncore_dpll_ops,
907 .recalc = &omap3_dpll_recalc,
908 .round_rate = &omap2_dpll_round_rate,
909 .set_rate = &omap3_noncore_dpll_set_rate,
910 .clkdm_name = "l3_init_clkdm",
911};
912
913static struct clk dpll_usb_clkdcoldo_ck = {
914 .name = "dpll_usb_clkdcoldo_ck",
915 .parent = &dpll_usb_ck,
916 .clksel_reg = OMAP4430_CM_CLKDCOLDO_DPLL_USB,
917 .ops = &clkops_omap4_dpllmx_ops,
918 .recalc = &followparent_recalc,
919};
920
921static const struct clksel dpll_usb_m2_div[] = {
922 { .parent = &dpll_usb_ck, .rates = div31_1to31_rates },
923 { .parent = NULL },
924};
925
926static struct clk dpll_usb_m2_ck = {
927 .name = "dpll_usb_m2_ck",
928 .parent = &dpll_usb_ck,
929 .clksel = dpll_usb_m2_div,
930 .clksel_reg = OMAP4430_CM_DIV_M2_DPLL_USB,
931 .clksel_mask = OMAP4430_DPLL_CLKOUT_DIV_0_6_MASK,
932 .ops = &clkops_omap4_dpllmx_ops,
933 .recalc = &omap2_clksel_recalc,
934 .round_rate = &omap2_clksel_round_rate,
935 .set_rate = &omap2_clksel_set_rate,
936};
937
938static const struct clksel ducati_clk_mux_sel[] = {
939 { .parent = &div_core_ck, .rates = div_1_0_rates },
940 { .parent = &dpll_per_m6x2_ck, .rates = div_1_1_rates },
941 { .parent = NULL },
942};
943
944static struct clk ducati_clk_mux_ck = {
945 .name = "ducati_clk_mux_ck",
946 .parent = &div_core_ck,
947 .clksel = ducati_clk_mux_sel,
948 .init = &omap2_init_clksel_parent,
949 .clksel_reg = OMAP4430_CM_CLKSEL_DUCATI_ISS_ROOT,
950 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
951 .ops = &clkops_null,
952 .recalc = &omap2_clksel_recalc,
953};
954
955static struct clk func_12m_fclk = {
956 .name = "func_12m_fclk",
957 .parent = &dpll_per_m2x2_ck,
958 .ops = &clkops_null,
959 .fixed_div = 16,
960 .recalc = &omap_fixed_divisor_recalc,
961};
962
963static struct clk func_24m_clk = {
964 .name = "func_24m_clk",
965 .parent = &dpll_per_m2_ck,
966 .ops = &clkops_null,
967 .fixed_div = 4,
968 .recalc = &omap_fixed_divisor_recalc,
969};
970
971static struct clk func_24mc_fclk = {
972 .name = "func_24mc_fclk",
973 .parent = &dpll_per_m2x2_ck,
974 .ops = &clkops_null,
975 .fixed_div = 8,
976 .recalc = &omap_fixed_divisor_recalc,
977};
978
979static const struct clksel_rate div2_4to8_rates[] = {
980 { .div = 4, .val = 0, .flags = RATE_IN_4430 },
981 { .div = 8, .val = 1, .flags = RATE_IN_4430 },
982 { .div = 0 },
983};
984
985static const struct clksel func_48m_fclk_div[] = {
986 { .parent = &dpll_per_m2x2_ck, .rates = div2_4to8_rates },
987 { .parent = NULL },
988};
989
990static struct clk func_48m_fclk = {
991 .name = "func_48m_fclk",
992 .parent = &dpll_per_m2x2_ck,
993 .clksel = func_48m_fclk_div,
994 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
995 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
996 .ops = &clkops_null,
997 .recalc = &omap2_clksel_recalc,
998 .round_rate = &omap2_clksel_round_rate,
999 .set_rate = &omap2_clksel_set_rate,
1000};
1001
1002static struct clk func_48mc_fclk = {
1003 .name = "func_48mc_fclk",
1004 .parent = &dpll_per_m2x2_ck,
1005 .ops = &clkops_null,
1006 .fixed_div = 4,
1007 .recalc = &omap_fixed_divisor_recalc,
1008};
1009
1010static const struct clksel_rate div2_2to4_rates[] = {
1011 { .div = 2, .val = 0, .flags = RATE_IN_4430 },
1012 { .div = 4, .val = 1, .flags = RATE_IN_4430 },
1013 { .div = 0 },
1014};
1015
1016static const struct clksel func_64m_fclk_div[] = {
1017 { .parent = &dpll_per_m4x2_ck, .rates = div2_2to4_rates },
1018 { .parent = NULL },
1019};
1020
1021static struct clk func_64m_fclk = {
1022 .name = "func_64m_fclk",
1023 .parent = &dpll_per_m4x2_ck,
1024 .clksel = func_64m_fclk_div,
1025 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1026 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1027 .ops = &clkops_null,
1028 .recalc = &omap2_clksel_recalc,
1029 .round_rate = &omap2_clksel_round_rate,
1030 .set_rate = &omap2_clksel_set_rate,
1031};
1032
1033static const struct clksel func_96m_fclk_div[] = {
1034 { .parent = &dpll_per_m2x2_ck, .rates = div2_2to4_rates },
1035 { .parent = NULL },
1036};
1037
1038static struct clk func_96m_fclk = {
1039 .name = "func_96m_fclk",
1040 .parent = &dpll_per_m2x2_ck,
1041 .clksel = func_96m_fclk_div,
1042 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1043 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1044 .ops = &clkops_null,
1045 .recalc = &omap2_clksel_recalc,
1046 .round_rate = &omap2_clksel_round_rate,
1047 .set_rate = &omap2_clksel_set_rate,
1048};
1049
1050static const struct clksel_rate div2_1to8_rates[] = {
1051 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
1052 { .div = 8, .val = 1, .flags = RATE_IN_4430 },
1053 { .div = 0 },
1054};
1055
1056static const struct clksel init_60m_fclk_div[] = {
1057 { .parent = &dpll_usb_m2_ck, .rates = div2_1to8_rates },
1058 { .parent = NULL },
1059};
1060
1061static struct clk init_60m_fclk = {
1062 .name = "init_60m_fclk",
1063 .parent = &dpll_usb_m2_ck,
1064 .clksel = init_60m_fclk_div,
1065 .clksel_reg = OMAP4430_CM_CLKSEL_USB_60MHZ,
1066 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1067 .ops = &clkops_null,
1068 .recalc = &omap2_clksel_recalc,
1069 .round_rate = &omap2_clksel_round_rate,
1070 .set_rate = &omap2_clksel_set_rate,
1071};
1072
1073static const struct clksel l3_div_div[] = {
1074 { .parent = &div_core_ck, .rates = div2_1to2_rates },
1075 { .parent = NULL },
1076};
1077
1078static struct clk l3_div_ck = {
1079 .name = "l3_div_ck",
1080 .parent = &div_core_ck,
1081 .clkdm_name = "cm_clkdm",
1082 .clksel = l3_div_div,
1083 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1084 .clksel_mask = OMAP4430_CLKSEL_L3_MASK,
1085 .ops = &clkops_null,
1086 .recalc = &omap2_clksel_recalc,
1087 .round_rate = &omap2_clksel_round_rate,
1088 .set_rate = &omap2_clksel_set_rate,
1089};
1090
1091static const struct clksel l4_div_div[] = {
1092 { .parent = &l3_div_ck, .rates = div2_1to2_rates },
1093 { .parent = NULL },
1094};
1095
1096static struct clk l4_div_ck = {
1097 .name = "l4_div_ck",
1098 .parent = &l3_div_ck,
1099 .clksel = l4_div_div,
1100 .clksel_reg = OMAP4430_CM_CLKSEL_CORE,
1101 .clksel_mask = OMAP4430_CLKSEL_L4_MASK,
1102 .ops = &clkops_null,
1103 .recalc = &omap2_clksel_recalc,
1104 .round_rate = &omap2_clksel_round_rate,
1105 .set_rate = &omap2_clksel_set_rate,
1106};
1107
1108static struct clk lp_clk_div_ck = {
1109 .name = "lp_clk_div_ck",
1110 .parent = &dpll_abe_m2x2_ck,
1111 .ops = &clkops_null,
1112 .fixed_div = 16,
1113 .recalc = &omap_fixed_divisor_recalc,
1114};
1115
1116static const struct clksel l4_wkup_clk_mux_sel[] = {
1117 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1118 { .parent = &lp_clk_div_ck, .rates = div_1_1_rates },
1119 { .parent = NULL },
1120};
1121
1122static struct clk l4_wkup_clk_mux_ck = {
1123 .name = "l4_wkup_clk_mux_ck",
1124 .parent = &sys_clkin_ck,
1125 .clksel = l4_wkup_clk_mux_sel,
1126 .init = &omap2_init_clksel_parent,
1127 .clksel_reg = OMAP4430_CM_L4_WKUP_CLKSEL,
1128 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1129 .ops = &clkops_null,
1130 .recalc = &omap2_clksel_recalc,
1131};
1132
1133static const struct clksel_rate div2_2to1_rates[] = {
1134 { .div = 1, .val = 1, .flags = RATE_IN_4430 },
1135 { .div = 2, .val = 0, .flags = RATE_IN_4430 },
1136 { .div = 0 },
1137};
1138
1139static const struct clksel ocp_abe_iclk_div[] = {
1140 { .parent = &aess_fclk, .rates = div2_2to1_rates },
1141 { .parent = NULL },
1142};
1143
1144static struct clk mpu_periphclk = {
1145 .name = "mpu_periphclk",
1146 .parent = &dpll_mpu_ck,
1147 .ops = &clkops_null,
1148 .fixed_div = 2,
1149 .recalc = &omap_fixed_divisor_recalc,
1150};
1151
1152static struct clk ocp_abe_iclk = {
1153 .name = "ocp_abe_iclk",
1154 .parent = &aess_fclk,
1155 .clksel = ocp_abe_iclk_div,
1156 .clksel_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
1157 .clksel_mask = OMAP4430_CLKSEL_AESS_FCLK_MASK,
1158 .ops = &clkops_null,
1159 .recalc = &omap2_clksel_recalc,
1160};
1161
1162static struct clk per_abe_24m_fclk = {
1163 .name = "per_abe_24m_fclk",
1164 .parent = &dpll_abe_m2_ck,
1165 .ops = &clkops_null,
1166 .fixed_div = 4,
1167 .recalc = &omap_fixed_divisor_recalc,
1168};
1169
1170static const struct clksel per_abe_nc_fclk_div[] = {
1171 { .parent = &dpll_abe_m2_ck, .rates = div2_1to2_rates },
1172 { .parent = NULL },
1173};
1174
1175static struct clk per_abe_nc_fclk = {
1176 .name = "per_abe_nc_fclk",
1177 .parent = &dpll_abe_m2_ck,
1178 .clksel = per_abe_nc_fclk_div,
1179 .clksel_reg = OMAP4430_CM_SCALE_FCLK,
1180 .clksel_mask = OMAP4430_SCALE_FCLK_MASK,
1181 .ops = &clkops_null,
1182 .recalc = &omap2_clksel_recalc,
1183 .round_rate = &omap2_clksel_round_rate,
1184 .set_rate = &omap2_clksel_set_rate,
1185};
1186
1187static const struct clksel pmd_stm_clock_mux_sel[] = {
1188 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
1189 { .parent = &dpll_core_m6x2_ck, .rates = div_1_1_rates },
1190 { .parent = &tie_low_clock_ck, .rates = div_1_2_rates },
1191 { .parent = NULL },
1192};
1193
1194static struct clk pmd_stm_clock_mux_ck = {
1195 .name = "pmd_stm_clock_mux_ck",
1196 .parent = &sys_clkin_ck,
1197 .ops = &clkops_null,
1198 .recalc = &followparent_recalc,
1199};
1200
1201static struct clk pmd_trace_clk_mux_ck = {
1202 .name = "pmd_trace_clk_mux_ck",
1203 .parent = &sys_clkin_ck,
1204 .ops = &clkops_null,
1205 .recalc = &followparent_recalc,
1206};
1207
1208static const struct clksel syc_clk_div_div[] = {
1209 { .parent = &sys_clkin_ck, .rates = div2_1to2_rates },
1210 { .parent = NULL },
1211};
1212
1213static struct clk syc_clk_div_ck = {
1214 .name = "syc_clk_div_ck",
1215 .parent = &sys_clkin_ck,
1216 .clksel = syc_clk_div_div,
1217 .clksel_reg = OMAP4430_CM_ABE_DSS_SYS_CLKSEL,
1218 .clksel_mask = OMAP4430_CLKSEL_0_0_MASK,
1219 .ops = &clkops_null,
1220 .recalc = &omap2_clksel_recalc,
1221 .round_rate = &omap2_clksel_round_rate,
1222 .set_rate = &omap2_clksel_set_rate,
1223};
1224
1225/* Leaf clocks controlled by modules */
1226
1227static struct clk aes1_fck = {
1228 .name = "aes1_fck",
1229 .ops = &clkops_omap2_dflt,
1230 .enable_reg = OMAP4430_CM_L4SEC_AES1_CLKCTRL,
1231 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1232 .clkdm_name = "l4_secure_clkdm",
1233 .parent = &l3_div_ck,
1234 .recalc = &followparent_recalc,
1235};
1236
1237static struct clk aes2_fck = {
1238 .name = "aes2_fck",
1239 .ops = &clkops_omap2_dflt,
1240 .enable_reg = OMAP4430_CM_L4SEC_AES2_CLKCTRL,
1241 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1242 .clkdm_name = "l4_secure_clkdm",
1243 .parent = &l3_div_ck,
1244 .recalc = &followparent_recalc,
1245};
1246
1247static struct clk aess_fck = {
1248 .name = "aess_fck",
1249 .ops = &clkops_omap2_dflt,
1250 .enable_reg = OMAP4430_CM1_ABE_AESS_CLKCTRL,
1251 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1252 .clkdm_name = "abe_clkdm",
1253 .parent = &aess_fclk,
1254 .recalc = &followparent_recalc,
1255};
1256
1257static struct clk bandgap_fclk = {
1258 .name = "bandgap_fclk",
1259 .ops = &clkops_omap2_dflt,
1260 .enable_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1261 .enable_bit = OMAP4430_OPTFCLKEN_BGAP_32K_SHIFT,
1262 .clkdm_name = "l4_wkup_clkdm",
1263 .parent = &sys_32k_ck,
1264 .recalc = &followparent_recalc,
1265};
1266
1267static struct clk des3des_fck = {
1268 .name = "des3des_fck",
1269 .ops = &clkops_omap2_dflt,
1270 .enable_reg = OMAP4430_CM_L4SEC_DES3DES_CLKCTRL,
1271 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1272 .clkdm_name = "l4_secure_clkdm",
1273 .parent = &l4_div_ck,
1274 .recalc = &followparent_recalc,
1275};
1276
1277static const struct clksel dmic_sync_mux_sel[] = {
1278 { .parent = &abe_24m_fclk, .rates = div_1_0_rates },
1279 { .parent = &syc_clk_div_ck, .rates = div_1_1_rates },
1280 { .parent = &func_24m_clk, .rates = div_1_2_rates },
1281 { .parent = NULL },
1282};
1283
1284static struct clk dmic_sync_mux_ck = {
1285 .name = "dmic_sync_mux_ck",
1286 .parent = &abe_24m_fclk,
1287 .clksel = dmic_sync_mux_sel,
1288 .init = &omap2_init_clksel_parent,
1289 .clksel_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1290 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1291 .ops = &clkops_null,
1292 .recalc = &omap2_clksel_recalc,
1293};
1294
1295static const struct clksel func_dmic_abe_gfclk_sel[] = {
1296 { .parent = &dmic_sync_mux_ck, .rates = div_1_0_rates },
1297 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1298 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1299 { .parent = NULL },
1300};
1301
1302/* Merged func_dmic_abe_gfclk into dmic */
1303static struct clk dmic_fck = {
1304 .name = "dmic_fck",
1305 .parent = &dmic_sync_mux_ck,
1306 .clksel = func_dmic_abe_gfclk_sel,
1307 .init = &omap2_init_clksel_parent,
1308 .clksel_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1309 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1310 .ops = &clkops_omap2_dflt,
1311 .recalc = &omap2_clksel_recalc,
1312 .enable_reg = OMAP4430_CM1_ABE_DMIC_CLKCTRL,
1313 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1314 .clkdm_name = "abe_clkdm",
1315};
1316
1317static struct clk dsp_fck = {
1318 .name = "dsp_fck",
1319 .ops = &clkops_omap2_dflt,
1320 .enable_reg = OMAP4430_CM_TESLA_TESLA_CLKCTRL,
1321 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1322 .clkdm_name = "tesla_clkdm",
1323 .parent = &dpll_iva_m4x2_ck,
1324 .recalc = &followparent_recalc,
1325};
1326
1327static struct clk dss_sys_clk = {
1328 .name = "dss_sys_clk",
1329 .ops = &clkops_omap2_dflt,
1330 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1331 .enable_bit = OMAP4430_OPTFCLKEN_SYS_CLK_SHIFT,
1332 .clkdm_name = "l3_dss_clkdm",
1333 .parent = &syc_clk_div_ck,
1334 .recalc = &followparent_recalc,
1335};
1336
1337static struct clk dss_tv_clk = {
1338 .name = "dss_tv_clk",
1339 .ops = &clkops_omap2_dflt,
1340 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1341 .enable_bit = OMAP4430_OPTFCLKEN_TV_CLK_SHIFT,
1342 .clkdm_name = "l3_dss_clkdm",
1343 .parent = &extalt_clkin_ck,
1344 .recalc = &followparent_recalc,
1345};
1346
1347static struct clk dss_dss_clk = {
1348 .name = "dss_dss_clk",
1349 .ops = &clkops_omap2_dflt,
1350 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1351 .enable_bit = OMAP4430_OPTFCLKEN_DSSCLK_SHIFT,
1352 .clkdm_name = "l3_dss_clkdm",
1353 .parent = &dpll_per_m5x2_ck,
1354 .recalc = &followparent_recalc,
1355};
1356
1357static const struct clksel_rate div3_8to32_rates[] = {
1358 { .div = 8, .val = 0, .flags = RATE_IN_4460 },
1359 { .div = 16, .val = 1, .flags = RATE_IN_4460 },
1360 { .div = 32, .val = 2, .flags = RATE_IN_4460 },
1361 { .div = 0 },
1362};
1363
1364static const struct clksel div_ts_div[] = {
1365 { .parent = &l4_wkup_clk_mux_ck, .rates = div3_8to32_rates },
1366 { .parent = NULL },
1367};
1368
1369static struct clk div_ts_ck = {
1370 .name = "div_ts_ck",
1371 .parent = &l4_wkup_clk_mux_ck,
1372 .clksel = div_ts_div,
1373 .clksel_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1374 .clksel_mask = OMAP4430_CLKSEL_24_25_MASK,
1375 .ops = &clkops_null,
1376 .recalc = &omap2_clksel_recalc,
1377 .round_rate = &omap2_clksel_round_rate,
1378 .set_rate = &omap2_clksel_set_rate,
1379};
1380
1381static struct clk bandgap_ts_fclk = {
1382 .name = "bandgap_ts_fclk",
1383 .ops = &clkops_omap2_dflt,
1384 .enable_reg = OMAP4430_CM_WKUP_BANDGAP_CLKCTRL,
1385 .enable_bit = OMAP4460_OPTFCLKEN_TS_FCLK_SHIFT,
1386 .clkdm_name = "l4_wkup_clkdm",
1387 .parent = &div_ts_ck,
1388 .recalc = &followparent_recalc,
1389};
1390
1391static struct clk dss_48mhz_clk = {
1392 .name = "dss_48mhz_clk",
1393 .ops = &clkops_omap2_dflt,
1394 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1395 .enable_bit = OMAP4430_OPTFCLKEN_48MHZ_CLK_SHIFT,
1396 .clkdm_name = "l3_dss_clkdm",
1397 .parent = &func_48mc_fclk,
1398 .recalc = &followparent_recalc,
1399};
1400
1401static struct clk dss_fck = {
1402 .name = "dss_fck",
1403 .ops = &clkops_omap2_dflt,
1404 .enable_reg = OMAP4430_CM_DSS_DSS_CLKCTRL,
1405 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1406 .clkdm_name = "l3_dss_clkdm",
1407 .parent = &l3_div_ck,
1408 .recalc = &followparent_recalc,
1409};
1410
1411static struct clk efuse_ctrl_cust_fck = {
1412 .name = "efuse_ctrl_cust_fck",
1413 .ops = &clkops_omap2_dflt,
1414 .enable_reg = OMAP4430_CM_CEFUSE_CEFUSE_CLKCTRL,
1415 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1416 .clkdm_name = "l4_cefuse_clkdm",
1417 .parent = &sys_clkin_ck,
1418 .recalc = &followparent_recalc,
1419};
1420
1421static struct clk emif1_fck = {
1422 .name = "emif1_fck",
1423 .ops = &clkops_omap2_dflt,
1424 .enable_reg = OMAP4430_CM_MEMIF_EMIF_1_CLKCTRL,
1425 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1426 .flags = ENABLE_ON_INIT,
1427 .clkdm_name = "l3_emif_clkdm",
1428 .parent = &ddrphy_ck,
1429 .recalc = &followparent_recalc,
1430};
1431
1432static struct clk emif2_fck = {
1433 .name = "emif2_fck",
1434 .ops = &clkops_omap2_dflt,
1435 .enable_reg = OMAP4430_CM_MEMIF_EMIF_2_CLKCTRL,
1436 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1437 .flags = ENABLE_ON_INIT,
1438 .clkdm_name = "l3_emif_clkdm",
1439 .parent = &ddrphy_ck,
1440 .recalc = &followparent_recalc,
1441};
1442
1443static const struct clksel fdif_fclk_div[] = {
1444 { .parent = &dpll_per_m4x2_ck, .rates = div3_1to4_rates },
1445 { .parent = NULL },
1446};
1447
1448/* Merged fdif_fclk into fdif */
1449static struct clk fdif_fck = {
1450 .name = "fdif_fck",
1451 .parent = &dpll_per_m4x2_ck,
1452 .clksel = fdif_fclk_div,
1453 .clksel_reg = OMAP4430_CM_CAM_FDIF_CLKCTRL,
1454 .clksel_mask = OMAP4430_CLKSEL_FCLK_MASK,
1455 .ops = &clkops_omap2_dflt,
1456 .recalc = &omap2_clksel_recalc,
1457 .round_rate = &omap2_clksel_round_rate,
1458 .set_rate = &omap2_clksel_set_rate,
1459 .enable_reg = OMAP4430_CM_CAM_FDIF_CLKCTRL,
1460 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1461 .clkdm_name = "iss_clkdm",
1462};
1463
1464static struct clk fpka_fck = {
1465 .name = "fpka_fck",
1466 .ops = &clkops_omap2_dflt,
1467 .enable_reg = OMAP4430_CM_L4SEC_PKAEIP29_CLKCTRL,
1468 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1469 .clkdm_name = "l4_secure_clkdm",
1470 .parent = &l4_div_ck,
1471 .recalc = &followparent_recalc,
1472};
1473
1474static struct clk gpio1_dbclk = {
1475 .name = "gpio1_dbclk",
1476 .ops = &clkops_omap2_dflt,
1477 .enable_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
1478 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1479 .clkdm_name = "l4_wkup_clkdm",
1480 .parent = &sys_32k_ck,
1481 .recalc = &followparent_recalc,
1482};
1483
1484static struct clk gpio1_ick = {
1485 .name = "gpio1_ick",
1486 .ops = &clkops_omap2_dflt,
1487 .enable_reg = OMAP4430_CM_WKUP_GPIO1_CLKCTRL,
1488 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1489 .clkdm_name = "l4_wkup_clkdm",
1490 .parent = &l4_wkup_clk_mux_ck,
1491 .recalc = &followparent_recalc,
1492};
1493
1494static struct clk gpio2_dbclk = {
1495 .name = "gpio2_dbclk",
1496 .ops = &clkops_omap2_dflt,
1497 .enable_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
1498 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1499 .clkdm_name = "l4_per_clkdm",
1500 .parent = &sys_32k_ck,
1501 .recalc = &followparent_recalc,
1502};
1503
1504static struct clk gpio2_ick = {
1505 .name = "gpio2_ick",
1506 .ops = &clkops_omap2_dflt,
1507 .enable_reg = OMAP4430_CM_L4PER_GPIO2_CLKCTRL,
1508 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1509 .clkdm_name = "l4_per_clkdm",
1510 .parent = &l4_div_ck,
1511 .recalc = &followparent_recalc,
1512};
1513
1514static struct clk gpio3_dbclk = {
1515 .name = "gpio3_dbclk",
1516 .ops = &clkops_omap2_dflt,
1517 .enable_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
1518 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1519 .clkdm_name = "l4_per_clkdm",
1520 .parent = &sys_32k_ck,
1521 .recalc = &followparent_recalc,
1522};
1523
1524static struct clk gpio3_ick = {
1525 .name = "gpio3_ick",
1526 .ops = &clkops_omap2_dflt,
1527 .enable_reg = OMAP4430_CM_L4PER_GPIO3_CLKCTRL,
1528 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1529 .clkdm_name = "l4_per_clkdm",
1530 .parent = &l4_div_ck,
1531 .recalc = &followparent_recalc,
1532};
1533
1534static struct clk gpio4_dbclk = {
1535 .name = "gpio4_dbclk",
1536 .ops = &clkops_omap2_dflt,
1537 .enable_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
1538 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1539 .clkdm_name = "l4_per_clkdm",
1540 .parent = &sys_32k_ck,
1541 .recalc = &followparent_recalc,
1542};
1543
1544static struct clk gpio4_ick = {
1545 .name = "gpio4_ick",
1546 .ops = &clkops_omap2_dflt,
1547 .enable_reg = OMAP4430_CM_L4PER_GPIO4_CLKCTRL,
1548 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1549 .clkdm_name = "l4_per_clkdm",
1550 .parent = &l4_div_ck,
1551 .recalc = &followparent_recalc,
1552};
1553
1554static struct clk gpio5_dbclk = {
1555 .name = "gpio5_dbclk",
1556 .ops = &clkops_omap2_dflt,
1557 .enable_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
1558 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1559 .clkdm_name = "l4_per_clkdm",
1560 .parent = &sys_32k_ck,
1561 .recalc = &followparent_recalc,
1562};
1563
1564static struct clk gpio5_ick = {
1565 .name = "gpio5_ick",
1566 .ops = &clkops_omap2_dflt,
1567 .enable_reg = OMAP4430_CM_L4PER_GPIO5_CLKCTRL,
1568 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1569 .clkdm_name = "l4_per_clkdm",
1570 .parent = &l4_div_ck,
1571 .recalc = &followparent_recalc,
1572};
1573
1574static struct clk gpio6_dbclk = {
1575 .name = "gpio6_dbclk",
1576 .ops = &clkops_omap2_dflt,
1577 .enable_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
1578 .enable_bit = OMAP4430_OPTFCLKEN_DBCLK_SHIFT,
1579 .clkdm_name = "l4_per_clkdm",
1580 .parent = &sys_32k_ck,
1581 .recalc = &followparent_recalc,
1582};
1583
1584static struct clk gpio6_ick = {
1585 .name = "gpio6_ick",
1586 .ops = &clkops_omap2_dflt,
1587 .enable_reg = OMAP4430_CM_L4PER_GPIO6_CLKCTRL,
1588 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1589 .clkdm_name = "l4_per_clkdm",
1590 .parent = &l4_div_ck,
1591 .recalc = &followparent_recalc,
1592};
1593
1594static struct clk gpmc_ick = {
1595 .name = "gpmc_ick",
1596 .ops = &clkops_omap2_dflt,
1597 .enable_reg = OMAP4430_CM_L3_2_GPMC_CLKCTRL,
1598 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1599 .flags = ENABLE_ON_INIT,
1600 .clkdm_name = "l3_2_clkdm",
1601 .parent = &l3_div_ck,
1602 .recalc = &followparent_recalc,
1603};
1604
1605static const struct clksel sgx_clk_mux_sel[] = {
1606 { .parent = &dpll_core_m7x2_ck, .rates = div_1_0_rates },
1607 { .parent = &dpll_per_m7x2_ck, .rates = div_1_1_rates },
1608 { .parent = NULL },
1609};
1610
1611/* Merged sgx_clk_mux into gpu */
1612static struct clk gpu_fck = {
1613 .name = "gpu_fck",
1614 .parent = &dpll_core_m7x2_ck,
1615 .clksel = sgx_clk_mux_sel,
1616 .init = &omap2_init_clksel_parent,
1617 .clksel_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1618 .clksel_mask = OMAP4430_CLKSEL_SGX_FCLK_MASK,
1619 .ops = &clkops_omap2_dflt,
1620 .recalc = &omap2_clksel_recalc,
1621 .enable_reg = OMAP4430_CM_GFX_GFX_CLKCTRL,
1622 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1623 .clkdm_name = "l3_gfx_clkdm",
1624};
1625
1626static struct clk hdq1w_fck = {
1627 .name = "hdq1w_fck",
1628 .ops = &clkops_omap2_dflt,
1629 .enable_reg = OMAP4430_CM_L4PER_HDQ1W_CLKCTRL,
1630 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1631 .clkdm_name = "l4_per_clkdm",
1632 .parent = &func_12m_fclk,
1633 .recalc = &followparent_recalc,
1634};
1635
1636static const struct clksel hsi_fclk_div[] = {
1637 { .parent = &dpll_per_m2x2_ck, .rates = div3_1to4_rates },
1638 { .parent = NULL },
1639};
1640
1641/* Merged hsi_fclk into hsi */
1642static struct clk hsi_fck = {
1643 .name = "hsi_fck",
1644 .parent = &dpll_per_m2x2_ck,
1645 .clksel = hsi_fclk_div,
1646 .clksel_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL,
1647 .clksel_mask = OMAP4430_CLKSEL_24_25_MASK,
1648 .ops = &clkops_omap2_dflt,
1649 .recalc = &omap2_clksel_recalc,
1650 .round_rate = &omap2_clksel_round_rate,
1651 .set_rate = &omap2_clksel_set_rate,
1652 .enable_reg = OMAP4430_CM_L3INIT_HSI_CLKCTRL,
1653 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1654 .clkdm_name = "l3_init_clkdm",
1655};
1656
1657static struct clk i2c1_fck = {
1658 .name = "i2c1_fck",
1659 .ops = &clkops_omap2_dflt,
1660 .enable_reg = OMAP4430_CM_L4PER_I2C1_CLKCTRL,
1661 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1662 .clkdm_name = "l4_per_clkdm",
1663 .parent = &func_96m_fclk,
1664 .recalc = &followparent_recalc,
1665};
1666
1667static struct clk i2c2_fck = {
1668 .name = "i2c2_fck",
1669 .ops = &clkops_omap2_dflt,
1670 .enable_reg = OMAP4430_CM_L4PER_I2C2_CLKCTRL,
1671 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1672 .clkdm_name = "l4_per_clkdm",
1673 .parent = &func_96m_fclk,
1674 .recalc = &followparent_recalc,
1675};
1676
1677static struct clk i2c3_fck = {
1678 .name = "i2c3_fck",
1679 .ops = &clkops_omap2_dflt,
1680 .enable_reg = OMAP4430_CM_L4PER_I2C3_CLKCTRL,
1681 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1682 .clkdm_name = "l4_per_clkdm",
1683 .parent = &func_96m_fclk,
1684 .recalc = &followparent_recalc,
1685};
1686
1687static struct clk i2c4_fck = {
1688 .name = "i2c4_fck",
1689 .ops = &clkops_omap2_dflt,
1690 .enable_reg = OMAP4430_CM_L4PER_I2C4_CLKCTRL,
1691 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1692 .clkdm_name = "l4_per_clkdm",
1693 .parent = &func_96m_fclk,
1694 .recalc = &followparent_recalc,
1695};
1696
1697static struct clk ipu_fck = {
1698 .name = "ipu_fck",
1699 .ops = &clkops_omap2_dflt,
1700 .enable_reg = OMAP4430_CM_DUCATI_DUCATI_CLKCTRL,
1701 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1702 .clkdm_name = "ducati_clkdm",
1703 .parent = &ducati_clk_mux_ck,
1704 .recalc = &followparent_recalc,
1705};
1706
1707static struct clk iss_ctrlclk = {
1708 .name = "iss_ctrlclk",
1709 .ops = &clkops_omap2_dflt,
1710 .enable_reg = OMAP4430_CM_CAM_ISS_CLKCTRL,
1711 .enable_bit = OMAP4430_OPTFCLKEN_CTRLCLK_SHIFT,
1712 .clkdm_name = "iss_clkdm",
1713 .parent = &func_96m_fclk,
1714 .recalc = &followparent_recalc,
1715};
1716
1717static struct clk iss_fck = {
1718 .name = "iss_fck",
1719 .ops = &clkops_omap2_dflt,
1720 .enable_reg = OMAP4430_CM_CAM_ISS_CLKCTRL,
1721 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1722 .clkdm_name = "iss_clkdm",
1723 .parent = &ducati_clk_mux_ck,
1724 .recalc = &followparent_recalc,
1725};
1726
1727static struct clk iva_fck = {
1728 .name = "iva_fck",
1729 .ops = &clkops_omap2_dflt,
1730 .enable_reg = OMAP4430_CM_IVAHD_IVAHD_CLKCTRL,
1731 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1732 .clkdm_name = "ivahd_clkdm",
1733 .parent = &dpll_iva_m5x2_ck,
1734 .recalc = &followparent_recalc,
1735};
1736
1737static struct clk kbd_fck = {
1738 .name = "kbd_fck",
1739 .ops = &clkops_omap2_dflt,
1740 .enable_reg = OMAP4430_CM_WKUP_KEYBOARD_CLKCTRL,
1741 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1742 .clkdm_name = "l4_wkup_clkdm",
1743 .parent = &sys_32k_ck,
1744 .recalc = &followparent_recalc,
1745};
1746
1747static struct clk l3_instr_ick = {
1748 .name = "l3_instr_ick",
1749 .ops = &clkops_omap2_dflt,
1750 .enable_reg = OMAP4430_CM_L3INSTR_L3_INSTR_CLKCTRL,
1751 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1752 .flags = ENABLE_ON_INIT,
1753 .clkdm_name = "l3_instr_clkdm",
1754 .parent = &l3_div_ck,
1755 .recalc = &followparent_recalc,
1756};
1757
1758static struct clk l3_main_3_ick = {
1759 .name = "l3_main_3_ick",
1760 .ops = &clkops_omap2_dflt,
1761 .enable_reg = OMAP4430_CM_L3INSTR_L3_3_CLKCTRL,
1762 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
1763 .flags = ENABLE_ON_INIT,
1764 .clkdm_name = "l3_instr_clkdm",
1765 .parent = &l3_div_ck,
1766 .recalc = &followparent_recalc,
1767};
1768
1769static struct clk mcasp_sync_mux_ck = {
1770 .name = "mcasp_sync_mux_ck",
1771 .parent = &abe_24m_fclk,
1772 .clksel = dmic_sync_mux_sel,
1773 .init = &omap2_init_clksel_parent,
1774 .clksel_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1775 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1776 .ops = &clkops_null,
1777 .recalc = &omap2_clksel_recalc,
1778};
1779
1780static const struct clksel func_mcasp_abe_gfclk_sel[] = {
1781 { .parent = &mcasp_sync_mux_ck, .rates = div_1_0_rates },
1782 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1783 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1784 { .parent = NULL },
1785};
1786
1787/* Merged func_mcasp_abe_gfclk into mcasp */
1788static struct clk mcasp_fck = {
1789 .name = "mcasp_fck",
1790 .parent = &mcasp_sync_mux_ck,
1791 .clksel = func_mcasp_abe_gfclk_sel,
1792 .init = &omap2_init_clksel_parent,
1793 .clksel_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1794 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1795 .ops = &clkops_omap2_dflt,
1796 .recalc = &omap2_clksel_recalc,
1797 .enable_reg = OMAP4430_CM1_ABE_MCASP_CLKCTRL,
1798 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1799 .clkdm_name = "abe_clkdm",
1800};
1801
1802static struct clk mcbsp1_sync_mux_ck = {
1803 .name = "mcbsp1_sync_mux_ck",
1804 .parent = &abe_24m_fclk,
1805 .clksel = dmic_sync_mux_sel,
1806 .init = &omap2_init_clksel_parent,
1807 .clksel_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1808 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1809 .ops = &clkops_null,
1810 .recalc = &omap2_clksel_recalc,
1811};
1812
1813static const struct clksel func_mcbsp1_gfclk_sel[] = {
1814 { .parent = &mcbsp1_sync_mux_ck, .rates = div_1_0_rates },
1815 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1816 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1817 { .parent = NULL },
1818};
1819
1820/* Merged func_mcbsp1_gfclk into mcbsp1 */
1821static struct clk mcbsp1_fck = {
1822 .name = "mcbsp1_fck",
1823 .parent = &mcbsp1_sync_mux_ck,
1824 .clksel = func_mcbsp1_gfclk_sel,
1825 .init = &omap2_init_clksel_parent,
1826 .clksel_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1827 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1828 .ops = &clkops_omap2_dflt,
1829 .recalc = &omap2_clksel_recalc,
1830 .enable_reg = OMAP4430_CM1_ABE_MCBSP1_CLKCTRL,
1831 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1832 .clkdm_name = "abe_clkdm",
1833};
1834
1835static struct clk mcbsp2_sync_mux_ck = {
1836 .name = "mcbsp2_sync_mux_ck",
1837 .parent = &abe_24m_fclk,
1838 .clksel = dmic_sync_mux_sel,
1839 .init = &omap2_init_clksel_parent,
1840 .clksel_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1841 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1842 .ops = &clkops_null,
1843 .recalc = &omap2_clksel_recalc,
1844};
1845
1846static const struct clksel func_mcbsp2_gfclk_sel[] = {
1847 { .parent = &mcbsp2_sync_mux_ck, .rates = div_1_0_rates },
1848 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1849 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1850 { .parent = NULL },
1851};
1852
1853/* Merged func_mcbsp2_gfclk into mcbsp2 */
1854static struct clk mcbsp2_fck = {
1855 .name = "mcbsp2_fck",
1856 .parent = &mcbsp2_sync_mux_ck,
1857 .clksel = func_mcbsp2_gfclk_sel,
1858 .init = &omap2_init_clksel_parent,
1859 .clksel_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1860 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1861 .ops = &clkops_omap2_dflt,
1862 .recalc = &omap2_clksel_recalc,
1863 .enable_reg = OMAP4430_CM1_ABE_MCBSP2_CLKCTRL,
1864 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1865 .clkdm_name = "abe_clkdm",
1866};
1867
1868static struct clk mcbsp3_sync_mux_ck = {
1869 .name = "mcbsp3_sync_mux_ck",
1870 .parent = &abe_24m_fclk,
1871 .clksel = dmic_sync_mux_sel,
1872 .init = &omap2_init_clksel_parent,
1873 .clksel_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1874 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1875 .ops = &clkops_null,
1876 .recalc = &omap2_clksel_recalc,
1877};
1878
1879static const struct clksel func_mcbsp3_gfclk_sel[] = {
1880 { .parent = &mcbsp3_sync_mux_ck, .rates = div_1_0_rates },
1881 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1882 { .parent = &slimbus_clk, .rates = div_1_2_rates },
1883 { .parent = NULL },
1884};
1885
1886/* Merged func_mcbsp3_gfclk into mcbsp3 */
1887static struct clk mcbsp3_fck = {
1888 .name = "mcbsp3_fck",
1889 .parent = &mcbsp3_sync_mux_ck,
1890 .clksel = func_mcbsp3_gfclk_sel,
1891 .init = &omap2_init_clksel_parent,
1892 .clksel_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1893 .clksel_mask = OMAP4430_CLKSEL_SOURCE_MASK,
1894 .ops = &clkops_omap2_dflt,
1895 .recalc = &omap2_clksel_recalc,
1896 .enable_reg = OMAP4430_CM1_ABE_MCBSP3_CLKCTRL,
1897 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1898 .clkdm_name = "abe_clkdm",
1899};
1900
1901static const struct clksel mcbsp4_sync_mux_sel[] = {
1902 { .parent = &func_96m_fclk, .rates = div_1_0_rates },
1903 { .parent = &per_abe_nc_fclk, .rates = div_1_1_rates },
1904 { .parent = NULL },
1905};
1906
1907static struct clk mcbsp4_sync_mux_ck = {
1908 .name = "mcbsp4_sync_mux_ck",
1909 .parent = &func_96m_fclk,
1910 .clksel = mcbsp4_sync_mux_sel,
1911 .init = &omap2_init_clksel_parent,
1912 .clksel_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1913 .clksel_mask = OMAP4430_CLKSEL_INTERNAL_SOURCE_MASK,
1914 .ops = &clkops_null,
1915 .recalc = &omap2_clksel_recalc,
1916};
1917
1918static const struct clksel per_mcbsp4_gfclk_sel[] = {
1919 { .parent = &mcbsp4_sync_mux_ck, .rates = div_1_0_rates },
1920 { .parent = &pad_clks_ck, .rates = div_1_1_rates },
1921 { .parent = NULL },
1922};
1923
1924/* Merged per_mcbsp4_gfclk into mcbsp4 */
1925static struct clk mcbsp4_fck = {
1926 .name = "mcbsp4_fck",
1927 .parent = &mcbsp4_sync_mux_ck,
1928 .clksel = per_mcbsp4_gfclk_sel,
1929 .init = &omap2_init_clksel_parent,
1930 .clksel_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1931 .clksel_mask = OMAP4430_CLKSEL_SOURCE_24_24_MASK,
1932 .ops = &clkops_omap2_dflt,
1933 .recalc = &omap2_clksel_recalc,
1934 .enable_reg = OMAP4430_CM_L4PER_MCBSP4_CLKCTRL,
1935 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1936 .clkdm_name = "l4_per_clkdm",
1937};
1938
1939static struct clk mcpdm_fck = {
1940 .name = "mcpdm_fck",
1941 .ops = &clkops_omap2_dflt,
1942 .enable_reg = OMAP4430_CM1_ABE_PDM_CLKCTRL,
1943 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1944 .clkdm_name = "abe_clkdm",
1945 .parent = &pad_clks_ck,
1946 .recalc = &followparent_recalc,
1947};
1948
1949static struct clk mcspi1_fck = {
1950 .name = "mcspi1_fck",
1951 .ops = &clkops_omap2_dflt,
1952 .enable_reg = OMAP4430_CM_L4PER_MCSPI1_CLKCTRL,
1953 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1954 .clkdm_name = "l4_per_clkdm",
1955 .parent = &func_48m_fclk,
1956 .recalc = &followparent_recalc,
1957};
1958
1959static struct clk mcspi2_fck = {
1960 .name = "mcspi2_fck",
1961 .ops = &clkops_omap2_dflt,
1962 .enable_reg = OMAP4430_CM_L4PER_MCSPI2_CLKCTRL,
1963 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1964 .clkdm_name = "l4_per_clkdm",
1965 .parent = &func_48m_fclk,
1966 .recalc = &followparent_recalc,
1967};
1968
1969static struct clk mcspi3_fck = {
1970 .name = "mcspi3_fck",
1971 .ops = &clkops_omap2_dflt,
1972 .enable_reg = OMAP4430_CM_L4PER_MCSPI3_CLKCTRL,
1973 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1974 .clkdm_name = "l4_per_clkdm",
1975 .parent = &func_48m_fclk,
1976 .recalc = &followparent_recalc,
1977};
1978
1979static struct clk mcspi4_fck = {
1980 .name = "mcspi4_fck",
1981 .ops = &clkops_omap2_dflt,
1982 .enable_reg = OMAP4430_CM_L4PER_MCSPI4_CLKCTRL,
1983 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
1984 .clkdm_name = "l4_per_clkdm",
1985 .parent = &func_48m_fclk,
1986 .recalc = &followparent_recalc,
1987};
1988
1989static const struct clksel hsmmc1_fclk_sel[] = {
1990 { .parent = &func_64m_fclk, .rates = div_1_0_rates },
1991 { .parent = &func_96m_fclk, .rates = div_1_1_rates },
1992 { .parent = NULL },
1993};
1994
1995/* Merged hsmmc1_fclk into mmc1 */
1996static struct clk mmc1_fck = {
1997 .name = "mmc1_fck",
1998 .parent = &func_64m_fclk,
1999 .clksel = hsmmc1_fclk_sel,
2000 .init = &omap2_init_clksel_parent,
2001 .clksel_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
2002 .clksel_mask = OMAP4430_CLKSEL_MASK,
2003 .ops = &clkops_omap2_dflt,
2004 .recalc = &omap2_clksel_recalc,
2005 .enable_reg = OMAP4430_CM_L3INIT_MMC1_CLKCTRL,
2006 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2007 .clkdm_name = "l3_init_clkdm",
2008};
2009
2010/* Merged hsmmc2_fclk into mmc2 */
2011static struct clk mmc2_fck = {
2012 .name = "mmc2_fck",
2013 .parent = &func_64m_fclk,
2014 .clksel = hsmmc1_fclk_sel,
2015 .init = &omap2_init_clksel_parent,
2016 .clksel_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
2017 .clksel_mask = OMAP4430_CLKSEL_MASK,
2018 .ops = &clkops_omap2_dflt,
2019 .recalc = &omap2_clksel_recalc,
2020 .enable_reg = OMAP4430_CM_L3INIT_MMC2_CLKCTRL,
2021 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2022 .clkdm_name = "l3_init_clkdm",
2023};
2024
2025static struct clk mmc3_fck = {
2026 .name = "mmc3_fck",
2027 .ops = &clkops_omap2_dflt,
2028 .enable_reg = OMAP4430_CM_L4PER_MMCSD3_CLKCTRL,
2029 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2030 .clkdm_name = "l4_per_clkdm",
2031 .parent = &func_48m_fclk,
2032 .recalc = &followparent_recalc,
2033};
2034
2035static struct clk mmc4_fck = {
2036 .name = "mmc4_fck",
2037 .ops = &clkops_omap2_dflt,
2038 .enable_reg = OMAP4430_CM_L4PER_MMCSD4_CLKCTRL,
2039 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2040 .clkdm_name = "l4_per_clkdm",
2041 .parent = &func_48m_fclk,
2042 .recalc = &followparent_recalc,
2043};
2044
2045static struct clk mmc5_fck = {
2046 .name = "mmc5_fck",
2047 .ops = &clkops_omap2_dflt,
2048 .enable_reg = OMAP4430_CM_L4PER_MMCSD5_CLKCTRL,
2049 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2050 .clkdm_name = "l4_per_clkdm",
2051 .parent = &func_48m_fclk,
2052 .recalc = &followparent_recalc,
2053};
2054
2055static struct clk ocp2scp_usb_phy_phy_48m = {
2056 .name = "ocp2scp_usb_phy_phy_48m",
2057 .ops = &clkops_omap2_dflt,
2058 .enable_reg = OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
2059 .enable_bit = OMAP4430_OPTFCLKEN_PHY_48M_SHIFT,
2060 .clkdm_name = "l3_init_clkdm",
2061 .parent = &func_48m_fclk,
2062 .recalc = &followparent_recalc,
2063};
2064
2065static struct clk ocp2scp_usb_phy_ick = {
2066 .name = "ocp2scp_usb_phy_ick",
2067 .ops = &clkops_omap2_dflt,
2068 .enable_reg = OMAP4430_CM_L3INIT_USBPHYOCP2SCP_CLKCTRL,
2069 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2070 .clkdm_name = "l3_init_clkdm",
2071 .parent = &l4_div_ck,
2072 .recalc = &followparent_recalc,
2073};
2074
2075static struct clk ocp_wp_noc_ick = {
2076 .name = "ocp_wp_noc_ick",
2077 .ops = &clkops_omap2_dflt,
2078 .enable_reg = OMAP4430_CM_L3INSTR_OCP_WP1_CLKCTRL,
2079 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2080 .flags = ENABLE_ON_INIT,
2081 .clkdm_name = "l3_instr_clkdm",
2082 .parent = &l3_div_ck,
2083 .recalc = &followparent_recalc,
2084};
2085
2086static struct clk rng_ick = {
2087 .name = "rng_ick",
2088 .ops = &clkops_omap2_dflt,
2089 .enable_reg = OMAP4430_CM_L4SEC_RNG_CLKCTRL,
2090 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2091 .clkdm_name = "l4_secure_clkdm",
2092 .parent = &l4_div_ck,
2093 .recalc = &followparent_recalc,
2094};
2095
2096static struct clk sha2md5_fck = {
2097 .name = "sha2md5_fck",
2098 .ops = &clkops_omap2_dflt,
2099 .enable_reg = OMAP4430_CM_L4SEC_SHA2MD51_CLKCTRL,
2100 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2101 .clkdm_name = "l4_secure_clkdm",
2102 .parent = &l3_div_ck,
2103 .recalc = &followparent_recalc,
2104};
2105
2106static struct clk sl2if_ick = {
2107 .name = "sl2if_ick",
2108 .ops = &clkops_omap2_dflt,
2109 .enable_reg = OMAP4430_CM_IVAHD_SL2_CLKCTRL,
2110 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2111 .clkdm_name = "ivahd_clkdm",
2112 .parent = &dpll_iva_m5x2_ck,
2113 .recalc = &followparent_recalc,
2114};
2115
2116static struct clk slimbus1_fclk_1 = {
2117 .name = "slimbus1_fclk_1",
2118 .ops = &clkops_omap2_dflt,
2119 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2120 .enable_bit = OMAP4430_OPTFCLKEN_FCLK1_SHIFT,
2121 .clkdm_name = "abe_clkdm",
2122 .parent = &func_24m_clk,
2123 .recalc = &followparent_recalc,
2124};
2125
2126static struct clk slimbus1_fclk_0 = {
2127 .name = "slimbus1_fclk_0",
2128 .ops = &clkops_omap2_dflt,
2129 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2130 .enable_bit = OMAP4430_OPTFCLKEN_FCLK0_SHIFT,
2131 .clkdm_name = "abe_clkdm",
2132 .parent = &abe_24m_fclk,
2133 .recalc = &followparent_recalc,
2134};
2135
2136static struct clk slimbus1_fclk_2 = {
2137 .name = "slimbus1_fclk_2",
2138 .ops = &clkops_omap2_dflt,
2139 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2140 .enable_bit = OMAP4430_OPTFCLKEN_FCLK2_SHIFT,
2141 .clkdm_name = "abe_clkdm",
2142 .parent = &pad_clks_ck,
2143 .recalc = &followparent_recalc,
2144};
2145
2146static struct clk slimbus1_slimbus_clk = {
2147 .name = "slimbus1_slimbus_clk",
2148 .ops = &clkops_omap2_dflt,
2149 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2150 .enable_bit = OMAP4430_OPTFCLKEN_SLIMBUS_CLK_11_11_SHIFT,
2151 .clkdm_name = "abe_clkdm",
2152 .parent = &slimbus_clk,
2153 .recalc = &followparent_recalc,
2154};
2155
2156static struct clk slimbus1_fck = {
2157 .name = "slimbus1_fck",
2158 .ops = &clkops_omap2_dflt,
2159 .enable_reg = OMAP4430_CM1_ABE_SLIMBUS_CLKCTRL,
2160 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2161 .clkdm_name = "abe_clkdm",
2162 .parent = &ocp_abe_iclk,
2163 .recalc = &followparent_recalc,
2164};
2165
2166static struct clk slimbus2_fclk_1 = {
2167 .name = "slimbus2_fclk_1",
2168 .ops = &clkops_omap2_dflt,
2169 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2170 .enable_bit = OMAP4430_OPTFCLKEN_PERABE24M_GFCLK_SHIFT,
2171 .clkdm_name = "l4_per_clkdm",
2172 .parent = &per_abe_24m_fclk,
2173 .recalc = &followparent_recalc,
2174};
2175
2176static struct clk slimbus2_fclk_0 = {
2177 .name = "slimbus2_fclk_0",
2178 .ops = &clkops_omap2_dflt,
2179 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2180 .enable_bit = OMAP4430_OPTFCLKEN_PER24MC_GFCLK_SHIFT,
2181 .clkdm_name = "l4_per_clkdm",
2182 .parent = &func_24mc_fclk,
2183 .recalc = &followparent_recalc,
2184};
2185
2186static struct clk slimbus2_slimbus_clk = {
2187 .name = "slimbus2_slimbus_clk",
2188 .ops = &clkops_omap2_dflt,
2189 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2190 .enable_bit = OMAP4430_OPTFCLKEN_SLIMBUS_CLK_SHIFT,
2191 .clkdm_name = "l4_per_clkdm",
2192 .parent = &pad_slimbus_core_clks_ck,
2193 .recalc = &followparent_recalc,
2194};
2195
2196static struct clk slimbus2_fck = {
2197 .name = "slimbus2_fck",
2198 .ops = &clkops_omap2_dflt,
2199 .enable_reg = OMAP4430_CM_L4PER_SLIMBUS2_CLKCTRL,
2200 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2201 .clkdm_name = "l4_per_clkdm",
2202 .parent = &l4_div_ck,
2203 .recalc = &followparent_recalc,
2204};
2205
2206static struct clk smartreflex_core_fck = {
2207 .name = "smartreflex_core_fck",
2208 .ops = &clkops_omap2_dflt,
2209 .enable_reg = OMAP4430_CM_ALWON_SR_CORE_CLKCTRL,
2210 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2211 .clkdm_name = "l4_ao_clkdm",
2212 .parent = &l4_wkup_clk_mux_ck,
2213 .recalc = &followparent_recalc,
2214};
2215
2216static struct clk smartreflex_iva_fck = {
2217 .name = "smartreflex_iva_fck",
2218 .ops = &clkops_omap2_dflt,
2219 .enable_reg = OMAP4430_CM_ALWON_SR_IVA_CLKCTRL,
2220 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2221 .clkdm_name = "l4_ao_clkdm",
2222 .parent = &l4_wkup_clk_mux_ck,
2223 .recalc = &followparent_recalc,
2224};
2225
2226static struct clk smartreflex_mpu_fck = {
2227 .name = "smartreflex_mpu_fck",
2228 .ops = &clkops_omap2_dflt,
2229 .enable_reg = OMAP4430_CM_ALWON_SR_MPU_CLKCTRL,
2230 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2231 .clkdm_name = "l4_ao_clkdm",
2232 .parent = &l4_wkup_clk_mux_ck,
2233 .recalc = &followparent_recalc,
2234};
2235
2236/* Merged dmt1_clk_mux into timer1 */
2237static struct clk timer1_fck = {
2238 .name = "timer1_fck",
2239 .parent = &sys_clkin_ck,
2240 .clksel = abe_dpll_bypass_clk_mux_sel,
2241 .init = &omap2_init_clksel_parent,
2242 .clksel_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
2243 .clksel_mask = OMAP4430_CLKSEL_MASK,
2244 .ops = &clkops_omap2_dflt,
2245 .recalc = &omap2_clksel_recalc,
2246 .enable_reg = OMAP4430_CM_WKUP_TIMER1_CLKCTRL,
2247 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2248 .clkdm_name = "l4_wkup_clkdm",
2249};
2250
2251/* Merged cm2_dm10_mux into timer10 */
2252static struct clk timer10_fck = {
2253 .name = "timer10_fck",
2254 .parent = &sys_clkin_ck,
2255 .clksel = abe_dpll_bypass_clk_mux_sel,
2256 .init = &omap2_init_clksel_parent,
2257 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
2258 .clksel_mask = OMAP4430_CLKSEL_MASK,
2259 .ops = &clkops_omap2_dflt,
2260 .recalc = &omap2_clksel_recalc,
2261 .enable_reg = OMAP4430_CM_L4PER_DMTIMER10_CLKCTRL,
2262 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2263 .clkdm_name = "l4_per_clkdm",
2264};
2265
2266/* Merged cm2_dm11_mux into timer11 */
2267static struct clk timer11_fck = {
2268 .name = "timer11_fck",
2269 .parent = &sys_clkin_ck,
2270 .clksel = abe_dpll_bypass_clk_mux_sel,
2271 .init = &omap2_init_clksel_parent,
2272 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
2273 .clksel_mask = OMAP4430_CLKSEL_MASK,
2274 .ops = &clkops_omap2_dflt,
2275 .recalc = &omap2_clksel_recalc,
2276 .enable_reg = OMAP4430_CM_L4PER_DMTIMER11_CLKCTRL,
2277 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2278 .clkdm_name = "l4_per_clkdm",
2279};
2280
2281/* Merged cm2_dm2_mux into timer2 */
2282static struct clk timer2_fck = {
2283 .name = "timer2_fck",
2284 .parent = &sys_clkin_ck,
2285 .clksel = abe_dpll_bypass_clk_mux_sel,
2286 .init = &omap2_init_clksel_parent,
2287 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
2288 .clksel_mask = OMAP4430_CLKSEL_MASK,
2289 .ops = &clkops_omap2_dflt,
2290 .recalc = &omap2_clksel_recalc,
2291 .enable_reg = OMAP4430_CM_L4PER_DMTIMER2_CLKCTRL,
2292 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2293 .clkdm_name = "l4_per_clkdm",
2294};
2295
2296/* Merged cm2_dm3_mux into timer3 */
2297static struct clk timer3_fck = {
2298 .name = "timer3_fck",
2299 .parent = &sys_clkin_ck,
2300 .clksel = abe_dpll_bypass_clk_mux_sel,
2301 .init = &omap2_init_clksel_parent,
2302 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
2303 .clksel_mask = OMAP4430_CLKSEL_MASK,
2304 .ops = &clkops_omap2_dflt,
2305 .recalc = &omap2_clksel_recalc,
2306 .enable_reg = OMAP4430_CM_L4PER_DMTIMER3_CLKCTRL,
2307 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2308 .clkdm_name = "l4_per_clkdm",
2309};
2310
2311/* Merged cm2_dm4_mux into timer4 */
2312static struct clk timer4_fck = {
2313 .name = "timer4_fck",
2314 .parent = &sys_clkin_ck,
2315 .clksel = abe_dpll_bypass_clk_mux_sel,
2316 .init = &omap2_init_clksel_parent,
2317 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
2318 .clksel_mask = OMAP4430_CLKSEL_MASK,
2319 .ops = &clkops_omap2_dflt,
2320 .recalc = &omap2_clksel_recalc,
2321 .enable_reg = OMAP4430_CM_L4PER_DMTIMER4_CLKCTRL,
2322 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2323 .clkdm_name = "l4_per_clkdm",
2324};
2325
2326static const struct clksel timer5_sync_mux_sel[] = {
2327 { .parent = &syc_clk_div_ck, .rates = div_1_0_rates },
2328 { .parent = &sys_32k_ck, .rates = div_1_1_rates },
2329 { .parent = NULL },
2330};
2331
2332/* Merged timer5_sync_mux into timer5 */
2333static struct clk timer5_fck = {
2334 .name = "timer5_fck",
2335 .parent = &syc_clk_div_ck,
2336 .clksel = timer5_sync_mux_sel,
2337 .init = &omap2_init_clksel_parent,
2338 .clksel_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
2339 .clksel_mask = OMAP4430_CLKSEL_MASK,
2340 .ops = &clkops_omap2_dflt,
2341 .recalc = &omap2_clksel_recalc,
2342 .enable_reg = OMAP4430_CM1_ABE_TIMER5_CLKCTRL,
2343 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2344 .clkdm_name = "abe_clkdm",
2345};
2346
2347/* Merged timer6_sync_mux into timer6 */
2348static struct clk timer6_fck = {
2349 .name = "timer6_fck",
2350 .parent = &syc_clk_div_ck,
2351 .clksel = timer5_sync_mux_sel,
2352 .init = &omap2_init_clksel_parent,
2353 .clksel_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
2354 .clksel_mask = OMAP4430_CLKSEL_MASK,
2355 .ops = &clkops_omap2_dflt,
2356 .recalc = &omap2_clksel_recalc,
2357 .enable_reg = OMAP4430_CM1_ABE_TIMER6_CLKCTRL,
2358 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2359 .clkdm_name = "abe_clkdm",
2360};
2361
2362/* Merged timer7_sync_mux into timer7 */
2363static struct clk timer7_fck = {
2364 .name = "timer7_fck",
2365 .parent = &syc_clk_div_ck,
2366 .clksel = timer5_sync_mux_sel,
2367 .init = &omap2_init_clksel_parent,
2368 .clksel_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
2369 .clksel_mask = OMAP4430_CLKSEL_MASK,
2370 .ops = &clkops_omap2_dflt,
2371 .recalc = &omap2_clksel_recalc,
2372 .enable_reg = OMAP4430_CM1_ABE_TIMER7_CLKCTRL,
2373 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2374 .clkdm_name = "abe_clkdm",
2375};
2376
2377/* Merged timer8_sync_mux into timer8 */
2378static struct clk timer8_fck = {
2379 .name = "timer8_fck",
2380 .parent = &syc_clk_div_ck,
2381 .clksel = timer5_sync_mux_sel,
2382 .init = &omap2_init_clksel_parent,
2383 .clksel_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
2384 .clksel_mask = OMAP4430_CLKSEL_MASK,
2385 .ops = &clkops_omap2_dflt,
2386 .recalc = &omap2_clksel_recalc,
2387 .enable_reg = OMAP4430_CM1_ABE_TIMER8_CLKCTRL,
2388 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2389 .clkdm_name = "abe_clkdm",
2390};
2391
2392/* Merged cm2_dm9_mux into timer9 */
2393static struct clk timer9_fck = {
2394 .name = "timer9_fck",
2395 .parent = &sys_clkin_ck,
2396 .clksel = abe_dpll_bypass_clk_mux_sel,
2397 .init = &omap2_init_clksel_parent,
2398 .clksel_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
2399 .clksel_mask = OMAP4430_CLKSEL_MASK,
2400 .ops = &clkops_omap2_dflt,
2401 .recalc = &omap2_clksel_recalc,
2402 .enable_reg = OMAP4430_CM_L4PER_DMTIMER9_CLKCTRL,
2403 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2404 .clkdm_name = "l4_per_clkdm",
2405};
2406
2407static struct clk uart1_fck = {
2408 .name = "uart1_fck",
2409 .ops = &clkops_omap2_dflt,
2410 .enable_reg = OMAP4430_CM_L4PER_UART1_CLKCTRL,
2411 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2412 .clkdm_name = "l4_per_clkdm",
2413 .parent = &func_48m_fclk,
2414 .recalc = &followparent_recalc,
2415};
2416
2417static struct clk uart2_fck = {
2418 .name = "uart2_fck",
2419 .ops = &clkops_omap2_dflt,
2420 .enable_reg = OMAP4430_CM_L4PER_UART2_CLKCTRL,
2421 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2422 .clkdm_name = "l4_per_clkdm",
2423 .parent = &func_48m_fclk,
2424 .recalc = &followparent_recalc,
2425};
2426
2427static struct clk uart3_fck = {
2428 .name = "uart3_fck",
2429 .ops = &clkops_omap2_dflt,
2430 .enable_reg = OMAP4430_CM_L4PER_UART3_CLKCTRL,
2431 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2432 .clkdm_name = "l4_per_clkdm",
2433 .parent = &func_48m_fclk,
2434 .recalc = &followparent_recalc,
2435};
2436
2437static struct clk uart4_fck = {
2438 .name = "uart4_fck",
2439 .ops = &clkops_omap2_dflt,
2440 .enable_reg = OMAP4430_CM_L4PER_UART4_CLKCTRL,
2441 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2442 .clkdm_name = "l4_per_clkdm",
2443 .parent = &func_48m_fclk,
2444 .recalc = &followparent_recalc,
2445};
2446
2447static struct clk usb_host_fs_fck = {
2448 .name = "usb_host_fs_fck",
2449 .ops = &clkops_omap2_dflt,
2450 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_FS_CLKCTRL,
2451 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2452 .clkdm_name = "l3_init_clkdm",
2453 .parent = &func_48mc_fclk,
2454 .recalc = &followparent_recalc,
2455};
2456
2457static const struct clksel utmi_p1_gfclk_sel[] = {
2458 { .parent = &init_60m_fclk, .rates = div_1_0_rates },
2459 { .parent = &xclk60mhsp1_ck, .rates = div_1_1_rates },
2460 { .parent = NULL },
2461};
2462
2463static struct clk utmi_p1_gfclk = {
2464 .name = "utmi_p1_gfclk",
2465 .parent = &init_60m_fclk,
2466 .clksel = utmi_p1_gfclk_sel,
2467 .init = &omap2_init_clksel_parent,
2468 .clksel_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2469 .clksel_mask = OMAP4430_CLKSEL_UTMI_P1_MASK,
2470 .ops = &clkops_null,
2471 .recalc = &omap2_clksel_recalc,
2472};
2473
2474static struct clk usb_host_hs_utmi_p1_clk = {
2475 .name = "usb_host_hs_utmi_p1_clk",
2476 .ops = &clkops_omap2_dflt,
2477 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2478 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P1_CLK_SHIFT,
2479 .clkdm_name = "l3_init_clkdm",
2480 .parent = &utmi_p1_gfclk,
2481 .recalc = &followparent_recalc,
2482};
2483
2484static const struct clksel utmi_p2_gfclk_sel[] = {
2485 { .parent = &init_60m_fclk, .rates = div_1_0_rates },
2486 { .parent = &xclk60mhsp2_ck, .rates = div_1_1_rates },
2487 { .parent = NULL },
2488};
2489
2490static struct clk utmi_p2_gfclk = {
2491 .name = "utmi_p2_gfclk",
2492 .parent = &init_60m_fclk,
2493 .clksel = utmi_p2_gfclk_sel,
2494 .init = &omap2_init_clksel_parent,
2495 .clksel_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2496 .clksel_mask = OMAP4430_CLKSEL_UTMI_P2_MASK,
2497 .ops = &clkops_null,
2498 .recalc = &omap2_clksel_recalc,
2499};
2500
2501static struct clk usb_host_hs_utmi_p2_clk = {
2502 .name = "usb_host_hs_utmi_p2_clk",
2503 .ops = &clkops_omap2_dflt,
2504 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2505 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P2_CLK_SHIFT,
2506 .clkdm_name = "l3_init_clkdm",
2507 .parent = &utmi_p2_gfclk,
2508 .recalc = &followparent_recalc,
2509};
2510
2511static struct clk usb_host_hs_utmi_p3_clk = {
2512 .name = "usb_host_hs_utmi_p3_clk",
2513 .ops = &clkops_omap2_dflt,
2514 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2515 .enable_bit = OMAP4430_OPTFCLKEN_UTMI_P3_CLK_SHIFT,
2516 .clkdm_name = "l3_init_clkdm",
2517 .parent = &init_60m_fclk,
2518 .recalc = &followparent_recalc,
2519};
2520
2521static struct clk usb_host_hs_hsic480m_p1_clk = {
2522 .name = "usb_host_hs_hsic480m_p1_clk",
2523 .ops = &clkops_omap2_dflt,
2524 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2525 .enable_bit = OMAP4430_OPTFCLKEN_HSIC480M_P1_CLK_SHIFT,
2526 .clkdm_name = "l3_init_clkdm",
2527 .parent = &dpll_usb_m2_ck,
2528 .recalc = &followparent_recalc,
2529};
2530
2531static struct clk usb_host_hs_hsic60m_p1_clk = {
2532 .name = "usb_host_hs_hsic60m_p1_clk",
2533 .ops = &clkops_omap2_dflt,
2534 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2535 .enable_bit = OMAP4430_OPTFCLKEN_HSIC60M_P1_CLK_SHIFT,
2536 .clkdm_name = "l3_init_clkdm",
2537 .parent = &init_60m_fclk,
2538 .recalc = &followparent_recalc,
2539};
2540
2541static struct clk usb_host_hs_hsic60m_p2_clk = {
2542 .name = "usb_host_hs_hsic60m_p2_clk",
2543 .ops = &clkops_omap2_dflt,
2544 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2545 .enable_bit = OMAP4430_OPTFCLKEN_HSIC60M_P2_CLK_SHIFT,
2546 .clkdm_name = "l3_init_clkdm",
2547 .parent = &init_60m_fclk,
2548 .recalc = &followparent_recalc,
2549};
2550
2551static struct clk usb_host_hs_hsic480m_p2_clk = {
2552 .name = "usb_host_hs_hsic480m_p2_clk",
2553 .ops = &clkops_omap2_dflt,
2554 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2555 .enable_bit = OMAP4430_OPTFCLKEN_HSIC480M_P2_CLK_SHIFT,
2556 .clkdm_name = "l3_init_clkdm",
2557 .parent = &dpll_usb_m2_ck,
2558 .recalc = &followparent_recalc,
2559};
2560
2561static struct clk usb_host_hs_func48mclk = {
2562 .name = "usb_host_hs_func48mclk",
2563 .ops = &clkops_omap2_dflt,
2564 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2565 .enable_bit = OMAP4430_OPTFCLKEN_FUNC48MCLK_SHIFT,
2566 .clkdm_name = "l3_init_clkdm",
2567 .parent = &func_48mc_fclk,
2568 .recalc = &followparent_recalc,
2569};
2570
2571static struct clk usb_host_hs_fck = {
2572 .name = "usb_host_hs_fck",
2573 .ops = &clkops_omap2_dflt,
2574 .enable_reg = OMAP4430_CM_L3INIT_USB_HOST_CLKCTRL,
2575 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2576 .clkdm_name = "l3_init_clkdm",
2577 .parent = &init_60m_fclk,
2578 .recalc = &followparent_recalc,
2579};
2580
2581static const struct clksel otg_60m_gfclk_sel[] = {
2582 { .parent = &utmi_phy_clkout_ck, .rates = div_1_0_rates },
2583 { .parent = &xclk60motg_ck, .rates = div_1_1_rates },
2584 { .parent = NULL },
2585};
2586
2587static struct clk otg_60m_gfclk = {
2588 .name = "otg_60m_gfclk",
2589 .parent = &utmi_phy_clkout_ck,
2590 .clksel = otg_60m_gfclk_sel,
2591 .init = &omap2_init_clksel_parent,
2592 .clksel_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2593 .clksel_mask = OMAP4430_CLKSEL_60M_MASK,
2594 .ops = &clkops_null,
2595 .recalc = &omap2_clksel_recalc,
2596};
2597
2598static struct clk usb_otg_hs_xclk = {
2599 .name = "usb_otg_hs_xclk",
2600 .ops = &clkops_omap2_dflt,
2601 .enable_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2602 .enable_bit = OMAP4430_OPTFCLKEN_XCLK_SHIFT,
2603 .clkdm_name = "l3_init_clkdm",
2604 .parent = &otg_60m_gfclk,
2605 .recalc = &followparent_recalc,
2606};
2607
2608static struct clk usb_otg_hs_ick = {
2609 .name = "usb_otg_hs_ick",
2610 .ops = &clkops_omap2_dflt,
2611 .enable_reg = OMAP4430_CM_L3INIT_USB_OTG_CLKCTRL,
2612 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2613 .clkdm_name = "l3_init_clkdm",
2614 .parent = &l3_div_ck,
2615 .recalc = &followparent_recalc,
2616};
2617
2618static struct clk usb_phy_cm_clk32k = {
2619 .name = "usb_phy_cm_clk32k",
2620 .ops = &clkops_omap2_dflt,
2621 .enable_reg = OMAP4430_CM_ALWON_USBPHY_CLKCTRL,
2622 .enable_bit = OMAP4430_OPTFCLKEN_CLK32K_SHIFT,
2623 .clkdm_name = "l4_ao_clkdm",
2624 .parent = &sys_32k_ck,
2625 .recalc = &followparent_recalc,
2626};
2627
2628static struct clk usb_tll_hs_usb_ch2_clk = {
2629 .name = "usb_tll_hs_usb_ch2_clk",
2630 .ops = &clkops_omap2_dflt,
2631 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2632 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH2_CLK_SHIFT,
2633 .clkdm_name = "l3_init_clkdm",
2634 .parent = &init_60m_fclk,
2635 .recalc = &followparent_recalc,
2636};
2637
2638static struct clk usb_tll_hs_usb_ch0_clk = {
2639 .name = "usb_tll_hs_usb_ch0_clk",
2640 .ops = &clkops_omap2_dflt,
2641 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2642 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH0_CLK_SHIFT,
2643 .clkdm_name = "l3_init_clkdm",
2644 .parent = &init_60m_fclk,
2645 .recalc = &followparent_recalc,
2646};
2647
2648static struct clk usb_tll_hs_usb_ch1_clk = {
2649 .name = "usb_tll_hs_usb_ch1_clk",
2650 .ops = &clkops_omap2_dflt,
2651 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2652 .enable_bit = OMAP4430_OPTFCLKEN_USB_CH1_CLK_SHIFT,
2653 .clkdm_name = "l3_init_clkdm",
2654 .parent = &init_60m_fclk,
2655 .recalc = &followparent_recalc,
2656};
2657
2658static struct clk usb_tll_hs_ick = {
2659 .name = "usb_tll_hs_ick",
2660 .ops = &clkops_omap2_dflt,
2661 .enable_reg = OMAP4430_CM_L3INIT_USB_TLL_CLKCTRL,
2662 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2663 .clkdm_name = "l3_init_clkdm",
2664 .parent = &l4_div_ck,
2665 .recalc = &followparent_recalc,
2666};
2667
2668static const struct clksel_rate div2_14to18_rates[] = {
2669 { .div = 14, .val = 0, .flags = RATE_IN_4430 },
2670 { .div = 18, .val = 1, .flags = RATE_IN_4430 },
2671 { .div = 0 },
2672};
2673
2674static const struct clksel usim_fclk_div[] = {
2675 { .parent = &dpll_per_m4x2_ck, .rates = div2_14to18_rates },
2676 { .parent = NULL },
2677};
2678
2679static struct clk usim_ck = {
2680 .name = "usim_ck",
2681 .parent = &dpll_per_m4x2_ck,
2682 .clksel = usim_fclk_div,
2683 .clksel_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2684 .clksel_mask = OMAP4430_CLKSEL_DIV_MASK,
2685 .ops = &clkops_null,
2686 .recalc = &omap2_clksel_recalc,
2687 .round_rate = &omap2_clksel_round_rate,
2688 .set_rate = &omap2_clksel_set_rate,
2689};
2690
2691static struct clk usim_fclk = {
2692 .name = "usim_fclk",
2693 .ops = &clkops_omap2_dflt,
2694 .enable_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2695 .enable_bit = OMAP4430_OPTFCLKEN_FCLK_SHIFT,
2696 .clkdm_name = "l4_wkup_clkdm",
2697 .parent = &usim_ck,
2698 .recalc = &followparent_recalc,
2699};
2700
2701static struct clk usim_fck = {
2702 .name = "usim_fck",
2703 .ops = &clkops_omap2_dflt,
2704 .enable_reg = OMAP4430_CM_WKUP_USIM_CLKCTRL,
2705 .enable_bit = OMAP4430_MODULEMODE_HWCTRL,
2706 .clkdm_name = "l4_wkup_clkdm",
2707 .parent = &sys_32k_ck,
2708 .recalc = &followparent_recalc,
2709};
2710
2711static struct clk wd_timer2_fck = {
2712 .name = "wd_timer2_fck",
2713 .ops = &clkops_omap2_dflt,
2714 .enable_reg = OMAP4430_CM_WKUP_WDT2_CLKCTRL,
2715 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2716 .clkdm_name = "l4_wkup_clkdm",
2717 .parent = &sys_32k_ck,
2718 .recalc = &followparent_recalc,
2719};
2720
2721static struct clk wd_timer3_fck = {
2722 .name = "wd_timer3_fck",
2723 .ops = &clkops_omap2_dflt,
2724 .enable_reg = OMAP4430_CM1_ABE_WDT3_CLKCTRL,
2725 .enable_bit = OMAP4430_MODULEMODE_SWCTRL,
2726 .clkdm_name = "abe_clkdm",
2727 .parent = &sys_32k_ck,
2728 .recalc = &followparent_recalc,
2729};
2730
2731/* Remaining optional clocks */
2732static const struct clksel stm_clk_div_div[] = {
2733 { .parent = &pmd_stm_clock_mux_ck, .rates = div3_1to4_rates },
2734 { .parent = NULL },
2735};
2736
2737static struct clk stm_clk_div_ck = {
2738 .name = "stm_clk_div_ck",
2739 .parent = &pmd_stm_clock_mux_ck,
2740 .clksel = stm_clk_div_div,
2741 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2742 .clksel_mask = OMAP4430_CLKSEL_PMD_STM_CLK_MASK,
2743 .ops = &clkops_null,
2744 .recalc = &omap2_clksel_recalc,
2745 .round_rate = &omap2_clksel_round_rate,
2746 .set_rate = &omap2_clksel_set_rate,
2747};
2748
2749static const struct clksel trace_clk_div_div[] = {
2750 { .parent = &pmd_trace_clk_mux_ck, .rates = div3_1to4_rates },
2751 { .parent = NULL },
2752};
2753
2754static struct clk trace_clk_div_ck = {
2755 .name = "trace_clk_div_ck",
2756 .parent = &pmd_trace_clk_mux_ck,
2757 .clkdm_name = "emu_sys_clkdm",
2758 .clksel = trace_clk_div_div,
2759 .clksel_reg = OMAP4430_CM_EMU_DEBUGSS_CLKCTRL,
2760 .clksel_mask = OMAP4430_CLKSEL_PMD_TRACE_CLK_MASK,
2761 .ops = &clkops_null,
2762 .recalc = &omap2_clksel_recalc,
2763 .round_rate = &omap2_clksel_round_rate,
2764 .set_rate = &omap2_clksel_set_rate,
2765};
2766
2767/* SCRM aux clk nodes */
2768
2769static const struct clksel auxclk_src_sel[] = {
2770 { .parent = &sys_clkin_ck, .rates = div_1_0_rates },
2771 { .parent = &dpll_core_m3x2_ck, .rates = div_1_1_rates },
2772 { .parent = &dpll_per_m3x2_ck, .rates = div_1_2_rates },
2773 { .parent = NULL },
2774};
2775
2776static const struct clksel_rate div16_1to16_rates[] = {
2777 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
2778 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
2779 { .div = 3, .val = 2, .flags = RATE_IN_4430 },
2780 { .div = 4, .val = 3, .flags = RATE_IN_4430 },
2781 { .div = 5, .val = 4, .flags = RATE_IN_4430 },
2782 { .div = 6, .val = 5, .flags = RATE_IN_4430 },
2783 { .div = 7, .val = 6, .flags = RATE_IN_4430 },
2784 { .div = 8, .val = 7, .flags = RATE_IN_4430 },
2785 { .div = 9, .val = 8, .flags = RATE_IN_4430 },
2786 { .div = 10, .val = 9, .flags = RATE_IN_4430 },
2787 { .div = 11, .val = 10, .flags = RATE_IN_4430 },
2788 { .div = 12, .val = 11, .flags = RATE_IN_4430 },
2789 { .div = 13, .val = 12, .flags = RATE_IN_4430 },
2790 { .div = 14, .val = 13, .flags = RATE_IN_4430 },
2791 { .div = 15, .val = 14, .flags = RATE_IN_4430 },
2792 { .div = 16, .val = 15, .flags = RATE_IN_4430 },
2793 { .div = 0 },
2794};
2795
2796static struct clk auxclk0_src_ck = {
2797 .name = "auxclk0_src_ck",
2798 .parent = &sys_clkin_ck,
2799 .init = &omap2_init_clksel_parent,
2800 .ops = &clkops_omap2_dflt,
2801 .clksel = auxclk_src_sel,
2802 .clksel_reg = OMAP4_SCRM_AUXCLK0,
2803 .clksel_mask = OMAP4_SRCSELECT_MASK,
2804 .recalc = &omap2_clksel_recalc,
2805 .enable_reg = OMAP4_SCRM_AUXCLK0,
2806 .enable_bit = OMAP4_ENABLE_SHIFT,
2807};
2808
2809static const struct clksel auxclk0_sel[] = {
2810 { .parent = &auxclk0_src_ck, .rates = div16_1to16_rates },
2811 { .parent = NULL },
2812};
2813
2814static struct clk auxclk0_ck = {
2815 .name = "auxclk0_ck",
2816 .parent = &auxclk0_src_ck,
2817 .clksel = auxclk0_sel,
2818 .clksel_reg = OMAP4_SCRM_AUXCLK0,
2819 .clksel_mask = OMAP4_CLKDIV_MASK,
2820 .ops = &clkops_null,
2821 .recalc = &omap2_clksel_recalc,
2822 .round_rate = &omap2_clksel_round_rate,
2823 .set_rate = &omap2_clksel_set_rate,
2824};
2825
2826static struct clk auxclk1_src_ck = {
2827 .name = "auxclk1_src_ck",
2828 .parent = &sys_clkin_ck,
2829 .init = &omap2_init_clksel_parent,
2830 .ops = &clkops_omap2_dflt,
2831 .clksel = auxclk_src_sel,
2832 .clksel_reg = OMAP4_SCRM_AUXCLK1,
2833 .clksel_mask = OMAP4_SRCSELECT_MASK,
2834 .recalc = &omap2_clksel_recalc,
2835 .enable_reg = OMAP4_SCRM_AUXCLK1,
2836 .enable_bit = OMAP4_ENABLE_SHIFT,
2837};
2838
2839static const struct clksel auxclk1_sel[] = {
2840 { .parent = &auxclk1_src_ck, .rates = div16_1to16_rates },
2841 { .parent = NULL },
2842};
2843
2844static struct clk auxclk1_ck = {
2845 .name = "auxclk1_ck",
2846 .parent = &auxclk1_src_ck,
2847 .clksel = auxclk1_sel,
2848 .clksel_reg = OMAP4_SCRM_AUXCLK1,
2849 .clksel_mask = OMAP4_CLKDIV_MASK,
2850 .ops = &clkops_null,
2851 .recalc = &omap2_clksel_recalc,
2852 .round_rate = &omap2_clksel_round_rate,
2853 .set_rate = &omap2_clksel_set_rate,
2854};
2855
2856static struct clk auxclk2_src_ck = {
2857 .name = "auxclk2_src_ck",
2858 .parent = &sys_clkin_ck,
2859 .init = &omap2_init_clksel_parent,
2860 .ops = &clkops_omap2_dflt,
2861 .clksel = auxclk_src_sel,
2862 .clksel_reg = OMAP4_SCRM_AUXCLK2,
2863 .clksel_mask = OMAP4_SRCSELECT_MASK,
2864 .recalc = &omap2_clksel_recalc,
2865 .enable_reg = OMAP4_SCRM_AUXCLK2,
2866 .enable_bit = OMAP4_ENABLE_SHIFT,
2867};
2868
2869static const struct clksel auxclk2_sel[] = {
2870 { .parent = &auxclk2_src_ck, .rates = div16_1to16_rates },
2871 { .parent = NULL },
2872};
2873
2874static struct clk auxclk2_ck = {
2875 .name = "auxclk2_ck",
2876 .parent = &auxclk2_src_ck,
2877 .clksel = auxclk2_sel,
2878 .clksel_reg = OMAP4_SCRM_AUXCLK2,
2879 .clksel_mask = OMAP4_CLKDIV_MASK,
2880 .ops = &clkops_null,
2881 .recalc = &omap2_clksel_recalc,
2882 .round_rate = &omap2_clksel_round_rate,
2883 .set_rate = &omap2_clksel_set_rate,
2884};
2885
2886static struct clk auxclk3_src_ck = {
2887 .name = "auxclk3_src_ck",
2888 .parent = &sys_clkin_ck,
2889 .init = &omap2_init_clksel_parent,
2890 .ops = &clkops_omap2_dflt,
2891 .clksel = auxclk_src_sel,
2892 .clksel_reg = OMAP4_SCRM_AUXCLK3,
2893 .clksel_mask = OMAP4_SRCSELECT_MASK,
2894 .recalc = &omap2_clksel_recalc,
2895 .enable_reg = OMAP4_SCRM_AUXCLK3,
2896 .enable_bit = OMAP4_ENABLE_SHIFT,
2897};
2898
2899static const struct clksel auxclk3_sel[] = {
2900 { .parent = &auxclk3_src_ck, .rates = div16_1to16_rates },
2901 { .parent = NULL },
2902};
2903
2904static struct clk auxclk3_ck = {
2905 .name = "auxclk3_ck",
2906 .parent = &auxclk3_src_ck,
2907 .clksel = auxclk3_sel,
2908 .clksel_reg = OMAP4_SCRM_AUXCLK3,
2909 .clksel_mask = OMAP4_CLKDIV_MASK,
2910 .ops = &clkops_null,
2911 .recalc = &omap2_clksel_recalc,
2912 .round_rate = &omap2_clksel_round_rate,
2913 .set_rate = &omap2_clksel_set_rate,
2914};
2915
2916static struct clk auxclk4_src_ck = {
2917 .name = "auxclk4_src_ck",
2918 .parent = &sys_clkin_ck,
2919 .init = &omap2_init_clksel_parent,
2920 .ops = &clkops_omap2_dflt,
2921 .clksel = auxclk_src_sel,
2922 .clksel_reg = OMAP4_SCRM_AUXCLK4,
2923 .clksel_mask = OMAP4_SRCSELECT_MASK,
2924 .recalc = &omap2_clksel_recalc,
2925 .enable_reg = OMAP4_SCRM_AUXCLK4,
2926 .enable_bit = OMAP4_ENABLE_SHIFT,
2927};
2928
2929static const struct clksel auxclk4_sel[] = {
2930 { .parent = &auxclk4_src_ck, .rates = div16_1to16_rates },
2931 { .parent = NULL },
2932};
2933
2934static struct clk auxclk4_ck = {
2935 .name = "auxclk4_ck",
2936 .parent = &auxclk4_src_ck,
2937 .clksel = auxclk4_sel,
2938 .clksel_reg = OMAP4_SCRM_AUXCLK4,
2939 .clksel_mask = OMAP4_CLKDIV_MASK,
2940 .ops = &clkops_null,
2941 .recalc = &omap2_clksel_recalc,
2942 .round_rate = &omap2_clksel_round_rate,
2943 .set_rate = &omap2_clksel_set_rate,
2944};
2945
2946static struct clk auxclk5_src_ck = {
2947 .name = "auxclk5_src_ck",
2948 .parent = &sys_clkin_ck,
2949 .init = &omap2_init_clksel_parent,
2950 .ops = &clkops_omap2_dflt,
2951 .clksel = auxclk_src_sel,
2952 .clksel_reg = OMAP4_SCRM_AUXCLK5,
2953 .clksel_mask = OMAP4_SRCSELECT_MASK,
2954 .recalc = &omap2_clksel_recalc,
2955 .enable_reg = OMAP4_SCRM_AUXCLK5,
2956 .enable_bit = OMAP4_ENABLE_SHIFT,
2957};
2958
2959static const struct clksel auxclk5_sel[] = {
2960 { .parent = &auxclk5_src_ck, .rates = div16_1to16_rates },
2961 { .parent = NULL },
2962};
2963
2964static struct clk auxclk5_ck = {
2965 .name = "auxclk5_ck",
2966 .parent = &auxclk5_src_ck,
2967 .clksel = auxclk5_sel,
2968 .clksel_reg = OMAP4_SCRM_AUXCLK5,
2969 .clksel_mask = OMAP4_CLKDIV_MASK,
2970 .ops = &clkops_null,
2971 .recalc = &omap2_clksel_recalc,
2972 .round_rate = &omap2_clksel_round_rate,
2973 .set_rate = &omap2_clksel_set_rate,
2974};
2975
2976static const struct clksel auxclkreq_sel[] = {
2977 { .parent = &auxclk0_ck, .rates = div_1_0_rates },
2978 { .parent = &auxclk1_ck, .rates = div_1_1_rates },
2979 { .parent = &auxclk2_ck, .rates = div_1_2_rates },
2980 { .parent = &auxclk3_ck, .rates = div_1_3_rates },
2981 { .parent = &auxclk4_ck, .rates = div_1_4_rates },
2982 { .parent = &auxclk5_ck, .rates = div_1_5_rates },
2983 { .parent = NULL },
2984};
2985
2986static struct clk auxclkreq0_ck = {
2987 .name = "auxclkreq0_ck",
2988 .parent = &auxclk0_ck,
2989 .init = &omap2_init_clksel_parent,
2990 .ops = &clkops_null,
2991 .clksel = auxclkreq_sel,
2992 .clksel_reg = OMAP4_SCRM_AUXCLKREQ0,
2993 .clksel_mask = OMAP4_MAPPING_MASK,
2994 .recalc = &omap2_clksel_recalc,
2995};
2996
2997static struct clk auxclkreq1_ck = {
2998 .name = "auxclkreq1_ck",
2999 .parent = &auxclk1_ck,
3000 .init = &omap2_init_clksel_parent,
3001 .ops = &clkops_null,
3002 .clksel = auxclkreq_sel,
3003 .clksel_reg = OMAP4_SCRM_AUXCLKREQ1,
3004 .clksel_mask = OMAP4_MAPPING_MASK,
3005 .recalc = &omap2_clksel_recalc,
3006};
3007
3008static struct clk auxclkreq2_ck = {
3009 .name = "auxclkreq2_ck",
3010 .parent = &auxclk2_ck,
3011 .init = &omap2_init_clksel_parent,
3012 .ops = &clkops_null,
3013 .clksel = auxclkreq_sel,
3014 .clksel_reg = OMAP4_SCRM_AUXCLKREQ2,
3015 .clksel_mask = OMAP4_MAPPING_MASK,
3016 .recalc = &omap2_clksel_recalc,
3017};
3018
3019static struct clk auxclkreq3_ck = {
3020 .name = "auxclkreq3_ck",
3021 .parent = &auxclk3_ck,
3022 .init = &omap2_init_clksel_parent,
3023 .ops = &clkops_null,
3024 .clksel = auxclkreq_sel,
3025 .clksel_reg = OMAP4_SCRM_AUXCLKREQ3,
3026 .clksel_mask = OMAP4_MAPPING_MASK,
3027 .recalc = &omap2_clksel_recalc,
3028};
3029
3030static struct clk auxclkreq4_ck = {
3031 .name = "auxclkreq4_ck",
3032 .parent = &auxclk4_ck,
3033 .init = &omap2_init_clksel_parent,
3034 .ops = &clkops_null,
3035 .clksel = auxclkreq_sel,
3036 .clksel_reg = OMAP4_SCRM_AUXCLKREQ4,
3037 .clksel_mask = OMAP4_MAPPING_MASK,
3038 .recalc = &omap2_clksel_recalc,
3039};
3040
3041static struct clk auxclkreq5_ck = {
3042 .name = "auxclkreq5_ck",
3043 .parent = &auxclk5_ck,
3044 .init = &omap2_init_clksel_parent,
3045 .ops = &clkops_null,
3046 .clksel = auxclkreq_sel,
3047 .clksel_reg = OMAP4_SCRM_AUXCLKREQ5,
3048 .clksel_mask = OMAP4_MAPPING_MASK,
3049 .recalc = &omap2_clksel_recalc,
3050};
3051
3052/*
3053 * clkdev
3054 */
3055
3056static struct omap_clk omap44xx_clks[] = {
3057 CLK(NULL, "extalt_clkin_ck", &extalt_clkin_ck, CK_443X),
3058 CLK(NULL, "pad_clks_ck", &pad_clks_ck, CK_443X),
3059 CLK(NULL, "pad_slimbus_core_clks_ck", &pad_slimbus_core_clks_ck, CK_443X),
3060 CLK(NULL, "secure_32k_clk_src_ck", &secure_32k_clk_src_ck, CK_443X),
3061 CLK(NULL, "slimbus_clk", &slimbus_clk, CK_443X),
3062 CLK(NULL, "sys_32k_ck", &sys_32k_ck, CK_443X),
3063 CLK(NULL, "virt_12000000_ck", &virt_12000000_ck, CK_443X),
3064 CLK(NULL, "virt_13000000_ck", &virt_13000000_ck, CK_443X),
3065 CLK(NULL, "virt_16800000_ck", &virt_16800000_ck, CK_443X),
3066 CLK(NULL, "virt_19200000_ck", &virt_19200000_ck, CK_443X),
3067 CLK(NULL, "virt_26000000_ck", &virt_26000000_ck, CK_443X),
3068 CLK(NULL, "virt_27000000_ck", &virt_27000000_ck, CK_443X),
3069 CLK(NULL, "virt_38400000_ck", &virt_38400000_ck, CK_443X),
3070 CLK(NULL, "sys_clkin_ck", &sys_clkin_ck, CK_443X),
3071 CLK(NULL, "tie_low_clock_ck", &tie_low_clock_ck, CK_443X),
3072 CLK(NULL, "utmi_phy_clkout_ck", &utmi_phy_clkout_ck, CK_443X),
3073 CLK(NULL, "xclk60mhsp1_ck", &xclk60mhsp1_ck, CK_443X),
3074 CLK(NULL, "xclk60mhsp2_ck", &xclk60mhsp2_ck, CK_443X),
3075 CLK(NULL, "xclk60motg_ck", &xclk60motg_ck, CK_443X),
3076 CLK(NULL, "abe_dpll_bypass_clk_mux_ck", &abe_dpll_bypass_clk_mux_ck, CK_443X),
3077 CLK(NULL, "abe_dpll_refclk_mux_ck", &abe_dpll_refclk_mux_ck, CK_443X),
3078 CLK(NULL, "dpll_abe_ck", &dpll_abe_ck, CK_443X),
3079 CLK(NULL, "dpll_abe_x2_ck", &dpll_abe_x2_ck, CK_443X),
3080 CLK(NULL, "dpll_abe_m2x2_ck", &dpll_abe_m2x2_ck, CK_443X),
3081 CLK(NULL, "abe_24m_fclk", &abe_24m_fclk, CK_443X),
3082 CLK(NULL, "abe_clk", &abe_clk, CK_443X),
3083 CLK(NULL, "aess_fclk", &aess_fclk, CK_443X),
3084 CLK(NULL, "dpll_abe_m3x2_ck", &dpll_abe_m3x2_ck, CK_443X),
3085 CLK(NULL, "core_hsd_byp_clk_mux_ck", &core_hsd_byp_clk_mux_ck, CK_443X),
3086 CLK(NULL, "dpll_core_ck", &dpll_core_ck, CK_443X),
3087 CLK(NULL, "dpll_core_x2_ck", &dpll_core_x2_ck, CK_443X),
3088 CLK(NULL, "dpll_core_m6x2_ck", &dpll_core_m6x2_ck, CK_443X),
3089 CLK(NULL, "dbgclk_mux_ck", &dbgclk_mux_ck, CK_443X),
3090 CLK(NULL, "dpll_core_m2_ck", &dpll_core_m2_ck, CK_443X),
3091 CLK(NULL, "ddrphy_ck", &ddrphy_ck, CK_443X),
3092 CLK(NULL, "dpll_core_m5x2_ck", &dpll_core_m5x2_ck, CK_443X),
3093 CLK(NULL, "div_core_ck", &div_core_ck, CK_443X),
3094 CLK(NULL, "div_iva_hs_clk", &div_iva_hs_clk, CK_443X),
3095 CLK(NULL, "div_mpu_hs_clk", &div_mpu_hs_clk, CK_443X),
3096 CLK(NULL, "dpll_core_m4x2_ck", &dpll_core_m4x2_ck, CK_443X),
3097 CLK(NULL, "dll_clk_div_ck", &dll_clk_div_ck, CK_443X),
3098 CLK(NULL, "dpll_abe_m2_ck", &dpll_abe_m2_ck, CK_443X),
3099 CLK(NULL, "dpll_core_m3x2_ck", &dpll_core_m3x2_ck, CK_443X),
3100 CLK(NULL, "dpll_core_m7x2_ck", &dpll_core_m7x2_ck, CK_443X),
3101 CLK(NULL, "iva_hsd_byp_clk_mux_ck", &iva_hsd_byp_clk_mux_ck, CK_443X),
3102 CLK(NULL, "dpll_iva_ck", &dpll_iva_ck, CK_443X),
3103 CLK(NULL, "dpll_iva_x2_ck", &dpll_iva_x2_ck, CK_443X),
3104 CLK(NULL, "dpll_iva_m4x2_ck", &dpll_iva_m4x2_ck, CK_443X),
3105 CLK(NULL, "dpll_iva_m5x2_ck", &dpll_iva_m5x2_ck, CK_443X),
3106 CLK(NULL, "dpll_mpu_ck", &dpll_mpu_ck, CK_443X),
3107 CLK(NULL, "dpll_mpu_m2_ck", &dpll_mpu_m2_ck, CK_443X),
3108 CLK(NULL, "per_hs_clk_div_ck", &per_hs_clk_div_ck, CK_443X),
3109 CLK(NULL, "per_hsd_byp_clk_mux_ck", &per_hsd_byp_clk_mux_ck, CK_443X),
3110 CLK(NULL, "dpll_per_ck", &dpll_per_ck, CK_443X),
3111 CLK(NULL, "dpll_per_m2_ck", &dpll_per_m2_ck, CK_443X),
3112 CLK(NULL, "dpll_per_x2_ck", &dpll_per_x2_ck, CK_443X),
3113 CLK(NULL, "dpll_per_m2x2_ck", &dpll_per_m2x2_ck, CK_443X),
3114 CLK(NULL, "dpll_per_m3x2_ck", &dpll_per_m3x2_ck, CK_443X),
3115 CLK(NULL, "dpll_per_m4x2_ck", &dpll_per_m4x2_ck, CK_443X),
3116 CLK(NULL, "dpll_per_m5x2_ck", &dpll_per_m5x2_ck, CK_443X),
3117 CLK(NULL, "dpll_per_m6x2_ck", &dpll_per_m6x2_ck, CK_443X),
3118 CLK(NULL, "dpll_per_m7x2_ck", &dpll_per_m7x2_ck, CK_443X),
3119 CLK(NULL, "usb_hs_clk_div_ck", &usb_hs_clk_div_ck, CK_443X),
3120 CLK(NULL, "dpll_usb_ck", &dpll_usb_ck, CK_443X),
3121 CLK(NULL, "dpll_usb_clkdcoldo_ck", &dpll_usb_clkdcoldo_ck, CK_443X),
3122 CLK(NULL, "dpll_usb_m2_ck", &dpll_usb_m2_ck, CK_443X),
3123 CLK(NULL, "ducati_clk_mux_ck", &ducati_clk_mux_ck, CK_443X),
3124 CLK(NULL, "func_12m_fclk", &func_12m_fclk, CK_443X),
3125 CLK(NULL, "func_24m_clk", &func_24m_clk, CK_443X),
3126 CLK(NULL, "func_24mc_fclk", &func_24mc_fclk, CK_443X),
3127 CLK(NULL, "func_48m_fclk", &func_48m_fclk, CK_443X),
3128 CLK(NULL, "func_48mc_fclk", &func_48mc_fclk, CK_443X),
3129 CLK(NULL, "func_64m_fclk", &func_64m_fclk, CK_443X),
3130 CLK(NULL, "func_96m_fclk", &func_96m_fclk, CK_443X),
3131 CLK(NULL, "init_60m_fclk", &init_60m_fclk, CK_443X),
3132 CLK(NULL, "l3_div_ck", &l3_div_ck, CK_443X),
3133 CLK(NULL, "l4_div_ck", &l4_div_ck, CK_443X),
3134 CLK(NULL, "lp_clk_div_ck", &lp_clk_div_ck, CK_443X),
3135 CLK(NULL, "l4_wkup_clk_mux_ck", &l4_wkup_clk_mux_ck, CK_443X),
3136 CLK("smp_twd", NULL, &mpu_periphclk, CK_443X),
3137 CLK(NULL, "ocp_abe_iclk", &ocp_abe_iclk, CK_443X),
3138 CLK(NULL, "per_abe_24m_fclk", &per_abe_24m_fclk, CK_443X),
3139 CLK(NULL, "per_abe_nc_fclk", &per_abe_nc_fclk, CK_443X),
3140 CLK(NULL, "pmd_stm_clock_mux_ck", &pmd_stm_clock_mux_ck, CK_443X),
3141 CLK(NULL, "pmd_trace_clk_mux_ck", &pmd_trace_clk_mux_ck, CK_443X),
3142 CLK(NULL, "syc_clk_div_ck", &syc_clk_div_ck, CK_443X),
3143 CLK(NULL, "aes1_fck", &aes1_fck, CK_443X),
3144 CLK(NULL, "aes2_fck", &aes2_fck, CK_443X),
3145 CLK(NULL, "aess_fck", &aess_fck, CK_443X),
3146 CLK(NULL, "bandgap_fclk", &bandgap_fclk, CK_443X),
3147 CLK(NULL, "bandgap_ts_fclk", &bandgap_ts_fclk, CK_446X),
3148 CLK(NULL, "des3des_fck", &des3des_fck, CK_443X),
3149 CLK(NULL, "div_ts_ck", &div_ts_ck, CK_446X),
3150 CLK(NULL, "dmic_sync_mux_ck", &dmic_sync_mux_ck, CK_443X),
3151 CLK(NULL, "dmic_fck", &dmic_fck, CK_443X),
3152 CLK(NULL, "dsp_fck", &dsp_fck, CK_443X),
3153 CLK(NULL, "dss_sys_clk", &dss_sys_clk, CK_443X),
3154 CLK(NULL, "dss_tv_clk", &dss_tv_clk, CK_443X),
3155 CLK(NULL, "dss_48mhz_clk", &dss_48mhz_clk, CK_443X),
3156 CLK(NULL, "dss_dss_clk", &dss_dss_clk, CK_443X),
3157 CLK(NULL, "dss_fck", &dss_fck, CK_443X),
3158 CLK("omapdss_dss", "ick", &dss_fck, CK_443X),
3159 CLK(NULL, "efuse_ctrl_cust_fck", &efuse_ctrl_cust_fck, CK_443X),
3160 CLK(NULL, "emif1_fck", &emif1_fck, CK_443X),
3161 CLK(NULL, "emif2_fck", &emif2_fck, CK_443X),
3162 CLK(NULL, "fdif_fck", &fdif_fck, CK_443X),
3163 CLK(NULL, "fpka_fck", &fpka_fck, CK_443X),
3164 CLK(NULL, "gpio1_dbclk", &gpio1_dbclk, CK_443X),
3165 CLK(NULL, "gpio1_ick", &gpio1_ick, CK_443X),
3166 CLK(NULL, "gpio2_dbclk", &gpio2_dbclk, CK_443X),
3167 CLK(NULL, "gpio2_ick", &gpio2_ick, CK_443X),
3168 CLK(NULL, "gpio3_dbclk", &gpio3_dbclk, CK_443X),
3169 CLK(NULL, "gpio3_ick", &gpio3_ick, CK_443X),
3170 CLK(NULL, "gpio4_dbclk", &gpio4_dbclk, CK_443X),
3171 CLK(NULL, "gpio4_ick", &gpio4_ick, CK_443X),
3172 CLK(NULL, "gpio5_dbclk", &gpio5_dbclk, CK_443X),
3173 CLK(NULL, "gpio5_ick", &gpio5_ick, CK_443X),
3174 CLK(NULL, "gpio6_dbclk", &gpio6_dbclk, CK_443X),
3175 CLK(NULL, "gpio6_ick", &gpio6_ick, CK_443X),
3176 CLK(NULL, "gpmc_ick", &gpmc_ick, CK_443X),
3177 CLK(NULL, "gpu_fck", &gpu_fck, CK_443X),
3178 CLK(NULL, "hdq1w_fck", &hdq1w_fck, CK_443X),
3179 CLK(NULL, "hsi_fck", &hsi_fck, CK_443X),
3180 CLK(NULL, "i2c1_fck", &i2c1_fck, CK_443X),
3181 CLK(NULL, "i2c2_fck", &i2c2_fck, CK_443X),
3182 CLK(NULL, "i2c3_fck", &i2c3_fck, CK_443X),
3183 CLK(NULL, "i2c4_fck", &i2c4_fck, CK_443X),
3184 CLK(NULL, "ipu_fck", &ipu_fck, CK_443X),
3185 CLK(NULL, "iss_ctrlclk", &iss_ctrlclk, CK_443X),
3186 CLK(NULL, "iss_fck", &iss_fck, CK_443X),
3187 CLK(NULL, "iva_fck", &iva_fck, CK_443X),
3188 CLK(NULL, "kbd_fck", &kbd_fck, CK_443X),
3189 CLK(NULL, "l3_instr_ick", &l3_instr_ick, CK_443X),
3190 CLK(NULL, "l3_main_3_ick", &l3_main_3_ick, CK_443X),
3191 CLK(NULL, "mcasp_sync_mux_ck", &mcasp_sync_mux_ck, CK_443X),
3192 CLK(NULL, "mcasp_fck", &mcasp_fck, CK_443X),
3193 CLK(NULL, "mcbsp1_sync_mux_ck", &mcbsp1_sync_mux_ck, CK_443X),
3194 CLK(NULL, "mcbsp1_fck", &mcbsp1_fck, CK_443X),
3195 CLK(NULL, "mcbsp2_sync_mux_ck", &mcbsp2_sync_mux_ck, CK_443X),
3196 CLK(NULL, "mcbsp2_fck", &mcbsp2_fck, CK_443X),
3197 CLK(NULL, "mcbsp3_sync_mux_ck", &mcbsp3_sync_mux_ck, CK_443X),
3198 CLK(NULL, "mcbsp3_fck", &mcbsp3_fck, CK_443X),
3199 CLK(NULL, "mcbsp4_sync_mux_ck", &mcbsp4_sync_mux_ck, CK_443X),
3200 CLK(NULL, "mcbsp4_fck", &mcbsp4_fck, CK_443X),
3201 CLK(NULL, "mcpdm_fck", &mcpdm_fck, CK_443X),
3202 CLK(NULL, "mcspi1_fck", &mcspi1_fck, CK_443X),
3203 CLK(NULL, "mcspi2_fck", &mcspi2_fck, CK_443X),
3204 CLK(NULL, "mcspi3_fck", &mcspi3_fck, CK_443X),
3205 CLK(NULL, "mcspi4_fck", &mcspi4_fck, CK_443X),
3206 CLK(NULL, "mmc1_fck", &mmc1_fck, CK_443X),
3207 CLK(NULL, "mmc2_fck", &mmc2_fck, CK_443X),
3208 CLK(NULL, "mmc3_fck", &mmc3_fck, CK_443X),
3209 CLK(NULL, "mmc4_fck", &mmc4_fck, CK_443X),
3210 CLK(NULL, "mmc5_fck", &mmc5_fck, CK_443X),
3211 CLK(NULL, "ocp2scp_usb_phy_phy_48m", &ocp2scp_usb_phy_phy_48m, CK_443X),
3212 CLK(NULL, "ocp2scp_usb_phy_ick", &ocp2scp_usb_phy_ick, CK_443X),
3213 CLK(NULL, "ocp_wp_noc_ick", &ocp_wp_noc_ick, CK_443X),
3214 CLK(NULL, "rng_ick", &rng_ick, CK_443X),
3215 CLK("omap_rng", "ick", &rng_ick, CK_443X),
3216 CLK(NULL, "sha2md5_fck", &sha2md5_fck, CK_443X),
3217 CLK(NULL, "sl2if_ick", &sl2if_ick, CK_443X),
3218 CLK(NULL, "slimbus1_fclk_1", &slimbus1_fclk_1, CK_443X),
3219 CLK(NULL, "slimbus1_fclk_0", &slimbus1_fclk_0, CK_443X),
3220 CLK(NULL, "slimbus1_fclk_2", &slimbus1_fclk_2, CK_443X),
3221 CLK(NULL, "slimbus1_slimbus_clk", &slimbus1_slimbus_clk, CK_443X),
3222 CLK(NULL, "slimbus1_fck", &slimbus1_fck, CK_443X),
3223 CLK(NULL, "slimbus2_fclk_1", &slimbus2_fclk_1, CK_443X),
3224 CLK(NULL, "slimbus2_fclk_0", &slimbus2_fclk_0, CK_443X),
3225 CLK(NULL, "slimbus2_slimbus_clk", &slimbus2_slimbus_clk, CK_443X),
3226 CLK(NULL, "slimbus2_fck", &slimbus2_fck, CK_443X),
3227 CLK(NULL, "smartreflex_core_fck", &smartreflex_core_fck, CK_443X),
3228 CLK(NULL, "smartreflex_iva_fck", &smartreflex_iva_fck, CK_443X),
3229 CLK(NULL, "smartreflex_mpu_fck", &smartreflex_mpu_fck, CK_443X),
3230 CLK(NULL, "timer1_fck", &timer1_fck, CK_443X),
3231 CLK(NULL, "timer10_fck", &timer10_fck, CK_443X),
3232 CLK(NULL, "timer11_fck", &timer11_fck, CK_443X),
3233 CLK(NULL, "timer2_fck", &timer2_fck, CK_443X),
3234 CLK(NULL, "timer3_fck", &timer3_fck, CK_443X),
3235 CLK(NULL, "timer4_fck", &timer4_fck, CK_443X),
3236 CLK(NULL, "timer5_fck", &timer5_fck, CK_443X),
3237 CLK(NULL, "timer6_fck", &timer6_fck, CK_443X),
3238 CLK(NULL, "timer7_fck", &timer7_fck, CK_443X),
3239 CLK(NULL, "timer8_fck", &timer8_fck, CK_443X),
3240 CLK(NULL, "timer9_fck", &timer9_fck, CK_443X),
3241 CLK(NULL, "uart1_fck", &uart1_fck, CK_443X),
3242 CLK(NULL, "uart2_fck", &uart2_fck, CK_443X),
3243 CLK(NULL, "uart3_fck", &uart3_fck, CK_443X),
3244 CLK(NULL, "uart4_fck", &uart4_fck, CK_443X),
3245 CLK("usbhs_omap", "fs_fck", &usb_host_fs_fck, CK_443X),
3246 CLK(NULL, "usb_host_fs_fck", &usb_host_fs_fck, CK_443X),
3247 CLK(NULL, "utmi_p1_gfclk", &utmi_p1_gfclk, CK_443X),
3248 CLK(NULL, "usb_host_hs_utmi_p1_clk", &usb_host_hs_utmi_p1_clk, CK_443X),
3249 CLK(NULL, "utmi_p2_gfclk", &utmi_p2_gfclk, CK_443X),
3250 CLK(NULL, "usb_host_hs_utmi_p2_clk", &usb_host_hs_utmi_p2_clk, CK_443X),
3251 CLK(NULL, "usb_host_hs_utmi_p3_clk", &usb_host_hs_utmi_p3_clk, CK_443X),
3252 CLK(NULL, "usb_host_hs_hsic480m_p1_clk", &usb_host_hs_hsic480m_p1_clk, CK_443X),
3253 CLK(NULL, "usb_host_hs_hsic60m_p1_clk", &usb_host_hs_hsic60m_p1_clk, CK_443X),
3254 CLK(NULL, "usb_host_hs_hsic60m_p2_clk", &usb_host_hs_hsic60m_p2_clk, CK_443X),
3255 CLK(NULL, "usb_host_hs_hsic480m_p2_clk", &usb_host_hs_hsic480m_p2_clk, CK_443X),
3256 CLK(NULL, "usb_host_hs_func48mclk", &usb_host_hs_func48mclk, CK_443X),
3257 CLK(NULL, "usb_host_hs_fck", &usb_host_hs_fck, CK_443X),
3258 CLK("usbhs_omap", "hs_fck", &usb_host_hs_fck, CK_443X),
3259 CLK(NULL, "otg_60m_gfclk", &otg_60m_gfclk, CK_443X),
3260 CLK(NULL, "usb_otg_hs_xclk", &usb_otg_hs_xclk, CK_443X),
3261 CLK(NULL, "usb_otg_hs_ick", &usb_otg_hs_ick, CK_443X),
3262 CLK("musb-omap2430", "ick", &usb_otg_hs_ick, CK_443X),
3263 CLK(NULL, "usb_phy_cm_clk32k", &usb_phy_cm_clk32k, CK_443X),
3264 CLK(NULL, "usb_tll_hs_usb_ch2_clk", &usb_tll_hs_usb_ch2_clk, CK_443X),
3265 CLK(NULL, "usb_tll_hs_usb_ch0_clk", &usb_tll_hs_usb_ch0_clk, CK_443X),
3266 CLK(NULL, "usb_tll_hs_usb_ch1_clk", &usb_tll_hs_usb_ch1_clk, CK_443X),
3267 CLK(NULL, "usb_tll_hs_ick", &usb_tll_hs_ick, CK_443X),
3268 CLK("usbhs_omap", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3269 CLK("usbhs_tll", "usbtll_ick", &usb_tll_hs_ick, CK_443X),
3270 CLK(NULL, "usim_ck", &usim_ck, CK_443X),
3271 CLK(NULL, "usim_fclk", &usim_fclk, CK_443X),
3272 CLK(NULL, "usim_fck", &usim_fck, CK_443X),
3273 CLK(NULL, "wd_timer2_fck", &wd_timer2_fck, CK_443X),
3274 CLK(NULL, "wd_timer3_fck", &wd_timer3_fck, CK_443X),
3275 CLK(NULL, "stm_clk_div_ck", &stm_clk_div_ck, CK_443X),
3276 CLK(NULL, "trace_clk_div_ck", &trace_clk_div_ck, CK_443X),
3277 CLK(NULL, "auxclk0_src_ck", &auxclk0_src_ck, CK_443X),
3278 CLK(NULL, "auxclk0_ck", &auxclk0_ck, CK_443X),
3279 CLK(NULL, "auxclkreq0_ck", &auxclkreq0_ck, CK_443X),
3280 CLK(NULL, "auxclk1_src_ck", &auxclk1_src_ck, CK_443X),
3281 CLK(NULL, "auxclk1_ck", &auxclk1_ck, CK_443X),
3282 CLK(NULL, "auxclkreq1_ck", &auxclkreq1_ck, CK_443X),
3283 CLK(NULL, "auxclk2_src_ck", &auxclk2_src_ck, CK_443X),
3284 CLK(NULL, "auxclk2_ck", &auxclk2_ck, CK_443X),
3285 CLK(NULL, "auxclkreq2_ck", &auxclkreq2_ck, CK_443X),
3286 CLK(NULL, "auxclk3_src_ck", &auxclk3_src_ck, CK_443X),
3287 CLK(NULL, "auxclk3_ck", &auxclk3_ck, CK_443X),
3288 CLK(NULL, "auxclkreq3_ck", &auxclkreq3_ck, CK_443X),
3289 CLK(NULL, "auxclk4_src_ck", &auxclk4_src_ck, CK_443X),
3290 CLK(NULL, "auxclk4_ck", &auxclk4_ck, CK_443X),
3291 CLK(NULL, "auxclkreq4_ck", &auxclkreq4_ck, CK_443X),
3292 CLK(NULL, "auxclk5_src_ck", &auxclk5_src_ck, CK_443X),
3293 CLK(NULL, "auxclk5_ck", &auxclk5_ck, CK_443X),
3294 CLK(NULL, "auxclkreq5_ck", &auxclkreq5_ck, CK_443X),
3295 CLK("omap-gpmc", "fck", &dummy_ck, CK_443X),
3296 CLK("omap_i2c.1", "ick", &dummy_ck, CK_443X),
3297 CLK("omap_i2c.2", "ick", &dummy_ck, CK_443X),
3298 CLK("omap_i2c.3", "ick", &dummy_ck, CK_443X),
3299 CLK("omap_i2c.4", "ick", &dummy_ck, CK_443X),
3300 CLK(NULL, "mailboxes_ick", &dummy_ck, CK_443X),
3301 CLK("omap_hsmmc.0", "ick", &dummy_ck, CK_443X),
3302 CLK("omap_hsmmc.1", "ick", &dummy_ck, CK_443X),
3303 CLK("omap_hsmmc.2", "ick", &dummy_ck, CK_443X),
3304 CLK("omap_hsmmc.3", "ick", &dummy_ck, CK_443X),
3305 CLK("omap_hsmmc.4", "ick", &dummy_ck, CK_443X),
3306 CLK("omap-mcbsp.1", "ick", &dummy_ck, CK_443X),
3307 CLK("omap-mcbsp.2", "ick", &dummy_ck, CK_443X),
3308 CLK("omap-mcbsp.3", "ick", &dummy_ck, CK_443X),
3309 CLK("omap-mcbsp.4", "ick", &dummy_ck, CK_443X),
3310 CLK("omap2_mcspi.1", "ick", &dummy_ck, CK_443X),
3311 CLK("omap2_mcspi.2", "ick", &dummy_ck, CK_443X),
3312 CLK("omap2_mcspi.3", "ick", &dummy_ck, CK_443X),
3313 CLK("omap2_mcspi.4", "ick", &dummy_ck, CK_443X),
3314 CLK(NULL, "uart1_ick", &dummy_ck, CK_443X),
3315 CLK(NULL, "uart2_ick", &dummy_ck, CK_443X),
3316 CLK(NULL, "uart3_ick", &dummy_ck, CK_443X),
3317 CLK(NULL, "uart4_ick", &dummy_ck, CK_443X),
3318 CLK("usbhs_omap", "usbhost_ick", &dummy_ck, CK_443X),
3319 CLK("usbhs_omap", "usbtll_fck", &dummy_ck, CK_443X),
3320 CLK("usbhs_tll", "usbtll_fck", &dummy_ck, CK_443X),
3321 CLK("omap_wdt", "ick", &dummy_ck, CK_443X),
3322 CLK(NULL, "timer_32k_ck", &sys_32k_ck, CK_443X),
3323 /* TODO: Remove "omap_timer.X" aliases once DT migration is complete */
3324 CLK("omap_timer.1", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3325 CLK("omap_timer.2", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3326 CLK("omap_timer.3", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3327 CLK("omap_timer.4", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3328 CLK("omap_timer.9", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3329 CLK("omap_timer.10", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3330 CLK("omap_timer.11", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3331 CLK("omap_timer.5", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3332 CLK("omap_timer.6", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3333 CLK("omap_timer.7", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3334 CLK("omap_timer.8", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3335 CLK("4a318000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3336 CLK("48032000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3337 CLK("48034000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3338 CLK("48036000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3339 CLK("4803e000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3340 CLK("48086000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3341 CLK("48088000.timer", "timer_sys_ck", &sys_clkin_ck, CK_443X),
3342 CLK("49038000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3343 CLK("4903a000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3344 CLK("4903c000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3345 CLK("4903e000.timer", "timer_sys_ck", &syc_clk_div_ck, CK_443X),
3346 CLK(NULL, "cpufreq_ck", &dpll_mpu_ck, CK_443X),
3347};
3348
3349int __init omap4xxx_clk_init(void)
3350{
3351 struct omap_clk *c;
3352 u32 cpu_clkflg;
3353
3354 if (cpu_is_omap443x()) {
3355 cpu_mask = RATE_IN_4430;
3356 cpu_clkflg = CK_443X;
3357 } else if (cpu_is_omap446x() || cpu_is_omap447x()) {
3358 cpu_mask = RATE_IN_4460 | RATE_IN_4430;
3359 cpu_clkflg = CK_446X | CK_443X;
3360
3361 if (cpu_is_omap447x())
3362 pr_warn("WARNING: OMAP4470 clock data incomplete!\n");
3363 } else {
3364 return 0;
3365 }
3366
3367 /*
3368 * Must stay commented until all OMAP SoC drivers are
3369 * converted to runtime PM, or drivers may start crashing
3370 *
3371 * omap2_clk_disable_clkdm_control();
3372 */
3373
3374 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
3375 c++)
3376 clk_preinit(c->lk.clk);
3377
3378 for (c = omap44xx_clks; c < omap44xx_clks + ARRAY_SIZE(omap44xx_clks);
3379 c++)
3380 if (c->cpu & cpu_clkflg) {
3381 clkdev_add(&c->lk);
3382 clk_register(c->lk.clk);
3383 omap2_init_clk_clkdm(c->lk.clk);
3384 }
3385
3386 /* Disable autoidle on all clocks; let the PM code enable it later */
3387 omap_clk_disable_autoidle_all();
3388
3389 recalculate_root_clocks();
3390
3391 /*
3392 * Only enable those clocks we will need, let the drivers
3393 * enable other clocks as necessary
3394 */
3395 clk_enable_init_clocks();
3396
3397 return 0;
3398}
diff --git a/arch/arm/mach-omap2/clock_common_data.c b/arch/arm/mach-omap2/clock_common_data.c
index b9f3ba68148c..ef4d21bfb964 100644
--- a/arch/arm/mach-omap2/clock_common_data.c
+++ b/arch/arm/mach-omap2/clock_common_data.c
@@ -16,6 +16,7 @@
16 * OMAP3xxx clock definition files. 16 * OMAP3xxx clock definition files.
17 */ 17 */
18 18
19#include <linux/clk-private.h>
19#include "clock.h" 20#include "clock.h"
20 21
21/* clksel_rate data common to 24xx/343x */ 22/* clksel_rate data common to 24xx/343x */
@@ -52,6 +53,13 @@ const struct clksel_rate div_1_0_rates[] = {
52 { .div = 0 }, 53 { .div = 0 },
53}; 54};
54 55
56const struct clksel_rate div3_1to4_rates[] = {
57 { .div = 1, .val = 0, .flags = RATE_IN_4430 },
58 { .div = 2, .val = 1, .flags = RATE_IN_4430 },
59 { .div = 4, .val = 2, .flags = RATE_IN_4430 },
60 { .div = 0 },
61};
62
55const struct clksel_rate div_1_1_rates[] = { 63const struct clksel_rate div_1_1_rates[] = {
56 { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX }, 64 { .div = 1, .val = 1, .flags = RATE_IN_4430 | RATE_IN_AM33XX },
57 { .div = 0 }, 65 { .div = 0 },
@@ -109,14 +117,10 @@ const struct clksel_rate div31_1to31_rates[] = {
109 117
110/* Clocks shared between various OMAP SoCs */ 118/* Clocks shared between various OMAP SoCs */
111 119
112struct clk virt_19200000_ck = { 120static struct clk_ops dummy_ck_ops = {};
113 .name = "virt_19200000_ck",
114 .ops = &clkops_null,
115 .rate = 19200000,
116};
117 121
118struct clk virt_26000000_ck = { 122struct clk dummy_ck = {
119 .name = "virt_26000000_ck", 123 .name = "dummy_clk",
120 .ops = &clkops_null, 124 .ops = &dummy_ck_ops,
121 .rate = 26000000, 125 .flags = CLK_IS_BASIC,
122}; 126};
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c
index 64e50465a4b5..384873580b23 100644
--- a/arch/arm/mach-omap2/clockdomain.c
+++ b/arch/arm/mach-omap2/clockdomain.c
@@ -22,6 +22,7 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/limits.h> 23#include <linux/limits.h>
24#include <linux/err.h> 24#include <linux/err.h>
25#include <linux/clk-provider.h>
25 26
26#include <linux/io.h> 27#include <linux/io.h>
27 28
@@ -947,35 +948,6 @@ static int _clkdm_clk_hwmod_enable(struct clockdomain *clkdm)
947 return 0; 948 return 0;
948} 949}
949 950
950static int _clkdm_clk_hwmod_disable(struct clockdomain *clkdm)
951{
952 unsigned long flags;
953
954 if (!clkdm || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
955 return -EINVAL;
956
957 spin_lock_irqsave(&clkdm->lock, flags);
958
959 if (atomic_read(&clkdm->usecount) == 0) {
960 spin_unlock_irqrestore(&clkdm->lock, flags);
961 WARN_ON(1); /* underflow */
962 return -ERANGE;
963 }
964
965 if (atomic_dec_return(&clkdm->usecount) > 0) {
966 spin_unlock_irqrestore(&clkdm->lock, flags);
967 return 0;
968 }
969
970 arch_clkdm->clkdm_clk_disable(clkdm);
971 pwrdm_state_switch(clkdm->pwrdm.ptr);
972 spin_unlock_irqrestore(&clkdm->lock, flags);
973
974 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
975
976 return 0;
977}
978
979/** 951/**
980 * clkdm_clk_enable - add an enabled downstream clock to this clkdm 952 * clkdm_clk_enable - add an enabled downstream clock to this clkdm
981 * @clkdm: struct clockdomain * 953 * @clkdm: struct clockdomain *
@@ -1018,15 +990,37 @@ int clkdm_clk_enable(struct clockdomain *clkdm, struct clk *clk)
1018 */ 990 */
1019int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk) 991int clkdm_clk_disable(struct clockdomain *clkdm, struct clk *clk)
1020{ 992{
1021 /* 993 unsigned long flags;
1022 * XXX Rewrite this code to maintain a list of enabled
1023 * downstream clocks for debugging purposes?
1024 */
1025 994
1026 if (!clk) 995 if (!clkdm || !clk || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
1027 return -EINVAL; 996 return -EINVAL;
1028 997
1029 return _clkdm_clk_hwmod_disable(clkdm); 998 spin_lock_irqsave(&clkdm->lock, flags);
999
1000 /* corner case: disabling unused clocks */
1001 if (__clk_get_enable_count(clk) == 0)
1002 goto ccd_exit;
1003
1004 if (atomic_read(&clkdm->usecount) == 0) {
1005 spin_unlock_irqrestore(&clkdm->lock, flags);
1006 WARN_ON(1); /* underflow */
1007 return -ERANGE;
1008 }
1009
1010 if (atomic_dec_return(&clkdm->usecount) > 0) {
1011 spin_unlock_irqrestore(&clkdm->lock, flags);
1012 return 0;
1013 }
1014
1015 arch_clkdm->clkdm_clk_disable(clkdm);
1016 pwrdm_state_switch(clkdm->pwrdm.ptr);
1017
1018 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
1019
1020ccd_exit:
1021 spin_unlock_irqrestore(&clkdm->lock, flags);
1022
1023 return 0;
1030} 1024}
1031 1025
1032/** 1026/**
@@ -1077,6 +1071,8 @@ int clkdm_hwmod_enable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1077 */ 1071 */
1078int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh) 1072int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1079{ 1073{
1074 unsigned long flags;
1075
1080 /* The clkdm attribute does not exist yet prior OMAP4 */ 1076 /* The clkdm attribute does not exist yet prior OMAP4 */
1081 if (cpu_is_omap24xx() || cpu_is_omap34xx()) 1077 if (cpu_is_omap24xx() || cpu_is_omap34xx())
1082 return 0; 1078 return 0;
@@ -1086,9 +1082,28 @@ int clkdm_hwmod_disable(struct clockdomain *clkdm, struct omap_hwmod *oh)
1086 * downstream hwmods for debugging purposes? 1082 * downstream hwmods for debugging purposes?
1087 */ 1083 */
1088 1084
1089 if (!oh) 1085 if (!clkdm || !oh || !arch_clkdm || !arch_clkdm->clkdm_clk_disable)
1090 return -EINVAL; 1086 return -EINVAL;
1091 1087
1092 return _clkdm_clk_hwmod_disable(clkdm); 1088 spin_lock_irqsave(&clkdm->lock, flags);
1089
1090 if (atomic_read(&clkdm->usecount) == 0) {
1091 spin_unlock_irqrestore(&clkdm->lock, flags);
1092 WARN_ON(1); /* underflow */
1093 return -ERANGE;
1094 }
1095
1096 if (atomic_dec_return(&clkdm->usecount) > 0) {
1097 spin_unlock_irqrestore(&clkdm->lock, flags);
1098 return 0;
1099 }
1100
1101 arch_clkdm->clkdm_clk_disable(clkdm);
1102 pwrdm_state_switch(clkdm->pwrdm.ptr);
1103 spin_unlock_irqrestore(&clkdm->lock, flags);
1104
1105 pr_debug("clockdomain: %s: disabled\n", clkdm->name);
1106
1107 return 0;
1093} 1108}
1094 1109
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
deleted file mode 100644
index 3e4e9209b2df..000000000000
--- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c
+++ /dev/null
@@ -1,341 +0,0 @@
1/*
2 * OMAP2 and OMAP3 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/types.h>
16#include <plat/prcm.h>
17
18#include "soc.h"
19#include "prm.h"
20#include "prm2xxx_3xxx.h"
21#include "cm.h"
22#include "cm2xxx_3xxx.h"
23#include "cm-regbits-24xx.h"
24#include "cm-regbits-34xx.h"
25#include "prm-regbits-24xx.h"
26#include "clockdomain.h"
27
28static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
29 struct clockdomain *clkdm2)
30{
31 omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
32 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
33 return 0;
34}
35
36static int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
37 struct clockdomain *clkdm2)
38{
39 omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
40 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
41 return 0;
42}
43
44static int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
45 struct clockdomain *clkdm2)
46{
47 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
48 PM_WKDEP, (1 << clkdm2->dep_bit));
49}
50
51static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
52{
53 struct clkdm_dep *cd;
54 u32 mask = 0;
55
56 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
57 if (!cd->clkdm)
58 continue; /* only happens if data is erroneous */
59
60 /* PRM accesses are slow, so minimize them */
61 mask |= 1 << cd->clkdm->dep_bit;
62 atomic_set(&cd->wkdep_usecount, 0);
63 }
64
65 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
66 PM_WKDEP);
67 return 0;
68}
69
70static int omap3_clkdm_add_sleepdep(struct clockdomain *clkdm1,
71 struct clockdomain *clkdm2)
72{
73 omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
74 clkdm1->pwrdm.ptr->prcm_offs,
75 OMAP3430_CM_SLEEPDEP);
76 return 0;
77}
78
79static int omap3_clkdm_del_sleepdep(struct clockdomain *clkdm1,
80 struct clockdomain *clkdm2)
81{
82 omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
83 clkdm1->pwrdm.ptr->prcm_offs,
84 OMAP3430_CM_SLEEPDEP);
85 return 0;
86}
87
88static int omap3_clkdm_read_sleepdep(struct clockdomain *clkdm1,
89 struct clockdomain *clkdm2)
90{
91 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
92 OMAP3430_CM_SLEEPDEP, (1 << clkdm2->dep_bit));
93}
94
95static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
96{
97 struct clkdm_dep *cd;
98 u32 mask = 0;
99
100 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
101 if (!cd->clkdm)
102 continue; /* only happens if data is erroneous */
103
104 /* PRM accesses are slow, so minimize them */
105 mask |= 1 << cd->clkdm->dep_bit;
106 atomic_set(&cd->sleepdep_usecount, 0);
107 }
108 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
109 OMAP3430_CM_SLEEPDEP);
110 return 0;
111}
112
113static int omap2_clkdm_sleep(struct clockdomain *clkdm)
114{
115 omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
116 clkdm->pwrdm.ptr->prcm_offs,
117 OMAP2_PM_PWSTCTRL);
118 return 0;
119}
120
121static int omap2_clkdm_wakeup(struct clockdomain *clkdm)
122{
123 omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
124 clkdm->pwrdm.ptr->prcm_offs,
125 OMAP2_PM_PWSTCTRL);
126 return 0;
127}
128
129static void omap2_clkdm_allow_idle(struct clockdomain *clkdm)
130{
131 if (atomic_read(&clkdm->usecount) > 0)
132 _clkdm_add_autodeps(clkdm);
133
134 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
135 clkdm->clktrctrl_mask);
136}
137
138static void omap2_clkdm_deny_idle(struct clockdomain *clkdm)
139{
140 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
141 clkdm->clktrctrl_mask);
142
143 if (atomic_read(&clkdm->usecount) > 0)
144 _clkdm_del_autodeps(clkdm);
145}
146
147static void _enable_hwsup(struct clockdomain *clkdm)
148{
149 if (cpu_is_omap24xx())
150 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
151 clkdm->clktrctrl_mask);
152 else if (cpu_is_omap34xx())
153 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
154 clkdm->clktrctrl_mask);
155}
156
157static void _disable_hwsup(struct clockdomain *clkdm)
158{
159 if (cpu_is_omap24xx())
160 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
161 clkdm->clktrctrl_mask);
162 else if (cpu_is_omap34xx())
163 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
164 clkdm->clktrctrl_mask);
165}
166
167static int omap3_clkdm_sleep(struct clockdomain *clkdm)
168{
169 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
170 clkdm->clktrctrl_mask);
171 return 0;
172}
173
174static int omap3_clkdm_wakeup(struct clockdomain *clkdm)
175{
176 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
177 clkdm->clktrctrl_mask);
178 return 0;
179}
180
181static int omap2_clkdm_clk_enable(struct clockdomain *clkdm)
182{
183 bool hwsup = false;
184
185 if (!clkdm->clktrctrl_mask)
186 return 0;
187
188 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
189 clkdm->clktrctrl_mask);
190
191 if (hwsup) {
192 /* Disable HW transitions when we are changing deps */
193 _disable_hwsup(clkdm);
194 _clkdm_add_autodeps(clkdm);
195 _enable_hwsup(clkdm);
196 } else {
197 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
198 omap2_clkdm_wakeup(clkdm);
199 }
200
201 return 0;
202}
203
204static int omap2_clkdm_clk_disable(struct clockdomain *clkdm)
205{
206 bool hwsup = false;
207
208 if (!clkdm->clktrctrl_mask)
209 return 0;
210
211 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
212 clkdm->clktrctrl_mask);
213
214 if (hwsup) {
215 /* Disable HW transitions when we are changing deps */
216 _disable_hwsup(clkdm);
217 _clkdm_del_autodeps(clkdm);
218 _enable_hwsup(clkdm);
219 } else {
220 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
221 omap2_clkdm_sleep(clkdm);
222 }
223
224 return 0;
225}
226
227static void omap3_clkdm_allow_idle(struct clockdomain *clkdm)
228{
229 if (atomic_read(&clkdm->usecount) > 0)
230 _clkdm_add_autodeps(clkdm);
231
232 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
233 clkdm->clktrctrl_mask);
234}
235
236static void omap3_clkdm_deny_idle(struct clockdomain *clkdm)
237{
238 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
239 clkdm->clktrctrl_mask);
240
241 if (atomic_read(&clkdm->usecount) > 0)
242 _clkdm_del_autodeps(clkdm);
243}
244
245static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
246{
247 bool hwsup = false;
248
249 if (!clkdm->clktrctrl_mask)
250 return 0;
251
252 /*
253 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
254 * more details on the unpleasant problem this is working
255 * around
256 */
257 if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
258 (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
259 omap3_clkdm_wakeup(clkdm);
260 return 0;
261 }
262
263 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
264 clkdm->clktrctrl_mask);
265
266 if (hwsup) {
267 /* Disable HW transitions when we are changing deps */
268 _disable_hwsup(clkdm);
269 _clkdm_add_autodeps(clkdm);
270 _enable_hwsup(clkdm);
271 } else {
272 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
273 omap3_clkdm_wakeup(clkdm);
274 }
275
276 return 0;
277}
278
279static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
280{
281 bool hwsup = false;
282
283 if (!clkdm->clktrctrl_mask)
284 return 0;
285
286 /*
287 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
288 * more details on the unpleasant problem this is working
289 * around
290 */
291 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
292 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
293 _enable_hwsup(clkdm);
294 return 0;
295 }
296
297 hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
298 clkdm->clktrctrl_mask);
299
300 if (hwsup) {
301 /* Disable HW transitions when we are changing deps */
302 _disable_hwsup(clkdm);
303 _clkdm_del_autodeps(clkdm);
304 _enable_hwsup(clkdm);
305 } else {
306 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
307 omap3_clkdm_sleep(clkdm);
308 }
309
310 return 0;
311}
312
313struct clkdm_ops omap2_clkdm_operations = {
314 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
315 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
316 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
317 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
318 .clkdm_sleep = omap2_clkdm_sleep,
319 .clkdm_wakeup = omap2_clkdm_wakeup,
320 .clkdm_allow_idle = omap2_clkdm_allow_idle,
321 .clkdm_deny_idle = omap2_clkdm_deny_idle,
322 .clkdm_clk_enable = omap2_clkdm_clk_enable,
323 .clkdm_clk_disable = omap2_clkdm_clk_disable,
324};
325
326struct clkdm_ops omap3_clkdm_operations = {
327 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
328 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
329 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
330 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
331 .clkdm_add_sleepdep = omap3_clkdm_add_sleepdep,
332 .clkdm_del_sleepdep = omap3_clkdm_del_sleepdep,
333 .clkdm_read_sleepdep = omap3_clkdm_read_sleepdep,
334 .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps,
335 .clkdm_sleep = omap3_clkdm_sleep,
336 .clkdm_wakeup = omap3_clkdm_wakeup,
337 .clkdm_allow_idle = omap3_clkdm_allow_idle,
338 .clkdm_deny_idle = omap3_clkdm_deny_idle,
339 .clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
340 .clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
341};
diff --git a/arch/arm/mach-omap2/clockdomain33xx.c b/arch/arm/mach-omap2/clockdomain33xx.c
deleted file mode 100644
index aca6388fad76..000000000000
--- a/arch/arm/mach-omap2/clockdomain33xx.c
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * AM33XX clockdomain control
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Vaibhav Hiremath <hvaibhav@ti.com>
6 *
7 * Derived from mach-omap2/clockdomain44xx.c written by Rajendra Nayak
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/kernel.h>
20
21#include "clockdomain.h"
22#include "cm33xx.h"
23
24
25static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
26{
27 am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
28 return 0;
29}
30
31static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
32{
33 am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
34 return 0;
35}
36
37static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
38{
39 am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
40}
41
42static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
43{
44 am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
45}
46
47static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
48{
49 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
50 return am33xx_clkdm_wakeup(clkdm);
51
52 return 0;
53}
54
55static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
56{
57 bool hwsup = false;
58
59 hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
60
61 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
62 am33xx_clkdm_sleep(clkdm);
63
64 return 0;
65}
66
67struct clkdm_ops am33xx_clkdm_operations = {
68 .clkdm_sleep = am33xx_clkdm_sleep,
69 .clkdm_wakeup = am33xx_clkdm_wakeup,
70 .clkdm_allow_idle = am33xx_clkdm_allow_idle,
71 .clkdm_deny_idle = am33xx_clkdm_deny_idle,
72 .clkdm_clk_enable = am33xx_clkdm_clk_enable,
73 .clkdm_clk_disable = am33xx_clkdm_clk_disable,
74};
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c
deleted file mode 100644
index 6fc6155625bc..000000000000
--- a/arch/arm/mach-omap2/clockdomain44xx.c
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * OMAP4 clockdomain control
3 *
4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 *
7 * Derived from mach-omap2/clockdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include "clockdomain.h"
17#include "cminst44xx.h"
18#include "cm44xx.h"
19
20static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
21 struct clockdomain *clkdm2)
22{
23 omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
24 clkdm1->prcm_partition,
25 clkdm1->cm_inst, clkdm1->clkdm_offs +
26 OMAP4_CM_STATICDEP);
27 return 0;
28}
29
30static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
31 struct clockdomain *clkdm2)
32{
33 omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
34 clkdm1->prcm_partition,
35 clkdm1->cm_inst, clkdm1->clkdm_offs +
36 OMAP4_CM_STATICDEP);
37 return 0;
38}
39
40static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
41 struct clockdomain *clkdm2)
42{
43 return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
44 clkdm1->cm_inst, clkdm1->clkdm_offs +
45 OMAP4_CM_STATICDEP,
46 (1 << clkdm2->dep_bit));
47}
48
49static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
50{
51 struct clkdm_dep *cd;
52 u32 mask = 0;
53
54 if (!clkdm->prcm_partition)
55 return 0;
56
57 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
58 if (!cd->clkdm)
59 continue; /* only happens if data is erroneous */
60
61 mask |= 1 << cd->clkdm->dep_bit;
62 atomic_set(&cd->wkdep_usecount, 0);
63 }
64
65 omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
66 clkdm->cm_inst, clkdm->clkdm_offs +
67 OMAP4_CM_STATICDEP);
68 return 0;
69}
70
71static int omap4_clkdm_sleep(struct clockdomain *clkdm)
72{
73 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
74 clkdm->cm_inst, clkdm->clkdm_offs);
75 return 0;
76}
77
78static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
79{
80 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
81 clkdm->cm_inst, clkdm->clkdm_offs);
82 return 0;
83}
84
85static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
86{
87 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
88 clkdm->cm_inst, clkdm->clkdm_offs);
89}
90
91static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
92{
93 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
94 omap4_clkdm_wakeup(clkdm);
95 else
96 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
97 clkdm->cm_inst,
98 clkdm->clkdm_offs);
99}
100
101static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
102{
103 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
104 return omap4_clkdm_wakeup(clkdm);
105
106 return 0;
107}
108
109static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
110{
111 bool hwsup = false;
112
113 if (!clkdm->prcm_partition)
114 return 0;
115
116 /*
117 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
118 * more details on the unpleasant problem this is working
119 * around
120 */
121 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
122 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
123 omap4_clkdm_allow_idle(clkdm);
124 return 0;
125 }
126
127 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
128 clkdm->cm_inst, clkdm->clkdm_offs);
129
130 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
131 omap4_clkdm_sleep(clkdm);
132
133 return 0;
134}
135
136struct clkdm_ops omap4_clkdm_operations = {
137 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
138 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
139 .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
140 .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
141 .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
142 .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
143 .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
144 .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
145 .clkdm_sleep = omap4_clkdm_sleep,
146 .clkdm_wakeup = omap4_clkdm_wakeup,
147 .clkdm_allow_idle = omap4_clkdm_allow_idle,
148 .clkdm_deny_idle = omap4_clkdm_deny_idle,
149 .clkdm_clk_enable = omap4_clkdm_clk_enable,
150 .clkdm_clk_disable = omap4_clkdm_clk_disable,
151};
diff --git a/arch/arm/mach-omap2/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h
index 686290437568..669ef51b17a8 100644
--- a/arch/arm/mach-omap2/cm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-24xx.h
@@ -59,6 +59,7 @@
59/* CM_CLKSEL_MPU */ 59/* CM_CLKSEL_MPU */
60#define OMAP24XX_CLKSEL_MPU_SHIFT 0 60#define OMAP24XX_CLKSEL_MPU_SHIFT 0
61#define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0) 61#define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0)
62#define OMAP24XX_CLKSEL_MPU_WIDTH 5
62 63
63/* CM_CLKSTCTRL_MPU */ 64/* CM_CLKSTCTRL_MPU */
64#define OMAP24XX_AUTOSTATE_MPU_SHIFT 0 65#define OMAP24XX_AUTOSTATE_MPU_SHIFT 0
@@ -237,8 +238,10 @@
237#define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8) 238#define OMAP24XX_CLKSEL_DSS1_MASK (0x1f << 8)
238#define OMAP24XX_CLKSEL_L4_SHIFT 5 239#define OMAP24XX_CLKSEL_L4_SHIFT 5
239#define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5) 240#define OMAP24XX_CLKSEL_L4_MASK (0x3 << 5)
241#define OMAP24XX_CLKSEL_L4_WIDTH 2
240#define OMAP24XX_CLKSEL_L3_SHIFT 0 242#define OMAP24XX_CLKSEL_L3_SHIFT 0
241#define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0) 243#define OMAP24XX_CLKSEL_L3_MASK (0x1f << 0)
244#define OMAP24XX_CLKSEL_L3_WIDTH 5
242 245
243/* CM_CLKSEL2_CORE */ 246/* CM_CLKSEL2_CORE */
244#define OMAP24XX_CLKSEL_GPT12_SHIFT 22 247#define OMAP24XX_CLKSEL_GPT12_SHIFT 22
@@ -333,7 +336,9 @@
333#define OMAP24XX_EN_DPLL_MASK (0x3 << 0) 336#define OMAP24XX_EN_DPLL_MASK (0x3 << 0)
334 337
335/* CM_IDLEST_CKGEN */ 338/* CM_IDLEST_CKGEN */
339#define OMAP24XX_ST_54M_APLL_SHIFT 9
336#define OMAP24XX_ST_54M_APLL_MASK (1 << 9) 340#define OMAP24XX_ST_54M_APLL_MASK (1 << 9)
341#define OMAP24XX_ST_96M_APLL_SHIFT 8
337#define OMAP24XX_ST_96M_APLL_MASK (1 << 8) 342#define OMAP24XX_ST_96M_APLL_MASK (1 << 8)
338#define OMAP24XX_ST_54M_CLK_MASK (1 << 6) 343#define OMAP24XX_ST_54M_CLK_MASK (1 << 6)
339#define OMAP24XX_ST_12M_CLK_MASK (1 << 5) 344#define OMAP24XX_ST_12M_CLK_MASK (1 << 5)
@@ -361,8 +366,10 @@
361#define OMAP24XX_DPLL_DIV_MASK (0xf << 8) 366#define OMAP24XX_DPLL_DIV_MASK (0xf << 8)
362#define OMAP24XX_54M_SOURCE_SHIFT 5 367#define OMAP24XX_54M_SOURCE_SHIFT 5
363#define OMAP24XX_54M_SOURCE_MASK (1 << 5) 368#define OMAP24XX_54M_SOURCE_MASK (1 << 5)
369#define OMAP24XX_54M_SOURCE_WIDTH 1
364#define OMAP2430_96M_SOURCE_SHIFT 4 370#define OMAP2430_96M_SOURCE_SHIFT 4
365#define OMAP2430_96M_SOURCE_MASK (1 << 4) 371#define OMAP2430_96M_SOURCE_MASK (1 << 4)
372#define OMAP2430_96M_SOURCE_WIDTH 1
366#define OMAP24XX_48M_SOURCE_SHIFT 3 373#define OMAP24XX_48M_SOURCE_SHIFT 3
367#define OMAP24XX_48M_SOURCE_MASK (1 << 3) 374#define OMAP24XX_48M_SOURCE_MASK (1 << 3)
368#define OMAP2430_ALTCLK_SOURCE_SHIFT 0 375#define OMAP2430_ALTCLK_SOURCE_SHIFT 0
diff --git a/arch/arm/mach-omap2/cm-regbits-34xx.h b/arch/arm/mach-omap2/cm-regbits-34xx.h
index 59598ffd8783..adf78d325804 100644
--- a/arch/arm/mach-omap2/cm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-34xx.h
@@ -81,6 +81,7 @@
81/* CM_CLKSEL1_PLL_IVA2 */ 81/* CM_CLKSEL1_PLL_IVA2 */
82#define OMAP3430_IVA2_CLK_SRC_SHIFT 19 82#define OMAP3430_IVA2_CLK_SRC_SHIFT 19
83#define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19) 83#define OMAP3430_IVA2_CLK_SRC_MASK (0x7 << 19)
84#define OMAP3430_IVA2_CLK_SRC_WIDTH 3
84#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8 85#define OMAP3430_IVA2_DPLL_MULT_SHIFT 8
85#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8) 86#define OMAP3430_IVA2_DPLL_MULT_MASK (0x7ff << 8)
86#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0 87#define OMAP3430_IVA2_DPLL_DIV_SHIFT 0
@@ -89,6 +90,7 @@
89/* CM_CLKSEL2_PLL_IVA2 */ 90/* CM_CLKSEL2_PLL_IVA2 */
90#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0 91#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_SHIFT 0
91#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0) 92#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
93#define OMAP3430_IVA2_DPLL_CLKOUT_DIV_WIDTH 5
92 94
93/* CM_CLKSTCTRL_IVA2 */ 95/* CM_CLKSTCTRL_IVA2 */
94#define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0 96#define OMAP3430_CLKTRCTRL_IVA2_SHIFT 0
@@ -118,6 +120,7 @@
118/* CM_IDLEST_PLL_MPU */ 120/* CM_IDLEST_PLL_MPU */
119#define OMAP3430_ST_MPU_CLK_SHIFT 0 121#define OMAP3430_ST_MPU_CLK_SHIFT 0
120#define OMAP3430_ST_MPU_CLK_MASK (1 << 0) 122#define OMAP3430_ST_MPU_CLK_MASK (1 << 0)
123#define OMAP3430_ST_MPU_CLK_WIDTH 1
121 124
122/* CM_AUTOIDLE_PLL_MPU */ 125/* CM_AUTOIDLE_PLL_MPU */
123#define OMAP3430_AUTO_MPU_DPLL_SHIFT 0 126#define OMAP3430_AUTO_MPU_DPLL_SHIFT 0
@@ -126,6 +129,7 @@
126/* CM_CLKSEL1_PLL_MPU */ 129/* CM_CLKSEL1_PLL_MPU */
127#define OMAP3430_MPU_CLK_SRC_SHIFT 19 130#define OMAP3430_MPU_CLK_SRC_SHIFT 19
128#define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19) 131#define OMAP3430_MPU_CLK_SRC_MASK (0x7 << 19)
132#define OMAP3430_MPU_CLK_SRC_WIDTH 3
129#define OMAP3430_MPU_DPLL_MULT_SHIFT 8 133#define OMAP3430_MPU_DPLL_MULT_SHIFT 8
130#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8) 134#define OMAP3430_MPU_DPLL_MULT_MASK (0x7ff << 8)
131#define OMAP3430_MPU_DPLL_DIV_SHIFT 0 135#define OMAP3430_MPU_DPLL_DIV_SHIFT 0
@@ -134,6 +138,7 @@
134/* CM_CLKSEL2_PLL_MPU */ 138/* CM_CLKSEL2_PLL_MPU */
135#define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0 139#define OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT 0
136#define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0) 140#define OMAP3430_MPU_DPLL_CLKOUT_DIV_MASK (0x1f << 0)
141#define OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH 5
137 142
138/* CM_CLKSTCTRL_MPU */ 143/* CM_CLKSTCTRL_MPU */
139#define OMAP3430_CLKTRCTRL_MPU_SHIFT 0 144#define OMAP3430_CLKTRCTRL_MPU_SHIFT 0
@@ -345,10 +350,13 @@
345#define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4) 350#define OMAP3430ES1_CLKSEL_FSHOSTUSB_MASK (0x3 << 4)
346#define OMAP3430_CLKSEL_L4_SHIFT 2 351#define OMAP3430_CLKSEL_L4_SHIFT 2
347#define OMAP3430_CLKSEL_L4_MASK (0x3 << 2) 352#define OMAP3430_CLKSEL_L4_MASK (0x3 << 2)
353#define OMAP3430_CLKSEL_L4_WIDTH 2
348#define OMAP3430_CLKSEL_L3_SHIFT 0 354#define OMAP3430_CLKSEL_L3_SHIFT 0
349#define OMAP3430_CLKSEL_L3_MASK (0x3 << 0) 355#define OMAP3430_CLKSEL_L3_MASK (0x3 << 0)
356#define OMAP3430_CLKSEL_L3_WIDTH 2
350#define OMAP3630_CLKSEL_96M_SHIFT 12 357#define OMAP3630_CLKSEL_96M_SHIFT 12
351#define OMAP3630_CLKSEL_96M_MASK (0x3 << 12) 358#define OMAP3630_CLKSEL_96M_MASK (0x3 << 12)
359#define OMAP3630_CLKSEL_96M_WIDTH 2
352 360
353/* CM_CLKSTCTRL_CORE */ 361/* CM_CLKSTCTRL_CORE */
354#define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4 362#define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4
@@ -452,6 +460,7 @@
452#define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3) 460#define OMAP3430ES2_CLKSEL_USIMOCP_MASK (0xf << 3)
453#define OMAP3430_CLKSEL_RM_SHIFT 1 461#define OMAP3430_CLKSEL_RM_SHIFT 1
454#define OMAP3430_CLKSEL_RM_MASK (0x3 << 1) 462#define OMAP3430_CLKSEL_RM_MASK (0x3 << 1)
463#define OMAP3430_CLKSEL_RM_WIDTH 2
455#define OMAP3430_CLKSEL_GPT1_SHIFT 0 464#define OMAP3430_CLKSEL_GPT1_SHIFT 0
456#define OMAP3430_CLKSEL_GPT1_MASK (1 << 0) 465#define OMAP3430_CLKSEL_GPT1_MASK (1 << 0)
457 466
@@ -520,14 +529,17 @@
520/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */ 529/* Note that OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK was (0x3 << 27) on 3430ES1 */
521#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27 530#define OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT 27
522#define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27) 531#define OMAP3430_CORE_DPLL_CLKOUT_DIV_MASK (0x1f << 27)
532#define OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH 5
523#define OMAP3430_CORE_DPLL_MULT_SHIFT 16 533#define OMAP3430_CORE_DPLL_MULT_SHIFT 16
524#define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16) 534#define OMAP3430_CORE_DPLL_MULT_MASK (0x7ff << 16)
525#define OMAP3430_CORE_DPLL_DIV_SHIFT 8 535#define OMAP3430_CORE_DPLL_DIV_SHIFT 8
526#define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8) 536#define OMAP3430_CORE_DPLL_DIV_MASK (0x7f << 8)
527#define OMAP3430_SOURCE_96M_SHIFT 6 537#define OMAP3430_SOURCE_96M_SHIFT 6
528#define OMAP3430_SOURCE_96M_MASK (1 << 6) 538#define OMAP3430_SOURCE_96M_MASK (1 << 6)
539#define OMAP3430_SOURCE_96M_WIDTH 1
529#define OMAP3430_SOURCE_54M_SHIFT 5 540#define OMAP3430_SOURCE_54M_SHIFT 5
530#define OMAP3430_SOURCE_54M_MASK (1 << 5) 541#define OMAP3430_SOURCE_54M_MASK (1 << 5)
542#define OMAP3430_SOURCE_54M_WIDTH 1
531#define OMAP3430_SOURCE_48M_SHIFT 3 543#define OMAP3430_SOURCE_48M_SHIFT 3
532#define OMAP3430_SOURCE_48M_MASK (1 << 3) 544#define OMAP3430_SOURCE_48M_MASK (1 << 3)
533 545
@@ -545,7 +557,9 @@
545/* CM_CLKSEL3_PLL */ 557/* CM_CLKSEL3_PLL */
546#define OMAP3430_DIV_96M_SHIFT 0 558#define OMAP3430_DIV_96M_SHIFT 0
547#define OMAP3430_DIV_96M_MASK (0x1f << 0) 559#define OMAP3430_DIV_96M_MASK (0x1f << 0)
560#define OMAP3430_DIV_96M_WIDTH 5
548#define OMAP3630_DIV_96M_MASK (0x3f << 0) 561#define OMAP3630_DIV_96M_MASK (0x3f << 0)
562#define OMAP3630_DIV_96M_WIDTH 6
549 563
550/* CM_CLKSEL4_PLL */ 564/* CM_CLKSEL4_PLL */
551#define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8 565#define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8
@@ -556,12 +570,14 @@
556/* CM_CLKSEL5_PLL */ 570/* CM_CLKSEL5_PLL */
557#define OMAP3430ES2_DIV_120M_SHIFT 0 571#define OMAP3430ES2_DIV_120M_SHIFT 0
558#define OMAP3430ES2_DIV_120M_MASK (0x1f << 0) 572#define OMAP3430ES2_DIV_120M_MASK (0x1f << 0)
573#define OMAP3430ES2_DIV_120M_WIDTH 5
559 574
560/* CM_CLKOUT_CTRL */ 575/* CM_CLKOUT_CTRL */
561#define OMAP3430_CLKOUT2_EN_SHIFT 7 576#define OMAP3430_CLKOUT2_EN_SHIFT 7
562#define OMAP3430_CLKOUT2_EN_MASK (1 << 7) 577#define OMAP3430_CLKOUT2_EN_MASK (1 << 7)
563#define OMAP3430_CLKOUT2_DIV_SHIFT 3 578#define OMAP3430_CLKOUT2_DIV_SHIFT 3
564#define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3) 579#define OMAP3430_CLKOUT2_DIV_MASK (0x7 << 3)
580#define OMAP3430_CLKOUT2_DIV_WIDTH 3
565#define OMAP3430_CLKOUT2SOURCE_SHIFT 0 581#define OMAP3430_CLKOUT2SOURCE_SHIFT 0
566#define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0) 582#define OMAP3430_CLKOUT2SOURCE_MASK (0x3 << 0)
567 583
@@ -592,10 +608,14 @@
592/* CM_CLKSEL_DSS */ 608/* CM_CLKSEL_DSS */
593#define OMAP3430_CLKSEL_TV_SHIFT 8 609#define OMAP3430_CLKSEL_TV_SHIFT 8
594#define OMAP3430_CLKSEL_TV_MASK (0x1f << 8) 610#define OMAP3430_CLKSEL_TV_MASK (0x1f << 8)
611#define OMAP3430_CLKSEL_TV_WIDTH 5
595#define OMAP3630_CLKSEL_TV_MASK (0x3f << 8) 612#define OMAP3630_CLKSEL_TV_MASK (0x3f << 8)
613#define OMAP3630_CLKSEL_TV_WIDTH 6
596#define OMAP3430_CLKSEL_DSS1_SHIFT 0 614#define OMAP3430_CLKSEL_DSS1_SHIFT 0
597#define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0) 615#define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0)
616#define OMAP3430_CLKSEL_DSS1_WIDTH 5
598#define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0) 617#define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0)
618#define OMAP3630_CLKSEL_DSS1_WIDTH 6
599 619
600/* CM_SLEEPDEP_DSS specific bits */ 620/* CM_SLEEPDEP_DSS specific bits */
601 621
@@ -623,7 +643,9 @@
623/* CM_CLKSEL_CAM */ 643/* CM_CLKSEL_CAM */
624#define OMAP3430_CLKSEL_CAM_SHIFT 0 644#define OMAP3430_CLKSEL_CAM_SHIFT 0
625#define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0) 645#define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0)
646#define OMAP3430_CLKSEL_CAM_WIDTH 5
626#define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0) 647#define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0)
648#define OMAP3630_CLKSEL_CAM_WIDTH 6
627 649
628/* CM_SLEEPDEP_CAM specific bits */ 650/* CM_SLEEPDEP_CAM specific bits */
629 651
@@ -721,21 +743,30 @@
721/* CM_CLKSEL1_EMU */ 743/* CM_CLKSEL1_EMU */
722#define OMAP3430_DIV_DPLL4_SHIFT 24 744#define OMAP3430_DIV_DPLL4_SHIFT 24
723#define OMAP3430_DIV_DPLL4_MASK (0x1f << 24) 745#define OMAP3430_DIV_DPLL4_MASK (0x1f << 24)
746#define OMAP3430_DIV_DPLL4_WIDTH 5
724#define OMAP3630_DIV_DPLL4_MASK (0x3f << 24) 747#define OMAP3630_DIV_DPLL4_MASK (0x3f << 24)
748#define OMAP3630_DIV_DPLL4_WIDTH 6
725#define OMAP3430_DIV_DPLL3_SHIFT 16 749#define OMAP3430_DIV_DPLL3_SHIFT 16
726#define OMAP3430_DIV_DPLL3_MASK (0x1f << 16) 750#define OMAP3430_DIV_DPLL3_MASK (0x1f << 16)
751#define OMAP3430_DIV_DPLL3_WIDTH 5
727#define OMAP3430_CLKSEL_TRACECLK_SHIFT 11 752#define OMAP3430_CLKSEL_TRACECLK_SHIFT 11
728#define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11) 753#define OMAP3430_CLKSEL_TRACECLK_MASK (0x7 << 11)
754#define OMAP3430_CLKSEL_TRACECLK_WIDTH 3
729#define OMAP3430_CLKSEL_PCLK_SHIFT 8 755#define OMAP3430_CLKSEL_PCLK_SHIFT 8
730#define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8) 756#define OMAP3430_CLKSEL_PCLK_MASK (0x7 << 8)
757#define OMAP3430_CLKSEL_PCLK_WIDTH 3
731#define OMAP3430_CLKSEL_PCLKX2_SHIFT 6 758#define OMAP3430_CLKSEL_PCLKX2_SHIFT 6
732#define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6) 759#define OMAP3430_CLKSEL_PCLKX2_MASK (0x3 << 6)
760#define OMAP3430_CLKSEL_PCLKX2_WIDTH 2
733#define OMAP3430_CLKSEL_ATCLK_SHIFT 4 761#define OMAP3430_CLKSEL_ATCLK_SHIFT 4
734#define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4) 762#define OMAP3430_CLKSEL_ATCLK_MASK (0x3 << 4)
763#define OMAP3430_CLKSEL_ATCLK_WIDTH 2
735#define OMAP3430_TRACE_MUX_CTRL_SHIFT 2 764#define OMAP3430_TRACE_MUX_CTRL_SHIFT 2
736#define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2) 765#define OMAP3430_TRACE_MUX_CTRL_MASK (0x3 << 2)
766#define OMAP3430_TRACE_MUX_CTRL_WIDTH 2
737#define OMAP3430_MUX_CTRL_SHIFT 0 767#define OMAP3430_MUX_CTRL_SHIFT 0
738#define OMAP3430_MUX_CTRL_MASK (0x3 << 0) 768#define OMAP3430_MUX_CTRL_MASK (0x3 << 0)
769#define OMAP3430_MUX_CTRL_WIDTH 2
739 770
740/* CM_CLKSTCTRL_EMU */ 771/* CM_CLKSTCTRL_EMU */
741#define OMAP3430_CLKTRCTRL_EMU_SHIFT 0 772#define OMAP3430_CLKTRCTRL_EMU_SHIFT 0
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index f24e3f7a2bbc..93473f9a551c 100644
--- a/arch/arm/mach-omap2/cm.h
+++ b/arch/arm/mach-omap2/cm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2+ Clock Management prototypes 2 * OMAP2+ Clock Management prototypes
3 * 3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation 5 * Copyright (C) 2007-2009 Nokia Corporation
6 * 6 *
7 * Written by Paul Walmsley 7 * Written by Paul Walmsley
@@ -22,6 +22,12 @@
22 */ 22 */
23#define MAX_MODULE_READY_TIME 2000 23#define MAX_MODULE_READY_TIME 2000
24 24
25# ifndef __ASSEMBLER__
26extern void __iomem *cm_base;
27extern void __iomem *cm2_base;
28extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2);
29# endif
30
25/* 31/*
26 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for 32 * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for
27 * the PRCM to request that a module enter the inactive state in the 33 * the PRCM to request that a module enter the inactive state in the
@@ -33,4 +39,26 @@
33 */ 39 */
34#define MAX_MODULE_DISABLE_TIME 5000 40#define MAX_MODULE_DISABLE_TIME 5000
35 41
42# ifndef __ASSEMBLER__
43
44/**
45 * struct cm_ll_data - fn ptrs to per-SoC CM function implementations
46 * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl
47 * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl
48 */
49struct cm_ll_data {
50 int (*split_idlest_reg)(void __iomem *idlest_reg, s16 *prcm_inst,
51 u8 *idlest_reg_id);
52 int (*wait_module_ready)(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
53};
54
55extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
56 u8 *idlest_reg_id);
57extern int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift);
58
59extern int cm_register(struct cm_ll_data *cld);
60extern int cm_unregister(struct cm_ll_data *cld);
61
62# endif
63
36#endif 64#endif
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
new file mode 100644
index 000000000000..db650690e9d0
--- /dev/null
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -0,0 +1,381 @@
1/*
2 * OMAP2xxx CM module functions
3 *
4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/kernel.h>
15#include <linux/types.h>
16#include <linux/delay.h>
17#include <linux/errno.h>
18#include <linux/err.h>
19#include <linux/io.h>
20
21#include "soc.h"
22#include "iomap.h"
23#include "common.h"
24#include "prm2xxx.h"
25#include "cm.h"
26#include "cm2xxx.h"
27#include "cm-regbits-24xx.h"
28#include "clockdomain.h"
29
30/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */
31#define DPLL_AUTOIDLE_DISABLE 0x0
32#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
33
34/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
35#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
36#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
37
38/* CM_IDLEST_PLL bit value offset for APLLs (OMAP2xxx only) */
39#define EN_APLL_LOCKED 3
40
41static const u8 omap2xxx_cm_idlest_offs[] = {
42 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
43};
44
45/*
46 *
47 */
48
49static void _write_clktrctrl(u8 c, s16 module, u32 mask)
50{
51 u32 v;
52
53 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
54 v &= ~mask;
55 v |= c << __ffs(mask);
56 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
57}
58
59bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
60{
61 u32 v;
62
63 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
64 v &= mask;
65 v >>= __ffs(mask);
66
67 return (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
68}
69
70void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
71{
72 _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
73}
74
75void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
76{
77 _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
78}
79
80/*
81 * DPLL autoidle control
82 */
83
84static void _omap2xxx_set_dpll_autoidle(u8 m)
85{
86 u32 v;
87
88 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
89 v &= ~OMAP24XX_AUTO_DPLL_MASK;
90 v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
91 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
92}
93
94void omap2xxx_cm_set_dpll_disable_autoidle(void)
95{
96 _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP);
97}
98
99void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
100{
101 _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE);
102}
103
104/*
105 * APLL control
106 */
107
108static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
109{
110 u32 v;
111
112 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE);
113 v &= ~mask;
114 v |= m << __ffs(mask);
115 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
116}
117
118void omap2xxx_cm_set_apll54_disable_autoidle(void)
119{
120 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
121 OMAP24XX_AUTO_54M_MASK);
122}
123
124void omap2xxx_cm_set_apll54_auto_low_power_stop(void)
125{
126 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
127 OMAP24XX_AUTO_54M_MASK);
128}
129
130void omap2xxx_cm_set_apll96_disable_autoidle(void)
131{
132 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP,
133 OMAP24XX_AUTO_96M_MASK);
134}
135
136void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
137{
138 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE,
139 OMAP24XX_AUTO_96M_MASK);
140}
141
142/* Enable an APLL if off */
143static int _omap2xxx_apll_enable(u8 enable_bit, u8 status_bit)
144{
145 u32 v, m;
146
147 m = EN_APLL_LOCKED << enable_bit;
148
149 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
150 if (v & m)
151 return 0; /* apll already enabled */
152
153 v |= m;
154 omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
155
156 omap2xxx_cm_wait_module_ready(PLL_MOD, 1, status_bit);
157
158 /*
159 * REVISIT: Should we return an error code if
160 * omap2xxx_cm_wait_module_ready() fails?
161 */
162 return 0;
163}
164
165/* Stop APLL */
166static void _omap2xxx_apll_disable(u8 enable_bit)
167{
168 u32 v;
169
170 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN);
171 v &= ~(EN_APLL_LOCKED << enable_bit);
172 omap2_cm_write_mod_reg(v, PLL_MOD, CM_CLKEN);
173}
174
175/* Enable an APLL if off */
176int omap2xxx_cm_apll54_enable(void)
177{
178 return _omap2xxx_apll_enable(OMAP24XX_EN_54M_PLL_SHIFT,
179 OMAP24XX_ST_54M_APLL_SHIFT);
180}
181
182/* Enable an APLL if off */
183int omap2xxx_cm_apll96_enable(void)
184{
185 return _omap2xxx_apll_enable(OMAP24XX_EN_96M_PLL_SHIFT,
186 OMAP24XX_ST_96M_APLL_SHIFT);
187}
188
189/* Stop APLL */
190void omap2xxx_cm_apll54_disable(void)
191{
192 _omap2xxx_apll_disable(OMAP24XX_EN_54M_PLL_SHIFT);
193}
194
195/* Stop APLL */
196void omap2xxx_cm_apll96_disable(void)
197{
198 _omap2xxx_apll_disable(OMAP24XX_EN_96M_PLL_SHIFT);
199}
200
201/**
202 * omap2xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components
203 * @idlest_reg: CM_IDLEST* virtual address
204 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
205 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
206 *
207 * XXX This function is only needed until absolute register addresses are
208 * removed from the OMAP struct clk records.
209 */
210int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
211 u8 *idlest_reg_id)
212{
213 unsigned long offs;
214 u8 idlest_offs;
215 int i;
216
217 if (idlest_reg < cm_base || idlest_reg > (cm_base + 0x0fff))
218 return -EINVAL;
219
220 idlest_offs = (unsigned long)idlest_reg & 0xff;
221 for (i = 0; i < ARRAY_SIZE(omap2xxx_cm_idlest_offs); i++) {
222 if (idlest_offs == omap2xxx_cm_idlest_offs[i]) {
223 *idlest_reg_id = i + 1;
224 break;
225 }
226 }
227
228 if (i == ARRAY_SIZE(omap2xxx_cm_idlest_offs))
229 return -EINVAL;
230
231 offs = idlest_reg - cm_base;
232 offs &= 0xff00;
233 *prcm_inst = offs;
234
235 return 0;
236}
237
238/*
239 *
240 */
241
242/**
243 * omap2xxx_cm_wait_module_ready - wait for a module to leave idle or standby
244 * @prcm_mod: PRCM module offset
245 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
246 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
247 *
248 * Wait for the PRCM to indicate that the module identified by
249 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
250 * success or -EBUSY if the module doesn't enable in time.
251 */
252int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
253{
254 int ena = 0, i = 0;
255 u8 cm_idlest_reg;
256 u32 mask;
257
258 if (!idlest_id || (idlest_id > ARRAY_SIZE(omap2xxx_cm_idlest_offs)))
259 return -EINVAL;
260
261 cm_idlest_reg = omap2xxx_cm_idlest_offs[idlest_id - 1];
262
263 mask = 1 << idlest_shift;
264 ena = mask;
265
266 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
267 mask) == ena), MAX_MODULE_READY_TIME, i);
268
269 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
270}
271
272/* Clockdomain low-level functions */
273
274static void omap2xxx_clkdm_allow_idle(struct clockdomain *clkdm)
275{
276 if (atomic_read(&clkdm->usecount) > 0)
277 _clkdm_add_autodeps(clkdm);
278
279 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
280 clkdm->clktrctrl_mask);
281}
282
283static void omap2xxx_clkdm_deny_idle(struct clockdomain *clkdm)
284{
285 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
286 clkdm->clktrctrl_mask);
287
288 if (atomic_read(&clkdm->usecount) > 0)
289 _clkdm_del_autodeps(clkdm);
290}
291
292static int omap2xxx_clkdm_clk_enable(struct clockdomain *clkdm)
293{
294 bool hwsup = false;
295
296 if (!clkdm->clktrctrl_mask)
297 return 0;
298
299 hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
300 clkdm->clktrctrl_mask);
301
302 if (hwsup) {
303 /* Disable HW transitions when we are changing deps */
304 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
305 clkdm->clktrctrl_mask);
306 _clkdm_add_autodeps(clkdm);
307 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
308 clkdm->clktrctrl_mask);
309 } else {
310 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
311 omap2xxx_clkdm_wakeup(clkdm);
312 }
313
314 return 0;
315}
316
317static int omap2xxx_clkdm_clk_disable(struct clockdomain *clkdm)
318{
319 bool hwsup = false;
320
321 if (!clkdm->clktrctrl_mask)
322 return 0;
323
324 hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
325 clkdm->clktrctrl_mask);
326
327 if (hwsup) {
328 /* Disable HW transitions when we are changing deps */
329 omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
330 clkdm->clktrctrl_mask);
331 _clkdm_del_autodeps(clkdm);
332 omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
333 clkdm->clktrctrl_mask);
334 } else {
335 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
336 omap2xxx_clkdm_sleep(clkdm);
337 }
338
339 return 0;
340}
341
342struct clkdm_ops omap2_clkdm_operations = {
343 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
344 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
345 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
346 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
347 .clkdm_sleep = omap2xxx_clkdm_sleep,
348 .clkdm_wakeup = omap2xxx_clkdm_wakeup,
349 .clkdm_allow_idle = omap2xxx_clkdm_allow_idle,
350 .clkdm_deny_idle = omap2xxx_clkdm_deny_idle,
351 .clkdm_clk_enable = omap2xxx_clkdm_clk_enable,
352 .clkdm_clk_disable = omap2xxx_clkdm_clk_disable,
353};
354
355/*
356 *
357 */
358
359static struct cm_ll_data omap2xxx_cm_ll_data = {
360 .split_idlest_reg = &omap2xxx_cm_split_idlest_reg,
361 .wait_module_ready = &omap2xxx_cm_wait_module_ready,
362};
363
364int __init omap2xxx_cm_init(void)
365{
366 if (!cpu_is_omap24xx())
367 return 0;
368
369 return cm_register(&omap2xxx_cm_ll_data);
370}
371
372static void __exit omap2xxx_cm_exit(void)
373{
374 if (!cpu_is_omap24xx())
375 return;
376
377 /* Should never happen */
378 WARN(cm_unregister(&omap2xxx_cm_ll_data),
379 "%s: cm_ll_data function pointer mismatch\n", __func__);
380}
381__exitcall(omap2xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm2xxx.h b/arch/arm/mach-omap2/cm2xxx.h
new file mode 100644
index 000000000000..4cbb39b051d2
--- /dev/null
+++ b/arch/arm/mach-omap2/cm2xxx.h
@@ -0,0 +1,70 @@
1/*
2 * OMAP2xxx Clock Management (CM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * The CM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The CM modules/instances on OMAP4 are quite different, so
14 * they are handled in a separate file.
15 */
16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_H
18
19#include "prcm-common.h"
20#include "cm2xxx_3xxx.h"
21
22#define OMAP2420_CM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
24#define OMAP2430_CM_REGADDR(module, reg) \
25 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
26
27/*
28 * Module specific CM register offsets from CM_BASE + domain offset
29 * Use cm_{read,write}_mod_reg() with these registers.
30 * These register offsets generally appear in more than one PRCM submodule.
31 */
32
33/* OMAP2-specific register offsets */
34
35#define OMAP24XX_CM_FCLKEN2 0x0004
36#define OMAP24XX_CM_ICLKEN4 0x001c
37#define OMAP24XX_CM_AUTOIDLE4 0x003c
38#define OMAP24XX_CM_IDLEST4 0x002c
39
40/* CM_IDLEST bit field values to indicate deasserted IdleReq */
41
42#define OMAP24XX_CM_IDLEST_VAL 0
43
44
45/* Clock management domain register get/set */
46
47#ifndef __ASSEMBLER__
48
49extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
50extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
51
52extern void omap2xxx_cm_set_dpll_disable_autoidle(void);
53extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void);
54
55extern void omap2xxx_cm_set_apll54_disable_autoidle(void);
56extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void);
57extern void omap2xxx_cm_set_apll96_disable_autoidle(void);
58extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
59
60extern bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
61extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
62 u8 idlest_shift);
63extern int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
64 s16 *prcm_inst, u8 *idlest_reg_id);
65
66extern int __init omap2xxx_cm_init(void);
67
68#endif
69
70#endif
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h
index 57b2f3c2fbf3..bfbd16fe9151 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h
@@ -16,28 +16,7 @@
16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H 16#ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H 17#define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H
18 18
19#include "prcm-common.h" 19#include "cm.h"
20
21#define OMAP2420_CM_REGADDR(module, reg) \
22 OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg))
23#define OMAP2430_CM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg))
25#define OMAP34XX_CM_REGADDR(module, reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
27
28
29/*
30 * OMAP3-specific global CM registers
31 * Use cm_{read,write}_reg() with these registers.
32 * These registers appear once per CM module.
33 */
34
35#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
36#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
37#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
38
39#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
40#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
41 20
42/* 21/*
43 * Module specific CM register offsets from CM_BASE + domain offset 22 * Module specific CM register offsets from CM_BASE + domain offset
@@ -57,6 +36,7 @@
57#define CM_IDLEST 0x0020 36#define CM_IDLEST 0x0020
58#define CM_IDLEST1 CM_IDLEST 37#define CM_IDLEST1 CM_IDLEST
59#define CM_IDLEST2 0x0024 38#define CM_IDLEST2 0x0024
39#define OMAP2430_CM_IDLEST3 0x0028
60#define CM_AUTOIDLE 0x0030 40#define CM_AUTOIDLE 0x0030
61#define CM_AUTOIDLE1 CM_AUTOIDLE 41#define CM_AUTOIDLE1 CM_AUTOIDLE
62#define CM_AUTOIDLE2 0x0034 42#define CM_AUTOIDLE2 0x0034
@@ -66,70 +46,60 @@
66#define CM_CLKSEL2 0x0044 46#define CM_CLKSEL2 0x0044
67#define OMAP2_CM_CLKSTCTRL 0x0048 47#define OMAP2_CM_CLKSTCTRL 0x0048
68 48
69/* OMAP2-specific register offsets */ 49#ifndef __ASSEMBLER__
70
71#define OMAP24XX_CM_FCLKEN2 0x0004
72#define OMAP24XX_CM_ICLKEN4 0x001c
73#define OMAP24XX_CM_AUTOIDLE4 0x003c
74#define OMAP24XX_CM_IDLEST4 0x002c
75
76#define OMAP2430_CM_IDLEST3 0x0028
77
78/* OMAP3-specific register offsets */
79
80#define OMAP3430_CM_CLKEN_PLL 0x0004
81#define OMAP3430ES2_CM_CLKEN2 0x0004
82#define OMAP3430ES2_CM_FCLKEN3 0x0008
83#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
84#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
85#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
86#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
87#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
88#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
89#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
90#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
91#define OMAP3430_CM_CLKSTST 0x004c
92#define OMAP3430ES2_CM_CLKSEL4 0x004c
93#define OMAP3430ES2_CM_CLKSEL5 0x0050
94#define OMAP3430_CM_CLKSEL2_EMU 0x0050
95#define OMAP3430_CM_CLKSEL3_EMU 0x0054
96 50
51#include <linux/io.h>
97 52
98/* CM_IDLEST bit field values to indicate deasserted IdleReq */ 53static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
54{
55 return __raw_readl(cm_base + module + idx);
56}
99 57
100#define OMAP24XX_CM_IDLEST_VAL 0 58static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
101#define OMAP34XX_CM_IDLEST_VAL 1 59{
60 __raw_writel(val, cm_base + module + idx);
61}
102 62
63/* Read-modify-write a register in a CM module. Caller must lock */
64static inline u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
65 s16 idx)
66{
67 u32 v;
103 68
104/* Clock management domain register get/set */ 69 v = omap2_cm_read_mod_reg(module, idx);
70 v &= ~mask;
71 v |= bits;
72 omap2_cm_write_mod_reg(v, module, idx);
105 73
106#ifndef __ASSEMBLER__ 74 return v;
75}
107 76
108extern u32 omap2_cm_read_mod_reg(s16 module, u16 idx); 77/* Read a CM register, AND it, and shift the result down to bit 0 */
109extern void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx); 78static inline u32 omap2_cm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
110extern u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); 79{
80 u32 v;
111 81
112extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, 82 v = omap2_cm_read_mod_reg(domain, idx);
113 u8 idlest_shift); 83 v &= mask;
114extern u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx); 84 v >>= __ffs(mask);
115extern u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx);
116 85
117extern bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask); 86 return v;
118extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); 87}
119extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
120 88
121extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); 89static inline u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
122extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask); 90{
123extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask); 91 return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
124extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask); 92}
125 93
126extern void omap2xxx_cm_set_dpll_disable_autoidle(void); 94static inline u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
127extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void); 95{
96 return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
97}
128 98
129extern void omap2xxx_cm_set_apll54_disable_autoidle(void); 99extern int omap2xxx_cm_apll54_enable(void);
130extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void); 100extern void omap2xxx_cm_apll54_disable(void);
131extern void omap2xxx_cm_set_apll96_disable_autoidle(void); 101extern int omap2xxx_cm_apll96_enable(void);
132extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void); 102extern void omap2xxx_cm_apll96_disable(void);
133 103
134#endif 104#endif
135 105
@@ -138,6 +108,7 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
138/* CM_CLKSEL_GFX */ 108/* CM_CLKSEL_GFX */
139#define OMAP_CLKSEL_GFX_SHIFT 0 109#define OMAP_CLKSEL_GFX_SHIFT 0
140#define OMAP_CLKSEL_GFX_MASK (0x7 << 0) 110#define OMAP_CLKSEL_GFX_MASK (0x7 << 0)
111#define OMAP_CLKSEL_GFX_WIDTH 3
141 112
142/* CM_ICLKEN_GFX */ 113/* CM_ICLKEN_GFX */
143#define OMAP_EN_GFX_SHIFT 0 114#define OMAP_EN_GFX_SHIFT 0
@@ -146,11 +117,4 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
146/* CM_IDLEST_GFX */ 117/* CM_IDLEST_GFX */
147#define OMAP_ST_GFX_MASK (1 << 0) 118#define OMAP_ST_GFX_MASK (1 << 0)
148 119
149
150/* Function prototypes */
151# ifndef __ASSEMBLER__
152extern void omap3_cm_save_context(void);
153extern void omap3_cm_restore_context(void);
154# endif
155
156#endif 120#endif
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c
index ed8dcaf4c849..058ce3c0873e 100644
--- a/arch/arm/mach-omap2/cm33xx.c
+++ b/arch/arm/mach-omap2/cm33xx.c
@@ -22,6 +22,7 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <linux/io.h> 23#include <linux/io.h>
24 24
25#include "clockdomain.h"
25#include "cm.h" 26#include "cm.h"
26#include "cm33xx.h" 27#include "cm33xx.h"
27#include "cm-regbits-34xx.h" 28#include "cm-regbits-34xx.h"
@@ -309,3 +310,58 @@ void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs)
309 v &= ~AM33XX_MODULEMODE_MASK; 310 v &= ~AM33XX_MODULEMODE_MASK;
310 am33xx_cm_write_reg(v, inst, clkctrl_offs); 311 am33xx_cm_write_reg(v, inst, clkctrl_offs);
311} 312}
313
314/*
315 * Clockdomain low-level functions
316 */
317
318static int am33xx_clkdm_sleep(struct clockdomain *clkdm)
319{
320 am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs);
321 return 0;
322}
323
324static int am33xx_clkdm_wakeup(struct clockdomain *clkdm)
325{
326 am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs);
327 return 0;
328}
329
330static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm)
331{
332 am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
333}
334
335static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm)
336{
337 am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
338}
339
340static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm)
341{
342 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
343 return am33xx_clkdm_wakeup(clkdm);
344
345 return 0;
346}
347
348static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm)
349{
350 bool hwsup = false;
351
352 hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs);
353
354 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
355 am33xx_clkdm_sleep(clkdm);
356
357 return 0;
358}
359
360struct clkdm_ops am33xx_clkdm_operations = {
361 .clkdm_sleep = am33xx_clkdm_sleep,
362 .clkdm_wakeup = am33xx_clkdm_wakeup,
363 .clkdm_allow_idle = am33xx_clkdm_allow_idle,
364 .clkdm_deny_idle = am33xx_clkdm_deny_idle,
365 .clkdm_clk_enable = am33xx_clkdm_clk_enable,
366 .clkdm_clk_disable = am33xx_clkdm_clk_disable,
367};
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 7f07ab02a5b3..c2086f2e86b6 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -1,8 +1,10 @@
1/* 1/*
2 * OMAP2/3 CM module functions 2 * OMAP3xxx CM module functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc.
5 * Paul Walmsley 6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
6 * 8 *
7 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -12,8 +14,6 @@
12#include <linux/kernel.h> 14#include <linux/kernel.h>
13#include <linux/types.h> 15#include <linux/types.h>
14#include <linux/delay.h> 16#include <linux/delay.h>
15#include <linux/spinlock.h>
16#include <linux/list.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
@@ -21,56 +21,16 @@
21#include "soc.h" 21#include "soc.h"
22#include "iomap.h" 22#include "iomap.h"
23#include "common.h" 23#include "common.h"
24#include "prm2xxx_3xxx.h"
24#include "cm.h" 25#include "cm.h"
25#include "cm2xxx_3xxx.h" 26#include "cm3xxx.h"
26#include "cm-regbits-24xx.h"
27#include "cm-regbits-34xx.h" 27#include "cm-regbits-34xx.h"
28#include "clockdomain.h"
28 29
29/* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */ 30static const u8 omap3xxx_cm_idlest_offs[] = {
30#define DPLL_AUTOIDLE_DISABLE 0x0 31 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3
31#define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3
32
33/* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */
34#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
35#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
36
37static const u8 cm_idlest_offs[] = {
38 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
39}; 32};
40 33
41u32 omap2_cm_read_mod_reg(s16 module, u16 idx)
42{
43 return __raw_readl(cm_base + module + idx);
44}
45
46void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx)
47{
48 __raw_writel(val, cm_base + module + idx);
49}
50
51/* Read-modify-write a register in a CM module. Caller must lock */
52u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
53{
54 u32 v;
55
56 v = omap2_cm_read_mod_reg(module, idx);
57 v &= ~mask;
58 v |= bits;
59 omap2_cm_write_mod_reg(v, module, idx);
60
61 return v;
62}
63
64u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
65{
66 return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx);
67}
68
69u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
70{
71 return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
72}
73
74/* 34/*
75 * 35 *
76 */ 36 */
@@ -85,33 +45,15 @@ static void _write_clktrctrl(u8 c, s16 module, u32 mask)
85 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL); 45 omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL);
86} 46}
87 47
88bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask) 48bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask)
89{ 49{
90 u32 v; 50 u32 v;
91 bool ret = 0;
92
93 BUG_ON(!cpu_is_omap24xx() && !cpu_is_omap34xx());
94 51
95 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL); 52 v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL);
96 v &= mask; 53 v &= mask;
97 v >>= __ffs(mask); 54 v >>= __ffs(mask);
98 55
99 if (cpu_is_omap24xx()) 56 return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
100 ret = (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
101 else
102 ret = (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0;
103
104 return ret;
105}
106
107void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
108{
109 _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask);
110}
111
112void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask)
113{
114 _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask);
115} 57}
116 58
117void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) 59void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask)
@@ -135,109 +77,247 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask)
135} 77}
136 78
137/* 79/*
138 * DPLL autoidle control 80 *
139 */ 81 */
140 82
141static void _omap2xxx_set_dpll_autoidle(u8 m) 83/**
84 * omap3xxx_cm_wait_module_ready - wait for a module to leave idle or standby
85 * @prcm_mod: PRCM module offset
86 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
87 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
88 *
89 * Wait for the PRCM to indicate that the module identified by
90 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
91 * success or -EBUSY if the module doesn't enable in time.
92 */
93int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
142{ 94{
143 u32 v; 95 int ena = 0, i = 0;
96 u8 cm_idlest_reg;
97 u32 mask;
144 98
145 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); 99 if (!idlest_id || (idlest_id > ARRAY_SIZE(omap3xxx_cm_idlest_offs)))
146 v &= ~OMAP24XX_AUTO_DPLL_MASK; 100 return -EINVAL;
147 v |= m << OMAP24XX_AUTO_DPLL_SHIFT;
148 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE);
149}
150 101
151void omap2xxx_cm_set_dpll_disable_autoidle(void) 102 cm_idlest_reg = omap3xxx_cm_idlest_offs[idlest_id - 1];
152{ 103
153 _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP); 104 mask = 1 << idlest_shift;
105 ena = 0;
106
107 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) &
108 mask) == ena), MAX_MODULE_READY_TIME, i);
109
110 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
154} 111}
155 112
156void omap2xxx_cm_set_dpll_auto_low_power_stop(void) 113/**
114 * omap3xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components
115 * @idlest_reg: CM_IDLEST* virtual address
116 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
117 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
118 *
119 * XXX This function is only needed until absolute register addresses are
120 * removed from the OMAP struct clk records.
121 */
122int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
123 u8 *idlest_reg_id)
157{ 124{
158 _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE); 125 unsigned long offs;
126 u8 idlest_offs;
127 int i;
128
129 if (idlest_reg < (cm_base + OMAP3430_IVA2_MOD) ||
130 idlest_reg > (cm_base + 0x1ffff))
131 return -EINVAL;
132
133 idlest_offs = (unsigned long)idlest_reg & 0xff;
134 for (i = 0; i < ARRAY_SIZE(omap3xxx_cm_idlest_offs); i++) {
135 if (idlest_offs == omap3xxx_cm_idlest_offs[i]) {
136 *idlest_reg_id = i + 1;
137 break;
138 }
139 }
140
141 if (i == ARRAY_SIZE(omap3xxx_cm_idlest_offs))
142 return -EINVAL;
143
144 offs = idlest_reg - cm_base;
145 offs &= 0xff00;
146 *prcm_inst = offs;
147
148 return 0;
159} 149}
160 150
161/* 151/* Clockdomain low-level operations */
162 * APLL autoidle control
163 */
164 152
165static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask) 153static int omap3xxx_clkdm_add_sleepdep(struct clockdomain *clkdm1,
154 struct clockdomain *clkdm2)
166{ 155{
167 u32 v; 156 omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit),
157 clkdm1->pwrdm.ptr->prcm_offs,
158 OMAP3430_CM_SLEEPDEP);
159 return 0;
160}
168 161
169 v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); 162static int omap3xxx_clkdm_del_sleepdep(struct clockdomain *clkdm1,
170 v &= ~mask; 163 struct clockdomain *clkdm2)
171 v |= m << __ffs(mask); 164{
172 omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE); 165 omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
166 clkdm1->pwrdm.ptr->prcm_offs,
167 OMAP3430_CM_SLEEPDEP);
168 return 0;
173} 169}
174 170
175void omap2xxx_cm_set_apll54_disable_autoidle(void) 171static int omap3xxx_clkdm_read_sleepdep(struct clockdomain *clkdm1,
172 struct clockdomain *clkdm2)
176{ 173{
177 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, 174 return omap2_cm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
178 OMAP24XX_AUTO_54M_MASK); 175 OMAP3430_CM_SLEEPDEP,
176 (1 << clkdm2->dep_bit));
179} 177}
180 178
181void omap2xxx_cm_set_apll54_auto_low_power_stop(void) 179static int omap3xxx_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm)
182{ 180{
183 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, 181 struct clkdm_dep *cd;
184 OMAP24XX_AUTO_54M_MASK); 182 u32 mask = 0;
183
184 for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) {
185 if (!cd->clkdm)
186 continue; /* only happens if data is erroneous */
187
188 mask |= 1 << cd->clkdm->dep_bit;
189 atomic_set(&cd->sleepdep_usecount, 0);
190 }
191 omap2_cm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
192 OMAP3430_CM_SLEEPDEP);
193 return 0;
185} 194}
186 195
187void omap2xxx_cm_set_apll96_disable_autoidle(void) 196static int omap3xxx_clkdm_sleep(struct clockdomain *clkdm)
188{ 197{
189 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, 198 omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs,
190 OMAP24XX_AUTO_96M_MASK); 199 clkdm->clktrctrl_mask);
200 return 0;
191} 201}
192 202
193void omap2xxx_cm_set_apll96_auto_low_power_stop(void) 203static int omap3xxx_clkdm_wakeup(struct clockdomain *clkdm)
194{ 204{
195 _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, 205 omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs,
196 OMAP24XX_AUTO_96M_MASK); 206 clkdm->clktrctrl_mask);
207 return 0;
197} 208}
198 209
199/* 210static void omap3xxx_clkdm_allow_idle(struct clockdomain *clkdm)
200 * 211{
201 */ 212 if (atomic_read(&clkdm->usecount) > 0)
213 _clkdm_add_autodeps(clkdm);
202 214
203/** 215 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
204 * omap2_cm_wait_idlest_ready - wait for a module to leave idle or standby 216 clkdm->clktrctrl_mask);
205 * @prcm_mod: PRCM module offset 217}
206 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) 218
207 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check 219static void omap3xxx_clkdm_deny_idle(struct clockdomain *clkdm)
208 *
209 * XXX document
210 */
211int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
212{ 220{
213 int ena = 0, i = 0; 221 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
214 u8 cm_idlest_reg; 222 clkdm->clktrctrl_mask);
215 u32 mask;
216 223
217 if (!idlest_id || (idlest_id > ARRAY_SIZE(cm_idlest_offs))) 224 if (atomic_read(&clkdm->usecount) > 0)
218 return -EINVAL; 225 _clkdm_del_autodeps(clkdm);
226}
219 227
220 cm_idlest_reg = cm_idlest_offs[idlest_id - 1]; 228static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm)
229{
230 bool hwsup = false;
221 231
222 mask = 1 << idlest_shift; 232 if (!clkdm->clktrctrl_mask)
233 return 0;
223 234
224 if (cpu_is_omap24xx()) 235 /*
225 ena = mask; 236 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
226 else if (cpu_is_omap34xx()) 237 * more details on the unpleasant problem this is working
227 ena = 0; 238 * around
228 else 239 */
229 BUG(); 240 if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) &&
241 (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) {
242 omap3xxx_clkdm_wakeup(clkdm);
243 return 0;
244 }
245
246 hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
247 clkdm->clktrctrl_mask);
248
249 if (hwsup) {
250 /* Disable HW transitions when we are changing deps */
251 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
252 clkdm->clktrctrl_mask);
253 _clkdm_add_autodeps(clkdm);
254 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
255 clkdm->clktrctrl_mask);
256 } else {
257 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
258 omap3xxx_clkdm_wakeup(clkdm);
259 }
260
261 return 0;
262}
230 263
231 omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena), 264static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm)
232 MAX_MODULE_READY_TIME, i); 265{
266 bool hwsup = false;
233 267
234 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 268 if (!clkdm->clktrctrl_mask)
269 return 0;
270
271 /*
272 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
273 * more details on the unpleasant problem this is working
274 * around
275 */
276 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
277 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
278 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
279 clkdm->clktrctrl_mask);
280 return 0;
281 }
282
283 hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs,
284 clkdm->clktrctrl_mask);
285
286 if (hwsup) {
287 /* Disable HW transitions when we are changing deps */
288 omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
289 clkdm->clktrctrl_mask);
290 _clkdm_del_autodeps(clkdm);
291 omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs,
292 clkdm->clktrctrl_mask);
293 } else {
294 if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)
295 omap3xxx_clkdm_sleep(clkdm);
296 }
297
298 return 0;
235} 299}
236 300
301struct clkdm_ops omap3_clkdm_operations = {
302 .clkdm_add_wkdep = omap2_clkdm_add_wkdep,
303 .clkdm_del_wkdep = omap2_clkdm_del_wkdep,
304 .clkdm_read_wkdep = omap2_clkdm_read_wkdep,
305 .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps,
306 .clkdm_add_sleepdep = omap3xxx_clkdm_add_sleepdep,
307 .clkdm_del_sleepdep = omap3xxx_clkdm_del_sleepdep,
308 .clkdm_read_sleepdep = omap3xxx_clkdm_read_sleepdep,
309 .clkdm_clear_all_sleepdeps = omap3xxx_clkdm_clear_all_sleepdeps,
310 .clkdm_sleep = omap3xxx_clkdm_sleep,
311 .clkdm_wakeup = omap3xxx_clkdm_wakeup,
312 .clkdm_allow_idle = omap3xxx_clkdm_allow_idle,
313 .clkdm_deny_idle = omap3xxx_clkdm_deny_idle,
314 .clkdm_clk_enable = omap3xxx_clkdm_clk_enable,
315 .clkdm_clk_disable = omap3xxx_clkdm_clk_disable,
316};
317
237/* 318/*
238 * Context save/restore code - OMAP3 only 319 * Context save/restore code - OMAP3 only
239 */ 320 */
240#ifdef CONFIG_ARCH_OMAP3
241struct omap3_cm_regs { 321struct omap3_cm_regs {
242 u32 iva2_cm_clksel1; 322 u32 iva2_cm_clksel1;
243 u32 iva2_cm_clksel2; 323 u32 iva2_cm_clksel2;
@@ -555,4 +635,31 @@ void omap3_cm_restore_context(void)
555 omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD, 635 omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD,
556 OMAP3_CM_CLKOUT_CTRL_OFFSET); 636 OMAP3_CM_CLKOUT_CTRL_OFFSET);
557} 637}
558#endif 638
639/*
640 *
641 */
642
643static struct cm_ll_data omap3xxx_cm_ll_data = {
644 .split_idlest_reg = &omap3xxx_cm_split_idlest_reg,
645 .wait_module_ready = &omap3xxx_cm_wait_module_ready,
646};
647
648int __init omap3xxx_cm_init(void)
649{
650 if (!cpu_is_omap34xx())
651 return 0;
652
653 return cm_register(&omap3xxx_cm_ll_data);
654}
655
656static void __exit omap3xxx_cm_exit(void)
657{
658 if (!cpu_is_omap34xx())
659 return;
660
661 /* Should never happen */
662 WARN(cm_unregister(&omap3xxx_cm_ll_data),
663 "%s: cm_ll_data function pointer mismatch\n", __func__);
664}
665__exitcall(omap3xxx_cm_exit);
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h
new file mode 100644
index 000000000000..e8e146f4a43f
--- /dev/null
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -0,0 +1,91 @@
1/*
2 * OMAP2/3 Clock Management (CM) register definitions
3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc.
5 * Copyright (C) 2007-2010 Nokia Corporation
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * The CM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The CM modules/instances on OMAP4 are quite different, so
14 * they are handled in a separate file.
15 */
16#ifndef __ARCH_ASM_MACH_OMAP2_CM3XXX_H
17#define __ARCH_ASM_MACH_OMAP2_CM3XXX_H
18
19#include "prcm-common.h"
20#include "cm2xxx_3xxx.h"
21
22#define OMAP34XX_CM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg))
24
25
26/*
27 * OMAP3-specific global CM registers
28 * Use cm_{read,write}_reg() with these registers.
29 * These registers appear once per CM module.
30 */
31
32#define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000)
33#define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010)
34#define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c)
35
36#define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070
37#define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
38
39/*
40 * Module specific CM register offsets from CM_BASE + domain offset
41 * Use cm_{read,write}_mod_reg() with these registers.
42 * These register offsets generally appear in more than one PRCM submodule.
43 */
44
45/* OMAP3-specific register offsets */
46
47#define OMAP3430_CM_CLKEN_PLL 0x0004
48#define OMAP3430ES2_CM_CLKEN2 0x0004
49#define OMAP3430ES2_CM_FCLKEN3 0x0008
50#define OMAP3430_CM_IDLEST_PLL CM_IDLEST2
51#define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2
52#define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2
53#define OMAP3430_CM_CLKSEL1 CM_CLKSEL
54#define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL
55#define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2
56#define OMAP3430_CM_SLEEPDEP CM_CLKSEL2
57#define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL
58#define OMAP3430_CM_CLKSTST 0x004c
59#define OMAP3430ES2_CM_CLKSEL4 0x004c
60#define OMAP3430ES2_CM_CLKSEL5 0x0050
61#define OMAP3430_CM_CLKSEL2_EMU 0x0050
62#define OMAP3430_CM_CLKSEL3_EMU 0x0054
63
64
65/* CM_IDLEST bit field values to indicate deasserted IdleReq */
66
67#define OMAP34XX_CM_IDLEST_VAL 1
68
69
70#ifndef __ASSEMBLER__
71
72extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask);
73extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask);
74extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask);
75extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask);
76
77extern bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
78extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
79 u8 idlest_shift);
80
81extern int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
82 s16 *prcm_inst, u8 *idlest_reg_id);
83
84extern void omap3_cm_save_context(void);
85extern void omap3_cm_restore_context(void);
86
87extern int __init omap3xxx_cm_init(void);
88
89#endif
90
91#endif
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
new file mode 100644
index 000000000000..0bab493ec133
--- /dev/null
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -0,0 +1,139 @@
1/*
2 * OMAP2+ common Clock Management (CM) IP block functions
3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * XXX This code should eventually be moved to a CM driver.
12 */
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16
17#include "cm2xxx.h"
18#include "cm3xxx.h"
19#include "cm44xx.h"
20#include "common.h"
21
22/*
23 * cm_ll_data: function pointers to SoC-specific implementations of
24 * common CM functions
25 */
26static struct cm_ll_data null_cm_ll_data;
27static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
28
29/* cm_base: base virtual address of the CM IP block */
30void __iomem *cm_base;
31
32/* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */
33void __iomem *cm2_base;
34
35/**
36 * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use)
37 * @cm: CM base virtual address
38 * @cm2: CM2 base virtual address (if present on the booted SoC)
39 *
40 * XXX Will be replaced when the PRM/CM drivers are completed.
41 */
42void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2)
43{
44 cm_base = cm;
45 cm2_base = cm2;
46}
47
48/**
49 * cm_split_idlest_reg - split CM_IDLEST reg addr into its components
50 * @idlest_reg: CM_IDLEST* virtual address
51 * @prcm_inst: pointer to an s16 to return the PRCM instance offset
52 * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID
53 *
54 * Given an absolute CM_IDLEST register address @idlest_reg, passes
55 * the PRCM instance offset and IDLEST register ID back to the caller
56 * via the @prcm_inst and @idlest_reg_id. Returns -EINVAL upon error,
57 * or 0 upon success. XXX This function is only needed until absolute
58 * register addresses are removed from the OMAP struct clk records.
59 */
60int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst,
61 u8 *idlest_reg_id)
62{
63 if (!cm_ll_data->split_idlest_reg) {
64 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
65 __func__);
66 return -EINVAL;
67 }
68
69 return cm_ll_data->split_idlest_reg(idlest_reg, prcm_inst,
70 idlest_reg_id);
71}
72
73/**
74 * cm_wait_module_ready - wait for a module to leave idle or standby
75 * @prcm_mod: PRCM module offset
76 * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3)
77 * @idlest_shift: shift of the bit in the CM_IDLEST* register to check
78 *
79 * Wait for the PRCM to indicate that the module identified by
80 * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon
81 * success, -EBUSY if the module doesn't enable in time, or -EINVAL if
82 * no per-SoC wait_module_ready() function pointer has been registered
83 * or if the idlest register is unknown on the SoC.
84 */
85int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
86{
87 if (!cm_ll_data->wait_module_ready) {
88 WARN_ONCE(1, "cm: %s: no low-level function defined\n",
89 __func__);
90 return -EINVAL;
91 }
92
93 return cm_ll_data->wait_module_ready(prcm_mod, idlest_id, idlest_shift);
94}
95
96/**
97 * cm_register - register per-SoC low-level data with the CM
98 * @cld: low-level per-SoC OMAP CM data & function pointers to register
99 *
100 * Register per-SoC low-level OMAP CM data and function pointers with
101 * the OMAP CM common interface. The caller must keep the data
102 * pointed to by @cld valid until it calls cm_unregister() and
103 * it returns successfully. Returns 0 upon success, -EINVAL if @cld
104 * is NULL, or -EEXIST if cm_register() has already been called
105 * without an intervening cm_unregister().
106 */
107int cm_register(struct cm_ll_data *cld)
108{
109 if (!cld)
110 return -EINVAL;
111
112 if (cm_ll_data != &null_cm_ll_data)
113 return -EEXIST;
114
115 cm_ll_data = cld;
116
117 return 0;
118}
119
120/**
121 * cm_unregister - unregister per-SoC low-level data & function pointers
122 * @cld: low-level per-SoC OMAP CM data & function pointers to unregister
123 *
124 * Unregister per-SoC low-level OMAP CM data and function pointers
125 * that were previously registered with cm_register(). The
126 * caller may not destroy any of the data pointed to by @cld until
127 * this function returns successfully. Returns 0 upon success, or
128 * -EINVAL if @cld is NULL or if @cld does not match the struct
129 * cm_ll_data * previously registered by cm_register().
130 */
131int cm_unregister(struct cm_ll_data *cld)
132{
133 if (!cld || cm_ll_data != cld)
134 return -EINVAL;
135
136 cm_ll_data = &null_cm_ll_data;
137
138 return 0;
139}
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c
index 1894015ff04b..7f9a464f01e9 100644
--- a/arch/arm/mach-omap2/cminst44xx.c
+++ b/arch/arm/mach-omap2/cminst44xx.c
@@ -2,8 +2,9 @@
2 * OMAP4 CM instance functions 2 * OMAP4 CM instance functions
3 * 3 *
4 * Copyright (C) 2009 Nokia Corporation 4 * Copyright (C) 2009 Nokia Corporation
5 * Copyright (C) 2011 Texas Instruments, Inc. 5 * Copyright (C) 2008-2011 Texas Instruments, Inc.
6 * Paul Walmsley 6 * Paul Walmsley
7 * Rajendra Nayak <rnayak@ti.com>
7 * 8 *
8 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
@@ -22,6 +23,7 @@
22 23
23#include "iomap.h" 24#include "iomap.h"
24#include "common.h" 25#include "common.h"
26#include "clockdomain.h"
25#include "cm.h" 27#include "cm.h"
26#include "cm1_44xx.h" 28#include "cm1_44xx.h"
27#include "cm2_44xx.h" 29#include "cm2_44xx.h"
@@ -343,3 +345,141 @@ void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
343 v &= ~OMAP4430_MODULEMODE_MASK; 345 v &= ~OMAP4430_MODULEMODE_MASK;
344 omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs); 346 omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs);
345} 347}
348
349/*
350 * Clockdomain low-level functions
351 */
352
353static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1,
354 struct clockdomain *clkdm2)
355{
356 omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit),
357 clkdm1->prcm_partition,
358 clkdm1->cm_inst, clkdm1->clkdm_offs +
359 OMAP4_CM_STATICDEP);
360 return 0;
361}
362
363static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1,
364 struct clockdomain *clkdm2)
365{
366 omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit),
367 clkdm1->prcm_partition,
368 clkdm1->cm_inst, clkdm1->clkdm_offs +
369 OMAP4_CM_STATICDEP);
370 return 0;
371}
372
373static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1,
374 struct clockdomain *clkdm2)
375{
376 return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition,
377 clkdm1->cm_inst,
378 clkdm1->clkdm_offs +
379 OMAP4_CM_STATICDEP,
380 (1 << clkdm2->dep_bit));
381}
382
383static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm)
384{
385 struct clkdm_dep *cd;
386 u32 mask = 0;
387
388 if (!clkdm->prcm_partition)
389 return 0;
390
391 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
392 if (!cd->clkdm)
393 continue; /* only happens if data is erroneous */
394
395 mask |= 1 << cd->clkdm->dep_bit;
396 atomic_set(&cd->wkdep_usecount, 0);
397 }
398
399 omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition,
400 clkdm->cm_inst, clkdm->clkdm_offs +
401 OMAP4_CM_STATICDEP);
402 return 0;
403}
404
405static int omap4_clkdm_sleep(struct clockdomain *clkdm)
406{
407 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
408 clkdm->cm_inst, clkdm->clkdm_offs);
409 return 0;
410}
411
412static int omap4_clkdm_wakeup(struct clockdomain *clkdm)
413{
414 omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition,
415 clkdm->cm_inst, clkdm->clkdm_offs);
416 return 0;
417}
418
419static void omap4_clkdm_allow_idle(struct clockdomain *clkdm)
420{
421 omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition,
422 clkdm->cm_inst, clkdm->clkdm_offs);
423}
424
425static void omap4_clkdm_deny_idle(struct clockdomain *clkdm)
426{
427 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
428 omap4_clkdm_wakeup(clkdm);
429 else
430 omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition,
431 clkdm->cm_inst,
432 clkdm->clkdm_offs);
433}
434
435static int omap4_clkdm_clk_enable(struct clockdomain *clkdm)
436{
437 if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)
438 return omap4_clkdm_wakeup(clkdm);
439
440 return 0;
441}
442
443static int omap4_clkdm_clk_disable(struct clockdomain *clkdm)
444{
445 bool hwsup = false;
446
447 if (!clkdm->prcm_partition)
448 return 0;
449
450 /*
451 * The CLKDM_MISSING_IDLE_REPORTING flag documentation has
452 * more details on the unpleasant problem this is working
453 * around
454 */
455 if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING &&
456 !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) {
457 omap4_clkdm_allow_idle(clkdm);
458 return 0;
459 }
460
461 hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition,
462 clkdm->cm_inst, clkdm->clkdm_offs);
463
464 if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP))
465 omap4_clkdm_sleep(clkdm);
466
467 return 0;
468}
469
470struct clkdm_ops omap4_clkdm_operations = {
471 .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep,
472 .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep,
473 .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep,
474 .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
475 .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep,
476 .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep,
477 .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep,
478 .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps,
479 .clkdm_sleep = omap4_clkdm_sleep,
480 .clkdm_wakeup = omap4_clkdm_wakeup,
481 .clkdm_allow_idle = omap4_clkdm_allow_idle,
482 .clkdm_deny_idle = omap4_clkdm_deny_idle,
483 .clkdm_clk_enable = omap4_clkdm_clk_enable,
484 .clkdm_clk_disable = omap4_clkdm_clk_disable,
485};
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h
index d69fdefef985..bd7bab889745 100644
--- a/arch/arm/mach-omap2/cminst44xx.h
+++ b/arch/arm/mach-omap2/cminst44xx.h
@@ -38,4 +38,6 @@ extern u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst,
38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, 38extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx,
39 u32 mask); 39 u32 mask);
40 40
41extern void omap_cm_base_init(void);
42
41#endif 43#endif
diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 34fb5b95859b..5c2fd4863b2b 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -14,196 +14,13 @@
14 */ 14 */
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/clk.h>
18#include <linux/io.h>
19#include <linux/platform_data/dsp-omap.h> 17#include <linux/platform_data/dsp-omap.h>
20 18
21#include <plat/vram.h> 19#include <plat/vram.h>
22 20
23#include "soc.h"
24#include "iomap.h"
25#include "common.h" 21#include "common.h"
26#include "clock.h"
27#include "sdrc.h"
28#include "control.h"
29#include "omap-secure.h" 22#include "omap-secure.h"
30 23
31/* Global address base setup code */
32
33static void __init __omap2_set_globals(struct omap_globals *omap2_globals)
34{
35 omap2_set_globals_tap(omap2_globals);
36 omap2_set_globals_sdrc(omap2_globals);
37 omap2_set_globals_control(omap2_globals);
38 omap2_set_globals_prcm(omap2_globals);
39}
40
41#if defined(CONFIG_SOC_OMAP2420)
42
43static struct omap_globals omap242x_globals = {
44 .class = OMAP242X_CLASS,
45 .tap = OMAP2_L4_IO_ADDRESS(0x48014000),
46 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
47 .sms = OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE),
48 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
49 .prm = OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE),
50 .cm = OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE),
51};
52
53void __init omap2_set_globals_242x(void)
54{
55 __omap2_set_globals(&omap242x_globals);
56}
57
58void __init omap242x_map_io(void)
59{
60 omap242x_map_common_io();
61}
62#endif
63
64#if defined(CONFIG_SOC_OMAP2430)
65
66static struct omap_globals omap243x_globals = {
67 .class = OMAP243X_CLASS,
68 .tap = OMAP2_L4_IO_ADDRESS(0x4900a000),
69 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
70 .sms = OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE),
71 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
72 .prm = OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE),
73 .cm = OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE),
74};
75
76void __init omap2_set_globals_243x(void)
77{
78 __omap2_set_globals(&omap243x_globals);
79}
80
81void __init omap243x_map_io(void)
82{
83 omap243x_map_common_io();
84}
85#endif
86
87#if defined(CONFIG_ARCH_OMAP3)
88
89static struct omap_globals omap3_globals = {
90 .class = OMAP343X_CLASS,
91 .tap = OMAP2_L4_IO_ADDRESS(0x4830A000),
92 .sdrc = OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
93 .sms = OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE),
94 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
95 .prm = OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE),
96 .cm = OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE),
97};
98
99void __init omap2_set_globals_3xxx(void)
100{
101 __omap2_set_globals(&omap3_globals);
102}
103
104void __init omap3_map_io(void)
105{
106 omap34xx_map_common_io();
107}
108
109/*
110 * Adjust TAP register base such that omap3_check_revision accesses the correct
111 * TI81XX register for checking device ID (it adds 0x204 to tap base while
112 * TI81XX DEVICE ID register is at offset 0x600 from control base).
113 */
114#define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \
115 TI81XX_CONTROL_DEVICE_ID - 0x204)
116
117static struct omap_globals ti81xx_globals = {
118 .class = OMAP343X_CLASS,
119 .tap = OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE),
120 .ctrl = OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
121 .prm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
122 .cm = OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE),
123};
124
125void __init omap2_set_globals_ti81xx(void)
126{
127 __omap2_set_globals(&ti81xx_globals);
128}
129
130void __init ti81xx_map_io(void)
131{
132 omapti81xx_map_common_io();
133}
134#endif
135
136#if defined(CONFIG_SOC_AM33XX)
137#define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + \
138 TI81XX_CONTROL_DEVICE_ID - 0x204)
139
140static struct omap_globals am33xx_globals = {
141 .class = AM335X_CLASS,
142 .tap = AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE),
143 .ctrl = AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
144 .prm = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
145 .cm = AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE),
146};
147
148void __init omap2_set_globals_am33xx(void)
149{
150 __omap2_set_globals(&am33xx_globals);
151}
152
153void __init am33xx_map_io(void)
154{
155 omapam33xx_map_common_io();
156}
157#endif
158
159#if defined(CONFIG_ARCH_OMAP4)
160static struct omap_globals omap4_globals = {
161 .class = OMAP443X_CLASS,
162 .tap = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
163 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
164 .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE),
165 .prm = OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE),
166 .cm = OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
167 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE),
168 .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE),
169};
170
171void __init omap2_set_globals_443x(void)
172{
173 __omap2_set_globals(&omap4_globals);
174}
175
176void __init omap4_map_io(void)
177{
178 omap44xx_map_common_io();
179}
180#endif
181
182#if defined(CONFIG_SOC_OMAP5)
183static struct omap_globals omap5_globals = {
184 .class = OMAP54XX_CLASS,
185 .tap = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
186 .ctrl = OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
187 .ctrl_pad = OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE),
188 .prm = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE),
189 .cm = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
190 .cm2 = OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE),
191 .prcm_mpu = OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE),
192};
193
194void __init omap2_set_globals_5xxx(void)
195{
196 omap2_set_globals_tap(&omap5_globals);
197 omap2_set_globals_control(&omap5_globals);
198 omap2_set_globals_prcm(&omap5_globals);
199}
200
201void __init omap5_map_io(void)
202{
203 omap5_map_common_io();
204}
205#endif
206
207/* 24/*
208 * Stub function for OMAP2 so that common files 25 * Stub function for OMAP2 so that common files
209 * continue to build when custom builds are used 26 * continue to build when custom builds are used
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index 426fcfcfd821..08c586451f93 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -41,54 +41,6 @@
41 41
42#define OMAP_INTC_START NR_IRQS 42#define OMAP_INTC_START NR_IRQS
43 43
44#ifdef CONFIG_SOC_OMAP2420
45extern void omap242x_map_common_io(void);
46#else
47static inline void omap242x_map_common_io(void)
48{
49}
50#endif
51
52#ifdef CONFIG_SOC_OMAP2430
53extern void omap243x_map_common_io(void);
54#else
55static inline void omap243x_map_common_io(void)
56{
57}
58#endif
59
60#ifdef CONFIG_ARCH_OMAP3
61extern void omap34xx_map_common_io(void);
62#else
63static inline void omap34xx_map_common_io(void)
64{
65}
66#endif
67
68#ifdef CONFIG_SOC_TI81XX
69extern void omapti81xx_map_common_io(void);
70#else
71static inline void omapti81xx_map_common_io(void)
72{
73}
74#endif
75
76#ifdef CONFIG_SOC_AM33XX
77extern void omapam33xx_map_common_io(void);
78#else
79static inline void omapam33xx_map_common_io(void)
80{
81}
82#endif
83
84#ifdef CONFIG_ARCH_OMAP4
85extern void omap44xx_map_common_io(void);
86#else
87static inline void omap44xx_map_common_io(void)
88{
89}
90#endif
91
92#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) 44#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2)
93int omap2_pm_init(void); 45int omap2_pm_init(void);
94#else 46#else
@@ -125,14 +77,6 @@ static inline int omap_mux_late_init(void)
125} 77}
126#endif 78#endif
127 79
128#ifdef CONFIG_SOC_OMAP5
129extern void omap5_map_common_io(void);
130#else
131static inline void omap5_map_common_io(void)
132{
133}
134#endif
135
136extern void omap2_init_common_infrastructure(void); 80extern void omap2_init_common_infrastructure(void);
137 81
138extern struct sys_timer omap2_timer; 82extern struct sys_timer omap2_timer;
@@ -165,52 +109,43 @@ void am35xx_init_late(void);
165void ti81xx_init_late(void); 109void ti81xx_init_late(void);
166void omap4430_init_late(void); 110void omap4430_init_late(void);
167int omap2_common_pm_late_init(void); 111int omap2_common_pm_late_init(void);
168void omap_prcm_restart(char, const char *);
169 112
170/* 113#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
171 * IO bases for various OMAP processors 114void omap2xxx_restart(char mode, const char *cmd);
172 * Except the tap base, rest all the io bases
173 * listed are physical addresses.
174 */
175struct omap_globals {
176 u32 class; /* OMAP class to detect */
177 void __iomem *tap; /* Control module ID code */
178 void __iomem *sdrc; /* SDRAM Controller */
179 void __iomem *sms; /* SDRAM Memory Scheduler */
180 void __iomem *ctrl; /* System Control Module */
181 void __iomem *ctrl_pad; /* PAD Control Module */
182 void __iomem *prm; /* Power and Reset Management */
183 void __iomem *cm; /* Clock Management */
184 void __iomem *cm2;
185 void __iomem *prcm_mpu;
186};
187
188void omap2_set_globals_242x(void);
189void omap2_set_globals_243x(void);
190void omap2_set_globals_3xxx(void);
191void omap2_set_globals_443x(void);
192void omap2_set_globals_5xxx(void);
193void omap2_set_globals_ti81xx(void);
194void omap2_set_globals_am33xx(void);
195
196/* These get called from omap2_set_globals_xxxx(), do not call these */
197void omap2_set_globals_tap(struct omap_globals *);
198#if defined(CONFIG_SOC_HAS_OMAP2_SDRC)
199void omap2_set_globals_sdrc(struct omap_globals *);
200#else 115#else
201static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 116static inline void omap2xxx_restart(char mode, const char *cmd)
202{ } 117{
118}
203#endif 119#endif
204void omap2_set_globals_control(struct omap_globals *); 120
205void omap2_set_globals_prcm(struct omap_globals *); 121#ifdef CONFIG_ARCH_OMAP3
206 122void omap3xxx_restart(char mode, const char *cmd);
207void omap242x_map_io(void); 123#else
208void omap243x_map_io(void); 124static inline void omap3xxx_restart(char mode, const char *cmd)
209void omap3_map_io(void); 125{
210void am33xx_map_io(void); 126}
211void omap4_map_io(void); 127#endif
212void omap5_map_io(void); 128
213void ti81xx_map_io(void); 129#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
130void omap44xx_restart(char mode, const char *cmd);
131#else
132static inline void omap44xx_restart(char mode, const char *cmd)
133{
134}
135#endif
136
137/* This gets called from mach-omap2/io.c, do not call this */
138void __init omap2_set_globals_tap(u32 class, void __iomem *tap);
139
140void __init omap242x_map_io(void);
141void __init omap243x_map_io(void);
142void __init omap3_map_io(void);
143void __init am33xx_map_io(void);
144void __init omap4_map_io(void);
145void __init omap5_map_io(void);
146void __init ti81xx_map_io(void);
147
148/* omap_barriers_init() is OMAP4 only */
214void omap_barriers_init(void); 149void omap_barriers_init(void);
215 150
216/** 151/**
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index bf2be5c5468d..2adb2683f074 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -20,8 +20,8 @@
20#include "common.h" 20#include "common.h"
21#include "cm-regbits-34xx.h" 21#include "cm-regbits-34xx.h"
22#include "prm-regbits-34xx.h" 22#include "prm-regbits-34xx.h"
23#include "prm2xxx_3xxx.h" 23#include "prm3xxx.h"
24#include "cm2xxx_3xxx.h" 24#include "cm3xxx.h"
25#include "sdrc.h" 25#include "sdrc.h"
26#include "pm.h" 26#include "pm.h"
27#include "control.h" 27#include "control.h"
@@ -147,13 +147,11 @@ static struct omap3_control_regs control_context;
147#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) 147#define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg))
148#define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg)) 148#define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg))
149 149
150void __init omap2_set_globals_control(struct omap_globals *omap2_globals) 150void __init omap2_set_globals_control(void __iomem *ctrl,
151 void __iomem *ctrl_pad)
151{ 152{
152 if (omap2_globals->ctrl) 153 omap2_ctrl_base = ctrl;
153 omap2_ctrl_base = omap2_globals->ctrl; 154 omap4_ctrl_pad_base = ctrl_pad;
154
155 if (omap2_globals->ctrl_pad)
156 omap4_ctrl_pad_base = omap2_globals->ctrl_pad;
157} 155}
158 156
159void __iomem *omap_ctrl_base_get(void) 157void __iomem *omap_ctrl_base_get(void)
diff --git a/arch/arm/mach-omap2/control.h b/arch/arm/mach-omap2/control.h
index a89e8256fd0e..3d944d3263d2 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -201,6 +201,7 @@
201#define OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO 0x249 201#define OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO 0x249
202#define OMAP44XX_CONTROL_FUSE_CORE_OPP50 0x254 202#define OMAP44XX_CONTROL_FUSE_CORE_OPP50 0x254
203#define OMAP44XX_CONTROL_FUSE_CORE_OPP100 0x257 203#define OMAP44XX_CONTROL_FUSE_CORE_OPP100 0x257
204#define OMAP44XX_CONTROL_FUSE_CORE_OPP100OV 0x25A
204 205
205/* AM35XX only CONTROL_GENERAL register offsets */ 206/* AM35XX only CONTROL_GENERAL register offsets */
206#define AM35XX_CONTROL_MSUSPENDMUX_6 (OMAP2_CONTROL_GENERAL + 0x0038) 207#define AM35XX_CONTROL_MSUSPENDMUX_6 (OMAP2_CONTROL_GENERAL + 0x0038)
@@ -414,6 +415,8 @@ extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
414extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode); 415extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
415extern void omap3630_ctrl_disable_rta(void); 416extern void omap3630_ctrl_disable_rta(void);
416extern int omap3_ctrl_save_padconf(void); 417extern int omap3_ctrl_save_padconf(void);
418extern void omap2_set_globals_control(void __iomem *ctrl,
419 void __iomem *ctrl_pad);
417#else 420#else
418#define omap_ctrl_base_get() 0 421#define omap_ctrl_base_get() 0
419#define omap_ctrl_readb(x) 0 422#define omap_ctrl_readb(x) 0
diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c
index bc2756959be5..bca7a8885703 100644
--- a/arch/arm/mach-omap2/cpuidle34xx.c
+++ b/arch/arm/mach-omap2/cpuidle34xx.c
@@ -27,7 +27,6 @@
27#include <linux/export.h> 27#include <linux/export.h>
28#include <linux/cpu_pm.h> 28#include <linux/cpu_pm.h>
29 29
30#include <plat/prcm.h>
31#include "powerdomain.h" 30#include "powerdomain.h"
32#include "clockdomain.h" 31#include "clockdomain.h"
33 32
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2ad491d6910b..cf365c387c06 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -646,29 +646,3 @@ static int __init omap2_init_devices(void)
646 return 0; 646 return 0;
647} 647}
648arch_initcall(omap2_init_devices); 648arch_initcall(omap2_init_devices);
649
650#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
651static int __init omap_init_wdt(void)
652{
653 int id = -1;
654 struct platform_device *pdev;
655 struct omap_hwmod *oh;
656 char *oh_name = "wd_timer2";
657 char *dev_name = "omap_wdt";
658
659 if (!cpu_class_is_omap2() || of_have_populated_dt())
660 return 0;
661
662 oh = omap_hwmod_lookup(oh_name);
663 if (!oh) {
664 pr_err("Could not look up wd_timer%d hwmod\n", id);
665 return -EINVAL;
666 }
667
668 pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
669 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
670 dev_name, oh->name);
671 return 0;
672}
673subsys_initcall(omap_init_wdt);
674#endif
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 89c57129357a..38ba58c97628 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -35,6 +35,7 @@
35#include "mux.h" 35#include "mux.h"
36#include "control.h" 36#include "control.h"
37#include "display.h" 37#include "display.h"
38#include "prm.h"
38 39
39#define DISPC_CONTROL 0x0040 40#define DISPC_CONTROL 0x0040
40#define DISPC_CONTROL2 0x0238 41#define DISPC_CONTROL2 0x0238
@@ -512,7 +513,6 @@ static void dispc_disable_outputs(void)
512 } 513 }
513} 514}
514 515
515#define MAX_MODULE_SOFTRESET_WAIT 10000
516int omap_dss_reset(struct omap_hwmod *oh) 516int omap_dss_reset(struct omap_hwmod *oh)
517{ 517{
518 struct omap_hwmod_opt_clk *oc; 518 struct omap_hwmod_opt_clk *oc;
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index eacf51f2bc27..fafb28c0dcbc 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -29,6 +29,7 @@
29#include <linux/clkdev.h> 29#include <linux/clkdev.h>
30 30
31#include "soc.h" 31#include "soc.h"
32#include "clockdomain.h"
32#include "clock.h" 33#include "clock.h"
33#include "cm2xxx_3xxx.h" 34#include "cm2xxx_3xxx.h"
34#include "cm-regbits-34xx.h" 35#include "cm-regbits-34xx.h"
@@ -42,7 +43,7 @@
42/* Private functions */ 43/* Private functions */
43 44
44/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */ 45/* _omap3_dpll_write_clken - write clken_bits arg to a DPLL's enable bits */
45static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits) 46static void _omap3_dpll_write_clken(struct clk_hw_omap *clk, u8 clken_bits)
46{ 47{
47 const struct dpll_data *dd; 48 const struct dpll_data *dd;
48 u32 v; 49 u32 v;
@@ -56,7 +57,7 @@ static void _omap3_dpll_write_clken(struct clk *clk, u8 clken_bits)
56} 57}
57 58
58/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */ 59/* _omap3_wait_dpll_status: wait for a DPLL to enter a specific state */
59static int _omap3_wait_dpll_status(struct clk *clk, u8 state) 60static int _omap3_wait_dpll_status(struct clk_hw_omap *clk, u8 state)
60{ 61{
61 const struct dpll_data *dd; 62 const struct dpll_data *dd;
62 int i = 0; 63 int i = 0;
@@ -64,7 +65,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
64 const char *clk_name; 65 const char *clk_name;
65 66
66 dd = clk->dpll_data; 67 dd = clk->dpll_data;
67 clk_name = __clk_get_name(clk); 68 clk_name = __clk_get_name(clk->hw.clk);
68 69
69 state <<= __ffs(dd->idlest_mask); 70 state <<= __ffs(dd->idlest_mask);
70 71
@@ -88,7 +89,7 @@ static int _omap3_wait_dpll_status(struct clk *clk, u8 state)
88} 89}
89 90
90/* From 3430 TRM ES2 4.7.6.2 */ 91/* From 3430 TRM ES2 4.7.6.2 */
91static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n) 92static u16 _omap3_dpll_compute_freqsel(struct clk_hw_omap *clk, u8 n)
92{ 93{
93 unsigned long fint; 94 unsigned long fint;
94 u16 f = 0; 95 u16 f = 0;
@@ -133,14 +134,14 @@ static u16 _omap3_dpll_compute_freqsel(struct clk *clk, u8 n)
133 * locked successfully, return 0; if the DPLL did not lock in the time 134 * locked successfully, return 0; if the DPLL did not lock in the time
134 * allotted, or DPLL3 was passed in, return -EINVAL. 135 * allotted, or DPLL3 was passed in, return -EINVAL.
135 */ 136 */
136static int _omap3_noncore_dpll_lock(struct clk *clk) 137static int _omap3_noncore_dpll_lock(struct clk_hw_omap *clk)
137{ 138{
138 const struct dpll_data *dd; 139 const struct dpll_data *dd;
139 u8 ai; 140 u8 ai;
140 u8 state = 1; 141 u8 state = 1;
141 int r = 0; 142 int r = 0;
142 143
143 pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk)); 144 pr_debug("clock: locking DPLL %s\n", __clk_get_name(clk->hw.clk));
144 145
145 dd = clk->dpll_data; 146 dd = clk->dpll_data;
146 state <<= __ffs(dd->idlest_mask); 147 state <<= __ffs(dd->idlest_mask);
@@ -178,7 +179,7 @@ done:
178 * DPLL3 was passed in, or the DPLL does not support low-power bypass, 179 * DPLL3 was passed in, or the DPLL does not support low-power bypass,
179 * return -EINVAL. 180 * return -EINVAL.
180 */ 181 */
181static int _omap3_noncore_dpll_bypass(struct clk *clk) 182static int _omap3_noncore_dpll_bypass(struct clk_hw_omap *clk)
182{ 183{
183 int r; 184 int r;
184 u8 ai; 185 u8 ai;
@@ -187,7 +188,7 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
187 return -EINVAL; 188 return -EINVAL;
188 189
189 pr_debug("clock: configuring DPLL %s for low-power bypass\n", 190 pr_debug("clock: configuring DPLL %s for low-power bypass\n",
190 __clk_get_name(clk)); 191 __clk_get_name(clk->hw.clk));
191 192
192 ai = omap3_dpll_autoidle_read(clk); 193 ai = omap3_dpll_autoidle_read(clk);
193 194
@@ -210,14 +211,14 @@ static int _omap3_noncore_dpll_bypass(struct clk *clk)
210 * code. If DPLL3 was passed in, or the DPLL does not support 211 * code. If DPLL3 was passed in, or the DPLL does not support
211 * low-power stop, return -EINVAL; otherwise, return 0. 212 * low-power stop, return -EINVAL; otherwise, return 0.
212 */ 213 */
213static int _omap3_noncore_dpll_stop(struct clk *clk) 214static int _omap3_noncore_dpll_stop(struct clk_hw_omap *clk)
214{ 215{
215 u8 ai; 216 u8 ai;
216 217
217 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP))) 218 if (!(clk->dpll_data->modes & (1 << DPLL_LOW_POWER_STOP)))
218 return -EINVAL; 219 return -EINVAL;
219 220
220 pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk)); 221 pr_debug("clock: stopping DPLL %s\n", __clk_get_name(clk->hw.clk));
221 222
222 ai = omap3_dpll_autoidle_read(clk); 223 ai = omap3_dpll_autoidle_read(clk);
223 224
@@ -241,11 +242,11 @@ static int _omap3_noncore_dpll_stop(struct clk *clk)
241 * XXX This code is not needed for 3430/AM35xx; can it be optimized 242 * XXX This code is not needed for 3430/AM35xx; can it be optimized
242 * out in non-multi-OMAP builds for those chips? 243 * out in non-multi-OMAP builds for those chips?
243 */ 244 */
244static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n) 245static void _lookup_dco(struct clk_hw_omap *clk, u8 *dco, u16 m, u8 n)
245{ 246{
246 unsigned long fint, clkinp; /* watch out for overflow */ 247 unsigned long fint, clkinp; /* watch out for overflow */
247 248
248 clkinp = __clk_get_rate(__clk_get_parent(clk)); 249 clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk));
249 fint = (clkinp / n) * m; 250 fint = (clkinp / n) * m;
250 251
251 if (fint < 1000000000) 252 if (fint < 1000000000)
@@ -266,12 +267,12 @@ static void _lookup_dco(struct clk *clk, u8 *dco, u16 m, u8 n)
266 * XXX This code is not needed for 3430/AM35xx; can it be optimized 267 * XXX This code is not needed for 3430/AM35xx; can it be optimized
267 * out in non-multi-OMAP builds for those chips? 268 * out in non-multi-OMAP builds for those chips?
268 */ 269 */
269static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n) 270static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n)
270{ 271{
271 unsigned long clkinp, sd; /* watch out for overflow */ 272 unsigned long clkinp, sd; /* watch out for overflow */
272 int mod1, mod2; 273 int mod1, mod2;
273 274
274 clkinp = __clk_get_rate(__clk_get_parent(clk)); 275 clkinp = __clk_get_rate(__clk_get_parent(clk->hw.clk));
275 276
276 /* 277 /*
277 * target sigma-delta to near 250MHz 278 * target sigma-delta to near 250MHz
@@ -298,7 +299,8 @@ static void _lookup_sddiv(struct clk *clk, u8 *sd_div, u16 m, u8 n)
298 * Program the DPLL with the supplied M, N values, and wait for the DPLL to 299 * Program the DPLL with the supplied M, N values, and wait for the DPLL to
299 * lock.. Returns -EINVAL upon error, or 0 upon success. 300 * lock.. Returns -EINVAL upon error, or 0 upon success.
300 */ 301 */
301static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) 302static int omap3_noncore_dpll_program(struct clk_hw_omap *clk, u16 m, u8 n,
303 u16 freqsel)
302{ 304{
303 struct dpll_data *dd = clk->dpll_data; 305 struct dpll_data *dd = clk->dpll_data;
304 u8 dco, sd_div; 306 u8 dco, sd_div;
@@ -355,8 +357,10 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)
355 * 357 *
356 * Recalculate and propagate the DPLL rate. 358 * Recalculate and propagate the DPLL rate.
357 */ 359 */
358unsigned long omap3_dpll_recalc(struct clk *clk) 360unsigned long omap3_dpll_recalc(struct clk_hw *hw, unsigned long parent_rate)
359{ 361{
362 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
363
360 return omap2_get_dpll_rate(clk); 364 return omap2_get_dpll_rate(clk);
361} 365}
362 366
@@ -376,8 +380,9 @@ unsigned long omap3_dpll_recalc(struct clk *clk)
376 * support low-power stop, or if the DPLL took too long to enter 380 * support low-power stop, or if the DPLL took too long to enter
377 * bypass or lock, return -EINVAL; otherwise, return 0. 381 * bypass or lock, return -EINVAL; otherwise, return 0.
378 */ 382 */
379int omap3_noncore_dpll_enable(struct clk *clk) 383int omap3_noncore_dpll_enable(struct clk_hw *hw)
380{ 384{
385 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
381 int r; 386 int r;
382 struct dpll_data *dd; 387 struct dpll_data *dd;
383 struct clk *parent; 388 struct clk *parent;
@@ -386,22 +391,26 @@ int omap3_noncore_dpll_enable(struct clk *clk)
386 if (!dd) 391 if (!dd)
387 return -EINVAL; 392 return -EINVAL;
388 393
389 parent = __clk_get_parent(clk); 394 if (clk->clkdm) {
395 r = clkdm_clk_enable(clk->clkdm, hw->clk);
396 if (r) {
397 WARN(1,
398 "%s: could not enable %s's clockdomain %s: %d\n",
399 __func__, __clk_get_name(hw->clk),
400 clk->clkdm->name, r);
401 return r;
402 }
403 }
404
405 parent = __clk_get_parent(hw->clk);
390 406
391 if (__clk_get_rate(clk) == __clk_get_rate(dd->clk_bypass)) { 407 if (__clk_get_rate(hw->clk) == __clk_get_rate(dd->clk_bypass)) {
392 WARN_ON(parent != dd->clk_bypass); 408 WARN_ON(parent != dd->clk_bypass);
393 r = _omap3_noncore_dpll_bypass(clk); 409 r = _omap3_noncore_dpll_bypass(clk);
394 } else { 410 } else {
395 WARN_ON(parent != dd->clk_ref); 411 WARN_ON(parent != dd->clk_ref);
396 r = _omap3_noncore_dpll_lock(clk); 412 r = _omap3_noncore_dpll_lock(clk);
397 } 413 }
398 /*
399 *FIXME: this is dubious - if clk->rate has changed, what about
400 * propagating?
401 */
402 if (!r)
403 clk->rate = (clk->recalc) ? clk->recalc(clk) :
404 omap2_get_dpll_rate(clk);
405 414
406 return r; 415 return r;
407} 416}
@@ -413,9 +422,13 @@ int omap3_noncore_dpll_enable(struct clk *clk)
413 * Instructs a non-CORE DPLL to enter low-power stop. This function is 422 * Instructs a non-CORE DPLL to enter low-power stop. This function is
414 * intended for use in struct clkops. No return value. 423 * intended for use in struct clkops. No return value.
415 */ 424 */
416void omap3_noncore_dpll_disable(struct clk *clk) 425void omap3_noncore_dpll_disable(struct clk_hw *hw)
417{ 426{
427 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
428
418 _omap3_noncore_dpll_stop(clk); 429 _omap3_noncore_dpll_stop(clk);
430 if (clk->clkdm)
431 clkdm_clk_disable(clk->clkdm, hw->clk);
419} 432}
420 433
421 434
@@ -432,80 +445,72 @@ void omap3_noncore_dpll_disable(struct clk *clk)
432 * target rate if it hasn't been done already, then program and lock 445 * target rate if it hasn't been done already, then program and lock
433 * the DPLL. Returns -EINVAL upon error, or 0 upon success. 446 * the DPLL. Returns -EINVAL upon error, or 0 upon success.
434 */ 447 */
435int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate) 448int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate,
449 unsigned long parent_rate)
436{ 450{
451 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
437 struct clk *new_parent = NULL; 452 struct clk *new_parent = NULL;
438 unsigned long hw_rate, bypass_rate;
439 u16 freqsel = 0; 453 u16 freqsel = 0;
440 struct dpll_data *dd; 454 struct dpll_data *dd;
441 int ret; 455 int ret;
442 456
443 if (!clk || !rate) 457 if (!hw || !rate)
444 return -EINVAL; 458 return -EINVAL;
445 459
446 dd = clk->dpll_data; 460 dd = clk->dpll_data;
447 if (!dd) 461 if (!dd)
448 return -EINVAL; 462 return -EINVAL;
449 463
450 hw_rate = (clk->recalc) ? clk->recalc(clk) : omap2_get_dpll_rate(clk); 464 __clk_prepare(dd->clk_bypass);
451 if (rate == hw_rate) 465 clk_enable(dd->clk_bypass);
452 return 0; 466 __clk_prepare(dd->clk_ref);
453 467 clk_enable(dd->clk_ref);
454 /*
455 * Ensure both the bypass and ref clocks are enabled prior to
456 * doing anything; we need the bypass clock running to reprogram
457 * the DPLL.
458 */
459 omap2_clk_enable(dd->clk_bypass);
460 omap2_clk_enable(dd->clk_ref);
461 468
462 bypass_rate = __clk_get_rate(dd->clk_bypass); 469 if (__clk_get_rate(dd->clk_bypass) == rate &&
463 if (bypass_rate == rate && 470 (dd->modes & (1 << DPLL_LOW_POWER_BYPASS))) {
464 (clk->dpll_data->modes & (1 << DPLL_LOW_POWER_BYPASS))) { 471 pr_debug("%s: %s: set rate: entering bypass.\n",
465 pr_debug("clock: %s: set rate: entering bypass.\n", clk->name); 472 __func__, __clk_get_name(hw->clk));
466 473
467 ret = _omap3_noncore_dpll_bypass(clk); 474 ret = _omap3_noncore_dpll_bypass(clk);
468 if (!ret) 475 if (!ret)
469 new_parent = dd->clk_bypass; 476 new_parent = dd->clk_bypass;
470 } else { 477 } else {
471 if (dd->last_rounded_rate != rate) 478 if (dd->last_rounded_rate != rate)
472 rate = clk->round_rate(clk, rate); 479 rate = __clk_round_rate(hw->clk, rate);
473 480
474 if (dd->last_rounded_rate == 0) 481 if (dd->last_rounded_rate == 0)
475 return -EINVAL; 482 return -EINVAL;
476 483
477 /* No freqsel on OMAP4 and OMAP3630 */ 484 /* No freqsel on OMAP4 and OMAP3630 */
478 if (!soc_is_am33xx() && !cpu_is_omap44xx() && !cpu_is_omap3630()) { 485 if (!cpu_is_omap44xx() && !cpu_is_omap3630()) {
479 freqsel = _omap3_dpll_compute_freqsel(clk, 486 freqsel = _omap3_dpll_compute_freqsel(clk,
480 dd->last_rounded_n); 487 dd->last_rounded_n);
481 if (!freqsel) 488 if (!freqsel)
482 WARN_ON(1); 489 WARN_ON(1);
483 } 490 }
484 491
485 pr_debug("clock: %s: set rate: locking rate to %lu.\n", 492 pr_debug("%s: %s: set rate: locking rate to %lu.\n",
486 __clk_get_name(clk), rate); 493 __func__, __clk_get_name(hw->clk), rate);
487 494
488 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m, 495 ret = omap3_noncore_dpll_program(clk, dd->last_rounded_m,
489 dd->last_rounded_n, freqsel); 496 dd->last_rounded_n, freqsel);
490 if (!ret) 497 if (!ret)
491 new_parent = dd->clk_ref; 498 new_parent = dd->clk_ref;
492 } 499 }
493 if (!ret) { 500 /*
494 /* 501 * FIXME - this is all wrong. common code handles reparenting and
495 * Switch the parent clock in the hierarchy, and make sure 502 * migrating prepare/enable counts. dplls should be a multiplexer
496 * that the new parent's usecount is correct. Note: we 503 * clock and this should be a set_parent operation so that all of that
497 * enable the new parent before disabling the old to avoid 504 * stuff is inherited for free
498 * any unnecessary hardware disable->enable transitions. 505 */
499 */ 506
500 if (clk->usecount) { 507 if (!ret)
501 omap2_clk_enable(new_parent); 508 __clk_reparent(hw->clk, new_parent);
502 omap2_clk_disable(clk->parent); 509
503 } 510 clk_disable(dd->clk_ref);
504 clk_reparent(clk, new_parent); 511 __clk_unprepare(dd->clk_ref);
505 clk->rate = rate; 512 clk_disable(dd->clk_bypass);
506 } 513 __clk_unprepare(dd->clk_bypass);
507 omap2_clk_disable(dd->clk_ref);
508 omap2_clk_disable(dd->clk_bypass);
509 514
510 return 0; 515 return 0;
511} 516}
@@ -520,7 +525,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
520 * -EINVAL if passed a null pointer or if the struct clk does not 525 * -EINVAL if passed a null pointer or if the struct clk does not
521 * appear to refer to a DPLL. 526 * appear to refer to a DPLL.
522 */ 527 */
523u32 omap3_dpll_autoidle_read(struct clk *clk) 528u32 omap3_dpll_autoidle_read(struct clk_hw_omap *clk)
524{ 529{
525 const struct dpll_data *dd; 530 const struct dpll_data *dd;
526 u32 v; 531 u32 v;
@@ -549,7 +554,7 @@ u32 omap3_dpll_autoidle_read(struct clk *clk)
549 * OMAP3430. The DPLL will enter low-power stop when its downstream 554 * OMAP3430. The DPLL will enter low-power stop when its downstream
550 * clocks are gated. No return value. 555 * clocks are gated. No return value.
551 */ 556 */
552void omap3_dpll_allow_idle(struct clk *clk) 557void omap3_dpll_allow_idle(struct clk_hw_omap *clk)
553{ 558{
554 const struct dpll_data *dd; 559 const struct dpll_data *dd;
555 u32 v; 560 u32 v;
@@ -559,11 +564,8 @@ void omap3_dpll_allow_idle(struct clk *clk)
559 564
560 dd = clk->dpll_data; 565 dd = clk->dpll_data;
561 566
562 if (!dd->autoidle_reg) { 567 if (!dd->autoidle_reg)
563 pr_debug("clock: DPLL %s: autoidle not supported\n",
564 __clk_get_name(clk));
565 return; 568 return;
566 }
567 569
568 /* 570 /*
569 * REVISIT: CORE DPLL can optionally enter low-power bypass 571 * REVISIT: CORE DPLL can optionally enter low-power bypass
@@ -583,7 +585,7 @@ void omap3_dpll_allow_idle(struct clk *clk)
583 * 585 *
584 * Disable DPLL automatic idle control. No return value. 586 * Disable DPLL automatic idle control. No return value.
585 */ 587 */
586void omap3_dpll_deny_idle(struct clk *clk) 588void omap3_dpll_deny_idle(struct clk_hw_omap *clk)
587{ 589{
588 const struct dpll_data *dd; 590 const struct dpll_data *dd;
589 u32 v; 591 u32 v;
@@ -593,11 +595,8 @@ void omap3_dpll_deny_idle(struct clk *clk)
593 595
594 dd = clk->dpll_data; 596 dd = clk->dpll_data;
595 597
596 if (!dd->autoidle_reg) { 598 if (!dd->autoidle_reg)
597 pr_debug("clock: DPLL %s: autoidle not supported\n",
598 __clk_get_name(clk));
599 return; 599 return;
600 }
601 600
602 v = __raw_readl(dd->autoidle_reg); 601 v = __raw_readl(dd->autoidle_reg);
603 v &= ~dd->autoidle_mask; 602 v &= ~dd->autoidle_mask;
@@ -615,18 +614,25 @@ void omap3_dpll_deny_idle(struct clk *clk)
615 * Using parent clock DPLL data, look up DPLL state. If locked, set our 614 * Using parent clock DPLL data, look up DPLL state. If locked, set our
616 * rate to the dpll_clk * 2; otherwise, just use dpll_clk. 615 * rate to the dpll_clk * 2; otherwise, just use dpll_clk.
617 */ 616 */
618unsigned long omap3_clkoutx2_recalc(struct clk *clk) 617unsigned long omap3_clkoutx2_recalc(struct clk_hw *hw,
618 unsigned long parent_rate)
619{ 619{
620 const struct dpll_data *dd; 620 const struct dpll_data *dd;
621 unsigned long rate; 621 unsigned long rate;
622 u32 v; 622 u32 v;
623 struct clk *pclk; 623 struct clk_hw_omap *pclk = NULL;
624 unsigned long parent_rate; 624 struct clk *parent;
625 625
626 /* Walk up the parents of clk, looking for a DPLL */ 626 /* Walk up the parents of clk, looking for a DPLL */
627 pclk = __clk_get_parent(clk); 627 do {
628 while (pclk && !pclk->dpll_data) 628 do {
629 pclk = __clk_get_parent(pclk); 629 parent = __clk_get_parent(hw->clk);
630 hw = __clk_get_hw(parent);
631 } while (hw && (__clk_get_flags(hw->clk) & CLK_IS_BASIC));
632 if (!hw)
633 break;
634 pclk = to_clk_hw_omap(hw);
635 } while (pclk && !pclk->dpll_data);
630 636
631 /* clk does not have a DPLL as a parent? error in the clock data */ 637 /* clk does not have a DPLL as a parent? error in the clock data */
632 if (!pclk) { 638 if (!pclk) {
@@ -638,7 +644,6 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
638 644
639 WARN_ON(!dd->enable_mask); 645 WARN_ON(!dd->enable_mask);
640 646
641 parent_rate = __clk_get_rate(__clk_get_parent(clk));
642 v = __raw_readl(dd->control_reg) & dd->enable_mask; 647 v = __raw_readl(dd->control_reg) & dd->enable_mask;
643 v >>= __ffs(dd->enable_mask); 648 v >>= __ffs(dd->enable_mask);
644 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE)) 649 if ((v != OMAP3XXX_EN_DPLL_LOCKED) || (dd->flags & DPLL_J_TYPE))
@@ -649,15 +654,7 @@ unsigned long omap3_clkoutx2_recalc(struct clk *clk)
649} 654}
650 655
651/* OMAP3/4 non-CORE DPLL clkops */ 656/* OMAP3/4 non-CORE DPLL clkops */
652 657const struct clk_hw_omap_ops clkhwops_omap3_dpll = {
653const struct clkops clkops_omap3_noncore_dpll_ops = {
654 .enable = omap3_noncore_dpll_enable,
655 .disable = omap3_noncore_dpll_disable,
656 .allow_idle = omap3_dpll_allow_idle,
657 .deny_idle = omap3_dpll_deny_idle,
658};
659
660const struct clkops clkops_omap3_core_dpll_ops = {
661 .allow_idle = omap3_dpll_allow_idle, 658 .allow_idle = omap3_dpll_allow_idle,
662 .deny_idle = omap3_dpll_deny_idle, 659 .deny_idle = omap3_dpll_deny_idle,
663}; 660};
diff --git a/arch/arm/mach-omap2/dpll44xx.c b/arch/arm/mach-omap2/dpll44xx.c
index 5854da168a9c..d3326c474fdc 100644
--- a/arch/arm/mach-omap2/dpll44xx.c
+++ b/arch/arm/mach-omap2/dpll44xx.c
@@ -21,7 +21,7 @@
21#include "cm-regbits-44xx.h" 21#include "cm-regbits-44xx.h"
22 22
23/* Supported only on OMAP4 */ 23/* Supported only on OMAP4 */
24int omap4_dpllmx_gatectrl_read(struct clk *clk) 24int omap4_dpllmx_gatectrl_read(struct clk_hw_omap *clk)
25{ 25{
26 u32 v; 26 u32 v;
27 u32 mask; 27 u32 mask;
@@ -40,7 +40,7 @@ int omap4_dpllmx_gatectrl_read(struct clk *clk)
40 return v; 40 return v;
41} 41}
42 42
43void omap4_dpllmx_allow_gatectrl(struct clk *clk) 43void omap4_dpllmx_allow_gatectrl(struct clk_hw_omap *clk)
44{ 44{
45 u32 v; 45 u32 v;
46 u32 mask; 46 u32 mask;
@@ -58,7 +58,7 @@ void omap4_dpllmx_allow_gatectrl(struct clk *clk)
58 __raw_writel(v, clk->clksel_reg); 58 __raw_writel(v, clk->clksel_reg);
59} 59}
60 60
61void omap4_dpllmx_deny_gatectrl(struct clk *clk) 61void omap4_dpllmx_deny_gatectrl(struct clk_hw_omap *clk)
62{ 62{
63 u32 v; 63 u32 v;
64 u32 mask; 64 u32 mask;
@@ -76,9 +76,9 @@ void omap4_dpllmx_deny_gatectrl(struct clk *clk)
76 __raw_writel(v, clk->clksel_reg); 76 __raw_writel(v, clk->clksel_reg);
77} 77}
78 78
79const struct clkops clkops_omap4_dpllmx_ops = { 79const struct clk_hw_omap_ops clkhwops_omap4_dpllmx = {
80 .allow_idle = omap4_dpllmx_allow_gatectrl, 80 .allow_idle = omap4_dpllmx_allow_gatectrl,
81 .deny_idle = omap4_dpllmx_deny_gatectrl, 81 .deny_idle = omap4_dpllmx_deny_gatectrl,
82}; 82};
83 83
84/** 84/**
@@ -90,8 +90,10 @@ const struct clkops clkops_omap4_dpllmx_ops = {
90 * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers) 90 * OMAP4 ABE DPLL. Returns the DPLL's output rate (before M-dividers)
91 * upon success, or 0 upon error. 91 * upon success, or 0 upon error.
92 */ 92 */
93unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk) 93unsigned long omap4_dpll_regm4xen_recalc(struct clk_hw *hw,
94 unsigned long parent_rate)
94{ 95{
96 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
95 u32 v; 97 u32 v;
96 unsigned long rate; 98 unsigned long rate;
97 struct dpll_data *dd; 99 struct dpll_data *dd;
@@ -123,8 +125,11 @@ unsigned long omap4_dpll_regm4xen_recalc(struct clk *clk)
123 * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or 125 * M-dividers) upon success, -EINVAL if @clk is null or not a DPLL, or
124 * ~0 if an error occurred in omap2_dpll_round_rate(). 126 * ~0 if an error occurred in omap2_dpll_round_rate().
125 */ 127 */
126long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate) 128long omap4_dpll_regm4xen_round_rate(struct clk_hw *hw,
129 unsigned long target_rate,
130 unsigned long *parent_rate)
127{ 131{
132 struct clk_hw_omap *clk = to_clk_hw_omap(hw);
128 u32 v; 133 u32 v;
129 struct dpll_data *dd; 134 struct dpll_data *dd;
130 long r; 135 long r;
@@ -140,7 +145,7 @@ long omap4_dpll_regm4xen_round_rate(struct clk *clk, unsigned long target_rate)
140 if (v) 145 if (v)
141 target_rate = target_rate / OMAP4430_REGM4XEN_MULT; 146 target_rate = target_rate / OMAP4430_REGM4XEN_MULT;
142 147
143 r = omap2_dpll_round_rate(clk, target_rate); 148 r = omap2_dpll_round_rate(hw, target_rate, NULL);
144 if (r == ~0) 149 if (r == ~0)
145 return r; 150 return r;
146 151
diff --git a/arch/arm/mach-omap2/hdq1w.c b/arch/arm/mach-omap2/hdq1w.c
index 3da8900598c8..ab7bf181a105 100644
--- a/arch/arm/mach-omap2/hdq1w.c
+++ b/arch/arm/mach-omap2/hdq1w.c
@@ -31,11 +31,9 @@
31#include "omap_device.h" 31#include "omap_device.h"
32#include "hdq1w.h" 32#include "hdq1w.h"
33 33
34#include "prm.h"
34#include "common.h" 35#include "common.h"
35 36
36/* Maximum microseconds to wait for OMAP module to softreset */
37#define MAX_MODULE_SOFTRESET_WAIT 10000
38
39/** 37/**
40 * omap_hdq1w_reset - reset the OMAP HDQ1W module 38 * omap_hdq1w_reset - reset the OMAP HDQ1W module
41 * @oh: struct omap_hwmod * 39 * @oh: struct omap_hwmod *
diff --git a/arch/arm/mach-omap2/i2c.c b/arch/arm/mach-omap2/i2c.c
index 4e63097e3cd8..fbb9b152cd5e 100644
--- a/arch/arm/mach-omap2/i2c.c
+++ b/arch/arm/mach-omap2/i2c.c
@@ -20,10 +20,11 @@
20 */ 20 */
21 21
22#include "soc.h" 22#include "soc.h"
23#include "common.h"
24#include "omap_hwmod.h" 23#include "omap_hwmod.h"
25#include "omap_device.h" 24#include "omap_device.h"
26 25
26#include "prm.h"
27#include "common.h"
27#include "mux.h" 28#include "mux.h"
28#include "i2c.h" 29#include "i2c.h"
29 30
@@ -32,9 +33,6 @@
32#define OMAP2_I2C_CON_OFFSET 0x24 33#define OMAP2_I2C_CON_OFFSET 0x24
33#define OMAP4_I2C_CON_OFFSET 0xA4 34#define OMAP4_I2C_CON_OFFSET 0xA4
34 35
35/* Maximum microseconds to wait for OMAP module to softreset */
36#define MAX_MODULE_SOFTRESET_WAIT 10000
37
38#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16 36#define MAX_OMAP_I2C_HWMOD_NAME_LEN 16
39 37
40static void __init omap2_i2c_mux_pins(int bus_id) 38static void __init omap2_i2c_mux_pins(int bus_id)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 3c47a19a580f..45cc7ed4dd58 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -548,11 +548,12 @@ void __init omap5xxx_check_revision(void)
548 * detect the exact revision later on in omap2_detect_revision() once map_io 548 * detect the exact revision later on in omap2_detect_revision() once map_io
549 * is done. 549 * is done.
550 */ 550 */
551void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) 551void __init omap2_set_globals_tap(u32 class, void __iomem *tap)
552{ 552{
553 omap_revision = omap2_globals->class; 553 omap_revision = class;
554 tap_base = omap2_globals->tap; 554 tap_base = tap;
555 555
556 /* XXX What is this intended to do? */
556 if (cpu_is_omap34xx()) 557 if (cpu_is_omap34xx())
557 tap_prod_id = 0x0210; 558 tap_prod_id = 0x0210;
558 else 559 else
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 807b8d919f81..7c39238322e0 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -40,8 +40,19 @@
40#include "clock44xx.h" 40#include "clock44xx.h"
41#include "omap-pm.h" 41#include "omap-pm.h"
42#include "sdrc.h" 42#include "sdrc.h"
43#include "control.h"
43#include "serial.h" 44#include "serial.h"
44#include "sram.h" 45#include "sram.h"
46#include "cm2xxx.h"
47#include "cm3xxx.h"
48#include "prm.h"
49#include "cm.h"
50#include "prcm_mpu44xx.h"
51#include "prminst44xx.h"
52#include "cminst44xx.h"
53#include "prm2xxx.h"
54#include "prm3xxx.h"
55#include "prm44xx.h"
45 56
46/* 57/*
47 * The machine specific code may provide the extra mapping besides the 58 * The machine specific code may provide the extra mapping besides the
@@ -264,7 +275,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
264#endif 275#endif
265 276
266#ifdef CONFIG_SOC_OMAP2420 277#ifdef CONFIG_SOC_OMAP2420
267void __init omap242x_map_common_io(void) 278void __init omap242x_map_io(void)
268{ 279{
269 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 280 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
270 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 281 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
@@ -272,7 +283,7 @@ void __init omap242x_map_common_io(void)
272#endif 283#endif
273 284
274#ifdef CONFIG_SOC_OMAP2430 285#ifdef CONFIG_SOC_OMAP2430
275void __init omap243x_map_common_io(void) 286void __init omap243x_map_io(void)
276{ 287{
277 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 288 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
278 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 289 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
@@ -280,28 +291,28 @@ void __init omap243x_map_common_io(void)
280#endif 291#endif
281 292
282#ifdef CONFIG_ARCH_OMAP3 293#ifdef CONFIG_ARCH_OMAP3
283void __init omap34xx_map_common_io(void) 294void __init omap3_map_io(void)
284{ 295{
285 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 296 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
286} 297}
287#endif 298#endif
288 299
289#ifdef CONFIG_SOC_TI81XX 300#ifdef CONFIG_SOC_TI81XX
290void __init omapti81xx_map_common_io(void) 301void __init ti81xx_map_io(void)
291{ 302{
292 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc)); 303 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
293} 304}
294#endif 305#endif
295 306
296#ifdef CONFIG_SOC_AM33XX 307#ifdef CONFIG_SOC_AM33XX
297void __init omapam33xx_map_common_io(void) 308void __init am33xx_map_io(void)
298{ 309{
299 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); 310 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
300} 311}
301#endif 312#endif
302 313
303#ifdef CONFIG_ARCH_OMAP4 314#ifdef CONFIG_ARCH_OMAP4
304void __init omap44xx_map_common_io(void) 315void __init omap4_map_io(void)
305{ 316{
306 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 317 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
307 omap_barriers_init(); 318 omap_barriers_init();
@@ -309,7 +320,7 @@ void __init omap44xx_map_common_io(void)
309#endif 320#endif
310 321
311#ifdef CONFIG_SOC_OMAP5 322#ifdef CONFIG_SOC_OMAP5
312void __init omap5_map_common_io(void) 323void __init omap5_map_io(void)
313{ 324{
314 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); 325 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
315} 326}
@@ -371,8 +382,16 @@ static void __init omap_hwmod_init_postsetup(void)
371#ifdef CONFIG_SOC_OMAP2420 382#ifdef CONFIG_SOC_OMAP2420
372void __init omap2420_init_early(void) 383void __init omap2420_init_early(void)
373{ 384{
374 omap2_set_globals_242x(); 385 omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
386 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
387 OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
388 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
389 NULL);
390 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
391 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
375 omap2xxx_check_revision(); 392 omap2xxx_check_revision();
393 omap2xxx_prm_init();
394 omap2xxx_cm_init();
376 omap2xxx_voltagedomains_init(); 395 omap2xxx_voltagedomains_init();
377 omap242x_powerdomains_init(); 396 omap242x_powerdomains_init();
378 omap242x_clockdomains_init(); 397 omap242x_clockdomains_init();
@@ -386,14 +405,23 @@ void __init omap2420_init_late(void)
386 omap_mux_late_init(); 405 omap_mux_late_init();
387 omap2_common_pm_late_init(); 406 omap2_common_pm_late_init();
388 omap2_pm_init(); 407 omap2_pm_init();
408 omap2_clk_enable_autoidle_all();
389} 409}
390#endif 410#endif
391 411
392#ifdef CONFIG_SOC_OMAP2430 412#ifdef CONFIG_SOC_OMAP2430
393void __init omap2430_init_early(void) 413void __init omap2430_init_early(void)
394{ 414{
395 omap2_set_globals_243x(); 415 omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
416 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
417 OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
418 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
419 NULL);
420 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
421 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
396 omap2xxx_check_revision(); 422 omap2xxx_check_revision();
423 omap2xxx_prm_init();
424 omap2xxx_cm_init();
397 omap2xxx_voltagedomains_init(); 425 omap2xxx_voltagedomains_init();
398 omap243x_powerdomains_init(); 426 omap243x_powerdomains_init();
399 omap243x_clockdomains_init(); 427 omap243x_clockdomains_init();
@@ -407,6 +435,7 @@ void __init omap2430_init_late(void)
407 omap_mux_late_init(); 435 omap_mux_late_init();
408 omap2_common_pm_late_init(); 436 omap2_common_pm_late_init();
409 omap2_pm_init(); 437 omap2_pm_init();
438 omap2_clk_enable_autoidle_all();
410} 439}
411#endif 440#endif
412 441
@@ -417,9 +446,17 @@ void __init omap2430_init_late(void)
417#ifdef CONFIG_ARCH_OMAP3 446#ifdef CONFIG_ARCH_OMAP3
418void __init omap3_init_early(void) 447void __init omap3_init_early(void)
419{ 448{
420 omap2_set_globals_3xxx(); 449 omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000));
450 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE),
451 OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE));
452 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE),
453 NULL);
454 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE));
455 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL);
421 omap3xxx_check_revision(); 456 omap3xxx_check_revision();
422 omap3xxx_check_features(); 457 omap3xxx_check_features();
458 omap3xxx_prm_init();
459 omap3xxx_cm_init();
423 omap3xxx_voltagedomains_init(); 460 omap3xxx_voltagedomains_init();
424 omap3xxx_powerdomains_init(); 461 omap3xxx_powerdomains_init();
425 omap3xxx_clockdomains_init(); 462 omap3xxx_clockdomains_init();
@@ -450,7 +487,12 @@ void __init am35xx_init_early(void)
450 487
451void __init ti81xx_init_early(void) 488void __init ti81xx_init_early(void)
452{ 489{
453 omap2_set_globals_ti81xx(); 490 omap2_set_globals_tap(OMAP343X_CLASS,
491 OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE));
492 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE),
493 NULL);
494 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE));
495 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL);
454 omap3xxx_check_revision(); 496 omap3xxx_check_revision();
455 ti81xx_check_features(); 497 ti81xx_check_features();
456 omap3xxx_voltagedomains_init(); 498 omap3xxx_voltagedomains_init();
@@ -466,6 +508,7 @@ void __init omap3_init_late(void)
466 omap_mux_late_init(); 508 omap_mux_late_init();
467 omap2_common_pm_late_init(); 509 omap2_common_pm_late_init();
468 omap3_pm_init(); 510 omap3_pm_init();
511 omap2_clk_enable_autoidle_all();
469} 512}
470 513
471void __init omap3430_init_late(void) 514void __init omap3430_init_late(void)
@@ -473,6 +516,7 @@ void __init omap3430_init_late(void)
473 omap_mux_late_init(); 516 omap_mux_late_init();
474 omap2_common_pm_late_init(); 517 omap2_common_pm_late_init();
475 omap3_pm_init(); 518 omap3_pm_init();
519 omap2_clk_enable_autoidle_all();
476} 520}
477 521
478void __init omap35xx_init_late(void) 522void __init omap35xx_init_late(void)
@@ -480,6 +524,7 @@ void __init omap35xx_init_late(void)
480 omap_mux_late_init(); 524 omap_mux_late_init();
481 omap2_common_pm_late_init(); 525 omap2_common_pm_late_init();
482 omap3_pm_init(); 526 omap3_pm_init();
527 omap2_clk_enable_autoidle_all();
483} 528}
484 529
485void __init omap3630_init_late(void) 530void __init omap3630_init_late(void)
@@ -487,6 +532,7 @@ void __init omap3630_init_late(void)
487 omap_mux_late_init(); 532 omap_mux_late_init();
488 omap2_common_pm_late_init(); 533 omap2_common_pm_late_init();
489 omap3_pm_init(); 534 omap3_pm_init();
535 omap2_clk_enable_autoidle_all();
490} 536}
491 537
492void __init am35xx_init_late(void) 538void __init am35xx_init_late(void)
@@ -494,6 +540,7 @@ void __init am35xx_init_late(void)
494 omap_mux_late_init(); 540 omap_mux_late_init();
495 omap2_common_pm_late_init(); 541 omap2_common_pm_late_init();
496 omap3_pm_init(); 542 omap3_pm_init();
543 omap2_clk_enable_autoidle_all();
497} 544}
498 545
499void __init ti81xx_init_late(void) 546void __init ti81xx_init_late(void)
@@ -501,13 +548,19 @@ void __init ti81xx_init_late(void)
501 omap_mux_late_init(); 548 omap_mux_late_init();
502 omap2_common_pm_late_init(); 549 omap2_common_pm_late_init();
503 omap3_pm_init(); 550 omap3_pm_init();
551 omap2_clk_enable_autoidle_all();
504} 552}
505#endif 553#endif
506 554
507#ifdef CONFIG_SOC_AM33XX 555#ifdef CONFIG_SOC_AM33XX
508void __init am33xx_init_early(void) 556void __init am33xx_init_early(void)
509{ 557{
510 omap2_set_globals_am33xx(); 558 omap2_set_globals_tap(AM335X_CLASS,
559 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
560 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
561 NULL);
562 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
563 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
511 omap3xxx_check_revision(); 564 omap3xxx_check_revision();
512 ti81xx_check_features(); 565 ti81xx_check_features();
513 am33xx_voltagedomains_init(); 566 am33xx_voltagedomains_init();
@@ -522,9 +575,19 @@ void __init am33xx_init_early(void)
522#ifdef CONFIG_ARCH_OMAP4 575#ifdef CONFIG_ARCH_OMAP4
523void __init omap4430_init_early(void) 576void __init omap4430_init_early(void)
524{ 577{
525 omap2_set_globals_443x(); 578 omap2_set_globals_tap(OMAP443X_CLASS,
579 OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
580 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
581 OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
582 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
583 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
584 OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
585 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
586 omap_prm_base_init();
587 omap_cm_base_init();
526 omap4xxx_check_revision(); 588 omap4xxx_check_revision();
527 omap4xxx_check_features(); 589 omap4xxx_check_features();
590 omap44xx_prm_init();
528 omap44xx_voltagedomains_init(); 591 omap44xx_voltagedomains_init();
529 omap44xx_powerdomains_init(); 592 omap44xx_powerdomains_init();
530 omap44xx_clockdomains_init(); 593 omap44xx_clockdomains_init();
@@ -538,13 +601,23 @@ void __init omap4430_init_late(void)
538 omap_mux_late_init(); 601 omap_mux_late_init();
539 omap2_common_pm_late_init(); 602 omap2_common_pm_late_init();
540 omap4_pm_init(); 603 omap4_pm_init();
604 omap2_clk_enable_autoidle_all();
541} 605}
542#endif 606#endif
543 607
544#ifdef CONFIG_SOC_OMAP5 608#ifdef CONFIG_SOC_OMAP5
545void __init omap5_init_early(void) 609void __init omap5_init_early(void)
546{ 610{
547 omap2_set_globals_5xxx(); 611 omap2_set_globals_tap(OMAP54XX_CLASS,
612 OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
613 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
614 OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
615 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
616 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
617 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
618 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
619 omap_prm_base_init();
620 omap_cm_base_init();
548 omap5xxx_check_revision(); 621 omap5xxx_check_revision();
549} 622}
550#endif 623#endif
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c
index a106c75c5338..bf496510eb5e 100644
--- a/arch/arm/mach-omap2/mcbsp.c
+++ b/arch/arm/mach-omap2/mcbsp.c
@@ -29,7 +29,7 @@
29 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. 29 * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle.
30 * Sidetone needs non-gated ICLK and sidetone autoidle is broken. 30 * Sidetone needs non-gated ICLK and sidetone autoidle is broken.
31 */ 31 */
32#include "cm2xxx_3xxx.h" 32#include "cm3xxx.h"
33#include "cm-regbits-34xx.h" 33#include "cm-regbits-34xx.h"
34 34
35static int omap3_enable_st_clock(unsigned int id, bool enable) 35static int omap3_enable_st_clock(unsigned int id, bool enable)
diff --git a/arch/arm/mach-omap2/msdi.c b/arch/arm/mach-omap2/msdi.c
index 627e97e30743..aafdd4ca9f4f 100644
--- a/arch/arm/mach-omap2/msdi.c
+++ b/arch/arm/mach-omap2/msdi.c
@@ -25,6 +25,7 @@
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/platform_data/gpio-omap.h> 26#include <linux/platform_data/gpio-omap.h>
27 27
28#include "prm.h"
28#include "common.h" 29#include "common.h"
29#include "control.h" 30#include "control.h"
30#include "omap_hwmod.h" 31#include "omap_hwmod.h"
@@ -43,9 +44,6 @@
43#define MSDI_CON_CLKD_MASK (0x3f << 0) 44#define MSDI_CON_CLKD_MASK (0x3f << 0)
44#define MSDI_CON_CLKD_SHIFT 0 45#define MSDI_CON_CLKD_SHIFT 0
45 46
46/* Maximum microseconds to wait for OMAP module to softreset */
47#define MAX_MODULE_SOFTRESET_WAIT 10000
48
49/* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */ 47/* MSDI_TARGET_RESET_CLKD: clock divisor to use throughout the reset */
50#define MSDI_TARGET_RESET_CLKD 0x3ff 48#define MSDI_TARGET_RESET_CLKD 0x3ff
51 49
diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c
new file mode 100644
index 000000000000..be6bc89ab1e8
--- /dev/null
+++ b/arch/arm/mach-omap2/omap2-restart.c
@@ -0,0 +1,65 @@
1/*
2 * omap2-restart.c - code common to all OMAP2xxx machines.
3 *
4 * Copyright (C) 2012 Texas Instruments
5 * Paul Walmsley
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/clk.h>
14#include <linux/io.h>
15
16#include "common.h"
17#include "prm2xxx.h"
18
19/*
20 * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set
21 * clock and the sys_ck. Used during the reset process
22 */
23static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck;
24
25/* Reboot handling */
26
27/**
28 * omap2xxx_restart - Set DPLL to bypass mode for reboot to work
29 *
30 * Set the DPLL to bypass so that reboot completes successfully. No
31 * return value.
32 */
33void omap2xxx_restart(char mode, const char *cmd)
34{
35 u32 rate;
36
37 rate = clk_get_rate(reset_sys_ck);
38 clk_set_rate(reset_virt_prcm_set_ck, rate);
39
40 /* XXX Should save the cmd argument for use after the reboot */
41
42 omap2xxx_prm_dpll_reset(); /* never returns */
43 while (1);
44}
45
46/**
47 * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart
48 *
49 * Some clocks need to be looked up in advance for the SoC restart
50 * operation to work - see omap2xxx_restart(). Returns -EINVAL upon
51 * error or 0 upon success.
52 */
53static int __init omap2xxx_common_look_up_clks_for_reset(void)
54{
55 reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set");
56 if (IS_ERR(reset_virt_prcm_set_ck))
57 return -EINVAL;
58
59 reset_sys_ck = clk_get(NULL, "sys_ck");
60 if (IS_ERR(reset_sys_ck))
61 return -EINVAL;
62
63 return 0;
64}
65core_initcall(omap2xxx_common_look_up_clks_for_reset);
diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c
new file mode 100644
index 000000000000..923c582189e5
--- /dev/null
+++ b/arch/arm/mach-omap2/omap3-restart.c
@@ -0,0 +1,36 @@
1/*
2 * omap3-restart.c - Code common to all OMAP3xxx machines.
3 *
4 * Copyright (C) 2009, 2012 Texas Instruments
5 * Copyright (C) 2010 Nokia Corporation
6 * Tony Lindgren <tony@atomide.com>
7 * Santosh Shilimkar <santosh.shilimkar@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/kernel.h>
14#include <linux/init.h>
15
16#include "iomap.h"
17#include "common.h"
18#include "control.h"
19#include "prm3xxx.h"
20
21/* Global address base setup code */
22
23/**
24 * omap3xxx_restart - trigger a software restart of the SoC
25 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
26 * @cmd: passed from the userspace program rebooting the system (if provided)
27 *
28 * Resets the SoC. For @cmd, see the 'reboot' syscall in
29 * kernel/sys.c. No return value.
30 */
31void omap3xxx_restart(char mode, const char *cmd)
32{
33 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
34 omap3xxx_prm_dpll3_reset(); /* never returns */
35 while (1);
36}
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c
index 3cfcd41bf8fa..5695885ea340 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -27,9 +27,12 @@
27 27
28#include "omap-wakeupgen.h" 28#include "omap-wakeupgen.h"
29#include "soc.h" 29#include "soc.h"
30#include "iomap.h"
30#include "common.h" 31#include "common.h"
31#include "mmc.h" 32#include "mmc.h"
32#include "hsmmc.h" 33#include "hsmmc.h"
34#include "prminst44xx.h"
35#include "prcm_mpu44xx.h"
33#include "omap4-sar-layout.h" 36#include "omap4-sar-layout.h"
34#include "omap-secure.h" 37#include "omap-secure.h"
35#include "sram.h" 38#include "sram.h"
@@ -279,3 +282,19 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
279 return 0; 282 return 0;
280} 283}
281#endif 284#endif
285
286/**
287 * omap44xx_restart - trigger a software restart of the SoC
288 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
289 * @cmd: passed from the userspace program rebooting the system (if provided)
290 *
291 * Resets the SoC. For @cmd, see the 'reboot' syscall in
292 * kernel/sys.c. No return value.
293 */
294void omap44xx_restart(char mode, const char *cmd)
295{
296 /* XXX Should save 'cmd' into scratchpad for use after reboot */
297 omap4_prminst_global_warm_sw_reset(); /* never returns */
298 while (1);
299}
300
diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index 0ef934fec364..e065daa537c0 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -441,19 +441,21 @@ int omap_device_get_context_loss_count(struct platform_device *pdev)
441/** 441/**
442 * omap_device_count_resources - count number of struct resource entries needed 442 * omap_device_count_resources - count number of struct resource entries needed
443 * @od: struct omap_device * 443 * @od: struct omap_device *
444 * @flags: Type of resources to include when counting (IRQ/DMA/MEM)
444 * 445 *
445 * Count the number of struct resource entries needed for this 446 * Count the number of struct resource entries needed for this
446 * omap_device @od. Used by omap_device_build_ss() to determine how 447 * omap_device @od. Used by omap_device_build_ss() to determine how
447 * much memory to allocate before calling 448 * much memory to allocate before calling
448 * omap_device_fill_resources(). Returns the count. 449 * omap_device_fill_resources(). Returns the count.
449 */ 450 */
450static int omap_device_count_resources(struct omap_device *od) 451static int omap_device_count_resources(struct omap_device *od,
452 unsigned long flags)
451{ 453{
452 int c = 0; 454 int c = 0;
453 int i; 455 int i;
454 456
455 for (i = 0; i < od->hwmods_cnt; i++) 457 for (i = 0; i < od->hwmods_cnt; i++)
456 c += omap_hwmod_count_resources(od->hwmods[i]); 458 c += omap_hwmod_count_resources(od->hwmods[i], flags);
457 459
458 pr_debug("omap_device: %s: counted %d total resources across %d hwmods\n", 460 pr_debug("omap_device: %s: counted %d total resources across %d hwmods\n",
459 od->pdev->name, c, od->hwmods_cnt); 461 od->pdev->name, c, od->hwmods_cnt);
@@ -557,52 +559,73 @@ struct omap_device *omap_device_alloc(struct platform_device *pdev,
557 od->hwmods = hwmods; 559 od->hwmods = hwmods;
558 od->pdev = pdev; 560 od->pdev = pdev;
559 561
560 res_count = omap_device_count_resources(od);
561 /* 562 /*
563 * Non-DT Boot:
564 * Here, pdev->num_resources = 0, and we should get all the
565 * resources from hwmod.
566 *
562 * DT Boot: 567 * DT Boot:
563 * OF framework will construct the resource structure (currently 568 * OF framework will construct the resource structure (currently
564 * does for MEM & IRQ resource) and we should respect/use these 569 * does for MEM & IRQ resource) and we should respect/use these
565 * resources, killing hwmod dependency. 570 * resources, killing hwmod dependency.
566 * If pdev->num_resources > 0, we assume that MEM & IRQ resources 571 * If pdev->num_resources > 0, we assume that MEM & IRQ resources
567 * have been allocated by OF layer already (through DTB). 572 * have been allocated by OF layer already (through DTB).
568 * 573 * As preparation for the future we examine the OF provided resources
569 * Non-DT Boot: 574 * to see if we have DMA resources provided already. In this case
570 * Here, pdev->num_resources = 0, and we should get all the 575 * there is no need to update the resources for the device, we use the
571 * resources from hwmod. 576 * OF provided ones.
572 * 577 *
573 * TODO: Once DMA resource is available from OF layer, we should 578 * TODO: Once DMA resource is available from OF layer, we should
574 * kill filling any resources from hwmod. 579 * kill filling any resources from hwmod.
575 */ 580 */
576 if (res_count > pdev->num_resources) { 581 if (!pdev->num_resources) {
577 /* Allocate resources memory to account for new resources */ 582 /* Count all resources for the device */
578 res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL); 583 res_count = omap_device_count_resources(od, IORESOURCE_IRQ |
579 if (!res) 584 IORESOURCE_DMA |
580 goto oda_exit3; 585 IORESOURCE_MEM);
581 586 } else {
582 /* 587 /* Take a look if we already have DMA resource via DT */
583 * If pdev->num_resources > 0, then assume that, 588 for (i = 0; i < pdev->num_resources; i++) {
584 * MEM and IRQ resources will only come from DT and only 589 struct resource *r = &pdev->resource[i];
585 * fill DMA resource from hwmod layer. 590
586 */ 591 /* We have it, no need to touch the resources */
587 if (pdev->num_resources && pdev->resource) { 592 if (r->flags == IORESOURCE_DMA)
588 dev_dbg(&pdev->dev, "%s(): resources already allocated %d\n", 593 goto have_everything;
589 __func__, res_count);
590 memcpy(res, pdev->resource,
591 sizeof(struct resource) * pdev->num_resources);
592 _od_fill_dma_resources(od, &res[pdev->num_resources]);
593 } else {
594 dev_dbg(&pdev->dev, "%s(): using resources from hwmod %d\n",
595 __func__, res_count);
596 omap_device_fill_resources(od, res);
597 } 594 }
595 /* Count only DMA resources for the device */
596 res_count = omap_device_count_resources(od, IORESOURCE_DMA);
597 /* The device has no DMA resource, no need for update */
598 if (!res_count)
599 goto have_everything;
598 600
599 ret = platform_device_add_resources(pdev, res, res_count); 601 res_count += pdev->num_resources;
600 kfree(res); 602 }
601 603
602 if (ret) 604 /* Allocate resources memory to account for new resources */
603 goto oda_exit3; 605 res = kzalloc(sizeof(struct resource) * res_count, GFP_KERNEL);
606 if (!res)
607 goto oda_exit3;
608
609 if (!pdev->num_resources) {
610 dev_dbg(&pdev->dev, "%s: using %d resources from hwmod\n",
611 __func__, res_count);
612 omap_device_fill_resources(od, res);
613 } else {
614 dev_dbg(&pdev->dev,
615 "%s: appending %d DMA resources from hwmod\n",
616 __func__, res_count - pdev->num_resources);
617 memcpy(res, pdev->resource,
618 sizeof(struct resource) * pdev->num_resources);
619 _od_fill_dma_resources(od, &res[pdev->num_resources]);
604 } 620 }
605 621
622 ret = platform_device_add_resources(pdev, res, res_count);
623 kfree(res);
624
625 if (ret)
626 goto oda_exit3;
627
628have_everything:
606 if (!pm_lats) { 629 if (!pm_lats) {
607 pm_lats = omap_default_latency; 630 pm_lats = omap_default_latency;
608 pm_lats_cnt = ARRAY_SIZE(omap_default_latency); 631 pm_lats_cnt = ARRAY_SIZE(omap_default_latency);
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 87eee3b62a3c..a8090907fe35 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -130,7 +130,7 @@
130#include <linux/kernel.h> 130#include <linux/kernel.h>
131#include <linux/errno.h> 131#include <linux/errno.h>
132#include <linux/io.h> 132#include <linux/io.h>
133#include <linux/clk.h> 133#include <linux/clk-provider.h>
134#include <linux/delay.h> 134#include <linux/delay.h>
135#include <linux/err.h> 135#include <linux/err.h>
136#include <linux/list.h> 136#include <linux/list.h>
@@ -141,25 +141,23 @@
141 141
142#include "clock.h" 142#include "clock.h"
143#include "omap_hwmod.h" 143#include "omap_hwmod.h"
144#include <plat/prcm.h>
145 144
146#include "soc.h" 145#include "soc.h"
147#include "common.h" 146#include "common.h"
148#include "clockdomain.h" 147#include "clockdomain.h"
149#include "powerdomain.h" 148#include "powerdomain.h"
150#include "cm2xxx_3xxx.h" 149#include "cm2xxx.h"
150#include "cm3xxx.h"
151#include "cminst44xx.h" 151#include "cminst44xx.h"
152#include "cm33xx.h" 152#include "cm33xx.h"
153#include "prm2xxx_3xxx.h" 153#include "prm.h"
154#include "prm3xxx.h"
154#include "prm44xx.h" 155#include "prm44xx.h"
155#include "prm33xx.h" 156#include "prm33xx.h"
156#include "prminst44xx.h" 157#include "prminst44xx.h"
157#include "mux.h" 158#include "mux.h"
158#include "pm.h" 159#include "pm.h"
159 160
160/* Maximum microseconds to wait for OMAP module to softreset */
161#define MAX_MODULE_SOFTRESET_WAIT 10000
162
163/* Name of the OMAP hwmod for the MPU */ 161/* Name of the OMAP hwmod for the MPU */
164#define MPU_INITIATOR_NAME "mpu" 162#define MPU_INITIATOR_NAME "mpu"
165 163
@@ -189,6 +187,8 @@ struct omap_hwmod_soc_ops {
189 int (*is_hardreset_asserted)(struct omap_hwmod *oh, 187 int (*is_hardreset_asserted)(struct omap_hwmod *oh,
190 struct omap_hwmod_rst_info *ohri); 188 struct omap_hwmod_rst_info *ohri);
191 int (*init_clkdm)(struct omap_hwmod *oh); 189 int (*init_clkdm)(struct omap_hwmod *oh);
190 void (*update_context_lost)(struct omap_hwmod *oh);
191 int (*get_context_lost)(struct omap_hwmod *oh);
192}; 192};
193 193
194/* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */ 194/* soc_ops: adapts the omap_hwmod code to the currently-booted SoC */
@@ -616,6 +616,19 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
616 return 0; 616 return 0;
617} 617}
618 618
619static struct clockdomain *_get_clkdm(struct omap_hwmod *oh)
620{
621 struct clk_hw_omap *clk;
622
623 if (oh->clkdm) {
624 return oh->clkdm;
625 } else if (oh->_clk) {
626 clk = to_clk_hw_omap(__clk_get_hw(oh->_clk));
627 return clk->clkdm;
628 }
629 return NULL;
630}
631
619/** 632/**
620 * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active 633 * _add_initiator_dep: prevent @oh from smart-idling while @init_oh is active
621 * @oh: struct omap_hwmod * 634 * @oh: struct omap_hwmod *
@@ -631,13 +644,18 @@ static int _disable_wakeup(struct omap_hwmod *oh, u32 *v)
631 */ 644 */
632static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) 645static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
633{ 646{
634 if (!oh->_clk) 647 struct clockdomain *clkdm, *init_clkdm;
648
649 clkdm = _get_clkdm(oh);
650 init_clkdm = _get_clkdm(init_oh);
651
652 if (!clkdm || !init_clkdm)
635 return -EINVAL; 653 return -EINVAL;
636 654
637 if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) 655 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
638 return 0; 656 return 0;
639 657
640 return clkdm_add_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); 658 return clkdm_add_sleepdep(clkdm, init_clkdm);
641} 659}
642 660
643/** 661/**
@@ -655,13 +673,18 @@ static int _add_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
655 */ 673 */
656static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh) 674static int _del_initiator_dep(struct omap_hwmod *oh, struct omap_hwmod *init_oh)
657{ 675{
658 if (!oh->_clk) 676 struct clockdomain *clkdm, *init_clkdm;
677
678 clkdm = _get_clkdm(oh);
679 init_clkdm = _get_clkdm(init_oh);
680
681 if (!clkdm || !init_clkdm)
659 return -EINVAL; 682 return -EINVAL;
660 683
661 if (oh->_clk->clkdm && oh->_clk->clkdm->flags & CLKDM_NO_AUTODEPS) 684 if (clkdm && clkdm->flags & CLKDM_NO_AUTODEPS)
662 return 0; 685 return 0;
663 686
664 return clkdm_del_sleepdep(oh->_clk->clkdm, init_oh->_clk->clkdm); 687 return clkdm_del_sleepdep(clkdm, init_clkdm);
665} 688}
666 689
667/** 690/**
@@ -695,7 +718,7 @@ static int _init_main_clk(struct omap_hwmod *oh)
695 */ 718 */
696 clk_prepare(oh->_clk); 719 clk_prepare(oh->_clk);
697 720
698 if (!oh->_clk->clkdm) 721 if (!_get_clkdm(oh))
699 pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n", 722 pr_debug("omap_hwmod: %s: missing clockdomain for %s.\n",
700 oh->name, oh->main_clk); 723 oh->name, oh->main_clk);
701 724
@@ -1278,6 +1301,7 @@ static void _enable_sysc(struct omap_hwmod *oh)
1278 u8 idlemode, sf; 1301 u8 idlemode, sf;
1279 u32 v; 1302 u32 v;
1280 bool clkdm_act; 1303 bool clkdm_act;
1304 struct clockdomain *clkdm;
1281 1305
1282 if (!oh->class->sysc) 1306 if (!oh->class->sysc)
1283 return; 1307 return;
@@ -1285,11 +1309,9 @@ static void _enable_sysc(struct omap_hwmod *oh)
1285 v = oh->_sysc_cache; 1309 v = oh->_sysc_cache;
1286 sf = oh->class->sysc->sysc_flags; 1310 sf = oh->class->sysc->sysc_flags;
1287 1311
1312 clkdm = _get_clkdm(oh);
1288 if (sf & SYSC_HAS_SIDLEMODE) { 1313 if (sf & SYSC_HAS_SIDLEMODE) {
1289 clkdm_act = ((oh->clkdm && 1314 clkdm_act = (clkdm && clkdm->flags & CLKDM_ACTIVE_WITH_MPU);
1290 oh->clkdm->flags & CLKDM_ACTIVE_WITH_MPU) ||
1291 (oh->_clk && oh->_clk->clkdm &&
1292 oh->_clk->clkdm->flags & CLKDM_ACTIVE_WITH_MPU));
1293 if (clkdm_act && !(oh->class->sysc->idlemodes & 1315 if (clkdm_act && !(oh->class->sysc->idlemodes &
1294 (SIDLE_SMART | SIDLE_SMART_WKUP))) 1316 (SIDLE_SMART | SIDLE_SMART_WKUP)))
1295 idlemode = HWMOD_IDLEMODE_FORCE; 1317 idlemode = HWMOD_IDLEMODE_FORCE;
@@ -1491,11 +1513,12 @@ static int _init_clocks(struct omap_hwmod *oh, void *data)
1491 1513
1492 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name); 1514 pr_debug("omap_hwmod: %s: looking up clocks\n", oh->name);
1493 1515
1516 if (soc_ops.init_clkdm)
1517 ret |= soc_ops.init_clkdm(oh);
1518
1494 ret |= _init_main_clk(oh); 1519 ret |= _init_main_clk(oh);
1495 ret |= _init_interface_clks(oh); 1520 ret |= _init_interface_clks(oh);
1496 ret |= _init_opt_clks(oh); 1521 ret |= _init_opt_clks(oh);
1497 if (soc_ops.init_clkdm)
1498 ret |= soc_ops.init_clkdm(oh);
1499 1522
1500 if (!ret) 1523 if (!ret)
1501 oh->_state = _HWMOD_STATE_CLKS_INITED; 1524 oh->_state = _HWMOD_STATE_CLKS_INITED;
@@ -1962,6 +1985,42 @@ static void _reconfigure_io_chain(void)
1962} 1985}
1963 1986
1964/** 1987/**
1988 * _omap4_update_context_lost - increment hwmod context loss counter if
1989 * hwmod context was lost, and clear hardware context loss reg
1990 * @oh: hwmod to check for context loss
1991 *
1992 * If the PRCM indicates that the hwmod @oh lost context, increment
1993 * our in-memory context loss counter, and clear the RM_*_CONTEXT
1994 * bits. No return value.
1995 */
1996static void _omap4_update_context_lost(struct omap_hwmod *oh)
1997{
1998 if (oh->prcm.omap4.flags & HWMOD_OMAP4_NO_CONTEXT_LOSS_BIT)
1999 return;
2000
2001 if (!prm_was_any_context_lost_old(oh->clkdm->pwrdm.ptr->prcm_partition,
2002 oh->clkdm->pwrdm.ptr->prcm_offs,
2003 oh->prcm.omap4.context_offs))
2004 return;
2005
2006 oh->prcm.omap4.context_lost_counter++;
2007 prm_clear_context_loss_flags_old(oh->clkdm->pwrdm.ptr->prcm_partition,
2008 oh->clkdm->pwrdm.ptr->prcm_offs,
2009 oh->prcm.omap4.context_offs);
2010}
2011
2012/**
2013 * _omap4_get_context_lost - get context loss counter for a hwmod
2014 * @oh: hwmod to get context loss counter for
2015 *
2016 * Returns the in-memory context loss counter for a hwmod.
2017 */
2018static int _omap4_get_context_lost(struct omap_hwmod *oh)
2019{
2020 return oh->prcm.omap4.context_lost_counter;
2021}
2022
2023/**
1965 * _enable - enable an omap_hwmod 2024 * _enable - enable an omap_hwmod
1966 * @oh: struct omap_hwmod * 2025 * @oh: struct omap_hwmod *
1967 * 2026 *
@@ -2044,6 +2103,9 @@ static int _enable(struct omap_hwmod *oh)
2044 if (soc_ops.enable_module) 2103 if (soc_ops.enable_module)
2045 soc_ops.enable_module(oh); 2104 soc_ops.enable_module(oh);
2046 2105
2106 if (soc_ops.update_context_lost)
2107 soc_ops.update_context_lost(oh);
2108
2047 r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) : 2109 r = (soc_ops.wait_target_ready) ? soc_ops.wait_target_ready(oh) :
2048 -EINVAL; 2110 -EINVAL;
2049 if (!r) { 2111 if (!r) {
@@ -2063,7 +2125,8 @@ static int _enable(struct omap_hwmod *oh)
2063 _enable_sysc(oh); 2125 _enable_sysc(oh);
2064 } 2126 }
2065 } else { 2127 } else {
2066 _omap4_disable_module(oh); 2128 if (soc_ops.disable_module)
2129 soc_ops.disable_module(oh);
2067 _disable_clocks(oh); 2130 _disable_clocks(oh);
2068 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", 2131 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",
2069 oh->name, r); 2132 oh->name, r);
@@ -2668,7 +2731,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2668/* Static functions intended only for use in soc_ops field function pointers */ 2731/* Static functions intended only for use in soc_ops field function pointers */
2669 2732
2670/** 2733/**
2671 * _omap2_wait_target_ready - wait for a module to leave slave idle 2734 * _omap2xxx_wait_target_ready - wait for a module to leave slave idle
2672 * @oh: struct omap_hwmod * 2735 * @oh: struct omap_hwmod *
2673 * 2736 *
2674 * Wait for a module @oh to leave slave idle. Returns 0 if the module 2737 * Wait for a module @oh to leave slave idle. Returns 0 if the module
@@ -2676,7 +2739,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois)
2676 * slave idle; otherwise, pass along the return value of the 2739 * slave idle; otherwise, pass along the return value of the
2677 * appropriate *_cm*_wait_module_ready() function. 2740 * appropriate *_cm*_wait_module_ready() function.
2678 */ 2741 */
2679static int _omap2_wait_target_ready(struct omap_hwmod *oh) 2742static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh)
2680{ 2743{
2681 if (!oh) 2744 if (!oh)
2682 return -EINVAL; 2745 return -EINVAL;
@@ -2689,9 +2752,36 @@ static int _omap2_wait_target_ready(struct omap_hwmod *oh)
2689 2752
2690 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ 2753 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2691 2754
2692 return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs, 2755 return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2693 oh->prcm.omap2.idlest_reg_id, 2756 oh->prcm.omap2.idlest_reg_id,
2694 oh->prcm.omap2.idlest_idle_bit); 2757 oh->prcm.omap2.idlest_idle_bit);
2758}
2759
2760/**
2761 * _omap3xxx_wait_target_ready - wait for a module to leave slave idle
2762 * @oh: struct omap_hwmod *
2763 *
2764 * Wait for a module @oh to leave slave idle. Returns 0 if the module
2765 * does not have an IDLEST bit or if the module successfully leaves
2766 * slave idle; otherwise, pass along the return value of the
2767 * appropriate *_cm*_wait_module_ready() function.
2768 */
2769static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh)
2770{
2771 if (!oh)
2772 return -EINVAL;
2773
2774 if (oh->flags & HWMOD_NO_IDLEST)
2775 return 0;
2776
2777 if (!_find_mpu_rt_port(oh))
2778 return 0;
2779
2780 /* XXX check module SIDLEMODE, hardreset status, enabled clocks */
2781
2782 return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs,
2783 oh->prcm.omap2.idlest_reg_id,
2784 oh->prcm.omap2.idlest_idle_bit);
2695} 2785}
2696 2786
2697/** 2787/**
@@ -3337,7 +3427,7 @@ int omap_hwmod_reset(struct omap_hwmod *oh)
3337/** 3427/**
3338 * omap_hwmod_count_resources - count number of struct resources needed by hwmod 3428 * omap_hwmod_count_resources - count number of struct resources needed by hwmod
3339 * @oh: struct omap_hwmod * 3429 * @oh: struct omap_hwmod *
3340 * @res: pointer to the first element of an array of struct resource to fill 3430 * @flags: Type of resources to include when counting (IRQ/DMA/MEM)
3341 * 3431 *
3342 * Count the number of struct resource array elements necessary to 3432 * Count the number of struct resource array elements necessary to
3343 * contain omap_hwmod @oh resources. Intended to be called by code 3433 * contain omap_hwmod @oh resources. Intended to be called by code
@@ -3350,20 +3440,25 @@ int omap_hwmod_reset(struct omap_hwmod *oh)
3350 * resource IDs. 3440 * resource IDs.
3351 * 3441 *
3352 */ 3442 */
3353int omap_hwmod_count_resources(struct omap_hwmod *oh) 3443int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags)
3354{ 3444{
3355 struct omap_hwmod_ocp_if *os; 3445 int ret = 0;
3356 struct list_head *p;
3357 int ret;
3358 int i = 0;
3359 3446
3360 ret = _count_mpu_irqs(oh) + _count_sdma_reqs(oh); 3447 if (flags & IORESOURCE_IRQ)
3448 ret += _count_mpu_irqs(oh);
3361 3449
3362 p = oh->slave_ports.next; 3450 if (flags & IORESOURCE_DMA)
3451 ret += _count_sdma_reqs(oh);
3363 3452
3364 while (i < oh->slaves_cnt) { 3453 if (flags & IORESOURCE_MEM) {
3365 os = _fetch_next_ocp_if(&p, &i); 3454 int i = 0;
3366 ret += _count_ocp_if_addr_spaces(os); 3455 struct omap_hwmod_ocp_if *os;
3456 struct list_head *p = oh->slave_ports.next;
3457
3458 while (i < oh->slaves_cnt) {
3459 os = _fetch_next_ocp_if(&p, &i);
3460 ret += _count_ocp_if_addr_spaces(os);
3461 }
3367 } 3462 }
3368 3463
3369 return ret; 3464 return ret;
@@ -3530,10 +3625,15 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
3530{ 3625{
3531 struct clk *c; 3626 struct clk *c;
3532 struct omap_hwmod_ocp_if *oi; 3627 struct omap_hwmod_ocp_if *oi;
3628 struct clockdomain *clkdm;
3629 struct clk_hw_omap *clk;
3533 3630
3534 if (!oh) 3631 if (!oh)
3535 return NULL; 3632 return NULL;
3536 3633
3634 if (oh->clkdm)
3635 return oh->clkdm->pwrdm.ptr;
3636
3537 if (oh->_clk) { 3637 if (oh->_clk) {
3538 c = oh->_clk; 3638 c = oh->_clk;
3539 } else { 3639 } else {
@@ -3543,11 +3643,12 @@ struct powerdomain *omap_hwmod_get_pwrdm(struct omap_hwmod *oh)
3543 c = oi->_clk; 3643 c = oi->_clk;
3544 } 3644 }
3545 3645
3546 if (!c->clkdm) 3646 clk = to_clk_hw_omap(__clk_get_hw(c));
3647 clkdm = clk->clkdm;
3648 if (!clkdm)
3547 return NULL; 3649 return NULL;
3548 3650
3549 return c->clkdm->pwrdm.ptr; 3651 return clkdm->pwrdm.ptr;
3550
3551} 3652}
3552 3653
3553/** 3654/**
@@ -3852,17 +3953,21 @@ ohsps_unlock:
3852 * omap_hwmod_get_context_loss_count - get lost context count 3953 * omap_hwmod_get_context_loss_count - get lost context count
3853 * @oh: struct omap_hwmod * 3954 * @oh: struct omap_hwmod *
3854 * 3955 *
3855 * Query the powerdomain of of @oh to get the context loss 3956 * Returns the context loss count of associated @oh
3856 * count for this device. 3957 * upon success, or zero if no context loss data is available.
3857 * 3958 *
3858 * Returns the context loss count of the powerdomain assocated with @oh 3959 * On OMAP4, this queries the per-hwmod context loss register,
3859 * upon success, or zero if no powerdomain exists for @oh. 3960 * assuming one exists. If not, or on OMAP2/3, this queries the
3961 * enclosing powerdomain context loss count.
3860 */ 3962 */
3861int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh) 3963int omap_hwmod_get_context_loss_count(struct omap_hwmod *oh)
3862{ 3964{
3863 struct powerdomain *pwrdm; 3965 struct powerdomain *pwrdm;
3864 int ret = 0; 3966 int ret = 0;
3865 3967
3968 if (soc_ops.get_context_lost)
3969 return soc_ops.get_context_lost(oh);
3970
3866 pwrdm = omap_hwmod_get_pwrdm(oh); 3971 pwrdm = omap_hwmod_get_pwrdm(oh);
3867 if (pwrdm) 3972 if (pwrdm)
3868 ret = pwrdm_get_context_loss_count(pwrdm); 3973 ret = pwrdm_get_context_loss_count(pwrdm);
@@ -3959,8 +4064,13 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx)
3959 */ 4064 */
3960void __init omap_hwmod_init(void) 4065void __init omap_hwmod_init(void)
3961{ 4066{
3962 if (cpu_is_omap24xx() || cpu_is_omap34xx()) { 4067 if (cpu_is_omap24xx()) {
3963 soc_ops.wait_target_ready = _omap2_wait_target_ready; 4068 soc_ops.wait_target_ready = _omap2xxx_wait_target_ready;
4069 soc_ops.assert_hardreset = _omap2_assert_hardreset;
4070 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
4071 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
4072 } else if (cpu_is_omap34xx()) {
4073 soc_ops.wait_target_ready = _omap3xxx_wait_target_ready;
3964 soc_ops.assert_hardreset = _omap2_assert_hardreset; 4074 soc_ops.assert_hardreset = _omap2_assert_hardreset;
3965 soc_ops.deassert_hardreset = _omap2_deassert_hardreset; 4075 soc_ops.deassert_hardreset = _omap2_deassert_hardreset;
3966 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; 4076 soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted;
@@ -3972,6 +4082,8 @@ void __init omap_hwmod_init(void)
3972 soc_ops.deassert_hardreset = _omap4_deassert_hardreset; 4082 soc_ops.deassert_hardreset = _omap4_deassert_hardreset;
3973 soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted; 4083 soc_ops.is_hardreset_asserted = _omap4_is_hardreset_asserted;
3974 soc_ops.init_clkdm = _init_clkdm; 4084 soc_ops.init_clkdm = _init_clkdm;
4085 soc_ops.update_context_lost = _omap4_update_context_lost;
4086 soc_ops.get_context_lost = _omap4_get_context_lost;
3975 } else if (soc_is_am33xx()) { 4087 } else if (soc_is_am33xx()) {
3976 soc_ops.enable_module = _am33xx_enable_module; 4088 soc_ops.enable_module = _am33xx_enable_module;
3977 soc_ops.disable_module = _am33xx_disable_module; 4089 soc_ops.disable_module = _am33xx_disable_module;
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 87b59b45c678..86b7414b5835 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -2,7 +2,7 @@
2 * omap_hwmod macros, structures 2 * omap_hwmod macros, structures
3 * 3 *
4 * Copyright (C) 2009-2011 Nokia Corporation 4 * Copyright (C) 2009-2011 Nokia Corporation
5 * Copyright (C) 2012 Texas Instruments, Inc. 5 * Copyright (C) 2011-2012 Texas Instruments, Inc.
6 * Paul Walmsley 6 * Paul Walmsley
7 * 7 *
8 * Created in collaboration with (alphabetical order): Benoît Cousson, 8 * Created in collaboration with (alphabetical order): Benoît Cousson,
@@ -394,12 +394,15 @@ struct omap_hwmod_omap2_prcm {
394 394
395/** 395/**
396 * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data 396 * struct omap_hwmod_omap4_prcm - OMAP4-specific PRCM data
397 * @clkctrl_reg: PRCM address of the clock control register 397 * @clkctrl_offs: offset of the PRCM clock control register
398 * @rstctrl_reg: address of the XXX_RSTCTRL register located in the PRM 398 * @rstctrl_offs: offset of the XXX_RSTCTRL register located in the PRM
399 * @context_offs: offset of the RM_*_CONTEXT register
399 * @lostcontext_mask: bitmask for selecting bits from RM_*_CONTEXT register 400 * @lostcontext_mask: bitmask for selecting bits from RM_*_CONTEXT register
400 * @rstst_reg: (AM33XX only) address of the XXX_RSTST register in the PRM 401 * @rstst_reg: (AM33XX only) address of the XXX_RSTST register in the PRM
401 * @submodule_wkdep_bit: bit shift of the WKDEP range 402 * @submodule_wkdep_bit: bit shift of the WKDEP range
402 * @flags: PRCM register capabilities for this IP block 403 * @flags: PRCM register capabilities for this IP block
404 * @modulemode: allowable modulemodes
405 * @context_lost_counter: Count of module level context lost
403 * 406 *
404 * If @lostcontext_mask is not defined, context loss check code uses 407 * If @lostcontext_mask is not defined, context loss check code uses
405 * whole register without masking. @lostcontext_mask should only be 408 * whole register without masking. @lostcontext_mask should only be
@@ -415,6 +418,7 @@ struct omap_hwmod_omap4_prcm {
415 u8 submodule_wkdep_bit; 418 u8 submodule_wkdep_bit;
416 u8 modulemode; 419 u8 modulemode;
417 u8 flags; 420 u8 flags;
421 int context_lost_counter;
418}; 422};
419 423
420 424
@@ -627,7 +631,7 @@ void omap_hwmod_write(u32 v, struct omap_hwmod *oh, u16 reg_offs);
627u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs); 631u32 omap_hwmod_read(struct omap_hwmod *oh, u16 reg_offs);
628int omap_hwmod_softreset(struct omap_hwmod *oh); 632int omap_hwmod_softreset(struct omap_hwmod *oh);
629 633
630int omap_hwmod_count_resources(struct omap_hwmod *oh); 634int omap_hwmod_count_resources(struct omap_hwmod *oh, unsigned long flags);
631int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res); 635int omap_hwmod_fill_resources(struct omap_hwmod *oh, struct resource *res);
632int omap_hwmod_fill_dma_resources(struct omap_hwmod *oh, struct resource *res); 636int omap_hwmod_fill_dma_resources(struct omap_hwmod *oh, struct resource *res);
633int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type, 637int omap_hwmod_get_resource_byname(struct omap_hwmod *oh, unsigned int type,
diff --git a/arch/arm/mach-omap2/omap_opp_data.h b/arch/arm/mach-omap2/omap_opp_data.h
index 7e437bf6024c..336fdfcf88bb 100644
--- a/arch/arm/mach-omap2/omap_opp_data.h
+++ b/arch/arm/mach-omap2/omap_opp_data.h
@@ -89,8 +89,11 @@ extern struct omap_volt_data omap34xx_vddcore_volt_data[];
89extern struct omap_volt_data omap36xx_vddmpu_volt_data[]; 89extern struct omap_volt_data omap36xx_vddmpu_volt_data[];
90extern struct omap_volt_data omap36xx_vddcore_volt_data[]; 90extern struct omap_volt_data omap36xx_vddcore_volt_data[];
91 91
92extern struct omap_volt_data omap44xx_vdd_mpu_volt_data[]; 92extern struct omap_volt_data omap443x_vdd_mpu_volt_data[];
93extern struct omap_volt_data omap44xx_vdd_iva_volt_data[]; 93extern struct omap_volt_data omap443x_vdd_iva_volt_data[];
94extern struct omap_volt_data omap44xx_vdd_core_volt_data[]; 94extern struct omap_volt_data omap443x_vdd_core_volt_data[];
95extern struct omap_volt_data omap446x_vdd_mpu_volt_data[];
96extern struct omap_volt_data omap446x_vdd_iva_volt_data[];
97extern struct omap_volt_data omap446x_vdd_core_volt_data[];
95 98
96#endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */ 99#endif /* __ARCH_ARM_MACH_OMAP2_OMAP_OPP_DATA_H */
diff --git a/arch/arm/mach-omap2/omap_twl.c b/arch/arm/mach-omap2/omap_twl.c
index 2bf35dc091be..fefd40166624 100644
--- a/arch/arm/mach-omap2/omap_twl.c
+++ b/arch/arm/mach-omap2/omap_twl.c
@@ -31,16 +31,6 @@
31#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04 31#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04
32#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200 32#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200
33 33
34#define OMAP3430_VP1_VLIMITTO_VDDMIN 0x14
35#define OMAP3430_VP1_VLIMITTO_VDDMAX 0x42
36#define OMAP3430_VP2_VLIMITTO_VDDMIN 0x18
37#define OMAP3430_VP2_VLIMITTO_VDDMAX 0x2c
38
39#define OMAP3630_VP1_VLIMITTO_VDDMIN 0x18
40#define OMAP3630_VP1_VLIMITTO_VDDMAX 0x3c
41#define OMAP3630_VP2_VLIMITTO_VDDMIN 0x18
42#define OMAP3630_VP2_VLIMITTO_VDDMAX 0x30
43
44#define OMAP4_SRI2C_SLAVE_ADDR 0x12 34#define OMAP4_SRI2C_SLAVE_ADDR 0x12
45#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55 35#define OMAP4_VDD_MPU_SR_VOLT_REG 0x55
46#define OMAP4_VDD_MPU_SR_CMD_REG 0x56 36#define OMAP4_VDD_MPU_SR_CMD_REG 0x56
@@ -54,13 +44,6 @@
54#define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04 44#define OMAP4_VP_VSTEPMAX_VSTEPMAX 0x04
55#define OMAP4_VP_VLIMITTO_TIMEOUT_US 200 45#define OMAP4_VP_VLIMITTO_TIMEOUT_US 200
56 46
57#define OMAP4_VP_MPU_VLIMITTO_VDDMIN 0xA
58#define OMAP4_VP_MPU_VLIMITTO_VDDMAX 0x39
59#define OMAP4_VP_IVA_VLIMITTO_VDDMIN 0xA
60#define OMAP4_VP_IVA_VLIMITTO_VDDMAX 0x2D
61#define OMAP4_VP_CORE_VLIMITTO_VDDMIN 0xA
62#define OMAP4_VP_CORE_VLIMITTO_VDDMAX 0x28
63
64static bool is_offset_valid; 47static bool is_offset_valid;
65static u8 smps_offset; 48static u8 smps_offset;
66/* 49/*
@@ -159,16 +142,11 @@ static u8 twl6030_uv_to_vsel(unsigned long uv)
159static struct omap_voltdm_pmic omap3_mpu_pmic = { 142static struct omap_voltdm_pmic omap3_mpu_pmic = {
160 .slew_rate = 4000, 143 .slew_rate = 4000,
161 .step_size = 12500, 144 .step_size = 12500,
162 .on_volt = 1200000,
163 .onlp_volt = 1000000,
164 .ret_volt = 975000,
165 .off_volt = 600000,
166 .volt_setup_time = 0xfff,
167 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, 145 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
168 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, 146 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
169 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, 147 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX,
170 .vp_vddmin = OMAP3430_VP1_VLIMITTO_VDDMIN, 148 .vddmin = 600000,
171 .vp_vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX, 149 .vddmax = 1450000,
172 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, 150 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
173 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, 151 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
174 .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG, 152 .volt_reg_addr = OMAP3_VDD_MPU_SR_CONTROL_REG,
@@ -180,16 +158,11 @@ static struct omap_voltdm_pmic omap3_mpu_pmic = {
180static struct omap_voltdm_pmic omap3_core_pmic = { 158static struct omap_voltdm_pmic omap3_core_pmic = {
181 .slew_rate = 4000, 159 .slew_rate = 4000,
182 .step_size = 12500, 160 .step_size = 12500,
183 .on_volt = 1200000,
184 .onlp_volt = 1000000,
185 .ret_volt = 975000,
186 .off_volt = 600000,
187 .volt_setup_time = 0xfff,
188 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET, 161 .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
189 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN, 162 .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
190 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX, 163 .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX,
191 .vp_vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN, 164 .vddmin = 600000,
192 .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX, 165 .vddmax = 1450000,
193 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US, 166 .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
194 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR, 167 .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
195 .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG, 168 .volt_reg_addr = OMAP3_VDD_CORE_SR_CONTROL_REG,
@@ -201,21 +174,17 @@ static struct omap_voltdm_pmic omap3_core_pmic = {
201static struct omap_voltdm_pmic omap4_mpu_pmic = { 174static struct omap_voltdm_pmic omap4_mpu_pmic = {
202 .slew_rate = 4000, 175 .slew_rate = 4000,
203 .step_size = 12660, 176 .step_size = 12660,
204 .on_volt = 1375000,
205 .onlp_volt = 1375000,
206 .ret_volt = 830000,
207 .off_volt = 0,
208 .volt_setup_time = 0,
209 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 177 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
210 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 178 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
211 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, 179 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX,
212 .vp_vddmin = OMAP4_VP_MPU_VLIMITTO_VDDMIN, 180 .vddmin = 0,
213 .vp_vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX, 181 .vddmax = 2100000,
214 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 182 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
215 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 183 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
216 .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG, 184 .volt_reg_addr = OMAP4_VDD_MPU_SR_VOLT_REG,
217 .cmd_reg_addr = OMAP4_VDD_MPU_SR_CMD_REG, 185 .cmd_reg_addr = OMAP4_VDD_MPU_SR_CMD_REG,
218 .i2c_high_speed = true, 186 .i2c_high_speed = true,
187 .i2c_pad_load = 3,
219 .vsel_to_uv = twl6030_vsel_to_uv, 188 .vsel_to_uv = twl6030_vsel_to_uv,
220 .uv_to_vsel = twl6030_uv_to_vsel, 189 .uv_to_vsel = twl6030_uv_to_vsel,
221}; 190};
@@ -223,21 +192,17 @@ static struct omap_voltdm_pmic omap4_mpu_pmic = {
223static struct omap_voltdm_pmic omap4_iva_pmic = { 192static struct omap_voltdm_pmic omap4_iva_pmic = {
224 .slew_rate = 4000, 193 .slew_rate = 4000,
225 .step_size = 12660, 194 .step_size = 12660,
226 .on_volt = 1188000,
227 .onlp_volt = 1188000,
228 .ret_volt = 830000,
229 .off_volt = 0,
230 .volt_setup_time = 0,
231 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 195 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
232 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 196 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
233 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, 197 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX,
234 .vp_vddmin = OMAP4_VP_IVA_VLIMITTO_VDDMIN, 198 .vddmin = 0,
235 .vp_vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX, 199 .vddmax = 2100000,
236 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 200 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
237 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 201 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
238 .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG, 202 .volt_reg_addr = OMAP4_VDD_IVA_SR_VOLT_REG,
239 .cmd_reg_addr = OMAP4_VDD_IVA_SR_CMD_REG, 203 .cmd_reg_addr = OMAP4_VDD_IVA_SR_CMD_REG,
240 .i2c_high_speed = true, 204 .i2c_high_speed = true,
205 .i2c_pad_load = 3,
241 .vsel_to_uv = twl6030_vsel_to_uv, 206 .vsel_to_uv = twl6030_vsel_to_uv,
242 .uv_to_vsel = twl6030_uv_to_vsel, 207 .uv_to_vsel = twl6030_uv_to_vsel,
243}; 208};
@@ -245,20 +210,17 @@ static struct omap_voltdm_pmic omap4_iva_pmic = {
245static struct omap_voltdm_pmic omap4_core_pmic = { 210static struct omap_voltdm_pmic omap4_core_pmic = {
246 .slew_rate = 4000, 211 .slew_rate = 4000,
247 .step_size = 12660, 212 .step_size = 12660,
248 .on_volt = 1200000,
249 .onlp_volt = 1200000,
250 .ret_volt = 830000,
251 .off_volt = 0,
252 .volt_setup_time = 0,
253 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET, 213 .vp_erroroffset = OMAP4_VP_CONFIG_ERROROFFSET,
254 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN, 214 .vp_vstepmin = OMAP4_VP_VSTEPMIN_VSTEPMIN,
255 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX, 215 .vp_vstepmax = OMAP4_VP_VSTEPMAX_VSTEPMAX,
256 .vp_vddmin = OMAP4_VP_CORE_VLIMITTO_VDDMIN, 216 .vddmin = 0,
257 .vp_vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX, 217 .vddmax = 2100000,
258 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US, 218 .vp_timeout_us = OMAP4_VP_VLIMITTO_TIMEOUT_US,
259 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR, 219 .i2c_slave_addr = OMAP4_SRI2C_SLAVE_ADDR,
260 .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG, 220 .volt_reg_addr = OMAP4_VDD_CORE_SR_VOLT_REG,
261 .cmd_reg_addr = OMAP4_VDD_CORE_SR_CMD_REG, 221 .cmd_reg_addr = OMAP4_VDD_CORE_SR_CMD_REG,
222 .i2c_high_speed = true,
223 .i2c_pad_load = 3,
262 .vsel_to_uv = twl6030_vsel_to_uv, 224 .vsel_to_uv = twl6030_vsel_to_uv,
263 .uv_to_vsel = twl6030_uv_to_vsel, 225 .uv_to_vsel = twl6030_uv_to_vsel,
264}; 226};
@@ -289,13 +251,6 @@ int __init omap3_twl_init(void)
289 if (!cpu_is_omap34xx()) 251 if (!cpu_is_omap34xx())
290 return -ENODEV; 252 return -ENODEV;
291 253
292 if (cpu_is_omap3630()) {
293 omap3_mpu_pmic.vp_vddmin = OMAP3630_VP1_VLIMITTO_VDDMIN;
294 omap3_mpu_pmic.vp_vddmax = OMAP3630_VP1_VLIMITTO_VDDMAX;
295 omap3_core_pmic.vp_vddmin = OMAP3630_VP2_VLIMITTO_VDDMIN;
296 omap3_core_pmic.vp_vddmax = OMAP3630_VP2_VLIMITTO_VDDMAX;
297 }
298
299 /* 254 /*
300 * The smartreflex bit on twl4030 specifies if the setting of voltage 255 * The smartreflex bit on twl4030 specifies if the setting of voltage
301 * is done over the I2C_SR path. Since this setting is independent of 256 * is done over the I2C_SR path. Since this setting is independent of
diff --git a/arch/arm/mach-omap2/opp4xxx_data.c b/arch/arm/mach-omap2/opp4xxx_data.c
index a9fd6d5fe79e..d470b728e720 100644
--- a/arch/arm/mach-omap2/opp4xxx_data.c
+++ b/arch/arm/mach-omap2/opp4xxx_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP4 OPP table definitions. 2 * OMAP4 OPP table definitions.
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ 4 * Copyright (C) 2010-2012 Texas Instruments Incorporated - http://www.ti.com/
5 * Nishanth Menon 5 * Nishanth Menon
6 * Kevin Hilman 6 * Kevin Hilman
7 * Thara Gopinath 7 * Thara Gopinath
@@ -35,7 +35,7 @@
35#define OMAP4430_VDD_MPU_OPPTURBO_UV 1313000 35#define OMAP4430_VDD_MPU_OPPTURBO_UV 1313000
36#define OMAP4430_VDD_MPU_OPPNITRO_UV 1375000 36#define OMAP4430_VDD_MPU_OPPNITRO_UV 1375000
37 37
38struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = { 38struct omap_volt_data omap443x_vdd_mpu_volt_data[] = {
39 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c), 39 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c),
40 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16), 40 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16),
41 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23), 41 VOLT_DATA_DEFINE(OMAP4430_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23),
@@ -47,7 +47,7 @@ struct omap_volt_data omap44xx_vdd_mpu_volt_data[] = {
47#define OMAP4430_VDD_IVA_OPP100_UV 1188000 47#define OMAP4430_VDD_IVA_OPP100_UV 1188000
48#define OMAP4430_VDD_IVA_OPPTURBO_UV 1300000 48#define OMAP4430_VDD_IVA_OPPTURBO_UV 1300000
49 49
50struct omap_volt_data omap44xx_vdd_iva_volt_data[] = { 50struct omap_volt_data omap443x_vdd_iva_volt_data[] = {
51 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c), 51 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c),
52 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16), 52 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16),
53 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23), 53 VOLT_DATA_DEFINE(OMAP4430_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23),
@@ -57,14 +57,14 @@ struct omap_volt_data omap44xx_vdd_iva_volt_data[] = {
57#define OMAP4430_VDD_CORE_OPP50_UV 1025000 57#define OMAP4430_VDD_CORE_OPP50_UV 1025000
58#define OMAP4430_VDD_CORE_OPP100_UV 1200000 58#define OMAP4430_VDD_CORE_OPP100_UV 1200000
59 59
60struct omap_volt_data omap44xx_vdd_core_volt_data[] = { 60struct omap_volt_data omap443x_vdd_core_volt_data[] = {
61 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c), 61 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c),
62 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16), 62 VOLT_DATA_DEFINE(OMAP4430_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16),
63 VOLT_DATA_DEFINE(0, 0, 0, 0), 63 VOLT_DATA_DEFINE(0, 0, 0, 0),
64}; 64};
65 65
66 66
67static struct omap_opp_def __initdata omap44xx_opp_def_list[] = { 67static struct omap_opp_def __initdata omap443x_opp_def_list[] = {
68 /* MPU OPP1 - OPP50 */ 68 /* MPU OPP1 - OPP50 */
69 OPP_INITIALIZER("mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV), 69 OPP_INITIALIZER("mpu", true, 300000000, OMAP4430_VDD_MPU_OPP50_UV),
70 /* MPU OPP2 - OPP100 */ 70 /* MPU OPP2 - OPP100 */
@@ -86,6 +86,82 @@ static struct omap_opp_def __initdata omap44xx_opp_def_list[] = {
86 /* TODO: add DSP, aess, fdif, gpu */ 86 /* TODO: add DSP, aess, fdif, gpu */
87}; 87};
88 88
89#define OMAP4460_VDD_MPU_OPP50_UV 1025000
90#define OMAP4460_VDD_MPU_OPP100_UV 1200000
91#define OMAP4460_VDD_MPU_OPPTURBO_UV 1313000
92#define OMAP4460_VDD_MPU_OPPNITRO_UV 1375000
93
94struct omap_volt_data omap446x_vdd_mpu_volt_data[] = {
95 VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPP50_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP50, 0xf4, 0x0c),
96 VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPP100_UV, OMAP44XX_CONTROL_FUSE_MPU_OPP100, 0xf9, 0x16),
97 VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPTURBO, 0xfa, 0x23),
98 VOLT_DATA_DEFINE(OMAP4460_VDD_MPU_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_MPU_OPPNITRO, 0xfa, 0x27),
99 VOLT_DATA_DEFINE(0, 0, 0, 0),
100};
101
102#define OMAP4460_VDD_IVA_OPP50_UV 1025000
103#define OMAP4460_VDD_IVA_OPP100_UV 1200000
104#define OMAP4460_VDD_IVA_OPPTURBO_UV 1313000
105#define OMAP4460_VDD_IVA_OPPNITRO_UV 1375000
106
107struct omap_volt_data omap446x_vdd_iva_volt_data[] = {
108 VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPP50_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP50, 0xf4, 0x0c),
109 VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPP100_UV, OMAP44XX_CONTROL_FUSE_IVA_OPP100, 0xf9, 0x16),
110 VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPPTURBO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPTURBO, 0xfa, 0x23),
111 VOLT_DATA_DEFINE(OMAP4460_VDD_IVA_OPPNITRO_UV, OMAP44XX_CONTROL_FUSE_IVA_OPPNITRO, 0xfa, 0x23),
112 VOLT_DATA_DEFINE(0, 0, 0, 0),
113};
114
115#define OMAP4460_VDD_CORE_OPP50_UV 1025000
116#define OMAP4460_VDD_CORE_OPP100_UV 1200000
117#define OMAP4460_VDD_CORE_OPP100_OV_UV 1250000
118
119struct omap_volt_data omap446x_vdd_core_volt_data[] = {
120 VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP50_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP50, 0xf4, 0x0c),
121 VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100, 0xf9, 0x16),
122 VOLT_DATA_DEFINE(OMAP4460_VDD_CORE_OPP100_OV_UV, OMAP44XX_CONTROL_FUSE_CORE_OPP100OV, 0xf9, 0x16),
123 VOLT_DATA_DEFINE(0, 0, 0, 0),
124};
125
126static struct omap_opp_def __initdata omap446x_opp_def_list[] = {
127 /* MPU OPP1 - OPP50 */
128 OPP_INITIALIZER("mpu", true, 350000000, OMAP4460_VDD_MPU_OPP50_UV),
129 /* MPU OPP2 - OPP100 */
130 OPP_INITIALIZER("mpu", true, 700000000, OMAP4460_VDD_MPU_OPP100_UV),
131 /* MPU OPP3 - OPP-Turbo */
132 OPP_INITIALIZER("mpu", true, 920000000, OMAP4460_VDD_MPU_OPPTURBO_UV),
133 /*
134 * MPU OPP4 - OPP-Nitro + Disabled as the reference schematics
135 * recommends TPS623631 - confirm and enable the opp in board file
136 * XXX: May be we should enable these based on mpu capability and
137 * Exception board files disable it...
138 */
139 OPP_INITIALIZER("mpu", false, 1200000000, OMAP4460_VDD_MPU_OPPNITRO_UV),
140 /* MPU OPP4 - OPP-Nitro SpeedBin */
141 OPP_INITIALIZER("mpu", false, 1500000000, OMAP4460_VDD_MPU_OPPNITRO_UV),
142 /* L3 OPP1 - OPP50 */
143 OPP_INITIALIZER("l3_main_1", true, 100000000, OMAP4460_VDD_CORE_OPP50_UV),
144 /* L3 OPP2 - OPP100 */
145 OPP_INITIALIZER("l3_main_1", true, 200000000, OMAP4460_VDD_CORE_OPP100_UV),
146 /* IVA OPP1 - OPP50 */
147 OPP_INITIALIZER("iva", true, 133000000, OMAP4460_VDD_IVA_OPP50_UV),
148 /* IVA OPP2 - OPP100 */
149 OPP_INITIALIZER("iva", true, 266100000, OMAP4460_VDD_IVA_OPP100_UV),
150 /*
151 * IVA OPP3 - OPP-Turbo + Disabled as the reference schematics
152 * recommends Phoenix VCORE2 which can supply only 600mA - so the ones
153 * above this OPP frequency, even though OMAP is capable, should be
154 * enabled by board file which is sure of the chip power capability
155 */
156 OPP_INITIALIZER("iva", false, 332000000, OMAP4460_VDD_IVA_OPPTURBO_UV),
157 /* IVA OPP4 - OPP-Nitro */
158 OPP_INITIALIZER("iva", false, 430000000, OMAP4460_VDD_IVA_OPPNITRO_UV),
159 /* IVA OPP5 - OPP-Nitro SpeedBin*/
160 OPP_INITIALIZER("iva", false, 500000000, OMAP4460_VDD_IVA_OPPNITRO_UV),
161
162 /* TODO: add DSP, aess, fdif, gpu */
163};
164
89/** 165/**
90 * omap4_opp_init() - initialize omap4 opp table 166 * omap4_opp_init() - initialize omap4 opp table
91 */ 167 */
@@ -93,12 +169,12 @@ int __init omap4_opp_init(void)
93{ 169{
94 int r = -ENODEV; 170 int r = -ENODEV;
95 171
96 if (!cpu_is_omap443x()) 172 if (cpu_is_omap443x())
97 return r; 173 r = omap_init_opp_table(omap443x_opp_def_list,
98 174 ARRAY_SIZE(omap443x_opp_def_list));
99 r = omap_init_opp_table(omap44xx_opp_def_list, 175 else if (cpu_is_omap446x())
100 ARRAY_SIZE(omap44xx_opp_def_list)); 176 r = omap_init_opp_table(omap446x_opp_def_list,
101 177 ARRAY_SIZE(omap446x_opp_def_list));
102 return r; 178 return r;
103} 179}
104device_initcall(omap4_opp_init); 180device_initcall(omap4_opp_init);
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 331478f9b864..e5a4c3a0accd 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -40,6 +40,36 @@ static struct omap_device_pm_latency *pm_lats;
40 */ 40 */
41int (*omap_pm_suspend)(void); 41int (*omap_pm_suspend)(void);
42 42
43/**
44 * struct omap2_oscillator - Describe the board main oscillator latencies
45 * @startup_time: oscillator startup latency
46 * @shutdown_time: oscillator shutdown latency
47 */
48struct omap2_oscillator {
49 u32 startup_time;
50 u32 shutdown_time;
51};
52
53static struct omap2_oscillator oscillator = {
54 .startup_time = ULONG_MAX,
55 .shutdown_time = ULONG_MAX,
56};
57
58void omap_pm_setup_oscillator(u32 tstart, u32 tshut)
59{
60 oscillator.startup_time = tstart;
61 oscillator.shutdown_time = tshut;
62}
63
64void omap_pm_get_oscillator(u32 *tstart, u32 *tshut)
65{
66 if (!tstart || !tshut)
67 return;
68
69 *tstart = oscillator.startup_time;
70 *tshut = oscillator.shutdown_time;
71}
72
43static int __init _init_omap_device(char *name) 73static int __init _init_omap_device(char *name)
44{ 74{
45 struct omap_hwmod *oh; 75 struct omap_hwmod *oh;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 67d66131cfa7..4db7b238a0d5 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -129,4 +129,14 @@ static inline int omap4_twl_init(void)
129} 129}
130#endif 130#endif
131 131
132#ifdef CONFIG_PM
133extern void omap_pm_setup_oscillator(u32 tstart, u32 tshut);
134extern void omap_pm_get_oscillator(u32 *tstart, u32 *tshut);
135extern void omap_pm_setup_sr_i2c_pcb_length(u32 mm);
136#else
137static inline void omap_pm_setup_oscillator(u32 tstart, u32 tshut) { }
138static inline void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { }
139static inline void omap_pm_setup_sr_i2c_pcb_length(u32 mm) { }
140#endif
141
132#endif 142#endif
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index 9a2f5594a7dc..c289b3333c99 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -25,7 +25,7 @@
25#include <linux/sysfs.h> 25#include <linux/sysfs.h>
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/clk.h> 28#include <linux/clk-provider.h>
29#include <linux/irq.h> 29#include <linux/irq.h>
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/gpio.h> 31#include <linux/gpio.h>
@@ -43,9 +43,9 @@
43#include "soc.h" 43#include "soc.h"
44#include "common.h" 44#include "common.h"
45#include "clock.h" 45#include "clock.h"
46#include "prm2xxx_3xxx.h" 46#include "prm2xxx.h"
47#include "prm-regbits-24xx.h" 47#include "prm-regbits-24xx.h"
48#include "cm2xxx_3xxx.h" 48#include "cm2xxx.h"
49#include "cm-regbits-24xx.h" 49#include "cm-regbits-24xx.h"
50#include "sdrc.h" 50#include "sdrc.h"
51#include "sram.h" 51#include "sram.h"
@@ -203,7 +203,7 @@ static int omap2_can_sleep(void)
203{ 203{
204 if (omap2_fclks_active()) 204 if (omap2_fclks_active())
205 return 0; 205 return 0;
206 if (osc_ck->usecount > 1) 206 if (__clk_is_enabled(osc_ck))
207 return 0; 207 return 0;
208 if (omap_dma_running()) 208 if (omap_dma_running())
209 return 0; 209 return 0;
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 11f9669eb7ed..770320061422 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -38,17 +38,15 @@
38 38
39#include "clockdomain.h" 39#include "clockdomain.h"
40#include "powerdomain.h" 40#include "powerdomain.h"
41#include <plat/prcm.h>
42#include <plat-omap/dma-omap.h> 41#include <plat-omap/dma-omap.h>
43 42
44#include "soc.h" 43#include "soc.h"
45#include "common.h" 44#include "common.h"
46#include "cm2xxx_3xxx.h" 45#include "cm3xxx.h"
47#include "cm-regbits-34xx.h" 46#include "cm-regbits-34xx.h"
48#include "gpmc.h" 47#include "gpmc.h"
49#include "prm-regbits-34xx.h" 48#include "prm-regbits-34xx.h"
50 49#include "prm3xxx.h"
51#include "prm2xxx_3xxx.h"
52#include "pm.h" 50#include "pm.h"
53#include "sdrc.h" 51#include "sdrc.h"
54#include "sram.h" 52#include "sram.h"
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 1678a3284233..dea62a9aad07 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -29,8 +29,6 @@
29 29
30#include <asm/cpu.h> 30#include <asm/cpu.h>
31 31
32#include <plat/prcm.h>
33
34#include "powerdomain.h" 32#include "powerdomain.h"
35#include "clockdomain.h" 33#include "clockdomain.h"
36 34
diff --git a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
deleted file mode 100644
index 3950ccfe5f4a..000000000000
--- a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c
+++ /dev/null
@@ -1,242 +0,0 @@
1/*
2 * OMAP2 and OMAP3 powerdomain control
3 *
4 * Copyright (C) 2009-2011 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation
6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/io.h>
16#include <linux/errno.h>
17#include <linux/delay.h>
18#include <linux/bug.h>
19
20#include <plat/prcm.h>
21
22#include "powerdomain.h"
23#include "prm.h"
24#include "prm-regbits-24xx.h"
25#include "prm-regbits-34xx.h"
26
27
28/* Common functions across OMAP2 and OMAP3 */
29static int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
30{
31 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
32 (pwrst << OMAP_POWERSTATE_SHIFT),
33 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
34 return 0;
35}
36
37static int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
38{
39 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
40 OMAP2_PM_PWSTCTRL,
41 OMAP_POWERSTATE_MASK);
42}
43
44static int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
45{
46 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
47 OMAP2_PM_PWSTST,
48 OMAP_POWERSTATEST_MASK);
49}
50
51static int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
52 u8 pwrst)
53{
54 u32 m;
55
56 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
57
58 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
59 OMAP2_PM_PWSTCTRL);
60
61 return 0;
62}
63
64static int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
65 u8 pwrst)
66{
67 u32 m;
68
69 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
70
71 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
72 OMAP2_PM_PWSTCTRL);
73
74 return 0;
75}
76
77static int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
78{
79 u32 m;
80
81 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
82
83 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
84 m);
85}
86
87static int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
88{
89 u32 m;
90
91 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
92
93 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
94 OMAP2_PM_PWSTCTRL, m);
95}
96
97static int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
98{
99 u32 v;
100
101 v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK);
102 omap2_prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v,
103 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
104
105 return 0;
106}
107
108static int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm)
109{
110 u32 c = 0;
111
112 /*
113 * REVISIT: pwrdm_wait_transition() may be better implemented
114 * via a callback and a periodic timer check -- how long do we expect
115 * powerdomain transitions to take?
116 */
117
118 /* XXX Is this udelay() value meaningful? */
119 while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) &
120 OMAP_INTRANSITION_MASK) &&
121 (c++ < PWRDM_TRANSITION_BAILOUT))
122 udelay(1);
123
124 if (c > PWRDM_TRANSITION_BAILOUT) {
125 pr_err("powerdomain: %s: waited too long to complete transition\n",
126 pwrdm->name);
127 return -EAGAIN;
128 }
129
130 pr_debug("powerdomain: completed transition in %d loops\n", c);
131
132 return 0;
133}
134
135/* Applicable only for OMAP3. Not supported on OMAP2 */
136static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
137{
138 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
139 OMAP3430_PM_PREPWSTST,
140 OMAP3430_LASTPOWERSTATEENTERED_MASK);
141}
142
143static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
144{
145 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
146 OMAP2_PM_PWSTST,
147 OMAP3430_LOGICSTATEST_MASK);
148}
149
150static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
151{
152 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
153 OMAP2_PM_PWSTCTRL,
154 OMAP3430_LOGICSTATEST_MASK);
155}
156
157static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
158{
159 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
160 OMAP3430_PM_PREPWSTST,
161 OMAP3430_LASTLOGICSTATEENTERED_MASK);
162}
163
164static int omap3_get_mem_bank_lastmemst_mask(u8 bank)
165{
166 switch (bank) {
167 case 0:
168 return OMAP3430_LASTMEM1STATEENTERED_MASK;
169 case 1:
170 return OMAP3430_LASTMEM2STATEENTERED_MASK;
171 case 2:
172 return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
173 case 3:
174 return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
175 default:
176 WARN_ON(1); /* should never happen */
177 return -EEXIST;
178 }
179 return 0;
180}
181
182static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
183{
184 u32 m;
185
186 m = omap3_get_mem_bank_lastmemst_mask(bank);
187
188 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
189 OMAP3430_PM_PREPWSTST, m);
190}
191
192static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
193{
194 omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
195 return 0;
196}
197
198static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
199{
200 return omap2_prm_rmw_mod_reg_bits(0,
201 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
202 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
203}
204
205static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
206{
207 return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
208 0, pwrdm->prcm_offs,
209 OMAP2_PM_PWSTCTRL);
210}
211
212struct pwrdm_ops omap2_pwrdm_operations = {
213 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
214 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
215 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
216 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
217 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
218 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
219 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
220 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
221 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
222};
223
224struct pwrdm_ops omap3_pwrdm_operations = {
225 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
226 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
227 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
228 .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst,
229 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
230 .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
231 .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst,
232 .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst,
233 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
234 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
235 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
236 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
237 .pwrdm_read_prev_mem_pwrst = omap3_pwrdm_read_prev_mem_pwrst,
238 .pwrdm_clear_all_prev_pwrst = omap3_pwrdm_clear_all_prev_pwrst,
239 .pwrdm_enable_hdwr_sar = omap3_pwrdm_enable_hdwr_sar,
240 .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar,
241 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
242};
diff --git a/arch/arm/mach-omap2/powerdomain33xx.c b/arch/arm/mach-omap2/powerdomain33xx.c
deleted file mode 100644
index 67c5663899b6..000000000000
--- a/arch/arm/mach-omap2/powerdomain33xx.c
+++ /dev/null
@@ -1,229 +0,0 @@
1/*
2 * AM33XX Powerdomain control
3 *
4 * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * Derived from mach-omap2/powerdomain44xx.c written by Rajendra Nayak
7 * <rnayak@ti.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
12 *
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/io.h>
20#include <linux/errno.h>
21#include <linux/delay.h>
22
23#include <plat/prcm.h>
24
25#include "powerdomain.h"
26#include "prm33xx.h"
27#include "prm-regbits-33xx.h"
28
29
30static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
31{
32 am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK,
33 (pwrst << OMAP_POWERSTATE_SHIFT),
34 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
35 return 0;
36}
37
38static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
39{
40 u32 v;
41
42 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
43 v &= OMAP_POWERSTATE_MASK;
44 v >>= OMAP_POWERSTATE_SHIFT;
45
46 return v;
47}
48
49static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
50{
51 u32 v;
52
53 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
54 v &= OMAP_POWERSTATEST_MASK;
55 v >>= OMAP_POWERSTATEST_SHIFT;
56
57 return v;
58}
59
60static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
61{
62 u32 v;
63
64 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
65 v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
66 v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
67
68 return v;
69}
70
71static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
72{
73 am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
74 (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT),
75 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
76 return 0;
77}
78
79static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
80{
81 am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK,
82 AM33XX_LASTPOWERSTATEENTERED_MASK,
83 pwrdm->prcm_offs, pwrdm->pwrstst_offs);
84 return 0;
85}
86
87static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
88{
89 u32 m;
90
91 m = pwrdm->logicretstate_mask;
92 if (!m)
93 return -EINVAL;
94
95 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
96 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
97
98 return 0;
99}
100
101static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
102{
103 u32 v;
104
105 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
106 v &= AM33XX_LOGICSTATEST_MASK;
107 v >>= AM33XX_LOGICSTATEST_SHIFT;
108
109 return v;
110}
111
112static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
113{
114 u32 v, m;
115
116 m = pwrdm->logicretstate_mask;
117 if (!m)
118 return -EINVAL;
119
120 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
121 v &= m;
122 v >>= __ffs(m);
123
124 return v;
125}
126
127static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
128 u8 pwrst)
129{
130 u32 m;
131
132 m = pwrdm->mem_on_mask[bank];
133 if (!m)
134 return -EINVAL;
135
136 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
137 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
138
139 return 0;
140}
141
142static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
143 u8 pwrst)
144{
145 u32 m;
146
147 m = pwrdm->mem_ret_mask[bank];
148 if (!m)
149 return -EINVAL;
150
151 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
152 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
153
154 return 0;
155}
156
157static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
158{
159 u32 m, v;
160
161 m = pwrdm->mem_pwrst_mask[bank];
162 if (!m)
163 return -EINVAL;
164
165 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
166 v &= m;
167 v >>= __ffs(m);
168
169 return v;
170}
171
172static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
173{
174 u32 m, v;
175
176 m = pwrdm->mem_retst_mask[bank];
177 if (!m)
178 return -EINVAL;
179
180 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
181 v &= m;
182 v >>= __ffs(m);
183
184 return v;
185}
186
187static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
188{
189 u32 c = 0;
190
191 /*
192 * REVISIT: pwrdm_wait_transition() may be better implemented
193 * via a callback and a periodic timer check -- how long do we expect
194 * powerdomain transitions to take?
195 */
196
197 /* XXX Is this udelay() value meaningful? */
198 while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs)
199 & OMAP_INTRANSITION_MASK) &&
200 (c++ < PWRDM_TRANSITION_BAILOUT))
201 udelay(1);
202
203 if (c > PWRDM_TRANSITION_BAILOUT) {
204 pr_err("powerdomain: %s: waited too long to complete transition\n",
205 pwrdm->name);
206 return -EAGAIN;
207 }
208
209 pr_debug("powerdomain: completed transition in %d loops\n", c);
210
211 return 0;
212}
213
214struct pwrdm_ops am33xx_pwrdm_operations = {
215 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
216 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
217 .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst,
218 .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst,
219 .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst,
220 .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst,
221 .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst,
222 .pwrdm_clear_all_prev_pwrst = am33xx_pwrdm_clear_all_prev_pwrst,
223 .pwrdm_set_lowpwrstchange = am33xx_pwrdm_set_lowpwrstchange,
224 .pwrdm_read_mem_pwrst = am33xx_pwrdm_read_mem_pwrst,
225 .pwrdm_read_mem_retst = am33xx_pwrdm_read_mem_retst,
226 .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst,
227 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst,
228 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
229};
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c
deleted file mode 100644
index aceb4f464c9b..000000000000
--- a/arch/arm/mach-omap2/powerdomain44xx.c
+++ /dev/null
@@ -1,285 +0,0 @@
1/*
2 * OMAP4 powerdomain control
3 *
4 * Copyright (C) 2009-2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2007-2009 Nokia Corporation
6 *
7 * Derived from mach-omap2/powerdomain.c written by Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/io.h>
16#include <linux/errno.h>
17#include <linux/delay.h>
18#include <linux/bug.h>
19
20#include "powerdomain.h"
21#include <plat/prcm.h>
22#include "prm2xxx_3xxx.h"
23#include "prm44xx.h"
24#include "prminst44xx.h"
25#include "prm-regbits-44xx.h"
26
27static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
28{
29 omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
30 (pwrst << OMAP_POWERSTATE_SHIFT),
31 pwrdm->prcm_partition,
32 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
33 return 0;
34}
35
36static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
37{
38 u32 v;
39
40 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
41 OMAP4_PM_PWSTCTRL);
42 v &= OMAP_POWERSTATE_MASK;
43 v >>= OMAP_POWERSTATE_SHIFT;
44
45 return v;
46}
47
48static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
49{
50 u32 v;
51
52 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
53 OMAP4_PM_PWSTST);
54 v &= OMAP_POWERSTATEST_MASK;
55 v >>= OMAP_POWERSTATEST_SHIFT;
56
57 return v;
58}
59
60static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
61{
62 u32 v;
63
64 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
65 OMAP4_PM_PWSTST);
66 v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
67 v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
68
69 return v;
70}
71
72static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
73{
74 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
75 (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
76 pwrdm->prcm_partition,
77 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
78 return 0;
79}
80
81static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
82{
83 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
84 OMAP4430_LASTPOWERSTATEENTERED_MASK,
85 pwrdm->prcm_partition,
86 pwrdm->prcm_offs, OMAP4_PM_PWSTST);
87 return 0;
88}
89
90static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
91{
92 u32 v;
93
94 v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
95 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
96 pwrdm->prcm_partition, pwrdm->prcm_offs,
97 OMAP4_PM_PWSTCTRL);
98
99 return 0;
100}
101
102static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
103 u8 pwrst)
104{
105 u32 m;
106
107 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
108
109 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
110 pwrdm->prcm_partition, pwrdm->prcm_offs,
111 OMAP4_PM_PWSTCTRL);
112
113 return 0;
114}
115
116static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
117 u8 pwrst)
118{
119 u32 m;
120
121 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
122
123 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
124 pwrdm->prcm_partition, pwrdm->prcm_offs,
125 OMAP4_PM_PWSTCTRL);
126
127 return 0;
128}
129
130static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
131{
132 u32 v;
133
134 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
135 OMAP4_PM_PWSTST);
136 v &= OMAP4430_LOGICSTATEST_MASK;
137 v >>= OMAP4430_LOGICSTATEST_SHIFT;
138
139 return v;
140}
141
142static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
143{
144 u32 v;
145
146 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
147 OMAP4_PM_PWSTCTRL);
148 v &= OMAP4430_LOGICRETSTATE_MASK;
149 v >>= OMAP4430_LOGICRETSTATE_SHIFT;
150
151 return v;
152}
153
154/**
155 * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
156 * @pwrdm: struct powerdomain * to read the state for
157 *
158 * Reads the previous logic powerstate for a powerdomain. This
159 * function must determine the previous logic powerstate by first
160 * checking the previous powerstate for the domain. If that was OFF,
161 * then logic has been lost. If previous state was RETENTION, the
162 * function reads the setting for the next retention logic state to
163 * see the actual value. In every other case, the logic is
164 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
165 * depending whether the logic was retained or not.
166 */
167static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
168{
169 int state;
170
171 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
172
173 if (state == PWRDM_POWER_OFF)
174 return PWRDM_POWER_OFF;
175
176 if (state != PWRDM_POWER_RET)
177 return PWRDM_POWER_RET;
178
179 return omap4_pwrdm_read_logic_retst(pwrdm);
180}
181
182static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
183{
184 u32 m, v;
185
186 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
187
188 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
189 OMAP4_PM_PWSTST);
190 v &= m;
191 v >>= __ffs(m);
192
193 return v;
194}
195
196static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
197{
198 u32 m, v;
199
200 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
201
202 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
203 OMAP4_PM_PWSTCTRL);
204 v &= m;
205 v >>= __ffs(m);
206
207 return v;
208}
209
210/**
211 * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
212 * @pwrdm: struct powerdomain * to read mem powerstate for
213 * @bank: memory bank index
214 *
215 * Reads the previous memory powerstate for a powerdomain. This
216 * function must determine the previous memory powerstate by first
217 * checking the previous powerstate for the domain. If that was OFF,
218 * then logic has been lost. If previous state was RETENTION, the
219 * function reads the setting for the next memory retention state to
220 * see the actual value. In every other case, the logic is
221 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
222 * depending whether logic was retained or not.
223 */
224static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
225{
226 int state;
227
228 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
229
230 if (state == PWRDM_POWER_OFF)
231 return PWRDM_POWER_OFF;
232
233 if (state != PWRDM_POWER_RET)
234 return PWRDM_POWER_RET;
235
236 return omap4_pwrdm_read_mem_retst(pwrdm, bank);
237}
238
239static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
240{
241 u32 c = 0;
242
243 /*
244 * REVISIT: pwrdm_wait_transition() may be better implemented
245 * via a callback and a periodic timer check -- how long do we expect
246 * powerdomain transitions to take?
247 */
248
249 /* XXX Is this udelay() value meaningful? */
250 while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
251 pwrdm->prcm_offs,
252 OMAP4_PM_PWSTST) &
253 OMAP_INTRANSITION_MASK) &&
254 (c++ < PWRDM_TRANSITION_BAILOUT))
255 udelay(1);
256
257 if (c > PWRDM_TRANSITION_BAILOUT) {
258 pr_err("powerdomain: %s: waited too long to complete transition\n",
259 pwrdm->name);
260 return -EAGAIN;
261 }
262
263 pr_debug("powerdomain: completed transition in %d loops\n", c);
264
265 return 0;
266}
267
268struct pwrdm_ops omap4_pwrdm_operations = {
269 .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst,
270 .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst,
271 .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst,
272 .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst,
273 .pwrdm_set_lowpwrstchange = omap4_pwrdm_set_lowpwrstchange,
274 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst,
275 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst,
276 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
277 .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst,
278 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
279 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst,
280 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst,
281 .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst,
282 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst,
283 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
284 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,
285};
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h
index 72df97482cc0..c7d355fafd24 100644
--- a/arch/arm/mach-omap2/prcm-common.h
+++ b/arch/arm/mach-omap2/prcm-common.h
@@ -406,11 +406,6 @@
406#define OMAP3430_EN_CORE_MASK (1 << 0) 406#define OMAP3430_EN_CORE_MASK (1 << 0)
407 407
408 408
409/*
410 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
411 * submodule to exit hardreset
412 */
413#define MAX_MODULE_HARDRESET_WAIT 10000
414 409
415/* 410/*
416 * Maximum time(us) it takes to output the signal WUCLKOUT of the last 411 * Maximum time(us) it takes to output the signal WUCLKOUT of the last
@@ -419,24 +414,7 @@
419 * microseconds on OMAP4, so this timeout may be too high. 414 * microseconds on OMAP4, so this timeout may be too high.
420 */ 415 */
421#define MAX_IOPAD_LATCH_TIME 100 416#define MAX_IOPAD_LATCH_TIME 100
422
423# ifndef __ASSEMBLER__ 417# ifndef __ASSEMBLER__
424extern void __iomem *prm_base;
425extern void __iomem *cm_base;
426extern void __iomem *cm2_base;
427extern void __iomem *prcm_mpu_base;
428
429#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
430extern void omap_prm_base_init(void);
431extern void omap_cm_base_init(void);
432#else
433static inline void omap_prm_base_init(void)
434{
435}
436static inline void omap_cm_base_init(void)
437{
438}
439#endif
440 418
441/** 419/**
442 * struct omap_prcm_irq - describes a PRCM interrupt bit 420 * struct omap_prcm_irq - describes a PRCM interrupt bit
diff --git a/arch/arm/mach-omap2/prcm.c b/arch/arm/mach-omap2/prcm.c
deleted file mode 100644
index cff270a178c5..000000000000
--- a/arch/arm/mach-omap2/prcm.c
+++ /dev/null
@@ -1,189 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap2/prcm.c
3 *
4 * OMAP 24xx Power Reset and Clock Management (PRCM) functions
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 *
8 * Written by Tony Lindgren <tony.lindgren@nokia.com>
9 *
10 * Copyright (C) 2007 Texas Instruments, Inc.
11 * Rajendra Nayak <rnayak@ti.com>
12 *
13 * Some pieces of code Copyright (C) 2005 Texas Instruments, Inc.
14 * Upgraded with OMAP4 support by Abhijit Pagare <abhijitpagare@ti.com>
15 *
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License version 2 as
18 * published by the Free Software Foundation.
19 */
20
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/clk.h>
24#include <linux/io.h>
25#include <linux/delay.h>
26#include <linux/export.h>
27
28#include "common.h"
29#include <plat/prcm.h>
30
31#include "soc.h"
32#include "clock.h"
33#include "clock2xxx.h"
34#include "cm2xxx_3xxx.h"
35#include "prm2xxx_3xxx.h"
36#include "prm44xx.h"
37#include "prminst44xx.h"
38#include "cminst44xx.h"
39#include "prm-regbits-24xx.h"
40#include "prm-regbits-44xx.h"
41#include "control.h"
42
43void __iomem *prm_base;
44void __iomem *cm_base;
45void __iomem *cm2_base;
46void __iomem *prcm_mpu_base;
47
48#define MAX_MODULE_ENABLE_WAIT 100000
49
50u32 omap_prcm_get_reset_sources(void)
51{
52 /* XXX This presumably needs modification for 34XX */
53 if (cpu_is_omap24xx() || cpu_is_omap34xx())
54 return omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST) & 0x7f;
55 if (cpu_is_omap44xx())
56 return omap2_prm_read_mod_reg(WKUP_MOD, OMAP4_RM_RSTST) & 0x7f;
57
58 return 0;
59}
60EXPORT_SYMBOL(omap_prcm_get_reset_sources);
61
62/* Resets clock rates and reboots the system. Only called from system.h */
63void omap_prcm_restart(char mode, const char *cmd)
64{
65 s16 prcm_offs = 0;
66
67 if (cpu_is_omap24xx()) {
68 omap2xxx_clk_prepare_for_reboot();
69
70 prcm_offs = WKUP_MOD;
71 } else if (cpu_is_omap34xx()) {
72 prcm_offs = OMAP3430_GR_MOD;
73 omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
74 } else if (cpu_is_omap44xx()) {
75 omap4_prminst_global_warm_sw_reset(); /* never returns */
76 } else {
77 WARN_ON(1);
78 }
79
80 /*
81 * As per Errata i520, in some cases, user will not be able to
82 * access DDR memory after warm-reset.
83 * This situation occurs while the warm-reset happens during a read
84 * access to DDR memory. In that particular condition, DDR memory
85 * does not respond to a corrupted read command due to the warm
86 * reset occurrence but SDRC is waiting for read completion.
87 * SDRC is not sensitive to the warm reset, but the interconnect is
88 * reset on the fly, thus causing a misalignment between SDRC logic,
89 * interconnect logic and DDR memory state.
90 * WORKAROUND:
91 * Steps to perform before a Warm reset is trigged:
92 * 1. enable self-refresh on idle request
93 * 2. put SDRC in idle
94 * 3. wait until SDRC goes to idle
95 * 4. generate SW reset (Global SW reset)
96 *
97 * Steps to be performed after warm reset occurs (in bootloader):
98 * if HW warm reset is the source, apply below steps before any
99 * accesses to SDRAM:
100 * 1. Reset SMS and SDRC and wait till reset is complete
101 * 2. Re-initialize SMS, SDRC and memory
102 *
103 * NOTE: Above work around is required only if arch reset is implemented
104 * using Global SW reset(GLOBAL_SW_RST). DPLL3 reset does not need
105 * the WA since it resets SDRC as well as part of cold reset.
106 */
107
108 /* XXX should be moved to some OMAP2/3 specific code */
109 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, prcm_offs,
110 OMAP2_RM_RSTCTRL);
111 omap2_prm_read_mod_reg(prcm_offs, OMAP2_RM_RSTCTRL); /* OCP barrier */
112}
113
114/**
115 * omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness
116 * @reg: physical address of module IDLEST register
117 * @mask: value to mask against to determine if the module is active
118 * @idlest: idle state indicator (0 or 1) for the clock
119 * @name: name of the clock (for printk)
120 *
121 * Returns 1 if the module indicated readiness in time, or 0 if it
122 * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds.
123 *
124 * XXX This function is deprecated. It should be removed once the
125 * hwmod conversion is complete.
126 */
127int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
128 const char *name)
129{
130 int i = 0;
131 int ena = 0;
132
133 if (idlest)
134 ena = 0;
135 else
136 ena = mask;
137
138 /* Wait for lock */
139 omap_test_timeout(((__raw_readl(reg) & mask) == ena),
140 MAX_MODULE_ENABLE_WAIT, i);
141
142 if (i < MAX_MODULE_ENABLE_WAIT)
143 pr_debug("cm: Module associated with clock %s ready after %d loops\n",
144 name, i);
145 else
146 pr_err("cm: Module associated with clock %s didn't enable in %d tries\n",
147 name, MAX_MODULE_ENABLE_WAIT);
148
149 return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
150};
151
152void __init omap2_set_globals_prcm(struct omap_globals *omap2_globals)
153{
154 if (omap2_globals->prm)
155 prm_base = omap2_globals->prm;
156 if (omap2_globals->cm)
157 cm_base = omap2_globals->cm;
158 if (omap2_globals->cm2)
159 cm2_base = omap2_globals->cm2;
160 if (omap2_globals->prcm_mpu)
161 prcm_mpu_base = omap2_globals->prcm_mpu;
162
163 if (cpu_is_omap44xx() || soc_is_omap54xx()) {
164 omap_prm_base_init();
165 omap_cm_base_init();
166 }
167}
168
169/*
170 * Stubbed functions so that common files continue to build when
171 * custom builds are used
172 * XXX These are temporary and should be removed at the earliest possible
173 * opportunity
174 */
175int __weak omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs,
176 u16 clkctrl_offs)
177{
178 return 0;
179}
180
181void __weak omap4_cminst_module_enable(u8 mode, u8 part, u16 inst,
182 s16 cdoffs, u16 clkctrl_offs)
183{
184}
185
186void __weak omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs,
187 u16 clkctrl_offs)
188{
189}
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.c b/arch/arm/mach-omap2/prcm_mpu44xx.c
index 928dbd4f20ed..c30e44a7fab0 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.c
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.c
@@ -20,6 +20,12 @@
20#include "prcm_mpu44xx.h" 20#include "prcm_mpu44xx.h"
21#include "cm-regbits-44xx.h" 21#include "cm-regbits-44xx.h"
22 22
23/*
24 * prcm_mpu_base: the virtual address of the start of the PRCM_MPU IP
25 * block registers
26 */
27void __iomem *prcm_mpu_base;
28
23/* PRCM_MPU low-level functions */ 29/* PRCM_MPU low-level functions */
24 30
25u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) 31u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg)
@@ -43,3 +49,14 @@ u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, s16 reg)
43 49
44 return v; 50 return v;
45} 51}
52
53/**
54 * omap2_set_globals_prcm_mpu - set the MPU PRCM base address (for early use)
55 * @prcm_mpu: PRCM_MPU base virtual address
56 *
57 * XXX Will be replaced when the PRM/CM drivers are completed.
58 */
59void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu)
60{
61 prcm_mpu_base = prcm_mpu;
62}
diff --git a/arch/arm/mach-omap2/prcm_mpu44xx.h b/arch/arm/mach-omap2/prcm_mpu44xx.h
index 8a6e250f04b5..884af7bb4afd 100644
--- a/arch/arm/mach-omap2/prcm_mpu44xx.h
+++ b/arch/arm/mach-omap2/prcm_mpu44xx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP44xx PRCM MPU instance offset macros 2 * OMAP44xx PRCM MPU instance offset macros
3 * 3 *
4 * Copyright (C) 2010 Texas Instruments, Inc. 4 * Copyright (C) 2010, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley (paul@pwsan.com) 7 * Paul Walmsley (paul@pwsan.com)
@@ -25,6 +25,12 @@
25#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 25#ifndef __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H 26#define __ARCH_ARM_MACH_OMAP2_PRCM_MPU44XX_H
27 27
28#include "common.h"
29
30# ifndef __ASSEMBLER__
31extern void __iomem *prcm_mpu_base;
32# endif
33
28#define OMAP4430_PRCM_MPU_BASE 0x48243000 34#define OMAP4430_PRCM_MPU_BASE 0x48243000
29 35
30#define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \ 36#define OMAP44XX_PRCM_MPU_REGADDR(inst, reg) \
@@ -98,6 +104,7 @@ extern u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 idx);
98extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx); 104extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx);
99extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, 105extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst,
100 s16 idx); 106 s16 idx);
107extern void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu);
101# endif 108# endif
102 109
103#endif 110#endif
diff --git a/arch/arm/mach-omap2/prm-regbits-24xx.h b/arch/arm/mach-omap2/prm-regbits-24xx.h
index 6ac966103f34..91aa5106d637 100644
--- a/arch/arm/mach-omap2/prm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-24xx.h
@@ -14,7 +14,7 @@
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16
17#include "prm2xxx_3xxx.h" 17#include "prm2xxx.h"
18 18
19/* Bits shared between registers */ 19/* Bits shared between registers */
20 20
@@ -107,12 +107,14 @@
107#define OMAP2420_CLKOUT2_EN_MASK (1 << 15) 107#define OMAP2420_CLKOUT2_EN_MASK (1 << 15)
108#define OMAP2420_CLKOUT2_DIV_SHIFT 11 108#define OMAP2420_CLKOUT2_DIV_SHIFT 11
109#define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11) 109#define OMAP2420_CLKOUT2_DIV_MASK (0x7 << 11)
110#define OMAP2420_CLKOUT2_DIV_WIDTH 3
110#define OMAP2420_CLKOUT2_SOURCE_SHIFT 8 111#define OMAP2420_CLKOUT2_SOURCE_SHIFT 8
111#define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8) 112#define OMAP2420_CLKOUT2_SOURCE_MASK (0x3 << 8)
112#define OMAP24XX_CLKOUT_EN_SHIFT 7 113#define OMAP24XX_CLKOUT_EN_SHIFT 7
113#define OMAP24XX_CLKOUT_EN_MASK (1 << 7) 114#define OMAP24XX_CLKOUT_EN_MASK (1 << 7)
114#define OMAP24XX_CLKOUT_DIV_SHIFT 3 115#define OMAP24XX_CLKOUT_DIV_SHIFT 3
115#define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3) 116#define OMAP24XX_CLKOUT_DIV_MASK (0x7 << 3)
117#define OMAP24XX_CLKOUT_DIV_WIDTH 3
116#define OMAP24XX_CLKOUT_SOURCE_SHIFT 0 118#define OMAP24XX_CLKOUT_SOURCE_SHIFT 0
117#define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0) 119#define OMAP24XX_CLKOUT_SOURCE_MASK (0x3 << 0)
118 120
@@ -209,9 +211,13 @@
209 211
210/* RM_RSTST_WKUP specific bits */ 212/* RM_RSTST_WKUP specific bits */
211/* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */ 213/* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */
214#define OMAP24XX_EXTWMPU_RST_SHIFT 6
212#define OMAP24XX_EXTWMPU_RST_MASK (1 << 6) 215#define OMAP24XX_EXTWMPU_RST_MASK (1 << 6)
216#define OMAP24XX_SECU_WD_RST_SHIFT 5
213#define OMAP24XX_SECU_WD_RST_MASK (1 << 5) 217#define OMAP24XX_SECU_WD_RST_MASK (1 << 5)
218#define OMAP24XX_MPU_WD_RST_SHIFT 4
214#define OMAP24XX_MPU_WD_RST_MASK (1 << 4) 219#define OMAP24XX_MPU_WD_RST_MASK (1 << 4)
220#define OMAP24XX_SECU_VIOL_RST_SHIFT 3
215#define OMAP24XX_SECU_VIOL_RST_MASK (1 << 3) 221#define OMAP24XX_SECU_VIOL_RST_MASK (1 << 3)
216 222
217/* PM_WKEN_WKUP specific bits */ 223/* PM_WKEN_WKUP specific bits */
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h
index 64c087af6a8b..b0a2142eeb91 100644
--- a/arch/arm/mach-omap2/prm-regbits-34xx.h
+++ b/arch/arm/mach-omap2/prm-regbits-34xx.h
@@ -14,7 +14,7 @@
14#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H 14#define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H
15 15
16 16
17#include "prm2xxx_3xxx.h" 17#include "prm3xxx.h"
18 18
19/* Shared register bits */ 19/* Shared register bits */
20 20
@@ -384,6 +384,7 @@
384/* PRM_CLKSEL */ 384/* PRM_CLKSEL */
385#define OMAP3430_SYS_CLKIN_SEL_SHIFT 0 385#define OMAP3430_SYS_CLKIN_SEL_SHIFT 0
386#define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0) 386#define OMAP3430_SYS_CLKIN_SEL_MASK (0x7 << 0)
387#define OMAP3430_SYS_CLKIN_SEL_WIDTH 3
387 388
388/* PRM_CLKOUT_CTRL */ 389/* PRM_CLKOUT_CTRL */
389#define OMAP3430_CLKOUT_EN_MASK (1 << 7) 390#define OMAP3430_CLKOUT_EN_MASK (1 << 7)
@@ -509,15 +510,25 @@
509#define OMAP3430_RSTTIME1_MASK (0xff << 0) 510#define OMAP3430_RSTTIME1_MASK (0xff << 0)
510 511
511/* PRM_RSTST */ 512/* PRM_RSTST */
513#define OMAP3430_ICECRUSHER_RST_SHIFT 10
512#define OMAP3430_ICECRUSHER_RST_MASK (1 << 10) 514#define OMAP3430_ICECRUSHER_RST_MASK (1 << 10)
515#define OMAP3430_ICEPICK_RST_SHIFT 9
513#define OMAP3430_ICEPICK_RST_MASK (1 << 9) 516#define OMAP3430_ICEPICK_RST_MASK (1 << 9)
517#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT 8
514#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK (1 << 8) 518#define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK (1 << 8)
519#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT 7
515#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK (1 << 7) 520#define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK (1 << 7)
521#define OMAP3430_EXTERNAL_WARM_RST_SHIFT 6
516#define OMAP3430_EXTERNAL_WARM_RST_MASK (1 << 6) 522#define OMAP3430_EXTERNAL_WARM_RST_MASK (1 << 6)
523#define OMAP3430_SECURE_WD_RST_SHIFT 5
517#define OMAP3430_SECURE_WD_RST_MASK (1 << 5) 524#define OMAP3430_SECURE_WD_RST_MASK (1 << 5)
525#define OMAP3430_MPU_WD_RST_SHIFT 4
518#define OMAP3430_MPU_WD_RST_MASK (1 << 4) 526#define OMAP3430_MPU_WD_RST_MASK (1 << 4)
527#define OMAP3430_SECURITY_VIOL_RST_SHIFT 3
519#define OMAP3430_SECURITY_VIOL_RST_MASK (1 << 3) 528#define OMAP3430_SECURITY_VIOL_RST_MASK (1 << 3)
529#define OMAP3430_GLOBAL_SW_RST_SHIFT 1
520#define OMAP3430_GLOBAL_SW_RST_MASK (1 << 1) 530#define OMAP3430_GLOBAL_SW_RST_MASK (1 << 1)
531#define OMAP3430_GLOBAL_COLD_RST_SHIFT 0
521#define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0) 532#define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0)
522 533
523/* PRM_VOLTCTRL */ 534/* PRM_VOLTCTRL */
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h
index 39d562169d18..ac25ae6667cf 100644
--- a/arch/arm/mach-omap2/prm.h
+++ b/arch/arm/mach-omap2/prm.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions 2 * OMAP2/3/4 Power/Reset Management (PRM) bitfield definitions
3 * 3 *
4 * Copyright (C) 2007-2009 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * 6 *
7 * Paul Walmsley 7 * Paul Walmsley
@@ -15,6 +15,28 @@
15 15
16#include "prcm-common.h" 16#include "prcm-common.h"
17 17
18# ifndef __ASSEMBLER__
19extern void __iomem *prm_base;
20extern void omap2_set_globals_prm(void __iomem *prm);
21# endif
22
23
24/*
25 * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP
26 * module to softreset
27 */
28#define MAX_MODULE_SOFTRESET_WAIT 10000
29
30/*
31 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
32 * submodule to exit hardreset
33 */
34#define MAX_MODULE_HARDRESET_WAIT 10000
35
36/*
37 * Register bitfields
38 */
39
18/* 40/*
19 * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP 41 * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP
20 * 42 *
@@ -52,5 +74,67 @@
52#define OMAP_POWERSTATE_SHIFT 0 74#define OMAP_POWERSTATE_SHIFT 0
53#define OMAP_POWERSTATE_MASK (0x3 << 0) 75#define OMAP_POWERSTATE_MASK (0x3 << 0)
54 76
77/*
78 * Standardized OMAP reset source bits
79 *
80 * To the extent these happen to match the hardware register bit
81 * shifts, it's purely coincidental. Used by omap-wdt.c.
82 * OMAP_UNKNOWN_RST_SRC_ID_SHIFT is a special value, used whenever
83 * there are any bits remaining in the global PRM_RSTST register that
84 * haven't been identified, or when the PRM code for the current SoC
85 * doesn't know how to interpret the register.
86 */
87#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0
88#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1
89#define OMAP_SECU_VIOL_RST_SRC_ID_SHIFT 2
90#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
91#define OMAP_SECU_WD_RST_SRC_ID_SHIFT 4
92#define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5
93#define OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT 6
94#define OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT 7
95#define OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT 8
96#define OMAP_ICEPICK_RST_SRC_ID_SHIFT 9
97#define OMAP_ICECRUSHER_RST_SRC_ID_SHIFT 10
98#define OMAP_C2C_RST_SRC_ID_SHIFT 11
99#define OMAP_UNKNOWN_RST_SRC_ID_SHIFT 12
100
101#ifndef __ASSEMBLER__
102
103/**
104 * struct prm_reset_src_map - map register bitshifts to standard bitshifts
105 * @reg_shift: bitshift in the PRM reset source register
106 * @std_shift: bitshift equivalent in the standard reset source list
107 *
108 * The fields are signed because -1 is used as a terminator.
109 */
110struct prm_reset_src_map {
111 s8 reg_shift;
112 s8 std_shift;
113};
114
115/**
116 * struct prm_ll_data - fn ptrs to per-SoC PRM function implementations
117 * @read_reset_sources: ptr to the SoC PRM-specific get_reset_source impl
118 * @was_any_context_lost_old: ptr to the SoC PRM context loss test fn
119 * @clear_context_loss_flags_old: ptr to the SoC PRM context loss flag clear fn
120 *
121 * XXX @was_any_context_lost_old and @clear_context_loss_flags_old are
122 * deprecated.
123 */
124struct prm_ll_data {
125 u32 (*read_reset_sources)(void);
126 bool (*was_any_context_lost_old)(u8 part, s16 inst, u16 idx);
127 void (*clear_context_loss_flags_old)(u8 part, s16 inst, u16 idx);
128};
129
130extern int prm_register(struct prm_ll_data *pld);
131extern int prm_unregister(struct prm_ll_data *pld);
132
133extern u32 prm_read_reset_sources(void);
134extern bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx);
135extern void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx);
136
137#endif
138
55 139
56#endif 140#endif
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
new file mode 100644
index 000000000000..faeab18696df
--- /dev/null
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -0,0 +1,138 @@
1/*
2 * OMAP2xxx PRM module functions
3 *
4 * Copyright (C) 2010-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson
7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/io.h>
19#include <linux/irq.h>
20
21#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h"
25#include "powerdomain.h"
26#include "clockdomain.h"
27#include "prm2xxx.h"
28#include "cm2xxx_3xxx.h"
29#include "prm-regbits-24xx.h"
30
31/*
32 * omap2xxx_prm_reset_src_map - map from bits in the PRM_RSTST_WKUP
33 * hardware register (which are specific to the OMAP2xxx SoCs) to
34 * reset source ID bit shifts (which is an OMAP SoC-independent
35 * enumeration)
36 */
37static struct prm_reset_src_map omap2xxx_prm_reset_src_map[] = {
38 { OMAP_GLOBALCOLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
39 { OMAP_GLOBALWARM_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
40 { OMAP24XX_SECU_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
41 { OMAP24XX_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
42 { OMAP24XX_SECU_WD_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
43 { OMAP24XX_EXTWMPU_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
44 { -1, -1 },
45};
46
47/**
48 * omap2xxx_prm_read_reset_sources - return the last SoC reset source
49 *
50 * Return a u32 representing the last reset sources of the SoC. The
51 * returned reset source bits are standardized across OMAP SoCs.
52 */
53static u32 omap2xxx_prm_read_reset_sources(void)
54{
55 struct prm_reset_src_map *p;
56 u32 r = 0;
57 u32 v;
58
59 v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST);
60
61 p = omap2xxx_prm_reset_src_map;
62 while (p->reg_shift >= 0 && p->std_shift >= 0) {
63 if (v & (1 << p->reg_shift))
64 r |= 1 << p->std_shift;
65 p++;
66 }
67
68 return r;
69}
70
71/**
72 * omap2xxx_prm_dpll_reset - use DPLL reset to reboot the OMAP SoC
73 *
74 * Set the DPLL reset bit, which should reboot the SoC. This is the
75 * recommended way to restart the SoC. No return value.
76 */
77void omap2xxx_prm_dpll_reset(void)
78{
79 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, WKUP_MOD,
80 OMAP2_RM_RSTCTRL);
81 /* OCP barrier */
82 omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTCTRL);
83}
84
85int omap2xxx_clkdm_sleep(struct clockdomain *clkdm)
86{
87 omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
88 clkdm->pwrdm.ptr->prcm_offs,
89 OMAP2_PM_PWSTCTRL);
90 return 0;
91}
92
93int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm)
94{
95 omap2_prm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
96 clkdm->pwrdm.ptr->prcm_offs,
97 OMAP2_PM_PWSTCTRL);
98 return 0;
99}
100
101struct pwrdm_ops omap2_pwrdm_operations = {
102 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
103 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
104 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
105 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
106 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
107 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
108 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
109 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
110 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
111};
112
113/*
114 *
115 */
116
117static struct prm_ll_data omap2xxx_prm_ll_data = {
118 .read_reset_sources = &omap2xxx_prm_read_reset_sources,
119};
120
121int __init omap2xxx_prm_init(void)
122{
123 if (!cpu_is_omap24xx())
124 return 0;
125
126 return prm_register(&omap2xxx_prm_ll_data);
127}
128
129static void __exit omap2xxx_prm_exit(void)
130{
131 if (!cpu_is_omap24xx())
132 return;
133
134 /* Should never happen */
135 WARN(prm_unregister(&omap2xxx_prm_ll_data),
136 "%s: prm_ll_data function pointer mismatch\n", __func__);
137}
138__exitcall(omap2xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
new file mode 100644
index 000000000000..3194dd87e0e4
--- /dev/null
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -0,0 +1,133 @@
1/*
2 * OMAP2xxx Power/Reset Management (PRM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * The PRM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The PRM on OMAP4 has a new register layout, and is handled
14 * in a separate file.
15 */
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM2XXX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM2XXX_H
18
19#include "prcm-common.h"
20#include "prm.h"
21#include "prm2xxx_3xxx.h"
22
23#define OMAP2420_PRM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
25#define OMAP2430_PRM_REGADDR(module, reg) \
26 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
27
28/*
29 * OMAP2-specific global PRM registers
30 * Use __raw_{read,write}l() with these registers.
31 *
32 * With a few exceptions, these are the register names beginning with
33 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE
34 * bits.)
35 *
36 */
37
38#define OMAP2_PRCM_REVISION_OFFSET 0x0000
39#define OMAP2420_PRCM_REVISION OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000)
40#define OMAP2_PRCM_SYSCONFIG_OFFSET 0x0010
41#define OMAP2420_PRCM_SYSCONFIG OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010)
42
43#define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET 0x0018
44#define OMAP2420_PRCM_IRQSTATUS_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018)
45#define OMAP2_PRCM_IRQENABLE_MPU_OFFSET 0x001c
46#define OMAP2420_PRCM_IRQENABLE_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c)
47
48#define OMAP2_PRCM_VOLTCTRL_OFFSET 0x0050
49#define OMAP2420_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050)
50#define OMAP2_PRCM_VOLTST_OFFSET 0x0054
51#define OMAP2420_PRCM_VOLTST OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054)
52#define OMAP2_PRCM_CLKSRC_CTRL_OFFSET 0x0060
53#define OMAP2420_PRCM_CLKSRC_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060)
54#define OMAP2_PRCM_CLKOUT_CTRL_OFFSET 0x0070
55#define OMAP2420_PRCM_CLKOUT_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070)
56#define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078
57#define OMAP2420_PRCM_CLKEMUL_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078)
58#define OMAP2_PRCM_CLKCFG_CTRL_OFFSET 0x0080
59#define OMAP2420_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080)
60#define OMAP2_PRCM_CLKCFG_STATUS_OFFSET 0x0084
61#define OMAP2420_PRCM_CLKCFG_STATUS OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084)
62#define OMAP2_PRCM_VOLTSETUP_OFFSET 0x0090
63#define OMAP2420_PRCM_VOLTSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090)
64#define OMAP2_PRCM_CLKSSETUP_OFFSET 0x0094
65#define OMAP2420_PRCM_CLKSSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094)
66#define OMAP2_PRCM_POLCTRL_OFFSET 0x0098
67#define OMAP2420_PRCM_POLCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098)
68
69#define OMAP2430_PRCM_REVISION OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000)
70#define OMAP2430_PRCM_SYSCONFIG OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010)
71
72#define OMAP2430_PRCM_IRQSTATUS_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018)
73#define OMAP2430_PRCM_IRQENABLE_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c)
74
75#define OMAP2430_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050)
76#define OMAP2430_PRCM_VOLTST OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054)
77#define OMAP2430_PRCM_CLKSRC_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060)
78#define OMAP2430_PRCM_CLKOUT_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070)
79#define OMAP2430_PRCM_CLKEMUL_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078)
80#define OMAP2430_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080)
81#define OMAP2430_PRCM_CLKCFG_STATUS OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084)
82#define OMAP2430_PRCM_VOLTSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090)
83#define OMAP2430_PRCM_CLKSSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094)
84#define OMAP2430_PRCM_POLCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098)
85
86/*
87 * Module specific PRM register offsets from PRM_BASE + domain offset
88 *
89 * Use prm_{read,write}_mod_reg() with these registers.
90 *
91 * With a few exceptions, these are the register names beginning with
92 * {PM,RM}_* on both OMAP2/3 SoC families.. (The exceptions are the
93 * IRQSTATUS and IRQENABLE bits.)
94 */
95
96/* Register offsets appearing on both OMAP2 and OMAP3 */
97
98#define OMAP2_RM_RSTCTRL 0x0050
99#define OMAP2_RM_RSTTIME 0x0054
100#define OMAP2_RM_RSTST 0x0058
101#define OMAP2_PM_PWSTCTRL 0x00e0
102#define OMAP2_PM_PWSTST 0x00e4
103
104#define PM_WKEN 0x00a0
105#define PM_WKEN1 PM_WKEN
106#define PM_WKST 0x00b0
107#define PM_WKST1 PM_WKST
108#define PM_WKDEP 0x00c8
109#define PM_EVGENCTRL 0x00d4
110#define PM_EVGENONTIM 0x00d8
111#define PM_EVGENOFFTIM 0x00dc
112
113/* OMAP2xxx specific register offsets */
114#define OMAP24XX_PM_WKEN2 0x00a4
115#define OMAP24XX_PM_WKST2 0x00b4
116
117#define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */
118#define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */
119#define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8
120#define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc
121
122#ifndef __ASSEMBLER__
123/* Function prototypes */
124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm);
125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm);
126
127extern void omap2xxx_prm_dpll_reset(void);
128
129extern int __init omap2xxx_prm_init(void);
130
131#endif
132
133#endif
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c
index 9529984d8d2b..30517f5af707 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c
@@ -15,82 +15,12 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/io.h> 17#include <linux/io.h>
18#include <linux/irq.h>
19 18
20#include <plat/prcm.h>
21
22#include "soc.h"
23#include "common.h" 19#include "common.h"
24#include "vp.h" 20#include "powerdomain.h"
25
26#include "prm2xxx_3xxx.h" 21#include "prm2xxx_3xxx.h"
27#include "cm2xxx_3xxx.h"
28#include "prm-regbits-24xx.h" 22#include "prm-regbits-24xx.h"
29#include "prm-regbits-34xx.h" 23#include "clockdomain.h"
30
31static const struct omap_prcm_irq omap3_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0),
33 OMAP_PRCM_IRQ("io", 9, 1),
34};
35
36static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
37 .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
38 .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
39 .nr_regs = 1,
40 .irqs = omap3_prcm_irqs,
41 .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs),
42 .irq = 11 + OMAP_INTC_START,
43 .read_pending_irqs = &omap3xxx_prm_read_pending_irqs,
44 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
45 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
46 .restore_irqen = &omap3xxx_prm_restore_irqen,
47};
48
49u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
50{
51 return __raw_readl(prm_base + module + idx);
52}
53
54void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
55{
56 __raw_writel(val, prm_base + module + idx);
57}
58
59/* Read-modify-write a register in a PRM module. Caller must lock */
60u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)
61{
62 u32 v;
63
64 v = omap2_prm_read_mod_reg(module, idx);
65 v &= ~mask;
66 v |= bits;
67 omap2_prm_write_mod_reg(v, module, idx);
68
69 return v;
70}
71
72/* Read a PRM register, AND it, and shift the result down to bit 0 */
73u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
74{
75 u32 v;
76
77 v = omap2_prm_read_mod_reg(domain, idx);
78 v &= mask;
79 v >>= __ffs(mask);
80
81 return v;
82}
83
84u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
85{
86 return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
87}
88
89u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
90{
91 return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
92}
93
94 24
95/** 25/**
96 * omap2_prm_is_hardreset_asserted - read the HW reset line state of 26 * omap2_prm_is_hardreset_asserted - read the HW reset line state of
@@ -104,9 +34,6 @@ u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
104 */ 34 */
105int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) 35int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift)
106{ 36{
107 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
108 return -EINVAL;
109
110 return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, 37 return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL,
111 (1 << shift)); 38 (1 << shift));
112} 39}
@@ -127,9 +54,6 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift)
127{ 54{
128 u32 mask; 55 u32 mask;
129 56
130 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
131 return -EINVAL;
132
133 mask = 1 << shift; 57 mask = 1 << shift;
134 omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL); 58 omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL);
135 59
@@ -156,9 +80,6 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
156 u32 rst, st; 80 u32 rst, st;
157 int c; 81 int c;
158 82
159 if (!(cpu_is_omap24xx() || cpu_is_omap34xx()))
160 return -EINVAL;
161
162 rst = 1 << rst_shift; 83 rst = 1 << rst_shift;
163 st = 1 << st_shift; 84 st = 1 << st_shift;
164 85
@@ -178,188 +99,155 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift)
178 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; 99 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
179} 100}
180 101
181/* PRM VP */
182
183/*
184 * struct omap3_vp - OMAP3 VP register access description.
185 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
186 */
187struct omap3_vp {
188 u32 tranxdone_status;
189};
190
191static struct omap3_vp omap3_vp[] = {
192 [OMAP3_VP_VDD_MPU_ID] = {
193 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
194 },
195 [OMAP3_VP_VDD_CORE_ID] = {
196 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
197 },
198};
199
200#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
201
202u32 omap3_prm_vp_check_txdone(u8 vp_id)
203{
204 struct omap3_vp *vp = &omap3_vp[vp_id];
205 u32 irqstatus;
206 102
207 irqstatus = omap2_prm_read_mod_reg(OCP_MOD, 103/* Powerdomain low-level functions */
208 OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
209 return irqstatus & vp->tranxdone_status;
210}
211 104
212void omap3_prm_vp_clear_txdone(u8 vp_id) 105/* Common functions across OMAP2 and OMAP3 */
106int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
213{ 107{
214 struct omap3_vp *vp = &omap3_vp[vp_id]; 108 omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK,
215 109 (pwrst << OMAP_POWERSTATE_SHIFT),
216 omap2_prm_write_mod_reg(vp->tranxdone_status, 110 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
217 OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); 111 return 0;
218} 112}
219 113
220u32 omap3_prm_vcvp_read(u8 offset) 114int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
221{ 115{
222 return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset); 116 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
117 OMAP2_PM_PWSTCTRL,
118 OMAP_POWERSTATE_MASK);
223} 119}
224 120
225void omap3_prm_vcvp_write(u32 val, u8 offset) 121int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm)
226{ 122{
227 omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset); 123 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
124 OMAP2_PM_PWSTST,
125 OMAP_POWERSTATEST_MASK);
228} 126}
229 127
230u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset) 128int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
129 u8 pwrst)
231{ 130{
232 return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset); 131 u32 m;
132
133 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
134
135 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
136 OMAP2_PM_PWSTCTRL);
137
138 return 0;
233} 139}
234 140
235/** 141int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
236 * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events 142 u8 pwrst)
237 * @events: ptr to a u32, preallocated by caller
238 *
239 * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM
240 * MPU IRQs, and store the result into the u32 pointed to by @events.
241 * No return value.
242 */
243void omap3xxx_prm_read_pending_irqs(unsigned long *events)
244{ 143{
245 u32 mask, st; 144 u32 m;
145
146 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
246 147
247 /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */ 148 omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs,
248 mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); 149 OMAP2_PM_PWSTCTRL);
249 st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
250 150
251 events[0] = mask & st; 151 return 0;
252} 152}
253 153
254/** 154int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
255 * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete
256 *
257 * Force any buffered writes to the PRM IP block to complete. Needed
258 * by the PRM IRQ handler, which reads and writes directly to the IP
259 * block, to avoid race conditions after acknowledging or clearing IRQ
260 * bits. No return value.
261 */
262void omap3xxx_prm_ocp_barrier(void)
263{ 155{
264 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); 156 u32 m;
157
158 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
159
160 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST,
161 m);
265} 162}
266 163
267/** 164int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
268 * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg
269 * @saved_mask: ptr to a u32 array to save IRQENABLE bits
270 *
271 * Save the PRM_IRQENABLE_MPU register to @saved_mask. @saved_mask
272 * must be allocated by the caller. Intended to be used in the PRM
273 * interrupt handler suspend callback. The OCP barrier is needed to
274 * ensure the write to disable PRM interrupts reaches the PRM before
275 * returning; otherwise, spurious interrupts might occur. No return
276 * value.
277 */
278void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
279{ 165{
280 saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD, 166 u32 m;
281 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 167
282 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); 168 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
283 169
284 /* OCP barrier */ 170 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
285 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); 171 OMAP2_PM_PWSTCTRL, m);
286} 172}
287 173
288/** 174int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
289 * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args
290 * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously
291 *
292 * Restore the PRM_IRQENABLE_MPU register from @saved_mask. Intended
293 * to be used in the PRM interrupt handler resume callback to restore
294 * values saved by omap3xxx_prm_save_and_clear_irqen(). No OCP
295 * barrier should be needed here; any pending PRM interrupts will fire
296 * once the writes reach the PRM. No return value.
297 */
298void omap3xxx_prm_restore_irqen(u32 *saved_mask)
299{ 175{
300 omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD, 176 u32 v;
301 OMAP3_PRM_IRQENABLE_MPU_OFFSET); 177
178 v = pwrst << __ffs(OMAP_LOGICRETSTATE_MASK);
179 omap2_prm_rmw_mod_reg_bits(OMAP_LOGICRETSTATE_MASK, v, pwrdm->prcm_offs,
180 OMAP2_PM_PWSTCTRL);
181
182 return 0;
302} 183}
303 184
304/** 185int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm)
305 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
306 *
307 * Clear any previously-latched I/O wakeup events and ensure that the
308 * I/O wakeup gates are aligned with the current mux settings. Works
309 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
310 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
311 * return value.
312 */
313void omap3xxx_prm_reconfigure_io_chain(void)
314{ 186{
315 int i = 0; 187 u32 c = 0;
316 188
317 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, 189 /*
318 PM_WKEN); 190 * REVISIT: pwrdm_wait_transition() may be better implemented
191 * via a callback and a periodic timer check -- how long do we expect
192 * powerdomain transitions to take?
193 */
319 194
320 omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) & 195 /* XXX Is this udelay() value meaningful? */
321 OMAP3430_ST_IO_CHAIN_MASK, 196 while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) &
322 MAX_IOPAD_LATCH_TIME, i); 197 OMAP_INTRANSITION_MASK) &&
323 if (i == MAX_IOPAD_LATCH_TIME) 198 (c++ < PWRDM_TRANSITION_BAILOUT))
324 pr_warn("PRM: I/O chain clock line assertion timed out\n"); 199 udelay(1);
325 200
326 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, 201 if (c > PWRDM_TRANSITION_BAILOUT) {
327 PM_WKEN); 202 pr_err("powerdomain: %s: waited too long to complete transition\n",
203 pwrdm->name);
204 return -EAGAIN;
205 }
328 206
329 omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD, 207 pr_debug("powerdomain: completed transition in %d loops\n", c);
330 PM_WKST);
331 208
332 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST); 209 return 0;
333} 210}
334 211
335/** 212int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
336 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches 213 struct clockdomain *clkdm2)
337 * 214{
338 * Activates the I/O wakeup event latches and allows events logged by 215 omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit),
339 * those latches to signal a wakeup event to the PRCM. For I/O 216 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
340 * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux 217 return 0;
341 * registers, and omap3xxx_prm_reconfigure_io_chain() must be called. 218}
342 * No return value. 219
343 */ 220int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
344static void __init omap3xxx_prm_enable_io_wakeup(void) 221 struct clockdomain *clkdm2)
222{
223 omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit),
224 clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP);
225 return 0;
226}
227
228int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
229 struct clockdomain *clkdm2)
345{ 230{
346 if (omap3_has_io_wakeup()) 231 return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs,
347 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, 232 PM_WKDEP, (1 << clkdm2->dep_bit));
348 PM_WKEN);
349} 233}
350 234
351static int __init omap3xxx_prcm_init(void) 235int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm)
352{ 236{
353 int ret = 0; 237 struct clkdm_dep *cd;
354 238 u32 mask = 0;
355 if (cpu_is_omap34xx()) { 239
356 omap3xxx_prm_enable_io_wakeup(); 240 for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) {
357 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); 241 if (!cd->clkdm)
358 if (!ret) 242 continue; /* only happens if data is erroneous */
359 irq_set_status_flags(omap_prcm_event_to_irq("io"), 243
360 IRQ_NOAUTOEN); 244 /* PRM accesses are slow, so minimize them */
245 mask |= 1 << cd->clkdm->dep_bit;
246 atomic_set(&cd->wkdep_usecount, 0);
361 } 247 }
362 248
363 return ret; 249 omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs,
250 PM_WKDEP);
251 return 0;
364} 252}
365subsys_initcall(omap3xxx_prcm_init); 253
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index c19d249b4816..9624b40836d4 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2/3 Power/Reset Management (PRM) register definitions 2 * OMAP2xxx/3xxx-common Power/Reset Management (PRM) register definitions
3 * 3 *
4 * Copyright (C) 2007-2009, 2011 Texas Instruments, Inc. 4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation 5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley 6 * Paul Walmsley
7 * 7 *
@@ -19,160 +19,6 @@
19#include "prcm-common.h" 19#include "prcm-common.h"
20#include "prm.h" 20#include "prm.h"
21 21
22#define OMAP2420_PRM_REGADDR(module, reg) \
23 OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg))
24#define OMAP2430_PRM_REGADDR(module, reg) \
25 OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg))
26#define OMAP34XX_PRM_REGADDR(module, reg) \
27 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
28
29
30/*
31 * OMAP2-specific global PRM registers
32 * Use __raw_{read,write}l() with these registers.
33 *
34 * With a few exceptions, these are the register names beginning with
35 * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE
36 * bits.)
37 *
38 */
39
40#define OMAP2_PRCM_REVISION_OFFSET 0x0000
41#define OMAP2420_PRCM_REVISION OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000)
42#define OMAP2_PRCM_SYSCONFIG_OFFSET 0x0010
43#define OMAP2420_PRCM_SYSCONFIG OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010)
44
45#define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET 0x0018
46#define OMAP2420_PRCM_IRQSTATUS_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018)
47#define OMAP2_PRCM_IRQENABLE_MPU_OFFSET 0x001c
48#define OMAP2420_PRCM_IRQENABLE_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c)
49
50#define OMAP2_PRCM_VOLTCTRL_OFFSET 0x0050
51#define OMAP2420_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050)
52#define OMAP2_PRCM_VOLTST_OFFSET 0x0054
53#define OMAP2420_PRCM_VOLTST OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054)
54#define OMAP2_PRCM_CLKSRC_CTRL_OFFSET 0x0060
55#define OMAP2420_PRCM_CLKSRC_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060)
56#define OMAP2_PRCM_CLKOUT_CTRL_OFFSET 0x0070
57#define OMAP2420_PRCM_CLKOUT_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070)
58#define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078
59#define OMAP2420_PRCM_CLKEMUL_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078)
60#define OMAP2_PRCM_CLKCFG_CTRL_OFFSET 0x0080
61#define OMAP2420_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080)
62#define OMAP2_PRCM_CLKCFG_STATUS_OFFSET 0x0084
63#define OMAP2420_PRCM_CLKCFG_STATUS OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084)
64#define OMAP2_PRCM_VOLTSETUP_OFFSET 0x0090
65#define OMAP2420_PRCM_VOLTSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090)
66#define OMAP2_PRCM_CLKSSETUP_OFFSET 0x0094
67#define OMAP2420_PRCM_CLKSSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094)
68#define OMAP2_PRCM_POLCTRL_OFFSET 0x0098
69#define OMAP2420_PRCM_POLCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098)
70
71#define OMAP2430_PRCM_REVISION OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000)
72#define OMAP2430_PRCM_SYSCONFIG OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010)
73
74#define OMAP2430_PRCM_IRQSTATUS_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018)
75#define OMAP2430_PRCM_IRQENABLE_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c)
76
77#define OMAP2430_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050)
78#define OMAP2430_PRCM_VOLTST OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054)
79#define OMAP2430_PRCM_CLKSRC_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060)
80#define OMAP2430_PRCM_CLKOUT_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070)
81#define OMAP2430_PRCM_CLKEMUL_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078)
82#define OMAP2430_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080)
83#define OMAP2430_PRCM_CLKCFG_STATUS OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084)
84#define OMAP2430_PRCM_VOLTSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090)
85#define OMAP2430_PRCM_CLKSSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094)
86#define OMAP2430_PRCM_POLCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098)
87
88/*
89 * OMAP3-specific global PRM registers
90 * Use __raw_{read,write}l() with these registers.
91 *
92 * With a few exceptions, these are the register names beginning with
93 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE
94 * bits.)
95 */
96
97#define OMAP3_PRM_REVISION_OFFSET 0x0004
98#define OMAP3430_PRM_REVISION OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004)
99#define OMAP3_PRM_SYSCONFIG_OFFSET 0x0014
100#define OMAP3430_PRM_SYSCONFIG OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014)
101
102#define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018
103#define OMAP3430_PRM_IRQSTATUS_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018)
104#define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c
105#define OMAP3430_PRM_IRQENABLE_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c)
106
107
108#define OMAP3_PRM_VC_SMPS_SA_OFFSET 0x0020
109#define OMAP3430_PRM_VC_SMPS_SA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020)
110#define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET 0x0024
111#define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024)
112#define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET 0x0028
113#define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028)
114#define OMAP3_PRM_VC_CMD_VAL_0_OFFSET 0x002c
115#define OMAP3430_PRM_VC_CMD_VAL_0 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c)
116#define OMAP3_PRM_VC_CMD_VAL_1_OFFSET 0x0030
117#define OMAP3430_PRM_VC_CMD_VAL_1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030)
118#define OMAP3_PRM_VC_CH_CONF_OFFSET 0x0034
119#define OMAP3430_PRM_VC_CH_CONF OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034)
120#define OMAP3_PRM_VC_I2C_CFG_OFFSET 0x0038
121#define OMAP3430_PRM_VC_I2C_CFG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038)
122#define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c
123#define OMAP3430_PRM_VC_BYPASS_VAL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c)
124#define OMAP3_PRM_RSTCTRL_OFFSET 0x0050
125#define OMAP3430_PRM_RSTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050)
126#define OMAP3_PRM_RSTTIME_OFFSET 0x0054
127#define OMAP3430_PRM_RSTTIME OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054)
128#define OMAP3_PRM_RSTST_OFFSET 0x0058
129#define OMAP3430_PRM_RSTST OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058)
130#define OMAP3_PRM_VOLTCTRL_OFFSET 0x0060
131#define OMAP3430_PRM_VOLTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060)
132#define OMAP3_PRM_SRAM_PCHARGE_OFFSET 0x0064
133#define OMAP3430_PRM_SRAM_PCHARGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064)
134#define OMAP3_PRM_CLKSRC_CTRL_OFFSET 0x0070
135#define OMAP3430_PRM_CLKSRC_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070)
136#define OMAP3_PRM_VOLTSETUP1_OFFSET 0x0090
137#define OMAP3430_PRM_VOLTSETUP1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090)
138#define OMAP3_PRM_VOLTOFFSET_OFFSET 0x0094
139#define OMAP3430_PRM_VOLTOFFSET OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094)
140#define OMAP3_PRM_CLKSETUP_OFFSET 0x0098
141#define OMAP3430_PRM_CLKSETUP OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098)
142#define OMAP3_PRM_POLCTRL_OFFSET 0x009c
143#define OMAP3430_PRM_POLCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c)
144#define OMAP3_PRM_VOLTSETUP2_OFFSET 0x00a0
145#define OMAP3430_PRM_VOLTSETUP2 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0)
146#define OMAP3_PRM_VP1_CONFIG_OFFSET 0x00b0
147#define OMAP3430_PRM_VP1_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0)
148#define OMAP3_PRM_VP1_VSTEPMIN_OFFSET 0x00b4
149#define OMAP3430_PRM_VP1_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4)
150#define OMAP3_PRM_VP1_VSTEPMAX_OFFSET 0x00b8
151#define OMAP3430_PRM_VP1_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8)
152#define OMAP3_PRM_VP1_VLIMITTO_OFFSET 0x00bc
153#define OMAP3430_PRM_VP1_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc)
154#define OMAP3_PRM_VP1_VOLTAGE_OFFSET 0x00c0
155#define OMAP3430_PRM_VP1_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0)
156#define OMAP3_PRM_VP1_STATUS_OFFSET 0x00c4
157#define OMAP3430_PRM_VP1_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4)
158#define OMAP3_PRM_VP2_CONFIG_OFFSET 0x00d0
159#define OMAP3430_PRM_VP2_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0)
160#define OMAP3_PRM_VP2_VSTEPMIN_OFFSET 0x00d4
161#define OMAP3430_PRM_VP2_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4)
162#define OMAP3_PRM_VP2_VSTEPMAX_OFFSET 0x00d8
163#define OMAP3430_PRM_VP2_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8)
164#define OMAP3_PRM_VP2_VLIMITTO_OFFSET 0x00dc
165#define OMAP3430_PRM_VP2_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc)
166#define OMAP3_PRM_VP2_VOLTAGE_OFFSET 0x00e0
167#define OMAP3430_PRM_VP2_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
168#define OMAP3_PRM_VP2_STATUS_OFFSET 0x00e4
169#define OMAP3430_PRM_VP2_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
170
171#define OMAP3_PRM_CLKSEL_OFFSET 0x0040
172#define OMAP3430_PRM_CLKSEL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
173#define OMAP3_PRM_CLKOUT_CTRL_OFFSET 0x0070
174#define OMAP3430_PRM_CLKOUT_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
175
176/* 22/*
177 * Module specific PRM register offsets from PRM_BASE + domain offset 23 * Module specific PRM register offsets from PRM_BASE + domain offset
178 * 24 *
@@ -200,66 +46,83 @@
200#define PM_EVGENONTIM 0x00d8 46#define PM_EVGENONTIM 0x00d8
201#define PM_EVGENOFFTIM 0x00dc 47#define PM_EVGENOFFTIM 0x00dc
202 48
203/* OMAP2xxx specific register offsets */
204#define OMAP24XX_PM_WKEN2 0x00a4
205#define OMAP24XX_PM_WKST2 0x00b4
206
207#define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */
208#define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */
209#define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8
210#define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc
211 49
212/* OMAP3 specific register offsets */ 50#ifndef __ASSEMBLER__
213#define OMAP3430ES2_PM_WKEN3 0x00f0
214#define OMAP3430ES2_PM_WKST3 0x00b8
215
216#define OMAP3430_PM_MPUGRPSEL 0x00a4
217#define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL
218#define OMAP3430ES2_PM_MPUGRPSEL3 0x00f8
219
220#define OMAP3430_PM_IVAGRPSEL 0x00a8
221#define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL
222#define OMAP3430ES2_PM_IVAGRPSEL3 0x00f4
223
224#define OMAP3430_PM_PREPWSTST 0x00e8
225
226#define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8
227#define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc
228 51
52#include <linux/io.h>
53#include "powerdomain.h"
229 54
230#ifndef __ASSEMBLER__
231/* Power/reset management domain register get/set */ 55/* Power/reset management domain register get/set */
232extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx); 56static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx)
233extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx); 57{
234extern u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); 58 return __raw_readl(prm_base + module + idx);
235extern u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx); 59}
236extern u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx); 60
237extern u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask); 61static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx)
62{
63 __raw_writel(val, prm_base + module + idx);
64}
65
66/* Read-modify-write a register in a PRM module. Caller must lock */
67static inline u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module,
68 s16 idx)
69{
70 u32 v;
71
72 v = omap2_prm_read_mod_reg(module, idx);
73 v &= ~mask;
74 v |= bits;
75 omap2_prm_write_mod_reg(v, module, idx);
76
77 return v;
78}
79
80/* Read a PRM register, AND it, and shift the result down to bit 0 */
81static inline u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask)
82{
83 u32 v;
84
85 v = omap2_prm_read_mod_reg(domain, idx);
86 v &= mask;
87 v >>= __ffs(mask);
88
89 return v;
90}
91
92static inline u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx)
93{
94 return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx);
95}
96
97static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
98{
99 return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx);
100}
238 101
239/* These omap2_ PRM functions apply to both OMAP2 and 3 */ 102/* These omap2_ PRM functions apply to both OMAP2 and 3 */
240extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); 103extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift);
241extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); 104extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift);
242extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); 105extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift);
243 106
244/* OMAP3-specific VP functions */ 107extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst);
245u32 omap3_prm_vp_check_txdone(u8 vp_id); 108extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm);
246void omap3_prm_vp_clear_txdone(u8 vp_id); 109extern int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm);
247 110extern int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
248/* 111 u8 pwrst);
249 * OMAP3 access functions for voltage controller (VC) and 112extern int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
250 * voltage proccessor (VP) in the PRM. 113 u8 pwrst);
251 */ 114extern int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank);
252extern u32 omap3_prm_vcvp_read(u8 offset); 115extern int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank);
253extern void omap3_prm_vcvp_write(u32 val, u8 offset); 116extern int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst);
254extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); 117extern int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm);
255 118
256extern void omap3xxx_prm_reconfigure_io_chain(void); 119extern int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1,
257 120 struct clockdomain *clkdm2);
258/* PRM interrupt-related functions */ 121extern int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1,
259extern void omap3xxx_prm_read_pending_irqs(unsigned long *events); 122 struct clockdomain *clkdm2);
260extern void omap3xxx_prm_ocp_barrier(void); 123extern int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1,
261extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask); 124 struct clockdomain *clkdm2);
262extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); 125extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
263 126
264#endif /* __ASSEMBLER */ 127#endif /* __ASSEMBLER */
265 128
@@ -289,6 +152,7 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
289/* Named PRCM_CLKSRC_CTRL on the 24XX */ 152/* Named PRCM_CLKSRC_CTRL on the 24XX */
290#define OMAP_SYSCLKDIV_SHIFT 6 153#define OMAP_SYSCLKDIV_SHIFT 6
291#define OMAP_SYSCLKDIV_MASK (0x3 << 6) 154#define OMAP_SYSCLKDIV_MASK (0x3 << 6)
155#define OMAP_SYSCLKDIV_WIDTH 2
292#define OMAP_AUTOEXTCLKMODE_SHIFT 3 156#define OMAP_AUTOEXTCLKMODE_SHIFT 3
293#define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3) 157#define OMAP_AUTOEXTCLKMODE_MASK (0x3 << 3)
294#define OMAP_SYSCLKSEL_SHIFT 0 158#define OMAP_SYSCLKSEL_SHIFT 0
@@ -348,7 +212,9 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
348 * 212 *
349 * 3430: RM_RSTST_CORE, RM_RSTST_EMU 213 * 3430: RM_RSTST_CORE, RM_RSTST_EMU
350 */ 214 */
215#define OMAP_GLOBALWARM_RST_SHIFT 1
351#define OMAP_GLOBALWARM_RST_MASK (1 << 1) 216#define OMAP_GLOBALWARM_RST_MASK (1 << 1)
217#define OMAP_GLOBALCOLD_RST_SHIFT 0
352#define OMAP_GLOBALCOLD_RST_MASK (1 << 0) 218#define OMAP_GLOBALCOLD_RST_MASK (1 << 0)
353 219
354/* 220/*
@@ -376,11 +242,4 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
376#define OMAP_LOGICRETSTATE_MASK (1 << 2) 242#define OMAP_LOGICRETSTATE_MASK (1 << 2)
377 243
378 244
379/*
380 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
381 * submodule to exit hardreset
382 */
383#define MAX_MODULE_HARDRESET_WAIT 10000
384
385
386#endif 245#endif
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c
index 0d8abb577669..1ac73883f891 100644
--- a/arch/arm/mach-omap2/prm33xx.c
+++ b/arch/arm/mach-omap2/prm33xx.c
@@ -20,6 +20,7 @@
20#include <linux/io.h> 20#include <linux/io.h>
21 21
22#include "common.h" 22#include "common.h"
23#include "powerdomain.h"
23#include "prm33xx.h" 24#include "prm33xx.h"
24#include "prm-regbits-33xx.h" 25#include "prm-regbits-33xx.h"
25 26
@@ -131,3 +132,204 @@ int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
131 132
132 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; 133 return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
133} 134}
135
136static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
137{
138 am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK,
139 (pwrst << OMAP_POWERSTATE_SHIFT),
140 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
141 return 0;
142}
143
144static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
145{
146 u32 v;
147
148 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
149 v &= OMAP_POWERSTATE_MASK;
150 v >>= OMAP_POWERSTATE_SHIFT;
151
152 return v;
153}
154
155static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm)
156{
157 u32 v;
158
159 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
160 v &= OMAP_POWERSTATEST_MASK;
161 v >>= OMAP_POWERSTATEST_SHIFT;
162
163 return v;
164}
165
166static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
167{
168 u32 v;
169
170 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
171 v &= AM33XX_LASTPOWERSTATEENTERED_MASK;
172 v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT;
173
174 return v;
175}
176
177static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
178{
179 am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK,
180 (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT),
181 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
182 return 0;
183}
184
185static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
186{
187 am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK,
188 AM33XX_LASTPOWERSTATEENTERED_MASK,
189 pwrdm->prcm_offs, pwrdm->pwrstst_offs);
190 return 0;
191}
192
193static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
194{
195 u32 m;
196
197 m = pwrdm->logicretstate_mask;
198 if (!m)
199 return -EINVAL;
200
201 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
202 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
203
204 return 0;
205}
206
207static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
208{
209 u32 v;
210
211 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
212 v &= AM33XX_LOGICSTATEST_MASK;
213 v >>= AM33XX_LOGICSTATEST_SHIFT;
214
215 return v;
216}
217
218static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
219{
220 u32 v, m;
221
222 m = pwrdm->logicretstate_mask;
223 if (!m)
224 return -EINVAL;
225
226 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
227 v &= m;
228 v >>= __ffs(m);
229
230 return v;
231}
232
233static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
234 u8 pwrst)
235{
236 u32 m;
237
238 m = pwrdm->mem_on_mask[bank];
239 if (!m)
240 return -EINVAL;
241
242 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
243 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
244
245 return 0;
246}
247
248static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
249 u8 pwrst)
250{
251 u32 m;
252
253 m = pwrdm->mem_ret_mask[bank];
254 if (!m)
255 return -EINVAL;
256
257 am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)),
258 pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
259
260 return 0;
261}
262
263static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
264{
265 u32 m, v;
266
267 m = pwrdm->mem_pwrst_mask[bank];
268 if (!m)
269 return -EINVAL;
270
271 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs);
272 v &= m;
273 v >>= __ffs(m);
274
275 return v;
276}
277
278static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
279{
280 u32 m, v;
281
282 m = pwrdm->mem_retst_mask[bank];
283 if (!m)
284 return -EINVAL;
285
286 v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs);
287 v &= m;
288 v >>= __ffs(m);
289
290 return v;
291}
292
293static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm)
294{
295 u32 c = 0;
296
297 /*
298 * REVISIT: pwrdm_wait_transition() may be better implemented
299 * via a callback and a periodic timer check -- how long do we expect
300 * powerdomain transitions to take?
301 */
302
303 /* XXX Is this udelay() value meaningful? */
304 while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs)
305 & OMAP_INTRANSITION_MASK) &&
306 (c++ < PWRDM_TRANSITION_BAILOUT))
307 udelay(1);
308
309 if (c > PWRDM_TRANSITION_BAILOUT) {
310 pr_err("powerdomain: %s: waited too long to complete transition\n",
311 pwrdm->name);
312 return -EAGAIN;
313 }
314
315 pr_debug("powerdomain: completed transition in %d loops\n", c);
316
317 return 0;
318}
319
320struct pwrdm_ops am33xx_pwrdm_operations = {
321 .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst,
322 .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst,
323 .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst,
324 .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst,
325 .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst,
326 .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst,
327 .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst,
328 .pwrdm_clear_all_prev_pwrst = am33xx_pwrdm_clear_all_prev_pwrst,
329 .pwrdm_set_lowpwrstchange = am33xx_pwrdm_set_lowpwrstchange,
330 .pwrdm_read_mem_pwrst = am33xx_pwrdm_read_mem_pwrst,
331 .pwrdm_read_mem_retst = am33xx_pwrdm_read_mem_retst,
332 .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst,
333 .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst,
334 .pwrdm_wait_transition = am33xx_pwrdm_wait_transition,
335};
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
new file mode 100644
index 000000000000..db198d058584
--- /dev/null
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -0,0 +1,420 @@
1/*
2 * OMAP3xxx PRM module functions
3 *
4 * Copyright (C) 2010-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson
7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/errno.h>
17#include <linux/err.h>
18#include <linux/io.h>
19#include <linux/irq.h>
20
21#include "common.h"
22#include <plat/cpu.h>
23
24#include "vp.h"
25#include "powerdomain.h"
26#include "prm3xxx.h"
27#include "prm2xxx_3xxx.h"
28#include "cm2xxx_3xxx.h"
29#include "prm-regbits-34xx.h"
30
31static const struct omap_prcm_irq omap3_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0),
33 OMAP_PRCM_IRQ("io", 9, 1),
34};
35
36static struct omap_prcm_irq_setup omap3_prcm_irq_setup = {
37 .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET,
38 .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET,
39 .nr_regs = 1,
40 .irqs = omap3_prcm_irqs,
41 .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs),
42 .irq = 11 + OMAP_INTC_START,
43 .read_pending_irqs = &omap3xxx_prm_read_pending_irqs,
44 .ocp_barrier = &omap3xxx_prm_ocp_barrier,
45 .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen,
46 .restore_irqen = &omap3xxx_prm_restore_irqen,
47};
48
49/*
50 * omap3_prm_reset_src_map - map from bits in the PRM_RSTST hardware
51 * register (which are specific to OMAP3xxx SoCs) to reset source ID
52 * bit shifts (which is an OMAP SoC-independent enumeration)
53 */
54static struct prm_reset_src_map omap3xxx_prm_reset_src_map[] = {
55 { OMAP3430_GLOBAL_COLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
56 { OMAP3430_GLOBAL_SW_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
57 { OMAP3430_SECURITY_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
58 { OMAP3430_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
59 { OMAP3430_SECURE_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
60 { OMAP3430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
61 { OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT,
62 OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
63 { OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT,
64 OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
65 { OMAP3430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
66 { OMAP3430_ICECRUSHER_RST_SHIFT, OMAP_ICECRUSHER_RST_SRC_ID_SHIFT },
67 { -1, -1 },
68};
69
70/* PRM VP */
71
72/*
73 * struct omap3_vp - OMAP3 VP register access description.
74 * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg
75 */
76struct omap3_vp {
77 u32 tranxdone_status;
78};
79
80static struct omap3_vp omap3_vp[] = {
81 [OMAP3_VP_VDD_MPU_ID] = {
82 .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK,
83 },
84 [OMAP3_VP_VDD_CORE_ID] = {
85 .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK,
86 },
87};
88
89#define MAX_VP_ID ARRAY_SIZE(omap3_vp);
90
91u32 omap3_prm_vp_check_txdone(u8 vp_id)
92{
93 struct omap3_vp *vp = &omap3_vp[vp_id];
94 u32 irqstatus;
95
96 irqstatus = omap2_prm_read_mod_reg(OCP_MOD,
97 OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
98 return irqstatus & vp->tranxdone_status;
99}
100
101void omap3_prm_vp_clear_txdone(u8 vp_id)
102{
103 struct omap3_vp *vp = &omap3_vp[vp_id];
104
105 omap2_prm_write_mod_reg(vp->tranxdone_status,
106 OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
107}
108
109u32 omap3_prm_vcvp_read(u8 offset)
110{
111 return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset);
112}
113
114void omap3_prm_vcvp_write(u32 val, u8 offset)
115{
116 omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset);
117}
118
119u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
120{
121 return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset);
122}
123
124/**
125 * omap3xxx_prm_dpll3_reset - use DPLL3 reset to reboot the OMAP SoC
126 *
127 * Set the DPLL3 reset bit, which should reboot the SoC. This is the
128 * recommended way to restart the SoC, considering Errata i520. No
129 * return value.
130 */
131void omap3xxx_prm_dpll3_reset(void)
132{
133 omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD,
134 OMAP2_RM_RSTCTRL);
135 /* OCP barrier */
136 omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL);
137}
138
139/**
140 * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events
141 * @events: ptr to a u32, preallocated by caller
142 *
143 * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM
144 * MPU IRQs, and store the result into the u32 pointed to by @events.
145 * No return value.
146 */
147void omap3xxx_prm_read_pending_irqs(unsigned long *events)
148{
149 u32 mask, st;
150
151 /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */
152 mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
153 st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET);
154
155 events[0] = mask & st;
156}
157
158/**
159 * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete
160 *
161 * Force any buffered writes to the PRM IP block to complete. Needed
162 * by the PRM IRQ handler, which reads and writes directly to the IP
163 * block, to avoid race conditions after acknowledging or clearing IRQ
164 * bits. No return value.
165 */
166void omap3xxx_prm_ocp_barrier(void)
167{
168 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
169}
170
171/**
172 * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg
173 * @saved_mask: ptr to a u32 array to save IRQENABLE bits
174 *
175 * Save the PRM_IRQENABLE_MPU register to @saved_mask. @saved_mask
176 * must be allocated by the caller. Intended to be used in the PRM
177 * interrupt handler suspend callback. The OCP barrier is needed to
178 * ensure the write to disable PRM interrupts reaches the PRM before
179 * returning; otherwise, spurious interrupts might occur. No return
180 * value.
181 */
182void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask)
183{
184 saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD,
185 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
186 omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET);
187
188 /* OCP barrier */
189 omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET);
190}
191
192/**
193 * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args
194 * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously
195 *
196 * Restore the PRM_IRQENABLE_MPU register from @saved_mask. Intended
197 * to be used in the PRM interrupt handler resume callback to restore
198 * values saved by omap3xxx_prm_save_and_clear_irqen(). No OCP
199 * barrier should be needed here; any pending PRM interrupts will fire
200 * once the writes reach the PRM. No return value.
201 */
202void omap3xxx_prm_restore_irqen(u32 *saved_mask)
203{
204 omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD,
205 OMAP3_PRM_IRQENABLE_MPU_OFFSET);
206}
207
208/**
209 * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain
210 *
211 * Clear any previously-latched I/O wakeup events and ensure that the
212 * I/O wakeup gates are aligned with the current mux settings. Works
213 * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then
214 * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No
215 * return value.
216 */
217void omap3xxx_prm_reconfigure_io_chain(void)
218{
219 int i = 0;
220
221 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
222 PM_WKEN);
223
224 omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) &
225 OMAP3430_ST_IO_CHAIN_MASK,
226 MAX_IOPAD_LATCH_TIME, i);
227 if (i == MAX_IOPAD_LATCH_TIME)
228 pr_warn("PRM: I/O chain clock line assertion timed out\n");
229
230 omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD,
231 PM_WKEN);
232
233 omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD,
234 PM_WKST);
235
236 omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST);
237}
238
239/**
240 * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches
241 *
242 * Activates the I/O wakeup event latches and allows events logged by
243 * those latches to signal a wakeup event to the PRCM. For I/O
244 * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux
245 * registers, and omap3xxx_prm_reconfigure_io_chain() must be called.
246 * No return value.
247 */
248static void __init omap3xxx_prm_enable_io_wakeup(void)
249{
250 if (omap3_has_io_wakeup())
251 omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD,
252 PM_WKEN);
253}
254
255/**
256 * omap3xxx_prm_read_reset_sources - return the last SoC reset source
257 *
258 * Return a u32 representing the last reset sources of the SoC. The
259 * returned reset source bits are standardized across OMAP SoCs.
260 */
261static u32 omap3xxx_prm_read_reset_sources(void)
262{
263 struct prm_reset_src_map *p;
264 u32 r = 0;
265 u32 v;
266
267 v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST);
268
269 p = omap3xxx_prm_reset_src_map;
270 while (p->reg_shift >= 0 && p->std_shift >= 0) {
271 if (v & (1 << p->reg_shift))
272 r |= 1 << p->std_shift;
273 p++;
274 }
275
276 return r;
277}
278
279/* Powerdomain low-level functions */
280
281/* Applicable only for OMAP3. Not supported on OMAP2 */
282static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
283{
284 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
285 OMAP3430_PM_PREPWSTST,
286 OMAP3430_LASTPOWERSTATEENTERED_MASK);
287}
288
289static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
290{
291 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
292 OMAP2_PM_PWSTST,
293 OMAP3430_LOGICSTATEST_MASK);
294}
295
296static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
297{
298 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
299 OMAP2_PM_PWSTCTRL,
300 OMAP3430_LOGICSTATEST_MASK);
301}
302
303static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
304{
305 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
306 OMAP3430_PM_PREPWSTST,
307 OMAP3430_LASTLOGICSTATEENTERED_MASK);
308}
309
310static int omap3_get_mem_bank_lastmemst_mask(u8 bank)
311{
312 switch (bank) {
313 case 0:
314 return OMAP3430_LASTMEM1STATEENTERED_MASK;
315 case 1:
316 return OMAP3430_LASTMEM2STATEENTERED_MASK;
317 case 2:
318 return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK;
319 case 3:
320 return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK;
321 default:
322 WARN_ON(1); /* should never happen */
323 return -EEXIST;
324 }
325 return 0;
326}
327
328static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
329{
330 u32 m;
331
332 m = omap3_get_mem_bank_lastmemst_mask(bank);
333
334 return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs,
335 OMAP3430_PM_PREPWSTST, m);
336}
337
338static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
339{
340 omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST);
341 return 0;
342}
343
344static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm)
345{
346 return omap2_prm_rmw_mod_reg_bits(0,
347 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
348 pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL);
349}
350
351static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm)
352{
353 return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT,
354 0, pwrdm->prcm_offs,
355 OMAP2_PM_PWSTCTRL);
356}
357
358struct pwrdm_ops omap3_pwrdm_operations = {
359 .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst,
360 .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst,
361 .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst,
362 .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst,
363 .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst,
364 .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst,
365 .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst,
366 .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst,
367 .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst,
368 .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst,
369 .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst,
370 .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst,
371 .pwrdm_read_prev_mem_pwrst = omap3_pwrdm_read_prev_mem_pwrst,
372 .pwrdm_clear_all_prev_pwrst = omap3_pwrdm_clear_all_prev_pwrst,
373 .pwrdm_enable_hdwr_sar = omap3_pwrdm_enable_hdwr_sar,
374 .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar,
375 .pwrdm_wait_transition = omap2_pwrdm_wait_transition,
376};
377
378/*
379 *
380 */
381
382static struct prm_ll_data omap3xxx_prm_ll_data = {
383 .read_reset_sources = &omap3xxx_prm_read_reset_sources,
384};
385
386int __init omap3xxx_prm_init(void)
387{
388 if (!cpu_is_omap34xx())
389 return 0;
390
391 return prm_register(&omap3xxx_prm_ll_data);
392}
393
394static int __init omap3xxx_prm_late_init(void)
395{
396 int ret;
397
398 if (!cpu_is_omap34xx())
399 return 0;
400
401 omap3xxx_prm_enable_io_wakeup();
402 ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup);
403 if (!ret)
404 irq_set_status_flags(omap_prcm_event_to_irq("io"),
405 IRQ_NOAUTOEN);
406
407 return ret;
408}
409subsys_initcall(omap3xxx_prm_late_init);
410
411static void __exit omap3xxx_prm_exit(void)
412{
413 if (!cpu_is_omap34xx())
414 return;
415
416 /* Should never happen */
417 WARN(prm_unregister(&omap3xxx_prm_ll_data),
418 "%s: prm_ll_data function pointer mismatch\n", __func__);
419}
420__exitcall(omap3xxx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
new file mode 100644
index 000000000000..277f71794e61
--- /dev/null
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -0,0 +1,163 @@
1/*
2 * OMAP3xxx Power/Reset Management (PRM) register definitions
3 *
4 * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Paul Walmsley
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * The PRM hardware modules on the OMAP2/3 are quite similar to each
13 * other. The PRM on OMAP4 has a new register layout, and is handled
14 * in a separate file.
15 */
16#ifndef __ARCH_ARM_MACH_OMAP2_PRM3XXX_H
17#define __ARCH_ARM_MACH_OMAP2_PRM3XXX_H
18
19#include "prcm-common.h"
20#include "prm.h"
21#include "prm2xxx_3xxx.h"
22
23#define OMAP34XX_PRM_REGADDR(module, reg) \
24 OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg))
25
26
27/*
28 * OMAP3-specific global PRM registers
29 * Use __raw_{read,write}l() with these registers.
30 *
31 * With a few exceptions, these are the register names beginning with
32 * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE
33 * bits.)
34 */
35
36#define OMAP3_PRM_REVISION_OFFSET 0x0004
37#define OMAP3430_PRM_REVISION OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004)
38#define OMAP3_PRM_SYSCONFIG_OFFSET 0x0014
39#define OMAP3430_PRM_SYSCONFIG OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014)
40
41#define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018
42#define OMAP3430_PRM_IRQSTATUS_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018)
43#define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c
44#define OMAP3430_PRM_IRQENABLE_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c)
45
46
47#define OMAP3_PRM_VC_SMPS_SA_OFFSET 0x0020
48#define OMAP3430_PRM_VC_SMPS_SA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020)
49#define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET 0x0024
50#define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024)
51#define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET 0x0028
52#define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028)
53#define OMAP3_PRM_VC_CMD_VAL_0_OFFSET 0x002c
54#define OMAP3430_PRM_VC_CMD_VAL_0 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c)
55#define OMAP3_PRM_VC_CMD_VAL_1_OFFSET 0x0030
56#define OMAP3430_PRM_VC_CMD_VAL_1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030)
57#define OMAP3_PRM_VC_CH_CONF_OFFSET 0x0034
58#define OMAP3430_PRM_VC_CH_CONF OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034)
59#define OMAP3_PRM_VC_I2C_CFG_OFFSET 0x0038
60#define OMAP3430_PRM_VC_I2C_CFG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038)
61#define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c
62#define OMAP3430_PRM_VC_BYPASS_VAL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c)
63#define OMAP3_PRM_RSTCTRL_OFFSET 0x0050
64#define OMAP3430_PRM_RSTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050)
65#define OMAP3_PRM_RSTTIME_OFFSET 0x0054
66#define OMAP3430_PRM_RSTTIME OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054)
67#define OMAP3_PRM_RSTST_OFFSET 0x0058
68#define OMAP3430_PRM_RSTST OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058)
69#define OMAP3_PRM_VOLTCTRL_OFFSET 0x0060
70#define OMAP3430_PRM_VOLTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060)
71#define OMAP3_PRM_SRAM_PCHARGE_OFFSET 0x0064
72#define OMAP3430_PRM_SRAM_PCHARGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064)
73#define OMAP3_PRM_CLKSRC_CTRL_OFFSET 0x0070
74#define OMAP3430_PRM_CLKSRC_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070)
75#define OMAP3_PRM_VOLTSETUP1_OFFSET 0x0090
76#define OMAP3430_PRM_VOLTSETUP1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090)
77#define OMAP3_PRM_VOLTOFFSET_OFFSET 0x0094
78#define OMAP3430_PRM_VOLTOFFSET OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094)
79#define OMAP3_PRM_CLKSETUP_OFFSET 0x0098
80#define OMAP3430_PRM_CLKSETUP OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098)
81#define OMAP3_PRM_POLCTRL_OFFSET 0x009c
82#define OMAP3430_PRM_POLCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c)
83#define OMAP3_PRM_VOLTSETUP2_OFFSET 0x00a0
84#define OMAP3430_PRM_VOLTSETUP2 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0)
85#define OMAP3_PRM_VP1_CONFIG_OFFSET 0x00b0
86#define OMAP3430_PRM_VP1_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0)
87#define OMAP3_PRM_VP1_VSTEPMIN_OFFSET 0x00b4
88#define OMAP3430_PRM_VP1_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4)
89#define OMAP3_PRM_VP1_VSTEPMAX_OFFSET 0x00b8
90#define OMAP3430_PRM_VP1_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8)
91#define OMAP3_PRM_VP1_VLIMITTO_OFFSET 0x00bc
92#define OMAP3430_PRM_VP1_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc)
93#define OMAP3_PRM_VP1_VOLTAGE_OFFSET 0x00c0
94#define OMAP3430_PRM_VP1_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0)
95#define OMAP3_PRM_VP1_STATUS_OFFSET 0x00c4
96#define OMAP3430_PRM_VP1_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4)
97#define OMAP3_PRM_VP2_CONFIG_OFFSET 0x00d0
98#define OMAP3430_PRM_VP2_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0)
99#define OMAP3_PRM_VP2_VSTEPMIN_OFFSET 0x00d4
100#define OMAP3430_PRM_VP2_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4)
101#define OMAP3_PRM_VP2_VSTEPMAX_OFFSET 0x00d8
102#define OMAP3430_PRM_VP2_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8)
103#define OMAP3_PRM_VP2_VLIMITTO_OFFSET 0x00dc
104#define OMAP3430_PRM_VP2_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc)
105#define OMAP3_PRM_VP2_VOLTAGE_OFFSET 0x00e0
106#define OMAP3430_PRM_VP2_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0)
107#define OMAP3_PRM_VP2_STATUS_OFFSET 0x00e4
108#define OMAP3430_PRM_VP2_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4)
109
110#define OMAP3_PRM_CLKSEL_OFFSET 0x0040
111#define OMAP3430_PRM_CLKSEL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040)
112#define OMAP3_PRM_CLKOUT_CTRL_OFFSET 0x0070
113#define OMAP3430_PRM_CLKOUT_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070)
114
115/* OMAP3 specific register offsets */
116#define OMAP3430ES2_PM_WKEN3 0x00f0
117#define OMAP3430ES2_PM_WKST3 0x00b8
118
119#define OMAP3430_PM_MPUGRPSEL 0x00a4
120#define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL
121#define OMAP3430ES2_PM_MPUGRPSEL3 0x00f8
122
123#define OMAP3430_PM_IVAGRPSEL 0x00a8
124#define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL
125#define OMAP3430ES2_PM_IVAGRPSEL3 0x00f4
126
127#define OMAP3430_PM_PREPWSTST 0x00e8
128
129#define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8
130#define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc
131
132
133#ifndef __ASSEMBLER__
134
135/* OMAP3-specific VP functions */
136u32 omap3_prm_vp_check_txdone(u8 vp_id);
137void omap3_prm_vp_clear_txdone(u8 vp_id);
138
139/*
140 * OMAP3 access functions for voltage controller (VC) and
141 * voltage proccessor (VP) in the PRM.
142 */
143extern u32 omap3_prm_vcvp_read(u8 offset);
144extern void omap3_prm_vcvp_write(u32 val, u8 offset);
145extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset);
146
147extern void omap3xxx_prm_reconfigure_io_chain(void);
148
149/* PRM interrupt-related functions */
150extern void omap3xxx_prm_read_pending_irqs(unsigned long *events);
151extern void omap3xxx_prm_ocp_barrier(void);
152extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
153extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
154
155extern void omap3xxx_prm_dpll3_reset(void);
156
157extern int __init omap3xxx_prm_init(void);
158extern u32 omap3xxx_prm_get_reset_sources(void);
159
160#endif /* __ASSEMBLER */
161
162
163#endif
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index f0c4d5f4a174..7498bc77fe8b 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -1,10 +1,11 @@
1/* 1/*
2 * OMAP4 PRM module functions 2 * OMAP4 PRM module functions
3 * 3 *
4 * Copyright (C) 2011 Texas Instruments, Inc. 4 * Copyright (C) 2011-2012 Texas Instruments, Inc.
5 * Copyright (C) 2010 Nokia Corporation 5 * Copyright (C) 2010 Nokia Corporation
6 * Benoît Cousson 6 * Benoît Cousson
7 * Paul Walmsley 7 * Paul Walmsley
8 * Rajendra Nayak <rnayak@ti.com>
8 * 9 *
9 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -17,7 +18,6 @@
17#include <linux/err.h> 18#include <linux/err.h>
18#include <linux/io.h> 19#include <linux/io.h>
19 20
20#include <plat/prcm.h>
21 21
22#include "soc.h" 22#include "soc.h"
23#include "iomap.h" 23#include "iomap.h"
@@ -27,6 +27,9 @@
27#include "prm-regbits-44xx.h" 27#include "prm-regbits-44xx.h"
28#include "prcm44xx.h" 28#include "prcm44xx.h"
29#include "prminst44xx.h" 29#include "prminst44xx.h"
30#include "powerdomain.h"
31
32/* Static data */
30 33
31static const struct omap_prcm_irq omap4_prcm_irqs[] = { 34static const struct omap_prcm_irq omap4_prcm_irqs[] = {
32 OMAP_PRCM_IRQ("wkup", 0, 0), 35 OMAP_PRCM_IRQ("wkup", 0, 0),
@@ -46,6 +49,33 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = {
46 .restore_irqen = &omap44xx_prm_restore_irqen, 49 .restore_irqen = &omap44xx_prm_restore_irqen,
47}; 50};
48 51
52/*
53 * omap44xx_prm_reset_src_map - map from bits in the PRM_RSTST
54 * hardware register (which are specific to OMAP44xx SoCs) to reset
55 * source ID bit shifts (which is an OMAP SoC-independent
56 * enumeration)
57 */
58static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = {
59 { OMAP4430_RST_GLOBAL_WARM_SW_SHIFT,
60 OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT },
61 { OMAP4430_RST_GLOBAL_COLD_SW_SHIFT,
62 OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT },
63 { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT,
64 OMAP_SECU_VIOL_RST_SRC_ID_SHIFT },
65 { OMAP4430_MPU_WDT_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT },
66 { OMAP4430_SECURE_WDT_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT },
67 { OMAP4430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT },
68 { OMAP4430_VDD_MPU_VOLT_MGR_RST_SHIFT,
69 OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT },
70 { OMAP4430_VDD_IVA_VOLT_MGR_RST_SHIFT,
71 OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT },
72 { OMAP4430_VDD_CORE_VOLT_MGR_RST_SHIFT,
73 OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT },
74 { OMAP4430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT },
75 { OMAP4430_C2C_RST_SHIFT, OMAP_C2C_RST_SRC_ID_SHIFT },
76 { -1, -1 },
77};
78
49/* PRM low-level functions */ 79/* PRM low-level functions */
50 80
51/* Read a register in a CM/PRM instance in the PRM module */ 81/* Read a register in a CM/PRM instance in the PRM module */
@@ -291,12 +321,359 @@ static void __init omap44xx_prm_enable_io_wakeup(void)
291 OMAP4_PRM_IO_PMCTRL_OFFSET); 321 OMAP4_PRM_IO_PMCTRL_OFFSET);
292} 322}
293 323
294static int __init omap4xxx_prcm_init(void) 324/**
325 * omap44xx_prm_read_reset_sources - return the last SoC reset source
326 *
327 * Return a u32 representing the last reset sources of the SoC. The
328 * returned reset source bits are standardized across OMAP SoCs.
329 */
330static u32 omap44xx_prm_read_reset_sources(void)
331{
332 struct prm_reset_src_map *p;
333 u32 r = 0;
334 u32 v;
335
336 v = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST,
337 OMAP4_RM_RSTST);
338
339 p = omap44xx_prm_reset_src_map;
340 while (p->reg_shift >= 0 && p->std_shift >= 0) {
341 if (v & (1 << p->reg_shift))
342 r |= 1 << p->std_shift;
343 p++;
344 }
345
346 return r;
347}
348
349/**
350 * omap44xx_prm_was_any_context_lost_old - was module hardware context lost?
351 * @part: PRM partition ID (e.g., OMAP4430_PRM_PARTITION)
352 * @inst: PRM instance offset (e.g., OMAP4430_PRM_MPU_INST)
353 * @idx: CONTEXT register offset
354 *
355 * Return 1 if any bits were set in the *_CONTEXT_* register
356 * identified by (@part, @inst, @idx), which means that some context
357 * was lost for that module; otherwise, return 0.
358 */
359static bool omap44xx_prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx)
360{
361 return (omap4_prminst_read_inst_reg(part, inst, idx)) ? 1 : 0;
362}
363
364/**
365 * omap44xx_prm_clear_context_lost_flags_old - clear context loss flags
366 * @part: PRM partition ID (e.g., OMAP4430_PRM_PARTITION)
367 * @inst: PRM instance offset (e.g., OMAP4430_PRM_MPU_INST)
368 * @idx: CONTEXT register offset
369 *
370 * Clear hardware context loss bits for the module identified by
371 * (@part, @inst, @idx). No return value. XXX Writes to reserved bits;
372 * is there a way to avoid this?
373 */
374static void omap44xx_prm_clear_context_loss_flags_old(u8 part, s16 inst,
375 u16 idx)
376{
377 omap4_prminst_write_inst_reg(0xffffffff, part, inst, idx);
378}
379
380/* Powerdomain low-level functions */
381
382static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
383{
384 omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK,
385 (pwrst << OMAP_POWERSTATE_SHIFT),
386 pwrdm->prcm_partition,
387 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
388 return 0;
389}
390
391static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm)
392{
393 u32 v;
394
395 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
396 OMAP4_PM_PWSTCTRL);
397 v &= OMAP_POWERSTATE_MASK;
398 v >>= OMAP_POWERSTATE_SHIFT;
399
400 return v;
401}
402
403static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm)
404{
405 u32 v;
406
407 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
408 OMAP4_PM_PWSTST);
409 v &= OMAP_POWERSTATEST_MASK;
410 v >>= OMAP_POWERSTATEST_SHIFT;
411
412 return v;
413}
414
415static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm)
416{
417 u32 v;
418
419 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
420 OMAP4_PM_PWSTST);
421 v &= OMAP4430_LASTPOWERSTATEENTERED_MASK;
422 v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT;
423
424 return v;
425}
426
427static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm)
428{
429 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK,
430 (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT),
431 pwrdm->prcm_partition,
432 pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL);
433 return 0;
434}
435
436static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm)
437{
438 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK,
439 OMAP4430_LASTPOWERSTATEENTERED_MASK,
440 pwrdm->prcm_partition,
441 pwrdm->prcm_offs, OMAP4_PM_PWSTST);
442 return 0;
443}
444
445static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst)
446{
447 u32 v;
448
449 v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK);
450 omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v,
451 pwrdm->prcm_partition, pwrdm->prcm_offs,
452 OMAP4_PM_PWSTCTRL);
453
454 return 0;
455}
456
457static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank,
458 u8 pwrst)
459{
460 u32 m;
461
462 m = omap2_pwrdm_get_mem_bank_onstate_mask(bank);
463
464 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
465 pwrdm->prcm_partition, pwrdm->prcm_offs,
466 OMAP4_PM_PWSTCTRL);
467
468 return 0;
469}
470
471static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank,
472 u8 pwrst)
295{ 473{
296 if (cpu_is_omap44xx()) { 474 u32 m;
297 omap44xx_prm_enable_io_wakeup(); 475
298 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); 476 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
477
478 omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)),
479 pwrdm->prcm_partition, pwrdm->prcm_offs,
480 OMAP4_PM_PWSTCTRL);
481
482 return 0;
483}
484
485static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm)
486{
487 u32 v;
488
489 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
490 OMAP4_PM_PWSTST);
491 v &= OMAP4430_LOGICSTATEST_MASK;
492 v >>= OMAP4430_LOGICSTATEST_SHIFT;
493
494 return v;
495}
496
497static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm)
498{
499 u32 v;
500
501 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
502 OMAP4_PM_PWSTCTRL);
503 v &= OMAP4430_LOGICRETSTATE_MASK;
504 v >>= OMAP4430_LOGICRETSTATE_SHIFT;
505
506 return v;
507}
508
509/**
510 * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate
511 * @pwrdm: struct powerdomain * to read the state for
512 *
513 * Reads the previous logic powerstate for a powerdomain. This
514 * function must determine the previous logic powerstate by first
515 * checking the previous powerstate for the domain. If that was OFF,
516 * then logic has been lost. If previous state was RETENTION, the
517 * function reads the setting for the next retention logic state to
518 * see the actual value. In every other case, the logic is
519 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
520 * depending whether the logic was retained or not.
521 */
522static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm)
523{
524 int state;
525
526 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
527
528 if (state == PWRDM_POWER_OFF)
529 return PWRDM_POWER_OFF;
530
531 if (state != PWRDM_POWER_RET)
532 return PWRDM_POWER_RET;
533
534 return omap4_pwrdm_read_logic_retst(pwrdm);
535}
536
537static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
538{
539 u32 m, v;
540
541 m = omap2_pwrdm_get_mem_bank_stst_mask(bank);
542
543 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
544 OMAP4_PM_PWSTST);
545 v &= m;
546 v >>= __ffs(m);
547
548 return v;
549}
550
551static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank)
552{
553 u32 m, v;
554
555 m = omap2_pwrdm_get_mem_bank_retst_mask(bank);
556
557 v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs,
558 OMAP4_PM_PWSTCTRL);
559 v &= m;
560 v >>= __ffs(m);
561
562 return v;
563}
564
565/**
566 * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate
567 * @pwrdm: struct powerdomain * to read mem powerstate for
568 * @bank: memory bank index
569 *
570 * Reads the previous memory powerstate for a powerdomain. This
571 * function must determine the previous memory powerstate by first
572 * checking the previous powerstate for the domain. If that was OFF,
573 * then logic has been lost. If previous state was RETENTION, the
574 * function reads the setting for the next memory retention state to
575 * see the actual value. In every other case, the logic is
576 * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET
577 * depending whether logic was retained or not.
578 */
579static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank)
580{
581 int state;
582
583 state = omap4_pwrdm_read_prev_pwrst(pwrdm);
584
585 if (state == PWRDM_POWER_OFF)
586 return PWRDM_POWER_OFF;
587
588 if (state != PWRDM_POWER_RET)
589 return PWRDM_POWER_RET;
590
591 return omap4_pwrdm_read_mem_retst(pwrdm, bank);
592}
593
594static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm)
595{
596 u32 c = 0;
597
598 /*
599 * REVISIT: pwrdm_wait_transition() may be better implemented
600 * via a callback and a periodic timer check -- how long do we expect
601 * powerdomain transitions to take?
602 */
603
604 /* XXX Is this udelay() value meaningful? */
605 while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition,
606 pwrdm->prcm_offs,
607 OMAP4_PM_PWSTST) &
608 OMAP_INTRANSITION_MASK) &&
609 (c++ < PWRDM_TRANSITION_BAILOUT))
610 udelay(1);
611
612 if (c > PWRDM_TRANSITION_BAILOUT) {
613 pr_err("powerdomain: %s: waited too long to complete transition\n",
614 pwrdm->name);
615 return -EAGAIN;
299 } 616 }
617
618 pr_debug("powerdomain: completed transition in %d loops\n", c);
619
300 return 0; 620 return 0;
301} 621}
302subsys_initcall(omap4xxx_prcm_init); 622
623struct pwrdm_ops omap4_pwrdm_operations = {
624 .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst,
625 .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst,
626 .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst,
627 .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst,
628 .pwrdm_set_lowpwrstchange = omap4_pwrdm_set_lowpwrstchange,
629 .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst,
630 .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst,
631 .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst,
632 .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst,
633 .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst,
634 .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst,
635 .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst,
636 .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst,
637 .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst,
638 .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst,
639 .pwrdm_wait_transition = omap4_pwrdm_wait_transition,
640};
641
642/*
643 * XXX document
644 */
645static struct prm_ll_data omap44xx_prm_ll_data = {
646 .read_reset_sources = &omap44xx_prm_read_reset_sources,
647 .was_any_context_lost_old = &omap44xx_prm_was_any_context_lost_old,
648 .clear_context_loss_flags_old = &omap44xx_prm_clear_context_loss_flags_old,
649};
650
651int __init omap44xx_prm_init(void)
652{
653 if (!cpu_is_omap44xx())
654 return 0;
655
656 return prm_register(&omap44xx_prm_ll_data);
657}
658
659static int __init omap44xx_prm_late_init(void)
660{
661 if (!cpu_is_omap44xx())
662 return 0;
663
664 omap44xx_prm_enable_io_wakeup();
665
666 return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup);
667}
668subsys_initcall(omap44xx_prm_late_init);
669
670static void __exit omap44xx_prm_exit(void)
671{
672 if (!cpu_is_omap44xx())
673 return;
674
675 /* Should never happen */
676 WARN(prm_unregister(&omap44xx_prm_ll_data),
677 "%s: prm_ll_data function pointer mismatch\n", __func__);
678}
679__exitcall(omap44xx_prm_exit);
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h
index ee72ae6bd8c9..22b0979206ca 100644
--- a/arch/arm/mach-omap2/prm44xx.h
+++ b/arch/arm/mach-omap2/prm44xx.h
@@ -771,6 +771,9 @@ extern void omap44xx_prm_ocp_barrier(void);
771extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask); 771extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask);
772extern void omap44xx_prm_restore_irqen(u32 *saved_mask); 772extern void omap44xx_prm_restore_irqen(u32 *saved_mask);
773 773
774extern int __init omap44xx_prm_init(void);
775extern u32 omap44xx_prm_get_reset_sources(void);
776
774# endif 777# endif
775 778
776#endif 779#endif
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 3442227d3f0b..228b850e632f 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -24,10 +24,11 @@
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include <plat/prcm.h>
28
29#include "prm2xxx_3xxx.h" 27#include "prm2xxx_3xxx.h"
28#include "prm2xxx.h"
29#include "prm3xxx.h"
30#include "prm44xx.h" 30#include "prm44xx.h"
31#include "common.h"
31 32
32/* 33/*
33 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs 34 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs
@@ -52,6 +53,16 @@ static struct irq_chip_generic **prcm_irq_chips;
52 */ 53 */
53static struct omap_prcm_irq_setup *prcm_irq_setup; 54static struct omap_prcm_irq_setup *prcm_irq_setup;
54 55
56/* prm_base: base virtual address of the PRM IP block */
57void __iomem *prm_base;
58
59/*
60 * prm_ll_data: function pointers to SoC-specific implementations of
61 * common PRM functions
62 */
63static struct prm_ll_data null_prm_ll_data;
64static struct prm_ll_data *prm_ll_data = &null_prm_ll_data;
65
55/* Private functions */ 66/* Private functions */
56 67
57/* 68/*
@@ -318,64 +329,127 @@ err:
318 return -ENOMEM; 329 return -ENOMEM;
319} 330}
320 331
321/* 332/**
322 * Stubbed functions so that common files continue to build when 333 * omap2_set_globals_prm - set the PRM base address (for early use)
323 * custom builds are used 334 * @prm: PRM base virtual address
324 * XXX These are temporary and should be removed at the earliest possible 335 *
325 * opportunity 336 * XXX Will be replaced when the PRM/CM drivers are completed.
326 */ 337 */
327u32 __weak omap2_prm_read_mod_reg(s16 module, u16 idx) 338void __init omap2_set_globals_prm(void __iomem *prm)
328{ 339{
329 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 340 prm_base = prm;
330 return 0;
331} 341}
332 342
333void __weak omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) 343/**
344 * prm_read_reset_sources - return the sources of the SoC's last reset
345 *
346 * Return a u32 bitmask representing the reset sources that caused the
347 * SoC to reset. The low-level per-SoC functions called by this
348 * function remap the SoC-specific reset source bits into an
349 * OMAP-common set of reset source bits, defined in
350 * arch/arm/mach-omap2/prm.h. Returns the standardized reset source
351 * u32 bitmask from the hardware upon success, or returns (1 <<
352 * OMAP_UNKNOWN_RST_SRC_ID_SHIFT) if no low-level read_reset_sources()
353 * function was registered.
354 */
355u32 prm_read_reset_sources(void)
334{ 356{
335 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 357 u32 ret = 1 << OMAP_UNKNOWN_RST_SRC_ID_SHIFT;
336}
337 358
338u32 __weak omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, 359 if (prm_ll_data->read_reset_sources)
339 s16 module, s16 idx) 360 ret = prm_ll_data->read_reset_sources();
340{ 361 else
341 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 362 WARN_ONCE(1, "prm: %s: no mapping function defined for reset sources\n", __func__);
342 return 0;
343}
344 363
345u32 __weak omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) 364 return ret;
346{
347 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n");
348 return 0;
349} 365}
350 366
351u32 __weak omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) 367/**
368 * prm_was_any_context_lost_old - was device context lost? (old API)
369 * @part: PRM partition ID (e.g., OMAP4430_PRM_PARTITION)
370 * @inst: PRM instance offset (e.g., OMAP4430_PRM_MPU_INST)
371 * @idx: CONTEXT register offset
372 *
373 * Return 1 if any bits were set in the *_CONTEXT_* register
374 * identified by (@part, @inst, @idx), which means that some context
375 * was lost for that module; otherwise, return 0. XXX Deprecated;
376 * callers need to use a less-SoC-dependent way to identify hardware
377 * IP blocks.
378 */
379bool prm_was_any_context_lost_old(u8 part, s16 inst, u16 idx)
352{ 380{
353 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 381 bool ret = true;
354 return 0;
355}
356 382
357u32 __weak omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) 383 if (prm_ll_data->was_any_context_lost_old)
358{ 384 ret = prm_ll_data->was_any_context_lost_old(part, inst, idx);
359 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 385 else
360 return 0; 386 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
387 __func__);
388
389 return ret;
361} 390}
362 391
363int __weak omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) 392/**
393 * prm_clear_context_lost_flags_old - clear context loss flags (old API)
394 * @part: PRM partition ID (e.g., OMAP4430_PRM_PARTITION)
395 * @inst: PRM instance offset (e.g., OMAP4430_PRM_MPU_INST)
396 * @idx: CONTEXT register offset
397 *
398 * Clear hardware context loss bits for the module identified by
399 * (@part, @inst, @idx). No return value. XXX Deprecated; callers
400 * need to use a less-SoC-dependent way to identify hardware IP
401 * blocks.
402 */
403void prm_clear_context_loss_flags_old(u8 part, s16 inst, u16 idx)
364{ 404{
365 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 405 if (prm_ll_data->clear_context_loss_flags_old)
366 return 0; 406 prm_ll_data->clear_context_loss_flags_old(part, inst, idx);
407 else
408 WARN_ONCE(1, "prm: %s: no mapping function defined\n",
409 __func__);
367} 410}
368 411
369int __weak omap2_prm_assert_hardreset(s16 prm_mod, u8 shift) 412/**
413 * prm_register - register per-SoC low-level data with the PRM
414 * @pld: low-level per-SoC OMAP PRM data & function pointers to register
415 *
416 * Register per-SoC low-level OMAP PRM data and function pointers with
417 * the OMAP PRM common interface. The caller must keep the data
418 * pointed to by @pld valid until it calls prm_unregister() and
419 * it returns successfully. Returns 0 upon success, -EINVAL if @pld
420 * is NULL, or -EEXIST if prm_register() has already been called
421 * without an intervening prm_unregister().
422 */
423int prm_register(struct prm_ll_data *pld)
370{ 424{
371 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 425 if (!pld)
426 return -EINVAL;
427
428 if (prm_ll_data != &null_prm_ll_data)
429 return -EEXIST;
430
431 prm_ll_data = pld;
432
372 return 0; 433 return 0;
373} 434}
374 435
375int __weak omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, 436/**
376 u8 st_shift) 437 * prm_unregister - unregister per-SoC low-level data & function pointers
438 * @pld: low-level per-SoC OMAP PRM data & function pointers to unregister
439 *
440 * Unregister per-SoC low-level OMAP PRM data and function pointers
441 * that were previously registered with prm_register(). The
442 * caller may not destroy any of the data pointed to by @pld until
443 * this function returns successfully. Returns 0 upon success, or
444 * -EINVAL if @pld is NULL or if @pld does not match the struct
445 * prm_ll_data * previously registered by prm_register().
446 */
447int prm_unregister(struct prm_ll_data *pld)
377{ 448{
378 WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); 449 if (!pld || prm_ll_data != pld)
450 return -EINVAL;
451
452 prm_ll_data = &null_prm_ll_data;
453
379 return 0; 454 return 0;
380} 455}
381
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h
index 46f2efb36596..a2ede2d65481 100644
--- a/arch/arm/mach-omap2/prminst44xx.h
+++ b/arch/arm/mach-omap2/prminst44xx.h
@@ -30,4 +30,6 @@ extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst,
30extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, 30extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst,
31 u16 rstctrl_offs); 31 u16 rstctrl_offs);
32 32
33extern void omap_prm_base_init(void);
34
33#endif 35#endif
diff --git a/arch/arm/mach-omap2/scrm44xx.h b/arch/arm/mach-omap2/scrm44xx.h
index 701bf2d32949..e897ac89a3fd 100644
--- a/arch/arm/mach-omap2/scrm44xx.h
+++ b/arch/arm/mach-omap2/scrm44xx.h
@@ -127,12 +127,14 @@
127/* AUXCLKREQ0 */ 127/* AUXCLKREQ0 */
128#define OMAP4_MAPPING_SHIFT 2 128#define OMAP4_MAPPING_SHIFT 2
129#define OMAP4_MAPPING_MASK (0x7 << 2) 129#define OMAP4_MAPPING_MASK (0x7 << 2)
130#define OMAP4_MAPPING_WIDTH 3
130#define OMAP4_ACCURACY_SHIFT 1 131#define OMAP4_ACCURACY_SHIFT 1
131#define OMAP4_ACCURACY_MASK (1 << 1) 132#define OMAP4_ACCURACY_MASK (1 << 1)
132 133
133/* AUXCLK0 */ 134/* AUXCLK0 */
134#define OMAP4_CLKDIV_SHIFT 16 135#define OMAP4_CLKDIV_SHIFT 16
135#define OMAP4_CLKDIV_MASK (0xf << 16) 136#define OMAP4_CLKDIV_MASK (0xf << 16)
137#define OMAP4_CLKDIV_WIDTH 4
136#define OMAP4_DISABLECLK_SHIFT 9 138#define OMAP4_DISABLECLK_SHIFT 9
137#define OMAP4_DISABLECLK_MASK (1 << 9) 139#define OMAP4_DISABLECLK_MASK (1 << 9)
138#define OMAP4_ENABLE_SHIFT 8 140#define OMAP4_ENABLE_SHIFT 8
diff --git a/arch/arm/mach-omap2/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index c64ee1904be8..dae7e4804a48 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -112,12 +112,10 @@ int omap2_sdrc_get_params(unsigned long r,
112} 112}
113 113
114 114
115void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 115void __init omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms)
116{ 116{
117 if (omap2_globals->sdrc) 117 omap2_sdrc_base = sdrc;
118 omap2_sdrc_base = omap2_globals->sdrc; 118 omap2_sms_base = sms;
119 if (omap2_globals->sms)
120 omap2_sms_base = omap2_globals->sms;
121} 119}
122 120
123/** 121/**
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h
index 69c4b329452e..446aa13511fd 100644
--- a/arch/arm/mach-omap2/sdrc.h
+++ b/arch/arm/mach-omap2/sdrc.h
@@ -51,6 +51,8 @@ static inline u32 sms_read_reg(u16 reg)
51 return __raw_readl(OMAP_SMS_REGADDR(reg)); 51 return __raw_readl(OMAP_SMS_REGADDR(reg));
52} 52}
53 53
54extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms);
55
54 56
55/** 57/**
56 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate 58 * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c
index 20cc950db4de..907291714643 100644
--- a/arch/arm/mach-omap2/sdrc2xxx.c
+++ b/arch/arm/mach-omap2/sdrc2xxx.c
@@ -27,7 +27,7 @@
27#include "soc.h" 27#include "soc.h"
28#include "iomap.h" 28#include "iomap.h"
29#include "common.h" 29#include "common.h"
30#include "prm2xxx_3xxx.h" 30#include "prm2xxx.h"
31#include "clock.h" 31#include "clock.h"
32#include "sdrc.h" 32#include "sdrc.h"
33#include "sram.h" 33#include "sram.h"
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index 7046c3c67181..d1dedc8195ed 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -28,8 +28,8 @@
28 28
29#include "omap34xx.h" 29#include "omap34xx.h"
30#include "iomap.h" 30#include "iomap.h"
31#include "cm2xxx_3xxx.h" 31#include "cm3xxx.h"
32#include "prm2xxx_3xxx.h" 32#include "prm3xxx.h"
33#include "sdrc.h" 33#include "sdrc.h"
34#include "sram.h" 34#include "sram.h"
35#include "control.h" 35#include "control.h"
diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index b0e77a407047..b9753fe27232 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -121,6 +121,19 @@ static int __init sr_dev_init(struct omap_hwmod *oh, void *user)
121 sr_data->senn_mod = 0x1; 121 sr_data->senn_mod = 0x1;
122 sr_data->senp_mod = 0x1; 122 sr_data->senp_mod = 0x1;
123 123
124 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
125 sr_data->err_weight = OMAP3430_SR_ERRWEIGHT;
126 sr_data->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT;
127 sr_data->accum_data = OMAP3430_SR_ACCUMDATA;
128 if (!(strcmp(sr_data->name, "smartreflex_mpu"))) {
129 sr_data->senn_avgweight = OMAP3430_SR1_SENNAVGWEIGHT;
130 sr_data->senp_avgweight = OMAP3430_SR1_SENPAVGWEIGHT;
131 } else {
132 sr_data->senn_avgweight = OMAP3430_SR2_SENNAVGWEIGHT;
133 sr_data->senp_avgweight = OMAP3430_SR2_SENPAVGWEIGHT;
134 }
135 }
136
124 sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name); 137 sr_data->voltdm = voltdm_lookup(sr_dev_attr->sensor_voltdm_name);
125 if (!sr_data->voltdm) { 138 if (!sr_data->voltdm) {
126 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n", 139 pr_err("%s: Unable to get voltage domain pointer for VDD %s\n",
diff --git a/arch/arm/mach-omap2/sram242x.S b/arch/arm/mach-omap2/sram242x.S
index 8f7326cd435b..680a7c56cc3e 100644
--- a/arch/arm/mach-omap2/sram242x.S
+++ b/arch/arm/mach-omap2/sram242x.S
@@ -34,8 +34,8 @@
34 34
35#include "soc.h" 35#include "soc.h"
36#include "iomap.h" 36#include "iomap.h"
37#include "prm2xxx_3xxx.h" 37#include "prm2xxx.h"
38#include "cm2xxx_3xxx.h" 38#include "cm2xxx.h"
39#include "sdrc.h" 39#include "sdrc.h"
40 40
41 .text 41 .text
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S
index b140d6578529..a1e9edd673f4 100644
--- a/arch/arm/mach-omap2/sram243x.S
+++ b/arch/arm/mach-omap2/sram243x.S
@@ -34,8 +34,8 @@
34 34
35#include "soc.h" 35#include "soc.h"
36#include "iomap.h" 36#include "iomap.h"
37#include "prm2xxx_3xxx.h" 37#include "prm2xxx.h"
38#include "cm2xxx_3xxx.h" 38#include "cm2xxx.h"
39#include "sdrc.h" 39#include "sdrc.h"
40 40
41 .text 41 .text
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S
index 2d0ceaa23fb8..1446331b576a 100644
--- a/arch/arm/mach-omap2/sram34xx.S
+++ b/arch/arm/mach-omap2/sram34xx.S
@@ -32,7 +32,7 @@
32#include "soc.h" 32#include "soc.h"
33#include "iomap.h" 33#include "iomap.h"
34#include "sdrc.h" 34#include "sdrc.h"
35#include "cm2xxx_3xxx.h" 35#include "cm3xxx.h"
36 36
37/* 37/*
38 * This file needs be built unconditionally as ARM to interoperate correctly 38 * This file needs be built unconditionally as ARM to interoperate correctly
diff --git a/arch/arm/mach-omap2/ti81xx.h b/arch/arm/mach-omap2/ti81xx.h
index 8f9843f78422..a1e6caf0dba6 100644
--- a/arch/arm/mach-omap2/ti81xx.h
+++ b/arch/arm/mach-omap2/ti81xx.h
@@ -22,6 +22,15 @@
22#define TI81XX_CTRL_BASE TI81XX_SCM_BASE 22#define TI81XX_CTRL_BASE TI81XX_SCM_BASE
23#define TI81XX_PRCM_BASE 0x48180000 23#define TI81XX_PRCM_BASE 0x48180000
24 24
25/*
26 * Adjust TAP register base such that omap3_check_revision accesses the correct
27 * TI81XX register for checking device ID (it adds 0x204 to tap base while
28 * TI81XX DEVICE ID register is at offset 0x600 from control base).
29 */
30#define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \
31 TI81XX_CONTROL_DEVICE_ID - 0x204)
32
33
25#define TI81XX_ARM_INTC_BASE 0x48200000 34#define TI81XX_ARM_INTC_BASE 0x48200000
26 35
27#endif /* __ASM_ARCH_TI81XX_H */ 36#endif /* __ASM_ARCH_TI81XX_H */
diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c
index 880249b17012..687aa86c0d5e 100644
--- a/arch/arm/mach-omap2/vc.c
+++ b/arch/arm/mach-omap2/vc.c
@@ -11,13 +11,20 @@
11#include <linux/delay.h> 11#include <linux/delay.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/bug.h> 13#include <linux/bug.h>
14#include <linux/io.h>
14 15
16#include <asm/div64.h>
17
18#include "iomap.h"
15#include "soc.h" 19#include "soc.h"
16#include "voltage.h" 20#include "voltage.h"
17#include "vc.h" 21#include "vc.h"
18#include "prm-regbits-34xx.h" 22#include "prm-regbits-34xx.h"
19#include "prm-regbits-44xx.h" 23#include "prm-regbits-44xx.h"
20#include "prm44xx.h" 24#include "prm44xx.h"
25#include "pm.h"
26#include "scrm44xx.h"
27#include "control.h"
21 28
22/** 29/**
23 * struct omap_vc_channel_cfg - describe the cfg_channel bitfield 30 * struct omap_vc_channel_cfg - describe the cfg_channel bitfield
@@ -63,6 +70,9 @@ static struct omap_vc_channel_cfg vc_mutant_channel_cfg = {
63}; 70};
64 71
65static struct omap_vc_channel_cfg *vc_cfg_bits; 72static struct omap_vc_channel_cfg *vc_cfg_bits;
73
74/* Default I2C trace length on pcb, 6.3cm. Used for capacitance calculations. */
75static u32 sr_i2c_pcb_length = 63;
66#define CFG_CHANNEL_MASK 0x1f 76#define CFG_CHANNEL_MASK 0x1f
67 77
68/** 78/**
@@ -135,6 +145,8 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm,
135 vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift); 145 vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift);
136 voltdm->write(vc_cmdval, vc->cmdval_reg); 146 voltdm->write(vc_cmdval, vc->cmdval_reg);
137 147
148 voltdm->vc_param->on = target_volt;
149
138 omap_vp_update_errorgain(voltdm, target_volt); 150 omap_vp_update_errorgain(voltdm, target_volt);
139 151
140 return 0; 152 return 0;
@@ -202,46 +214,389 @@ int omap_vc_bypass_scale(struct voltagedomain *voltdm,
202 return 0; 214 return 0;
203} 215}
204 216
205static void __init omap3_vfsm_init(struct voltagedomain *voltdm) 217/* Convert microsecond value to number of 32kHz clock cycles */
218static inline u32 omap_usec_to_32k(u32 usec)
219{
220 return DIV_ROUND_UP_ULL(32768ULL * (u64)usec, 1000000ULL);
221}
222
223/* Set oscillator setup time for omap3 */
224static void omap3_set_clksetup(u32 usec, struct voltagedomain *voltdm)
225{
226 voltdm->write(omap_usec_to_32k(usec), OMAP3_PRM_CLKSETUP_OFFSET);
227}
228
229/**
230 * omap3_set_i2c_timings - sets i2c sleep timings for a channel
231 * @voltdm: channel to configure
232 * @off_mode: select whether retention or off mode values used
233 *
234 * Calculates and sets up voltage controller to use I2C based
235 * voltage scaling for sleep modes. This can be used for either off mode
236 * or retention. Off mode has additionally an option to use sys_off_mode
237 * pad, which uses a global signal to program the whole power IC to
238 * off-mode.
239 */
240static void omap3_set_i2c_timings(struct voltagedomain *voltdm, bool off_mode)
206{ 241{
242 unsigned long voltsetup1;
243 u32 tgt_volt;
244
245 /*
246 * Oscillator is shut down only if we are using sys_off_mode pad,
247 * thus we set a minimal setup time here
248 */
249 omap3_set_clksetup(1, voltdm);
250
251 if (off_mode)
252 tgt_volt = voltdm->vc_param->off;
253 else
254 tgt_volt = voltdm->vc_param->ret;
255
256 voltsetup1 = (voltdm->vc_param->on - tgt_volt) /
257 voltdm->pmic->slew_rate;
258
259 voltsetup1 = voltsetup1 * voltdm->sys_clk.rate / 8 / 1000000 + 1;
260
261 voltdm->rmw(voltdm->vfsm->voltsetup_mask,
262 voltsetup1 << __ffs(voltdm->vfsm->voltsetup_mask),
263 voltdm->vfsm->voltsetup_reg);
264
207 /* 265 /*
208 * Voltage Manager FSM parameters init 266 * pmic is not controlling the voltage scaling during retention,
209 * XXX This data should be passed in from the board file 267 * thus set voltsetup2 to 0
210 */ 268 */
211 voltdm->write(OMAP3_CLKSETUP, OMAP3_PRM_CLKSETUP_OFFSET); 269 voltdm->write(0, OMAP3_PRM_VOLTSETUP2_OFFSET);
212 voltdm->write(OMAP3_VOLTOFFSET, OMAP3_PRM_VOLTOFFSET_OFFSET);
213 voltdm->write(OMAP3_VOLTSETUP2, OMAP3_PRM_VOLTSETUP2_OFFSET);
214} 270}
215 271
216static void __init omap3_vc_init_channel(struct voltagedomain *voltdm) 272/**
273 * omap3_set_off_timings - sets off-mode timings for a channel
274 * @voltdm: channel to configure
275 *
276 * Calculates and sets up off-mode timings for a channel. Off-mode
277 * can use either I2C based voltage scaling, or alternatively
278 * sys_off_mode pad can be used to send a global command to power IC.
279 * This function first checks which mode is being used, and calls
280 * omap3_set_i2c_timings() if the system is using I2C control mode.
281 * sys_off_mode has the additional benefit that voltages can be
282 * scaled to zero volt level with TWL4030 / TWL5030, I2C can only
283 * scale to 600mV.
284 */
285static void omap3_set_off_timings(struct voltagedomain *voltdm)
217{ 286{
218 static bool is_initialized; 287 unsigned long clksetup;
288 unsigned long voltsetup2;
289 unsigned long voltsetup2_old;
290 u32 val;
291 u32 tstart, tshut;
219 292
220 if (is_initialized) 293 /* check if sys_off_mode is used to control off-mode voltages */
294 val = voltdm->read(OMAP3_PRM_VOLTCTRL_OFFSET);
295 if (!(val & OMAP3430_SEL_OFF_MASK)) {
296 /* No, omap is controlling them over I2C */
297 omap3_set_i2c_timings(voltdm, true);
221 return; 298 return;
299 }
300
301 omap_pm_get_oscillator(&tstart, &tshut);
302 omap3_set_clksetup(tstart, voltdm);
303
304 clksetup = voltdm->read(OMAP3_PRM_CLKSETUP_OFFSET);
305
306 /* voltsetup 2 in us */
307 voltsetup2 = voltdm->vc_param->on / voltdm->pmic->slew_rate;
308
309 /* convert to 32k clk cycles */
310 voltsetup2 = DIV_ROUND_UP(voltsetup2 * 32768, 1000000);
311
312 voltsetup2_old = voltdm->read(OMAP3_PRM_VOLTSETUP2_OFFSET);
313
314 /*
315 * Update voltsetup2 if higher than current value (needed because
316 * we have multiple channels with different ramp times), also
317 * update voltoffset always to value recommended by TRM
318 */
319 if (voltsetup2 > voltsetup2_old) {
320 voltdm->write(voltsetup2, OMAP3_PRM_VOLTSETUP2_OFFSET);
321 voltdm->write(clksetup - voltsetup2,
322 OMAP3_PRM_VOLTOFFSET_OFFSET);
323 } else
324 voltdm->write(clksetup - voltsetup2_old,
325 OMAP3_PRM_VOLTOFFSET_OFFSET);
326
327 /*
328 * omap is not controlling voltage scaling during off-mode,
329 * thus set voltsetup1 to 0
330 */
331 voltdm->rmw(voltdm->vfsm->voltsetup_mask, 0,
332 voltdm->vfsm->voltsetup_reg);
333
334 /* voltoffset must be clksetup minus voltsetup2 according to TRM */
335 voltdm->write(clksetup - voltsetup2, OMAP3_PRM_VOLTOFFSET_OFFSET);
336}
337
338static void __init omap3_vc_init_channel(struct voltagedomain *voltdm)
339{
340 omap3_set_off_timings(voltdm);
341}
342
343/**
344 * omap4_calc_volt_ramp - calculates voltage ramping delays on omap4
345 * @voltdm: channel to calculate values for
346 * @voltage_diff: voltage difference in microvolts
347 *
348 * Calculates voltage ramp prescaler + counter values for a voltage
349 * difference on omap4. Returns a field value suitable for writing to
350 * VOLTSETUP register for a channel in following format:
351 * bits[8:9] prescaler ... bits[0:5] counter. See OMAP4 TRM for reference.
352 */
353static u32 omap4_calc_volt_ramp(struct voltagedomain *voltdm, u32 voltage_diff)
354{
355 u32 prescaler;
356 u32 cycles;
357 u32 time;
358
359 time = voltage_diff / voltdm->pmic->slew_rate;
360
361 cycles = voltdm->sys_clk.rate / 1000 * time / 1000;
362
363 cycles /= 64;
364 prescaler = 0;
365
366 /* shift to next prescaler until no overflow */
367
368 /* scale for div 256 = 64 * 4 */
369 if (cycles > 63) {
370 cycles /= 4;
371 prescaler++;
372 }
373
374 /* scale for div 512 = 256 * 2 */
375 if (cycles > 63) {
376 cycles /= 2;
377 prescaler++;
378 }
379
380 /* scale for div 2048 = 512 * 4 */
381 if (cycles > 63) {
382 cycles /= 4;
383 prescaler++;
384 }
385
386 /* check for overflow => invalid ramp time */
387 if (cycles > 63) {
388 pr_warn("%s: invalid setuptime for vdd_%s\n", __func__,
389 voltdm->name);
390 return 0;
391 }
392
393 cycles++;
222 394
223 omap3_vfsm_init(voltdm); 395 return (prescaler << OMAP4430_RAMP_UP_PRESCAL_SHIFT) |
396 (cycles << OMAP4430_RAMP_UP_COUNT_SHIFT);
397}
398
399/**
400 * omap4_usec_to_val_scrm - convert microsecond value to SCRM module bitfield
401 * @usec: microseconds
402 * @shift: number of bits to shift left
403 * @mask: bitfield mask
404 *
405 * Converts microsecond value to OMAP4 SCRM bitfield. Bitfield is
406 * shifted to requested position, and checked agains the mask value.
407 * If larger, forced to the max value of the field (i.e. the mask itself.)
408 * Returns the SCRM bitfield value.
409 */
410static u32 omap4_usec_to_val_scrm(u32 usec, int shift, u32 mask)
411{
412 u32 val;
413
414 val = omap_usec_to_32k(usec) << shift;
224 415
225 is_initialized = true; 416 /* Check for overflow, if yes, force to max value */
417 if (val > mask)
418 val = mask;
419
420 return val;
226} 421}
227 422
423/**
424 * omap4_set_timings - set voltage ramp timings for a channel
425 * @voltdm: channel to configure
426 * @off_mode: whether off-mode values are used
427 *
428 * Calculates and sets the voltage ramp up / down values for a channel.
429 */
430static void omap4_set_timings(struct voltagedomain *voltdm, bool off_mode)
431{
432 u32 val;
433 u32 ramp;
434 int offset;
435 u32 tstart, tshut;
436
437 if (off_mode) {
438 ramp = omap4_calc_volt_ramp(voltdm,
439 voltdm->vc_param->on - voltdm->vc_param->off);
440 offset = voltdm->vfsm->voltsetup_off_reg;
441 } else {
442 ramp = omap4_calc_volt_ramp(voltdm,
443 voltdm->vc_param->on - voltdm->vc_param->ret);
444 offset = voltdm->vfsm->voltsetup_reg;
445 }
446
447 if (!ramp)
448 return;
449
450 val = voltdm->read(offset);
451
452 val |= ramp << OMAP4430_RAMP_DOWN_COUNT_SHIFT;
453
454 val |= ramp << OMAP4430_RAMP_UP_COUNT_SHIFT;
455
456 voltdm->write(val, offset);
457
458 omap_pm_get_oscillator(&tstart, &tshut);
459
460 val = omap4_usec_to_val_scrm(tstart, OMAP4_SETUPTIME_SHIFT,
461 OMAP4_SETUPTIME_MASK);
462 val |= omap4_usec_to_val_scrm(tshut, OMAP4_DOWNTIME_SHIFT,
463 OMAP4_DOWNTIME_MASK);
464
465 __raw_writel(val, OMAP4_SCRM_CLKSETUPTIME);
466}
228 467
229/* OMAP4 specific voltage init functions */ 468/* OMAP4 specific voltage init functions */
230static void __init omap4_vc_init_channel(struct voltagedomain *voltdm) 469static void __init omap4_vc_init_channel(struct voltagedomain *voltdm)
231{ 470{
232 static bool is_initialized; 471 omap4_set_timings(voltdm, true);
233 u32 vc_val; 472 omap4_set_timings(voltdm, false);
473}
474
475struct i2c_init_data {
476 u8 loadbits;
477 u8 load;
478 u8 hsscll_38_4;
479 u8 hsscll_26;
480 u8 hsscll_19_2;
481 u8 hsscll_16_8;
482 u8 hsscll_12;
483};
234 484
235 if (is_initialized) 485static const __initdata struct i2c_init_data omap4_i2c_timing_data[] = {
486 {
487 .load = 50,
488 .loadbits = 0x3,
489 .hsscll_38_4 = 13,
490 .hsscll_26 = 11,
491 .hsscll_19_2 = 9,
492 .hsscll_16_8 = 9,
493 .hsscll_12 = 8,
494 },
495 {
496 .load = 25,
497 .loadbits = 0x2,
498 .hsscll_38_4 = 13,
499 .hsscll_26 = 11,
500 .hsscll_19_2 = 9,
501 .hsscll_16_8 = 9,
502 .hsscll_12 = 8,
503 },
504 {
505 .load = 12,
506 .loadbits = 0x1,
507 .hsscll_38_4 = 11,
508 .hsscll_26 = 10,
509 .hsscll_19_2 = 9,
510 .hsscll_16_8 = 9,
511 .hsscll_12 = 8,
512 },
513 {
514 .load = 0,
515 .loadbits = 0x0,
516 .hsscll_38_4 = 12,
517 .hsscll_26 = 10,
518 .hsscll_19_2 = 9,
519 .hsscll_16_8 = 8,
520 .hsscll_12 = 8,
521 },
522};
523
524/**
525 * omap4_vc_i2c_timing_init - sets up board I2C timing parameters
526 * @voltdm: voltagedomain pointer to get data from
527 *
528 * Use PMIC + board supplied settings for calculating the total I2C
529 * channel capacitance and set the timing parameters based on this.
530 * Pre-calculated values are provided in data tables, as it is not
531 * too straightforward to calculate these runtime.
532 */
533static void __init omap4_vc_i2c_timing_init(struct voltagedomain *voltdm)
534{
535 u32 capacitance;
536 u32 val;
537 u16 hsscll;
538 const struct i2c_init_data *i2c_data;
539
540 if (!voltdm->pmic->i2c_high_speed) {
541 pr_warn("%s: only high speed supported!\n", __func__);
236 return; 542 return;
543 }
544
545 /* PCB trace capacitance, 0.125pF / mm => mm / 8 */
546 capacitance = DIV_ROUND_UP(sr_i2c_pcb_length, 8);
547
548 /* OMAP pad capacitance */
549 capacitance += 4;
550
551 /* PMIC pad capacitance */
552 capacitance += voltdm->pmic->i2c_pad_load;
553
554 /* Search for capacitance match in the table */
555 i2c_data = omap4_i2c_timing_data;
556
557 while (i2c_data->load > capacitance)
558 i2c_data++;
559
560 /* Select proper values based on sysclk frequency */
561 switch (voltdm->sys_clk.rate) {
562 case 38400000:
563 hsscll = i2c_data->hsscll_38_4;
564 break;
565 case 26000000:
566 hsscll = i2c_data->hsscll_26;
567 break;
568 case 19200000:
569 hsscll = i2c_data->hsscll_19_2;
570 break;
571 case 16800000:
572 hsscll = i2c_data->hsscll_16_8;
573 break;
574 case 12000000:
575 hsscll = i2c_data->hsscll_12;
576 break;
577 default:
578 pr_warn("%s: unsupported sysclk rate: %d!\n", __func__,
579 voltdm->sys_clk.rate);
580 return;
581 }
237 582
238 /* XXX These are magic numbers and do not belong! */ 583 /* Loadbits define pull setup for the I2C channels */
239 vc_val = (0x60 << OMAP4430_SCLL_SHIFT | 0x26 << OMAP4430_SCLH_SHIFT); 584 val = i2c_data->loadbits << 25 | i2c_data->loadbits << 29;
240 voltdm->write(vc_val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
241 585
242 is_initialized = true; 586 /* Write to SYSCTRL_PADCONF_WKUP_CTRL_I2C_2 to setup I2C pull */
587 __raw_writel(val, OMAP2_L4_IO_ADDRESS(OMAP4_CTRL_MODULE_PAD_WKUP +
588 OMAP4_CTRL_MODULE_PAD_WKUP_CONTROL_I2C_2));
589
590 /* HSSCLH can always be zero */
591 val = hsscll << OMAP4430_HSSCLL_SHIFT;
592 val |= (0x28 << OMAP4430_SCLL_SHIFT | 0x2c << OMAP4430_SCLH_SHIFT);
593
594 /* Write setup times to I2C config register */
595 voltdm->write(val, OMAP4_PRM_VC_CFG_I2C_CLK_OFFSET);
243} 596}
244 597
598
599
245/** 600/**
246 * omap_vc_i2c_init - initialize I2C interface to PMIC 601 * omap_vc_i2c_init - initialize I2C interface to PMIC
247 * @voltdm: voltage domain containing VC data 602 * @voltdm: voltage domain containing VC data
@@ -281,9 +636,49 @@ static void __init omap_vc_i2c_init(struct voltagedomain *voltdm)
281 mcode << __ffs(vc->common->i2c_mcode_mask), 636 mcode << __ffs(vc->common->i2c_mcode_mask),
282 vc->common->i2c_cfg_reg); 637 vc->common->i2c_cfg_reg);
283 638
639 if (cpu_is_omap44xx())
640 omap4_vc_i2c_timing_init(voltdm);
641
284 initialized = true; 642 initialized = true;
285} 643}
286 644
645/**
646 * omap_vc_calc_vsel - calculate vsel value for a channel
647 * @voltdm: channel to calculate value for
648 * @uvolt: microvolt value to convert to vsel
649 *
650 * Converts a microvolt value to vsel value for the used PMIC.
651 * This checks whether the microvolt value is out of bounds, and
652 * adjusts the value accordingly. If unsupported value detected,
653 * warning is thrown.
654 */
655static u8 omap_vc_calc_vsel(struct voltagedomain *voltdm, u32 uvolt)
656{
657 if (voltdm->pmic->vddmin > uvolt)
658 uvolt = voltdm->pmic->vddmin;
659 if (voltdm->pmic->vddmax < uvolt) {
660 WARN(1, "%s: voltage not supported by pmic: %u vs max %u\n",
661 __func__, uvolt, voltdm->pmic->vddmax);
662 /* Lets try maximum value anyway */
663 uvolt = voltdm->pmic->vddmax;
664 }
665
666 return voltdm->pmic->uv_to_vsel(uvolt);
667}
668
669/**
670 * omap_pm_setup_sr_i2c_pcb_length - set length of SR I2C traces on PCB
671 * @mm: length of the PCB trace in millimetres
672 *
673 * Sets the PCB trace length for the I2C channel. By default uses 63mm.
674 * This is needed for properly calculating the capacitance value for
675 * the PCB trace, and for setting the SR I2C channel timing parameters.
676 */
677void __init omap_pm_setup_sr_i2c_pcb_length(u32 mm)
678{
679 sr_i2c_pcb_length = mm;
680}
681
287void __init omap_vc_init_channel(struct voltagedomain *voltdm) 682void __init omap_vc_init_channel(struct voltagedomain *voltdm)
288{ 683{
289 struct omap_vc_channel *vc = voltdm->vc; 684 struct omap_vc_channel *vc = voltdm->vc;
@@ -311,7 +706,6 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
311 vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr; 706 vc->i2c_slave_addr = voltdm->pmic->i2c_slave_addr;
312 vc->volt_reg_addr = voltdm->pmic->volt_reg_addr; 707 vc->volt_reg_addr = voltdm->pmic->volt_reg_addr;
313 vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr; 708 vc->cmd_reg_addr = voltdm->pmic->cmd_reg_addr;
314 vc->setup_time = voltdm->pmic->volt_setup_time;
315 709
316 /* Configure the i2c slave address for this VC */ 710 /* Configure the i2c slave address for this VC */
317 voltdm->rmw(vc->smps_sa_mask, 711 voltdm->rmw(vc->smps_sa_mask,
@@ -331,14 +725,18 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
331 voltdm->rmw(vc->smps_cmdra_mask, 725 voltdm->rmw(vc->smps_cmdra_mask,
332 vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask), 726 vc->cmd_reg_addr << __ffs(vc->smps_cmdra_mask),
333 vc->smps_cmdra_reg); 727 vc->smps_cmdra_reg);
334 vc->cfg_channel |= vc_cfg_bits->rac | vc_cfg_bits->racen; 728 vc->cfg_channel |= vc_cfg_bits->rac;
335 } 729 }
336 730
731 if (vc->cmd_reg_addr == vc->volt_reg_addr)
732 vc->cfg_channel |= vc_cfg_bits->racen;
733
337 /* Set up the on, inactive, retention and off voltage */ 734 /* Set up the on, inactive, retention and off voltage */
338 on_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->on_volt); 735 on_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->on);
339 onlp_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->onlp_volt); 736 onlp_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->onlp);
340 ret_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->ret_volt); 737 ret_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->ret);
341 off_vsel = voltdm->pmic->uv_to_vsel(voltdm->pmic->off_volt); 738 off_vsel = omap_vc_calc_vsel(voltdm, voltdm->vc_param->off);
739
342 val = ((on_vsel << vc->common->cmd_on_shift) | 740 val = ((on_vsel << vc->common->cmd_on_shift) |
343 (onlp_vsel << vc->common->cmd_onlp_shift) | 741 (onlp_vsel << vc->common->cmd_onlp_shift) |
344 (ret_vsel << vc->common->cmd_ret_shift) | 742 (ret_vsel << vc->common->cmd_ret_shift) |
@@ -349,11 +747,6 @@ void __init omap_vc_init_channel(struct voltagedomain *voltdm)
349 /* Channel configuration */ 747 /* Channel configuration */
350 omap_vc_config_channel(voltdm); 748 omap_vc_config_channel(voltdm);
351 749
352 /* Configure the setup times */
353 voltdm->rmw(voltdm->vfsm->voltsetup_mask,
354 vc->setup_time << __ffs(voltdm->vfsm->voltsetup_mask),
355 voltdm->vfsm->voltsetup_reg);
356
357 omap_vc_i2c_init(voltdm); 750 omap_vc_i2c_init(voltdm);
358 751
359 if (cpu_is_omap34xx()) 752 if (cpu_is_omap34xx())
diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h
index 478bf6b432c4..91c8d75bf2ea 100644
--- a/arch/arm/mach-omap2/vc.h
+++ b/arch/arm/mach-omap2/vc.h
@@ -86,7 +86,6 @@ struct omap_vc_channel {
86 u16 i2c_slave_addr; 86 u16 i2c_slave_addr;
87 u16 volt_reg_addr; 87 u16 volt_reg_addr;
88 u16 cmd_reg_addr; 88 u16 cmd_reg_addr;
89 u16 setup_time;
90 u8 cfg_channel; 89 u8 cfg_channel;
91 bool i2c_high_speed; 90 bool i2c_high_speed;
92 91
@@ -111,6 +110,13 @@ extern struct omap_vc_channel omap4_vc_mpu;
111extern struct omap_vc_channel omap4_vc_iva; 110extern struct omap_vc_channel omap4_vc_iva;
112extern struct omap_vc_channel omap4_vc_core; 111extern struct omap_vc_channel omap4_vc_core;
113 112
113extern struct omap_vc_param omap3_mpu_vc_data;
114extern struct omap_vc_param omap3_core_vc_data;
115
116extern struct omap_vc_param omap4_mpu_vc_data;
117extern struct omap_vc_param omap4_iva_vc_data;
118extern struct omap_vc_param omap4_core_vc_data;
119
114void omap_vc_init_channel(struct voltagedomain *voltdm); 120void omap_vc_init_channel(struct voltagedomain *voltdm);
115int omap_vc_pre_scale(struct voltagedomain *voltdm, 121int omap_vc_pre_scale(struct voltagedomain *voltdm,
116 unsigned long target_volt, 122 unsigned long target_volt,
diff --git a/arch/arm/mach-omap2/vc3xxx_data.c b/arch/arm/mach-omap2/vc3xxx_data.c
index 5d8eaf31569c..75bc4aa22b3a 100644
--- a/arch/arm/mach-omap2/vc3xxx_data.c
+++ b/arch/arm/mach-omap2/vc3xxx_data.c
@@ -71,3 +71,25 @@ struct omap_vc_channel omap3_vc_core = {
71 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK, 71 .smps_cmdra_mask = OMAP3430_CMDRA1_MASK,
72 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT, 72 .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT,
73}; 73};
74
75/*
76 * Voltage levels for different operating modes: on, sleep, retention and off
77 */
78#define OMAP3_ON_VOLTAGE_UV 1200000
79#define OMAP3_ONLP_VOLTAGE_UV 1000000
80#define OMAP3_RET_VOLTAGE_UV 975000
81#define OMAP3_OFF_VOLTAGE_UV 600000
82
83struct omap_vc_param omap3_mpu_vc_data = {
84 .on = OMAP3_ON_VOLTAGE_UV,
85 .onlp = OMAP3_ONLP_VOLTAGE_UV,
86 .ret = OMAP3_RET_VOLTAGE_UV,
87 .off = OMAP3_OFF_VOLTAGE_UV,
88};
89
90struct omap_vc_param omap3_core_vc_data = {
91 .on = OMAP3_ON_VOLTAGE_UV,
92 .onlp = OMAP3_ONLP_VOLTAGE_UV,
93 .ret = OMAP3_RET_VOLTAGE_UV,
94 .off = OMAP3_OFF_VOLTAGE_UV,
95};
diff --git a/arch/arm/mach-omap2/vc44xx_data.c b/arch/arm/mach-omap2/vc44xx_data.c
index d70b930f2739..085e5d6a04fd 100644
--- a/arch/arm/mach-omap2/vc44xx_data.c
+++ b/arch/arm/mach-omap2/vc44xx_data.c
@@ -87,3 +87,31 @@ struct omap_vc_channel omap4_vc_core = {
87 .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT, 87 .cfg_channel_sa_shift = OMAP4430_SA_VDD_CORE_L_SHIFT,
88}; 88};
89 89
90/*
91 * Voltage levels for different operating modes: on, sleep, retention and off
92 */
93#define OMAP4_ON_VOLTAGE_UV 1375000
94#define OMAP4_ONLP_VOLTAGE_UV 1375000
95#define OMAP4_RET_VOLTAGE_UV 837500
96#define OMAP4_OFF_VOLTAGE_UV 0
97
98struct omap_vc_param omap4_mpu_vc_data = {
99 .on = OMAP4_ON_VOLTAGE_UV,
100 .onlp = OMAP4_ONLP_VOLTAGE_UV,
101 .ret = OMAP4_RET_VOLTAGE_UV,
102 .off = OMAP4_OFF_VOLTAGE_UV,
103};
104
105struct omap_vc_param omap4_iva_vc_data = {
106 .on = OMAP4_ON_VOLTAGE_UV,
107 .onlp = OMAP4_ONLP_VOLTAGE_UV,
108 .ret = OMAP4_RET_VOLTAGE_UV,
109 .off = OMAP4_OFF_VOLTAGE_UV,
110};
111
112struct omap_vc_param omap4_core_vc_data = {
113 .on = OMAP4_ON_VOLTAGE_UV,
114 .onlp = OMAP4_ONLP_VOLTAGE_UV,
115 .ret = OMAP4_RET_VOLTAGE_UV,
116 .off = OMAP4_OFF_VOLTAGE_UV,
117};
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 7283b7ed7de8..a0ce4f10ff13 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -40,12 +40,14 @@ struct powerdomain;
40 * data 40 * data
41 * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register 41 * @voltsetup_mask: SETUP_TIME* bitmask in the PRM_VOLTSETUP* register
42 * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base 42 * @voltsetup_reg: register offset of PRM_VOLTSETUP from PRM base
43 * @voltsetup_off_reg: register offset of PRM_VOLTSETUP_OFF from PRM base
43 * 44 *
44 * XXX What about VOLTOFFSET/VOLTCTRL? 45 * XXX What about VOLTOFFSET/VOLTCTRL?
45 */ 46 */
46struct omap_vfsm_instance { 47struct omap_vfsm_instance {
47 u32 voltsetup_mask; 48 u32 voltsetup_mask;
48 u8 voltsetup_reg; 49 u8 voltsetup_reg;
50 u8 voltsetup_off_reg;
49}; 51};
50 52
51/** 53/**
@@ -74,6 +76,8 @@ struct voltagedomain {
74 const struct omap_vfsm_instance *vfsm; 76 const struct omap_vfsm_instance *vfsm;
75 struct omap_vp_instance *vp; 77 struct omap_vp_instance *vp;
76 struct omap_voltdm_pmic *pmic; 78 struct omap_voltdm_pmic *pmic;
79 struct omap_vp_param *vp_param;
80 struct omap_vc_param *vc_param;
77 81
78 /* VC/VP register access functions: SoC specific */ 82 /* VC/VP register access functions: SoC specific */
79 u32 (*read) (u8 offset); 83 u32 (*read) (u8 offset);
@@ -92,6 +96,24 @@ struct voltagedomain {
92 struct omap_volt_data *volt_data; 96 struct omap_volt_data *volt_data;
93}; 97};
94 98
99/* Min and max voltages from OMAP perspective */
100#define OMAP3430_VP1_VLIMITTO_VDDMIN 850000
101#define OMAP3430_VP1_VLIMITTO_VDDMAX 1425000
102#define OMAP3430_VP2_VLIMITTO_VDDMIN 900000
103#define OMAP3430_VP2_VLIMITTO_VDDMAX 1150000
104
105#define OMAP3630_VP1_VLIMITTO_VDDMIN 900000
106#define OMAP3630_VP1_VLIMITTO_VDDMAX 1350000
107#define OMAP3630_VP2_VLIMITTO_VDDMIN 900000
108#define OMAP3630_VP2_VLIMITTO_VDDMAX 1200000
109
110#define OMAP4_VP_MPU_VLIMITTO_VDDMIN 830000
111#define OMAP4_VP_MPU_VLIMITTO_VDDMAX 1410000
112#define OMAP4_VP_IVA_VLIMITTO_VDDMIN 830000
113#define OMAP4_VP_IVA_VLIMITTO_VDDMAX 1260000
114#define OMAP4_VP_CORE_VLIMITTO_VDDMIN 830000
115#define OMAP4_VP_CORE_VLIMITTO_VDDMAX 1200000
116
95/** 117/**
96 * struct omap_voltdm_pmic - PMIC specific data required by voltage driver. 118 * struct omap_voltdm_pmic - PMIC specific data required by voltage driver.
97 * @slew_rate: PMIC slew rate (in uv/us) 119 * @slew_rate: PMIC slew rate (in uv/us)
@@ -107,26 +129,34 @@ struct voltagedomain {
107struct omap_voltdm_pmic { 129struct omap_voltdm_pmic {
108 int slew_rate; 130 int slew_rate;
109 int step_size; 131 int step_size;
110 u32 on_volt;
111 u32 onlp_volt;
112 u32 ret_volt;
113 u32 off_volt;
114 u16 volt_setup_time;
115 u16 i2c_slave_addr; 132 u16 i2c_slave_addr;
116 u16 volt_reg_addr; 133 u16 volt_reg_addr;
117 u16 cmd_reg_addr; 134 u16 cmd_reg_addr;
118 u8 vp_erroroffset; 135 u8 vp_erroroffset;
119 u8 vp_vstepmin; 136 u8 vp_vstepmin;
120 u8 vp_vstepmax; 137 u8 vp_vstepmax;
121 u8 vp_vddmin; 138 u32 vddmin;
122 u8 vp_vddmax; 139 u32 vddmax;
123 u8 vp_timeout_us; 140 u8 vp_timeout_us;
124 bool i2c_high_speed; 141 bool i2c_high_speed;
142 u32 i2c_pad_load;
125 u8 i2c_mcode; 143 u8 i2c_mcode;
126 unsigned long (*vsel_to_uv) (const u8 vsel); 144 unsigned long (*vsel_to_uv) (const u8 vsel);
127 u8 (*uv_to_vsel) (unsigned long uV); 145 u8 (*uv_to_vsel) (unsigned long uV);
128}; 146};
129 147
148struct omap_vp_param {
149 u32 vddmax;
150 u32 vddmin;
151};
152
153struct omap_vc_param {
154 u32 on;
155 u32 onlp;
156 u32 ret;
157 u32 off;
158};
159
130void omap_voltage_get_volttable(struct voltagedomain *voltdm, 160void omap_voltage_get_volttable(struct voltagedomain *voltdm,
131 struct omap_volt_data **volt_data); 161 struct omap_volt_data **volt_data);
132struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, 162struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-omap2/voltagedomains3xxx_data.c b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
index 63afbfed3cbc..261bb7cb4e60 100644
--- a/arch/arm/mach-omap2/voltagedomains3xxx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains3xxx_data.c
@@ -117,6 +117,11 @@ void __init omap3xxx_voltagedomains_init(void)
117 } 117 }
118#endif 118#endif
119 119
120 omap3_voltdm_mpu.vp_param = &omap3_mpu_vp_data;
121 omap3_voltdm_core.vp_param = &omap3_core_vp_data;
122 omap3_voltdm_mpu.vc_param = &omap3_mpu_vc_data;
123 omap3_voltdm_core.vc_param = &omap3_core_vc_data;
124
120 if (soc_is_am35xx()) 125 if (soc_is_am35xx())
121 voltdms = voltagedomains_am35xx; 126 voltdms = voltagedomains_am35xx;
122 else 127 else
diff --git a/arch/arm/mach-omap2/voltagedomains44xx_data.c b/arch/arm/mach-omap2/voltagedomains44xx_data.c
index c3115f6853d4..48b22a0a0c88 100644
--- a/arch/arm/mach-omap2/voltagedomains44xx_data.c
+++ b/arch/arm/mach-omap2/voltagedomains44xx_data.c
@@ -22,7 +22,7 @@
22#include <linux/init.h> 22#include <linux/init.h>
23 23
24#include "common.h" 24#include "common.h"
25 25#include "soc.h"
26#include "prm-regbits-44xx.h" 26#include "prm-regbits-44xx.h"
27#include "prm44xx.h" 27#include "prm44xx.h"
28#include "prcm44xx.h" 28#include "prcm44xx.h"
@@ -34,14 +34,17 @@
34 34
35static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = { 35static const struct omap_vfsm_instance omap4_vdd_mpu_vfsm = {
36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET, 36 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_MPU_RET_SLEEP_OFFSET,
37 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_MPU_OFF_OFFSET,
37}; 38};
38 39
39static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = { 40static const struct omap_vfsm_instance omap4_vdd_iva_vfsm = {
40 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET, 41 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_IVA_RET_SLEEP_OFFSET,
42 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_IVA_OFF_OFFSET,
41}; 43};
42 44
43static const struct omap_vfsm_instance omap4_vdd_core_vfsm = { 45static const struct omap_vfsm_instance omap4_vdd_core_vfsm = {
44 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET, 46 .voltsetup_reg = OMAP4_PRM_VOLTSETUP_CORE_RET_SLEEP_OFFSET,
47 .voltsetup_off_reg = OMAP4_PRM_VOLTSETUP_CORE_OFF_OFFSET,
45}; 48};
46 49
47static struct voltagedomain omap4_voltdm_mpu = { 50static struct voltagedomain omap4_voltdm_mpu = {
@@ -101,11 +104,25 @@ void __init omap44xx_voltagedomains_init(void)
101 * for the currently-running IC 104 * for the currently-running IC
102 */ 105 */
103#ifdef CONFIG_PM_OPP 106#ifdef CONFIG_PM_OPP
104 omap4_voltdm_mpu.volt_data = omap44xx_vdd_mpu_volt_data; 107 if (cpu_is_omap443x()) {
105 omap4_voltdm_iva.volt_data = omap44xx_vdd_iva_volt_data; 108 omap4_voltdm_mpu.volt_data = omap443x_vdd_mpu_volt_data;
106 omap4_voltdm_core.volt_data = omap44xx_vdd_core_volt_data; 109 omap4_voltdm_iva.volt_data = omap443x_vdd_iva_volt_data;
110 omap4_voltdm_core.volt_data = omap443x_vdd_core_volt_data;
111 } else if (cpu_is_omap446x()) {
112 omap4_voltdm_mpu.volt_data = omap446x_vdd_mpu_volt_data;
113 omap4_voltdm_iva.volt_data = omap446x_vdd_iva_volt_data;
114 omap4_voltdm_core.volt_data = omap446x_vdd_core_volt_data;
115 }
107#endif 116#endif
108 117
118 omap4_voltdm_mpu.vp_param = &omap4_mpu_vp_data;
119 omap4_voltdm_iva.vp_param = &omap4_iva_vp_data;
120 omap4_voltdm_core.vp_param = &omap4_core_vp_data;
121
122 omap4_voltdm_mpu.vc_param = &omap4_mpu_vc_data;
123 omap4_voltdm_iva.vc_param = &omap4_iva_vc_data;
124 omap4_voltdm_core.vc_param = &omap4_core_vc_data;
125
109 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++) 126 for (i = 0; voltdm = voltagedomains_omap4[i], voltdm; i++)
110 voltdm->sys_clk.name = sys_clk_name; 127 voltdm->sys_clk.name = sys_clk_name;
111 128
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index 85241b828c02..a3c30655aa30 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -58,8 +58,10 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
58 sys_clk_rate = voltdm->sys_clk.rate / 1000; 58 sys_clk_rate = voltdm->sys_clk.rate / 1000;
59 59
60 timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000; 60 timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
61 vddmin = voltdm->pmic->vp_vddmin; 61 vddmin = max(voltdm->vp_param->vddmin, voltdm->pmic->vddmin);
62 vddmax = voltdm->pmic->vp_vddmax; 62 vddmax = min(voltdm->vp_param->vddmax, voltdm->pmic->vddmax);
63 vddmin = voltdm->pmic->uv_to_vsel(vddmin);
64 vddmax = voltdm->pmic->uv_to_vsel(vddmax);
63 65
64 waittime = DIV_ROUND_UP(voltdm->pmic->step_size * sys_clk_rate, 66 waittime = DIV_ROUND_UP(voltdm->pmic->step_size * sys_clk_rate,
65 1000 * voltdm->pmic->slew_rate); 67 1000 * voltdm->pmic->slew_rate);
@@ -138,7 +140,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm,
138 udelay(1); 140 udelay(1);
139 } 141 }
140 if (timeout >= VP_TRANXDONE_TIMEOUT) { 142 if (timeout >= VP_TRANXDONE_TIMEOUT) {
141 pr_warn("%s: vdd_%s TRANXDONE timeout exceeded. Voltage change aborted", 143 pr_warn("%s: vdd_%s TRANXDONE timeout exceeded. Voltage change aborted\n",
142 __func__, voltdm->name); 144 __func__, voltdm->name);
143 return -ETIMEDOUT; 145 return -ETIMEDOUT;
144 } 146 }
@@ -197,7 +199,7 @@ void omap_vp_enable(struct voltagedomain *voltdm)
197 u32 vpconfig, volt; 199 u32 vpconfig, volt;
198 200
199 if (!voltdm || IS_ERR(voltdm)) { 201 if (!voltdm || IS_ERR(voltdm)) {
200 pr_warning("%s: VDD specified does not exist!\n", __func__); 202 pr_warn("%s: VDD specified does not exist!\n", __func__);
201 return; 203 return;
202 } 204 }
203 205
@@ -214,8 +216,8 @@ void omap_vp_enable(struct voltagedomain *voltdm)
214 216
215 volt = voltdm_get_voltage(voltdm); 217 volt = voltdm_get_voltage(voltdm);
216 if (!volt) { 218 if (!volt) {
217 pr_warning("%s: unable to find current voltage for %s\n", 219 pr_warn("%s: unable to find current voltage for %s\n",
218 __func__, voltdm->name); 220 __func__, voltdm->name);
219 return; 221 return;
220 } 222 }
221 223
@@ -242,7 +244,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
242 int timeout; 244 int timeout;
243 245
244 if (!voltdm || IS_ERR(voltdm)) { 246 if (!voltdm || IS_ERR(voltdm)) {
245 pr_warning("%s: VDD specified does not exist!\n", __func__); 247 pr_warn("%s: VDD specified does not exist!\n", __func__);
246 return; 248 return;
247 } 249 }
248 250
@@ -272,8 +274,7 @@ void omap_vp_disable(struct voltagedomain *voltdm)
272 VP_IDLE_TIMEOUT, timeout); 274 VP_IDLE_TIMEOUT, timeout);
273 275
274 if (timeout >= VP_IDLE_TIMEOUT) 276 if (timeout >= VP_IDLE_TIMEOUT)
275 pr_warning("%s: vdd_%s idle timedout\n", 277 pr_warn("%s: vdd_%s idle timedout\n", __func__, voltdm->name);
276 __func__, voltdm->name);
277 278
278 vp->enabled = false; 279 vp->enabled = false;
279 280
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
index 7c155d248aa3..0fdf7080e4a6 100644
--- a/arch/arm/mach-omap2/vp.h
+++ b/arch/arm/mach-omap2/vp.h
@@ -117,6 +117,13 @@ extern struct omap_vp_instance omap4_vp_mpu;
117extern struct omap_vp_instance omap4_vp_iva; 117extern struct omap_vp_instance omap4_vp_iva;
118extern struct omap_vp_instance omap4_vp_core; 118extern struct omap_vp_instance omap4_vp_core;
119 119
120extern struct omap_vp_param omap3_mpu_vp_data;
121extern struct omap_vp_param omap3_core_vp_data;
122
123extern struct omap_vp_param omap4_mpu_vp_data;
124extern struct omap_vp_param omap4_iva_vp_data;
125extern struct omap_vp_param omap4_core_vp_data;
126
120void omap_vp_init(struct voltagedomain *voltdm); 127void omap_vp_init(struct voltagedomain *voltdm);
121void omap_vp_enable(struct voltagedomain *voltdm); 128void omap_vp_enable(struct voltagedomain *voltdm);
122void omap_vp_disable(struct voltagedomain *voltdm); 129void omap_vp_disable(struct voltagedomain *voltdm);
diff --git a/arch/arm/mach-omap2/vp3xxx_data.c b/arch/arm/mach-omap2/vp3xxx_data.c
index bd89f80089f5..1914e026245e 100644
--- a/arch/arm/mach-omap2/vp3xxx_data.c
+++ b/arch/arm/mach-omap2/vp3xxx_data.c
@@ -77,3 +77,13 @@ struct omap_vp_instance omap3_vp_core = {
77 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET, 77 .vstatus = OMAP3_PRM_VP2_STATUS_OFFSET,
78 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET, 78 .voltage = OMAP3_PRM_VP2_VOLTAGE_OFFSET,
79}; 79};
80
81struct omap_vp_param omap3_mpu_vp_data = {
82 .vddmin = OMAP3430_VP1_VLIMITTO_VDDMIN,
83 .vddmax = OMAP3430_VP1_VLIMITTO_VDDMAX,
84};
85
86struct omap_vp_param omap3_core_vp_data = {
87 .vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN,
88 .vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX,
89};
diff --git a/arch/arm/mach-omap2/vp44xx_data.c b/arch/arm/mach-omap2/vp44xx_data.c
index 8c031d16879e..e62f6b018beb 100644
--- a/arch/arm/mach-omap2/vp44xx_data.c
+++ b/arch/arm/mach-omap2/vp44xx_data.c
@@ -87,3 +87,18 @@ struct omap_vp_instance omap4_vp_core = {
87 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET, 87 .vstatus = OMAP4_PRM_VP_CORE_STATUS_OFFSET,
88 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET, 88 .voltage = OMAP4_PRM_VP_CORE_VOLTAGE_OFFSET,
89}; 89};
90
91struct omap_vp_param omap4_mpu_vp_data = {
92 .vddmin = OMAP4_VP_MPU_VLIMITTO_VDDMIN,
93 .vddmax = OMAP4_VP_MPU_VLIMITTO_VDDMAX,
94};
95
96struct omap_vp_param omap4_iva_vp_data = {
97 .vddmin = OMAP4_VP_IVA_VLIMITTO_VDDMIN,
98 .vddmax = OMAP4_VP_IVA_VLIMITTO_VDDMAX,
99};
100
101struct omap_vp_param omap4_core_vp_data = {
102 .vddmin = OMAP4_VP_CORE_VLIMITTO_VDDMIN,
103 .vddmax = OMAP4_VP_CORE_VLIMITTO_VDDMAX,
104};
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index f6b6c37ac3f4..7c2b4ed38f02 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -1,6 +1,8 @@
1/* 1/*
2 * OMAP2+ MPU WD_TIMER-specific code 2 * OMAP2+ MPU WD_TIMER-specific code
3 * 3 *
4 * Copyright (C) 2012 Texas Instruments, Inc.
5 *
4 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
@@ -11,10 +13,14 @@
11#include <linux/io.h> 13#include <linux/io.h>
12#include <linux/err.h> 14#include <linux/err.h>
13 15
14#include "omap_hwmod.h" 16#include <linux/platform_data/omap-wd-timer.h>
15 17
18#include "omap_hwmod.h"
19#include "omap_device.h"
16#include "wd_timer.h" 20#include "wd_timer.h"
17#include "common.h" 21#include "common.h"
22#include "prm.h"
23#include "soc.h"
18 24
19/* 25/*
20 * In order to avoid any assumptions from bootloader regarding WDT 26 * In order to avoid any assumptions from bootloader regarding WDT
@@ -26,9 +32,6 @@
26#define OMAP_WDT_WPS 0x34 32#define OMAP_WDT_WPS 0x34
27#define OMAP_WDT_SPR 0x48 33#define OMAP_WDT_SPR 0x48
28 34
29/* Maximum microseconds to wait for OMAP module to softreset */
30#define MAX_MODULE_SOFTRESET_WAIT 10000
31
32int omap2_wd_timer_disable(struct omap_hwmod *oh) 35int omap2_wd_timer_disable(struct omap_hwmod *oh)
33{ 36{
34 void __iomem *base; 37 void __iomem *base;
@@ -99,3 +102,32 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
99 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT : 102 return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
100 omap2_wd_timer_disable(oh); 103 omap2_wd_timer_disable(oh);
101} 104}
105
106static int __init omap_init_wdt(void)
107{
108 int id = -1;
109 struct platform_device *pdev;
110 struct omap_hwmod *oh;
111 char *oh_name = "wd_timer2";
112 char *dev_name = "omap_wdt";
113 struct omap_wd_timer_platform_data pdata;
114
115 if (!cpu_class_is_omap2() || of_have_populated_dt())
116 return 0;
117
118 oh = omap_hwmod_lookup(oh_name);
119 if (!oh) {
120 pr_err("Could not look up wd_timer%d hwmod\n", id);
121 return -EINVAL;
122 }
123
124 pdata.read_reset_sources = prm_read_reset_sources;
125
126 pdev = omap_device_build(dev_name, id, oh, &pdata,
127 sizeof(struct omap_wd_timer_platform_data),
128 NULL, 0, 0);
129 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
130 dev_name, oh->name);
131 return 0;
132}
133subsys_initcall(omap_init_wdt);
diff --git a/arch/arm/plat-omap/include/plat/prcm.h b/arch/arm/plat-omap/include/plat/prcm.h
deleted file mode 100644
index 267f43bb2a4e..000000000000
--- a/arch/arm/plat-omap/include/plat/prcm.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * arch/arm/plat-omap/include/mach/prcm.h
3 *
4 * Access definations for use in OMAP24XX clock and power management
5 *
6 * Copyright (C) 2005 Texas Instruments, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 * XXX This file is deprecated. The PRCM is an OMAP2+-only subsystem,
23 * so this file doesn't belong in plat-omap/include/plat. Please
24 * do not add anything new to this file.
25 */
26
27#ifndef __ASM_ARM_ARCH_OMAP_PRCM_H
28#define __ASM_ARM_ARCH_OMAP_PRCM_H
29
30u32 omap_prcm_get_reset_sources(void);
31int omap2_cm_wait_idlest(void __iomem *reg, u32 mask, u8 idlest,
32 const char *name);
33
34#endif
35
36
37