aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2012-11-09 17:13:43 -0500
committerTony Lindgren <tony@atomide.com>2012-11-09 17:13:43 -0500
commitc9d501e5cb0238910337213e12a09127221c35d8 (patch)
treea38418dc6a18b4138abbc81bb147d8aae0156f89
parent7fc54fd3084457c7f11b9e2e1e3fcd19a3badc33 (diff)
parentb99db36cdf37decb1b5575c5f293d170cbbc53d6 (diff)
Merge tag 'omap-cleanup-b2-for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/pjw/omap-pending into omap-for-v3.8/cleanup-prcm
Second set of OMAP PRCM cleanups for 3.8. These patches remove the use of omap_prcm_get_reset_sources() from the OMAP watchdog driver, and remove mach-omap2/prcm.c and plat-omap/include/plat/prcm.h. Basic test logs for this branch on top of Tony's cleanup-prcm branch at commit 7fc54fd3084457c7f11b9e2e1e3fcd19a3badc33 are here: http://www.pwsan.com/omap/testlogs/prcm_cleanup_b_3.8/20121108151646/ However, cleanup-prcm at 7fc54fd3 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_prcm_cleanup_b_3.8/20121108151930/ which indicate that the series tests cleanly. This second pull request updates one of the patches which broke with rmk's allnoconfigs, and also updates the tag description to indicate that 7fc54fd3 is building cleanly here.
-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.c9
-rw-r--r--arch/arm/mach-omap2/Makefile7
-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/clkt2xxx_apll.c57
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_dpllcore.c36
-rw-r--r--arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c70
-rw-r--r--arch/arm/mach-omap2/clkt_iclk.c1
-rw-r--r--arch/arm/mach-omap2/clock.c57
-rw-r--r--arch/arm/mach-omap2/clock.h28
-rw-r--r--arch/arm/mach-omap2/clock2420_data.c26
-rw-r--r--arch/arm/mach-omap2/clock2430_data.c26
-rw-r--r--arch/arm/mach-omap2/clock2xxx.c16
-rw-r--r--arch/arm/mach-omap2/clock2xxx.h9
-rw-r--r--arch/arm/mach-omap2/cm-regbits-24xx.h2
-rw-r--r--arch/arm/mach-omap2/cm.h20
-rw-r--r--arch/arm/mach-omap2/cm2xxx.c128
-rw-r--r--arch/arm/mach-omap2/cm2xxx.h4
-rw-r--r--arch/arm/mach-omap2/cm2xxx_3xxx.h8
-rw-r--r--arch/arm/mach-omap2/cm3xxx.c66
-rw-r--r--arch/arm/mach-omap2/cm3xxx.h5
-rw-r--r--arch/arm/mach-omap2/cm_common.c70
-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.c10
-rw-r--r--arch/arm/mach-omap2/control.h2
-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/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.c86
-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_hwmod.c8
-rw-r--r--arch/arm/mach-omap2/pm34xx.c1
-rw-r--r--arch/arm/mach-omap2/powerdomain.c2
-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.h24
-rw-r--r--arch/arm/mach-omap2/prm2xxx.c15
-rw-r--r--arch/arm/mach-omap2/prm2xxx.h2
-rw-r--r--arch/arm/mach-omap2/prm2xxx_3xxx.h7
-rw-r--r--arch/arm/mach-omap2/prm3xxx.c16
-rw-r--r--arch/arm/mach-omap2/prm3xxx.h2
-rw-r--r--arch/arm/mach-omap2/prm44xx.c1
-rw-r--r--arch/arm/mach-omap2/prm_common.c16
-rw-r--r--arch/arm/mach-omap2/prminst44xx.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/ti81xx.h9
-rw-r--r--arch/arm/mach-omap2/wd_timer.c40
-rw-r--r--arch/arm/plat-omap/include/plat/prcm.h37
-rw-r--r--drivers/watchdog/omap_wdt.c26
-rw-r--r--include/linux/platform_data/omap-wd-timer.h38
90 files changed, 991 insertions, 851 deletions
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h
index d6ac18d04da7..ecd0bb664dad 100644
--- a/arch/arm/mach-omap1/common.h
+++ b/arch/arm/mach-omap1/common.h
@@ -94,6 +94,6 @@ extern int ocpi_enable(void);
94static inline int ocpi_enable(void) { return 0; } 94static inline int ocpi_enable(void) { return 0; }
95#endif 95#endif
96 96
97extern int omap1_get_reset_sources(void); 97extern u32 omap1_get_reset_sources(void);
98 98
99#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ 99#endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 645668e2b1d5..745031870ce4 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>
@@ -448,18 +450,31 @@ static struct resource wdt_resources[] = {
448}; 450};
449 451
450static struct platform_device omap_wdt_device = { 452static struct platform_device omap_wdt_device = {
451 .name = "omap_wdt", 453 .name = "omap_wdt",
452 .id = -1, 454 .id = -1,
453 .num_resources = ARRAY_SIZE(wdt_resources), 455 .num_resources = ARRAY_SIZE(wdt_resources),
454 .resource = wdt_resources, 456 .resource = wdt_resources,
455}; 457};
456 458
457static int __init omap_init_wdt(void) 459static int __init omap_init_wdt(void)
458{ 460{
461 struct omap_wd_timer_platform_data pdata;
462 int ret;
463
459 if (!cpu_is_omap16xx()) 464 if (!cpu_is_omap16xx())
460 return -ENODEV; 465 return -ENODEV;
461 466
462 return platform_device_register(&omap_wdt_device); 467 pdata.read_reset_sources = omap1_get_reset_sources;
468
469 ret = platform_device_register(&omap_wdt_device);
470 if (!ret) {
471 ret = platform_device_add_data(&omap_wdt_device, &pdata,
472 sizeof(pdata));
473 if (ret)
474 platform_device_del(&omap_wdt_device);
475 }
476
477 return ret;
463} 478}
464subsys_initcall(omap_init_wdt); 479subsys_initcall(omap_init_wdt);
465#endif 480#endif
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c
index a0a9f97772ea..5eebd7e889d0 100644
--- a/arch/arm/mach-omap1/reset.c
+++ b/arch/arm/mach-omap1/reset.c
@@ -4,10 +4,9 @@
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
13/* ARM_SYSST bit shifts related to SoC reset sources */ 12/* ARM_SYSST bit shifts related to SoC reset sources */
@@ -43,12 +42,12 @@ void omap1_restart(char mode, const char *cmd)
43 * Returns bits that represent the last reset source for the SoC. The 42 * Returns bits that represent the last reset source for the SoC. The
44 * format is standardized across OMAPs for use by the OMAP watchdog. 43 * format is standardized across OMAPs for use by the OMAP watchdog.
45 */ 44 */
46int omap1_get_reset_sources(void) 45u32 omap1_get_reset_sources(void)
47{ 46{
48 int ret = 0; 47 u32 ret = 0;
49 u16 rs; 48 u16 rs;
50 49
51 rs = __raw_readw(ARM_SYSST); 50 rs = __raw_readw(OMAP1_IO_ADDRESS(ARM_SYSST));
52 51
53 if (rs & (1 << ARM_SYSST_POR_SHIFT)) 52 if (rs & (1 << ARM_SYSST_POR_SHIFT))
54 ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT; 53 ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT;
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index ae87a3ea53ae..96621a20413a 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -50,6 +50,11 @@ AFLAGS_sram242x.o :=-Wa,-march=armv6
50AFLAGS_sram243x.o :=-Wa,-march=armv6 50AFLAGS_sram243x.o :=-Wa,-march=armv6
51AFLAGS_sram34xx.o :=-Wa,-march=armv7-a 51AFLAGS_sram34xx.o :=-Wa,-march=armv7-a
52 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
53# Pin multiplexing 58# Pin multiplexing
54obj-$(CONFIG_SOC_OMAP2420) += mux2420.o 59obj-$(CONFIG_SOC_OMAP2420) += mux2420.o
55obj-$(CONFIG_SOC_OMAP2430) += mux2430.o 60obj-$(CONFIG_SOC_OMAP2430) += mux2430.o
@@ -94,7 +99,7 @@ obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o
94endif 99endif
95 100
96# PRCM 101# PRCM
97obj-y += prcm.o prm_common.o cm_common.o 102obj-y += prm_common.o cm_common.o
98obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o 103obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o
99obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o 104obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o
100obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o 105obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.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 3fc6d839fb3a..acb0a524ff7b 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -286,5 +286,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
286 .init_machine = omap_2430sdp_init, 286 .init_machine = omap_2430sdp_init,
287 .init_late = omap2430_init_late, 287 .init_late = omap2430_init_late,
288 .timer = &omap2_timer, 288 .timer = &omap2_timer,
289 .restart = omap_prcm_restart, 289 .restart = omap2xxx_restart,
290MACHINE_END 290MACHINE_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 cf9449bde186..488f86fd0e72 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -753,18 +753,18 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
753 .init_machine = cm_t35_init, 753 .init_machine = cm_t35_init,
754 .init_late = omap35xx_init_late, 754 .init_late = omap35xx_init_late,
755 .timer = &omap3_timer, 755 .timer = &omap3_timer,
756 .restart = omap_prcm_restart, 756 .restart = omap3xxx_restart,
757MACHINE_END 757MACHINE_END
758 758
759MACHINE_START(CM_T3730, "Compulab CM-T3730") 759MACHINE_START(CM_T3730, "Compulab CM-T3730")
760 .atag_offset = 0x100, 760 .atag_offset = 0x100,
761 .reserve = omap_reserve, 761 .reserve = omap_reserve,
762 .map_io = omap3_map_io, 762 .map_io = omap3_map_io,
763 .init_early = omap3630_init_early, 763 .init_early = omap3630_init_early,
764 .init_irq = omap3_init_irq, 764 .init_irq = omap3_init_irq,
765 .handle_irq = omap3_intc_handle_irq, 765 .handle_irq = omap3_intc_handle_irq,
766 .init_machine = cm_t3730_init, 766 .init_machine = cm_t3730_init,
767 .init_late = omap3630_init_late, 767 .init_late = omap3630_init_late,
768 .timer = &omap3_timer, 768 .timer = &omap3_timer,
769 .restart = omap_prcm_restart, 769 .restart = omap3xxx_restart,
770MACHINE_END 770MACHINE_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 bd11b0aa9495..3c1e458f68a1 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 85c09a09c5e3..8471c279ecd8 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -541,5 +541,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
541 .init_machine = omap3_beagle_init, 541 .init_machine = omap3_beagle_init,
542 .init_late = omap3_init_late, 542 .init_late = omap3_init_late,
543 .timer = &omap3_secure_timer, 543 .timer = &omap3_secure_timer,
544 .restart = omap_prcm_restart, 544 .restart = omap3xxx_restart,
545MACHINE_END 545MACHINE_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 1cfb0374f5e2..140b73094aff 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -553,5 +553,5 @@ MACHINE_START(OVERO, "Gumstix Overo")
553 .init_machine = overo_init, 553 .init_machine = overo_init,
554 .init_late = omap35xx_init_late, 554 .init_late = omap35xx_init_late,
555 .timer = &omap3_timer, 555 .timer = &omap3_timer,
556 .restart = omap_prcm_restart, 556 .restart = omap3xxx_restart,
557MACHINE_END 557MACHINE_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/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c
index e3f0c1e262a7..8c5b13e7ee61 100644
--- a/arch/arm/mach-omap2/clkt2xxx_apll.c
+++ b/arch/arm/mach-omap2/clkt2xxx_apll.c
@@ -21,7 +21,6 @@
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"
@@ -37,44 +36,16 @@
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 */ 41static int _apll96_enable(struct clk *clk)
45static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask)
46{
47 u32 cval, apll_mask;
48
49 apll_mask = EN_APLL_LOCKED << clk->enable_bit;
50
51 cval = 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
63 /*
64 * REVISIT: Should we return an error code if omap2_wait_clock_ready()
65 * fails?
66 */
67 return 0;
68}
69
70static int omap2_clk_apll96_enable(struct clk *clk)
71{ 42{
72 return omap2_clk_apll_enable(clk, OMAP24XX_ST_96M_APLL_MASK); 43 return omap2xxx_cm_apll96_enable();
73} 44}
74 45
75static int omap2_clk_apll54_enable(struct clk *clk) 46static int _apll54_enable(struct clk *clk)
76{ 47{
77 return omap2_clk_apll_enable(clk, OMAP24XX_ST_54M_APLL_MASK); 48 return omap2xxx_cm_apll54_enable();
78} 49}
79 50
80static void _apll96_allow_idle(struct clk *clk) 51static void _apll96_allow_idle(struct clk *clk)
@@ -97,28 +68,28 @@ static void _apll54_deny_idle(struct clk *clk)
97 omap2xxx_cm_set_apll54_disable_autoidle(); 68 omap2xxx_cm_set_apll54_disable_autoidle();
98} 69}
99 70
100/* Stop APLL */ 71static void _apll96_disable(struct clk *clk)
101static void omap2_clk_apll_disable(struct clk *clk)
102{ 72{
103 u32 cval; 73 omap2xxx_cm_apll96_disable();
74}
104 75
105 cval = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKEN); 76static void _apll54_disable(struct clk *clk)
106 cval &= ~(EN_APLL_LOCKED << clk->enable_bit); 77{
107 omap2_cm_write_mod_reg(cval, PLL_MOD, CM_CLKEN); 78 omap2xxx_cm_apll54_disable();
108} 79}
109 80
110/* Public data */ 81/* Public data */
111 82
112const struct clkops clkops_apll96 = { 83const struct clkops clkops_apll96 = {
113 .enable = omap2_clk_apll96_enable, 84 .enable = _apll96_enable,
114 .disable = omap2_clk_apll_disable, 85 .disable = _apll96_disable,
115 .allow_idle = _apll96_allow_idle, 86 .allow_idle = _apll96_allow_idle,
116 .deny_idle = _apll96_deny_idle, 87 .deny_idle = _apll96_deny_idle,
117}; 88};
118 89
119const struct clkops clkops_apll54 = { 90const struct clkops clkops_apll54 = {
120 .enable = omap2_clk_apll54_enable, 91 .enable = _apll54_enable,
121 .disable = omap2_clk_apll_disable, 92 .disable = _apll54_disable,
122 .allow_idle = _apll54_allow_idle, 93 .allow_idle = _apll54_allow_idle,
123 .deny_idle = _apll54_deny_idle, 94 .deny_idle = _apll54_deny_idle,
124}; 95};
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
index 3432f913f743..e687163a68fe 100644
--- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
+++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c
@@ -30,15 +30,21 @@
30#include "clock.h" 30#include "clock.h"
31#include "clock2xxx.h" 31#include "clock2xxx.h"
32#include "opp2xxx.h" 32#include "opp2xxx.h"
33#include "cm2xxx_3xxx.h" 33#include "cm2xxx.h"
34#include "cm-regbits-24xx.h" 34#include "cm-regbits-24xx.h"
35#include "sdrc.h" 35#include "sdrc.h"
36 36
37/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ 37/* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */
38 38
39/*
40 * dpll_core_ck: pointer to the combined dpll_ck + core_ck on OMAP2xxx
41 * (currently defined as "dpll_ck" in the OMAP2xxx clock tree). Set
42 * during dpll_ck init and used later by omap2xxx_clk_get_core_rate().
43 */
44static struct clk *dpll_core_ck;
45
39/** 46/**
40 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate 47 * omap2xxx_clk_get_core_rate - return the CORE_CLK rate
41 * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck")
42 * 48 *
43 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate 49 * Returns the CORE_CLK rate. CORE_CLK can have one of three rate
44 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz 50 * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz
@@ -46,12 +52,14 @@
46 * struct clk *dpll_ck, which is a composite clock of dpll_ck and 52 * struct clk *dpll_ck, which is a composite clock of dpll_ck and
47 * core_ck. 53 * core_ck.
48 */ 54 */
49unsigned long omap2xxx_clk_get_core_rate(struct clk *clk) 55unsigned long omap2xxx_clk_get_core_rate(void)
50{ 56{
51 long long core_clk; 57 long long core_clk;
52 u32 v; 58 u32 v;
53 59
54 core_clk = omap2_get_dpll_rate(clk); 60 WARN_ON(!dpll_core_ck);
61
62 core_clk = omap2_get_dpll_rate(dpll_core_ck);
55 63
56 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 64 v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
57 v &= OMAP24XX_CORE_CLK_SRC_MASK; 65 v &= OMAP24XX_CORE_CLK_SRC_MASK;
@@ -99,7 +107,7 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate)
99 107
100unsigned long omap2_dpllcore_recalc(struct clk *clk) 108unsigned long omap2_dpllcore_recalc(struct clk *clk)
101{ 109{
102 return omap2xxx_clk_get_core_rate(clk); 110 return omap2xxx_clk_get_core_rate();
103} 111}
104 112
105int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) 113int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
@@ -109,7 +117,7 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
109 struct prcm_config tmpset; 117 struct prcm_config tmpset;
110 const struct dpll_data *dd; 118 const struct dpll_data *dd;
111 119
112 cur_rate = omap2xxx_clk_get_core_rate(dclk); 120 cur_rate = omap2xxx_clk_get_core_rate();
113 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); 121 mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2);
114 mult &= OMAP24XX_CORE_CLK_SRC_MASK; 122 mult &= OMAP24XX_CORE_CLK_SRC_MASK;
115 123
@@ -170,3 +178,19 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate)
170 return 0; 178 return 0;
171} 179}
172 180
181/**
182 * omap2xxx_clkt_dpllcore_init - clk init function for dpll_ck
183 * @clk: struct clk *dpll_ck
184 *
185 * Store a local copy of @clk in dpll_core_ck so other code can query
186 * the core rate without having to clk_get(), which can sleep. Must
187 * only be called once. No return value. XXX If the clock
188 * registration process is ever changed such that dpll_ck is no longer
189 * statically defined, this code may need to change to increment some
190 * kind of use count on dpll_ck.
191 */
192void omap2xxx_clkt_dpllcore_init(struct clk *clk)
193{
194 WARN(dpll_core_ck, "dpll_core_ck already set - should never happen");
195 dpll_core_ck = clk;
196}
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c
index c66276b2bf0a..b9b981bac9d3 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:
@@ -39,13 +39,20 @@
39#include "clock.h" 39#include "clock.h"
40#include "clock2xxx.h" 40#include "clock2xxx.h"
41#include "opp2xxx.h" 41#include "opp2xxx.h"
42#include "cm2xxx_3xxx.h" 42#include "cm2xxx.h"
43#include "cm-regbits-24xx.h" 43#include "cm-regbits-24xx.h"
44#include "sdrc.h" 44#include "sdrc.h"
45 45
46const struct prcm_config *curr_prcm_set; 46const struct prcm_config *curr_prcm_set;
47const struct prcm_config *rate_table; 47const struct prcm_config *rate_table;
48 48
49/*
50 * sys_ck_rate: the rate of the external high-frequency clock
51 * oscillator on the board. Set by the SoC-specific clock init code.
52 * Once set during a boot, will not change.
53 */
54static unsigned long sys_ck_rate;
55
49/** 56/**
50 * omap2_table_mpu_recalc - just return the MPU speed 57 * omap2_table_mpu_recalc - just return the MPU speed
51 * @clk: virt_prcm_set struct clk 58 * @clk: virt_prcm_set struct clk
@@ -67,15 +74,14 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk)
67long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) 74long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
68{ 75{
69 const struct prcm_config *ptr; 76 const struct prcm_config *ptr;
70 long highest_rate, sys_clk_rate; 77 long highest_rate;
71 78
72 highest_rate = -EINVAL; 79 highest_rate = -EINVAL;
73 sys_clk_rate = __clk_get_rate(sclk);
74 80
75 for (ptr = rate_table; ptr->mpu_speed; ptr++) { 81 for (ptr = rate_table; ptr->mpu_speed; ptr++) {
76 if (!(ptr->flags & cpu_mask)) 82 if (!(ptr->flags & cpu_mask))
77 continue; 83 continue;
78 if (ptr->xtal_speed != sys_clk_rate) 84 if (ptr->xtal_speed != sys_ck_rate)
79 continue; 85 continue;
80 86
81 highest_rate = ptr->mpu_speed; 87 highest_rate = ptr->mpu_speed;
@@ -94,15 +100,12 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
94 const struct prcm_config *prcm; 100 const struct prcm_config *prcm;
95 unsigned long found_speed = 0; 101 unsigned long found_speed = 0;
96 unsigned long flags; 102 unsigned long flags;
97 long sys_clk_rate;
98
99 sys_clk_rate = __clk_get_rate(sclk);
100 103
101 for (prcm = rate_table; prcm->mpu_speed; prcm++) { 104 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
102 if (!(prcm->flags & cpu_mask)) 105 if (!(prcm->flags & cpu_mask))
103 continue; 106 continue;
104 107
105 if (prcm->xtal_speed != sys_clk_rate) 108 if (prcm->xtal_speed != sys_ck_rate)
106 continue; 109 continue;
107 110
108 if (prcm->mpu_speed <= rate) { 111 if (prcm->mpu_speed <= rate) {
@@ -118,7 +121,7 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
118 } 121 }
119 122
120 curr_prcm_set = prcm; 123 curr_prcm_set = prcm;
121 cur_rate = omap2xxx_clk_get_core_rate(dclk); 124 cur_rate = omap2xxx_clk_get_core_rate();
122 125
123 if (prcm->dpll_speed == cur_rate / 2) { 126 if (prcm->dpll_speed == cur_rate / 2) {
124 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1); 127 omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1);
@@ -168,3 +171,50 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate)
168 171
169 return 0; 172 return 0;
170} 173}
174
175/**
176 * omap2xxx_clkt_vps_check_bootloader_rate - determine which of the rate
177 * table sets matches the current CORE DPLL hardware rate
178 *
179 * Check the MPU rate set by bootloader. Sets the 'curr_prcm_set'
180 * global to point to the active rate set when found; otherwise, sets
181 * it to NULL. No return value;
182 */
183void omap2xxx_clkt_vps_check_bootloader_rates(void)
184{
185 const struct prcm_config *prcm = NULL;
186 unsigned long rate;
187
188 rate = omap2xxx_clk_get_core_rate();
189 for (prcm = rate_table; prcm->mpu_speed; prcm++) {
190 if (!(prcm->flags & cpu_mask))
191 continue;
192 if (prcm->xtal_speed != sys_ck_rate)
193 continue;
194 if (prcm->dpll_speed <= rate)
195 break;
196 }
197 curr_prcm_set = prcm;
198}
199
200/**
201 * omap2xxx_clkt_vps_late_init - store a copy of the sys_ck rate
202 *
203 * Store a copy of the sys_ck rate for later use by the OMAP2xxx DVFS
204 * code. (The sys_ck rate does not -- or rather, must not -- change
205 * during kernel runtime.) Must be called after we have a valid
206 * sys_ck rate, but before the virt_prcm_set clock rate is
207 * recalculated. No return value.
208 */
209void omap2xxx_clkt_vps_late_init(void)
210{
211 struct clk *c;
212
213 c = clk_get(NULL, "sys_ck");
214 if (IS_ERR(c)) {
215 WARN(1, "could not locate sys_ck\n");
216 } else {
217 sys_ck_rate = clk_get_rate(c);
218 clk_put(c);
219 }
220}
diff --git a/arch/arm/mach-omap2/clkt_iclk.c b/arch/arm/mach-omap2/clkt_iclk.c
index 7c8d41e49834..fe774a09dd0c 100644
--- a/arch/arm/mach-omap2/clkt_iclk.c
+++ b/arch/arm/mach-omap2/clkt_iclk.c
@@ -14,7 +14,6 @@
14#include <linux/clk.h> 14#include <linux/clk.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"
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 9205ea7d8dde..e381d991092c 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -26,17 +26,24 @@
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"
35#include "cm.h"
36#include "cm2xxx.h" 36#include "cm2xxx.h"
37#include "cm3xxx.h" 37#include "cm3xxx.h"
38#include "cm-regbits-24xx.h" 38#include "cm-regbits-24xx.h"
39#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
40 47
41u16 cpu_mask; 48u16 cpu_mask;
42 49
@@ -58,6 +65,40 @@ static DEFINE_SPINLOCK(clockfw_lock);
58 65
59/* Private functions */ 66/* Private functions */
60 67
68
69/**
70 * _wait_idlest_generic - wait for a module to leave the idle state
71 * @reg: virtual address of module IDLEST register
72 * @mask: value to mask against to determine if the module is active
73 * @idlest: idle state indicator (0 or 1) for the clock
74 * @name: name of the clock (for printk)
75 *
76 * Wait for a module to leave idle, where its idle-status register is
77 * not inside the CM module. Returns 1 if the module left idle
78 * promptly, or 0 if the module did not leave idle before the timeout
79 * elapsed. XXX Deprecated - should be moved into drivers for the
80 * individual IP block that the IDLEST register exists in.
81 */
82static int _wait_idlest_generic(void __iomem *reg, u32 mask, u8 idlest,
83 const char *name)
84{
85 int i = 0, ena = 0;
86
87 ena = (idlest) ? 0 : mask;
88
89 omap_test_timeout(((__raw_readl(reg) & mask) == ena),
90 MAX_MODULE_ENABLE_WAIT, i);
91
92 if (i < MAX_MODULE_ENABLE_WAIT)
93 pr_debug("omap clock: module associated with clock %s ready after %d loops\n",
94 name, i);
95 else
96 pr_err("omap clock: module associated with clock %s didn't enable in %d tries\n",
97 name, MAX_MODULE_ENABLE_WAIT);
98
99 return (i < MAX_MODULE_ENABLE_WAIT) ? 1 : 0;
100};
101
61/** 102/**
62 * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE 103 * _omap2_module_wait_ready - wait for an OMAP module to leave IDLE
63 * @clk: struct clk * belonging to the module 104 * @clk: struct clk * belonging to the module
@@ -71,7 +112,9 @@ static DEFINE_SPINLOCK(clockfw_lock);
71static void _omap2_module_wait_ready(struct clk *clk) 112static void _omap2_module_wait_ready(struct clk *clk)
72{ 113{
73 void __iomem *companion_reg, *idlest_reg; 114 void __iomem *companion_reg, *idlest_reg;
74 u8 other_bit, idlest_bit, idlest_val; 115 u8 other_bit, idlest_bit, idlest_val, idlest_reg_id;
116 s16 prcm_mod;
117 int r;
75 118
76 /* Not all modules have multiple clocks that their IDLEST depends on */ 119 /* Not all modules have multiple clocks that their IDLEST depends on */
77 if (clk->ops->find_companion) { 120 if (clk->ops->find_companion) {
@@ -82,8 +125,14 @@ static void _omap2_module_wait_ready(struct clk *clk)
82 125
83 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); 126 clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val);
84 127
85 omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val, 128 r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id);
86 __clk_get_name(clk)); 129 if (r) {
130 /* IDLEST register not in the CM module */
131 _wait_idlest_generic(idlest_reg, (1 << idlest_bit), idlest_val,
132 clk->name);
133 } else {
134 cm_wait_module_ready(prcm_mod, idlest_reg_id, idlest_bit);
135 };
87} 136}
88 137
89/* Public functions */ 138/* Public functions */
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index cfba1ffe5cc2..ff9789bc0fd1 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -409,33 +409,6 @@ extern void omap2_clkt_iclk_deny_idle(struct clk *clk);
409u32 omap2_get_dpll_rate(struct clk *clk); 409u32 omap2_get_dpll_rate(struct clk *clk);
410void omap2_init_dpll_parent(struct clk *clk); 410void omap2_init_dpll_parent(struct clk *clk);
411 411
412int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name);
413
414
415#ifdef CONFIG_ARCH_OMAP2
416void omap2xxx_clk_prepare_for_reboot(void);
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
439int omap2_dflt_clk_enable(struct clk *clk); 412int omap2_dflt_clk_enable(struct clk *clk);
440void omap2_dflt_clk_disable(struct clk *clk); 413void omap2_dflt_clk_disable(struct clk *clk);
441void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, 414void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,
@@ -454,7 +427,6 @@ extern const struct clkops clkops_dummy;
454extern const struct clkops clkops_omap2_dflt; 427extern const struct clkops clkops_omap2_dflt;
455 428
456extern struct clk_functions omap2_clk_functions; 429extern struct clk_functions omap2_clk_functions;
457extern struct clk *vclk, *sclk;
458 430
459extern const struct clksel_rate gpt_32k_rates[]; 431extern const struct clksel_rate gpt_32k_rates[];
460extern const struct clksel_rate gpt_sys_rates[]; 432extern const struct clksel_rate gpt_sys_rates[];
diff --git a/arch/arm/mach-omap2/clock2420_data.c b/arch/arm/mach-omap2/clock2420_data.c
index da1e388f22f7..608874b651e8 100644
--- a/arch/arm/mach-omap2/clock2420_data.c
+++ b/arch/arm/mach-omap2/clock2420_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2420 clock data 2 * OMAP2420 clock data
3 * 3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc. 4 * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation 5 * Copyright (C) 2004-2011 Nokia Corporation
6 * 6 *
7 * Contacts: 7 * Contacts:
@@ -124,6 +124,7 @@ static struct clk dpll_ck = {
124 .name = "dpll_ck", 124 .name = "dpll_ck",
125 .ops = &clkops_omap2xxx_dpll_ops, 125 .ops = &clkops_omap2xxx_dpll_ops,
126 .parent = &sys_ck, /* Can be func_32k also */ 126 .parent = &sys_ck, /* Can be func_32k also */
127 .init = &omap2xxx_clkt_dpllcore_init,
127 .dpll_data = &dpll_dd, 128 .dpll_data = &dpll_dd,
128 .clkdm_name = "wkup_clkdm", 129 .clkdm_name = "wkup_clkdm",
129 .recalc = &omap2_dpllcore_recalc, 130 .recalc = &omap2_dpllcore_recalc,
@@ -1924,12 +1925,9 @@ static struct omap_clk omap2420_clks[] = {
1924 1925
1925int __init omap2420_clk_init(void) 1926int __init omap2420_clk_init(void)
1926{ 1927{
1927 const struct prcm_config *prcm;
1928 struct omap_clk *c; 1928 struct omap_clk *c;
1929 u32 clkrate;
1930 1929
1931 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL; 1930 prcm_clksrc_ctrl = OMAP2420_PRCM_CLKSRC_CTRL;
1932 cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
1933 cpu_mask = RATE_IN_242X; 1931 cpu_mask = RATE_IN_242X;
1934 rate_table = omap2420_rate_table; 1932 rate_table = omap2420_rate_table;
1935 1933
@@ -1949,20 +1947,13 @@ int __init omap2420_clk_init(void)
1949 omap2_init_clk_clkdm(c->lk.clk); 1947 omap2_init_clk_clkdm(c->lk.clk);
1950 } 1948 }
1951 1949
1950 omap2xxx_clkt_vps_late_init();
1951
1952 /* Disable autoidle on all clocks; let the PM code enable it later */ 1952 /* Disable autoidle on all clocks; let the PM code enable it later */
1953 omap_clk_disable_autoidle_all(); 1953 omap_clk_disable_autoidle_all();
1954 1954
1955 /* Check the MPU rate set by bootloader */ 1955 /* XXX Can this be done from the virt_prcm_set clk init function? */
1956 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck); 1956 omap2xxx_clkt_vps_check_bootloader_rates();
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 1957
1967 recalculate_root_clocks(); 1958 recalculate_root_clocks();
1968 1959
@@ -1976,11 +1967,6 @@ int __init omap2420_clk_init(void)
1976 */ 1967 */
1977 clk_enable_init_clocks(); 1968 clk_enable_init_clocks();
1978 1969
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; 1970 return 0;
1985} 1971}
1986 1972
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c
index c97dafef894d..b179b6ef4329 100644
--- a/arch/arm/mach-omap2/clock2430_data.c
+++ b/arch/arm/mach-omap2/clock2430_data.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * OMAP2430 clock data 2 * OMAP2430 clock data
3 * 3 *
4 * Copyright (C) 2005-2009 Texas Instruments, Inc. 4 * Copyright (C) 2005-2009, 2012 Texas Instruments, Inc.
5 * Copyright (C) 2004-2011 Nokia Corporation 5 * Copyright (C) 2004-2011 Nokia Corporation
6 * 6 *
7 * Contacts: 7 * Contacts:
@@ -123,6 +123,7 @@ static struct clk dpll_ck = {
123 .name = "dpll_ck", 123 .name = "dpll_ck",
124 .ops = &clkops_omap2xxx_dpll_ops, 124 .ops = &clkops_omap2xxx_dpll_ops,
125 .parent = &sys_ck, /* Can be func_32k also */ 125 .parent = &sys_ck, /* Can be func_32k also */
126 .init = &omap2xxx_clkt_dpllcore_init,
126 .dpll_data = &dpll_dd, 127 .dpll_data = &dpll_dd,
127 .clkdm_name = "wkup_clkdm", 128 .clkdm_name = "wkup_clkdm",
128 .recalc = &omap2_dpllcore_recalc, 129 .recalc = &omap2_dpllcore_recalc,
@@ -2023,12 +2024,9 @@ static struct omap_clk omap2430_clks[] = {
2023 2024
2024int __init omap2430_clk_init(void) 2025int __init omap2430_clk_init(void)
2025{ 2026{
2026 const struct prcm_config *prcm;
2027 struct omap_clk *c; 2027 struct omap_clk *c;
2028 u32 clkrate;
2029 2028
2030 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL; 2029 prcm_clksrc_ctrl = OMAP2430_PRCM_CLKSRC_CTRL;
2031 cm_idlest_pll = OMAP_CM_REGADDR(PLL_MOD, CM_IDLEST);
2032 cpu_mask = RATE_IN_243X; 2030 cpu_mask = RATE_IN_243X;
2033 rate_table = omap2430_rate_table; 2031 rate_table = omap2430_rate_table;
2034 2032
@@ -2048,20 +2046,13 @@ int __init omap2430_clk_init(void)
2048 omap2_init_clk_clkdm(c->lk.clk); 2046 omap2_init_clk_clkdm(c->lk.clk);
2049 } 2047 }
2050 2048
2049 omap2xxx_clkt_vps_late_init();
2050
2051 /* Disable autoidle on all clocks; let the PM code enable it later */ 2051 /* Disable autoidle on all clocks; let the PM code enable it later */
2052 omap_clk_disable_autoidle_all(); 2052 omap_clk_disable_autoidle_all();
2053 2053
2054 /* Check the MPU rate set by bootloader */ 2054 /* XXX Can this be done from the virt_prcm_set clk init function? */
2055 clkrate = omap2xxx_clk_get_core_rate(&dpll_ck); 2055 omap2xxx_clkt_vps_check_bootloader_rates();
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 2056
2066 recalculate_root_clocks(); 2057 recalculate_root_clocks();
2067 2058
@@ -2075,11 +2066,6 @@ int __init omap2430_clk_init(void)
2075 */ 2066 */
2076 clk_enable_init_clocks(); 2067 clk_enable_init_clocks();
2077 2068
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; 2069 return 0;
2084} 2070}
2085 2071
diff --git a/arch/arm/mach-omap2/clock2xxx.c b/arch/arm/mach-omap2/clock2xxx.c
index 5feee16fee0e..5f7faeb4c19b 100644
--- a/arch/arm/mach-omap2/clock2xxx.c
+++ b/arch/arm/mach-omap2/clock2xxx.c
@@ -28,27 +28,11 @@
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;
32
33/* 31/*
34 * Omap24xx specific clock functions 32 * Omap24xx specific clock functions
35 */ 33 */
36 34
37/* 35/*
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 36 * 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 37 * 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. 38 * 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..ce809c913b6f 100644
--- a/arch/arm/mach-omap2/clock2xxx.h
+++ b/arch/arm/mach-omap2/clock2xxx.h
@@ -15,10 +15,13 @@ unsigned long omap2xxx_sys_clk_recalc(struct clk *clk);
15unsigned long omap2_osc_clk_recalc(struct clk *clk); 15unsigned long omap2_osc_clk_recalc(struct clk *clk);
16unsigned long omap2_dpllcore_recalc(struct clk *clk); 16unsigned long omap2_dpllcore_recalc(struct clk *clk);
17int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); 17int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate);
18unsigned long omap2xxx_clk_get_core_rate(struct clk *clk); 18unsigned long omap2xxx_clk_get_core_rate(void);
19u32 omap2xxx_get_apll_clkin(void); 19u32 omap2xxx_get_apll_clkin(void);
20u32 omap2xxx_get_sysclkdiv(void); 20u32 omap2xxx_get_sysclkdiv(void);
21void omap2xxx_clk_prepare_for_reboot(void); 21void omap2xxx_clk_prepare_for_reboot(void);
22void omap2xxx_clkt_dpllcore_init(struct clk *clk);
23void omap2xxx_clkt_vps_check_bootloader_rates(void);
24void omap2xxx_clkt_vps_late_init(void);
22 25
23#ifdef CONFIG_SOC_OMAP2420 26#ifdef CONFIG_SOC_OMAP2420
24int omap2420_clk_init(void); 27int omap2420_clk_init(void);
@@ -32,9 +35,7 @@ int omap2430_clk_init(void);
32#define omap2430_clk_init() do { } while(0) 35#define omap2430_clk_init() do { } while(0)
33#endif 36#endif
34 37
35extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll; 38extern void __iomem *prcm_clksrc_ctrl;
36
37extern struct clk *dclk;
38 39
39extern const struct clkops clkops_omap2430_i2chs_wait; 40extern const struct clkops clkops_omap2430_i2chs_wait;
40extern const struct clkops clkops_oscck; 41extern const struct clkops clkops_oscck;
diff --git a/arch/arm/mach-omap2/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h
index 686290437568..11eaf16880c4 100644
--- a/arch/arm/mach-omap2/cm-regbits-24xx.h
+++ b/arch/arm/mach-omap2/cm-regbits-24xx.h
@@ -333,7 +333,9 @@
333#define OMAP24XX_EN_DPLL_MASK (0x3 << 0) 333#define OMAP24XX_EN_DPLL_MASK (0x3 << 0)
334 334
335/* CM_IDLEST_CKGEN */ 335/* CM_IDLEST_CKGEN */
336#define OMAP24XX_ST_54M_APLL_SHIFT 9
336#define OMAP24XX_ST_54M_APLL_MASK (1 << 9) 337#define OMAP24XX_ST_54M_APLL_MASK (1 << 9)
338#define OMAP24XX_ST_96M_APLL_SHIFT 8
337#define OMAP24XX_ST_96M_APLL_MASK (1 << 8) 339#define OMAP24XX_ST_96M_APLL_MASK (1 << 8)
338#define OMAP24XX_ST_54M_CLK_MASK (1 << 6) 340#define OMAP24XX_ST_54M_CLK_MASK (1 << 6)
339#define OMAP24XX_ST_12M_CLK_MASK (1 << 5) 341#define OMAP24XX_ST_12M_CLK_MASK (1 << 5)
diff --git a/arch/arm/mach-omap2/cm.h b/arch/arm/mach-omap2/cm.h
index b3cee913dd67..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
@@ -37,8 +43,18 @@
37 43
38/** 44/**
39 * struct cm_ll_data - fn ptrs to per-SoC CM function implementations 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
40 */ 48 */
41struct cm_ll_data {}; 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);
42 58
43extern int cm_register(struct cm_ll_data *cld); 59extern int cm_register(struct cm_ll_data *cld);
44extern int cm_unregister(struct cm_ll_data *cld); 60extern int cm_unregister(struct cm_ll_data *cld);
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c
index 64165013daf9..db650690e9d0 100644
--- a/arch/arm/mach-omap2/cm2xxx.c
+++ b/arch/arm/mach-omap2/cm2xxx.c
@@ -35,6 +35,9 @@
35#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0 35#define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0
36#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3 36#define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3
37 37
38/* CM_IDLEST_PLL bit value offset for APLLs (OMAP2xxx only) */
39#define EN_APLL_LOCKED 3
40
38static const u8 omap2xxx_cm_idlest_offs[] = { 41static const u8 omap2xxx_cm_idlest_offs[] = {
39 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4 42 CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4
40}; 43};
@@ -99,7 +102,7 @@ void omap2xxx_cm_set_dpll_auto_low_power_stop(void)
99} 102}
100 103
101/* 104/*
102 * APLL autoidle control 105 * APLL control
103 */ 106 */
104 107
105static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask) 108static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask)
@@ -136,6 +139,102 @@ void omap2xxx_cm_set_apll96_auto_low_power_stop(void)
136 OMAP24XX_AUTO_96M_MASK); 139 OMAP24XX_AUTO_96M_MASK);
137} 140}
138 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
139/* 238/*
140 * 239 *
141 */ 240 */
@@ -253,3 +352,30 @@ struct clkdm_ops omap2_clkdm_operations = {
253 .clkdm_clk_disable = omap2xxx_clkdm_clk_disable, 352 .clkdm_clk_disable = omap2xxx_clkdm_clk_disable,
254}; 353};
255 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
index bce3c4be6d1f..4cbb39b051d2 100644
--- a/arch/arm/mach-omap2/cm2xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx.h
@@ -60,6 +60,10 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void);
60extern bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask); 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, 61extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
62 u8 idlest_shift); 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);
63 67
64#endif 68#endif
65 69
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h
index 0e26bb1bf7e2..98e6b3c9cd9b 100644
--- a/arch/arm/mach-omap2/cm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h
@@ -16,7 +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 20
21/* 21/*
22 * Module specific CM register offsets from CM_BASE + domain offset 22 * Module specific CM register offsets from CM_BASE + domain offset
@@ -96,6 +96,11 @@ static inline u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
96 return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx); 96 return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx);
97} 97}
98 98
99extern int omap2xxx_cm_apll54_enable(void);
100extern void omap2xxx_cm_apll54_disable(void);
101extern int omap2xxx_cm_apll96_enable(void);
102extern void omap2xxx_cm_apll96_disable(void);
103
99#endif 104#endif
100 105
101/* CM register bits shared between 24XX and 3430 */ 106/* CM register bits shared between 24XX and 3430 */
@@ -111,5 +116,4 @@ static inline u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)
111/* CM_IDLEST_GFX */ 116/* CM_IDLEST_GFX */
112#define OMAP_ST_GFX_MASK (1 << 0) 117#define OMAP_ST_GFX_MASK (1 << 0)
113 118
114
115#endif 119#endif
diff --git a/arch/arm/mach-omap2/cm3xxx.c b/arch/arm/mach-omap2/cm3xxx.c
index 8b03ec2f4394..c2086f2e86b6 100644
--- a/arch/arm/mach-omap2/cm3xxx.c
+++ b/arch/arm/mach-omap2/cm3xxx.c
@@ -110,6 +110,44 @@ int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift)
110 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; 110 return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY;
111} 111}
112 112
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)
124{
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;
149}
150
113/* Clockdomain low-level operations */ 151/* Clockdomain low-level operations */
114 152
115static int omap3xxx_clkdm_add_sleepdep(struct clockdomain *clkdm1, 153static int omap3xxx_clkdm_add_sleepdep(struct clockdomain *clkdm1,
@@ -597,3 +635,31 @@ void omap3_cm_restore_context(void)
597 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,
598 OMAP3_CM_CLKOUT_CTRL_OFFSET); 636 OMAP3_CM_CLKOUT_CTRL_OFFSET);
599} 637}
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
index 4a6ac812edf4..e8e146f4a43f 100644
--- a/arch/arm/mach-omap2/cm3xxx.h
+++ b/arch/arm/mach-omap2/cm3xxx.h
@@ -78,9 +78,14 @@ extern bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask);
78extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, 78extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id,
79 u8 idlest_shift); 79 u8 idlest_shift);
80 80
81extern int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg,
82 s16 *prcm_inst, u8 *idlest_reg_id);
83
81extern void omap3_cm_save_context(void); 84extern void omap3_cm_save_context(void);
82extern void omap3_cm_restore_context(void); 85extern void omap3_cm_restore_context(void);
83 86
87extern int __init omap3xxx_cm_init(void);
88
84#endif 89#endif
85 90
86#endif 91#endif
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c
index 3246cef151dc..0bab493ec133 100644
--- a/arch/arm/mach-omap2/cm_common.c
+++ b/arch/arm/mach-omap2/cm_common.c
@@ -2,7 +2,7 @@
2 * OMAP2+ common Clock Management (CM) IP block functions 2 * OMAP2+ common Clock Management (CM) IP block functions
3 * 3 *
4 * Copyright (C) 2012 Texas Instruments, Inc. 4 * Copyright (C) 2012 Texas Instruments, Inc.
5 * Paul Walmsley <paul@pwsan.com> 5 * Paul Walmsley
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 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 8 * it under the terms of the GNU General Public License version 2 as
@@ -17,6 +17,7 @@
17#include "cm2xxx.h" 17#include "cm2xxx.h"
18#include "cm3xxx.h" 18#include "cm3xxx.h"
19#include "cm44xx.h" 19#include "cm44xx.h"
20#include "common.h"
20 21
21/* 22/*
22 * cm_ll_data: function pointers to SoC-specific implementations of 23 * cm_ll_data: function pointers to SoC-specific implementations of
@@ -25,6 +26,73 @@
25static struct cm_ll_data null_cm_ll_data; 26static struct cm_ll_data null_cm_ll_data;
26static struct cm_ll_data *cm_ll_data = &null_cm_ll_data; 27static struct cm_ll_data *cm_ll_data = &null_cm_ll_data;
27 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
28/** 96/**
29 * cm_register - register per-SoC low-level data with the CM 97 * cm_register - register per-SoC low-level data with the CM
30 * @cld: low-level per-SoC OMAP CM data & function pointers to register 98 * @cld: low-level per-SoC OMAP CM data & function pointers to register
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 c925c805969f..c57eeeac7d11 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -43,54 +43,6 @@
43 43
44#define OMAP_INTC_START NR_IRQS 44#define OMAP_INTC_START NR_IRQS
45 45
46#ifdef CONFIG_SOC_OMAP2420
47extern void omap242x_map_common_io(void);
48#else
49static inline void omap242x_map_common_io(void)
50{
51}
52#endif
53
54#ifdef CONFIG_SOC_OMAP2430
55extern void omap243x_map_common_io(void);
56#else
57static inline void omap243x_map_common_io(void)
58{
59}
60#endif
61
62#ifdef CONFIG_ARCH_OMAP3
63extern void omap34xx_map_common_io(void);
64#else
65static inline void omap34xx_map_common_io(void)
66{
67}
68#endif
69
70#ifdef CONFIG_SOC_TI81XX
71extern void omapti81xx_map_common_io(void);
72#else
73static inline void omapti81xx_map_common_io(void)
74{
75}
76#endif
77
78#ifdef CONFIG_SOC_AM33XX
79extern void omapam33xx_map_common_io(void);
80#else
81static inline void omapam33xx_map_common_io(void)
82{
83}
84#endif
85
86#ifdef CONFIG_ARCH_OMAP4
87extern void omap44xx_map_common_io(void);
88#else
89static inline void omap44xx_map_common_io(void)
90{
91}
92#endif
93
94#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) 46#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2)
95int omap2_pm_init(void); 47int omap2_pm_init(void);
96#else 48#else
@@ -127,14 +79,6 @@ static inline int omap_mux_late_init(void)
127} 79}
128#endif 80#endif
129 81
130#ifdef CONFIG_SOC_OMAP5
131extern void omap5_map_common_io(void);
132#else
133static inline void omap5_map_common_io(void)
134{
135}
136#endif
137
138extern void omap2_init_common_infrastructure(void); 82extern void omap2_init_common_infrastructure(void);
139 83
140extern struct sys_timer omap2_timer; 84extern struct sys_timer omap2_timer;
@@ -167,52 +111,43 @@ void am35xx_init_late(void);
167void ti81xx_init_late(void); 111void ti81xx_init_late(void);
168void omap4430_init_late(void); 112void omap4430_init_late(void);
169int omap2_common_pm_late_init(void); 113int omap2_common_pm_late_init(void);
170void omap_prcm_restart(char, const char *);
171 114
172/* 115#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430)
173 * IO bases for various OMAP processors 116void omap2xxx_restart(char mode, const char *cmd);
174 * Except the tap base, rest all the io bases
175 * listed are physical addresses.
176 */
177struct omap_globals {
178 u32 class; /* OMAP class to detect */
179 void __iomem *tap; /* Control module ID code */
180 void __iomem *sdrc; /* SDRAM Controller */
181 void __iomem *sms; /* SDRAM Memory Scheduler */
182 void __iomem *ctrl; /* System Control Module */
183 void __iomem *ctrl_pad; /* PAD Control Module */
184 void __iomem *prm; /* Power and Reset Management */
185 void __iomem *cm; /* Clock Management */
186 void __iomem *cm2;
187 void __iomem *prcm_mpu;
188};
189
190void omap2_set_globals_242x(void);
191void omap2_set_globals_243x(void);
192void omap2_set_globals_3xxx(void);
193void omap2_set_globals_443x(void);
194void omap2_set_globals_5xxx(void);
195void omap2_set_globals_ti81xx(void);
196void omap2_set_globals_am33xx(void);
197
198/* These get called from omap2_set_globals_xxxx(), do not call these */
199void omap2_set_globals_tap(struct omap_globals *);
200#if defined(CONFIG_SOC_HAS_OMAP2_SDRC)
201void omap2_set_globals_sdrc(struct omap_globals *);
202#else 117#else
203static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 118static inline void omap2xxx_restart(char mode, const char *cmd)
204{ } 119{
120}
205#endif 121#endif
206void omap2_set_globals_control(struct omap_globals *); 122
207void omap2_set_globals_prcm(struct omap_globals *); 123#ifdef CONFIG_ARCH_OMAP3
208 124void omap3xxx_restart(char mode, const char *cmd);
209void omap242x_map_io(void); 125#else
210void omap243x_map_io(void); 126static inline void omap3xxx_restart(char mode, const char *cmd)
211void omap3_map_io(void); 127{
212void am33xx_map_io(void); 128}
213void omap4_map_io(void); 129#endif
214void omap5_map_io(void); 130
215void ti81xx_map_io(void); 131#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5)
132void omap44xx_restart(char mode, const char *cmd);
133#else
134static inline void omap44xx_restart(char mode, const char *cmd)
135{
136}
137#endif
138
139/* This gets called from mach-omap2/io.c, do not call this */
140void __init omap2_set_globals_tap(u32 class, void __iomem *tap);
141
142void __init omap242x_map_io(void);
143void __init omap243x_map_io(void);
144void __init omap3_map_io(void);
145void __init am33xx_map_io(void);
146void __init omap4_map_io(void);
147void __init omap5_map_io(void);
148void __init ti81xx_map_io(void);
149
150/* omap_barriers_init() is OMAP4 only */
216void omap_barriers_init(void); 151void omap_barriers_init(void);
217 152
218/** 153/**
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c
index 06375ad20917..2adb2683f074 100644
--- a/arch/arm/mach-omap2/control.c
+++ b/arch/arm/mach-omap2/control.c
@@ -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..4ca8747b3cc9 100644
--- a/arch/arm/mach-omap2/control.h
+++ b/arch/arm/mach-omap2/control.h
@@ -414,6 +414,8 @@ extern void omap_ctrl_write_dsp_boot_addr(u32 bootaddr);
414extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode); 414extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode);
415extern void omap3630_ctrl_disable_rta(void); 415extern void omap3630_ctrl_disable_rta(void);
416extern int omap3_ctrl_save_padconf(void); 416extern int omap3_ctrl_save_padconf(void);
417extern void omap2_set_globals_control(void __iomem *ctrl,
418 void __iomem *ctrl_pad);
417#else 419#else
418#define omap_ctrl_base_get() 0 420#define omap_ctrl_base_get() 0
419#define omap_ctrl_readb(x) 0 421#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/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 ad55b943108f..be092e8e5d85 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 cf2362ccb234..f1e121502789 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -559,11 +559,12 @@ void __init omap5xxx_check_revision(void)
559 * detect the exact revision later on in omap2_detect_revision() once map_io 559 * detect the exact revision later on in omap2_detect_revision() once map_io
560 * is done. 560 * is done.
561 */ 561 */
562void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) 562void __init omap2_set_globals_tap(u32 class, void __iomem *tap)
563{ 563{
564 omap_revision = omap2_globals->class; 564 omap_revision = class;
565 tap_base = omap2_globals->tap; 565 tap_base = tap;
566 566
567 /* XXX What is this intended to do? */
567 if (cpu_is_omap34xx()) 568 if (cpu_is_omap34xx())
568 tap_prod_id = 0x0210; 569 tap_prod_id = 0x0210;
569 else 570 else
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 4fadc7895579..c3472bd8e5a4 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -42,8 +42,15 @@
42#include "clock44xx.h" 42#include "clock44xx.h"
43#include "omap-pm.h" 43#include "omap-pm.h"
44#include "sdrc.h" 44#include "sdrc.h"
45#include "control.h"
45#include "serial.h" 46#include "serial.h"
46 47#include "cm2xxx.h"
48#include "cm3xxx.h"
49#include "prm.h"
50#include "cm.h"
51#include "prcm_mpu44xx.h"
52#include "prminst44xx.h"
53#include "cminst44xx.h"
47/* 54/*
48 * The machine specific code may provide the extra mapping besides the 55 * The machine specific code may provide the extra mapping besides the
49 * default mapping provided here. 56 * default mapping provided here.
@@ -265,7 +272,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = {
265#endif 272#endif
266 273
267#ifdef CONFIG_SOC_OMAP2420 274#ifdef CONFIG_SOC_OMAP2420
268void __init omap242x_map_common_io(void) 275void __init omap242x_map_io(void)
269{ 276{
270 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 277 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
271 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); 278 iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc));
@@ -273,7 +280,7 @@ void __init omap242x_map_common_io(void)
273#endif 280#endif
274 281
275#ifdef CONFIG_SOC_OMAP2430 282#ifdef CONFIG_SOC_OMAP2430
276void __init omap243x_map_common_io(void) 283void __init omap243x_map_io(void)
277{ 284{
278 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); 285 iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc));
279 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); 286 iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc));
@@ -281,28 +288,28 @@ void __init omap243x_map_common_io(void)
281#endif 288#endif
282 289
283#ifdef CONFIG_ARCH_OMAP3 290#ifdef CONFIG_ARCH_OMAP3
284void __init omap34xx_map_common_io(void) 291void __init omap3_map_io(void)
285{ 292{
286 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); 293 iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc));
287} 294}
288#endif 295#endif
289 296
290#ifdef CONFIG_SOC_TI81XX 297#ifdef CONFIG_SOC_TI81XX
291void __init omapti81xx_map_common_io(void) 298void __init ti81xx_map_io(void)
292{ 299{
293 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc)); 300 iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc));
294} 301}
295#endif 302#endif
296 303
297#ifdef CONFIG_SOC_AM33XX 304#ifdef CONFIG_SOC_AM33XX
298void __init omapam33xx_map_common_io(void) 305void __init am33xx_map_io(void)
299{ 306{
300 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); 307 iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc));
301} 308}
302#endif 309#endif
303 310
304#ifdef CONFIG_ARCH_OMAP4 311#ifdef CONFIG_ARCH_OMAP4
305void __init omap44xx_map_common_io(void) 312void __init omap4_map_io(void)
306{ 313{
307 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); 314 iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc));
308 omap_barriers_init(); 315 omap_barriers_init();
@@ -310,7 +317,7 @@ void __init omap44xx_map_common_io(void)
310#endif 317#endif
311 318
312#ifdef CONFIG_SOC_OMAP5 319#ifdef CONFIG_SOC_OMAP5
313void __init omap5_map_common_io(void) 320void __init omap5_map_io(void)
314{ 321{
315 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); 322 iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc));
316} 323}
@@ -377,8 +384,15 @@ static void __init omap_hwmod_init_postsetup(void)
377#ifdef CONFIG_SOC_OMAP2420 384#ifdef CONFIG_SOC_OMAP2420
378void __init omap2420_init_early(void) 385void __init omap2420_init_early(void)
379{ 386{
380 omap2_set_globals_242x(); 387 omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000));
388 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE),
389 OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE));
390 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE),
391 NULL);
392 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE));
393 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL);
381 omap2xxx_check_revision(); 394 omap2xxx_check_revision();
395 omap2xxx_cm_init();
382 omap_common_init_early(); 396 omap_common_init_early();
383 omap2xxx_voltagedomains_init(); 397 omap2xxx_voltagedomains_init();
384 omap242x_powerdomains_init(); 398 omap242x_powerdomains_init();
@@ -399,8 +413,15 @@ void __init omap2420_init_late(void)
399#ifdef CONFIG_SOC_OMAP2430 413#ifdef CONFIG_SOC_OMAP2430
400void __init omap2430_init_early(void) 414void __init omap2430_init_early(void)
401{ 415{
402 omap2_set_globals_243x(); 416 omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000));
417 omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE),
418 OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE));
419 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE),
420 NULL);
421 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE));
422 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL);
403 omap2xxx_check_revision(); 423 omap2xxx_check_revision();
424 omap2xxx_cm_init();
404 omap_common_init_early(); 425 omap_common_init_early();
405 omap2xxx_voltagedomains_init(); 426 omap2xxx_voltagedomains_init();
406 omap243x_powerdomains_init(); 427 omap243x_powerdomains_init();
@@ -425,9 +446,16 @@ void __init omap2430_init_late(void)
425#ifdef CONFIG_ARCH_OMAP3 446#ifdef CONFIG_ARCH_OMAP3
426void __init omap3_init_early(void) 447void __init omap3_init_early(void)
427{ 448{
428 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);
429 omap3xxx_check_revision(); 456 omap3xxx_check_revision();
430 omap3xxx_check_features(); 457 omap3xxx_check_features();
458 omap3xxx_cm_init();
431 omap_common_init_early(); 459 omap_common_init_early();
432 omap3xxx_voltagedomains_init(); 460 omap3xxx_voltagedomains_init();
433 omap3xxx_powerdomains_init(); 461 omap3xxx_powerdomains_init();
@@ -459,7 +487,12 @@ void __init am35xx_init_early(void)
459 487
460void __init ti81xx_init_early(void) 488void __init ti81xx_init_early(void)
461{ 489{
462 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);
463 omap3xxx_check_revision(); 496 omap3xxx_check_revision();
464 ti81xx_check_features(); 497 ti81xx_check_features();
465 omap_common_init_early(); 498 omap_common_init_early();
@@ -517,7 +550,12 @@ void __init ti81xx_init_late(void)
517#ifdef CONFIG_SOC_AM33XX 550#ifdef CONFIG_SOC_AM33XX
518void __init am33xx_init_early(void) 551void __init am33xx_init_early(void)
519{ 552{
520 omap2_set_globals_am33xx(); 553 omap2_set_globals_tap(AM335X_CLASS,
554 AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE));
555 omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE),
556 NULL);
557 omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE));
558 omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL);
521 omap3xxx_check_revision(); 559 omap3xxx_check_revision();
522 ti81xx_check_features(); 560 ti81xx_check_features();
523 omap_common_init_early(); 561 omap_common_init_early();
@@ -533,7 +571,16 @@ void __init am33xx_init_early(void)
533#ifdef CONFIG_ARCH_OMAP4 571#ifdef CONFIG_ARCH_OMAP4
534void __init omap4430_init_early(void) 572void __init omap4430_init_early(void)
535{ 573{
536 omap2_set_globals_443x(); 574 omap2_set_globals_tap(OMAP443X_CLASS,
575 OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE));
576 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE),
577 OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE));
578 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE));
579 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE),
580 OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE));
581 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE));
582 omap_prm_base_init();
583 omap_cm_base_init();
537 omap4xxx_check_revision(); 584 omap4xxx_check_revision();
538 omap4xxx_check_features(); 585 omap4xxx_check_features();
539 omap_common_init_early(); 586 omap_common_init_early();
@@ -556,7 +603,16 @@ void __init omap4430_init_late(void)
556#ifdef CONFIG_SOC_OMAP5 603#ifdef CONFIG_SOC_OMAP5
557void __init omap5_init_early(void) 604void __init omap5_init_early(void)
558{ 605{
559 omap2_set_globals_5xxx(); 606 omap2_set_globals_tap(OMAP54XX_CLASS,
607 OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE));
608 omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE),
609 OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE));
610 omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE));
611 omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE),
612 OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE));
613 omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE));
614 omap_prm_base_init();
615 omap_cm_base_init();
560 omap5xxx_check_revision(); 616 omap5xxx_check_revision();
561 omap_common_init_early(); 617 omap_common_init_early();
562} 618}
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 d25845c471da..64fce07a3ccd 100644
--- a/arch/arm/mach-omap2/omap4-common.c
+++ b/arch/arm/mach-omap2/omap4-common.c
@@ -29,9 +29,12 @@
29 29
30#include "omap-wakeupgen.h" 30#include "omap-wakeupgen.h"
31#include "soc.h" 31#include "soc.h"
32#include "iomap.h"
32#include "common.h" 33#include "common.h"
33#include "mmc.h" 34#include "mmc.h"
34#include "hsmmc.h" 35#include "hsmmc.h"
36#include "prminst44xx.h"
37#include "prcm_mpu44xx.h"
35#include "omap4-sar-layout.h" 38#include "omap4-sar-layout.h"
36#include "omap-secure.h" 39#include "omap-secure.h"
37 40
@@ -280,3 +283,19 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers)
280 return 0; 283 return 0;
281} 284}
282#endif 285#endif
286
287/**
288 * omap44xx_restart - trigger a software restart of the SoC
289 * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c
290 * @cmd: passed from the userspace program rebooting the system (if provided)
291 *
292 * Resets the SoC. For @cmd, see the 'reboot' syscall in
293 * kernel/sys.c. No return value.
294 */
295void omap44xx_restart(char mode, const char *cmd)
296{
297 /* XXX Should save 'cmd' into scratchpad for use after reboot */
298 omap4_prminst_global_warm_sw_reset(); /* never returns */
299 while (1);
300}
301
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 37eeb45612f8..139adca3bda1 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -141,7 +141,6 @@
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"
@@ -151,6 +150,7 @@
151#include "cm3xxx.h" 150#include "cm3xxx.h"
152#include "cminst44xx.h" 151#include "cminst44xx.h"
153#include "cm33xx.h" 152#include "cm33xx.h"
153#include "prm.h"
154#include "prm3xxx.h" 154#include "prm3xxx.h"
155#include "prm44xx.h" 155#include "prm44xx.h"
156#include "prm33xx.h" 156#include "prm33xx.h"
@@ -158,9 +158,6 @@
158#include "mux.h" 158#include "mux.h"
159#include "pm.h" 159#include "pm.h"
160 160
161/* Maximum microseconds to wait for OMAP module to softreset */
162#define MAX_MODULE_SOFTRESET_WAIT 10000
163
164/* Name of the OMAP hwmod for the MPU */ 161/* Name of the OMAP hwmod for the MPU */
165#define MPU_INITIATOR_NAME "mpu" 162#define MPU_INITIATOR_NAME "mpu"
166 163
@@ -2064,7 +2061,8 @@ static int _enable(struct omap_hwmod *oh)
2064 _enable_sysc(oh); 2061 _enable_sysc(oh);
2065 } 2062 }
2066 } else { 2063 } else {
2067 _omap4_disable_module(oh); 2064 if (soc_ops.disable_module)
2065 soc_ops.disable_module(oh);
2068 _disable_clocks(oh); 2066 _disable_clocks(oh);
2069 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", 2067 pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n",
2070 oh->name, r); 2068 oh->name, r);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 2f1ad87c1bb0..aa701d76efda 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -37,7 +37,6 @@
37 37
38#include "clockdomain.h" 38#include "clockdomain.h"
39#include "powerdomain.h" 39#include "powerdomain.h"
40#include <plat/prcm.h>
41#include <plat-omap/dma-omap.h> 40#include <plat-omap/dma-omap.h>
42 41
43#include "../plat-omap/sram.h" 42#include "../plat-omap/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/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.h b/arch/arm/mach-omap2/prm.h
index c30ab5de8d1d..a1a266ce90da 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 *
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c
index e2860f9c111d..bf24fc47603b 100644
--- a/arch/arm/mach-omap2/prm2xxx.c
+++ b/arch/arm/mach-omap2/prm2xxx.c
@@ -20,7 +20,6 @@
20 20
21#include "common.h" 21#include "common.h"
22#include <plat/cpu.h> 22#include <plat/cpu.h>
23#include <plat/prcm.h>
24 23
25#include "vp.h" 24#include "vp.h"
26#include "powerdomain.h" 25#include "powerdomain.h"
@@ -69,6 +68,20 @@ static u32 omap2xxx_prm_read_reset_sources(void)
69 return r; 68 return r;
70} 69}
71 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
72int omap2xxx_clkdm_sleep(struct clockdomain *clkdm) 85int omap2xxx_clkdm_sleep(struct clockdomain *clkdm)
73{ 86{
74 omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK, 87 omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK,
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h
index 1d97112524f1..fe8a14f190ab 100644
--- a/arch/arm/mach-omap2/prm2xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx.h
@@ -124,6 +124,8 @@
124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm); 124extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm);
125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm); 125extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm);
126 126
127extern void omap2xxx_prm_dpll_reset(void);
128
127extern int __init prm2xxx_init(void); 129extern int __init prm2xxx_init(void);
128extern int __exit prm2xxx_exit(void); 130extern int __exit prm2xxx_exit(void);
129 131
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h
index 3330b1bf789d..78532d6fecd7 100644
--- a/arch/arm/mach-omap2/prm2xxx_3xxx.h
+++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h
@@ -241,11 +241,4 @@ extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm);
241#define OMAP_LOGICRETSTATE_MASK (1 << 2) 241#define OMAP_LOGICRETSTATE_MASK (1 << 2)
242 242
243 243
244/*
245 * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP
246 * submodule to exit hardreset
247 */
248#define MAX_MODULE_HARDRESET_WAIT 10000
249
250
251#endif 244#endif
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c
index 1fea656b2ca8..b86116cf0db9 100644
--- a/arch/arm/mach-omap2/prm3xxx.c
+++ b/arch/arm/mach-omap2/prm3xxx.c
@@ -20,7 +20,6 @@
20 20
21#include "common.h" 21#include "common.h"
22#include <plat/cpu.h> 22#include <plat/cpu.h>
23#include <plat/prcm.h>
24 23
25#include "vp.h" 24#include "vp.h"
26#include "powerdomain.h" 25#include "powerdomain.h"
@@ -123,6 +122,21 @@ u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset)
123} 122}
124 123
125/** 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/**
126 * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events 140 * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events
127 * @events: ptr to a u32, preallocated by caller 141 * @events: ptr to a u32, preallocated by caller
128 * 142 *
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h
index a3c28a875410..10cd41a8129e 100644
--- a/arch/arm/mach-omap2/prm3xxx.h
+++ b/arch/arm/mach-omap2/prm3xxx.h
@@ -152,6 +152,8 @@ extern void omap3xxx_prm_ocp_barrier(void);
152extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask); 152extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask);
153extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); 153extern void omap3xxx_prm_restore_irqen(u32 *saved_mask);
154 154
155extern void omap3xxx_prm_dpll3_reset(void);
156
155extern u32 omap3xxx_prm_get_reset_sources(void); 157extern u32 omap3xxx_prm_get_reset_sources(void);
156 158
157#endif /* __ASSEMBLER */ 159#endif /* __ASSEMBLER */
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c
index a799e9552fbf..6d3467af205d 100644
--- a/arch/arm/mach-omap2/prm44xx.c
+++ b/arch/arm/mach-omap2/prm44xx.c
@@ -18,7 +18,6 @@
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/io.h> 19#include <linux/io.h>
20 20
21#include <plat/prcm.h>
22 21
23#include "soc.h" 22#include "soc.h"
24#include "iomap.h" 23#include "iomap.h"
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c
index 6c595798c5c5..d2e0798a4c82 100644
--- a/arch/arm/mach-omap2/prm_common.c
+++ b/arch/arm/mach-omap2/prm_common.c
@@ -25,12 +25,12 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26 26
27#include "../plat-omap/common.h" 27#include "../plat-omap/common.h"
28#include <plat/prcm.h>
29 28
30#include "prm2xxx_3xxx.h" 29#include "prm2xxx_3xxx.h"
31#include "prm2xxx.h" 30#include "prm2xxx.h"
32#include "prm3xxx.h" 31#include "prm3xxx.h"
33#include "prm44xx.h" 32#include "prm44xx.h"
33#include "common.h"
34 34
35/* 35/*
36 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs 36 * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs
@@ -55,6 +55,9 @@ static struct irq_chip_generic **prcm_irq_chips;
55 */ 55 */
56static struct omap_prcm_irq_setup *prcm_irq_setup; 56static struct omap_prcm_irq_setup *prcm_irq_setup;
57 57
58/* prm_base: base virtual address of the PRM IP block */
59void __iomem *prm_base;
60
58/* 61/*
59 * prm_ll_data: function pointers to SoC-specific implementations of 62 * prm_ll_data: function pointers to SoC-specific implementations of
60 * common PRM functions 63 * common PRM functions
@@ -329,6 +332,17 @@ err:
329} 332}
330 333
331/** 334/**
335 * omap2_set_globals_prm - set the PRM base address (for early use)
336 * @prm: PRM base virtual address
337 *
338 * XXX Will be replaced when the PRM/CM drivers are completed.
339 */
340void __init omap2_set_globals_prm(void __iomem *prm)
341{
342 prm_base = prm;
343}
344
345/**
332 * prm_read_reset_sources - return the sources of the SoC's last reset 346 * prm_read_reset_sources - return the sources of the SoC's last reset
333 * 347 *
334 * Return a u32 bitmask representing the reset sources that caused the 348 * Return a u32 bitmask representing the reset sources that caused the
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/sdrc.c b/arch/arm/mach-omap2/sdrc.c
index 94d4082f87ed..3ed0d62333c5 100644
--- a/arch/arm/mach-omap2/sdrc.c
+++ b/arch/arm/mach-omap2/sdrc.c
@@ -114,12 +114,10 @@ int omap2_sdrc_get_params(unsigned long r,
114} 114}
115 115
116 116
117void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) 117void __init omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms)
118{ 118{
119 if (omap2_globals->sdrc) 119 omap2_sdrc_base = sdrc;
120 omap2_sdrc_base = omap2_globals->sdrc; 120 omap2_sms_base = sms;
121 if (omap2_globals->sms)
122 omap2_sms_base = omap2_globals->sms;
123} 121}
124 122
125/** 123/**
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/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/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
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index f5db18dbc0f9..477a1d47a64c 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -46,8 +46,8 @@
46#include <linux/slab.h> 46#include <linux/slab.h>
47#include <linux/pm_runtime.h> 47#include <linux/pm_runtime.h>
48#include <mach/hardware.h> 48#include <mach/hardware.h>
49#include <plat/cpu.h> 49
50#include <plat/prcm.h> 50#include <linux/platform_data/omap-wd-timer.h>
51 51
52#include "omap_wdt.h" 52#include "omap_wdt.h"
53 53
@@ -202,8 +202,10 @@ static ssize_t omap_wdt_write(struct file *file, const char __user *data,
202static long omap_wdt_ioctl(struct file *file, unsigned int cmd, 202static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
203 unsigned long arg) 203 unsigned long arg)
204{ 204{
205 struct omap_wd_timer_platform_data *pdata;
205 struct omap_wdt_dev *wdev; 206 struct omap_wdt_dev *wdev;
206 int new_margin; 207 u32 rs;
208 int new_margin, bs;
207 static const struct watchdog_info ident = { 209 static const struct watchdog_info ident = {
208 .identity = "OMAP Watchdog", 210 .identity = "OMAP Watchdog",
209 .options = WDIOF_SETTIMEOUT, 211 .options = WDIOF_SETTIMEOUT,
@@ -211,6 +213,7 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
211 }; 213 };
212 214
213 wdev = file->private_data; 215 wdev = file->private_data;
216 pdata = wdev->dev->platform_data;
214 217
215 switch (cmd) { 218 switch (cmd) {
216 case WDIOC_GETSUPPORT: 219 case WDIOC_GETSUPPORT:
@@ -219,17 +222,12 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
219 case WDIOC_GETSTATUS: 222 case WDIOC_GETSTATUS:
220 return put_user(0, (int __user *)arg); 223 return put_user(0, (int __user *)arg);
221 case WDIOC_GETBOOTSTATUS: 224 case WDIOC_GETBOOTSTATUS:
222#ifdef CONFIG_ARCH_OMAP1 225 if (!pdata || !pdata->read_reset_sources)
223 if (cpu_is_omap16xx()) 226 return put_user(0, (int __user *)arg);
224 return put_user(__raw_readw(ARM_SYSST), 227 rs = pdata->read_reset_sources();
225 (int __user *)arg); 228 bs = (rs & (1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT)) ?
226#endif 229 WDIOF_CARDRESET : 0;
227#ifdef CONFIG_ARCH_OMAP2PLUS 230 return put_user(bs, (int __user *)arg);
228 if (cpu_is_omap24xx())
229 return put_user(omap_prcm_get_reset_sources(),
230 (int __user *)arg);
231#endif
232 return put_user(0, (int __user *)arg);
233 case WDIOC_KEEPALIVE: 231 case WDIOC_KEEPALIVE:
234 spin_lock(&wdt_lock); 232 spin_lock(&wdt_lock);
235 omap_wdt_ping(wdev); 233 omap_wdt_ping(wdev);
diff --git a/include/linux/platform_data/omap-wd-timer.h b/include/linux/platform_data/omap-wd-timer.h
new file mode 100644
index 000000000000..d75f5f802d98
--- /dev/null
+++ b/include/linux/platform_data/omap-wd-timer.h
@@ -0,0 +1,38 @@
1/*
2 * OMAP2+ WDTIMER-specific function prototypes
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 as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
14#define __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
15
16#include <linux/types.h>
17
18/*
19 * Standardized OMAP reset source bits
20 *
21 * This is a subset of the ones listed in arch/arm/mach-omap2/prm.h
22 * and are the only ones needed in the watchdog driver.
23 */
24#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
25
26/**
27 * struct omap_wd_timer_platform_data - WDTIMER integration to the host SoC
28 * @read_reset_sources - fn ptr for the SoC to indicate the last reset cause
29 *
30 * The function pointed to by @read_reset_sources must return its data
31 * in a standard format - search for RST_SRC_ID_SHIFT in
32 * arch/arm/mach-omap2
33 */
34struct omap_wd_timer_platform_data {
35 u32 (*read_reset_sources)(void);
36};
37
38#endif