diff options
| author | Arnd Bergmann <arnd@arndb.de> | 2012-11-15 11:59:54 -0500 |
|---|---|---|
| committer | Arnd Bergmann <arnd@arndb.de> | 2012-11-15 11:59:54 -0500 |
| commit | cff9f37a1e7b2565f254b5ab40c3213cc0f823a1 (patch) | |
| tree | 4ce5bef1e68a7cdd0567a6ab7c755fdbd9365d7b | |
| parent | b599dc078a7fd423c97217756d09400403a90a7f (diff) | |
| parent | cc4b1e24b93dd529b1d49258bee044d319b5b129 (diff) | |
Merge branch 'omap/cleanup-prcm-part2' into next/dt
This resolves a nontrivial conflict where the omap_prcm_restart
is removed in one branch but another use is added in another
branch.
Conflicts:
arch/arm/mach-omap2/cm33xx.c
arch/arm/mach-omap2/io.c
arch/arm/mach-omap2/prm_common.c
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
114 files changed, 3729 insertions, 2937 deletions
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h index fc8c9449eba8..b53e0854422f 100644 --- a/arch/arm/mach-omap1/common.h +++ b/arch/arm/mach-omap1/common.h | |||
| @@ -93,4 +93,6 @@ extern int ocpi_enable(void); | |||
| 93 | static inline int ocpi_enable(void) { return 0; } | 93 | static inline int ocpi_enable(void) { return 0; } |
| 94 | #endif | 94 | #endif |
| 95 | 95 | ||
| 96 | extern u32 omap1_get_reset_sources(void); | ||
| 97 | |||
| 96 | #endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ | 98 | #endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ |
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index 7155ed8b97f8..0af635205e8a 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
| @@ -17,6 +17,8 @@ | |||
| 17 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/spi/spi.h> | 18 | #include <linux/spi/spi.h> |
| 19 | 19 | ||
| 20 | #include <linux/platform_data/omap-wd-timer.h> | ||
| 21 | |||
| 20 | #include <asm/mach/map.h> | 22 | #include <asm/mach/map.h> |
| 21 | 23 | ||
| 22 | #include <mach/tc.h> | 24 | #include <mach/tc.h> |
| @@ -447,18 +449,31 @@ static struct resource wdt_resources[] = { | |||
| 447 | }; | 449 | }; |
| 448 | 450 | ||
| 449 | static struct platform_device omap_wdt_device = { | 451 | static struct platform_device omap_wdt_device = { |
| 450 | .name = "omap_wdt", | 452 | .name = "omap_wdt", |
| 451 | .id = -1, | 453 | .id = -1, |
| 452 | .num_resources = ARRAY_SIZE(wdt_resources), | 454 | .num_resources = ARRAY_SIZE(wdt_resources), |
| 453 | .resource = wdt_resources, | 455 | .resource = wdt_resources, |
| 454 | }; | 456 | }; |
| 455 | 457 | ||
| 456 | static int __init omap_init_wdt(void) | 458 | static int __init omap_init_wdt(void) |
| 457 | { | 459 | { |
| 460 | struct omap_wd_timer_platform_data pdata; | ||
| 461 | int ret; | ||
| 462 | |||
| 458 | if (!cpu_is_omap16xx()) | 463 | if (!cpu_is_omap16xx()) |
| 459 | return -ENODEV; | 464 | return -ENODEV; |
| 460 | 465 | ||
| 461 | return platform_device_register(&omap_wdt_device); | 466 | pdata.read_reset_sources = omap1_get_reset_sources; |
| 467 | |||
| 468 | ret = platform_device_register(&omap_wdt_device); | ||
| 469 | if (!ret) { | ||
| 470 | ret = platform_device_add_data(&omap_wdt_device, &pdata, | ||
| 471 | sizeof(pdata)); | ||
| 472 | if (ret) | ||
| 473 | platform_device_del(&omap_wdt_device); | ||
| 474 | } | ||
| 475 | |||
| 476 | return ret; | ||
| 462 | } | 477 | } |
| 463 | subsys_initcall(omap_init_wdt); | 478 | subsys_initcall(omap_init_wdt); |
| 464 | #endif | 479 | #endif |
diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c index b17709103866..5eebd7e889d0 100644 --- a/arch/arm/mach-omap1/reset.c +++ b/arch/arm/mach-omap1/reset.c | |||
| @@ -4,12 +4,24 @@ | |||
| 4 | #include <linux/kernel.h> | 4 | #include <linux/kernel.h> |
| 5 | #include <linux/io.h> | 5 | #include <linux/io.h> |
| 6 | 6 | ||
| 7 | #include <plat/prcm.h> | ||
| 8 | |||
| 9 | #include <mach/hardware.h> | 7 | #include <mach/hardware.h> |
| 10 | 8 | ||
| 9 | #include "iomap.h" | ||
| 11 | #include "common.h" | 10 | #include "common.h" |
| 12 | 11 | ||
| 12 | /* ARM_SYSST bit shifts related to SoC reset sources */ | ||
| 13 | #define ARM_SYSST_POR_SHIFT 5 | ||
| 14 | #define ARM_SYSST_EXT_RST_SHIFT 4 | ||
| 15 | #define ARM_SYSST_ARM_WDRST_SHIFT 2 | ||
| 16 | #define ARM_SYSST_GLOB_SWRST_SHIFT 1 | ||
| 17 | |||
| 18 | /* Standardized reset source bits (across all OMAP SoCs) */ | ||
| 19 | #define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0 | ||
| 20 | #define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1 | ||
| 21 | #define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3 | ||
| 22 | #define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5 | ||
| 23 | |||
| 24 | |||
| 13 | void omap1_restart(char mode, const char *cmd) | 25 | void omap1_restart(char mode, const char *cmd) |
| 14 | { | 26 | { |
| 15 | /* | 27 | /* |
| @@ -23,3 +35,28 @@ void omap1_restart(char mode, const char *cmd) | |||
| 23 | 35 | ||
| 24 | omap_writew(1, ARM_RSTCT1); | 36 | omap_writew(1, ARM_RSTCT1); |
| 25 | } | 37 | } |
| 38 | |||
| 39 | /** | ||
| 40 | * omap1_get_reset_sources - return the source of the SoC's last reset | ||
| 41 | * | ||
| 42 | * Returns bits that represent the last reset source for the SoC. The | ||
| 43 | * format is standardized across OMAPs for use by the OMAP watchdog. | ||
| 44 | */ | ||
| 45 | u32 omap1_get_reset_sources(void) | ||
| 46 | { | ||
| 47 | u32 ret = 0; | ||
| 48 | u16 rs; | ||
| 49 | |||
| 50 | rs = __raw_readw(OMAP1_IO_ADDRESS(ARM_SYSST)); | ||
| 51 | |||
| 52 | if (rs & (1 << ARM_SYSST_POR_SHIFT)) | ||
| 53 | ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT; | ||
| 54 | if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT)) | ||
| 55 | ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT; | ||
| 56 | if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT)) | ||
| 57 | ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT; | ||
| 58 | if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT)) | ||
| 59 | ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT; | ||
| 60 | |||
| 61 | return ret; | ||
| 62 | } | ||
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index b118ed5f61a9..78cbb8c5992e 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
| @@ -7,28 +7,34 @@ obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer.o pm.o \ | |||
| 7 | common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ | 7 | common.o gpio.o dma.o wd_timer.o display.o i2c.o hdq1w.o omap_hwmod.o \ |
| 8 | omap_device.o sram.o | 8 | omap_device.o sram.o |
| 9 | 9 | ||
| 10 | # INTCPS IP block support - XXX should be moved to drivers/ | 10 | omap-2-3-common = irq.o |
| 11 | obj-$(CONFIG_ARCH_OMAP2) += irq.o | 11 | hwmod-common = omap_hwmod.o \ |
| 12 | obj-$(CONFIG_ARCH_OMAP3) += irq.o | 12 | omap_hwmod_common_data.o |
| 13 | obj-$(CONFIG_SOC_AM33XX) += irq.o | 13 | clock-common = clock.o clock_common_data.o \ |
| 14 | 14 | clkt_dpll.o clkt_clksel.o | |
| 15 | # Secure monitor API support | 15 | secure-common = omap-smc.o omap-secure.o |
| 16 | obj-$(CONFIG_ARCH_OMAP3) += omap-smc.o omap-secure.o | 16 | |
| 17 | obj-$(CONFIG_ARCH_OMAP4) += omap-smc.o omap-secure.o | 17 | obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common) |
| 18 | obj-$(CONFIG_SOC_OMAP5) += omap-smc.o omap-secure.o | 18 | obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common) |
| 19 | obj-$(CONFIG_ARCH_OMAP4) += prm44xx.o $(hwmod-common) $(secure-common) | ||
| 20 | obj-$(CONFIG_SOC_AM33XX) += irq.o $(hwmod-common) | ||
| 21 | obj-$(CONFIG_SOC_OMAP5) += prm44xx.o $(hwmod-common) $(secure-common) | ||
| 19 | 22 | ||
| 20 | ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) | 23 | ifneq ($(CONFIG_SND_OMAP_SOC_MCBSP),) |
| 21 | obj-y += mcbsp.o | 24 | obj-y += mcbsp.o |
| 22 | endif | 25 | endif |
| 23 | 26 | ||
| 24 | obj-$(CONFIG_TWL4030_CORE) += omap_twl.o | 27 | obj-$(CONFIG_TWL4030_CORE) += omap_twl.o |
| 28 | obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o | ||
| 25 | 29 | ||
| 26 | # SMP support ONLY available for OMAP4 | 30 | # SMP support ONLY available for OMAP4 |
| 27 | 31 | ||
| 28 | obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o | 32 | obj-$(CONFIG_SMP) += omap-smp.o omap-headsmp.o |
| 29 | obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o | 33 | obj-$(CONFIG_HOTPLUG_CPU) += omap-hotplug.o |
| 30 | obj-$(CONFIG_ARCH_OMAP4) += omap4-common.o omap-wakeupgen.o | 34 | omap-4-5-common = omap4-common.o omap-wakeupgen.o \ |
| 31 | obj-$(CONFIG_SOC_OMAP5) += omap4-common.o omap-wakeupgen.o | 35 | sleep44xx.o |
| 36 | obj-$(CONFIG_ARCH_OMAP4) += $(omap-4-5-common) | ||
| 37 | obj-$(CONFIG_SOC_OMAP5) += $(omap-4-5-common) | ||
| 32 | 38 | ||
| 33 | plus_sec := $(call as-instr,.arch_extension sec,+sec) | 39 | plus_sec := $(call as-instr,.arch_extension sec,+sec) |
| 34 | AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) | 40 | AFLAGS_omap-headsmp.o :=-Wa,-march=armv7-a$(plus_sec) |
| @@ -44,6 +50,11 @@ AFLAGS_sram242x.o :=-Wa,-march=armv6 | |||
| 44 | AFLAGS_sram243x.o :=-Wa,-march=armv6 | 50 | AFLAGS_sram243x.o :=-Wa,-march=armv6 |
| 45 | AFLAGS_sram34xx.o :=-Wa,-march=armv7-a | 51 | AFLAGS_sram34xx.o :=-Wa,-march=armv7-a |
| 46 | 52 | ||
| 53 | # Restart code (OMAP4/5 currently in omap4-common.c) | ||
| 54 | obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o | ||
| 55 | obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o | ||
| 56 | obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o | ||
| 57 | |||
| 47 | # Pin multiplexing | 58 | # Pin multiplexing |
| 48 | obj-$(CONFIG_SOC_OMAP2420) += mux2420.o | 59 | obj-$(CONFIG_SOC_OMAP2420) += mux2420.o |
| 49 | obj-$(CONFIG_SOC_OMAP2430) += mux2430.o | 60 | obj-$(CONFIG_SOC_OMAP2430) += mux2430.o |
| @@ -53,7 +64,6 @@ obj-$(CONFIG_ARCH_OMAP4) += mux44xx.o | |||
| 53 | # SMS/SDRC | 64 | # SMS/SDRC |
| 54 | obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o | 65 | obj-$(CONFIG_ARCH_OMAP2) += sdrc2xxx.o |
| 55 | # obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o | 66 | # obj-$(CONFIG_ARCH_OMAP3) += sdrc3xxx.o |
| 56 | obj-$(CONFIG_SOC_HAS_OMAP2_SDRC) += sdrc.o | ||
| 57 | 67 | ||
| 58 | # OPP table initialization | 68 | # OPP table initialization |
| 59 | ifeq ($(CONFIG_PM_OPP),y) | 69 | ifeq ($(CONFIG_PM_OPP),y) |
| @@ -64,16 +74,16 @@ endif | |||
| 64 | 74 | ||
| 65 | # Power Management | 75 | # Power Management |
| 66 | ifeq ($(CONFIG_PM),y) | 76 | ifeq ($(CONFIG_PM),y) |
| 67 | obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o sleep24xx.o | 77 | obj-$(CONFIG_ARCH_OMAP2) += pm24xx.o |
| 78 | obj-$(CONFIG_ARCH_OMAP2) += sleep24xx.o | ||
| 68 | obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o | 79 | obj-$(CONFIG_ARCH_OMAP3) += pm34xx.o sleep34xx.o |
| 69 | obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o | 80 | obj-$(CONFIG_ARCH_OMAP4) += pm44xx.o omap-mpuss-lowpower.o |
| 70 | obj-$(CONFIG_ARCH_OMAP4) += sleep44xx.o | 81 | obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o |
| 71 | obj-$(CONFIG_SOC_OMAP5) += omap-mpuss-lowpower.o sleep44xx.o | ||
| 72 | obj-$(CONFIG_PM_DEBUG) += pm-debug.o | 82 | obj-$(CONFIG_PM_DEBUG) += pm-debug.o |
| 73 | obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o | 83 | obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o |
| 74 | 84 | ||
| 75 | obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o | 85 | obj-$(CONFIG_POWER_AVS_OMAP) += sr_device.o |
| 76 | obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o | 86 | obj-$(CONFIG_POWER_AVS_OMAP_CLASS3) += smartreflex-class3.o |
| 77 | 87 | ||
| 78 | AFLAGS_sleep24xx.o :=-Wa,-march=armv6 | 88 | AFLAGS_sleep24xx.o :=-Wa,-march=armv6 |
| 79 | AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) | 89 | AFLAGS_sleep34xx.o :=-Wa,-march=armv7-a$(plus_sec) |
| @@ -85,76 +95,82 @@ endif | |||
| 85 | endif | 95 | endif |
| 86 | 96 | ||
| 87 | ifeq ($(CONFIG_CPU_IDLE),y) | 97 | ifeq ($(CONFIG_CPU_IDLE),y) |
| 88 | obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o | 98 | obj-$(CONFIG_ARCH_OMAP3) += cpuidle34xx.o |
| 89 | obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o | 99 | obj-$(CONFIG_ARCH_OMAP4) += cpuidle44xx.o |
| 90 | endif | 100 | endif |
| 91 | 101 | ||
| 92 | # PRCM | 102 | # PRCM |
| 93 | obj-y += prcm.o prm_common.o | 103 | obj-y += prm_common.o cm_common.o |
| 94 | obj-$(CONFIG_ARCH_OMAP2) += cm2xxx_3xxx.o prm2xxx_3xxx.o | 104 | obj-$(CONFIG_ARCH_OMAP2) += prm2xxx_3xxx.o prm2xxx.o cm2xxx.o |
| 95 | obj-$(CONFIG_ARCH_OMAP3) += cm2xxx_3xxx.o prm2xxx_3xxx.o | 105 | obj-$(CONFIG_ARCH_OMAP3) += prm2xxx_3xxx.o prm3xxx.o cm3xxx.o |
| 96 | obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o | 106 | obj-$(CONFIG_ARCH_OMAP3) += vc3xxx_data.o vp3xxx_data.o |
| 97 | obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o | 107 | obj-$(CONFIG_SOC_AM33XX) += prm33xx.o cm33xx.o |
| 98 | omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ | 108 | omap-prcm-4-5-common = cminst44xx.o cm44xx.o prm44xx.o \ |
| 99 | prcm_mpu44xx.o prminst44xx.o \ | 109 | prcm_mpu44xx.o prminst44xx.o \ |
| 100 | vc44xx_data.o vp44xx_data.o \ | 110 | vc44xx_data.o vp44xx_data.o |
| 101 | prm44xx.o | ||
| 102 | obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) | 111 | obj-$(CONFIG_ARCH_OMAP4) += $(omap-prcm-4-5-common) |
| 103 | obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) | 112 | obj-$(CONFIG_SOC_OMAP5) += $(omap-prcm-4-5-common) |
| 104 | 113 | ||
| 105 | # OMAP voltage domains | 114 | # OMAP voltage domains |
| 106 | obj-y += voltage.o vc.o vp.o | 115 | voltagedomain-common := voltage.o vc.o vp.o |
| 116 | obj-$(CONFIG_ARCH_OMAP2) += $(voltagedomain-common) | ||
| 107 | obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o | 117 | obj-$(CONFIG_ARCH_OMAP2) += voltagedomains2xxx_data.o |
| 118 | obj-$(CONFIG_ARCH_OMAP3) += $(voltagedomain-common) | ||
| 108 | obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o | 119 | obj-$(CONFIG_ARCH_OMAP3) += voltagedomains3xxx_data.o |
| 120 | obj-$(CONFIG_ARCH_OMAP4) += $(voltagedomain-common) | ||
| 109 | obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o | 121 | obj-$(CONFIG_ARCH_OMAP4) += voltagedomains44xx_data.o |
| 110 | obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o | 122 | obj-$(CONFIG_SOC_AM33XX) += $(voltagedomain-common) |
| 123 | obj-$(CONFIG_SOC_AM33XX) += voltagedomains33xx_data.o | ||
| 124 | obj-$(CONFIG_SOC_OMAP5) += $(voltagedomain-common) | ||
| 111 | 125 | ||
| 112 | # OMAP powerdomain framework | 126 | # OMAP powerdomain framework |
| 113 | obj-y += powerdomain.o powerdomain-common.o | 127 | powerdomain-common += powerdomain.o powerdomain-common.o |
| 128 | obj-$(CONFIG_ARCH_OMAP2) += $(powerdomain-common) | ||
| 114 | obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o | 129 | obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_data.o |
| 115 | obj-$(CONFIG_ARCH_OMAP2) += powerdomain2xxx_3xxx.o | ||
| 116 | obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o | 130 | obj-$(CONFIG_ARCH_OMAP2) += powerdomains2xxx_3xxx_data.o |
| 117 | obj-$(CONFIG_ARCH_OMAP3) += powerdomain2xxx_3xxx.o | 131 | obj-$(CONFIG_ARCH_OMAP3) += $(powerdomain-common) |
| 118 | obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o | 132 | obj-$(CONFIG_ARCH_OMAP3) += powerdomains3xxx_data.o |
| 119 | obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o | 133 | obj-$(CONFIG_ARCH_OMAP3) += powerdomains2xxx_3xxx_data.o |
| 120 | obj-$(CONFIG_ARCH_OMAP4) += powerdomain44xx.o | 134 | obj-$(CONFIG_ARCH_OMAP4) += $(powerdomain-common) |
| 121 | obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o | 135 | obj-$(CONFIG_ARCH_OMAP4) += powerdomains44xx_data.o |
| 122 | obj-$(CONFIG_SOC_AM33XX) += powerdomain33xx.o | 136 | obj-$(CONFIG_SOC_AM33XX) += $(powerdomain-common) |
| 123 | obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o | 137 | obj-$(CONFIG_SOC_AM33XX) += powerdomains33xx_data.o |
| 124 | obj-$(CONFIG_SOC_OMAP5) += powerdomain44xx.o | 138 | obj-$(CONFIG_SOC_OMAP5) += $(powerdomain-common) |
| 125 | 139 | ||
| 126 | # PRCM clockdomain control | 140 | # PRCM clockdomain control |
| 127 | obj-y += clockdomain.o | 141 | clockdomain-common += clockdomain.o |
| 128 | obj-$(CONFIG_ARCH_OMAP2) += clockdomain2xxx_3xxx.o | 142 | obj-$(CONFIG_ARCH_OMAP2) += $(clockdomain-common) |
| 129 | obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o | 143 | obj-$(CONFIG_ARCH_OMAP2) += clockdomains2xxx_3xxx_data.o |
| 130 | obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o | 144 | obj-$(CONFIG_SOC_OMAP2420) += clockdomains2420_data.o |
| 131 | obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o | 145 | obj-$(CONFIG_SOC_OMAP2430) += clockdomains2430_data.o |
| 132 | obj-$(CONFIG_ARCH_OMAP3) += clockdomain2xxx_3xxx.o | 146 | obj-$(CONFIG_ARCH_OMAP3) += $(clockdomain-common) |
| 133 | obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o | 147 | obj-$(CONFIG_ARCH_OMAP3) += clockdomains2xxx_3xxx_data.o |
| 134 | obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o | 148 | obj-$(CONFIG_ARCH_OMAP3) += clockdomains3xxx_data.o |
| 135 | obj-$(CONFIG_ARCH_OMAP4) += clockdomain44xx.o | 149 | obj-$(CONFIG_ARCH_OMAP4) += $(clockdomain-common) |
| 136 | obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o | 150 | obj-$(CONFIG_ARCH_OMAP4) += clockdomains44xx_data.o |
| 137 | obj-$(CONFIG_SOC_AM33XX) += clockdomain33xx.o | 151 | obj-$(CONFIG_SOC_AM33XX) += $(clockdomain-common) |
| 138 | obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o | 152 | obj-$(CONFIG_SOC_AM33XX) += clockdomains33xx_data.o |
| 139 | obj-$(CONFIG_SOC_OMAP5) += clockdomain44xx.o | 153 | obj-$(CONFIG_SOC_OMAP5) += $(clockdomain-common) |
| 140 | 154 | ||
| 141 | # Clock framework | 155 | # Clock framework |
| 142 | obj-y += clock.o clock_common_data.o \ | 156 | obj-$(CONFIG_ARCH_OMAP2) += $(clock-common) clock2xxx.o |
| 143 | clkt_dpll.o clkt_clksel.o | 157 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_sys.o |
| 144 | obj-$(CONFIG_ARCH_OMAP2) += clock2xxx.o | 158 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o |
| 145 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpllcore.o clkt2xxx_sys.o | ||
| 146 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o | 159 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_virt_prcm_set.o |
| 147 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o | 160 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_apll.o clkt2xxx_osc.o |
| 148 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o | 161 | obj-$(CONFIG_ARCH_OMAP2) += clkt2xxx_dpll.o clkt_iclk.o |
| 149 | obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o | 162 | obj-$(CONFIG_SOC_OMAP2420) += clock2420_data.o |
| 150 | obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o | 163 | obj-$(CONFIG_SOC_OMAP2430) += clock2430.o clock2430_data.o |
| 151 | obj-$(CONFIG_ARCH_OMAP3) += clock3xxx.o | 164 | obj-$(CONFIG_ARCH_OMAP3) += $(clock-common) clock3xxx.o |
| 152 | obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o | 165 | obj-$(CONFIG_ARCH_OMAP3) += clock34xx.o clkt34xx_dpll3m2.o |
| 153 | obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o clkt_iclk.o | 166 | obj-$(CONFIG_ARCH_OMAP3) += clock3517.o clock36xx.o |
| 154 | obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o clock3xxx_data.o | 167 | obj-$(CONFIG_ARCH_OMAP3) += dpll3xxx.o clock3xxx_data.o |
| 155 | obj-$(CONFIG_ARCH_OMAP4) += clock44xx_data.o | 168 | obj-$(CONFIG_ARCH_OMAP3) += clkt_iclk.o |
| 169 | obj-$(CONFIG_ARCH_OMAP4) += $(clock-common) clock44xx_data.o | ||
| 156 | obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o | 170 | obj-$(CONFIG_ARCH_OMAP4) += dpll3xxx.o dpll44xx.o |
| 157 | obj-$(CONFIG_SOC_AM33XX) += dpll3xxx.o clock33xx_data.o | 171 | obj-$(CONFIG_SOC_AM33XX) += $(clock-common) dpll3xxx.o |
| 172 | obj-$(CONFIG_SOC_AM33XX) += clock33xx_data.o | ||
| 173 | obj-$(CONFIG_SOC_OMAP5) += $(clock-common) | ||
| 158 | obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o | 174 | obj-$(CONFIG_SOC_OMAP5) += dpll3xxx.o dpll44xx.o |
| 159 | 175 | ||
| 160 | # OMAP2 clock rate set data (old "OPP" data) | 176 | # OMAP2 clock rate set data (old "OPP" data) |
| @@ -162,7 +178,6 @@ obj-$(CONFIG_SOC_OMAP2420) += opp2420_data.o | |||
| 162 | obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o | 178 | obj-$(CONFIG_SOC_OMAP2430) += opp2430_data.o |
| 163 | 179 | ||
| 164 | # hwmod data | 180 | # hwmod data |
| 165 | obj-y += omap_hwmod_common_data.o | ||
| 166 | obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o | 181 | obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_ipblock_data.o |
| 167 | obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o | 182 | obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_3xxx_ipblock_data.o |
| 168 | obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o | 183 | obj-$(CONFIG_SOC_OMAP2420) += omap_hwmod_2xxx_interconnect_data.o |
| @@ -208,10 +223,10 @@ obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o | |||
| 208 | obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o | 223 | obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o |
| 209 | obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o | 224 | obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o |
| 210 | obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o | 225 | obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o |
| 211 | obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o | 226 | obj-$(CONFIG_MACH_DEVKIT8000) += board-devkit8000.o |
| 212 | obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o | 227 | obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o |
| 213 | obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o | 228 | obj-$(CONFIG_MACH_OMAP3530_LV_SOM) += board-omap3logic.o |
| 214 | obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o | 229 | obj-$(CONFIG_MACH_OMAP3_TORPEDO) += board-omap3logic.o |
| 215 | obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o | 230 | obj-$(CONFIG_MACH_ENCORE) += board-omap3encore.o |
| 216 | obj-$(CONFIG_MACH_OVERO) += board-overo.o | 231 | obj-$(CONFIG_MACH_OVERO) += board-overo.o |
| 217 | obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o | 232 | obj-$(CONFIG_MACH_OMAP3EVM) += board-omap3evm.o |
diff --git a/arch/arm/mach-omap2/am33xx.h b/arch/arm/mach-omap2/am33xx.h index 06c19bb7bca6..43296c1af9ee 100644 --- a/arch/arm/mach-omap2/am33xx.h +++ b/arch/arm/mach-omap2/am33xx.h | |||
| @@ -21,5 +21,6 @@ | |||
| 21 | #define AM33XX_SCM_BASE 0x44E10000 | 21 | #define AM33XX_SCM_BASE 0x44E10000 |
| 22 | #define AM33XX_CTRL_BASE AM33XX_SCM_BASE | 22 | #define AM33XX_CTRL_BASE AM33XX_SCM_BASE |
| 23 | #define AM33XX_PRCM_BASE 0x44E00000 | 23 | #define AM33XX_PRCM_BASE 0x44E00000 |
| 24 | #define AM33XX_TAP_BASE (AM33XX_CTRL_BASE + 0x3FC) | ||
| 24 | 25 | ||
| 25 | #endif /* __ASM_ARCH_AM33XX_H */ | 26 | #endif /* __ASM_ARCH_AM33XX_H */ |
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index d1c01625fe5a..4815ea6f8f5d 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c | |||
| @@ -285,5 +285,5 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") | |||
| 285 | .init_machine = omap_2430sdp_init, | 285 | .init_machine = omap_2430sdp_init, |
| 286 | .init_late = omap2430_init_late, | 286 | .init_late = omap2430_init_late, |
| 287 | .timer = &omap2_timer, | 287 | .timer = &omap2_timer, |
| 288 | .restart = omap_prcm_restart, | 288 | .restart = omap2xxx_restart, |
| 289 | MACHINE_END | 289 | MACHINE_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, |
| 601 | MACHINE_END | 601 | MACHINE_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, |
| 216 | MACHINE_END | 216 | MACHINE_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, |
| 885 | MACHINE_END | 885 | MACHINE_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, |
| 97 | MACHINE_END | 97 | MACHINE_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, |
| 397 | MACHINE_END | 397 | MACHINE_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, |
| 342 | MACHINE_END | 342 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c index a8cad2237a2a..c8e37dc00892 100644 --- a/arch/arm/mach-omap2/board-cm-t35.c +++ b/arch/arm/mach-omap2/board-cm-t35.c | |||
| @@ -751,18 +751,18 @@ MACHINE_START(CM_T35, "Compulab CM-T35") | |||
| 751 | .init_machine = cm_t35_init, | 751 | .init_machine = cm_t35_init, |
| 752 | .init_late = omap35xx_init_late, | 752 | .init_late = omap35xx_init_late, |
| 753 | .timer = &omap3_timer, | 753 | .timer = &omap3_timer, |
| 754 | .restart = omap_prcm_restart, | 754 | .restart = omap3xxx_restart, |
| 755 | MACHINE_END | 755 | MACHINE_END |
| 756 | 756 | ||
| 757 | MACHINE_START(CM_T3730, "Compulab CM-T3730") | 757 | MACHINE_START(CM_T3730, "Compulab CM-T3730") |
| 758 | .atag_offset = 0x100, | 758 | .atag_offset = 0x100, |
| 759 | .reserve = omap_reserve, | 759 | .reserve = omap_reserve, |
| 760 | .map_io = omap3_map_io, | 760 | .map_io = omap3_map_io, |
| 761 | .init_early = omap3630_init_early, | 761 | .init_early = omap3630_init_early, |
| 762 | .init_irq = omap3_init_irq, | 762 | .init_irq = omap3_init_irq, |
| 763 | .handle_irq = omap3_intc_handle_irq, | 763 | .handle_irq = omap3_intc_handle_irq, |
| 764 | .init_machine = cm_t3730_init, | 764 | .init_machine = cm_t3730_init, |
| 765 | .init_late = omap3630_init_late, | 765 | .init_late = omap3630_init_late, |
| 766 | .timer = &omap3_timer, | 766 | .timer = &omap3_timer, |
| 767 | .restart = omap_prcm_restart, | 767 | .restart = omap3xxx_restart, |
| 768 | MACHINE_END | 768 | MACHINE_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, |
| 302 | MACHINE_END | 302 | MACHINE_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, |
| 647 | MACHINE_END | 647 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c index d69018028d96..f0715a369c44 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, |
| 61 | MACHINE_END | 61 | MACHINE_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, |
| 80 | MACHINE_END | 80 | MACHINE_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, |
| 99 | MACHINE_END | 99 | MACHINE_END |
| 100 | 100 | ||
| 101 | static const char *omap3_gp_boards_compat[] __initdata = { | 101 | static const char *omap3_gp_boards_compat[] __initdata = { |
| @@ -112,7 +112,7 @@ DT_MACHINE_START(OMAP3_GP_DT, "Generic OMAP3-GP (Flattened Device Tree)") | |||
| 112 | .init_machine = omap_generic_init, | 112 | .init_machine = omap_generic_init, |
| 113 | .timer = &omap3_secure_timer, | 113 | .timer = &omap3_secure_timer, |
| 114 | .dt_compat = omap3_gp_boards_compat, | 114 | .dt_compat = omap3_gp_boards_compat, |
| 115 | .restart = omap_prcm_restart, | 115 | .restart = omap3xxx_restart, |
| 116 | MACHINE_END | 116 | MACHINE_END |
| 117 | #endif | 117 | #endif |
| 118 | 118 | ||
| @@ -151,7 +151,7 @@ DT_MACHINE_START(OMAP4_DT, "Generic OMAP4 (Flattened Device Tree)") | |||
| 151 | .init_late = omap4430_init_late, | 151 | .init_late = omap4430_init_late, |
| 152 | .timer = &omap4_timer, | 152 | .timer = &omap4_timer, |
| 153 | .dt_compat = omap4_boards_compat, | 153 | .dt_compat = omap4_boards_compat, |
| 154 | .restart = omap_prcm_restart, | 154 | .restart = omap44xx_restart, |
| 155 | MACHINE_END | 155 | MACHINE_END |
| 156 | #endif | 156 | #endif |
| 157 | 157 | ||
| @@ -171,6 +171,6 @@ DT_MACHINE_START(OMAP5_DT, "Generic OMAP5 (Flattened Device Tree)") | |||
| 171 | .init_machine = omap_generic_init, | 171 | .init_machine = omap_generic_init, |
| 172 | .timer = &omap5_timer, | 172 | .timer = &omap5_timer, |
| 173 | .dt_compat = omap5_boards_compat, | 173 | .dt_compat = omap5_boards_compat, |
| 174 | .restart = omap_prcm_restart, | 174 | .restart = omap44xx_restart, |
| 175 | MACHINE_END | 175 | MACHINE_END |
| 176 | #endif | 176 | #endif |
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index 8668c72ee810..b626dbe6f7bc 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
| @@ -386,5 +386,5 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board") | |||
| 386 | .init_machine = omap_h4_init, | 386 | .init_machine = omap_h4_init, |
| 387 | .init_late = omap2420_init_late, | 387 | .init_late = omap2420_init_late, |
| 388 | .timer = &omap2_timer, | 388 | .timer = &omap2_timer, |
| 389 | .restart = omap_prcm_restart, | 389 | .restart = omap2xxx_restart, |
| 390 | MACHINE_END | 390 | MACHINE_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, |
| 655 | MACHINE_END | 655 | MACHINE_END |
| 656 | 656 | ||
| 657 | MACHINE_START(IGEP0030, "IGEP OMAP3 module") | 657 | MACHINE_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, |
| 668 | MACHINE_END | 668 | MACHINE_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, |
| 440 | MACHINE_END | 440 | MACHINE_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, |
| 694 | MACHINE_END | 694 | MACHINE_END |
| 695 | 695 | ||
| 696 | MACHINE_START(NOKIA_N810, "Nokia N810") | 696 | MACHINE_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, |
| 707 | MACHINE_END | 707 | MACHINE_END |
| 708 | 708 | ||
| 709 | MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX") | 709 | MACHINE_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, |
| 720 | MACHINE_END | 720 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 5a3800da903f..22c483d5dfa8 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c | |||
| @@ -545,5 +545,5 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") | |||
| 545 | .init_machine = omap3_beagle_init, | 545 | .init_machine = omap3_beagle_init, |
| 546 | .init_late = omap3_init_late, | 546 | .init_late = omap3_init_late, |
| 547 | .timer = &omap3_secure_timer, | 547 | .timer = &omap3_secure_timer, |
| 548 | .restart = omap_prcm_restart, | 548 | .restart = omap3xxx_restart, |
| 549 | MACHINE_END | 549 | MACHINE_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, |
| 761 | MACHINE_END | 761 | MACHINE_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, |
| 236 | MACHINE_END | 236 | MACHINE_END |
| 237 | 237 | ||
| 238 | MACHINE_START(OMAP3530_LV_SOM, "OMAP Logic 3530 LV SOM board") | 238 | MACHINE_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, |
| 249 | MACHINE_END | 249 | MACHINE_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, |
| 623 | MACHINE_END | 623 | MACHINE_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, |
| 431 | MACHINE_END | 431 | MACHINE_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, |
| 391 | MACHINE_END | 391 | MACHINE_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, |
| 528 | MACHINE_END | 528 | MACHINE_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, |
| 557 | MACHINE_END | 557 | MACHINE_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, |
| 152 | MACHINE_END | 152 | MACHINE_END |
| 153 | 153 | ||
| 154 | MACHINE_START(NOKIA_RM696, "Nokia RM-696 board") | 154 | MACHINE_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, |
| 165 | MACHINE_END | 165 | MACHINE_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, |
| 131 | MACHINE_END | 131 | MACHINE_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, |
| 50 | MACHINE_END | 50 | MACHINE_END |
| 51 | 51 | ||
| 52 | MACHINE_START(TI8148EVM, "ti8148evm") | 52 | MACHINE_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, |
| 62 | MACHINE_END | 62 | MACHINE_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, |
| 142 | MACHINE_END | 142 | MACHINE_END |
| 143 | 143 | ||
| 144 | MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board") | 144 | MACHINE_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, |
| 155 | MACHINE_END | 155 | MACHINE_END |
diff --git a/arch/arm/mach-omap2/clkt2xxx_apll.c b/arch/arm/mach-omap2/clkt2xxx_apll.c index 73a1414b89b0..8c5b13e7ee61 100644 --- a/arch/arm/mach-omap2/clkt2xxx_apll.c +++ b/arch/arm/mach-omap2/clkt2xxx_apll.c | |||
| @@ -21,11 +21,10 @@ | |||
| 21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
| 22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
| 23 | 23 | ||
| 24 | #include <plat/prcm.h> | ||
| 25 | 24 | ||
| 26 | #include "clock.h" | 25 | #include "clock.h" |
| 27 | #include "clock2xxx.h" | 26 | #include "clock2xxx.h" |
| 28 | #include "cm2xxx_3xxx.h" | 27 | #include "cm2xxx.h" |
| 29 | #include "cm-regbits-24xx.h" | 28 | #include "cm-regbits-24xx.h" |
| 30 | 29 | ||
| 31 | /* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ | 30 | /* CM_CLKEN_PLL.EN_{54,96}M_PLL options (24XX) */ |
| @@ -37,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 | ||
| 40 | void __iomem *cm_idlest_pll; | ||
| 41 | |||
| 42 | /* Private functions */ | 39 | /* Private functions */ |
| 43 | 40 | ||
| 44 | /* Enable an APLL if off */ | 41 | static int _apll96_enable(struct clk *clk) |
| 45 | static 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 | |||
| 70 | static 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 | ||
| 75 | static int omap2_clk_apll54_enable(struct clk *clk) | 46 | static 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 | ||
| 80 | static void _apll96_allow_idle(struct clk *clk) | 51 | static 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 */ | 71 | static void _apll96_disable(struct clk *clk) |
| 101 | static 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); | 76 | static 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 | ||
| 112 | const struct clkops clkops_apll96 = { | 83 | const 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 | ||
| 119 | const struct clkops clkops_apll54 = { | 90 | const 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_dpll.c b/arch/arm/mach-omap2/clkt2xxx_dpll.c index 0890ba94a282..399534c7843b 100644 --- a/arch/arm/mach-omap2/clkt2xxx_dpll.c +++ b/arch/arm/mach-omap2/clkt2xxx_dpll.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include <linux/io.h> | 15 | #include <linux/io.h> |
| 16 | 16 | ||
| 17 | #include "clock.h" | 17 | #include "clock.h" |
| 18 | #include "cm2xxx_3xxx.h" | 18 | #include "cm2xxx.h" |
| 19 | #include "cm-regbits-24xx.h" | 19 | #include "cm-regbits-24xx.h" |
| 20 | 20 | ||
| 21 | /* Private functions */ | 21 | /* Private functions */ |
diff --git a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c index 0d2f14c2dcce..825e44cdf1cf 100644 --- a/arch/arm/mach-omap2/clkt2xxx_dpllcore.c +++ b/arch/arm/mach-omap2/clkt2xxx_dpllcore.c | |||
| @@ -28,16 +28,22 @@ | |||
| 28 | #include "clock.h" | 28 | #include "clock.h" |
| 29 | #include "clock2xxx.h" | 29 | #include "clock2xxx.h" |
| 30 | #include "opp2xxx.h" | 30 | #include "opp2xxx.h" |
| 31 | #include "cm2xxx_3xxx.h" | 31 | #include "cm2xxx.h" |
| 32 | #include "cm-regbits-24xx.h" | 32 | #include "cm-regbits-24xx.h" |
| 33 | #include "sdrc.h" | 33 | #include "sdrc.h" |
| 34 | #include "sram.h" | 34 | #include "sram.h" |
| 35 | 35 | ||
| 36 | /* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ | 36 | /* #define DOWN_VARIABLE_DPLL 1 */ /* Experimental */ |
| 37 | 37 | ||
| 38 | /* | ||
| 39 | * dpll_core_ck: pointer to the combined dpll_ck + core_ck on OMAP2xxx | ||
| 40 | * (currently defined as "dpll_ck" in the OMAP2xxx clock tree). Set | ||
| 41 | * during dpll_ck init and used later by omap2xxx_clk_get_core_rate(). | ||
| 42 | */ | ||
| 43 | static struct clk *dpll_core_ck; | ||
| 44 | |||
| 38 | /** | 45 | /** |
| 39 | * omap2xxx_clk_get_core_rate - return the CORE_CLK rate | 46 | * omap2xxx_clk_get_core_rate - return the CORE_CLK rate |
| 40 | * @clk: pointer to the combined dpll_ck + core_ck (currently "dpll_ck") | ||
| 41 | * | 47 | * |
| 42 | * Returns the CORE_CLK rate. CORE_CLK can have one of three rate | 48 | * Returns the CORE_CLK rate. CORE_CLK can have one of three rate |
| 43 | * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz | 49 | * sources on OMAP2xxx: the DPLL CLKOUT rate, DPLL CLKOUTX2, or 32KHz |
| @@ -45,12 +51,14 @@ | |||
| 45 | * struct clk *dpll_ck, which is a composite clock of dpll_ck and | 51 | * struct clk *dpll_ck, which is a composite clock of dpll_ck and |
| 46 | * core_ck. | 52 | * core_ck. |
| 47 | */ | 53 | */ |
| 48 | unsigned long omap2xxx_clk_get_core_rate(struct clk *clk) | 54 | unsigned long omap2xxx_clk_get_core_rate(void) |
| 49 | { | 55 | { |
| 50 | long long core_clk; | 56 | long long core_clk; |
| 51 | u32 v; | 57 | u32 v; |
| 52 | 58 | ||
| 53 | core_clk = omap2_get_dpll_rate(clk); | 59 | WARN_ON(!dpll_core_ck); |
| 60 | |||
| 61 | core_clk = omap2_get_dpll_rate(dpll_core_ck); | ||
| 54 | 62 | ||
| 55 | v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); | 63 | v = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); |
| 56 | v &= OMAP24XX_CORE_CLK_SRC_MASK; | 64 | v &= OMAP24XX_CORE_CLK_SRC_MASK; |
| @@ -98,7 +106,7 @@ static long omap2_dpllcore_round_rate(unsigned long target_rate) | |||
| 98 | 106 | ||
| 99 | unsigned long omap2_dpllcore_recalc(struct clk *clk) | 107 | unsigned long omap2_dpllcore_recalc(struct clk *clk) |
| 100 | { | 108 | { |
| 101 | return omap2xxx_clk_get_core_rate(clk); | 109 | return omap2xxx_clk_get_core_rate(); |
| 102 | } | 110 | } |
| 103 | 111 | ||
| 104 | int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) | 112 | int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) |
| @@ -108,7 +116,7 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) | |||
| 108 | struct prcm_config tmpset; | 116 | struct prcm_config tmpset; |
| 109 | const struct dpll_data *dd; | 117 | const struct dpll_data *dd; |
| 110 | 118 | ||
| 111 | cur_rate = omap2xxx_clk_get_core_rate(dclk); | 119 | cur_rate = omap2xxx_clk_get_core_rate(); |
| 112 | mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); | 120 | mult = omap2_cm_read_mod_reg(PLL_MOD, CM_CLKSEL2); |
| 113 | mult &= OMAP24XX_CORE_CLK_SRC_MASK; | 121 | mult &= OMAP24XX_CORE_CLK_SRC_MASK; |
| 114 | 122 | ||
| @@ -169,3 +177,19 @@ int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate) | |||
| 169 | return 0; | 177 | return 0; |
| 170 | } | 178 | } |
| 171 | 179 | ||
| 180 | /** | ||
| 181 | * omap2xxx_clkt_dpllcore_init - clk init function for dpll_ck | ||
| 182 | * @clk: struct clk *dpll_ck | ||
| 183 | * | ||
| 184 | * Store a local copy of @clk in dpll_core_ck so other code can query | ||
| 185 | * the core rate without having to clk_get(), which can sleep. Must | ||
| 186 | * only be called once. No return value. XXX If the clock | ||
| 187 | * registration process is ever changed such that dpll_ck is no longer | ||
| 188 | * statically defined, this code may need to change to increment some | ||
| 189 | * kind of use count on dpll_ck. | ||
| 190 | */ | ||
| 191 | void omap2xxx_clkt_dpllcore_init(struct clk *clk) | ||
| 192 | { | ||
| 193 | WARN(dpll_core_ck, "dpll_core_ck already set - should never happen"); | ||
| 194 | dpll_core_ck = clk; | ||
| 195 | } | ||
diff --git a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c index a38ebb209721..1c2041fbd718 100644 --- a/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c +++ b/arch/arm/mach-omap2/clkt2xxx_virt_prcm_set.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * OMAP2xxx DVFS virtual clock functions | 2 | * OMAP2xxx DVFS virtual clock functions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2005-2008 Texas Instruments, Inc. | 4 | * Copyright (C) 2005-2008, 2012 Texas Instruments, Inc. |
| 5 | * Copyright (C) 2004-2010 Nokia Corporation | 5 | * Copyright (C) 2004-2010 Nokia Corporation |
| 6 | * | 6 | * |
| 7 | * Contacts: | 7 | * Contacts: |
| @@ -37,7 +37,7 @@ | |||
| 37 | #include "clock.h" | 37 | #include "clock.h" |
| 38 | #include "clock2xxx.h" | 38 | #include "clock2xxx.h" |
| 39 | #include "opp2xxx.h" | 39 | #include "opp2xxx.h" |
| 40 | #include "cm2xxx_3xxx.h" | 40 | #include "cm2xxx.h" |
| 41 | #include "cm-regbits-24xx.h" | 41 | #include "cm-regbits-24xx.h" |
| 42 | #include "sdrc.h" | 42 | #include "sdrc.h" |
| 43 | #include "sram.h" | 43 | #include "sram.h" |
| @@ -45,6 +45,13 @@ | |||
| 45 | const struct prcm_config *curr_prcm_set; | 45 | const struct prcm_config *curr_prcm_set; |
| 46 | const struct prcm_config *rate_table; | 46 | const struct prcm_config *rate_table; |
| 47 | 47 | ||
| 48 | /* | ||
| 49 | * sys_ck_rate: the rate of the external high-frequency clock | ||
| 50 | * oscillator on the board. Set by the SoC-specific clock init code. | ||
| 51 | * Once set during a boot, will not change. | ||
| 52 | */ | ||
| 53 | static unsigned long sys_ck_rate; | ||
| 54 | |||
| 48 | /** | 55 | /** |
| 49 | * omap2_table_mpu_recalc - just return the MPU speed | 56 | * omap2_table_mpu_recalc - just return the MPU speed |
| 50 | * @clk: virt_prcm_set struct clk | 57 | * @clk: virt_prcm_set struct clk |
| @@ -66,15 +73,14 @@ unsigned long omap2_table_mpu_recalc(struct clk *clk) | |||
| 66 | long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) | 73 | long omap2_round_to_table_rate(struct clk *clk, unsigned long rate) |
| 67 | { | 74 | { |
| 68 | const struct prcm_config *ptr; | 75 | const struct prcm_config *ptr; |
| 69 | long highest_rate, sys_clk_rate; | 76 | long highest_rate; |
| 70 | 77 | ||
| 71 | highest_rate = -EINVAL; | 78 | highest_rate = -EINVAL; |
| 72 | sys_clk_rate = __clk_get_rate(sclk); | ||
| 73 | 79 | ||
| 74 | for (ptr = rate_table; ptr->mpu_speed; ptr++) { | 80 | for (ptr = rate_table; ptr->mpu_speed; ptr++) { |
| 75 | if (!(ptr->flags & cpu_mask)) | 81 | if (!(ptr->flags & cpu_mask)) |
| 76 | continue; | 82 | continue; |
| 77 | if (ptr->xtal_speed != sys_clk_rate) | 83 | if (ptr->xtal_speed != sys_ck_rate) |
| 78 | continue; | 84 | continue; |
| 79 | 85 | ||
| 80 | highest_rate = ptr->mpu_speed; | 86 | highest_rate = ptr->mpu_speed; |
| @@ -93,15 +99,12 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate) | |||
| 93 | const struct prcm_config *prcm; | 99 | const struct prcm_config *prcm; |
| 94 | unsigned long found_speed = 0; | 100 | unsigned long found_speed = 0; |
| 95 | unsigned long flags; | 101 | unsigned long flags; |
| 96 | long sys_clk_rate; | ||
| 97 | |||
| 98 | sys_clk_rate = __clk_get_rate(sclk); | ||
| 99 | 102 | ||
| 100 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | 103 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { |
| 101 | if (!(prcm->flags & cpu_mask)) | 104 | if (!(prcm->flags & cpu_mask)) |
| 102 | continue; | 105 | continue; |
| 103 | 106 | ||
| 104 | if (prcm->xtal_speed != sys_clk_rate) | 107 | if (prcm->xtal_speed != sys_ck_rate) |
| 105 | continue; | 108 | continue; |
| 106 | 109 | ||
| 107 | if (prcm->mpu_speed <= rate) { | 110 | if (prcm->mpu_speed <= rate) { |
| @@ -117,7 +120,7 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate) | |||
| 117 | } | 120 | } |
| 118 | 121 | ||
| 119 | curr_prcm_set = prcm; | 122 | curr_prcm_set = prcm; |
| 120 | cur_rate = omap2xxx_clk_get_core_rate(dclk); | 123 | cur_rate = omap2xxx_clk_get_core_rate(); |
| 121 | 124 | ||
| 122 | if (prcm->dpll_speed == cur_rate / 2) { | 125 | if (prcm->dpll_speed == cur_rate / 2) { |
| 123 | omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1); | 126 | omap2xxx_sdrc_reprogram(CORE_CLK_SRC_DPLL, 1); |
| @@ -167,3 +170,50 @@ int omap2_select_table_rate(struct clk *clk, unsigned long rate) | |||
| 167 | 170 | ||
| 168 | return 0; | 171 | return 0; |
| 169 | } | 172 | } |
| 173 | |||
| 174 | /** | ||
| 175 | * omap2xxx_clkt_vps_check_bootloader_rate - determine which of the rate | ||
| 176 | * table sets matches the current CORE DPLL hardware rate | ||
| 177 | * | ||
| 178 | * Check the MPU rate set by bootloader. Sets the 'curr_prcm_set' | ||
| 179 | * global to point to the active rate set when found; otherwise, sets | ||
| 180 | * it to NULL. No return value; | ||
| 181 | */ | ||
| 182 | void omap2xxx_clkt_vps_check_bootloader_rates(void) | ||
| 183 | { | ||
| 184 | const struct prcm_config *prcm = NULL; | ||
| 185 | unsigned long rate; | ||
| 186 | |||
| 187 | rate = omap2xxx_clk_get_core_rate(); | ||
| 188 | for (prcm = rate_table; prcm->mpu_speed; prcm++) { | ||
| 189 | if (!(prcm->flags & cpu_mask)) | ||
| 190 | continue; | ||
| 191 | if (prcm->xtal_speed != sys_ck_rate) | ||
| 192 | continue; | ||
| 193 | if (prcm->dpll_speed <= rate) | ||
| 194 | break; | ||
| 195 | } | ||
| 196 | curr_prcm_set = prcm; | ||
| 197 | } | ||
| 198 | |||
| 199 | /** | ||
| 200 | * omap2xxx_clkt_vps_late_init - store a copy of the sys_ck rate | ||
| 201 | * | ||
| 202 | * Store a copy of the sys_ck rate for later use by the OMAP2xxx DVFS | ||
| 203 | * code. (The sys_ck rate does not -- or rather, must not -- change | ||
| 204 | * during kernel runtime.) Must be called after we have a valid | ||
| 205 | * sys_ck rate, but before the virt_prcm_set clock rate is | ||
| 206 | * recalculated. No return value. | ||
| 207 | */ | ||
| 208 | void omap2xxx_clkt_vps_late_init(void) | ||
| 209 | { | ||
| 210 | struct clk *c; | ||
| 211 | |||
| 212 | c = clk_get(NULL, "sys_ck"); | ||
| 213 | if (IS_ERR(c)) { | ||
| 214 | WARN(1, "could not locate sys_ck\n"); | ||
| 215 | } else { | ||
| 216 | sys_ck_rate = clk_get_rate(c); | ||
| 217 | clk_put(c); | ||
| 218 | } | ||
| 219 | } | ||
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 8b30759f8f9e..e381d991092c 100644 --- a/arch/arm/mach-omap2/clock.c +++ b/arch/arm/mach-omap2/clock.c | |||
| @@ -26,16 +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" |
| 36 | #include "cm2xxx_3xxx.h" | 35 | #include "cm.h" |
| 36 | #include "cm2xxx.h" | ||
| 37 | #include "cm3xxx.h" | ||
| 37 | #include "cm-regbits-24xx.h" | 38 | #include "cm-regbits-24xx.h" |
| 38 | #include "cm-regbits-34xx.h" | 39 | #include "cm-regbits-34xx.h" |
| 40 | #include "common.h" | ||
| 41 | |||
| 42 | /* | ||
| 43 | * MAX_MODULE_ENABLE_WAIT: maximum of number of microseconds to wait | ||
| 44 | * for a module to indicate that it is no longer in idle | ||
| 45 | */ | ||
| 46 | #define MAX_MODULE_ENABLE_WAIT 100000 | ||
| 39 | 47 | ||
| 40 | u16 cpu_mask; | 48 | u16 cpu_mask; |
| 41 | 49 | ||
| @@ -57,6 +65,40 @@ static DEFINE_SPINLOCK(clockfw_lock); | |||
| 57 | 65 | ||
| 58 | /* Private functions */ | 66 | /* Private functions */ |
| 59 | 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 | */ | ||
| 82 | static 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 | |||
| 60 | /** | 102 | /** |
| 61 | * _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 |
| 62 | * @clk: struct clk * belonging to the module | 104 | * @clk: struct clk * belonging to the module |
| @@ -70,7 +112,9 @@ static DEFINE_SPINLOCK(clockfw_lock); | |||
| 70 | static void _omap2_module_wait_ready(struct clk *clk) | 112 | static void _omap2_module_wait_ready(struct clk *clk) |
| 71 | { | 113 | { |
| 72 | void __iomem *companion_reg, *idlest_reg; | 114 | void __iomem *companion_reg, *idlest_reg; |
| 73 | 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; | ||
| 74 | 118 | ||
| 75 | /* Not all modules have multiple clocks that their IDLEST depends on */ | 119 | /* Not all modules have multiple clocks that their IDLEST depends on */ |
| 76 | if (clk->ops->find_companion) { | 120 | if (clk->ops->find_companion) { |
| @@ -81,8 +125,14 @@ static void _omap2_module_wait_ready(struct clk *clk) | |||
| 81 | 125 | ||
| 82 | clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); | 126 | clk->ops->find_idlest(clk, &idlest_reg, &idlest_bit, &idlest_val); |
| 83 | 127 | ||
| 84 | omap2_cm_wait_idlest(idlest_reg, (1 << idlest_bit), idlest_val, | 128 | r = cm_split_idlest_reg(idlest_reg, &prcm_mod, &idlest_reg_id); |
| 85 | __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 | }; | ||
| 86 | } | 136 | } |
| 87 | 137 | ||
| 88 | /* 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); | |||
| 409 | u32 omap2_get_dpll_rate(struct clk *clk); | 409 | u32 omap2_get_dpll_rate(struct clk *clk); |
| 410 | void omap2_init_dpll_parent(struct clk *clk); | 410 | void omap2_init_dpll_parent(struct clk *clk); |
| 411 | 411 | ||
| 412 | int omap2_wait_clock_ready(void __iomem *reg, u32 cval, const char *name); | ||
| 413 | |||
| 414 | |||
| 415 | #ifdef CONFIG_ARCH_OMAP2 | ||
| 416 | void omap2xxx_clk_prepare_for_reboot(void); | ||
| 417 | #else | ||
| 418 | static inline void omap2xxx_clk_prepare_for_reboot(void) | ||
| 419 | { | ||
| 420 | } | ||
| 421 | #endif | ||
| 422 | |||
| 423 | #ifdef CONFIG_ARCH_OMAP3 | ||
| 424 | void omap3_clk_prepare_for_reboot(void); | ||
| 425 | #else | ||
| 426 | static inline void omap3_clk_prepare_for_reboot(void) | ||
| 427 | { | ||
| 428 | } | ||
| 429 | #endif | ||
| 430 | |||
| 431 | #ifdef CONFIG_ARCH_OMAP4 | ||
| 432 | void omap4_clk_prepare_for_reboot(void); | ||
| 433 | #else | ||
| 434 | static inline void omap4_clk_prepare_for_reboot(void) | ||
| 435 | { | ||
| 436 | } | ||
| 437 | #endif | ||
| 438 | |||
| 439 | int omap2_dflt_clk_enable(struct clk *clk); | 412 | int omap2_dflt_clk_enable(struct clk *clk); |
| 440 | void omap2_dflt_clk_disable(struct clk *clk); | 413 | void omap2_dflt_clk_disable(struct clk *clk); |
| 441 | void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, | 414 | void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg, |
| @@ -454,7 +427,6 @@ extern const struct clkops clkops_dummy; | |||
| 454 | extern const struct clkops clkops_omap2_dflt; | 427 | extern const struct clkops clkops_omap2_dflt; |
| 455 | 428 | ||
| 456 | extern struct clk_functions omap2_clk_functions; | 429 | extern struct clk_functions omap2_clk_functions; |
| 457 | extern struct clk *vclk, *sclk; | ||
| 458 | 430 | ||
| 459 | extern const struct clksel_rate gpt_32k_rates[]; | 431 | extern const struct clksel_rate gpt_32k_rates[]; |
| 460 | extern const struct clksel_rate gpt_sys_rates[]; | 432 | extern 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 ff47a6c2611d..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: |
| @@ -23,7 +23,7 @@ | |||
| 23 | #include "clock.h" | 23 | #include "clock.h" |
| 24 | #include "clock2xxx.h" | 24 | #include "clock2xxx.h" |
| 25 | #include "opp2xxx.h" | 25 | #include "opp2xxx.h" |
| 26 | #include "cm2xxx_3xxx.h" | 26 | #include "cm2xxx.h" |
| 27 | #include "prm2xxx_3xxx.h" | 27 | #include "prm2xxx_3xxx.h" |
| 28 | #include "prm-regbits-24xx.h" | 28 | #include "prm-regbits-24xx.h" |
| 29 | #include "cm-regbits-24xx.h" | 29 | #include "cm-regbits-24xx.h" |
| @@ -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 | ||
| 1925 | int __init omap2420_clk_init(void) | 1926 | int __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.c b/arch/arm/mach-omap2/clock2430.c index 850f83e8954f..e37df538bcd3 100644 --- a/arch/arm/mach-omap2/clock2430.c +++ b/arch/arm/mach-omap2/clock2430.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | #include "iomap.h" | 25 | #include "iomap.h" |
| 26 | #include "clock.h" | 26 | #include "clock.h" |
| 27 | #include "clock2xxx.h" | 27 | #include "clock2xxx.h" |
| 28 | #include "cm2xxx_3xxx.h" | 28 | #include "cm2xxx.h" |
| 29 | #include "cm-regbits-24xx.h" | 29 | #include "cm-regbits-24xx.h" |
| 30 | 30 | ||
| 31 | /** | 31 | /** |
diff --git a/arch/arm/mach-omap2/clock2430_data.c b/arch/arm/mach-omap2/clock2430_data.c index cab8e9c52d6e..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: |
| @@ -22,7 +22,7 @@ | |||
| 22 | #include "clock.h" | 22 | #include "clock.h" |
| 23 | #include "clock2xxx.h" | 23 | #include "clock2xxx.h" |
| 24 | #include "opp2xxx.h" | 24 | #include "opp2xxx.h" |
| 25 | #include "cm2xxx_3xxx.h" | 25 | #include "cm2xxx.h" |
| 26 | #include "prm2xxx_3xxx.h" | 26 | #include "prm2xxx_3xxx.h" |
| 27 | #include "prm-regbits-24xx.h" | 27 | #include "prm-regbits-24xx.h" |
| 28 | #include "cm-regbits-24xx.h" | 28 | #include "cm-regbits-24xx.h" |
| @@ -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 | ||
| 2024 | int __init omap2430_clk_init(void) | 2025 | int __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 | ||
| 31 | struct 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 | */ | ||
| 40 | void 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); | |||
| 15 | unsigned long omap2_osc_clk_recalc(struct clk *clk); | 15 | unsigned long omap2_osc_clk_recalc(struct clk *clk); |
| 16 | unsigned long omap2_dpllcore_recalc(struct clk *clk); | 16 | unsigned long omap2_dpllcore_recalc(struct clk *clk); |
| 17 | int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); | 17 | int omap2_reprogram_dpllcore(struct clk *clk, unsigned long rate); |
| 18 | unsigned long omap2xxx_clk_get_core_rate(struct clk *clk); | 18 | unsigned long omap2xxx_clk_get_core_rate(void); |
| 19 | u32 omap2xxx_get_apll_clkin(void); | 19 | u32 omap2xxx_get_apll_clkin(void); |
| 20 | u32 omap2xxx_get_sysclkdiv(void); | 20 | u32 omap2xxx_get_sysclkdiv(void); |
| 21 | void omap2xxx_clk_prepare_for_reboot(void); | 21 | void omap2xxx_clk_prepare_for_reboot(void); |
| 22 | void omap2xxx_clkt_dpllcore_init(struct clk *clk); | ||
| 23 | void omap2xxx_clkt_vps_check_bootloader_rates(void); | ||
| 24 | void omap2xxx_clkt_vps_late_init(void); | ||
| 22 | 25 | ||
| 23 | #ifdef CONFIG_SOC_OMAP2420 | 26 | #ifdef CONFIG_SOC_OMAP2420 |
| 24 | int omap2420_clk_init(void); | 27 | int 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 | ||
| 35 | extern void __iomem *prcm_clksrc_ctrl, *cm_idlest_pll; | 38 | extern void __iomem *prcm_clksrc_ctrl; |
| 36 | |||
| 37 | extern struct clk *dclk; | ||
| 38 | 39 | ||
| 39 | extern const struct clkops clkops_omap2430_i2chs_wait; | 40 | extern const struct clkops clkops_omap2430_i2chs_wait; |
| 40 | extern const struct clkops clkops_oscck; | 41 | extern const struct clkops clkops_oscck; |
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index baaaa4258708..e41819ba7482 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include "clock.h" | 24 | #include "clock.h" |
| 25 | #include "clock34xx.h" | 25 | #include "clock34xx.h" |
| 26 | #include "cm2xxx_3xxx.h" | 26 | #include "cm3xxx.h" |
| 27 | #include "cm-regbits-34xx.h" | 27 | #include "cm-regbits-34xx.h" |
| 28 | 28 | ||
| 29 | /** | 29 | /** |
diff --git a/arch/arm/mach-omap2/clock3517.c b/arch/arm/mach-omap2/clock3517.c index 80209050cd7a..622ea0502610 100644 --- a/arch/arm/mach-omap2/clock3517.c +++ b/arch/arm/mach-omap2/clock3517.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include "clock.h" | 24 | #include "clock.h" |
| 25 | #include "clock3517.h" | 25 | #include "clock3517.h" |
| 26 | #include "cm2xxx_3xxx.h" | 26 | #include "cm3xxx.h" |
| 27 | #include "cm-regbits-34xx.h" | 27 | #include "cm-regbits-34xx.h" |
| 28 | 28 | ||
| 29 | /* | 29 | /* |
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c index a02d158568e8..6cca19953950 100644 --- a/arch/arm/mach-omap2/clock3xxx_data.c +++ b/arch/arm/mach-omap2/clock3xxx_data.c | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | #include "clock34xx.h" | 28 | #include "clock34xx.h" |
| 29 | #include "clock36xx.h" | 29 | #include "clock36xx.h" |
| 30 | #include "clock3517.h" | 30 | #include "clock3517.h" |
| 31 | #include "cm2xxx_3xxx.h" | 31 | #include "cm3xxx.h" |
| 32 | #include "cm-regbits-34xx.h" | 32 | #include "cm-regbits-34xx.h" |
| 33 | #include "prm2xxx_3xxx.h" | 33 | #include "prm2xxx_3xxx.h" |
| 34 | #include "prm-regbits-34xx.h" | 34 | #include "prm-regbits-34xx.h" |
diff --git a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c b/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c deleted file mode 100644 index 3e4e9209b2df..000000000000 --- a/arch/arm/mach-omap2/clockdomain2xxx_3xxx.c +++ /dev/null | |||
| @@ -1,341 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * OMAP2 and OMAP3 clockdomain control | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2010 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2008-2010 Nokia Corporation | ||
| 6 | * | ||
| 7 | * Derived from mach-omap2/clockdomain.c written by Paul Walmsley | ||
| 8 | * Rajendra Nayak <rnayak@ti.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/types.h> | ||
| 16 | #include <plat/prcm.h> | ||
| 17 | |||
| 18 | #include "soc.h" | ||
| 19 | #include "prm.h" | ||
| 20 | #include "prm2xxx_3xxx.h" | ||
| 21 | #include "cm.h" | ||
| 22 | #include "cm2xxx_3xxx.h" | ||
| 23 | #include "cm-regbits-24xx.h" | ||
| 24 | #include "cm-regbits-34xx.h" | ||
| 25 | #include "prm-regbits-24xx.h" | ||
| 26 | #include "clockdomain.h" | ||
| 27 | |||
| 28 | static int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1, | ||
| 29 | struct clockdomain *clkdm2) | ||
| 30 | { | ||
| 31 | omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit), | ||
| 32 | clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP); | ||
| 33 | return 0; | ||
| 34 | } | ||
| 35 | |||
| 36 | static int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1, | ||
| 37 | struct clockdomain *clkdm2) | ||
| 38 | { | ||
| 39 | omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit), | ||
| 40 | clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP); | ||
| 41 | return 0; | ||
| 42 | } | ||
| 43 | |||
| 44 | static int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1, | ||
| 45 | struct clockdomain *clkdm2) | ||
| 46 | { | ||
| 47 | return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs, | ||
| 48 | PM_WKDEP, (1 << clkdm2->dep_bit)); | ||
| 49 | } | ||
| 50 | |||
| 51 | static int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm) | ||
| 52 | { | ||
| 53 | struct clkdm_dep *cd; | ||
| 54 | u32 mask = 0; | ||
| 55 | |||
| 56 | for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) { | ||
| 57 | if (!cd->clkdm) | ||
| 58 | continue; /* only happens if data is erroneous */ | ||
| 59 | |||
| 60 | /* PRM accesses are slow, so minimize them */ | ||
| 61 | mask |= 1 << cd->clkdm->dep_bit; | ||
| 62 | atomic_set(&cd->wkdep_usecount, 0); | ||
| 63 | } | ||
| 64 | |||
| 65 | omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs, | ||
| 66 | PM_WKDEP); | ||
| 67 | return 0; | ||
| 68 | } | ||
| 69 | |||
| 70 | static int omap3_clkdm_add_sleepdep(struct clockdomain *clkdm1, | ||
| 71 | struct clockdomain *clkdm2) | ||
| 72 | { | ||
| 73 | omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit), | ||
| 74 | clkdm1->pwrdm.ptr->prcm_offs, | ||
| 75 | OMAP3430_CM_SLEEPDEP); | ||
| 76 | return 0; | ||
| 77 | } | ||
| 78 | |||
| 79 | static int omap3_clkdm_del_sleepdep(struct clockdomain *clkdm1, | ||
| 80 | struct clockdomain *clkdm2) | ||
| 81 | { | ||
| 82 | omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit), | ||
| 83 | clkdm1->pwrdm.ptr->prcm_offs, | ||
| 84 | OMAP3430_CM_SLEEPDEP); | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | |||
| 88 | static int omap3_clkdm_read_sleepdep(struct clockdomain *clkdm1, | ||
| 89 | struct clockdomain *clkdm2) | ||
| 90 | { | ||
| 91 | return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs, | ||
| 92 | OMAP3430_CM_SLEEPDEP, (1 << clkdm2->dep_bit)); | ||
| 93 | } | ||
| 94 | |||
| 95 | static int omap3_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm) | ||
| 96 | { | ||
| 97 | struct clkdm_dep *cd; | ||
| 98 | u32 mask = 0; | ||
| 99 | |||
| 100 | for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) { | ||
| 101 | if (!cd->clkdm) | ||
| 102 | continue; /* only happens if data is erroneous */ | ||
| 103 | |||
| 104 | /* PRM accesses are slow, so minimize them */ | ||
| 105 | mask |= 1 << cd->clkdm->dep_bit; | ||
| 106 | atomic_set(&cd->sleepdep_usecount, 0); | ||
| 107 | } | ||
| 108 | omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs, | ||
| 109 | OMAP3430_CM_SLEEPDEP); | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | static int omap2_clkdm_sleep(struct clockdomain *clkdm) | ||
| 114 | { | ||
| 115 | omap2_cm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK, | ||
| 116 | clkdm->pwrdm.ptr->prcm_offs, | ||
| 117 | OMAP2_PM_PWSTCTRL); | ||
| 118 | return 0; | ||
| 119 | } | ||
| 120 | |||
| 121 | static int omap2_clkdm_wakeup(struct clockdomain *clkdm) | ||
| 122 | { | ||
| 123 | omap2_cm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK, | ||
| 124 | clkdm->pwrdm.ptr->prcm_offs, | ||
| 125 | OMAP2_PM_PWSTCTRL); | ||
| 126 | return 0; | ||
| 127 | } | ||
| 128 | |||
| 129 | static void omap2_clkdm_allow_idle(struct clockdomain *clkdm) | ||
| 130 | { | ||
| 131 | if (atomic_read(&clkdm->usecount) > 0) | ||
| 132 | _clkdm_add_autodeps(clkdm); | ||
| 133 | |||
| 134 | omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 135 | clkdm->clktrctrl_mask); | ||
| 136 | } | ||
| 137 | |||
| 138 | static void omap2_clkdm_deny_idle(struct clockdomain *clkdm) | ||
| 139 | { | ||
| 140 | omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 141 | clkdm->clktrctrl_mask); | ||
| 142 | |||
| 143 | if (atomic_read(&clkdm->usecount) > 0) | ||
| 144 | _clkdm_del_autodeps(clkdm); | ||
| 145 | } | ||
| 146 | |||
| 147 | static void _enable_hwsup(struct clockdomain *clkdm) | ||
| 148 | { | ||
| 149 | if (cpu_is_omap24xx()) | ||
| 150 | omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 151 | clkdm->clktrctrl_mask); | ||
| 152 | else if (cpu_is_omap34xx()) | ||
| 153 | omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 154 | clkdm->clktrctrl_mask); | ||
| 155 | } | ||
| 156 | |||
| 157 | static void _disable_hwsup(struct clockdomain *clkdm) | ||
| 158 | { | ||
| 159 | if (cpu_is_omap24xx()) | ||
| 160 | omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 161 | clkdm->clktrctrl_mask); | ||
| 162 | else if (cpu_is_omap34xx()) | ||
| 163 | omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 164 | clkdm->clktrctrl_mask); | ||
| 165 | } | ||
| 166 | |||
| 167 | static int omap3_clkdm_sleep(struct clockdomain *clkdm) | ||
| 168 | { | ||
| 169 | omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs, | ||
| 170 | clkdm->clktrctrl_mask); | ||
| 171 | return 0; | ||
| 172 | } | ||
| 173 | |||
| 174 | static int omap3_clkdm_wakeup(struct clockdomain *clkdm) | ||
| 175 | { | ||
| 176 | omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 177 | clkdm->clktrctrl_mask); | ||
| 178 | return 0; | ||
| 179 | } | ||
| 180 | |||
| 181 | static int omap2_clkdm_clk_enable(struct clockdomain *clkdm) | ||
| 182 | { | ||
| 183 | bool hwsup = false; | ||
| 184 | |||
| 185 | if (!clkdm->clktrctrl_mask) | ||
| 186 | return 0; | ||
| 187 | |||
| 188 | hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 189 | clkdm->clktrctrl_mask); | ||
| 190 | |||
| 191 | if (hwsup) { | ||
| 192 | /* Disable HW transitions when we are changing deps */ | ||
| 193 | _disable_hwsup(clkdm); | ||
| 194 | _clkdm_add_autodeps(clkdm); | ||
| 195 | _enable_hwsup(clkdm); | ||
| 196 | } else { | ||
| 197 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 198 | omap2_clkdm_wakeup(clkdm); | ||
| 199 | } | ||
| 200 | |||
| 201 | return 0; | ||
| 202 | } | ||
| 203 | |||
| 204 | static int omap2_clkdm_clk_disable(struct clockdomain *clkdm) | ||
| 205 | { | ||
| 206 | bool hwsup = false; | ||
| 207 | |||
| 208 | if (!clkdm->clktrctrl_mask) | ||
| 209 | return 0; | ||
| 210 | |||
| 211 | hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 212 | clkdm->clktrctrl_mask); | ||
| 213 | |||
| 214 | if (hwsup) { | ||
| 215 | /* Disable HW transitions when we are changing deps */ | ||
| 216 | _disable_hwsup(clkdm); | ||
| 217 | _clkdm_del_autodeps(clkdm); | ||
| 218 | _enable_hwsup(clkdm); | ||
| 219 | } else { | ||
| 220 | if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP) | ||
| 221 | omap2_clkdm_sleep(clkdm); | ||
| 222 | } | ||
| 223 | |||
| 224 | return 0; | ||
| 225 | } | ||
| 226 | |||
| 227 | static void omap3_clkdm_allow_idle(struct clockdomain *clkdm) | ||
| 228 | { | ||
| 229 | if (atomic_read(&clkdm->usecount) > 0) | ||
| 230 | _clkdm_add_autodeps(clkdm); | ||
| 231 | |||
| 232 | omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 233 | clkdm->clktrctrl_mask); | ||
| 234 | } | ||
| 235 | |||
| 236 | static void omap3_clkdm_deny_idle(struct clockdomain *clkdm) | ||
| 237 | { | ||
| 238 | omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 239 | clkdm->clktrctrl_mask); | ||
| 240 | |||
| 241 | if (atomic_read(&clkdm->usecount) > 0) | ||
| 242 | _clkdm_del_autodeps(clkdm); | ||
| 243 | } | ||
| 244 | |||
| 245 | static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm) | ||
| 246 | { | ||
| 247 | bool hwsup = false; | ||
| 248 | |||
| 249 | if (!clkdm->clktrctrl_mask) | ||
| 250 | return 0; | ||
| 251 | |||
| 252 | /* | ||
| 253 | * The CLKDM_MISSING_IDLE_REPORTING flag documentation has | ||
| 254 | * more details on the unpleasant problem this is working | ||
| 255 | * around | ||
| 256 | */ | ||
| 257 | if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) && | ||
| 258 | (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) { | ||
| 259 | omap3_clkdm_wakeup(clkdm); | ||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | |||
| 263 | hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 264 | clkdm->clktrctrl_mask); | ||
| 265 | |||
| 266 | if (hwsup) { | ||
| 267 | /* Disable HW transitions when we are changing deps */ | ||
| 268 | _disable_hwsup(clkdm); | ||
| 269 | _clkdm_add_autodeps(clkdm); | ||
| 270 | _enable_hwsup(clkdm); | ||
| 271 | } else { | ||
| 272 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 273 | omap3_clkdm_wakeup(clkdm); | ||
| 274 | } | ||
| 275 | |||
| 276 | return 0; | ||
| 277 | } | ||
| 278 | |||
| 279 | static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm) | ||
| 280 | { | ||
| 281 | bool hwsup = false; | ||
| 282 | |||
| 283 | if (!clkdm->clktrctrl_mask) | ||
| 284 | return 0; | ||
| 285 | |||
| 286 | /* | ||
| 287 | * The CLKDM_MISSING_IDLE_REPORTING flag documentation has | ||
| 288 | * more details on the unpleasant problem this is working | ||
| 289 | * around | ||
| 290 | */ | ||
| 291 | if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING && | ||
| 292 | !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) { | ||
| 293 | _enable_hwsup(clkdm); | ||
| 294 | return 0; | ||
| 295 | } | ||
| 296 | |||
| 297 | hwsup = omap2_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 298 | clkdm->clktrctrl_mask); | ||
| 299 | |||
| 300 | if (hwsup) { | ||
| 301 | /* Disable HW transitions when we are changing deps */ | ||
| 302 | _disable_hwsup(clkdm); | ||
| 303 | _clkdm_del_autodeps(clkdm); | ||
| 304 | _enable_hwsup(clkdm); | ||
| 305 | } else { | ||
| 306 | if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP) | ||
| 307 | omap3_clkdm_sleep(clkdm); | ||
| 308 | } | ||
| 309 | |||
| 310 | return 0; | ||
| 311 | } | ||
| 312 | |||
| 313 | struct clkdm_ops omap2_clkdm_operations = { | ||
| 314 | .clkdm_add_wkdep = omap2_clkdm_add_wkdep, | ||
| 315 | .clkdm_del_wkdep = omap2_clkdm_del_wkdep, | ||
| 316 | .clkdm_read_wkdep = omap2_clkdm_read_wkdep, | ||
| 317 | .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, | ||
| 318 | .clkdm_sleep = omap2_clkdm_sleep, | ||
| 319 | .clkdm_wakeup = omap2_clkdm_wakeup, | ||
| 320 | .clkdm_allow_idle = omap2_clkdm_allow_idle, | ||
| 321 | .clkdm_deny_idle = omap2_clkdm_deny_idle, | ||
| 322 | .clkdm_clk_enable = omap2_clkdm_clk_enable, | ||
| 323 | .clkdm_clk_disable = omap2_clkdm_clk_disable, | ||
| 324 | }; | ||
| 325 | |||
| 326 | struct clkdm_ops omap3_clkdm_operations = { | ||
| 327 | .clkdm_add_wkdep = omap2_clkdm_add_wkdep, | ||
| 328 | .clkdm_del_wkdep = omap2_clkdm_del_wkdep, | ||
| 329 | .clkdm_read_wkdep = omap2_clkdm_read_wkdep, | ||
| 330 | .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, | ||
| 331 | .clkdm_add_sleepdep = omap3_clkdm_add_sleepdep, | ||
| 332 | .clkdm_del_sleepdep = omap3_clkdm_del_sleepdep, | ||
| 333 | .clkdm_read_sleepdep = omap3_clkdm_read_sleepdep, | ||
| 334 | .clkdm_clear_all_sleepdeps = omap3_clkdm_clear_all_sleepdeps, | ||
| 335 | .clkdm_sleep = omap3_clkdm_sleep, | ||
| 336 | .clkdm_wakeup = omap3_clkdm_wakeup, | ||
| 337 | .clkdm_allow_idle = omap3_clkdm_allow_idle, | ||
| 338 | .clkdm_deny_idle = omap3_clkdm_deny_idle, | ||
| 339 | .clkdm_clk_enable = omap3xxx_clkdm_clk_enable, | ||
| 340 | .clkdm_clk_disable = omap3xxx_clkdm_clk_disable, | ||
| 341 | }; | ||
diff --git a/arch/arm/mach-omap2/clockdomain33xx.c b/arch/arm/mach-omap2/clockdomain33xx.c deleted file mode 100644 index aca6388fad76..000000000000 --- a/arch/arm/mach-omap2/clockdomain33xx.c +++ /dev/null | |||
| @@ -1,74 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * AM33XX clockdomain control | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/ | ||
| 5 | * Vaibhav Hiremath <hvaibhav@ti.com> | ||
| 6 | * | ||
| 7 | * Derived from mach-omap2/clockdomain44xx.c written by Rajendra Nayak | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or | ||
| 10 | * modify it under the terms of the GNU General Public License as | ||
| 11 | * published by the Free Software Foundation version 2. | ||
| 12 | * | ||
| 13 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
| 14 | * kind, whether express or implied; without even the implied warranty | ||
| 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/kernel.h> | ||
| 20 | |||
| 21 | #include "clockdomain.h" | ||
| 22 | #include "cm33xx.h" | ||
| 23 | |||
| 24 | |||
| 25 | static int am33xx_clkdm_sleep(struct clockdomain *clkdm) | ||
| 26 | { | ||
| 27 | am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 28 | return 0; | ||
| 29 | } | ||
| 30 | |||
| 31 | static int am33xx_clkdm_wakeup(struct clockdomain *clkdm) | ||
| 32 | { | ||
| 33 | am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 34 | return 0; | ||
| 35 | } | ||
| 36 | |||
| 37 | static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm) | ||
| 38 | { | ||
| 39 | am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 40 | } | ||
| 41 | |||
| 42 | static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm) | ||
| 43 | { | ||
| 44 | am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 45 | } | ||
| 46 | |||
| 47 | static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm) | ||
| 48 | { | ||
| 49 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 50 | return am33xx_clkdm_wakeup(clkdm); | ||
| 51 | |||
| 52 | return 0; | ||
| 53 | } | ||
| 54 | |||
| 55 | static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm) | ||
| 56 | { | ||
| 57 | bool hwsup = false; | ||
| 58 | |||
| 59 | hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 60 | |||
| 61 | if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) | ||
| 62 | am33xx_clkdm_sleep(clkdm); | ||
| 63 | |||
| 64 | return 0; | ||
| 65 | } | ||
| 66 | |||
| 67 | struct clkdm_ops am33xx_clkdm_operations = { | ||
| 68 | .clkdm_sleep = am33xx_clkdm_sleep, | ||
| 69 | .clkdm_wakeup = am33xx_clkdm_wakeup, | ||
| 70 | .clkdm_allow_idle = am33xx_clkdm_allow_idle, | ||
| 71 | .clkdm_deny_idle = am33xx_clkdm_deny_idle, | ||
| 72 | .clkdm_clk_enable = am33xx_clkdm_clk_enable, | ||
| 73 | .clkdm_clk_disable = am33xx_clkdm_clk_disable, | ||
| 74 | }; | ||
diff --git a/arch/arm/mach-omap2/clockdomain44xx.c b/arch/arm/mach-omap2/clockdomain44xx.c deleted file mode 100644 index 6fc6155625bc..000000000000 --- a/arch/arm/mach-omap2/clockdomain44xx.c +++ /dev/null | |||
| @@ -1,151 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * OMAP4 clockdomain control | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008-2010 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2008-2010 Nokia Corporation | ||
| 6 | * | ||
| 7 | * Derived from mach-omap2/clockdomain.c written by Paul Walmsley | ||
| 8 | * Rajendra Nayak <rnayak@ti.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/kernel.h> | ||
| 16 | #include "clockdomain.h" | ||
| 17 | #include "cminst44xx.h" | ||
| 18 | #include "cm44xx.h" | ||
| 19 | |||
| 20 | static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1, | ||
| 21 | struct clockdomain *clkdm2) | ||
| 22 | { | ||
| 23 | omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit), | ||
| 24 | clkdm1->prcm_partition, | ||
| 25 | clkdm1->cm_inst, clkdm1->clkdm_offs + | ||
| 26 | OMAP4_CM_STATICDEP); | ||
| 27 | return 0; | ||
| 28 | } | ||
| 29 | |||
| 30 | static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1, | ||
| 31 | struct clockdomain *clkdm2) | ||
| 32 | { | ||
| 33 | omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit), | ||
| 34 | clkdm1->prcm_partition, | ||
| 35 | clkdm1->cm_inst, clkdm1->clkdm_offs + | ||
| 36 | OMAP4_CM_STATICDEP); | ||
| 37 | return 0; | ||
| 38 | } | ||
| 39 | |||
| 40 | static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1, | ||
| 41 | struct clockdomain *clkdm2) | ||
| 42 | { | ||
| 43 | return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition, | ||
| 44 | clkdm1->cm_inst, clkdm1->clkdm_offs + | ||
| 45 | OMAP4_CM_STATICDEP, | ||
| 46 | (1 << clkdm2->dep_bit)); | ||
| 47 | } | ||
| 48 | |||
| 49 | static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm) | ||
| 50 | { | ||
| 51 | struct clkdm_dep *cd; | ||
| 52 | u32 mask = 0; | ||
| 53 | |||
| 54 | if (!clkdm->prcm_partition) | ||
| 55 | return 0; | ||
| 56 | |||
| 57 | for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) { | ||
| 58 | if (!cd->clkdm) | ||
| 59 | continue; /* only happens if data is erroneous */ | ||
| 60 | |||
| 61 | mask |= 1 << cd->clkdm->dep_bit; | ||
| 62 | atomic_set(&cd->wkdep_usecount, 0); | ||
| 63 | } | ||
| 64 | |||
| 65 | omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition, | ||
| 66 | clkdm->cm_inst, clkdm->clkdm_offs + | ||
| 67 | OMAP4_CM_STATICDEP); | ||
| 68 | return 0; | ||
| 69 | } | ||
| 70 | |||
| 71 | static int omap4_clkdm_sleep(struct clockdomain *clkdm) | ||
| 72 | { | ||
| 73 | omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition, | ||
| 74 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 75 | return 0; | ||
| 76 | } | ||
| 77 | |||
| 78 | static int omap4_clkdm_wakeup(struct clockdomain *clkdm) | ||
| 79 | { | ||
| 80 | omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition, | ||
| 81 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 82 | return 0; | ||
| 83 | } | ||
| 84 | |||
| 85 | static void omap4_clkdm_allow_idle(struct clockdomain *clkdm) | ||
| 86 | { | ||
| 87 | omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition, | ||
| 88 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 89 | } | ||
| 90 | |||
| 91 | static void omap4_clkdm_deny_idle(struct clockdomain *clkdm) | ||
| 92 | { | ||
| 93 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 94 | omap4_clkdm_wakeup(clkdm); | ||
| 95 | else | ||
| 96 | omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition, | ||
| 97 | clkdm->cm_inst, | ||
| 98 | clkdm->clkdm_offs); | ||
| 99 | } | ||
| 100 | |||
| 101 | static int omap4_clkdm_clk_enable(struct clockdomain *clkdm) | ||
| 102 | { | ||
| 103 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 104 | return omap4_clkdm_wakeup(clkdm); | ||
| 105 | |||
| 106 | return 0; | ||
| 107 | } | ||
| 108 | |||
| 109 | static int omap4_clkdm_clk_disable(struct clockdomain *clkdm) | ||
| 110 | { | ||
| 111 | bool hwsup = false; | ||
| 112 | |||
| 113 | if (!clkdm->prcm_partition) | ||
| 114 | return 0; | ||
| 115 | |||
| 116 | /* | ||
| 117 | * The CLKDM_MISSING_IDLE_REPORTING flag documentation has | ||
| 118 | * more details on the unpleasant problem this is working | ||
| 119 | * around | ||
| 120 | */ | ||
| 121 | if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING && | ||
| 122 | !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) { | ||
| 123 | omap4_clkdm_allow_idle(clkdm); | ||
| 124 | return 0; | ||
| 125 | } | ||
| 126 | |||
| 127 | hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition, | ||
| 128 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 129 | |||
| 130 | if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) | ||
| 131 | omap4_clkdm_sleep(clkdm); | ||
| 132 | |||
| 133 | return 0; | ||
| 134 | } | ||
| 135 | |||
| 136 | struct clkdm_ops omap4_clkdm_operations = { | ||
| 137 | .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep, | ||
| 138 | .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep, | ||
| 139 | .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep, | ||
| 140 | .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps, | ||
| 141 | .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep, | ||
| 142 | .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep, | ||
| 143 | .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep, | ||
| 144 | .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps, | ||
| 145 | .clkdm_sleep = omap4_clkdm_sleep, | ||
| 146 | .clkdm_wakeup = omap4_clkdm_wakeup, | ||
| 147 | .clkdm_allow_idle = omap4_clkdm_allow_idle, | ||
| 148 | .clkdm_deny_idle = omap4_clkdm_deny_idle, | ||
| 149 | .clkdm_clk_enable = omap4_clkdm_clk_enable, | ||
| 150 | .clkdm_clk_disable = omap4_clkdm_clk_disable, | ||
| 151 | }; | ||
diff --git a/arch/arm/mach-omap2/cm-regbits-24xx.h b/arch/arm/mach-omap2/cm-regbits-24xx.h index 686290437568..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 f24e3f7a2bbc..93473f9a551c 100644 --- a/arch/arm/mach-omap2/cm.h +++ b/arch/arm/mach-omap2/cm.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * OMAP2+ Clock Management prototypes | 2 | * OMAP2+ Clock Management prototypes |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007-2009 Texas Instruments, Inc. | 4 | * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc. |
| 5 | * Copyright (C) 2007-2009 Nokia Corporation | 5 | * Copyright (C) 2007-2009 Nokia Corporation |
| 6 | * | 6 | * |
| 7 | * Written by Paul Walmsley | 7 | * Written by Paul Walmsley |
| @@ -22,6 +22,12 @@ | |||
| 22 | */ | 22 | */ |
| 23 | #define MAX_MODULE_READY_TIME 2000 | 23 | #define MAX_MODULE_READY_TIME 2000 |
| 24 | 24 | ||
| 25 | # ifndef __ASSEMBLER__ | ||
| 26 | extern void __iomem *cm_base; | ||
| 27 | extern void __iomem *cm2_base; | ||
| 28 | extern void omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2); | ||
| 29 | # endif | ||
| 30 | |||
| 25 | /* | 31 | /* |
| 26 | * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for | 32 | * MAX_MODULE_DISABLE_TIME: max duration in microseconds to wait for |
| 27 | * the PRCM to request that a module enter the inactive state in the | 33 | * the PRCM to request that a module enter the inactive state in the |
| @@ -33,4 +39,26 @@ | |||
| 33 | */ | 39 | */ |
| 34 | #define MAX_MODULE_DISABLE_TIME 5000 | 40 | #define MAX_MODULE_DISABLE_TIME 5000 |
| 35 | 41 | ||
| 42 | # ifndef __ASSEMBLER__ | ||
| 43 | |||
| 44 | /** | ||
| 45 | * struct cm_ll_data - fn ptrs to per-SoC CM function implementations | ||
| 46 | * @split_idlest_reg: ptr to the SoC CM-specific split_idlest_reg impl | ||
| 47 | * @wait_module_ready: ptr to the SoC CM-specific wait_module_ready impl | ||
| 48 | */ | ||
| 49 | struct 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 | |||
| 55 | extern int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, | ||
| 56 | u8 *idlest_reg_id); | ||
| 57 | extern int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift); | ||
| 58 | |||
| 59 | extern int cm_register(struct cm_ll_data *cld); | ||
| 60 | extern int cm_unregister(struct cm_ll_data *cld); | ||
| 61 | |||
| 62 | # endif | ||
| 63 | |||
| 36 | #endif | 64 | #endif |
diff --git a/arch/arm/mach-omap2/cm2xxx.c b/arch/arm/mach-omap2/cm2xxx.c new file mode 100644 index 000000000000..db650690e9d0 --- /dev/null +++ b/arch/arm/mach-omap2/cm2xxx.c | |||
| @@ -0,0 +1,381 @@ | |||
| 1 | /* | ||
| 2 | * OMAP2xxx CM module functions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Nokia Corporation | ||
| 5 | * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc. | ||
| 6 | * Paul Walmsley | ||
| 7 | * Rajendra Nayak <rnayak@ti.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or modify | ||
| 10 | * it under the terms of the GNU General Public License version 2 as | ||
| 11 | * published by the Free Software Foundation. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/types.h> | ||
| 16 | #include <linux/delay.h> | ||
| 17 | #include <linux/errno.h> | ||
| 18 | #include <linux/err.h> | ||
| 19 | #include <linux/io.h> | ||
| 20 | |||
| 21 | #include "soc.h" | ||
| 22 | #include "iomap.h" | ||
| 23 | #include "common.h" | ||
| 24 | #include "prm2xxx.h" | ||
| 25 | #include "cm.h" | ||
| 26 | #include "cm2xxx.h" | ||
| 27 | #include "cm-regbits-24xx.h" | ||
| 28 | #include "clockdomain.h" | ||
| 29 | |||
| 30 | /* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */ | ||
| 31 | #define DPLL_AUTOIDLE_DISABLE 0x0 | ||
| 32 | #define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3 | ||
| 33 | |||
| 34 | /* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */ | ||
| 35 | #define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0 | ||
| 36 | #define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3 | ||
| 37 | |||
| 38 | /* CM_IDLEST_PLL bit value offset for APLLs (OMAP2xxx only) */ | ||
| 39 | #define EN_APLL_LOCKED 3 | ||
| 40 | |||
| 41 | static const u8 omap2xxx_cm_idlest_offs[] = { | ||
| 42 | CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4 | ||
| 43 | }; | ||
| 44 | |||
| 45 | /* | ||
| 46 | * | ||
| 47 | */ | ||
| 48 | |||
| 49 | static void _write_clktrctrl(u8 c, s16 module, u32 mask) | ||
| 50 | { | ||
| 51 | u32 v; | ||
| 52 | |||
| 53 | v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL); | ||
| 54 | v &= ~mask; | ||
| 55 | v |= c << __ffs(mask); | ||
| 56 | omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL); | ||
| 57 | } | ||
| 58 | |||
| 59 | bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask) | ||
| 60 | { | ||
| 61 | u32 v; | ||
| 62 | |||
| 63 | v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL); | ||
| 64 | v &= mask; | ||
| 65 | v >>= __ffs(mask); | ||
| 66 | |||
| 67 | return (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0; | ||
| 68 | } | ||
| 69 | |||
| 70 | void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) | ||
| 71 | { | ||
| 72 | _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask); | ||
| 73 | } | ||
| 74 | |||
| 75 | void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask) | ||
| 76 | { | ||
| 77 | _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask); | ||
| 78 | } | ||
| 79 | |||
| 80 | /* | ||
| 81 | * DPLL autoidle control | ||
| 82 | */ | ||
| 83 | |||
| 84 | static void _omap2xxx_set_dpll_autoidle(u8 m) | ||
| 85 | { | ||
| 86 | u32 v; | ||
| 87 | |||
| 88 | v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); | ||
| 89 | v &= ~OMAP24XX_AUTO_DPLL_MASK; | ||
| 90 | v |= m << OMAP24XX_AUTO_DPLL_SHIFT; | ||
| 91 | omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE); | ||
| 92 | } | ||
| 93 | |||
| 94 | void omap2xxx_cm_set_dpll_disable_autoidle(void) | ||
| 95 | { | ||
| 96 | _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP); | ||
| 97 | } | ||
| 98 | |||
| 99 | void omap2xxx_cm_set_dpll_auto_low_power_stop(void) | ||
| 100 | { | ||
| 101 | _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE); | ||
| 102 | } | ||
| 103 | |||
| 104 | /* | ||
| 105 | * APLL control | ||
| 106 | */ | ||
| 107 | |||
| 108 | static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask) | ||
| 109 | { | ||
| 110 | u32 v; | ||
| 111 | |||
| 112 | v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); | ||
| 113 | v &= ~mask; | ||
| 114 | v |= m << __ffs(mask); | ||
| 115 | omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE); | ||
| 116 | } | ||
| 117 | |||
| 118 | void omap2xxx_cm_set_apll54_disable_autoidle(void) | ||
| 119 | { | ||
| 120 | _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, | ||
| 121 | OMAP24XX_AUTO_54M_MASK); | ||
| 122 | } | ||
| 123 | |||
| 124 | void omap2xxx_cm_set_apll54_auto_low_power_stop(void) | ||
| 125 | { | ||
| 126 | _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, | ||
| 127 | OMAP24XX_AUTO_54M_MASK); | ||
| 128 | } | ||
| 129 | |||
| 130 | void omap2xxx_cm_set_apll96_disable_autoidle(void) | ||
| 131 | { | ||
| 132 | _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, | ||
| 133 | OMAP24XX_AUTO_96M_MASK); | ||
| 134 | } | ||
| 135 | |||
| 136 | void omap2xxx_cm_set_apll96_auto_low_power_stop(void) | ||
| 137 | { | ||
| 138 | _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, | ||
| 139 | OMAP24XX_AUTO_96M_MASK); | ||
| 140 | } | ||
| 141 | |||
| 142 | /* Enable an APLL if off */ | ||
| 143 | static 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 */ | ||
| 166 | static 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 */ | ||
| 176 | int 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 */ | ||
| 183 | int 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 */ | ||
| 190 | void omap2xxx_cm_apll54_disable(void) | ||
| 191 | { | ||
| 192 | _omap2xxx_apll_disable(OMAP24XX_EN_54M_PLL_SHIFT); | ||
| 193 | } | ||
| 194 | |||
| 195 | /* Stop APLL */ | ||
| 196 | void 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 | */ | ||
| 210 | int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, | ||
| 211 | u8 *idlest_reg_id) | ||
| 212 | { | ||
| 213 | unsigned long offs; | ||
| 214 | u8 idlest_offs; | ||
| 215 | int i; | ||
| 216 | |||
| 217 | if (idlest_reg < cm_base || idlest_reg > (cm_base + 0x0fff)) | ||
| 218 | return -EINVAL; | ||
| 219 | |||
| 220 | idlest_offs = (unsigned long)idlest_reg & 0xff; | ||
| 221 | for (i = 0; i < ARRAY_SIZE(omap2xxx_cm_idlest_offs); i++) { | ||
| 222 | if (idlest_offs == omap2xxx_cm_idlest_offs[i]) { | ||
| 223 | *idlest_reg_id = i + 1; | ||
| 224 | break; | ||
| 225 | } | ||
| 226 | } | ||
| 227 | |||
| 228 | if (i == ARRAY_SIZE(omap2xxx_cm_idlest_offs)) | ||
| 229 | return -EINVAL; | ||
| 230 | |||
| 231 | offs = idlest_reg - cm_base; | ||
| 232 | offs &= 0xff00; | ||
| 233 | *prcm_inst = offs; | ||
| 234 | |||
| 235 | return 0; | ||
| 236 | } | ||
| 237 | |||
| 238 | /* | ||
| 239 | * | ||
| 240 | */ | ||
| 241 | |||
| 242 | /** | ||
| 243 | * omap2xxx_cm_wait_module_ready - wait for a module to leave idle or standby | ||
| 244 | * @prcm_mod: PRCM module offset | ||
| 245 | * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) | ||
| 246 | * @idlest_shift: shift of the bit in the CM_IDLEST* register to check | ||
| 247 | * | ||
| 248 | * Wait for the PRCM to indicate that the module identified by | ||
| 249 | * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon | ||
| 250 | * success or -EBUSY if the module doesn't enable in time. | ||
| 251 | */ | ||
| 252 | int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) | ||
| 253 | { | ||
| 254 | int ena = 0, i = 0; | ||
| 255 | u8 cm_idlest_reg; | ||
| 256 | u32 mask; | ||
| 257 | |||
| 258 | if (!idlest_id || (idlest_id > ARRAY_SIZE(omap2xxx_cm_idlest_offs))) | ||
| 259 | return -EINVAL; | ||
| 260 | |||
| 261 | cm_idlest_reg = omap2xxx_cm_idlest_offs[idlest_id - 1]; | ||
| 262 | |||
| 263 | mask = 1 << idlest_shift; | ||
| 264 | ena = mask; | ||
| 265 | |||
| 266 | omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) & | ||
| 267 | mask) == ena), MAX_MODULE_READY_TIME, i); | ||
| 268 | |||
| 269 | return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; | ||
| 270 | } | ||
| 271 | |||
| 272 | /* Clockdomain low-level functions */ | ||
| 273 | |||
| 274 | static void omap2xxx_clkdm_allow_idle(struct clockdomain *clkdm) | ||
| 275 | { | ||
| 276 | if (atomic_read(&clkdm->usecount) > 0) | ||
| 277 | _clkdm_add_autodeps(clkdm); | ||
| 278 | |||
| 279 | omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 280 | clkdm->clktrctrl_mask); | ||
| 281 | } | ||
| 282 | |||
| 283 | static void omap2xxx_clkdm_deny_idle(struct clockdomain *clkdm) | ||
| 284 | { | ||
| 285 | omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 286 | clkdm->clktrctrl_mask); | ||
| 287 | |||
| 288 | if (atomic_read(&clkdm->usecount) > 0) | ||
| 289 | _clkdm_del_autodeps(clkdm); | ||
| 290 | } | ||
| 291 | |||
| 292 | static int omap2xxx_clkdm_clk_enable(struct clockdomain *clkdm) | ||
| 293 | { | ||
| 294 | bool hwsup = false; | ||
| 295 | |||
| 296 | if (!clkdm->clktrctrl_mask) | ||
| 297 | return 0; | ||
| 298 | |||
| 299 | hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 300 | clkdm->clktrctrl_mask); | ||
| 301 | |||
| 302 | if (hwsup) { | ||
| 303 | /* Disable HW transitions when we are changing deps */ | ||
| 304 | omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 305 | clkdm->clktrctrl_mask); | ||
| 306 | _clkdm_add_autodeps(clkdm); | ||
| 307 | omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 308 | clkdm->clktrctrl_mask); | ||
| 309 | } else { | ||
| 310 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 311 | omap2xxx_clkdm_wakeup(clkdm); | ||
| 312 | } | ||
| 313 | |||
| 314 | return 0; | ||
| 315 | } | ||
| 316 | |||
| 317 | static int omap2xxx_clkdm_clk_disable(struct clockdomain *clkdm) | ||
| 318 | { | ||
| 319 | bool hwsup = false; | ||
| 320 | |||
| 321 | if (!clkdm->clktrctrl_mask) | ||
| 322 | return 0; | ||
| 323 | |||
| 324 | hwsup = omap2xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 325 | clkdm->clktrctrl_mask); | ||
| 326 | |||
| 327 | if (hwsup) { | ||
| 328 | /* Disable HW transitions when we are changing deps */ | ||
| 329 | omap2xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 330 | clkdm->clktrctrl_mask); | ||
| 331 | _clkdm_del_autodeps(clkdm); | ||
| 332 | omap2xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 333 | clkdm->clktrctrl_mask); | ||
| 334 | } else { | ||
| 335 | if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP) | ||
| 336 | omap2xxx_clkdm_sleep(clkdm); | ||
| 337 | } | ||
| 338 | |||
| 339 | return 0; | ||
| 340 | } | ||
| 341 | |||
| 342 | struct clkdm_ops omap2_clkdm_operations = { | ||
| 343 | .clkdm_add_wkdep = omap2_clkdm_add_wkdep, | ||
| 344 | .clkdm_del_wkdep = omap2_clkdm_del_wkdep, | ||
| 345 | .clkdm_read_wkdep = omap2_clkdm_read_wkdep, | ||
| 346 | .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, | ||
| 347 | .clkdm_sleep = omap2xxx_clkdm_sleep, | ||
| 348 | .clkdm_wakeup = omap2xxx_clkdm_wakeup, | ||
| 349 | .clkdm_allow_idle = omap2xxx_clkdm_allow_idle, | ||
| 350 | .clkdm_deny_idle = omap2xxx_clkdm_deny_idle, | ||
| 351 | .clkdm_clk_enable = omap2xxx_clkdm_clk_enable, | ||
| 352 | .clkdm_clk_disable = omap2xxx_clkdm_clk_disable, | ||
| 353 | }; | ||
| 354 | |||
| 355 | /* | ||
| 356 | * | ||
| 357 | */ | ||
| 358 | |||
| 359 | static 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 | |||
| 364 | int __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 | |||
| 372 | static void __exit omap2xxx_cm_exit(void) | ||
| 373 | { | ||
| 374 | if (!cpu_is_omap24xx()) | ||
| 375 | return; | ||
| 376 | |||
| 377 | /* Should never happen */ | ||
| 378 | WARN(cm_unregister(&omap2xxx_cm_ll_data), | ||
| 379 | "%s: cm_ll_data function pointer mismatch\n", __func__); | ||
| 380 | } | ||
| 381 | __exitcall(omap2xxx_cm_exit); | ||
diff --git a/arch/arm/mach-omap2/cm2xxx.h b/arch/arm/mach-omap2/cm2xxx.h new file mode 100644 index 000000000000..4cbb39b051d2 --- /dev/null +++ b/arch/arm/mach-omap2/cm2xxx.h | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | /* | ||
| 2 | * OMAP2xxx Clock Management (CM) register definitions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007-2009, 2012 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2007-2010 Nokia Corporation | ||
| 6 | * Paul Walmsley | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * The CM hardware modules on the OMAP2/3 are quite similar to each | ||
| 13 | * other. The CM modules/instances on OMAP4 are quite different, so | ||
| 14 | * they are handled in a separate file. | ||
| 15 | */ | ||
| 16 | #ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_H | ||
| 17 | #define __ARCH_ASM_MACH_OMAP2_CM2XXX_H | ||
| 18 | |||
| 19 | #include "prcm-common.h" | ||
| 20 | #include "cm2xxx_3xxx.h" | ||
| 21 | |||
| 22 | #define OMAP2420_CM_REGADDR(module, reg) \ | ||
| 23 | OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg)) | ||
| 24 | #define OMAP2430_CM_REGADDR(module, reg) \ | ||
| 25 | OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg)) | ||
| 26 | |||
| 27 | /* | ||
| 28 | * Module specific CM register offsets from CM_BASE + domain offset | ||
| 29 | * Use cm_{read,write}_mod_reg() with these registers. | ||
| 30 | * These register offsets generally appear in more than one PRCM submodule. | ||
| 31 | */ | ||
| 32 | |||
| 33 | /* OMAP2-specific register offsets */ | ||
| 34 | |||
| 35 | #define OMAP24XX_CM_FCLKEN2 0x0004 | ||
| 36 | #define OMAP24XX_CM_ICLKEN4 0x001c | ||
| 37 | #define OMAP24XX_CM_AUTOIDLE4 0x003c | ||
| 38 | #define OMAP24XX_CM_IDLEST4 0x002c | ||
| 39 | |||
| 40 | /* CM_IDLEST bit field values to indicate deasserted IdleReq */ | ||
| 41 | |||
| 42 | #define OMAP24XX_CM_IDLEST_VAL 0 | ||
| 43 | |||
| 44 | |||
| 45 | /* Clock management domain register get/set */ | ||
| 46 | |||
| 47 | #ifndef __ASSEMBLER__ | ||
| 48 | |||
| 49 | extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); | ||
| 50 | extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask); | ||
| 51 | |||
| 52 | extern void omap2xxx_cm_set_dpll_disable_autoidle(void); | ||
| 53 | extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void); | ||
| 54 | |||
| 55 | extern void omap2xxx_cm_set_apll54_disable_autoidle(void); | ||
| 56 | extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void); | ||
| 57 | extern void omap2xxx_cm_set_apll96_disable_autoidle(void); | ||
| 58 | extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void); | ||
| 59 | |||
| 60 | extern bool omap2xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask); | ||
| 61 | extern int omap2xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, | ||
| 62 | u8 idlest_shift); | ||
| 63 | extern int omap2xxx_cm_split_idlest_reg(void __iomem *idlest_reg, | ||
| 64 | s16 *prcm_inst, u8 *idlest_reg_id); | ||
| 65 | |||
| 66 | extern int __init omap2xxx_cm_init(void); | ||
| 67 | |||
| 68 | #endif | ||
| 69 | |||
| 70 | #endif | ||
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.h b/arch/arm/mach-omap2/cm2xxx_3xxx.h index 57b2f3c2fbf3..98e6b3c9cd9b 100644 --- a/arch/arm/mach-omap2/cm2xxx_3xxx.h +++ b/arch/arm/mach-omap2/cm2xxx_3xxx.h | |||
| @@ -16,28 +16,7 @@ | |||
| 16 | #ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H | 16 | #ifndef __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H |
| 17 | #define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H | 17 | #define __ARCH_ASM_MACH_OMAP2_CM2XXX_3XXX_H |
| 18 | 18 | ||
| 19 | #include "prcm-common.h" | 19 | #include "cm.h" |
| 20 | |||
| 21 | #define OMAP2420_CM_REGADDR(module, reg) \ | ||
| 22 | OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE + (module) + (reg)) | ||
| 23 | #define OMAP2430_CM_REGADDR(module, reg) \ | ||
| 24 | OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE + (module) + (reg)) | ||
| 25 | #define OMAP34XX_CM_REGADDR(module, reg) \ | ||
| 26 | OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg)) | ||
| 27 | |||
| 28 | |||
| 29 | /* | ||
| 30 | * OMAP3-specific global CM registers | ||
| 31 | * Use cm_{read,write}_reg() with these registers. | ||
| 32 | * These registers appear once per CM module. | ||
| 33 | */ | ||
| 34 | |||
| 35 | #define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000) | ||
| 36 | #define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010) | ||
| 37 | #define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c) | ||
| 38 | |||
| 39 | #define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070 | ||
| 40 | #define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) | ||
| 41 | 20 | ||
| 42 | /* | 21 | /* |
| 43 | * Module specific CM register offsets from CM_BASE + domain offset | 22 | * Module specific CM register offsets from CM_BASE + domain offset |
| @@ -57,6 +36,7 @@ | |||
| 57 | #define CM_IDLEST 0x0020 | 36 | #define CM_IDLEST 0x0020 |
| 58 | #define CM_IDLEST1 CM_IDLEST | 37 | #define CM_IDLEST1 CM_IDLEST |
| 59 | #define CM_IDLEST2 0x0024 | 38 | #define CM_IDLEST2 0x0024 |
| 39 | #define OMAP2430_CM_IDLEST3 0x0028 | ||
| 60 | #define CM_AUTOIDLE 0x0030 | 40 | #define CM_AUTOIDLE 0x0030 |
| 61 | #define CM_AUTOIDLE1 CM_AUTOIDLE | 41 | #define CM_AUTOIDLE1 CM_AUTOIDLE |
| 62 | #define CM_AUTOIDLE2 0x0034 | 42 | #define CM_AUTOIDLE2 0x0034 |
| @@ -66,70 +46,60 @@ | |||
| 66 | #define CM_CLKSEL2 0x0044 | 46 | #define CM_CLKSEL2 0x0044 |
| 67 | #define OMAP2_CM_CLKSTCTRL 0x0048 | 47 | #define OMAP2_CM_CLKSTCTRL 0x0048 |
| 68 | 48 | ||
| 69 | /* OMAP2-specific register offsets */ | 49 | #ifndef __ASSEMBLER__ |
| 70 | |||
| 71 | #define OMAP24XX_CM_FCLKEN2 0x0004 | ||
| 72 | #define OMAP24XX_CM_ICLKEN4 0x001c | ||
| 73 | #define OMAP24XX_CM_AUTOIDLE4 0x003c | ||
| 74 | #define OMAP24XX_CM_IDLEST4 0x002c | ||
| 75 | |||
| 76 | #define OMAP2430_CM_IDLEST3 0x0028 | ||
| 77 | |||
| 78 | /* OMAP3-specific register offsets */ | ||
| 79 | |||
| 80 | #define OMAP3430_CM_CLKEN_PLL 0x0004 | ||
| 81 | #define OMAP3430ES2_CM_CLKEN2 0x0004 | ||
| 82 | #define OMAP3430ES2_CM_FCLKEN3 0x0008 | ||
| 83 | #define OMAP3430_CM_IDLEST_PLL CM_IDLEST2 | ||
| 84 | #define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2 | ||
| 85 | #define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2 | ||
| 86 | #define OMAP3430_CM_CLKSEL1 CM_CLKSEL | ||
| 87 | #define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL | ||
| 88 | #define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2 | ||
| 89 | #define OMAP3430_CM_SLEEPDEP CM_CLKSEL2 | ||
| 90 | #define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL | ||
| 91 | #define OMAP3430_CM_CLKSTST 0x004c | ||
| 92 | #define OMAP3430ES2_CM_CLKSEL4 0x004c | ||
| 93 | #define OMAP3430ES2_CM_CLKSEL5 0x0050 | ||
| 94 | #define OMAP3430_CM_CLKSEL2_EMU 0x0050 | ||
| 95 | #define OMAP3430_CM_CLKSEL3_EMU 0x0054 | ||
| 96 | 50 | ||
| 51 | #include <linux/io.h> | ||
| 97 | 52 | ||
| 98 | /* CM_IDLEST bit field values to indicate deasserted IdleReq */ | 53 | static inline u32 omap2_cm_read_mod_reg(s16 module, u16 idx) |
| 54 | { | ||
| 55 | return __raw_readl(cm_base + module + idx); | ||
| 56 | } | ||
| 99 | 57 | ||
| 100 | #define OMAP24XX_CM_IDLEST_VAL 0 | 58 | static inline void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx) |
| 101 | #define OMAP34XX_CM_IDLEST_VAL 1 | 59 | { |
| 60 | __raw_writel(val, cm_base + module + idx); | ||
| 61 | } | ||
| 102 | 62 | ||
| 63 | /* Read-modify-write a register in a CM module. Caller must lock */ | ||
| 64 | static inline u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, | ||
| 65 | s16 idx) | ||
| 66 | { | ||
| 67 | u32 v; | ||
| 103 | 68 | ||
| 104 | /* Clock management domain register get/set */ | 69 | v = omap2_cm_read_mod_reg(module, idx); |
| 70 | v &= ~mask; | ||
| 71 | v |= bits; | ||
| 72 | omap2_cm_write_mod_reg(v, module, idx); | ||
| 105 | 73 | ||
| 106 | #ifndef __ASSEMBLER__ | 74 | return v; |
| 75 | } | ||
| 107 | 76 | ||
| 108 | extern u32 omap2_cm_read_mod_reg(s16 module, u16 idx); | 77 | /* Read a CM register, AND it, and shift the result down to bit 0 */ |
| 109 | extern void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx); | 78 | static inline u32 omap2_cm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) |
| 110 | extern u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); | 79 | { |
| 80 | u32 v; | ||
| 111 | 81 | ||
| 112 | extern int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, | 82 | v = omap2_cm_read_mod_reg(domain, idx); |
| 113 | u8 idlest_shift); | 83 | v &= mask; |
| 114 | extern u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx); | 84 | v >>= __ffs(mask); |
| 115 | extern u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx); | ||
| 116 | 85 | ||
| 117 | extern bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask); | 86 | return v; |
| 118 | extern void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); | 87 | } |
| 119 | extern void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask); | ||
| 120 | 88 | ||
| 121 | extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); | 89 | static inline u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) |
| 122 | extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask); | 90 | { |
| 123 | extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask); | 91 | return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx); |
| 124 | extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask); | 92 | } |
| 125 | 93 | ||
| 126 | extern void omap2xxx_cm_set_dpll_disable_autoidle(void); | 94 | static inline u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) |
| 127 | extern void omap2xxx_cm_set_dpll_auto_low_power_stop(void); | 95 | { |
| 96 | return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx); | ||
| 97 | } | ||
| 128 | 98 | ||
| 129 | extern void omap2xxx_cm_set_apll54_disable_autoidle(void); | 99 | extern int omap2xxx_cm_apll54_enable(void); |
| 130 | extern void omap2xxx_cm_set_apll54_auto_low_power_stop(void); | 100 | extern void omap2xxx_cm_apll54_disable(void); |
| 131 | extern void omap2xxx_cm_set_apll96_disable_autoidle(void); | 101 | extern int omap2xxx_cm_apll96_enable(void); |
| 132 | extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void); | 102 | extern void omap2xxx_cm_apll96_disable(void); |
| 133 | 103 | ||
| 134 | #endif | 104 | #endif |
| 135 | 105 | ||
| @@ -146,11 +116,4 @@ extern void omap2xxx_cm_set_apll96_auto_low_power_stop(void); | |||
| 146 | /* CM_IDLEST_GFX */ | 116 | /* CM_IDLEST_GFX */ |
| 147 | #define OMAP_ST_GFX_MASK (1 << 0) | 117 | #define OMAP_ST_GFX_MASK (1 << 0) |
| 148 | 118 | ||
| 149 | |||
| 150 | /* Function prototypes */ | ||
| 151 | # ifndef __ASSEMBLER__ | ||
| 152 | extern void omap3_cm_save_context(void); | ||
| 153 | extern void omap3_cm_restore_context(void); | ||
| 154 | # endif | ||
| 155 | |||
| 156 | #endif | 119 | #endif |
diff --git a/arch/arm/mach-omap2/cm33xx.c b/arch/arm/mach-omap2/cm33xx.c index ed8dcaf4c849..058ce3c0873e 100644 --- a/arch/arm/mach-omap2/cm33xx.c +++ b/arch/arm/mach-omap2/cm33xx.c | |||
| @@ -22,6 +22,7 @@ | |||
| 22 | #include <linux/err.h> | 22 | #include <linux/err.h> |
| 23 | #include <linux/io.h> | 23 | #include <linux/io.h> |
| 24 | 24 | ||
| 25 | #include "clockdomain.h" | ||
| 25 | #include "cm.h" | 26 | #include "cm.h" |
| 26 | #include "cm33xx.h" | 27 | #include "cm33xx.h" |
| 27 | #include "cm-regbits-34xx.h" | 28 | #include "cm-regbits-34xx.h" |
| @@ -309,3 +310,58 @@ void am33xx_cm_module_disable(u16 inst, s16 cdoffs, u16 clkctrl_offs) | |||
| 309 | v &= ~AM33XX_MODULEMODE_MASK; | 310 | v &= ~AM33XX_MODULEMODE_MASK; |
| 310 | am33xx_cm_write_reg(v, inst, clkctrl_offs); | 311 | am33xx_cm_write_reg(v, inst, clkctrl_offs); |
| 311 | } | 312 | } |
| 313 | |||
| 314 | /* | ||
| 315 | * Clockdomain low-level functions | ||
| 316 | */ | ||
| 317 | |||
| 318 | static int am33xx_clkdm_sleep(struct clockdomain *clkdm) | ||
| 319 | { | ||
| 320 | am33xx_cm_clkdm_force_sleep(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 321 | return 0; | ||
| 322 | } | ||
| 323 | |||
| 324 | static int am33xx_clkdm_wakeup(struct clockdomain *clkdm) | ||
| 325 | { | ||
| 326 | am33xx_cm_clkdm_force_wakeup(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 327 | return 0; | ||
| 328 | } | ||
| 329 | |||
| 330 | static void am33xx_clkdm_allow_idle(struct clockdomain *clkdm) | ||
| 331 | { | ||
| 332 | am33xx_cm_clkdm_enable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 333 | } | ||
| 334 | |||
| 335 | static void am33xx_clkdm_deny_idle(struct clockdomain *clkdm) | ||
| 336 | { | ||
| 337 | am33xx_cm_clkdm_disable_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 338 | } | ||
| 339 | |||
| 340 | static int am33xx_clkdm_clk_enable(struct clockdomain *clkdm) | ||
| 341 | { | ||
| 342 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 343 | return am33xx_clkdm_wakeup(clkdm); | ||
| 344 | |||
| 345 | return 0; | ||
| 346 | } | ||
| 347 | |||
| 348 | static int am33xx_clkdm_clk_disable(struct clockdomain *clkdm) | ||
| 349 | { | ||
| 350 | bool hwsup = false; | ||
| 351 | |||
| 352 | hwsup = am33xx_cm_is_clkdm_in_hwsup(clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 353 | |||
| 354 | if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) | ||
| 355 | am33xx_clkdm_sleep(clkdm); | ||
| 356 | |||
| 357 | return 0; | ||
| 358 | } | ||
| 359 | |||
| 360 | struct clkdm_ops am33xx_clkdm_operations = { | ||
| 361 | .clkdm_sleep = am33xx_clkdm_sleep, | ||
| 362 | .clkdm_wakeup = am33xx_clkdm_wakeup, | ||
| 363 | .clkdm_allow_idle = am33xx_clkdm_allow_idle, | ||
| 364 | .clkdm_deny_idle = am33xx_clkdm_deny_idle, | ||
| 365 | .clkdm_clk_enable = am33xx_clkdm_clk_enable, | ||
| 366 | .clkdm_clk_disable = am33xx_clkdm_clk_disable, | ||
| 367 | }; | ||
diff --git a/arch/arm/mach-omap2/cm2xxx_3xxx.c b/arch/arm/mach-omap2/cm3xxx.c index 7f07ab02a5b3..c2086f2e86b6 100644 --- a/arch/arm/mach-omap2/cm2xxx_3xxx.c +++ b/arch/arm/mach-omap2/cm3xxx.c | |||
| @@ -1,8 +1,10 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * OMAP2/3 CM module functions | 2 | * OMAP3xxx CM module functions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009 Nokia Corporation | 4 | * Copyright (C) 2009 Nokia Corporation |
| 5 | * Copyright (C) 2008-2010, 2012 Texas Instruments, Inc. | ||
| 5 | * Paul Walmsley | 6 | * Paul Walmsley |
| 7 | * Rajendra Nayak <rnayak@ti.com> | ||
| 6 | * | 8 | * |
| 7 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
| @@ -12,8 +14,6 @@ | |||
| 12 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
| 13 | #include <linux/types.h> | 15 | #include <linux/types.h> |
| 14 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
| 15 | #include <linux/spinlock.h> | ||
| 16 | #include <linux/list.h> | ||
| 17 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
| 18 | #include <linux/err.h> | 18 | #include <linux/err.h> |
| 19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
| @@ -21,56 +21,16 @@ | |||
| 21 | #include "soc.h" | 21 | #include "soc.h" |
| 22 | #include "iomap.h" | 22 | #include "iomap.h" |
| 23 | #include "common.h" | 23 | #include "common.h" |
| 24 | #include "prm2xxx_3xxx.h" | ||
| 24 | #include "cm.h" | 25 | #include "cm.h" |
| 25 | #include "cm2xxx_3xxx.h" | 26 | #include "cm3xxx.h" |
| 26 | #include "cm-regbits-24xx.h" | ||
| 27 | #include "cm-regbits-34xx.h" | 27 | #include "cm-regbits-34xx.h" |
| 28 | #include "clockdomain.h" | ||
| 28 | 29 | ||
| 29 | /* CM_AUTOIDLE_PLL.AUTO_* bit values for DPLLs */ | 30 | static const u8 omap3xxx_cm_idlest_offs[] = { |
| 30 | #define DPLL_AUTOIDLE_DISABLE 0x0 | 31 | CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3 |
| 31 | #define OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP 0x3 | ||
| 32 | |||
| 33 | /* CM_AUTOIDLE_PLL.AUTO_* bit values for APLLs (OMAP2xxx only) */ | ||
| 34 | #define OMAP2XXX_APLL_AUTOIDLE_DISABLE 0x0 | ||
| 35 | #define OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP 0x3 | ||
| 36 | |||
| 37 | static const u8 cm_idlest_offs[] = { | ||
| 38 | CM_IDLEST1, CM_IDLEST2, OMAP2430_CM_IDLEST3, OMAP24XX_CM_IDLEST4 | ||
| 39 | }; | 32 | }; |
| 40 | 33 | ||
| 41 | u32 omap2_cm_read_mod_reg(s16 module, u16 idx) | ||
| 42 | { | ||
| 43 | return __raw_readl(cm_base + module + idx); | ||
| 44 | } | ||
| 45 | |||
| 46 | void omap2_cm_write_mod_reg(u32 val, s16 module, u16 idx) | ||
| 47 | { | ||
| 48 | __raw_writel(val, cm_base + module + idx); | ||
| 49 | } | ||
| 50 | |||
| 51 | /* Read-modify-write a register in a CM module. Caller must lock */ | ||
| 52 | u32 omap2_cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) | ||
| 53 | { | ||
| 54 | u32 v; | ||
| 55 | |||
| 56 | v = omap2_cm_read_mod_reg(module, idx); | ||
| 57 | v &= ~mask; | ||
| 58 | v |= bits; | ||
| 59 | omap2_cm_write_mod_reg(v, module, idx); | ||
| 60 | |||
| 61 | return v; | ||
| 62 | } | ||
| 63 | |||
| 64 | u32 omap2_cm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) | ||
| 65 | { | ||
| 66 | return omap2_cm_rmw_mod_reg_bits(bits, bits, module, idx); | ||
| 67 | } | ||
| 68 | |||
| 69 | u32 omap2_cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) | ||
| 70 | { | ||
| 71 | return omap2_cm_rmw_mod_reg_bits(bits, 0x0, module, idx); | ||
| 72 | } | ||
| 73 | |||
| 74 | /* | 34 | /* |
| 75 | * | 35 | * |
| 76 | */ | 36 | */ |
| @@ -85,33 +45,15 @@ static void _write_clktrctrl(u8 c, s16 module, u32 mask) | |||
| 85 | omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL); | 45 | omap2_cm_write_mod_reg(v, module, OMAP2_CM_CLKSTCTRL); |
| 86 | } | 46 | } |
| 87 | 47 | ||
| 88 | bool omap2_cm_is_clkdm_in_hwsup(s16 module, u32 mask) | 48 | bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask) |
| 89 | { | 49 | { |
| 90 | u32 v; | 50 | u32 v; |
| 91 | bool ret = 0; | ||
| 92 | |||
| 93 | BUG_ON(!cpu_is_omap24xx() && !cpu_is_omap34xx()); | ||
| 94 | 51 | ||
| 95 | v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL); | 52 | v = omap2_cm_read_mod_reg(module, OMAP2_CM_CLKSTCTRL); |
| 96 | v &= mask; | 53 | v &= mask; |
| 97 | v >>= __ffs(mask); | 54 | v >>= __ffs(mask); |
| 98 | 55 | ||
| 99 | if (cpu_is_omap24xx()) | 56 | return (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0; |
| 100 | ret = (v == OMAP24XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0; | ||
| 101 | else | ||
| 102 | ret = (v == OMAP34XX_CLKSTCTRL_ENABLE_AUTO) ? 1 : 0; | ||
| 103 | |||
| 104 | return ret; | ||
| 105 | } | ||
| 106 | |||
| 107 | void omap2xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) | ||
| 108 | { | ||
| 109 | _write_clktrctrl(OMAP24XX_CLKSTCTRL_ENABLE_AUTO, module, mask); | ||
| 110 | } | ||
| 111 | |||
| 112 | void omap2xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask) | ||
| 113 | { | ||
| 114 | _write_clktrctrl(OMAP24XX_CLKSTCTRL_DISABLE_AUTO, module, mask); | ||
| 115 | } | 57 | } |
| 116 | 58 | ||
| 117 | void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) | 59 | void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask) |
| @@ -135,109 +77,247 @@ void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask) | |||
| 135 | } | 77 | } |
| 136 | 78 | ||
| 137 | /* | 79 | /* |
| 138 | * DPLL autoidle control | 80 | * |
| 139 | */ | 81 | */ |
| 140 | 82 | ||
| 141 | static void _omap2xxx_set_dpll_autoidle(u8 m) | 83 | /** |
| 84 | * omap3xxx_cm_wait_module_ready - wait for a module to leave idle or standby | ||
| 85 | * @prcm_mod: PRCM module offset | ||
| 86 | * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) | ||
| 87 | * @idlest_shift: shift of the bit in the CM_IDLEST* register to check | ||
| 88 | * | ||
| 89 | * Wait for the PRCM to indicate that the module identified by | ||
| 90 | * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon | ||
| 91 | * success or -EBUSY if the module doesn't enable in time. | ||
| 92 | */ | ||
| 93 | int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) | ||
| 142 | { | 94 | { |
| 143 | u32 v; | 95 | int ena = 0, i = 0; |
| 96 | u8 cm_idlest_reg; | ||
| 97 | u32 mask; | ||
| 144 | 98 | ||
| 145 | v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); | 99 | if (!idlest_id || (idlest_id > ARRAY_SIZE(omap3xxx_cm_idlest_offs))) |
| 146 | v &= ~OMAP24XX_AUTO_DPLL_MASK; | 100 | return -EINVAL; |
| 147 | v |= m << OMAP24XX_AUTO_DPLL_SHIFT; | ||
| 148 | omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE); | ||
| 149 | } | ||
| 150 | 101 | ||
| 151 | void omap2xxx_cm_set_dpll_disable_autoidle(void) | 102 | cm_idlest_reg = omap3xxx_cm_idlest_offs[idlest_id - 1]; |
| 152 | { | 103 | |
| 153 | _omap2xxx_set_dpll_autoidle(OMAP2XXX_DPLL_AUTOIDLE_LOW_POWER_STOP); | 104 | mask = 1 << idlest_shift; |
| 105 | ena = 0; | ||
| 106 | |||
| 107 | omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) & | ||
| 108 | mask) == ena), MAX_MODULE_READY_TIME, i); | ||
| 109 | |||
| 110 | return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; | ||
| 154 | } | 111 | } |
| 155 | 112 | ||
| 156 | void omap2xxx_cm_set_dpll_auto_low_power_stop(void) | 113 | /** |
| 114 | * omap3xxx_cm_split_idlest_reg - split CM_IDLEST reg addr into its components | ||
| 115 | * @idlest_reg: CM_IDLEST* virtual address | ||
| 116 | * @prcm_inst: pointer to an s16 to return the PRCM instance offset | ||
| 117 | * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID | ||
| 118 | * | ||
| 119 | * XXX This function is only needed until absolute register addresses are | ||
| 120 | * removed from the OMAP struct clk records. | ||
| 121 | */ | ||
| 122 | int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, | ||
| 123 | u8 *idlest_reg_id) | ||
| 157 | { | 124 | { |
| 158 | _omap2xxx_set_dpll_autoidle(DPLL_AUTOIDLE_DISABLE); | 125 | unsigned long offs; |
| 126 | u8 idlest_offs; | ||
| 127 | int i; | ||
| 128 | |||
| 129 | if (idlest_reg < (cm_base + OMAP3430_IVA2_MOD) || | ||
| 130 | idlest_reg > (cm_base + 0x1ffff)) | ||
| 131 | return -EINVAL; | ||
| 132 | |||
| 133 | idlest_offs = (unsigned long)idlest_reg & 0xff; | ||
| 134 | for (i = 0; i < ARRAY_SIZE(omap3xxx_cm_idlest_offs); i++) { | ||
| 135 | if (idlest_offs == omap3xxx_cm_idlest_offs[i]) { | ||
| 136 | *idlest_reg_id = i + 1; | ||
| 137 | break; | ||
| 138 | } | ||
| 139 | } | ||
| 140 | |||
| 141 | if (i == ARRAY_SIZE(omap3xxx_cm_idlest_offs)) | ||
| 142 | return -EINVAL; | ||
| 143 | |||
| 144 | offs = idlest_reg - cm_base; | ||
| 145 | offs &= 0xff00; | ||
| 146 | *prcm_inst = offs; | ||
| 147 | |||
| 148 | return 0; | ||
| 159 | } | 149 | } |
| 160 | 150 | ||
| 161 | /* | 151 | /* Clockdomain low-level operations */ |
| 162 | * APLL autoidle control | ||
| 163 | */ | ||
| 164 | 152 | ||
| 165 | static void _omap2xxx_set_apll_autoidle(u8 m, u32 mask) | 153 | static int omap3xxx_clkdm_add_sleepdep(struct clockdomain *clkdm1, |
| 154 | struct clockdomain *clkdm2) | ||
| 166 | { | 155 | { |
| 167 | u32 v; | 156 | omap2_cm_set_mod_reg_bits((1 << clkdm2->dep_bit), |
| 157 | clkdm1->pwrdm.ptr->prcm_offs, | ||
| 158 | OMAP3430_CM_SLEEPDEP); | ||
| 159 | return 0; | ||
| 160 | } | ||
| 168 | 161 | ||
| 169 | v = omap2_cm_read_mod_reg(PLL_MOD, CM_AUTOIDLE); | 162 | static int omap3xxx_clkdm_del_sleepdep(struct clockdomain *clkdm1, |
| 170 | v &= ~mask; | 163 | struct clockdomain *clkdm2) |
| 171 | v |= m << __ffs(mask); | 164 | { |
| 172 | omap2_cm_write_mod_reg(v, PLL_MOD, CM_AUTOIDLE); | 165 | omap2_cm_clear_mod_reg_bits((1 << clkdm2->dep_bit), |
| 166 | clkdm1->pwrdm.ptr->prcm_offs, | ||
| 167 | OMAP3430_CM_SLEEPDEP); | ||
| 168 | return 0; | ||
| 173 | } | 169 | } |
| 174 | 170 | ||
| 175 | void omap2xxx_cm_set_apll54_disable_autoidle(void) | 171 | static int omap3xxx_clkdm_read_sleepdep(struct clockdomain *clkdm1, |
| 172 | struct clockdomain *clkdm2) | ||
| 176 | { | 173 | { |
| 177 | _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, | 174 | return omap2_cm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs, |
| 178 | OMAP24XX_AUTO_54M_MASK); | 175 | OMAP3430_CM_SLEEPDEP, |
| 176 | (1 << clkdm2->dep_bit)); | ||
| 179 | } | 177 | } |
| 180 | 178 | ||
| 181 | void omap2xxx_cm_set_apll54_auto_low_power_stop(void) | 179 | static int omap3xxx_clkdm_clear_all_sleepdeps(struct clockdomain *clkdm) |
| 182 | { | 180 | { |
| 183 | _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, | 181 | struct clkdm_dep *cd; |
| 184 | OMAP24XX_AUTO_54M_MASK); | 182 | u32 mask = 0; |
| 183 | |||
| 184 | for (cd = clkdm->sleepdep_srcs; cd && cd->clkdm_name; cd++) { | ||
| 185 | if (!cd->clkdm) | ||
| 186 | continue; /* only happens if data is erroneous */ | ||
| 187 | |||
| 188 | mask |= 1 << cd->clkdm->dep_bit; | ||
| 189 | atomic_set(&cd->sleepdep_usecount, 0); | ||
| 190 | } | ||
| 191 | omap2_cm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs, | ||
| 192 | OMAP3430_CM_SLEEPDEP); | ||
| 193 | return 0; | ||
| 185 | } | 194 | } |
| 186 | 195 | ||
| 187 | void omap2xxx_cm_set_apll96_disable_autoidle(void) | 196 | static int omap3xxx_clkdm_sleep(struct clockdomain *clkdm) |
| 188 | { | 197 | { |
| 189 | _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_LOW_POWER_STOP, | 198 | omap3xxx_cm_clkdm_force_sleep(clkdm->pwrdm.ptr->prcm_offs, |
| 190 | OMAP24XX_AUTO_96M_MASK); | 199 | clkdm->clktrctrl_mask); |
| 200 | return 0; | ||
| 191 | } | 201 | } |
| 192 | 202 | ||
| 193 | void omap2xxx_cm_set_apll96_auto_low_power_stop(void) | 203 | static int omap3xxx_clkdm_wakeup(struct clockdomain *clkdm) |
| 194 | { | 204 | { |
| 195 | _omap2xxx_set_apll_autoidle(OMAP2XXX_APLL_AUTOIDLE_DISABLE, | 205 | omap3xxx_cm_clkdm_force_wakeup(clkdm->pwrdm.ptr->prcm_offs, |
| 196 | OMAP24XX_AUTO_96M_MASK); | 206 | clkdm->clktrctrl_mask); |
| 207 | return 0; | ||
| 197 | } | 208 | } |
| 198 | 209 | ||
| 199 | /* | 210 | static void omap3xxx_clkdm_allow_idle(struct clockdomain *clkdm) |
| 200 | * | 211 | { |
| 201 | */ | 212 | if (atomic_read(&clkdm->usecount) > 0) |
| 213 | _clkdm_add_autodeps(clkdm); | ||
| 202 | 214 | ||
| 203 | /** | 215 | omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, |
| 204 | * omap2_cm_wait_idlest_ready - wait for a module to leave idle or standby | 216 | clkdm->clktrctrl_mask); |
| 205 | * @prcm_mod: PRCM module offset | 217 | } |
| 206 | * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) | 218 | |
| 207 | * @idlest_shift: shift of the bit in the CM_IDLEST* register to check | 219 | static void omap3xxx_clkdm_deny_idle(struct clockdomain *clkdm) |
| 208 | * | ||
| 209 | * XXX document | ||
| 210 | */ | ||
| 211 | int omap2_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) | ||
| 212 | { | 220 | { |
| 213 | int ena = 0, i = 0; | 221 | omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, |
| 214 | u8 cm_idlest_reg; | 222 | clkdm->clktrctrl_mask); |
| 215 | u32 mask; | ||
| 216 | 223 | ||
| 217 | if (!idlest_id || (idlest_id > ARRAY_SIZE(cm_idlest_offs))) | 224 | if (atomic_read(&clkdm->usecount) > 0) |
| 218 | return -EINVAL; | 225 | _clkdm_del_autodeps(clkdm); |
| 226 | } | ||
| 219 | 227 | ||
| 220 | cm_idlest_reg = cm_idlest_offs[idlest_id - 1]; | 228 | static int omap3xxx_clkdm_clk_enable(struct clockdomain *clkdm) |
| 229 | { | ||
| 230 | bool hwsup = false; | ||
| 221 | 231 | ||
| 222 | mask = 1 << idlest_shift; | 232 | if (!clkdm->clktrctrl_mask) |
| 233 | return 0; | ||
| 223 | 234 | ||
| 224 | if (cpu_is_omap24xx()) | 235 | /* |
| 225 | ena = mask; | 236 | * The CLKDM_MISSING_IDLE_REPORTING flag documentation has |
| 226 | else if (cpu_is_omap34xx()) | 237 | * more details on the unpleasant problem this is working |
| 227 | ena = 0; | 238 | * around |
| 228 | else | 239 | */ |
| 229 | BUG(); | 240 | if ((clkdm->flags & CLKDM_MISSING_IDLE_REPORTING) && |
| 241 | (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP)) { | ||
| 242 | omap3xxx_clkdm_wakeup(clkdm); | ||
| 243 | return 0; | ||
| 244 | } | ||
| 245 | |||
| 246 | hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 247 | clkdm->clktrctrl_mask); | ||
| 248 | |||
| 249 | if (hwsup) { | ||
| 250 | /* Disable HW transitions when we are changing deps */ | ||
| 251 | omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 252 | clkdm->clktrctrl_mask); | ||
| 253 | _clkdm_add_autodeps(clkdm); | ||
| 254 | omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 255 | clkdm->clktrctrl_mask); | ||
| 256 | } else { | ||
| 257 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 258 | omap3xxx_clkdm_wakeup(clkdm); | ||
| 259 | } | ||
| 260 | |||
| 261 | return 0; | ||
| 262 | } | ||
| 230 | 263 | ||
| 231 | omap_test_timeout(((omap2_cm_read_mod_reg(prcm_mod, cm_idlest_reg) & mask) == ena), | 264 | static int omap3xxx_clkdm_clk_disable(struct clockdomain *clkdm) |
| 232 | MAX_MODULE_READY_TIME, i); | 265 | { |
| 266 | bool hwsup = false; | ||
| 233 | 267 | ||
| 234 | return (i < MAX_MODULE_READY_TIME) ? 0 : -EBUSY; | 268 | if (!clkdm->clktrctrl_mask) |
| 269 | return 0; | ||
| 270 | |||
| 271 | /* | ||
| 272 | * The CLKDM_MISSING_IDLE_REPORTING flag documentation has | ||
| 273 | * more details on the unpleasant problem this is working | ||
| 274 | * around | ||
| 275 | */ | ||
| 276 | if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING && | ||
| 277 | !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) { | ||
| 278 | omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 279 | clkdm->clktrctrl_mask); | ||
| 280 | return 0; | ||
| 281 | } | ||
| 282 | |||
| 283 | hwsup = omap3xxx_cm_is_clkdm_in_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 284 | clkdm->clktrctrl_mask); | ||
| 285 | |||
| 286 | if (hwsup) { | ||
| 287 | /* Disable HW transitions when we are changing deps */ | ||
| 288 | omap3xxx_cm_clkdm_disable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 289 | clkdm->clktrctrl_mask); | ||
| 290 | _clkdm_del_autodeps(clkdm); | ||
| 291 | omap3xxx_cm_clkdm_enable_hwsup(clkdm->pwrdm.ptr->prcm_offs, | ||
| 292 | clkdm->clktrctrl_mask); | ||
| 293 | } else { | ||
| 294 | if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP) | ||
| 295 | omap3xxx_clkdm_sleep(clkdm); | ||
| 296 | } | ||
| 297 | |||
| 298 | return 0; | ||
| 235 | } | 299 | } |
| 236 | 300 | ||
| 301 | struct clkdm_ops omap3_clkdm_operations = { | ||
| 302 | .clkdm_add_wkdep = omap2_clkdm_add_wkdep, | ||
| 303 | .clkdm_del_wkdep = omap2_clkdm_del_wkdep, | ||
| 304 | .clkdm_read_wkdep = omap2_clkdm_read_wkdep, | ||
| 305 | .clkdm_clear_all_wkdeps = omap2_clkdm_clear_all_wkdeps, | ||
| 306 | .clkdm_add_sleepdep = omap3xxx_clkdm_add_sleepdep, | ||
| 307 | .clkdm_del_sleepdep = omap3xxx_clkdm_del_sleepdep, | ||
| 308 | .clkdm_read_sleepdep = omap3xxx_clkdm_read_sleepdep, | ||
| 309 | .clkdm_clear_all_sleepdeps = omap3xxx_clkdm_clear_all_sleepdeps, | ||
| 310 | .clkdm_sleep = omap3xxx_clkdm_sleep, | ||
| 311 | .clkdm_wakeup = omap3xxx_clkdm_wakeup, | ||
| 312 | .clkdm_allow_idle = omap3xxx_clkdm_allow_idle, | ||
| 313 | .clkdm_deny_idle = omap3xxx_clkdm_deny_idle, | ||
| 314 | .clkdm_clk_enable = omap3xxx_clkdm_clk_enable, | ||
| 315 | .clkdm_clk_disable = omap3xxx_clkdm_clk_disable, | ||
| 316 | }; | ||
| 317 | |||
| 237 | /* | 318 | /* |
| 238 | * Context save/restore code - OMAP3 only | 319 | * Context save/restore code - OMAP3 only |
| 239 | */ | 320 | */ |
| 240 | #ifdef CONFIG_ARCH_OMAP3 | ||
| 241 | struct omap3_cm_regs { | 321 | struct omap3_cm_regs { |
| 242 | u32 iva2_cm_clksel1; | 322 | u32 iva2_cm_clksel1; |
| 243 | u32 iva2_cm_clksel2; | 323 | u32 iva2_cm_clksel2; |
| @@ -555,4 +635,31 @@ void omap3_cm_restore_context(void) | |||
| 555 | omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD, | 635 | omap2_cm_write_mod_reg(cm_context.cm_clkout_ctrl, OMAP3430_CCR_MOD, |
| 556 | OMAP3_CM_CLKOUT_CTRL_OFFSET); | 636 | OMAP3_CM_CLKOUT_CTRL_OFFSET); |
| 557 | } | 637 | } |
| 558 | #endif | 638 | |
| 639 | /* | ||
| 640 | * | ||
| 641 | */ | ||
| 642 | |||
| 643 | static 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 | |||
| 648 | int __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 | |||
| 656 | static void __exit omap3xxx_cm_exit(void) | ||
| 657 | { | ||
| 658 | if (!cpu_is_omap34xx()) | ||
| 659 | return; | ||
| 660 | |||
| 661 | /* Should never happen */ | ||
| 662 | WARN(cm_unregister(&omap3xxx_cm_ll_data), | ||
| 663 | "%s: cm_ll_data function pointer mismatch\n", __func__); | ||
| 664 | } | ||
| 665 | __exitcall(omap3xxx_cm_exit); | ||
diff --git a/arch/arm/mach-omap2/cm3xxx.h b/arch/arm/mach-omap2/cm3xxx.h new file mode 100644 index 000000000000..e8e146f4a43f --- /dev/null +++ b/arch/arm/mach-omap2/cm3xxx.h | |||
| @@ -0,0 +1,91 @@ | |||
| 1 | /* | ||
| 2 | * OMAP2/3 Clock Management (CM) register definitions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007-2009 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2007-2010 Nokia Corporation | ||
| 6 | * Paul Walmsley | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * The CM hardware modules on the OMAP2/3 are quite similar to each | ||
| 13 | * other. The CM modules/instances on OMAP4 are quite different, so | ||
| 14 | * they are handled in a separate file. | ||
| 15 | */ | ||
| 16 | #ifndef __ARCH_ASM_MACH_OMAP2_CM3XXX_H | ||
| 17 | #define __ARCH_ASM_MACH_OMAP2_CM3XXX_H | ||
| 18 | |||
| 19 | #include "prcm-common.h" | ||
| 20 | #include "cm2xxx_3xxx.h" | ||
| 21 | |||
| 22 | #define OMAP34XX_CM_REGADDR(module, reg) \ | ||
| 23 | OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE + (module) + (reg)) | ||
| 24 | |||
| 25 | |||
| 26 | /* | ||
| 27 | * OMAP3-specific global CM registers | ||
| 28 | * Use cm_{read,write}_reg() with these registers. | ||
| 29 | * These registers appear once per CM module. | ||
| 30 | */ | ||
| 31 | |||
| 32 | #define OMAP3430_CM_REVISION OMAP34XX_CM_REGADDR(OCP_MOD, 0x0000) | ||
| 33 | #define OMAP3430_CM_SYSCONFIG OMAP34XX_CM_REGADDR(OCP_MOD, 0x0010) | ||
| 34 | #define OMAP3430_CM_POLCTRL OMAP34XX_CM_REGADDR(OCP_MOD, 0x009c) | ||
| 35 | |||
| 36 | #define OMAP3_CM_CLKOUT_CTRL_OFFSET 0x0070 | ||
| 37 | #define OMAP3430_CM_CLKOUT_CTRL OMAP_CM_REGADDR(OMAP3430_CCR_MOD, 0x0070) | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Module specific CM register offsets from CM_BASE + domain offset | ||
| 41 | * Use cm_{read,write}_mod_reg() with these registers. | ||
| 42 | * These register offsets generally appear in more than one PRCM submodule. | ||
| 43 | */ | ||
| 44 | |||
| 45 | /* OMAP3-specific register offsets */ | ||
| 46 | |||
| 47 | #define OMAP3430_CM_CLKEN_PLL 0x0004 | ||
| 48 | #define OMAP3430ES2_CM_CLKEN2 0x0004 | ||
| 49 | #define OMAP3430ES2_CM_FCLKEN3 0x0008 | ||
| 50 | #define OMAP3430_CM_IDLEST_PLL CM_IDLEST2 | ||
| 51 | #define OMAP3430_CM_AUTOIDLE_PLL CM_AUTOIDLE2 | ||
| 52 | #define OMAP3430ES2_CM_AUTOIDLE2_PLL CM_AUTOIDLE2 | ||
| 53 | #define OMAP3430_CM_CLKSEL1 CM_CLKSEL | ||
| 54 | #define OMAP3430_CM_CLKSEL1_PLL CM_CLKSEL | ||
| 55 | #define OMAP3430_CM_CLKSEL2_PLL CM_CLKSEL2 | ||
| 56 | #define OMAP3430_CM_SLEEPDEP CM_CLKSEL2 | ||
| 57 | #define OMAP3430_CM_CLKSEL3 OMAP2_CM_CLKSTCTRL | ||
| 58 | #define OMAP3430_CM_CLKSTST 0x004c | ||
| 59 | #define OMAP3430ES2_CM_CLKSEL4 0x004c | ||
| 60 | #define OMAP3430ES2_CM_CLKSEL5 0x0050 | ||
| 61 | #define OMAP3430_CM_CLKSEL2_EMU 0x0050 | ||
| 62 | #define OMAP3430_CM_CLKSEL3_EMU 0x0054 | ||
| 63 | |||
| 64 | |||
| 65 | /* CM_IDLEST bit field values to indicate deasserted IdleReq */ | ||
| 66 | |||
| 67 | #define OMAP34XX_CM_IDLEST_VAL 1 | ||
| 68 | |||
| 69 | |||
| 70 | #ifndef __ASSEMBLER__ | ||
| 71 | |||
| 72 | extern void omap3xxx_cm_clkdm_enable_hwsup(s16 module, u32 mask); | ||
| 73 | extern void omap3xxx_cm_clkdm_disable_hwsup(s16 module, u32 mask); | ||
| 74 | extern void omap3xxx_cm_clkdm_force_sleep(s16 module, u32 mask); | ||
| 75 | extern void omap3xxx_cm_clkdm_force_wakeup(s16 module, u32 mask); | ||
| 76 | |||
| 77 | extern bool omap3xxx_cm_is_clkdm_in_hwsup(s16 module, u32 mask); | ||
| 78 | extern int omap3xxx_cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, | ||
| 79 | u8 idlest_shift); | ||
| 80 | |||
| 81 | extern int omap3xxx_cm_split_idlest_reg(void __iomem *idlest_reg, | ||
| 82 | s16 *prcm_inst, u8 *idlest_reg_id); | ||
| 83 | |||
| 84 | extern void omap3_cm_save_context(void); | ||
| 85 | extern void omap3_cm_restore_context(void); | ||
| 86 | |||
| 87 | extern int __init omap3xxx_cm_init(void); | ||
| 88 | |||
| 89 | #endif | ||
| 90 | |||
| 91 | #endif | ||
diff --git a/arch/arm/mach-omap2/cm_common.c b/arch/arm/mach-omap2/cm_common.c new file mode 100644 index 000000000000..40b3b5a84458 --- /dev/null +++ b/arch/arm/mach-omap2/cm_common.c | |||
| @@ -0,0 +1,140 @@ | |||
| 1 | /* | ||
| 2 | * OMAP2+ common Clock Management (CM) IP block functions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2012 Texas Instruments, Inc. | ||
| 5 | * Paul Walmsley | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * XXX This code should eventually be moved to a CM driver. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/init.h> | ||
| 16 | #include <linux/errno.h> | ||
| 17 | |||
| 18 | #include "cm2xxx.h" | ||
| 19 | #include "cm3xxx.h" | ||
| 20 | #include "cm44xx.h" | ||
| 21 | #include "common.h" | ||
| 22 | |||
| 23 | /* | ||
| 24 | * cm_ll_data: function pointers to SoC-specific implementations of | ||
| 25 | * common CM functions | ||
| 26 | */ | ||
| 27 | static struct cm_ll_data null_cm_ll_data; | ||
| 28 | static struct cm_ll_data *cm_ll_data = &null_cm_ll_data; | ||
| 29 | |||
| 30 | /* cm_base: base virtual address of the CM IP block */ | ||
| 31 | void __iomem *cm_base; | ||
| 32 | |||
| 33 | /* cm2_base: base virtual address of the CM2 IP block (OMAP44xx only) */ | ||
| 34 | void __iomem *cm2_base; | ||
| 35 | |||
| 36 | /** | ||
| 37 | * omap2_set_globals_cm - set the CM/CM2 base addresses (for early use) | ||
| 38 | * @cm: CM base virtual address | ||
| 39 | * @cm2: CM2 base virtual address (if present on the booted SoC) | ||
| 40 | * | ||
| 41 | * XXX Will be replaced when the PRM/CM drivers are completed. | ||
| 42 | */ | ||
| 43 | void __init omap2_set_globals_cm(void __iomem *cm, void __iomem *cm2) | ||
| 44 | { | ||
| 45 | cm_base = cm; | ||
| 46 | cm2_base = cm2; | ||
| 47 | } | ||
| 48 | |||
| 49 | /** | ||
| 50 | * cm_split_idlest_reg - split CM_IDLEST reg addr into its components | ||
| 51 | * @idlest_reg: CM_IDLEST* virtual address | ||
| 52 | * @prcm_inst: pointer to an s16 to return the PRCM instance offset | ||
| 53 | * @idlest_reg_id: pointer to a u8 to return the CM_IDLESTx register ID | ||
| 54 | * | ||
| 55 | * Given an absolute CM_IDLEST register address @idlest_reg, passes | ||
| 56 | * the PRCM instance offset and IDLEST register ID back to the caller | ||
| 57 | * via the @prcm_inst and @idlest_reg_id. Returns -EINVAL upon error, | ||
| 58 | * or 0 upon success. XXX This function is only needed until absolute | ||
| 59 | * register addresses are removed from the OMAP struct clk records. | ||
| 60 | */ | ||
| 61 | int cm_split_idlest_reg(void __iomem *idlest_reg, s16 *prcm_inst, | ||
| 62 | u8 *idlest_reg_id) | ||
| 63 | { | ||
| 64 | if (!cm_ll_data->split_idlest_reg) { | ||
| 65 | WARN_ONCE(1, "cm: %s: no low-level function defined\n", | ||
| 66 | __func__); | ||
| 67 | return -EINVAL; | ||
| 68 | } | ||
| 69 | |||
| 70 | return cm_ll_data->split_idlest_reg(idlest_reg, prcm_inst, | ||
| 71 | idlest_reg_id); | ||
| 72 | } | ||
| 73 | |||
| 74 | /** | ||
| 75 | * cm_wait_module_ready - wait for a module to leave idle or standby | ||
| 76 | * @prcm_mod: PRCM module offset | ||
| 77 | * @idlest_id: CM_IDLESTx register ID (i.e., x = 1, 2, 3) | ||
| 78 | * @idlest_shift: shift of the bit in the CM_IDLEST* register to check | ||
| 79 | * | ||
| 80 | * Wait for the PRCM to indicate that the module identified by | ||
| 81 | * (@prcm_mod, @idlest_id, @idlest_shift) is clocked. Return 0 upon | ||
| 82 | * success, -EBUSY if the module doesn't enable in time, or -EINVAL if | ||
| 83 | * no per-SoC wait_module_ready() function pointer has been registered | ||
| 84 | * or if the idlest register is unknown on the SoC. | ||
| 85 | */ | ||
| 86 | int cm_wait_module_ready(s16 prcm_mod, u8 idlest_id, u8 idlest_shift) | ||
| 87 | { | ||
| 88 | if (!cm_ll_data->wait_module_ready) { | ||
| 89 | WARN_ONCE(1, "cm: %s: no low-level function defined\n", | ||
| 90 | __func__); | ||
| 91 | return -EINVAL; | ||
| 92 | } | ||
| 93 | |||
| 94 | return cm_ll_data->wait_module_ready(prcm_mod, idlest_id, idlest_shift); | ||
| 95 | } | ||
| 96 | |||
| 97 | /** | ||
| 98 | * cm_register - register per-SoC low-level data with the CM | ||
| 99 | * @cld: low-level per-SoC OMAP CM data & function pointers to register | ||
| 100 | * | ||
| 101 | * Register per-SoC low-level OMAP CM data and function pointers with | ||
| 102 | * the OMAP CM common interface. The caller must keep the data | ||
| 103 | * pointed to by @cld valid until it calls cm_unregister() and | ||
| 104 | * it returns successfully. Returns 0 upon success, -EINVAL if @cld | ||
| 105 | * is NULL, or -EEXIST if cm_register() has already been called | ||
| 106 | * without an intervening cm_unregister(). | ||
| 107 | */ | ||
| 108 | int cm_register(struct cm_ll_data *cld) | ||
| 109 | { | ||
| 110 | if (!cld) | ||
| 111 | return -EINVAL; | ||
| 112 | |||
| 113 | if (cm_ll_data != &null_cm_ll_data) | ||
| 114 | return -EEXIST; | ||
| 115 | |||
| 116 | cm_ll_data = cld; | ||
| 117 | |||
| 118 | return 0; | ||
| 119 | } | ||
| 120 | |||
| 121 | /** | ||
| 122 | * cm_unregister - unregister per-SoC low-level data & function pointers | ||
| 123 | * @cld: low-level per-SoC OMAP CM data & function pointers to unregister | ||
| 124 | * | ||
| 125 | * Unregister per-SoC low-level OMAP CM data and function pointers | ||
| 126 | * that were previously registered with cm_register(). The | ||
| 127 | * caller may not destroy any of the data pointed to by @cld until | ||
| 128 | * this function returns successfully. Returns 0 upon success, or | ||
| 129 | * -EINVAL if @cld is NULL or if @cld does not match the struct | ||
| 130 | * cm_ll_data * previously registered by cm_register(). | ||
| 131 | */ | ||
| 132 | int cm_unregister(struct cm_ll_data *cld) | ||
| 133 | { | ||
| 134 | if (!cld || cm_ll_data != cld) | ||
| 135 | return -EINVAL; | ||
| 136 | |||
| 137 | cm_ll_data = &null_cm_ll_data; | ||
| 138 | |||
| 139 | return 0; | ||
| 140 | } | ||
diff --git a/arch/arm/mach-omap2/cminst44xx.c b/arch/arm/mach-omap2/cminst44xx.c index 1894015ff04b..7f9a464f01e9 100644 --- a/arch/arm/mach-omap2/cminst44xx.c +++ b/arch/arm/mach-omap2/cminst44xx.c | |||
| @@ -2,8 +2,9 @@ | |||
| 2 | * OMAP4 CM instance functions | 2 | * OMAP4 CM instance functions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009 Nokia Corporation | 4 | * Copyright (C) 2009 Nokia Corporation |
| 5 | * Copyright (C) 2011 Texas Instruments, Inc. | 5 | * Copyright (C) 2008-2011 Texas Instruments, Inc. |
| 6 | * Paul Walmsley | 6 | * Paul Walmsley |
| 7 | * Rajendra Nayak <rnayak@ti.com> | ||
| 7 | * | 8 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License version 2 as | 10 | * it under the terms of the GNU General Public License version 2 as |
| @@ -22,6 +23,7 @@ | |||
| 22 | 23 | ||
| 23 | #include "iomap.h" | 24 | #include "iomap.h" |
| 24 | #include "common.h" | 25 | #include "common.h" |
| 26 | #include "clockdomain.h" | ||
| 25 | #include "cm.h" | 27 | #include "cm.h" |
| 26 | #include "cm1_44xx.h" | 28 | #include "cm1_44xx.h" |
| 27 | #include "cm2_44xx.h" | 29 | #include "cm2_44xx.h" |
| @@ -343,3 +345,141 @@ void omap4_cminst_module_disable(u8 part, u16 inst, s16 cdoffs, | |||
| 343 | v &= ~OMAP4430_MODULEMODE_MASK; | 345 | v &= ~OMAP4430_MODULEMODE_MASK; |
| 344 | omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs); | 346 | omap4_cminst_write_inst_reg(v, part, inst, clkctrl_offs); |
| 345 | } | 347 | } |
| 348 | |||
| 349 | /* | ||
| 350 | * Clockdomain low-level functions | ||
| 351 | */ | ||
| 352 | |||
| 353 | static int omap4_clkdm_add_wkup_sleep_dep(struct clockdomain *clkdm1, | ||
| 354 | struct clockdomain *clkdm2) | ||
| 355 | { | ||
| 356 | omap4_cminst_set_inst_reg_bits((1 << clkdm2->dep_bit), | ||
| 357 | clkdm1->prcm_partition, | ||
| 358 | clkdm1->cm_inst, clkdm1->clkdm_offs + | ||
| 359 | OMAP4_CM_STATICDEP); | ||
| 360 | return 0; | ||
| 361 | } | ||
| 362 | |||
| 363 | static int omap4_clkdm_del_wkup_sleep_dep(struct clockdomain *clkdm1, | ||
| 364 | struct clockdomain *clkdm2) | ||
| 365 | { | ||
| 366 | omap4_cminst_clear_inst_reg_bits((1 << clkdm2->dep_bit), | ||
| 367 | clkdm1->prcm_partition, | ||
| 368 | clkdm1->cm_inst, clkdm1->clkdm_offs + | ||
| 369 | OMAP4_CM_STATICDEP); | ||
| 370 | return 0; | ||
| 371 | } | ||
| 372 | |||
| 373 | static int omap4_clkdm_read_wkup_sleep_dep(struct clockdomain *clkdm1, | ||
| 374 | struct clockdomain *clkdm2) | ||
| 375 | { | ||
| 376 | return omap4_cminst_read_inst_reg_bits(clkdm1->prcm_partition, | ||
| 377 | clkdm1->cm_inst, | ||
| 378 | clkdm1->clkdm_offs + | ||
| 379 | OMAP4_CM_STATICDEP, | ||
| 380 | (1 << clkdm2->dep_bit)); | ||
| 381 | } | ||
| 382 | |||
| 383 | static int omap4_clkdm_clear_all_wkup_sleep_deps(struct clockdomain *clkdm) | ||
| 384 | { | ||
| 385 | struct clkdm_dep *cd; | ||
| 386 | u32 mask = 0; | ||
| 387 | |||
| 388 | if (!clkdm->prcm_partition) | ||
| 389 | return 0; | ||
| 390 | |||
| 391 | for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) { | ||
| 392 | if (!cd->clkdm) | ||
| 393 | continue; /* only happens if data is erroneous */ | ||
| 394 | |||
| 395 | mask |= 1 << cd->clkdm->dep_bit; | ||
| 396 | atomic_set(&cd->wkdep_usecount, 0); | ||
| 397 | } | ||
| 398 | |||
| 399 | omap4_cminst_clear_inst_reg_bits(mask, clkdm->prcm_partition, | ||
| 400 | clkdm->cm_inst, clkdm->clkdm_offs + | ||
| 401 | OMAP4_CM_STATICDEP); | ||
| 402 | return 0; | ||
| 403 | } | ||
| 404 | |||
| 405 | static int omap4_clkdm_sleep(struct clockdomain *clkdm) | ||
| 406 | { | ||
| 407 | omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition, | ||
| 408 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 409 | return 0; | ||
| 410 | } | ||
| 411 | |||
| 412 | static int omap4_clkdm_wakeup(struct clockdomain *clkdm) | ||
| 413 | { | ||
| 414 | omap4_cminst_clkdm_force_wakeup(clkdm->prcm_partition, | ||
| 415 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 416 | return 0; | ||
| 417 | } | ||
| 418 | |||
| 419 | static void omap4_clkdm_allow_idle(struct clockdomain *clkdm) | ||
| 420 | { | ||
| 421 | omap4_cminst_clkdm_enable_hwsup(clkdm->prcm_partition, | ||
| 422 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 423 | } | ||
| 424 | |||
| 425 | static void omap4_clkdm_deny_idle(struct clockdomain *clkdm) | ||
| 426 | { | ||
| 427 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 428 | omap4_clkdm_wakeup(clkdm); | ||
| 429 | else | ||
| 430 | omap4_cminst_clkdm_disable_hwsup(clkdm->prcm_partition, | ||
| 431 | clkdm->cm_inst, | ||
| 432 | clkdm->clkdm_offs); | ||
| 433 | } | ||
| 434 | |||
| 435 | static int omap4_clkdm_clk_enable(struct clockdomain *clkdm) | ||
| 436 | { | ||
| 437 | if (clkdm->flags & CLKDM_CAN_FORCE_WAKEUP) | ||
| 438 | return omap4_clkdm_wakeup(clkdm); | ||
| 439 | |||
| 440 | return 0; | ||
| 441 | } | ||
| 442 | |||
| 443 | static int omap4_clkdm_clk_disable(struct clockdomain *clkdm) | ||
| 444 | { | ||
| 445 | bool hwsup = false; | ||
| 446 | |||
| 447 | if (!clkdm->prcm_partition) | ||
| 448 | return 0; | ||
| 449 | |||
| 450 | /* | ||
| 451 | * The CLKDM_MISSING_IDLE_REPORTING flag documentation has | ||
| 452 | * more details on the unpleasant problem this is working | ||
| 453 | * around | ||
| 454 | */ | ||
| 455 | if (clkdm->flags & CLKDM_MISSING_IDLE_REPORTING && | ||
| 456 | !(clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) { | ||
| 457 | omap4_clkdm_allow_idle(clkdm); | ||
| 458 | return 0; | ||
| 459 | } | ||
| 460 | |||
| 461 | hwsup = omap4_cminst_is_clkdm_in_hwsup(clkdm->prcm_partition, | ||
| 462 | clkdm->cm_inst, clkdm->clkdm_offs); | ||
| 463 | |||
| 464 | if (!hwsup && (clkdm->flags & CLKDM_CAN_FORCE_SLEEP)) | ||
| 465 | omap4_clkdm_sleep(clkdm); | ||
| 466 | |||
| 467 | return 0; | ||
| 468 | } | ||
| 469 | |||
| 470 | struct clkdm_ops omap4_clkdm_operations = { | ||
| 471 | .clkdm_add_wkdep = omap4_clkdm_add_wkup_sleep_dep, | ||
| 472 | .clkdm_del_wkdep = omap4_clkdm_del_wkup_sleep_dep, | ||
| 473 | .clkdm_read_wkdep = omap4_clkdm_read_wkup_sleep_dep, | ||
| 474 | .clkdm_clear_all_wkdeps = omap4_clkdm_clear_all_wkup_sleep_deps, | ||
| 475 | .clkdm_add_sleepdep = omap4_clkdm_add_wkup_sleep_dep, | ||
| 476 | .clkdm_del_sleepdep = omap4_clkdm_del_wkup_sleep_dep, | ||
| 477 | .clkdm_read_sleepdep = omap4_clkdm_read_wkup_sleep_dep, | ||
| 478 | .clkdm_clear_all_sleepdeps = omap4_clkdm_clear_all_wkup_sleep_deps, | ||
| 479 | .clkdm_sleep = omap4_clkdm_sleep, | ||
| 480 | .clkdm_wakeup = omap4_clkdm_wakeup, | ||
| 481 | .clkdm_allow_idle = omap4_clkdm_allow_idle, | ||
| 482 | .clkdm_deny_idle = omap4_clkdm_deny_idle, | ||
| 483 | .clkdm_clk_enable = omap4_clkdm_clk_enable, | ||
| 484 | .clkdm_clk_disable = omap4_clkdm_clk_disable, | ||
| 485 | }; | ||
diff --git a/arch/arm/mach-omap2/cminst44xx.h b/arch/arm/mach-omap2/cminst44xx.h index d69fdefef985..bd7bab889745 100644 --- a/arch/arm/mach-omap2/cminst44xx.h +++ b/arch/arm/mach-omap2/cminst44xx.h | |||
| @@ -38,4 +38,6 @@ extern u32 omap4_cminst_clear_inst_reg_bits(u32 bits, u8 part, s16 inst, | |||
| 38 | extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, | 38 | extern u32 omap4_cminst_read_inst_reg_bits(u8 part, u16 inst, s16 idx, |
| 39 | u32 mask); | 39 | u32 mask); |
| 40 | 40 | ||
| 41 | extern 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 | |||
| 33 | static 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 | |||
| 43 | static 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 | |||
| 53 | void __init omap2_set_globals_242x(void) | ||
| 54 | { | ||
| 55 | __omap2_set_globals(&omap242x_globals); | ||
| 56 | } | ||
| 57 | |||
| 58 | void __init omap242x_map_io(void) | ||
| 59 | { | ||
| 60 | omap242x_map_common_io(); | ||
| 61 | } | ||
| 62 | #endif | ||
| 63 | |||
| 64 | #if defined(CONFIG_SOC_OMAP2430) | ||
| 65 | |||
| 66 | static 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 | |||
| 76 | void __init omap2_set_globals_243x(void) | ||
| 77 | { | ||
| 78 | __omap2_set_globals(&omap243x_globals); | ||
| 79 | } | ||
| 80 | |||
| 81 | void __init omap243x_map_io(void) | ||
| 82 | { | ||
| 83 | omap243x_map_common_io(); | ||
| 84 | } | ||
| 85 | #endif | ||
| 86 | |||
| 87 | #if defined(CONFIG_ARCH_OMAP3) | ||
| 88 | |||
| 89 | static 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 | |||
| 99 | void __init omap2_set_globals_3xxx(void) | ||
| 100 | { | ||
| 101 | __omap2_set_globals(&omap3_globals); | ||
| 102 | } | ||
| 103 | |||
| 104 | void __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 | |||
| 117 | static 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 | |||
| 125 | void __init omap2_set_globals_ti81xx(void) | ||
| 126 | { | ||
| 127 | __omap2_set_globals(&ti81xx_globals); | ||
| 128 | } | ||
| 129 | |||
| 130 | void __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 | |||
| 140 | static 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 | |||
| 148 | void __init omap2_set_globals_am33xx(void) | ||
| 149 | { | ||
| 150 | __omap2_set_globals(&am33xx_globals); | ||
| 151 | } | ||
| 152 | |||
| 153 | void __init am33xx_map_io(void) | ||
| 154 | { | ||
| 155 | omapam33xx_map_common_io(); | ||
| 156 | } | ||
| 157 | #endif | ||
| 158 | |||
| 159 | #if defined(CONFIG_ARCH_OMAP4) | ||
| 160 | static 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 | |||
| 171 | void __init omap2_set_globals_443x(void) | ||
| 172 | { | ||
| 173 | __omap2_set_globals(&omap4_globals); | ||
| 174 | } | ||
| 175 | |||
| 176 | void __init omap4_map_io(void) | ||
| 177 | { | ||
| 178 | omap44xx_map_common_io(); | ||
| 179 | } | ||
| 180 | #endif | ||
| 181 | |||
| 182 | #if defined(CONFIG_SOC_OMAP5) | ||
| 183 | static 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 | |||
| 194 | void __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 | |||
| 201 | void __init omap5_map_io(void) | ||
| 202 | { | ||
| 203 | omap5_map_common_io(); | ||
| 204 | } | ||
| 205 | #endif | ||
| 206 | |||
| 207 | /* | 24 | /* |
| 208 | * Stub function for OMAP2 so that common files | 25 | * Stub function for OMAP2 so that common files |
| 209 | * continue to build when custom builds are used | 26 | * continue to build when custom builds are used |
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index 426fcfcfd821..08c586451f93 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h | |||
| @@ -41,54 +41,6 @@ | |||
| 41 | 41 | ||
| 42 | #define OMAP_INTC_START NR_IRQS | 42 | #define OMAP_INTC_START NR_IRQS |
| 43 | 43 | ||
| 44 | #ifdef CONFIG_SOC_OMAP2420 | ||
| 45 | extern void omap242x_map_common_io(void); | ||
| 46 | #else | ||
| 47 | static inline void omap242x_map_common_io(void) | ||
| 48 | { | ||
| 49 | } | ||
| 50 | #endif | ||
| 51 | |||
| 52 | #ifdef CONFIG_SOC_OMAP2430 | ||
| 53 | extern void omap243x_map_common_io(void); | ||
| 54 | #else | ||
| 55 | static inline void omap243x_map_common_io(void) | ||
| 56 | { | ||
| 57 | } | ||
| 58 | #endif | ||
| 59 | |||
| 60 | #ifdef CONFIG_ARCH_OMAP3 | ||
| 61 | extern void omap34xx_map_common_io(void); | ||
| 62 | #else | ||
| 63 | static inline void omap34xx_map_common_io(void) | ||
| 64 | { | ||
| 65 | } | ||
| 66 | #endif | ||
| 67 | |||
| 68 | #ifdef CONFIG_SOC_TI81XX | ||
| 69 | extern void omapti81xx_map_common_io(void); | ||
| 70 | #else | ||
| 71 | static inline void omapti81xx_map_common_io(void) | ||
| 72 | { | ||
| 73 | } | ||
| 74 | #endif | ||
| 75 | |||
| 76 | #ifdef CONFIG_SOC_AM33XX | ||
| 77 | extern void omapam33xx_map_common_io(void); | ||
| 78 | #else | ||
| 79 | static inline void omapam33xx_map_common_io(void) | ||
| 80 | { | ||
| 81 | } | ||
| 82 | #endif | ||
| 83 | |||
| 84 | #ifdef CONFIG_ARCH_OMAP4 | ||
| 85 | extern void omap44xx_map_common_io(void); | ||
| 86 | #else | ||
| 87 | static inline void omap44xx_map_common_io(void) | ||
| 88 | { | ||
| 89 | } | ||
| 90 | #endif | ||
| 91 | |||
| 92 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) | 44 | #if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP2) |
| 93 | int omap2_pm_init(void); | 45 | int omap2_pm_init(void); |
| 94 | #else | 46 | #else |
| @@ -125,14 +77,6 @@ static inline int omap_mux_late_init(void) | |||
| 125 | } | 77 | } |
| 126 | #endif | 78 | #endif |
| 127 | 79 | ||
| 128 | #ifdef CONFIG_SOC_OMAP5 | ||
| 129 | extern void omap5_map_common_io(void); | ||
| 130 | #else | ||
| 131 | static inline void omap5_map_common_io(void) | ||
| 132 | { | ||
| 133 | } | ||
| 134 | #endif | ||
| 135 | |||
| 136 | extern void omap2_init_common_infrastructure(void); | 80 | extern void omap2_init_common_infrastructure(void); |
| 137 | 81 | ||
| 138 | extern struct sys_timer omap2_timer; | 82 | extern struct sys_timer omap2_timer; |
| @@ -165,52 +109,43 @@ void am35xx_init_late(void); | |||
| 165 | void ti81xx_init_late(void); | 109 | void ti81xx_init_late(void); |
| 166 | void omap4430_init_late(void); | 110 | void omap4430_init_late(void); |
| 167 | int omap2_common_pm_late_init(void); | 111 | int omap2_common_pm_late_init(void); |
| 168 | void omap_prcm_restart(char, const char *); | ||
| 169 | 112 | ||
| 170 | /* | 113 | #if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) |
| 171 | * IO bases for various OMAP processors | 114 | void omap2xxx_restart(char mode, const char *cmd); |
| 172 | * Except the tap base, rest all the io bases | ||
| 173 | * listed are physical addresses. | ||
| 174 | */ | ||
| 175 | struct omap_globals { | ||
| 176 | u32 class; /* OMAP class to detect */ | ||
| 177 | void __iomem *tap; /* Control module ID code */ | ||
| 178 | void __iomem *sdrc; /* SDRAM Controller */ | ||
| 179 | void __iomem *sms; /* SDRAM Memory Scheduler */ | ||
| 180 | void __iomem *ctrl; /* System Control Module */ | ||
| 181 | void __iomem *ctrl_pad; /* PAD Control Module */ | ||
| 182 | void __iomem *prm; /* Power and Reset Management */ | ||
| 183 | void __iomem *cm; /* Clock Management */ | ||
| 184 | void __iomem *cm2; | ||
| 185 | void __iomem *prcm_mpu; | ||
| 186 | }; | ||
| 187 | |||
| 188 | void omap2_set_globals_242x(void); | ||
| 189 | void omap2_set_globals_243x(void); | ||
| 190 | void omap2_set_globals_3xxx(void); | ||
| 191 | void omap2_set_globals_443x(void); | ||
| 192 | void omap2_set_globals_5xxx(void); | ||
| 193 | void omap2_set_globals_ti81xx(void); | ||
| 194 | void omap2_set_globals_am33xx(void); | ||
| 195 | |||
| 196 | /* These get called from omap2_set_globals_xxxx(), do not call these */ | ||
| 197 | void omap2_set_globals_tap(struct omap_globals *); | ||
| 198 | #if defined(CONFIG_SOC_HAS_OMAP2_SDRC) | ||
| 199 | void omap2_set_globals_sdrc(struct omap_globals *); | ||
| 200 | #else | 115 | #else |
| 201 | static inline void omap2_set_globals_sdrc(struct omap_globals *omap2_globals) | 116 | static inline void omap2xxx_restart(char mode, const char *cmd) |
| 202 | { } | 117 | { |
| 118 | } | ||
| 203 | #endif | 119 | #endif |
| 204 | void omap2_set_globals_control(struct omap_globals *); | 120 | |
| 205 | void omap2_set_globals_prcm(struct omap_globals *); | 121 | #ifdef CONFIG_ARCH_OMAP3 |
| 206 | 122 | void omap3xxx_restart(char mode, const char *cmd); | |
| 207 | void omap242x_map_io(void); | 123 | #else |
| 208 | void omap243x_map_io(void); | 124 | static inline void omap3xxx_restart(char mode, const char *cmd) |
| 209 | void omap3_map_io(void); | 125 | { |
| 210 | void am33xx_map_io(void); | 126 | } |
| 211 | void omap4_map_io(void); | 127 | #endif |
| 212 | void omap5_map_io(void); | 128 | |
| 213 | void ti81xx_map_io(void); | 129 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) |
| 130 | void omap44xx_restart(char mode, const char *cmd); | ||
| 131 | #else | ||
| 132 | static inline void omap44xx_restart(char mode, const char *cmd) | ||
| 133 | { | ||
| 134 | } | ||
| 135 | #endif | ||
| 136 | |||
| 137 | /* This gets called from mach-omap2/io.c, do not call this */ | ||
| 138 | void __init omap2_set_globals_tap(u32 class, void __iomem *tap); | ||
| 139 | |||
| 140 | void __init omap242x_map_io(void); | ||
| 141 | void __init omap243x_map_io(void); | ||
| 142 | void __init omap3_map_io(void); | ||
| 143 | void __init am33xx_map_io(void); | ||
| 144 | void __init omap4_map_io(void); | ||
| 145 | void __init omap5_map_io(void); | ||
| 146 | void __init ti81xx_map_io(void); | ||
| 147 | |||
| 148 | /* omap_barriers_init() is OMAP4 only */ | ||
| 214 | void omap_barriers_init(void); | 149 | void omap_barriers_init(void); |
| 215 | 150 | ||
| 216 | /** | 151 | /** |
diff --git a/arch/arm/mach-omap2/control.c b/arch/arm/mach-omap2/control.c index bf2be5c5468d..2adb2683f074 100644 --- a/arch/arm/mach-omap2/control.c +++ b/arch/arm/mach-omap2/control.c | |||
| @@ -20,8 +20,8 @@ | |||
| 20 | #include "common.h" | 20 | #include "common.h" |
| 21 | #include "cm-regbits-34xx.h" | 21 | #include "cm-regbits-34xx.h" |
| 22 | #include "prm-regbits-34xx.h" | 22 | #include "prm-regbits-34xx.h" |
| 23 | #include "prm2xxx_3xxx.h" | 23 | #include "prm3xxx.h" |
| 24 | #include "cm2xxx_3xxx.h" | 24 | #include "cm3xxx.h" |
| 25 | #include "sdrc.h" | 25 | #include "sdrc.h" |
| 26 | #include "pm.h" | 26 | #include "pm.h" |
| 27 | #include "control.h" | 27 | #include "control.h" |
| @@ -147,13 +147,11 @@ static struct omap3_control_regs control_context; | |||
| 147 | #define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) | 147 | #define OMAP_CTRL_REGADDR(reg) (omap2_ctrl_base + (reg)) |
| 148 | #define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg)) | 148 | #define OMAP4_CTRL_PAD_REGADDR(reg) (omap4_ctrl_pad_base + (reg)) |
| 149 | 149 | ||
| 150 | void __init omap2_set_globals_control(struct omap_globals *omap2_globals) | 150 | void __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 | ||
| 159 | void __iomem *omap_ctrl_base_get(void) | 157 | void __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); | |||
| 414 | extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode); | 414 | extern void omap_ctrl_write_dsp_boot_mode(u8 bootmode); |
| 415 | extern void omap3630_ctrl_disable_rta(void); | 415 | extern void omap3630_ctrl_disable_rta(void); |
| 416 | extern int omap3_ctrl_save_padconf(void); | 416 | extern int omap3_ctrl_save_padconf(void); |
| 417 | extern 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 | } |
| 648 | arch_initcall(omap2_init_devices); | 648 | arch_initcall(omap2_init_devices); |
| 649 | |||
| 650 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) | ||
| 651 | static 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 | } | ||
| 673 | subsys_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 | ||
| 516 | int omap_dss_reset(struct omap_hwmod *oh) | 516 | int 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 4e63097e3cd8..fbb9b152cd5e 100644 --- a/arch/arm/mach-omap2/i2c.c +++ b/arch/arm/mach-omap2/i2c.c | |||
| @@ -20,10 +20,11 @@ | |||
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | #include "soc.h" | 22 | #include "soc.h" |
| 23 | #include "common.h" | ||
| 24 | #include "omap_hwmod.h" | 23 | #include "omap_hwmod.h" |
| 25 | #include "omap_device.h" | 24 | #include "omap_device.h" |
| 26 | 25 | ||
| 26 | #include "prm.h" | ||
| 27 | #include "common.h" | ||
| 27 | #include "mux.h" | 28 | #include "mux.h" |
| 28 | #include "i2c.h" | 29 | #include "i2c.h" |
| 29 | 30 | ||
| @@ -32,9 +33,6 @@ | |||
| 32 | #define OMAP2_I2C_CON_OFFSET 0x24 | 33 | #define OMAP2_I2C_CON_OFFSET 0x24 |
| 33 | #define OMAP4_I2C_CON_OFFSET 0xA4 | 34 | #define OMAP4_I2C_CON_OFFSET 0xA4 |
| 34 | 35 | ||
| 35 | /* Maximum microseconds to wait for OMAP module to softreset */ | ||
| 36 | #define MAX_MODULE_SOFTRESET_WAIT 10000 | ||
| 37 | |||
| 38 | #define MAX_OMAP_I2C_HWMOD_NAME_LEN 16 | 36 | #define MAX_OMAP_I2C_HWMOD_NAME_LEN 16 |
| 39 | 37 | ||
| 40 | static void __init omap2_i2c_mux_pins(int bus_id) | 38 | static 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 | */ |
| 562 | void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) | 562 | void __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 807b8d919f81..9df757644cce 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
| @@ -40,8 +40,16 @@ | |||
| 40 | #include "clock44xx.h" | 40 | #include "clock44xx.h" |
| 41 | #include "omap-pm.h" | 41 | #include "omap-pm.h" |
| 42 | #include "sdrc.h" | 42 | #include "sdrc.h" |
| 43 | #include "control.h" | ||
| 43 | #include "serial.h" | 44 | #include "serial.h" |
| 44 | #include "sram.h" | 45 | #include "sram.h" |
| 46 | #include "cm2xxx.h" | ||
| 47 | #include "cm3xxx.h" | ||
| 48 | #include "prm.h" | ||
| 49 | #include "cm.h" | ||
| 50 | #include "prcm_mpu44xx.h" | ||
| 51 | #include "prminst44xx.h" | ||
| 52 | #include "cminst44xx.h" | ||
| 45 | 53 | ||
| 46 | /* | 54 | /* |
| 47 | * The machine specific code may provide the extra mapping besides the | 55 | * The machine specific code may provide the extra mapping besides the |
| @@ -264,7 +272,7 @@ static struct map_desc omap54xx_io_desc[] __initdata = { | |||
| 264 | #endif | 272 | #endif |
| 265 | 273 | ||
| 266 | #ifdef CONFIG_SOC_OMAP2420 | 274 | #ifdef CONFIG_SOC_OMAP2420 |
| 267 | void __init omap242x_map_common_io(void) | 275 | void __init omap242x_map_io(void) |
| 268 | { | 276 | { |
| 269 | iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); | 277 | iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); |
| 270 | iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); | 278 | iotable_init(omap242x_io_desc, ARRAY_SIZE(omap242x_io_desc)); |
| @@ -272,7 +280,7 @@ void __init omap242x_map_common_io(void) | |||
| 272 | #endif | 280 | #endif |
| 273 | 281 | ||
| 274 | #ifdef CONFIG_SOC_OMAP2430 | 282 | #ifdef CONFIG_SOC_OMAP2430 |
| 275 | void __init omap243x_map_common_io(void) | 283 | void __init omap243x_map_io(void) |
| 276 | { | 284 | { |
| 277 | iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); | 285 | iotable_init(omap24xx_io_desc, ARRAY_SIZE(omap24xx_io_desc)); |
| 278 | iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); | 286 | iotable_init(omap243x_io_desc, ARRAY_SIZE(omap243x_io_desc)); |
| @@ -280,28 +288,28 @@ void __init omap243x_map_common_io(void) | |||
| 280 | #endif | 288 | #endif |
| 281 | 289 | ||
| 282 | #ifdef CONFIG_ARCH_OMAP3 | 290 | #ifdef CONFIG_ARCH_OMAP3 |
| 283 | void __init omap34xx_map_common_io(void) | 291 | void __init omap3_map_io(void) |
| 284 | { | 292 | { |
| 285 | iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); | 293 | iotable_init(omap34xx_io_desc, ARRAY_SIZE(omap34xx_io_desc)); |
| 286 | } | 294 | } |
| 287 | #endif | 295 | #endif |
| 288 | 296 | ||
| 289 | #ifdef CONFIG_SOC_TI81XX | 297 | #ifdef CONFIG_SOC_TI81XX |
| 290 | void __init omapti81xx_map_common_io(void) | 298 | void __init ti81xx_map_io(void) |
| 291 | { | 299 | { |
| 292 | iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc)); | 300 | iotable_init(omapti81xx_io_desc, ARRAY_SIZE(omapti81xx_io_desc)); |
| 293 | } | 301 | } |
| 294 | #endif | 302 | #endif |
| 295 | 303 | ||
| 296 | #ifdef CONFIG_SOC_AM33XX | 304 | #ifdef CONFIG_SOC_AM33XX |
| 297 | void __init omapam33xx_map_common_io(void) | 305 | void __init am33xx_map_io(void) |
| 298 | { | 306 | { |
| 299 | iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); | 307 | iotable_init(omapam33xx_io_desc, ARRAY_SIZE(omapam33xx_io_desc)); |
| 300 | } | 308 | } |
| 301 | #endif | 309 | #endif |
| 302 | 310 | ||
| 303 | #ifdef CONFIG_ARCH_OMAP4 | 311 | #ifdef CONFIG_ARCH_OMAP4 |
| 304 | void __init omap44xx_map_common_io(void) | 312 | void __init omap4_map_io(void) |
| 305 | { | 313 | { |
| 306 | iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); | 314 | iotable_init(omap44xx_io_desc, ARRAY_SIZE(omap44xx_io_desc)); |
| 307 | omap_barriers_init(); | 315 | omap_barriers_init(); |
| @@ -309,7 +317,7 @@ void __init omap44xx_map_common_io(void) | |||
| 309 | #endif | 317 | #endif |
| 310 | 318 | ||
| 311 | #ifdef CONFIG_SOC_OMAP5 | 319 | #ifdef CONFIG_SOC_OMAP5 |
| 312 | void __init omap5_map_common_io(void) | 320 | void __init omap5_map_io(void) |
| 313 | { | 321 | { |
| 314 | iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); | 322 | iotable_init(omap54xx_io_desc, ARRAY_SIZE(omap54xx_io_desc)); |
| 315 | } | 323 | } |
| @@ -371,8 +379,15 @@ static void __init omap_hwmod_init_postsetup(void) | |||
| 371 | #ifdef CONFIG_SOC_OMAP2420 | 379 | #ifdef CONFIG_SOC_OMAP2420 |
| 372 | void __init omap2420_init_early(void) | 380 | void __init omap2420_init_early(void) |
| 373 | { | 381 | { |
| 374 | omap2_set_globals_242x(); | 382 | omap2_set_globals_tap(OMAP242X_CLASS, OMAP2_L4_IO_ADDRESS(0x48014000)); |
| 383 | omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP2420_SDRC_BASE), | ||
| 384 | OMAP2_L3_IO_ADDRESS(OMAP2420_SMS_BASE)); | ||
| 385 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP242X_CTRL_BASE), | ||
| 386 | NULL); | ||
| 387 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE)); | ||
| 388 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2420_CM_BASE), NULL); | ||
| 375 | omap2xxx_check_revision(); | 389 | omap2xxx_check_revision(); |
| 390 | omap2xxx_cm_init(); | ||
| 376 | omap2xxx_voltagedomains_init(); | 391 | omap2xxx_voltagedomains_init(); |
| 377 | omap242x_powerdomains_init(); | 392 | omap242x_powerdomains_init(); |
| 378 | omap242x_clockdomains_init(); | 393 | omap242x_clockdomains_init(); |
| @@ -392,8 +407,15 @@ void __init omap2420_init_late(void) | |||
| 392 | #ifdef CONFIG_SOC_OMAP2430 | 407 | #ifdef CONFIG_SOC_OMAP2430 |
| 393 | void __init omap2430_init_early(void) | 408 | void __init omap2430_init_early(void) |
| 394 | { | 409 | { |
| 395 | omap2_set_globals_243x(); | 410 | omap2_set_globals_tap(OMAP243X_CLASS, OMAP2_L4_IO_ADDRESS(0x4900a000)); |
| 411 | omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP243X_SDRC_BASE), | ||
| 412 | OMAP2_L3_IO_ADDRESS(OMAP243X_SMS_BASE)); | ||
| 413 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP243X_CTRL_BASE), | ||
| 414 | NULL); | ||
| 415 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE)); | ||
| 416 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP2430_CM_BASE), NULL); | ||
| 396 | omap2xxx_check_revision(); | 417 | omap2xxx_check_revision(); |
| 418 | omap2xxx_cm_init(); | ||
| 397 | omap2xxx_voltagedomains_init(); | 419 | omap2xxx_voltagedomains_init(); |
| 398 | omap243x_powerdomains_init(); | 420 | omap243x_powerdomains_init(); |
| 399 | omap243x_clockdomains_init(); | 421 | omap243x_clockdomains_init(); |
| @@ -417,9 +439,16 @@ void __init omap2430_init_late(void) | |||
| 417 | #ifdef CONFIG_ARCH_OMAP3 | 439 | #ifdef CONFIG_ARCH_OMAP3 |
| 418 | void __init omap3_init_early(void) | 440 | void __init omap3_init_early(void) |
| 419 | { | 441 | { |
| 420 | omap2_set_globals_3xxx(); | 442 | omap2_set_globals_tap(OMAP343X_CLASS, OMAP2_L4_IO_ADDRESS(0x4830A000)); |
| 443 | omap2_set_globals_sdrc(OMAP2_L3_IO_ADDRESS(OMAP343X_SDRC_BASE), | ||
| 444 | OMAP2_L3_IO_ADDRESS(OMAP343X_SMS_BASE)); | ||
| 445 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE), | ||
| 446 | NULL); | ||
| 447 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE)); | ||
| 448 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP3430_CM_BASE), NULL); | ||
| 421 | omap3xxx_check_revision(); | 449 | omap3xxx_check_revision(); |
| 422 | omap3xxx_check_features(); | 450 | omap3xxx_check_features(); |
| 451 | omap3xxx_cm_init(); | ||
| 423 | omap3xxx_voltagedomains_init(); | 452 | omap3xxx_voltagedomains_init(); |
| 424 | omap3xxx_powerdomains_init(); | 453 | omap3xxx_powerdomains_init(); |
| 425 | omap3xxx_clockdomains_init(); | 454 | omap3xxx_clockdomains_init(); |
| @@ -450,7 +479,12 @@ void __init am35xx_init_early(void) | |||
| 450 | 479 | ||
| 451 | void __init ti81xx_init_early(void) | 480 | void __init ti81xx_init_early(void) |
| 452 | { | 481 | { |
| 453 | omap2_set_globals_ti81xx(); | 482 | omap2_set_globals_tap(OMAP343X_CLASS, |
| 483 | OMAP2_L4_IO_ADDRESS(TI81XX_TAP_BASE)); | ||
| 484 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(TI81XX_CTRL_BASE), | ||
| 485 | NULL); | ||
| 486 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE)); | ||
| 487 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(TI81XX_PRCM_BASE), NULL); | ||
| 454 | omap3xxx_check_revision(); | 488 | omap3xxx_check_revision(); |
| 455 | ti81xx_check_features(); | 489 | ti81xx_check_features(); |
| 456 | omap3xxx_voltagedomains_init(); | 490 | omap3xxx_voltagedomains_init(); |
| @@ -507,7 +541,12 @@ void __init ti81xx_init_late(void) | |||
| 507 | #ifdef CONFIG_SOC_AM33XX | 541 | #ifdef CONFIG_SOC_AM33XX |
| 508 | void __init am33xx_init_early(void) | 542 | void __init am33xx_init_early(void) |
| 509 | { | 543 | { |
| 510 | omap2_set_globals_am33xx(); | 544 | omap2_set_globals_tap(AM335X_CLASS, |
| 545 | AM33XX_L4_WK_IO_ADDRESS(AM33XX_TAP_BASE)); | ||
| 546 | omap2_set_globals_control(AM33XX_L4_WK_IO_ADDRESS(AM33XX_CTRL_BASE), | ||
| 547 | NULL); | ||
| 548 | omap2_set_globals_prm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE)); | ||
| 549 | omap2_set_globals_cm(AM33XX_L4_WK_IO_ADDRESS(AM33XX_PRCM_BASE), NULL); | ||
| 511 | omap3xxx_check_revision(); | 550 | omap3xxx_check_revision(); |
| 512 | ti81xx_check_features(); | 551 | ti81xx_check_features(); |
| 513 | am33xx_voltagedomains_init(); | 552 | am33xx_voltagedomains_init(); |
| @@ -522,7 +561,16 @@ void __init am33xx_init_early(void) | |||
| 522 | #ifdef CONFIG_ARCH_OMAP4 | 561 | #ifdef CONFIG_ARCH_OMAP4 |
| 523 | void __init omap4430_init_early(void) | 562 | void __init omap4430_init_early(void) |
| 524 | { | 563 | { |
| 525 | omap2_set_globals_443x(); | 564 | omap2_set_globals_tap(OMAP443X_CLASS, |
| 565 | OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE)); | ||
| 566 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP443X_SCM_BASE), | ||
| 567 | OMAP2_L4_IO_ADDRESS(OMAP443X_CTRL_BASE)); | ||
| 568 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP4430_PRM_BASE)); | ||
| 569 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP4430_CM_BASE), | ||
| 570 | OMAP2_L4_IO_ADDRESS(OMAP4430_CM2_BASE)); | ||
| 571 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP4430_PRCM_MPU_BASE)); | ||
| 572 | omap_prm_base_init(); | ||
| 573 | omap_cm_base_init(); | ||
| 526 | omap4xxx_check_revision(); | 574 | omap4xxx_check_revision(); |
| 527 | omap4xxx_check_features(); | 575 | omap4xxx_check_features(); |
| 528 | omap44xx_voltagedomains_init(); | 576 | omap44xx_voltagedomains_init(); |
| @@ -544,7 +592,16 @@ void __init omap4430_init_late(void) | |||
| 544 | #ifdef CONFIG_SOC_OMAP5 | 592 | #ifdef CONFIG_SOC_OMAP5 |
| 545 | void __init omap5_init_early(void) | 593 | void __init omap5_init_early(void) |
| 546 | { | 594 | { |
| 547 | omap2_set_globals_5xxx(); | 595 | omap2_set_globals_tap(OMAP54XX_CLASS, |
| 596 | OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE)); | ||
| 597 | omap2_set_globals_control(OMAP2_L4_IO_ADDRESS(OMAP54XX_SCM_BASE), | ||
| 598 | OMAP2_L4_IO_ADDRESS(OMAP54XX_CTRL_BASE)); | ||
| 599 | omap2_set_globals_prm(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRM_BASE)); | ||
| 600 | omap2_set_globals_cm(OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_AON_BASE), | ||
| 601 | OMAP2_L4_IO_ADDRESS(OMAP54XX_CM_CORE_BASE)); | ||
| 602 | omap2_set_globals_prcm_mpu(OMAP2_L4_IO_ADDRESS(OMAP54XX_PRCM_MPU_BASE)); | ||
| 603 | omap_prm_base_init(); | ||
| 604 | omap_cm_base_init(); | ||
| 548 | omap5xxx_check_revision(); | 605 | omap5xxx_check_revision(); |
| 549 | } | 606 | } |
| 550 | #endif | 607 | #endif |
diff --git a/arch/arm/mach-omap2/mcbsp.c b/arch/arm/mach-omap2/mcbsp.c index a106c75c5338..bf496510eb5e 100644 --- a/arch/arm/mach-omap2/mcbsp.c +++ b/arch/arm/mach-omap2/mcbsp.c | |||
| @@ -29,7 +29,7 @@ | |||
| 29 | * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. | 29 | * FIXME: Find a mechanism to enable/disable runtime the McBSP ICLK autoidle. |
| 30 | * Sidetone needs non-gated ICLK and sidetone autoidle is broken. | 30 | * Sidetone needs non-gated ICLK and sidetone autoidle is broken. |
| 31 | */ | 31 | */ |
| 32 | #include "cm2xxx_3xxx.h" | 32 | #include "cm3xxx.h" |
| 33 | #include "cm-regbits-34xx.h" | 33 | #include "cm-regbits-34xx.h" |
| 34 | 34 | ||
| 35 | static int omap3_enable_st_clock(unsigned int id, bool enable) | 35 | static 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 | */ | ||
| 23 | static 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 | */ | ||
| 33 | void 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 | */ | ||
| 53 | static 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 | } | ||
| 65 | core_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 | */ | ||
| 31 | void omap3xxx_restart(char mode, const char *cmd) | ||
| 32 | { | ||
| 33 | omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0)); | ||
| 34 | omap3xxx_prm_dpll3_reset(); /* never returns */ | ||
| 35 | while (1); | ||
| 36 | } | ||
diff --git a/arch/arm/mach-omap2/omap4-common.c b/arch/arm/mach-omap2/omap4-common.c index 3cfcd41bf8fa..5695885ea340 100644 --- a/arch/arm/mach-omap2/omap4-common.c +++ b/arch/arm/mach-omap2/omap4-common.c | |||
| @@ -27,9 +27,12 @@ | |||
| 27 | 27 | ||
| 28 | #include "omap-wakeupgen.h" | 28 | #include "omap-wakeupgen.h" |
| 29 | #include "soc.h" | 29 | #include "soc.h" |
| 30 | #include "iomap.h" | ||
| 30 | #include "common.h" | 31 | #include "common.h" |
| 31 | #include "mmc.h" | 32 | #include "mmc.h" |
| 32 | #include "hsmmc.h" | 33 | #include "hsmmc.h" |
| 34 | #include "prminst44xx.h" | ||
| 35 | #include "prcm_mpu44xx.h" | ||
| 33 | #include "omap4-sar-layout.h" | 36 | #include "omap4-sar-layout.h" |
| 34 | #include "omap-secure.h" | 37 | #include "omap-secure.h" |
| 35 | #include "sram.h" | 38 | #include "sram.h" |
| @@ -279,3 +282,19 @@ int __init omap4_twl6030_hsmmc_init(struct omap2_hsmmc_info *controllers) | |||
| 279 | return 0; | 282 | return 0; |
| 280 | } | 283 | } |
| 281 | #endif | 284 | #endif |
| 285 | |||
| 286 | /** | ||
| 287 | * omap44xx_restart - trigger a software restart of the SoC | ||
| 288 | * @mode: the "reboot mode", see arch/arm/kernel/{setup,process}.c | ||
| 289 | * @cmd: passed from the userspace program rebooting the system (if provided) | ||
| 290 | * | ||
| 291 | * Resets the SoC. For @cmd, see the 'reboot' syscall in | ||
| 292 | * kernel/sys.c. No return value. | ||
| 293 | */ | ||
| 294 | void omap44xx_restart(char mode, const char *cmd) | ||
| 295 | { | ||
| 296 | /* XXX Should save 'cmd' into scratchpad for use after reboot */ | ||
| 297 | omap4_prminst_global_warm_sw_reset(); /* never returns */ | ||
| 298 | while (1); | ||
| 299 | } | ||
| 300 | |||
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 87eee3b62a3c..139adca3bda1 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c | |||
| @@ -141,25 +141,23 @@ | |||
| 141 | 141 | ||
| 142 | #include "clock.h" | 142 | #include "clock.h" |
| 143 | #include "omap_hwmod.h" | 143 | #include "omap_hwmod.h" |
| 144 | #include <plat/prcm.h> | ||
| 145 | 144 | ||
| 146 | #include "soc.h" | 145 | #include "soc.h" |
| 147 | #include "common.h" | 146 | #include "common.h" |
| 148 | #include "clockdomain.h" | 147 | #include "clockdomain.h" |
| 149 | #include "powerdomain.h" | 148 | #include "powerdomain.h" |
| 150 | #include "cm2xxx_3xxx.h" | 149 | #include "cm2xxx.h" |
| 150 | #include "cm3xxx.h" | ||
| 151 | #include "cminst44xx.h" | 151 | #include "cminst44xx.h" |
| 152 | #include "cm33xx.h" | 152 | #include "cm33xx.h" |
| 153 | #include "prm2xxx_3xxx.h" | 153 | #include "prm.h" |
| 154 | #include "prm3xxx.h" | ||
| 154 | #include "prm44xx.h" | 155 | #include "prm44xx.h" |
| 155 | #include "prm33xx.h" | 156 | #include "prm33xx.h" |
| 156 | #include "prminst44xx.h" | 157 | #include "prminst44xx.h" |
| 157 | #include "mux.h" | 158 | #include "mux.h" |
| 158 | #include "pm.h" | 159 | #include "pm.h" |
| 159 | 160 | ||
| 160 | /* Maximum microseconds to wait for OMAP module to softreset */ | ||
| 161 | #define MAX_MODULE_SOFTRESET_WAIT 10000 | ||
| 162 | |||
| 163 | /* Name of the OMAP hwmod for the MPU */ | 161 | /* Name of the OMAP hwmod for the MPU */ |
| 164 | #define MPU_INITIATOR_NAME "mpu" | 162 | #define MPU_INITIATOR_NAME "mpu" |
| 165 | 163 | ||
| @@ -2063,7 +2061,8 @@ static int _enable(struct omap_hwmod *oh) | |||
| 2063 | _enable_sysc(oh); | 2061 | _enable_sysc(oh); |
| 2064 | } | 2062 | } |
| 2065 | } else { | 2063 | } else { |
| 2066 | _omap4_disable_module(oh); | 2064 | if (soc_ops.disable_module) |
| 2065 | soc_ops.disable_module(oh); | ||
| 2067 | _disable_clocks(oh); | 2066 | _disable_clocks(oh); |
| 2068 | pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", | 2067 | pr_debug("omap_hwmod: %s: _wait_target_ready: %d\n", |
| 2069 | oh->name, r); | 2068 | oh->name, r); |
| @@ -2668,7 +2667,34 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois) | |||
| 2668 | /* Static functions intended only for use in soc_ops field function pointers */ | 2667 | /* Static functions intended only for use in soc_ops field function pointers */ |
| 2669 | 2668 | ||
| 2670 | /** | 2669 | /** |
| 2671 | * _omap2_wait_target_ready - wait for a module to leave slave idle | 2670 | * _omap2xxx_wait_target_ready - wait for a module to leave slave idle |
| 2671 | * @oh: struct omap_hwmod * | ||
| 2672 | * | ||
| 2673 | * Wait for a module @oh to leave slave idle. Returns 0 if the module | ||
| 2674 | * does not have an IDLEST bit or if the module successfully leaves | ||
| 2675 | * slave idle; otherwise, pass along the return value of the | ||
| 2676 | * appropriate *_cm*_wait_module_ready() function. | ||
| 2677 | */ | ||
| 2678 | static int _omap2xxx_wait_target_ready(struct omap_hwmod *oh) | ||
| 2679 | { | ||
| 2680 | if (!oh) | ||
| 2681 | return -EINVAL; | ||
| 2682 | |||
| 2683 | if (oh->flags & HWMOD_NO_IDLEST) | ||
| 2684 | return 0; | ||
| 2685 | |||
| 2686 | if (!_find_mpu_rt_port(oh)) | ||
| 2687 | return 0; | ||
| 2688 | |||
| 2689 | /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ | ||
| 2690 | |||
| 2691 | return omap2xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs, | ||
| 2692 | oh->prcm.omap2.idlest_reg_id, | ||
| 2693 | oh->prcm.omap2.idlest_idle_bit); | ||
| 2694 | } | ||
| 2695 | |||
| 2696 | /** | ||
| 2697 | * _omap3xxx_wait_target_ready - wait for a module to leave slave idle | ||
| 2672 | * @oh: struct omap_hwmod * | 2698 | * @oh: struct omap_hwmod * |
| 2673 | * | 2699 | * |
| 2674 | * Wait for a module @oh to leave slave idle. Returns 0 if the module | 2700 | * Wait for a module @oh to leave slave idle. Returns 0 if the module |
| @@ -2676,7 +2702,7 @@ static int __init _alloc_linkspace(struct omap_hwmod_ocp_if **ois) | |||
| 2676 | * slave idle; otherwise, pass along the return value of the | 2702 | * slave idle; otherwise, pass along the return value of the |
| 2677 | * appropriate *_cm*_wait_module_ready() function. | 2703 | * appropriate *_cm*_wait_module_ready() function. |
| 2678 | */ | 2704 | */ |
| 2679 | static int _omap2_wait_target_ready(struct omap_hwmod *oh) | 2705 | static int _omap3xxx_wait_target_ready(struct omap_hwmod *oh) |
| 2680 | { | 2706 | { |
| 2681 | if (!oh) | 2707 | if (!oh) |
| 2682 | return -EINVAL; | 2708 | return -EINVAL; |
| @@ -2689,9 +2715,9 @@ static int _omap2_wait_target_ready(struct omap_hwmod *oh) | |||
| 2689 | 2715 | ||
| 2690 | /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ | 2716 | /* XXX check module SIDLEMODE, hardreset status, enabled clocks */ |
| 2691 | 2717 | ||
| 2692 | return omap2_cm_wait_module_ready(oh->prcm.omap2.module_offs, | 2718 | return omap3xxx_cm_wait_module_ready(oh->prcm.omap2.module_offs, |
| 2693 | oh->prcm.omap2.idlest_reg_id, | 2719 | oh->prcm.omap2.idlest_reg_id, |
| 2694 | oh->prcm.omap2.idlest_idle_bit); | 2720 | oh->prcm.omap2.idlest_idle_bit); |
| 2695 | } | 2721 | } |
| 2696 | 2722 | ||
| 2697 | /** | 2723 | /** |
| @@ -3959,8 +3985,13 @@ int omap_hwmod_pad_route_irq(struct omap_hwmod *oh, int pad_idx, int irq_idx) | |||
| 3959 | */ | 3985 | */ |
| 3960 | void __init omap_hwmod_init(void) | 3986 | void __init omap_hwmod_init(void) |
| 3961 | { | 3987 | { |
| 3962 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { | 3988 | if (cpu_is_omap24xx()) { |
| 3963 | soc_ops.wait_target_ready = _omap2_wait_target_ready; | 3989 | soc_ops.wait_target_ready = _omap2xxx_wait_target_ready; |
| 3990 | soc_ops.assert_hardreset = _omap2_assert_hardreset; | ||
| 3991 | soc_ops.deassert_hardreset = _omap2_deassert_hardreset; | ||
| 3992 | soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; | ||
| 3993 | } else if (cpu_is_omap34xx()) { | ||
| 3994 | soc_ops.wait_target_ready = _omap3xxx_wait_target_ready; | ||
| 3964 | soc_ops.assert_hardreset = _omap2_assert_hardreset; | 3995 | soc_ops.assert_hardreset = _omap2_assert_hardreset; |
| 3965 | soc_ops.deassert_hardreset = _omap2_deassert_hardreset; | 3996 | soc_ops.deassert_hardreset = _omap2_deassert_hardreset; |
| 3966 | soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; | 3997 | soc_ops.is_hardreset_asserted = _omap2_is_hardreset_asserted; |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 9a2f5594a7dc..13e1f4303989 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
| @@ -43,9 +43,9 @@ | |||
| 43 | #include "soc.h" | 43 | #include "soc.h" |
| 44 | #include "common.h" | 44 | #include "common.h" |
| 45 | #include "clock.h" | 45 | #include "clock.h" |
| 46 | #include "prm2xxx_3xxx.h" | 46 | #include "prm2xxx.h" |
| 47 | #include "prm-regbits-24xx.h" | 47 | #include "prm-regbits-24xx.h" |
| 48 | #include "cm2xxx_3xxx.h" | 48 | #include "cm2xxx.h" |
| 49 | #include "cm-regbits-24xx.h" | 49 | #include "cm-regbits-24xx.h" |
| 50 | #include "sdrc.h" | 50 | #include "sdrc.h" |
| 51 | #include "sram.h" | 51 | #include "sram.h" |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 11f9669eb7ed..770320061422 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
| @@ -38,17 +38,15 @@ | |||
| 38 | 38 | ||
| 39 | #include "clockdomain.h" | 39 | #include "clockdomain.h" |
| 40 | #include "powerdomain.h" | 40 | #include "powerdomain.h" |
| 41 | #include <plat/prcm.h> | ||
| 42 | #include <plat-omap/dma-omap.h> | 41 | #include <plat-omap/dma-omap.h> |
| 43 | 42 | ||
| 44 | #include "soc.h" | 43 | #include "soc.h" |
| 45 | #include "common.h" | 44 | #include "common.h" |
| 46 | #include "cm2xxx_3xxx.h" | 45 | #include "cm3xxx.h" |
| 47 | #include "cm-regbits-34xx.h" | 46 | #include "cm-regbits-34xx.h" |
| 48 | #include "gpmc.h" | 47 | #include "gpmc.h" |
| 49 | #include "prm-regbits-34xx.h" | 48 | #include "prm-regbits-34xx.h" |
| 50 | 49 | #include "prm3xxx.h" | |
| 51 | #include "prm2xxx_3xxx.h" | ||
| 52 | #include "pm.h" | 50 | #include "pm.h" |
| 53 | #include "sdrc.h" | 51 | #include "sdrc.h" |
| 54 | #include "sram.h" | 52 | #include "sram.h" |
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 1678a3284233..dea62a9aad07 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c | |||
| @@ -29,8 +29,6 @@ | |||
| 29 | 29 | ||
| 30 | #include <asm/cpu.h> | 30 | #include <asm/cpu.h> |
| 31 | 31 | ||
| 32 | #include <plat/prcm.h> | ||
| 33 | |||
| 34 | #include "powerdomain.h" | 32 | #include "powerdomain.h" |
| 35 | #include "clockdomain.h" | 33 | #include "clockdomain.h" |
| 36 | 34 | ||
diff --git a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c b/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c deleted file mode 100644 index 3950ccfe5f4a..000000000000 --- a/arch/arm/mach-omap2/powerdomain2xxx_3xxx.c +++ /dev/null | |||
| @@ -1,242 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * OMAP2 and OMAP3 powerdomain control | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009-2011 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2007-2009 Nokia Corporation | ||
| 6 | * | ||
| 7 | * Derived from mach-omap2/powerdomain.c written by Paul Walmsley | ||
| 8 | * Rajendra Nayak <rnayak@ti.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/io.h> | ||
| 16 | #include <linux/errno.h> | ||
| 17 | #include <linux/delay.h> | ||
| 18 | #include <linux/bug.h> | ||
| 19 | |||
| 20 | #include <plat/prcm.h> | ||
| 21 | |||
| 22 | #include "powerdomain.h" | ||
| 23 | #include "prm.h" | ||
| 24 | #include "prm-regbits-24xx.h" | ||
| 25 | #include "prm-regbits-34xx.h" | ||
| 26 | |||
| 27 | |||
| 28 | /* Common functions across OMAP2 and OMAP3 */ | ||
| 29 | static int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 30 | { | ||
| 31 | omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, | ||
| 32 | (pwrst << OMAP_POWERSTATE_SHIFT), | ||
| 33 | pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); | ||
| 34 | return 0; | ||
| 35 | } | ||
| 36 | |||
| 37 | static int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | ||
| 38 | { | ||
| 39 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 40 | OMAP2_PM_PWSTCTRL, | ||
| 41 | OMAP_POWERSTATE_MASK); | ||
| 42 | } | ||
| 43 | |||
| 44 | static int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm) | ||
| 45 | { | ||
| 46 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 47 | OMAP2_PM_PWSTST, | ||
| 48 | OMAP_POWERSTATEST_MASK); | ||
| 49 | } | ||
| 50 | |||
| 51 | static int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, | ||
| 52 | u8 pwrst) | ||
| 53 | { | ||
| 54 | u32 m; | ||
| 55 | |||
| 56 | m = omap2_pwrdm_get_mem_bank_onstate_mask(bank); | ||
| 57 | |||
| 58 | omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs, | ||
| 59 | OMAP2_PM_PWSTCTRL); | ||
| 60 | |||
| 61 | return 0; | ||
| 62 | } | ||
| 63 | |||
| 64 | static int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, | ||
| 65 | u8 pwrst) | ||
| 66 | { | ||
| 67 | u32 m; | ||
| 68 | |||
| 69 | m = omap2_pwrdm_get_mem_bank_retst_mask(bank); | ||
| 70 | |||
| 71 | omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs, | ||
| 72 | OMAP2_PM_PWSTCTRL); | ||
| 73 | |||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | static int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 78 | { | ||
| 79 | u32 m; | ||
| 80 | |||
| 81 | m = omap2_pwrdm_get_mem_bank_stst_mask(bank); | ||
| 82 | |||
| 83 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST, | ||
| 84 | m); | ||
| 85 | } | ||
| 86 | |||
| 87 | static int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank) | ||
| 88 | { | ||
| 89 | u32 m; | ||
| 90 | |||
| 91 | m = omap2_pwrdm_get_mem_bank_retst_mask(bank); | ||
| 92 | |||
| 93 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 94 | OMAP2_PM_PWSTCTRL, m); | ||
| 95 | } | ||
| 96 | |||
| 97 | static int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 98 | { | ||
| 99 | u32 v; | ||
| 100 | |||
| 101 | v = pwrst << __ffs(OMAP3430_LOGICL1CACHERETSTATE_MASK); | ||
| 102 | omap2_prm_rmw_mod_reg_bits(OMAP3430_LOGICL1CACHERETSTATE_MASK, v, | ||
| 103 | pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); | ||
| 104 | |||
| 105 | return 0; | ||
| 106 | } | ||
| 107 | |||
| 108 | static int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm) | ||
| 109 | { | ||
| 110 | u32 c = 0; | ||
| 111 | |||
| 112 | /* | ||
| 113 | * REVISIT: pwrdm_wait_transition() may be better implemented | ||
| 114 | * via a callback and a periodic timer check -- how long do we expect | ||
| 115 | * powerdomain transitions to take? | ||
| 116 | */ | ||
| 117 | |||
| 118 | /* XXX Is this udelay() value meaningful? */ | ||
| 119 | while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) & | ||
| 120 | OMAP_INTRANSITION_MASK) && | ||
| 121 | (c++ < PWRDM_TRANSITION_BAILOUT)) | ||
| 122 | udelay(1); | ||
| 123 | |||
| 124 | if (c > PWRDM_TRANSITION_BAILOUT) { | ||
| 125 | pr_err("powerdomain: %s: waited too long to complete transition\n", | ||
| 126 | pwrdm->name); | ||
| 127 | return -EAGAIN; | ||
| 128 | } | ||
| 129 | |||
| 130 | pr_debug("powerdomain: completed transition in %d loops\n", c); | ||
| 131 | |||
| 132 | return 0; | ||
| 133 | } | ||
| 134 | |||
| 135 | /* Applicable only for OMAP3. Not supported on OMAP2 */ | ||
| 136 | static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | ||
| 137 | { | ||
| 138 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 139 | OMAP3430_PM_PREPWSTST, | ||
| 140 | OMAP3430_LASTPOWERSTATEENTERED_MASK); | ||
| 141 | } | ||
| 142 | |||
| 143 | static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | ||
| 144 | { | ||
| 145 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 146 | OMAP2_PM_PWSTST, | ||
| 147 | OMAP3430_LOGICSTATEST_MASK); | ||
| 148 | } | ||
| 149 | |||
| 150 | static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
| 151 | { | ||
| 152 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 153 | OMAP2_PM_PWSTCTRL, | ||
| 154 | OMAP3430_LOGICSTATEST_MASK); | ||
| 155 | } | ||
| 156 | |||
| 157 | static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | ||
| 158 | { | ||
| 159 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 160 | OMAP3430_PM_PREPWSTST, | ||
| 161 | OMAP3430_LASTLOGICSTATEENTERED_MASK); | ||
| 162 | } | ||
| 163 | |||
| 164 | static int omap3_get_mem_bank_lastmemst_mask(u8 bank) | ||
| 165 | { | ||
| 166 | switch (bank) { | ||
| 167 | case 0: | ||
| 168 | return OMAP3430_LASTMEM1STATEENTERED_MASK; | ||
| 169 | case 1: | ||
| 170 | return OMAP3430_LASTMEM2STATEENTERED_MASK; | ||
| 171 | case 2: | ||
| 172 | return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK; | ||
| 173 | case 3: | ||
| 174 | return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK; | ||
| 175 | default: | ||
| 176 | WARN_ON(1); /* should never happen */ | ||
| 177 | return -EEXIST; | ||
| 178 | } | ||
| 179 | return 0; | ||
| 180 | } | ||
| 181 | |||
| 182 | static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 183 | { | ||
| 184 | u32 m; | ||
| 185 | |||
| 186 | m = omap3_get_mem_bank_lastmemst_mask(bank); | ||
| 187 | |||
| 188 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 189 | OMAP3430_PM_PREPWSTST, m); | ||
| 190 | } | ||
| 191 | |||
| 192 | static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) | ||
| 193 | { | ||
| 194 | omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST); | ||
| 195 | return 0; | ||
| 196 | } | ||
| 197 | |||
| 198 | static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm) | ||
| 199 | { | ||
| 200 | return omap2_prm_rmw_mod_reg_bits(0, | ||
| 201 | 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, | ||
| 202 | pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); | ||
| 203 | } | ||
| 204 | |||
| 205 | static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm) | ||
| 206 | { | ||
| 207 | return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, | ||
| 208 | 0, pwrdm->prcm_offs, | ||
| 209 | OMAP2_PM_PWSTCTRL); | ||
| 210 | } | ||
| 211 | |||
| 212 | struct pwrdm_ops omap2_pwrdm_operations = { | ||
| 213 | .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, | ||
| 214 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, | ||
| 215 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, | ||
| 216 | .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, | ||
| 217 | .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst, | ||
| 218 | .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst, | ||
| 219 | .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst, | ||
| 220 | .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst, | ||
| 221 | .pwrdm_wait_transition = omap2_pwrdm_wait_transition, | ||
| 222 | }; | ||
| 223 | |||
| 224 | struct pwrdm_ops omap3_pwrdm_operations = { | ||
| 225 | .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, | ||
| 226 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, | ||
| 227 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, | ||
| 228 | .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst, | ||
| 229 | .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, | ||
| 230 | .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst, | ||
| 231 | .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst, | ||
| 232 | .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst, | ||
| 233 | .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst, | ||
| 234 | .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst, | ||
| 235 | .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst, | ||
| 236 | .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst, | ||
| 237 | .pwrdm_read_prev_mem_pwrst = omap3_pwrdm_read_prev_mem_pwrst, | ||
| 238 | .pwrdm_clear_all_prev_pwrst = omap3_pwrdm_clear_all_prev_pwrst, | ||
| 239 | .pwrdm_enable_hdwr_sar = omap3_pwrdm_enable_hdwr_sar, | ||
| 240 | .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar, | ||
| 241 | .pwrdm_wait_transition = omap2_pwrdm_wait_transition, | ||
| 242 | }; | ||
diff --git a/arch/arm/mach-omap2/powerdomain33xx.c b/arch/arm/mach-omap2/powerdomain33xx.c deleted file mode 100644 index 67c5663899b6..000000000000 --- a/arch/arm/mach-omap2/powerdomain33xx.c +++ /dev/null | |||
| @@ -1,229 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * AM33XX Powerdomain control | ||
| 3 | * | ||
| 4 | * Copyright (C) 2011-2012 Texas Instruments Incorporated - http://www.ti.com/ | ||
| 5 | * | ||
| 6 | * Derived from mach-omap2/powerdomain44xx.c written by Rajendra Nayak | ||
| 7 | * <rnayak@ti.com> | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or | ||
| 10 | * modify it under the terms of the GNU General Public License as | ||
| 11 | * published by the Free Software Foundation version 2. | ||
| 12 | * | ||
| 13 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
| 14 | * kind, whether express or implied; without even the implied warranty | ||
| 15 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | * GNU General Public License for more details. | ||
| 17 | */ | ||
| 18 | |||
| 19 | #include <linux/io.h> | ||
| 20 | #include <linux/errno.h> | ||
| 21 | #include <linux/delay.h> | ||
| 22 | |||
| 23 | #include <plat/prcm.h> | ||
| 24 | |||
| 25 | #include "powerdomain.h" | ||
| 26 | #include "prm33xx.h" | ||
| 27 | #include "prm-regbits-33xx.h" | ||
| 28 | |||
| 29 | |||
| 30 | static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 31 | { | ||
| 32 | am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK, | ||
| 33 | (pwrst << OMAP_POWERSTATE_SHIFT), | ||
| 34 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 35 | return 0; | ||
| 36 | } | ||
| 37 | |||
| 38 | static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | ||
| 39 | { | ||
| 40 | u32 v; | ||
| 41 | |||
| 42 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 43 | v &= OMAP_POWERSTATE_MASK; | ||
| 44 | v >>= OMAP_POWERSTATE_SHIFT; | ||
| 45 | |||
| 46 | return v; | ||
| 47 | } | ||
| 48 | |||
| 49 | static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm) | ||
| 50 | { | ||
| 51 | u32 v; | ||
| 52 | |||
| 53 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 54 | v &= OMAP_POWERSTATEST_MASK; | ||
| 55 | v >>= OMAP_POWERSTATEST_SHIFT; | ||
| 56 | |||
| 57 | return v; | ||
| 58 | } | ||
| 59 | |||
| 60 | static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | ||
| 61 | { | ||
| 62 | u32 v; | ||
| 63 | |||
| 64 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 65 | v &= AM33XX_LASTPOWERSTATEENTERED_MASK; | ||
| 66 | v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT; | ||
| 67 | |||
| 68 | return v; | ||
| 69 | } | ||
| 70 | |||
| 71 | static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm) | ||
| 72 | { | ||
| 73 | am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK, | ||
| 74 | (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT), | ||
| 75 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 76 | return 0; | ||
| 77 | } | ||
| 78 | |||
| 79 | static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) | ||
| 80 | { | ||
| 81 | am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK, | ||
| 82 | AM33XX_LASTPOWERSTATEENTERED_MASK, | ||
| 83 | pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 84 | return 0; | ||
| 85 | } | ||
| 86 | |||
| 87 | static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 88 | { | ||
| 89 | u32 m; | ||
| 90 | |||
| 91 | m = pwrdm->logicretstate_mask; | ||
| 92 | if (!m) | ||
| 93 | return -EINVAL; | ||
| 94 | |||
| 95 | am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)), | ||
| 96 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 97 | |||
| 98 | return 0; | ||
| 99 | } | ||
| 100 | |||
| 101 | static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | ||
| 102 | { | ||
| 103 | u32 v; | ||
| 104 | |||
| 105 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 106 | v &= AM33XX_LOGICSTATEST_MASK; | ||
| 107 | v >>= AM33XX_LOGICSTATEST_SHIFT; | ||
| 108 | |||
| 109 | return v; | ||
| 110 | } | ||
| 111 | |||
| 112 | static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
| 113 | { | ||
| 114 | u32 v, m; | ||
| 115 | |||
| 116 | m = pwrdm->logicretstate_mask; | ||
| 117 | if (!m) | ||
| 118 | return -EINVAL; | ||
| 119 | |||
| 120 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 121 | v &= m; | ||
| 122 | v >>= __ffs(m); | ||
| 123 | |||
| 124 | return v; | ||
| 125 | } | ||
| 126 | |||
| 127 | static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, | ||
| 128 | u8 pwrst) | ||
| 129 | { | ||
| 130 | u32 m; | ||
| 131 | |||
| 132 | m = pwrdm->mem_on_mask[bank]; | ||
| 133 | if (!m) | ||
| 134 | return -EINVAL; | ||
| 135 | |||
| 136 | am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)), | ||
| 137 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 138 | |||
| 139 | return 0; | ||
| 140 | } | ||
| 141 | |||
| 142 | static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, | ||
| 143 | u8 pwrst) | ||
| 144 | { | ||
| 145 | u32 m; | ||
| 146 | |||
| 147 | m = pwrdm->mem_ret_mask[bank]; | ||
| 148 | if (!m) | ||
| 149 | return -EINVAL; | ||
| 150 | |||
| 151 | am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)), | ||
| 152 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 153 | |||
| 154 | return 0; | ||
| 155 | } | ||
| 156 | |||
| 157 | static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 158 | { | ||
| 159 | u32 m, v; | ||
| 160 | |||
| 161 | m = pwrdm->mem_pwrst_mask[bank]; | ||
| 162 | if (!m) | ||
| 163 | return -EINVAL; | ||
| 164 | |||
| 165 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 166 | v &= m; | ||
| 167 | v >>= __ffs(m); | ||
| 168 | |||
| 169 | return v; | ||
| 170 | } | ||
| 171 | |||
| 172 | static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank) | ||
| 173 | { | ||
| 174 | u32 m, v; | ||
| 175 | |||
| 176 | m = pwrdm->mem_retst_mask[bank]; | ||
| 177 | if (!m) | ||
| 178 | return -EINVAL; | ||
| 179 | |||
| 180 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 181 | v &= m; | ||
| 182 | v >>= __ffs(m); | ||
| 183 | |||
| 184 | return v; | ||
| 185 | } | ||
| 186 | |||
| 187 | static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm) | ||
| 188 | { | ||
| 189 | u32 c = 0; | ||
| 190 | |||
| 191 | /* | ||
| 192 | * REVISIT: pwrdm_wait_transition() may be better implemented | ||
| 193 | * via a callback and a periodic timer check -- how long do we expect | ||
| 194 | * powerdomain transitions to take? | ||
| 195 | */ | ||
| 196 | |||
| 197 | /* XXX Is this udelay() value meaningful? */ | ||
| 198 | while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs) | ||
| 199 | & OMAP_INTRANSITION_MASK) && | ||
| 200 | (c++ < PWRDM_TRANSITION_BAILOUT)) | ||
| 201 | udelay(1); | ||
| 202 | |||
| 203 | if (c > PWRDM_TRANSITION_BAILOUT) { | ||
| 204 | pr_err("powerdomain: %s: waited too long to complete transition\n", | ||
| 205 | pwrdm->name); | ||
| 206 | return -EAGAIN; | ||
| 207 | } | ||
| 208 | |||
| 209 | pr_debug("powerdomain: completed transition in %d loops\n", c); | ||
| 210 | |||
| 211 | return 0; | ||
| 212 | } | ||
| 213 | |||
| 214 | struct pwrdm_ops am33xx_pwrdm_operations = { | ||
| 215 | .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst, | ||
| 216 | .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst, | ||
| 217 | .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst, | ||
| 218 | .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst, | ||
| 219 | .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst, | ||
| 220 | .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst, | ||
| 221 | .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst, | ||
| 222 | .pwrdm_clear_all_prev_pwrst = am33xx_pwrdm_clear_all_prev_pwrst, | ||
| 223 | .pwrdm_set_lowpwrstchange = am33xx_pwrdm_set_lowpwrstchange, | ||
| 224 | .pwrdm_read_mem_pwrst = am33xx_pwrdm_read_mem_pwrst, | ||
| 225 | .pwrdm_read_mem_retst = am33xx_pwrdm_read_mem_retst, | ||
| 226 | .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst, | ||
| 227 | .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst, | ||
| 228 | .pwrdm_wait_transition = am33xx_pwrdm_wait_transition, | ||
| 229 | }; | ||
diff --git a/arch/arm/mach-omap2/powerdomain44xx.c b/arch/arm/mach-omap2/powerdomain44xx.c deleted file mode 100644 index aceb4f464c9b..000000000000 --- a/arch/arm/mach-omap2/powerdomain44xx.c +++ /dev/null | |||
| @@ -1,285 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * OMAP4 powerdomain control | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009-2010, 2012 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2007-2009 Nokia Corporation | ||
| 6 | * | ||
| 7 | * Derived from mach-omap2/powerdomain.c written by Paul Walmsley | ||
| 8 | * Rajendra Nayak <rnayak@ti.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/io.h> | ||
| 16 | #include <linux/errno.h> | ||
| 17 | #include <linux/delay.h> | ||
| 18 | #include <linux/bug.h> | ||
| 19 | |||
| 20 | #include "powerdomain.h" | ||
| 21 | #include <plat/prcm.h> | ||
| 22 | #include "prm2xxx_3xxx.h" | ||
| 23 | #include "prm44xx.h" | ||
| 24 | #include "prminst44xx.h" | ||
| 25 | #include "prm-regbits-44xx.h" | ||
| 26 | |||
| 27 | static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 28 | { | ||
| 29 | omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK, | ||
| 30 | (pwrst << OMAP_POWERSTATE_SHIFT), | ||
| 31 | pwrdm->prcm_partition, | ||
| 32 | pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL); | ||
| 33 | return 0; | ||
| 34 | } | ||
| 35 | |||
| 36 | static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | ||
| 37 | { | ||
| 38 | u32 v; | ||
| 39 | |||
| 40 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 41 | OMAP4_PM_PWSTCTRL); | ||
| 42 | v &= OMAP_POWERSTATE_MASK; | ||
| 43 | v >>= OMAP_POWERSTATE_SHIFT; | ||
| 44 | |||
| 45 | return v; | ||
| 46 | } | ||
| 47 | |||
| 48 | static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm) | ||
| 49 | { | ||
| 50 | u32 v; | ||
| 51 | |||
| 52 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 53 | OMAP4_PM_PWSTST); | ||
| 54 | v &= OMAP_POWERSTATEST_MASK; | ||
| 55 | v >>= OMAP_POWERSTATEST_SHIFT; | ||
| 56 | |||
| 57 | return v; | ||
| 58 | } | ||
| 59 | |||
| 60 | static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | ||
| 61 | { | ||
| 62 | u32 v; | ||
| 63 | |||
| 64 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 65 | OMAP4_PM_PWSTST); | ||
| 66 | v &= OMAP4430_LASTPOWERSTATEENTERED_MASK; | ||
| 67 | v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT; | ||
| 68 | |||
| 69 | return v; | ||
| 70 | } | ||
| 71 | |||
| 72 | static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm) | ||
| 73 | { | ||
| 74 | omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK, | ||
| 75 | (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT), | ||
| 76 | pwrdm->prcm_partition, | ||
| 77 | pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL); | ||
| 78 | return 0; | ||
| 79 | } | ||
| 80 | |||
| 81 | static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) | ||
| 82 | { | ||
| 83 | omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK, | ||
| 84 | OMAP4430_LASTPOWERSTATEENTERED_MASK, | ||
| 85 | pwrdm->prcm_partition, | ||
| 86 | pwrdm->prcm_offs, OMAP4_PM_PWSTST); | ||
| 87 | return 0; | ||
| 88 | } | ||
| 89 | |||
| 90 | static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 91 | { | ||
| 92 | u32 v; | ||
| 93 | |||
| 94 | v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK); | ||
| 95 | omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v, | ||
| 96 | pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 97 | OMAP4_PM_PWSTCTRL); | ||
| 98 | |||
| 99 | return 0; | ||
| 100 | } | ||
| 101 | |||
| 102 | static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, | ||
| 103 | u8 pwrst) | ||
| 104 | { | ||
| 105 | u32 m; | ||
| 106 | |||
| 107 | m = omap2_pwrdm_get_mem_bank_onstate_mask(bank); | ||
| 108 | |||
| 109 | omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)), | ||
| 110 | pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 111 | OMAP4_PM_PWSTCTRL); | ||
| 112 | |||
| 113 | return 0; | ||
| 114 | } | ||
| 115 | |||
| 116 | static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, | ||
| 117 | u8 pwrst) | ||
| 118 | { | ||
| 119 | u32 m; | ||
| 120 | |||
| 121 | m = omap2_pwrdm_get_mem_bank_retst_mask(bank); | ||
| 122 | |||
| 123 | omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)), | ||
| 124 | pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 125 | OMAP4_PM_PWSTCTRL); | ||
| 126 | |||
| 127 | return 0; | ||
| 128 | } | ||
| 129 | |||
| 130 | static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | ||
| 131 | { | ||
| 132 | u32 v; | ||
| 133 | |||
| 134 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 135 | OMAP4_PM_PWSTST); | ||
| 136 | v &= OMAP4430_LOGICSTATEST_MASK; | ||
| 137 | v >>= OMAP4430_LOGICSTATEST_SHIFT; | ||
| 138 | |||
| 139 | return v; | ||
| 140 | } | ||
| 141 | |||
| 142 | static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
| 143 | { | ||
| 144 | u32 v; | ||
| 145 | |||
| 146 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 147 | OMAP4_PM_PWSTCTRL); | ||
| 148 | v &= OMAP4430_LOGICRETSTATE_MASK; | ||
| 149 | v >>= OMAP4430_LOGICRETSTATE_SHIFT; | ||
| 150 | |||
| 151 | return v; | ||
| 152 | } | ||
| 153 | |||
| 154 | /** | ||
| 155 | * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate | ||
| 156 | * @pwrdm: struct powerdomain * to read the state for | ||
| 157 | * | ||
| 158 | * Reads the previous logic powerstate for a powerdomain. This | ||
| 159 | * function must determine the previous logic powerstate by first | ||
| 160 | * checking the previous powerstate for the domain. If that was OFF, | ||
| 161 | * then logic has been lost. If previous state was RETENTION, the | ||
| 162 | * function reads the setting for the next retention logic state to | ||
| 163 | * see the actual value. In every other case, the logic is | ||
| 164 | * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET | ||
| 165 | * depending whether the logic was retained or not. | ||
| 166 | */ | ||
| 167 | static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | ||
| 168 | { | ||
| 169 | int state; | ||
| 170 | |||
| 171 | state = omap4_pwrdm_read_prev_pwrst(pwrdm); | ||
| 172 | |||
| 173 | if (state == PWRDM_POWER_OFF) | ||
| 174 | return PWRDM_POWER_OFF; | ||
| 175 | |||
| 176 | if (state != PWRDM_POWER_RET) | ||
| 177 | return PWRDM_POWER_RET; | ||
| 178 | |||
| 179 | return omap4_pwrdm_read_logic_retst(pwrdm); | ||
| 180 | } | ||
| 181 | |||
| 182 | static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 183 | { | ||
| 184 | u32 m, v; | ||
| 185 | |||
| 186 | m = omap2_pwrdm_get_mem_bank_stst_mask(bank); | ||
| 187 | |||
| 188 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 189 | OMAP4_PM_PWSTST); | ||
| 190 | v &= m; | ||
| 191 | v >>= __ffs(m); | ||
| 192 | |||
| 193 | return v; | ||
| 194 | } | ||
| 195 | |||
| 196 | static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank) | ||
| 197 | { | ||
| 198 | u32 m, v; | ||
| 199 | |||
| 200 | m = omap2_pwrdm_get_mem_bank_retst_mask(bank); | ||
| 201 | |||
| 202 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 203 | OMAP4_PM_PWSTCTRL); | ||
| 204 | v &= m; | ||
| 205 | v >>= __ffs(m); | ||
| 206 | |||
| 207 | return v; | ||
| 208 | } | ||
| 209 | |||
| 210 | /** | ||
| 211 | * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate | ||
| 212 | * @pwrdm: struct powerdomain * to read mem powerstate for | ||
| 213 | * @bank: memory bank index | ||
| 214 | * | ||
| 215 | * Reads the previous memory powerstate for a powerdomain. This | ||
| 216 | * function must determine the previous memory powerstate by first | ||
| 217 | * checking the previous powerstate for the domain. If that was OFF, | ||
| 218 | * then logic has been lost. If previous state was RETENTION, the | ||
| 219 | * function reads the setting for the next memory retention state to | ||
| 220 | * see the actual value. In every other case, the logic is | ||
| 221 | * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET | ||
| 222 | * depending whether logic was retained or not. | ||
| 223 | */ | ||
| 224 | static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 225 | { | ||
| 226 | int state; | ||
| 227 | |||
| 228 | state = omap4_pwrdm_read_prev_pwrst(pwrdm); | ||
| 229 | |||
| 230 | if (state == PWRDM_POWER_OFF) | ||
| 231 | return PWRDM_POWER_OFF; | ||
| 232 | |||
| 233 | if (state != PWRDM_POWER_RET) | ||
| 234 | return PWRDM_POWER_RET; | ||
| 235 | |||
| 236 | return omap4_pwrdm_read_mem_retst(pwrdm, bank); | ||
| 237 | } | ||
| 238 | |||
| 239 | static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm) | ||
| 240 | { | ||
| 241 | u32 c = 0; | ||
| 242 | |||
| 243 | /* | ||
| 244 | * REVISIT: pwrdm_wait_transition() may be better implemented | ||
| 245 | * via a callback and a periodic timer check -- how long do we expect | ||
| 246 | * powerdomain transitions to take? | ||
| 247 | */ | ||
| 248 | |||
| 249 | /* XXX Is this udelay() value meaningful? */ | ||
| 250 | while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition, | ||
| 251 | pwrdm->prcm_offs, | ||
| 252 | OMAP4_PM_PWSTST) & | ||
| 253 | OMAP_INTRANSITION_MASK) && | ||
| 254 | (c++ < PWRDM_TRANSITION_BAILOUT)) | ||
| 255 | udelay(1); | ||
| 256 | |||
| 257 | if (c > PWRDM_TRANSITION_BAILOUT) { | ||
| 258 | pr_err("powerdomain: %s: waited too long to complete transition\n", | ||
| 259 | pwrdm->name); | ||
| 260 | return -EAGAIN; | ||
| 261 | } | ||
| 262 | |||
| 263 | pr_debug("powerdomain: completed transition in %d loops\n", c); | ||
| 264 | |||
| 265 | return 0; | ||
| 266 | } | ||
| 267 | |||
| 268 | struct pwrdm_ops omap4_pwrdm_operations = { | ||
| 269 | .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst, | ||
| 270 | .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst, | ||
| 271 | .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst, | ||
| 272 | .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst, | ||
| 273 | .pwrdm_set_lowpwrstchange = omap4_pwrdm_set_lowpwrstchange, | ||
| 274 | .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst, | ||
| 275 | .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst, | ||
| 276 | .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst, | ||
| 277 | .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst, | ||
| 278 | .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst, | ||
| 279 | .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst, | ||
| 280 | .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst, | ||
| 281 | .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst, | ||
| 282 | .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst, | ||
| 283 | .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst, | ||
| 284 | .pwrdm_wait_transition = omap4_pwrdm_wait_transition, | ||
| 285 | }; | ||
diff --git a/arch/arm/mach-omap2/prcm-common.h b/arch/arm/mach-omap2/prcm-common.h index 72df97482cc0..c7d355fafd24 100644 --- a/arch/arm/mach-omap2/prcm-common.h +++ b/arch/arm/mach-omap2/prcm-common.h | |||
| @@ -406,11 +406,6 @@ | |||
| 406 | #define OMAP3430_EN_CORE_MASK (1 << 0) | 406 | #define OMAP3430_EN_CORE_MASK (1 << 0) |
| 407 | 407 | ||
| 408 | 408 | ||
| 409 | /* | ||
| 410 | * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP | ||
| 411 | * submodule to exit hardreset | ||
| 412 | */ | ||
| 413 | #define MAX_MODULE_HARDRESET_WAIT 10000 | ||
| 414 | 409 | ||
| 415 | /* | 410 | /* |
| 416 | * Maximum time(us) it takes to output the signal WUCLKOUT of the last | 411 | * Maximum time(us) it takes to output the signal WUCLKOUT of the last |
| @@ -419,24 +414,7 @@ | |||
| 419 | * microseconds on OMAP4, so this timeout may be too high. | 414 | * microseconds on OMAP4, so this timeout may be too high. |
| 420 | */ | 415 | */ |
| 421 | #define MAX_IOPAD_LATCH_TIME 100 | 416 | #define MAX_IOPAD_LATCH_TIME 100 |
| 422 | |||
| 423 | # ifndef __ASSEMBLER__ | 417 | # ifndef __ASSEMBLER__ |
| 424 | extern void __iomem *prm_base; | ||
| 425 | extern void __iomem *cm_base; | ||
| 426 | extern void __iomem *cm2_base; | ||
| 427 | extern void __iomem *prcm_mpu_base; | ||
| 428 | |||
| 429 | #if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) | ||
| 430 | extern void omap_prm_base_init(void); | ||
| 431 | extern void omap_cm_base_init(void); | ||
| 432 | #else | ||
| 433 | static inline void omap_prm_base_init(void) | ||
| 434 | { | ||
| 435 | } | ||
| 436 | static 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 | |||
| 43 | void __iomem *prm_base; | ||
| 44 | void __iomem *cm_base; | ||
| 45 | void __iomem *cm2_base; | ||
| 46 | void __iomem *prcm_mpu_base; | ||
| 47 | |||
| 48 | #define MAX_MODULE_ENABLE_WAIT 100000 | ||
| 49 | |||
| 50 | u32 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 | } | ||
| 60 | EXPORT_SYMBOL(omap_prcm_get_reset_sources); | ||
| 61 | |||
| 62 | /* Resets clock rates and reboots the system. Only called from system.h */ | ||
| 63 | void 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 | */ | ||
| 127 | int 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 | |||
| 152 | void __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 | */ | ||
| 175 | int __weak omap4_cminst_wait_module_idle(u8 part, u16 inst, s16 cdoffs, | ||
| 176 | u16 clkctrl_offs) | ||
| 177 | { | ||
| 178 | return 0; | ||
| 179 | } | ||
| 180 | |||
| 181 | void __weak omap4_cminst_module_enable(u8 mode, u8 part, u16 inst, | ||
| 182 | s16 cdoffs, u16 clkctrl_offs) | ||
| 183 | { | ||
| 184 | } | ||
| 185 | |||
| 186 | void __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 | */ | ||
| 27 | void __iomem *prcm_mpu_base; | ||
| 28 | |||
| 23 | /* PRCM_MPU low-level functions */ | 29 | /* PRCM_MPU low-level functions */ |
| 24 | 30 | ||
| 25 | u32 omap4_prcm_mpu_read_inst_reg(s16 inst, u16 reg) | 31 | u32 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 | */ | ||
| 59 | void __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__ | ||
| 31 | extern 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); | |||
| 98 | extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx); | 104 | extern void omap4_prcm_mpu_write_inst_reg(u32 val, s16 inst, u16 idx); |
| 99 | extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, | 105 | extern u32 omap4_prcm_mpu_rmw_inst_reg_bits(u32 mask, u32 bits, s16 inst, |
| 100 | s16 idx); | 106 | s16 idx); |
| 107 | extern void __init omap2_set_globals_prcm_mpu(void __iomem *prcm_mpu); | ||
| 101 | # endif | 108 | # endif |
| 102 | 109 | ||
| 103 | #endif | 110 | #endif |
diff --git a/arch/arm/mach-omap2/prm-regbits-24xx.h b/arch/arm/mach-omap2/prm-regbits-24xx.h index 6ac966103f34..638da6dd41c3 100644 --- a/arch/arm/mach-omap2/prm-regbits-24xx.h +++ b/arch/arm/mach-omap2/prm-regbits-24xx.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | * published by the Free Software Foundation. | 14 | * published by the Free Software Foundation. |
| 15 | */ | 15 | */ |
| 16 | 16 | ||
| 17 | #include "prm2xxx_3xxx.h" | 17 | #include "prm2xxx.h" |
| 18 | 18 | ||
| 19 | /* Bits shared between registers */ | 19 | /* Bits shared between registers */ |
| 20 | 20 | ||
| @@ -209,9 +209,13 @@ | |||
| 209 | 209 | ||
| 210 | /* RM_RSTST_WKUP specific bits */ | 210 | /* RM_RSTST_WKUP specific bits */ |
| 211 | /* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */ | 211 | /* 2430 calls EXTWMPU_RST "EXTWARM_RST" and GLOBALWMPU_RST "GLOBALWARM_RST" */ |
| 212 | #define OMAP24XX_EXTWMPU_RST_SHIFT 6 | ||
| 212 | #define OMAP24XX_EXTWMPU_RST_MASK (1 << 6) | 213 | #define OMAP24XX_EXTWMPU_RST_MASK (1 << 6) |
| 214 | #define OMAP24XX_SECU_WD_RST_SHIFT 5 | ||
| 213 | #define OMAP24XX_SECU_WD_RST_MASK (1 << 5) | 215 | #define OMAP24XX_SECU_WD_RST_MASK (1 << 5) |
| 216 | #define OMAP24XX_MPU_WD_RST_SHIFT 4 | ||
| 214 | #define OMAP24XX_MPU_WD_RST_MASK (1 << 4) | 217 | #define OMAP24XX_MPU_WD_RST_MASK (1 << 4) |
| 218 | #define OMAP24XX_SECU_VIOL_RST_SHIFT 3 | ||
| 215 | #define OMAP24XX_SECU_VIOL_RST_MASK (1 << 3) | 219 | #define OMAP24XX_SECU_VIOL_RST_MASK (1 << 3) |
| 216 | 220 | ||
| 217 | /* PM_WKEN_WKUP specific bits */ | 221 | /* PM_WKEN_WKUP specific bits */ |
diff --git a/arch/arm/mach-omap2/prm-regbits-34xx.h b/arch/arm/mach-omap2/prm-regbits-34xx.h index 64c087af6a8b..838b594d4e13 100644 --- a/arch/arm/mach-omap2/prm-regbits-34xx.h +++ b/arch/arm/mach-omap2/prm-regbits-34xx.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H | 14 | #define __ARCH_ARM_MACH_OMAP2_PRM_REGBITS_34XX_H |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | #include "prm2xxx_3xxx.h" | 17 | #include "prm3xxx.h" |
| 18 | 18 | ||
| 19 | /* Shared register bits */ | 19 | /* Shared register bits */ |
| 20 | 20 | ||
| @@ -509,15 +509,25 @@ | |||
| 509 | #define OMAP3430_RSTTIME1_MASK (0xff << 0) | 509 | #define OMAP3430_RSTTIME1_MASK (0xff << 0) |
| 510 | 510 | ||
| 511 | /* PRM_RSTST */ | 511 | /* PRM_RSTST */ |
| 512 | #define OMAP3430_ICECRUSHER_RST_SHIFT 10 | ||
| 512 | #define OMAP3430_ICECRUSHER_RST_MASK (1 << 10) | 513 | #define OMAP3430_ICECRUSHER_RST_MASK (1 << 10) |
| 514 | #define OMAP3430_ICEPICK_RST_SHIFT 9 | ||
| 513 | #define OMAP3430_ICEPICK_RST_MASK (1 << 9) | 515 | #define OMAP3430_ICEPICK_RST_MASK (1 << 9) |
| 516 | #define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT 8 | ||
| 514 | #define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK (1 << 8) | 517 | #define OMAP3430_VDD2_VOLTAGE_MANAGER_RST_MASK (1 << 8) |
| 518 | #define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT 7 | ||
| 515 | #define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK (1 << 7) | 519 | #define OMAP3430_VDD1_VOLTAGE_MANAGER_RST_MASK (1 << 7) |
| 520 | #define OMAP3430_EXTERNAL_WARM_RST_SHIFT 6 | ||
| 516 | #define OMAP3430_EXTERNAL_WARM_RST_MASK (1 << 6) | 521 | #define OMAP3430_EXTERNAL_WARM_RST_MASK (1 << 6) |
| 522 | #define OMAP3430_SECURE_WD_RST_SHIFT 5 | ||
| 517 | #define OMAP3430_SECURE_WD_RST_MASK (1 << 5) | 523 | #define OMAP3430_SECURE_WD_RST_MASK (1 << 5) |
| 524 | #define OMAP3430_MPU_WD_RST_SHIFT 4 | ||
| 518 | #define OMAP3430_MPU_WD_RST_MASK (1 << 4) | 525 | #define OMAP3430_MPU_WD_RST_MASK (1 << 4) |
| 526 | #define OMAP3430_SECURITY_VIOL_RST_SHIFT 3 | ||
| 519 | #define OMAP3430_SECURITY_VIOL_RST_MASK (1 << 3) | 527 | #define OMAP3430_SECURITY_VIOL_RST_MASK (1 << 3) |
| 528 | #define OMAP3430_GLOBAL_SW_RST_SHIFT 1 | ||
| 520 | #define OMAP3430_GLOBAL_SW_RST_MASK (1 << 1) | 529 | #define OMAP3430_GLOBAL_SW_RST_MASK (1 << 1) |
| 530 | #define OMAP3430_GLOBAL_COLD_RST_SHIFT 0 | ||
| 521 | #define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0) | 531 | #define OMAP3430_GLOBAL_COLD_RST_MASK (1 << 0) |
| 522 | 532 | ||
| 523 | /* PRM_VOLTCTRL */ | 533 | /* PRM_VOLTCTRL */ |
diff --git a/arch/arm/mach-omap2/prm.h b/arch/arm/mach-omap2/prm.h index 39d562169d18..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__ | ||
| 19 | extern void __iomem *prm_base; | ||
| 20 | extern void omap2_set_globals_prm(void __iomem *prm); | ||
| 21 | # endif | ||
| 22 | |||
| 23 | |||
| 24 | /* | ||
| 25 | * MAX_MODULE_SOFTRESET_WAIT: Maximum microseconds to wait for OMAP | ||
| 26 | * module to softreset | ||
| 27 | */ | ||
| 28 | #define MAX_MODULE_SOFTRESET_WAIT 10000 | ||
| 29 | |||
| 30 | /* | ||
| 31 | * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP | ||
| 32 | * submodule to exit hardreset | ||
| 33 | */ | ||
| 34 | #define MAX_MODULE_HARDRESET_WAIT 10000 | ||
| 35 | |||
| 36 | /* | ||
| 37 | * Register bitfields | ||
| 38 | */ | ||
| 39 | |||
| 18 | /* | 40 | /* |
| 19 | * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP | 41 | * 24XX: PM_PWSTST_CORE, PM_PWSTST_GFX, PM_PWSTST_MPU, PM_PWSTST_DSP |
| 20 | * | 42 | * |
| @@ -52,5 +74,58 @@ | |||
| 52 | #define OMAP_POWERSTATE_SHIFT 0 | 74 | #define OMAP_POWERSTATE_SHIFT 0 |
| 53 | #define OMAP_POWERSTATE_MASK (0x3 << 0) | 75 | #define OMAP_POWERSTATE_MASK (0x3 << 0) |
| 54 | 76 | ||
| 77 | /* | ||
| 78 | * Standardized OMAP reset source bits | ||
| 79 | * | ||
| 80 | * To the extent these happen to match the hardware register bit | ||
| 81 | * shifts, it's purely coincidental. Used by omap-wdt.c. | ||
| 82 | * OMAP_UNKNOWN_RST_SRC_ID_SHIFT is a special value, used whenever | ||
| 83 | * there are any bits remaining in the global PRM_RSTST register that | ||
| 84 | * haven't been identified, or when the PRM code for the current SoC | ||
| 85 | * doesn't know how to interpret the register. | ||
| 86 | */ | ||
| 87 | #define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT 0 | ||
| 88 | #define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT 1 | ||
| 89 | #define OMAP_SECU_VIOL_RST_SRC_ID_SHIFT 2 | ||
| 90 | #define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3 | ||
| 91 | #define OMAP_SECU_WD_RST_SRC_ID_SHIFT 4 | ||
| 92 | #define OMAP_EXTWARM_RST_SRC_ID_SHIFT 5 | ||
| 93 | #define OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT 6 | ||
| 94 | #define OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT 7 | ||
| 95 | #define OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT 8 | ||
| 96 | #define OMAP_ICEPICK_RST_SRC_ID_SHIFT 9 | ||
| 97 | #define OMAP_ICECRUSHER_RST_SRC_ID_SHIFT 10 | ||
| 98 | #define OMAP_C2C_RST_SRC_ID_SHIFT 11 | ||
| 99 | #define OMAP_UNKNOWN_RST_SRC_ID_SHIFT 12 | ||
| 100 | |||
| 101 | #ifndef __ASSEMBLER__ | ||
| 102 | |||
| 103 | /** | ||
| 104 | * struct prm_reset_src_map - map register bitshifts to standard bitshifts | ||
| 105 | * @reg_shift: bitshift in the PRM reset source register | ||
| 106 | * @std_shift: bitshift equivalent in the standard reset source list | ||
| 107 | * | ||
| 108 | * The fields are signed because -1 is used as a terminator. | ||
| 109 | */ | ||
| 110 | struct prm_reset_src_map { | ||
| 111 | s8 reg_shift; | ||
| 112 | s8 std_shift; | ||
| 113 | }; | ||
| 114 | |||
| 115 | /** | ||
| 116 | * struct prm_ll_data - fn ptrs to per-SoC PRM function implementations | ||
| 117 | * @read_reset_sources: ptr to the Soc PRM-specific get_reset_source impl | ||
| 118 | */ | ||
| 119 | struct prm_ll_data { | ||
| 120 | u32 (*read_reset_sources)(void); | ||
| 121 | }; | ||
| 122 | |||
| 123 | extern int prm_register(struct prm_ll_data *pld); | ||
| 124 | extern int prm_unregister(struct prm_ll_data *pld); | ||
| 125 | |||
| 126 | extern u32 prm_read_reset_sources(void); | ||
| 127 | |||
| 128 | #endif | ||
| 129 | |||
| 55 | 130 | ||
| 56 | #endif | 131 | #endif |
diff --git a/arch/arm/mach-omap2/prm2xxx.c b/arch/arm/mach-omap2/prm2xxx.c new file mode 100644 index 000000000000..bf24fc47603b --- /dev/null +++ b/arch/arm/mach-omap2/prm2xxx.c | |||
| @@ -0,0 +1,139 @@ | |||
| 1 | /* | ||
| 2 | * OMAP2xxx PRM module functions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010-2012 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2010 Nokia Corporation | ||
| 6 | * Benoît Cousson | ||
| 7 | * Paul Walmsley | ||
| 8 | * Rajendra Nayak <rnayak@ti.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/kernel.h> | ||
| 16 | #include <linux/errno.h> | ||
| 17 | #include <linux/err.h> | ||
| 18 | #include <linux/io.h> | ||
| 19 | #include <linux/irq.h> | ||
| 20 | |||
| 21 | #include "common.h" | ||
| 22 | #include <plat/cpu.h> | ||
| 23 | |||
| 24 | #include "vp.h" | ||
| 25 | #include "powerdomain.h" | ||
| 26 | #include "clockdomain.h" | ||
| 27 | #include "prm2xxx.h" | ||
| 28 | #include "cm2xxx_3xxx.h" | ||
| 29 | #include "prm-regbits-24xx.h" | ||
| 30 | |||
| 31 | /* | ||
| 32 | * omap2xxx_prm_reset_src_map - map from bits in the PRM_RSTST_WKUP | ||
| 33 | * hardware register (which are specific to the OMAP2xxx SoCs) to | ||
| 34 | * reset source ID bit shifts (which is an OMAP SoC-independent | ||
| 35 | * enumeration) | ||
| 36 | */ | ||
| 37 | static struct prm_reset_src_map omap2xxx_prm_reset_src_map[] = { | ||
| 38 | { OMAP_GLOBALCOLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT }, | ||
| 39 | { OMAP_GLOBALWARM_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT }, | ||
| 40 | { OMAP24XX_SECU_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT }, | ||
| 41 | { OMAP24XX_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT }, | ||
| 42 | { OMAP24XX_SECU_WD_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT }, | ||
| 43 | { OMAP24XX_EXTWMPU_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT }, | ||
| 44 | { -1, -1 }, | ||
| 45 | }; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * omap2xxx_prm_read_reset_sources - return the last SoC reset source | ||
| 49 | * | ||
| 50 | * Return a u32 representing the last reset sources of the SoC. The | ||
| 51 | * returned reset source bits are standardized across OMAP SoCs. | ||
| 52 | */ | ||
| 53 | static u32 omap2xxx_prm_read_reset_sources(void) | ||
| 54 | { | ||
| 55 | struct prm_reset_src_map *p; | ||
| 56 | u32 r = 0; | ||
| 57 | u32 v; | ||
| 58 | |||
| 59 | v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST); | ||
| 60 | |||
| 61 | p = omap2xxx_prm_reset_src_map; | ||
| 62 | while (p->reg_shift >= 0 && p->std_shift >= 0) { | ||
| 63 | if (v & (1 << p->reg_shift)) | ||
| 64 | r |= 1 << p->std_shift; | ||
| 65 | p++; | ||
| 66 | } | ||
| 67 | |||
| 68 | return r; | ||
| 69 | } | ||
| 70 | |||
| 71 | /** | ||
| 72 | * omap2xxx_prm_dpll_reset - use DPLL reset to reboot the OMAP SoC | ||
| 73 | * | ||
| 74 | * Set the DPLL reset bit, which should reboot the SoC. This is the | ||
| 75 | * recommended way to restart the SoC. No return value. | ||
| 76 | */ | ||
| 77 | void 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 | |||
| 85 | int omap2xxx_clkdm_sleep(struct clockdomain *clkdm) | ||
| 86 | { | ||
| 87 | omap2_prm_set_mod_reg_bits(OMAP24XX_FORCESTATE_MASK, | ||
| 88 | clkdm->pwrdm.ptr->prcm_offs, | ||
| 89 | OMAP2_PM_PWSTCTRL); | ||
| 90 | return 0; | ||
| 91 | } | ||
| 92 | |||
| 93 | int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm) | ||
| 94 | { | ||
| 95 | omap2_prm_clear_mod_reg_bits(OMAP24XX_FORCESTATE_MASK, | ||
| 96 | clkdm->pwrdm.ptr->prcm_offs, | ||
| 97 | OMAP2_PM_PWSTCTRL); | ||
| 98 | return 0; | ||
| 99 | } | ||
| 100 | |||
| 101 | struct pwrdm_ops omap2_pwrdm_operations = { | ||
| 102 | .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, | ||
| 103 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, | ||
| 104 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, | ||
| 105 | .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, | ||
| 106 | .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst, | ||
| 107 | .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst, | ||
| 108 | .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst, | ||
| 109 | .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst, | ||
| 110 | .pwrdm_wait_transition = omap2_pwrdm_wait_transition, | ||
| 111 | }; | ||
| 112 | |||
| 113 | /* | ||
| 114 | * | ||
| 115 | */ | ||
| 116 | |||
| 117 | static struct prm_ll_data omap2xxx_prm_ll_data = { | ||
| 118 | .read_reset_sources = &omap2xxx_prm_read_reset_sources, | ||
| 119 | }; | ||
| 120 | |||
| 121 | static int __init omap2xxx_prm_init(void) | ||
| 122 | { | ||
| 123 | if (!cpu_is_omap24xx()) | ||
| 124 | return 0; | ||
| 125 | |||
| 126 | return prm_register(&omap2xxx_prm_ll_data); | ||
| 127 | } | ||
| 128 | subsys_initcall(omap2xxx_prm_init); | ||
| 129 | |||
| 130 | static void __exit omap2xxx_prm_exit(void) | ||
| 131 | { | ||
| 132 | if (!cpu_is_omap24xx()) | ||
| 133 | return; | ||
| 134 | |||
| 135 | /* Should never happen */ | ||
| 136 | WARN(prm_unregister(&omap2xxx_prm_ll_data), | ||
| 137 | "%s: prm_ll_data function pointer mismatch\n", __func__); | ||
| 138 | } | ||
| 139 | __exitcall(omap2xxx_prm_exit); | ||
diff --git a/arch/arm/mach-omap2/prm2xxx.h b/arch/arm/mach-omap2/prm2xxx.h new file mode 100644 index 000000000000..fe8a14f190ab --- /dev/null +++ b/arch/arm/mach-omap2/prm2xxx.h | |||
| @@ -0,0 +1,134 @@ | |||
| 1 | /* | ||
| 2 | * OMAP2xxx Power/Reset Management (PRM) register definitions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2008-2010 Nokia Corporation | ||
| 6 | * Paul Walmsley | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * The PRM hardware modules on the OMAP2/3 are quite similar to each | ||
| 13 | * other. The PRM on OMAP4 has a new register layout, and is handled | ||
| 14 | * in a separate file. | ||
| 15 | */ | ||
| 16 | #ifndef __ARCH_ARM_MACH_OMAP2_PRM2XXX_H | ||
| 17 | #define __ARCH_ARM_MACH_OMAP2_PRM2XXX_H | ||
| 18 | |||
| 19 | #include "prcm-common.h" | ||
| 20 | #include "prm.h" | ||
| 21 | #include "prm2xxx_3xxx.h" | ||
| 22 | |||
| 23 | #define OMAP2420_PRM_REGADDR(module, reg) \ | ||
| 24 | OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg)) | ||
| 25 | #define OMAP2430_PRM_REGADDR(module, reg) \ | ||
| 26 | OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg)) | ||
| 27 | |||
| 28 | /* | ||
| 29 | * OMAP2-specific global PRM registers | ||
| 30 | * Use __raw_{read,write}l() with these registers. | ||
| 31 | * | ||
| 32 | * With a few exceptions, these are the register names beginning with | ||
| 33 | * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE | ||
| 34 | * bits.) | ||
| 35 | * | ||
| 36 | */ | ||
| 37 | |||
| 38 | #define OMAP2_PRCM_REVISION_OFFSET 0x0000 | ||
| 39 | #define OMAP2420_PRCM_REVISION OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000) | ||
| 40 | #define OMAP2_PRCM_SYSCONFIG_OFFSET 0x0010 | ||
| 41 | #define OMAP2420_PRCM_SYSCONFIG OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010) | ||
| 42 | |||
| 43 | #define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET 0x0018 | ||
| 44 | #define OMAP2420_PRCM_IRQSTATUS_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018) | ||
| 45 | #define OMAP2_PRCM_IRQENABLE_MPU_OFFSET 0x001c | ||
| 46 | #define OMAP2420_PRCM_IRQENABLE_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c) | ||
| 47 | |||
| 48 | #define OMAP2_PRCM_VOLTCTRL_OFFSET 0x0050 | ||
| 49 | #define OMAP2420_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050) | ||
| 50 | #define OMAP2_PRCM_VOLTST_OFFSET 0x0054 | ||
| 51 | #define OMAP2420_PRCM_VOLTST OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054) | ||
| 52 | #define OMAP2_PRCM_CLKSRC_CTRL_OFFSET 0x0060 | ||
| 53 | #define OMAP2420_PRCM_CLKSRC_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060) | ||
| 54 | #define OMAP2_PRCM_CLKOUT_CTRL_OFFSET 0x0070 | ||
| 55 | #define OMAP2420_PRCM_CLKOUT_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070) | ||
| 56 | #define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078 | ||
| 57 | #define OMAP2420_PRCM_CLKEMUL_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078) | ||
| 58 | #define OMAP2_PRCM_CLKCFG_CTRL_OFFSET 0x0080 | ||
| 59 | #define OMAP2420_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080) | ||
| 60 | #define OMAP2_PRCM_CLKCFG_STATUS_OFFSET 0x0084 | ||
| 61 | #define OMAP2420_PRCM_CLKCFG_STATUS OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084) | ||
| 62 | #define OMAP2_PRCM_VOLTSETUP_OFFSET 0x0090 | ||
| 63 | #define OMAP2420_PRCM_VOLTSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090) | ||
| 64 | #define OMAP2_PRCM_CLKSSETUP_OFFSET 0x0094 | ||
| 65 | #define OMAP2420_PRCM_CLKSSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094) | ||
| 66 | #define OMAP2_PRCM_POLCTRL_OFFSET 0x0098 | ||
| 67 | #define OMAP2420_PRCM_POLCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098) | ||
| 68 | |||
| 69 | #define OMAP2430_PRCM_REVISION OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000) | ||
| 70 | #define OMAP2430_PRCM_SYSCONFIG OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010) | ||
| 71 | |||
| 72 | #define OMAP2430_PRCM_IRQSTATUS_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018) | ||
| 73 | #define OMAP2430_PRCM_IRQENABLE_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c) | ||
| 74 | |||
| 75 | #define OMAP2430_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050) | ||
| 76 | #define OMAP2430_PRCM_VOLTST OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054) | ||
| 77 | #define OMAP2430_PRCM_CLKSRC_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060) | ||
| 78 | #define OMAP2430_PRCM_CLKOUT_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070) | ||
| 79 | #define OMAP2430_PRCM_CLKEMUL_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078) | ||
| 80 | #define OMAP2430_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080) | ||
| 81 | #define OMAP2430_PRCM_CLKCFG_STATUS OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084) | ||
| 82 | #define OMAP2430_PRCM_VOLTSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090) | ||
| 83 | #define OMAP2430_PRCM_CLKSSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094) | ||
| 84 | #define OMAP2430_PRCM_POLCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098) | ||
| 85 | |||
| 86 | /* | ||
| 87 | * Module specific PRM register offsets from PRM_BASE + domain offset | ||
| 88 | * | ||
| 89 | * Use prm_{read,write}_mod_reg() with these registers. | ||
| 90 | * | ||
| 91 | * With a few exceptions, these are the register names beginning with | ||
| 92 | * {PM,RM}_* on both OMAP2/3 SoC families.. (The exceptions are the | ||
| 93 | * IRQSTATUS and IRQENABLE bits.) | ||
| 94 | */ | ||
| 95 | |||
| 96 | /* Register offsets appearing on both OMAP2 and OMAP3 */ | ||
| 97 | |||
| 98 | #define OMAP2_RM_RSTCTRL 0x0050 | ||
| 99 | #define OMAP2_RM_RSTTIME 0x0054 | ||
| 100 | #define OMAP2_RM_RSTST 0x0058 | ||
| 101 | #define OMAP2_PM_PWSTCTRL 0x00e0 | ||
| 102 | #define OMAP2_PM_PWSTST 0x00e4 | ||
| 103 | |||
| 104 | #define PM_WKEN 0x00a0 | ||
| 105 | #define PM_WKEN1 PM_WKEN | ||
| 106 | #define PM_WKST 0x00b0 | ||
| 107 | #define PM_WKST1 PM_WKST | ||
| 108 | #define PM_WKDEP 0x00c8 | ||
| 109 | #define PM_EVGENCTRL 0x00d4 | ||
| 110 | #define PM_EVGENONTIM 0x00d8 | ||
| 111 | #define PM_EVGENOFFTIM 0x00dc | ||
| 112 | |||
| 113 | /* OMAP2xxx specific register offsets */ | ||
| 114 | #define OMAP24XX_PM_WKEN2 0x00a4 | ||
| 115 | #define OMAP24XX_PM_WKST2 0x00b4 | ||
| 116 | |||
| 117 | #define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */ | ||
| 118 | #define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */ | ||
| 119 | #define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8 | ||
| 120 | #define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc | ||
| 121 | |||
| 122 | #ifndef __ASSEMBLER__ | ||
| 123 | /* Function prototypes */ | ||
| 124 | extern int omap2xxx_clkdm_sleep(struct clockdomain *clkdm); | ||
| 125 | extern int omap2xxx_clkdm_wakeup(struct clockdomain *clkdm); | ||
| 126 | |||
| 127 | extern void omap2xxx_prm_dpll_reset(void); | ||
| 128 | |||
| 129 | extern int __init prm2xxx_init(void); | ||
| 130 | extern int __exit prm2xxx_exit(void); | ||
| 131 | |||
| 132 | #endif | ||
| 133 | |||
| 134 | #endif | ||
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.c b/arch/arm/mach-omap2/prm2xxx_3xxx.c index 9529984d8d2b..30517f5af707 100644 --- a/arch/arm/mach-omap2/prm2xxx_3xxx.c +++ b/arch/arm/mach-omap2/prm2xxx_3xxx.c | |||
| @@ -15,82 +15,12 @@ | |||
| 15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
| 16 | #include <linux/err.h> | 16 | #include <linux/err.h> |
| 17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
| 18 | #include <linux/irq.h> | ||
| 19 | 18 | ||
| 20 | #include <plat/prcm.h> | ||
| 21 | |||
| 22 | #include "soc.h" | ||
| 23 | #include "common.h" | 19 | #include "common.h" |
| 24 | #include "vp.h" | 20 | #include "powerdomain.h" |
| 25 | |||
| 26 | #include "prm2xxx_3xxx.h" | 21 | #include "prm2xxx_3xxx.h" |
| 27 | #include "cm2xxx_3xxx.h" | ||
| 28 | #include "prm-regbits-24xx.h" | 22 | #include "prm-regbits-24xx.h" |
| 29 | #include "prm-regbits-34xx.h" | 23 | #include "clockdomain.h" |
| 30 | |||
| 31 | static const struct omap_prcm_irq omap3_prcm_irqs[] = { | ||
| 32 | OMAP_PRCM_IRQ("wkup", 0, 0), | ||
| 33 | OMAP_PRCM_IRQ("io", 9, 1), | ||
| 34 | }; | ||
| 35 | |||
| 36 | static struct omap_prcm_irq_setup omap3_prcm_irq_setup = { | ||
| 37 | .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET, | ||
| 38 | .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET, | ||
| 39 | .nr_regs = 1, | ||
| 40 | .irqs = omap3_prcm_irqs, | ||
| 41 | .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs), | ||
| 42 | .irq = 11 + OMAP_INTC_START, | ||
| 43 | .read_pending_irqs = &omap3xxx_prm_read_pending_irqs, | ||
| 44 | .ocp_barrier = &omap3xxx_prm_ocp_barrier, | ||
| 45 | .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, | ||
| 46 | .restore_irqen = &omap3xxx_prm_restore_irqen, | ||
| 47 | }; | ||
| 48 | |||
| 49 | u32 omap2_prm_read_mod_reg(s16 module, u16 idx) | ||
| 50 | { | ||
| 51 | return __raw_readl(prm_base + module + idx); | ||
| 52 | } | ||
| 53 | |||
| 54 | void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) | ||
| 55 | { | ||
| 56 | __raw_writel(val, prm_base + module + idx); | ||
| 57 | } | ||
| 58 | |||
| 59 | /* Read-modify-write a register in a PRM module. Caller must lock */ | ||
| 60 | u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx) | ||
| 61 | { | ||
| 62 | u32 v; | ||
| 63 | |||
| 64 | v = omap2_prm_read_mod_reg(module, idx); | ||
| 65 | v &= ~mask; | ||
| 66 | v |= bits; | ||
| 67 | omap2_prm_write_mod_reg(v, module, idx); | ||
| 68 | |||
| 69 | return v; | ||
| 70 | } | ||
| 71 | |||
| 72 | /* Read a PRM register, AND it, and shift the result down to bit 0 */ | ||
| 73 | u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) | ||
| 74 | { | ||
| 75 | u32 v; | ||
| 76 | |||
| 77 | v = omap2_prm_read_mod_reg(domain, idx); | ||
| 78 | v &= mask; | ||
| 79 | v >>= __ffs(mask); | ||
| 80 | |||
| 81 | return v; | ||
| 82 | } | ||
| 83 | |||
| 84 | u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) | ||
| 85 | { | ||
| 86 | return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx); | ||
| 87 | } | ||
| 88 | |||
| 89 | u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) | ||
| 90 | { | ||
| 91 | return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx); | ||
| 92 | } | ||
| 93 | |||
| 94 | 24 | ||
| 95 | /** | 25 | /** |
| 96 | * omap2_prm_is_hardreset_asserted - read the HW reset line state of | 26 | * omap2_prm_is_hardreset_asserted - read the HW reset line state of |
| @@ -104,9 +34,6 @@ u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) | |||
| 104 | */ | 34 | */ |
| 105 | int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) | 35 | int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) |
| 106 | { | 36 | { |
| 107 | if (!(cpu_is_omap24xx() || cpu_is_omap34xx())) | ||
| 108 | return -EINVAL; | ||
| 109 | |||
| 110 | return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, | 37 | return omap2_prm_read_mod_bits_shift(prm_mod, OMAP2_RM_RSTCTRL, |
| 111 | (1 << shift)); | 38 | (1 << shift)); |
| 112 | } | 39 | } |
| @@ -127,9 +54,6 @@ int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift) | |||
| 127 | { | 54 | { |
| 128 | u32 mask; | 55 | u32 mask; |
| 129 | 56 | ||
| 130 | if (!(cpu_is_omap24xx() || cpu_is_omap34xx())) | ||
| 131 | return -EINVAL; | ||
| 132 | |||
| 133 | mask = 1 << shift; | 57 | mask = 1 << shift; |
| 134 | omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL); | 58 | omap2_prm_rmw_mod_reg_bits(mask, mask, prm_mod, OMAP2_RM_RSTCTRL); |
| 135 | 59 | ||
| @@ -156,9 +80,6 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift) | |||
| 156 | u32 rst, st; | 80 | u32 rst, st; |
| 157 | int c; | 81 | int c; |
| 158 | 82 | ||
| 159 | if (!(cpu_is_omap24xx() || cpu_is_omap34xx())) | ||
| 160 | return -EINVAL; | ||
| 161 | |||
| 162 | rst = 1 << rst_shift; | 83 | rst = 1 << rst_shift; |
| 163 | st = 1 << st_shift; | 84 | st = 1 << st_shift; |
| 164 | 85 | ||
| @@ -178,188 +99,155 @@ int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift) | |||
| 178 | return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; | 99 | return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; |
| 179 | } | 100 | } |
| 180 | 101 | ||
| 181 | /* PRM VP */ | ||
| 182 | |||
| 183 | /* | ||
| 184 | * struct omap3_vp - OMAP3 VP register access description. | ||
| 185 | * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg | ||
| 186 | */ | ||
| 187 | struct omap3_vp { | ||
| 188 | u32 tranxdone_status; | ||
| 189 | }; | ||
| 190 | |||
| 191 | static struct omap3_vp omap3_vp[] = { | ||
| 192 | [OMAP3_VP_VDD_MPU_ID] = { | ||
| 193 | .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK, | ||
| 194 | }, | ||
| 195 | [OMAP3_VP_VDD_CORE_ID] = { | ||
| 196 | .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK, | ||
| 197 | }, | ||
| 198 | }; | ||
| 199 | |||
| 200 | #define MAX_VP_ID ARRAY_SIZE(omap3_vp); | ||
| 201 | |||
| 202 | u32 omap3_prm_vp_check_txdone(u8 vp_id) | ||
| 203 | { | ||
| 204 | struct omap3_vp *vp = &omap3_vp[vp_id]; | ||
| 205 | u32 irqstatus; | ||
| 206 | 102 | ||
| 207 | irqstatus = omap2_prm_read_mod_reg(OCP_MOD, | 103 | /* Powerdomain low-level functions */ |
| 208 | OMAP3_PRM_IRQSTATUS_MPU_OFFSET); | ||
| 209 | return irqstatus & vp->tranxdone_status; | ||
| 210 | } | ||
| 211 | 104 | ||
| 212 | void omap3_prm_vp_clear_txdone(u8 vp_id) | 105 | /* Common functions across OMAP2 and OMAP3 */ |
| 106 | int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 213 | { | 107 | { |
| 214 | struct omap3_vp *vp = &omap3_vp[vp_id]; | 108 | omap2_prm_rmw_mod_reg_bits(OMAP_POWERSTATE_MASK, |
| 215 | 109 | (pwrst << OMAP_POWERSTATE_SHIFT), | |
| 216 | omap2_prm_write_mod_reg(vp->tranxdone_status, | 110 | pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); |
| 217 | OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); | 111 | return 0; |
| 218 | } | 112 | } |
| 219 | 113 | ||
| 220 | u32 omap3_prm_vcvp_read(u8 offset) | 114 | int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) |
| 221 | { | 115 | { |
| 222 | return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset); | 116 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, |
| 117 | OMAP2_PM_PWSTCTRL, | ||
| 118 | OMAP_POWERSTATE_MASK); | ||
| 223 | } | 119 | } |
| 224 | 120 | ||
| 225 | void omap3_prm_vcvp_write(u32 val, u8 offset) | 121 | int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm) |
| 226 | { | 122 | { |
| 227 | omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset); | 123 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, |
| 124 | OMAP2_PM_PWSTST, | ||
| 125 | OMAP_POWERSTATEST_MASK); | ||
| 228 | } | 126 | } |
| 229 | 127 | ||
| 230 | u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset) | 128 | int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, |
| 129 | u8 pwrst) | ||
| 231 | { | 130 | { |
| 232 | return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset); | 131 | u32 m; |
| 132 | |||
| 133 | m = omap2_pwrdm_get_mem_bank_onstate_mask(bank); | ||
| 134 | |||
| 135 | omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs, | ||
| 136 | OMAP2_PM_PWSTCTRL); | ||
| 137 | |||
| 138 | return 0; | ||
| 233 | } | 139 | } |
| 234 | 140 | ||
| 235 | /** | 141 | int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, |
| 236 | * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events | 142 | u8 pwrst) |
| 237 | * @events: ptr to a u32, preallocated by caller | ||
| 238 | * | ||
| 239 | * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM | ||
| 240 | * MPU IRQs, and store the result into the u32 pointed to by @events. | ||
| 241 | * No return value. | ||
| 242 | */ | ||
| 243 | void omap3xxx_prm_read_pending_irqs(unsigned long *events) | ||
| 244 | { | 143 | { |
| 245 | u32 mask, st; | 144 | u32 m; |
| 145 | |||
| 146 | m = omap2_pwrdm_get_mem_bank_retst_mask(bank); | ||
| 246 | 147 | ||
| 247 | /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */ | 148 | omap2_prm_rmw_mod_reg_bits(m, (pwrst << __ffs(m)), pwrdm->prcm_offs, |
| 248 | mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); | 149 | OMAP2_PM_PWSTCTRL); |
| 249 | st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); | ||
| 250 | 150 | ||
| 251 | events[0] = mask & st; | 151 | return 0; |
| 252 | } | 152 | } |
| 253 | 153 | ||
| 254 | /** | 154 | int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) |
| 255 | * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete | ||
| 256 | * | ||
| 257 | * Force any buffered writes to the PRM IP block to complete. Needed | ||
| 258 | * by the PRM IRQ handler, which reads and writes directly to the IP | ||
| 259 | * block, to avoid race conditions after acknowledging or clearing IRQ | ||
| 260 | * bits. No return value. | ||
| 261 | */ | ||
| 262 | void omap3xxx_prm_ocp_barrier(void) | ||
| 263 | { | 155 | { |
| 264 | omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); | 156 | u32 m; |
| 157 | |||
| 158 | m = omap2_pwrdm_get_mem_bank_stst_mask(bank); | ||
| 159 | |||
| 160 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, OMAP2_PM_PWSTST, | ||
| 161 | m); | ||
| 265 | } | 162 | } |
| 266 | 163 | ||
| 267 | /** | 164 | int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank) |
| 268 | * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg | ||
| 269 | * @saved_mask: ptr to a u32 array to save IRQENABLE bits | ||
| 270 | * | ||
| 271 | * Save the PRM_IRQENABLE_MPU register to @saved_mask. @saved_mask | ||
| 272 | * must be allocated by the caller. Intended to be used in the PRM | ||
| 273 | * interrupt handler suspend callback. The OCP barrier is needed to | ||
| 274 | * ensure the write to disable PRM interrupts reaches the PRM before | ||
| 275 | * returning; otherwise, spurious interrupts might occur. No return | ||
| 276 | * value. | ||
| 277 | */ | ||
| 278 | void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask) | ||
| 279 | { | 165 | { |
| 280 | saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD, | 166 | u32 m; |
| 281 | OMAP3_PRM_IRQENABLE_MPU_OFFSET); | 167 | |
| 282 | omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); | 168 | m = omap2_pwrdm_get_mem_bank_retst_mask(bank); |
| 283 | 169 | ||
| 284 | /* OCP barrier */ | 170 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, |
| 285 | omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); | 171 | OMAP2_PM_PWSTCTRL, m); |
| 286 | } | 172 | } |
| 287 | 173 | ||
| 288 | /** | 174 | int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) |
| 289 | * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args | ||
| 290 | * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously | ||
| 291 | * | ||
| 292 | * Restore the PRM_IRQENABLE_MPU register from @saved_mask. Intended | ||
| 293 | * to be used in the PRM interrupt handler resume callback to restore | ||
| 294 | * values saved by omap3xxx_prm_save_and_clear_irqen(). No OCP | ||
| 295 | * barrier should be needed here; any pending PRM interrupts will fire | ||
| 296 | * once the writes reach the PRM. No return value. | ||
| 297 | */ | ||
| 298 | void omap3xxx_prm_restore_irqen(u32 *saved_mask) | ||
| 299 | { | 175 | { |
| 300 | omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD, | 176 | u32 v; |
| 301 | OMAP3_PRM_IRQENABLE_MPU_OFFSET); | 177 | |
| 178 | v = pwrst << __ffs(OMAP_LOGICRETSTATE_MASK); | ||
| 179 | omap2_prm_rmw_mod_reg_bits(OMAP_LOGICRETSTATE_MASK, v, pwrdm->prcm_offs, | ||
| 180 | OMAP2_PM_PWSTCTRL); | ||
| 181 | |||
| 182 | return 0; | ||
| 302 | } | 183 | } |
| 303 | 184 | ||
| 304 | /** | 185 | int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm) |
| 305 | * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain | ||
| 306 | * | ||
| 307 | * Clear any previously-latched I/O wakeup events and ensure that the | ||
| 308 | * I/O wakeup gates are aligned with the current mux settings. Works | ||
| 309 | * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then | ||
| 310 | * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No | ||
| 311 | * return value. | ||
| 312 | */ | ||
| 313 | void omap3xxx_prm_reconfigure_io_chain(void) | ||
| 314 | { | 186 | { |
| 315 | int i = 0; | 187 | u32 c = 0; |
| 316 | 188 | ||
| 317 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, | 189 | /* |
| 318 | PM_WKEN); | 190 | * REVISIT: pwrdm_wait_transition() may be better implemented |
| 191 | * via a callback and a periodic timer check -- how long do we expect | ||
| 192 | * powerdomain transitions to take? | ||
| 193 | */ | ||
| 319 | 194 | ||
| 320 | omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) & | 195 | /* XXX Is this udelay() value meaningful? */ |
| 321 | OMAP3430_ST_IO_CHAIN_MASK, | 196 | while ((omap2_prm_read_mod_reg(pwrdm->prcm_offs, OMAP2_PM_PWSTST) & |
| 322 | MAX_IOPAD_LATCH_TIME, i); | 197 | OMAP_INTRANSITION_MASK) && |
| 323 | if (i == MAX_IOPAD_LATCH_TIME) | 198 | (c++ < PWRDM_TRANSITION_BAILOUT)) |
| 324 | pr_warn("PRM: I/O chain clock line assertion timed out\n"); | 199 | udelay(1); |
| 325 | 200 | ||
| 326 | omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, | 201 | if (c > PWRDM_TRANSITION_BAILOUT) { |
| 327 | PM_WKEN); | 202 | pr_err("powerdomain: %s: waited too long to complete transition\n", |
| 203 | pwrdm->name); | ||
| 204 | return -EAGAIN; | ||
| 205 | } | ||
| 328 | 206 | ||
| 329 | omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD, | 207 | pr_debug("powerdomain: completed transition in %d loops\n", c); |
| 330 | PM_WKST); | ||
| 331 | 208 | ||
| 332 | omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST); | 209 | return 0; |
| 333 | } | 210 | } |
| 334 | 211 | ||
| 335 | /** | 212 | int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1, |
| 336 | * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches | 213 | struct clockdomain *clkdm2) |
| 337 | * | 214 | { |
| 338 | * Activates the I/O wakeup event latches and allows events logged by | 215 | omap2_prm_set_mod_reg_bits((1 << clkdm2->dep_bit), |
| 339 | * those latches to signal a wakeup event to the PRCM. For I/O | 216 | clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP); |
| 340 | * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux | 217 | return 0; |
| 341 | * registers, and omap3xxx_prm_reconfigure_io_chain() must be called. | 218 | } |
| 342 | * No return value. | 219 | |
| 343 | */ | 220 | int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1, |
| 344 | static void __init omap3xxx_prm_enable_io_wakeup(void) | 221 | struct clockdomain *clkdm2) |
| 222 | { | ||
| 223 | omap2_prm_clear_mod_reg_bits((1 << clkdm2->dep_bit), | ||
| 224 | clkdm1->pwrdm.ptr->prcm_offs, PM_WKDEP); | ||
| 225 | return 0; | ||
| 226 | } | ||
| 227 | |||
| 228 | int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1, | ||
| 229 | struct clockdomain *clkdm2) | ||
| 345 | { | 230 | { |
| 346 | if (omap3_has_io_wakeup()) | 231 | return omap2_prm_read_mod_bits_shift(clkdm1->pwrdm.ptr->prcm_offs, |
| 347 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, | 232 | PM_WKDEP, (1 << clkdm2->dep_bit)); |
| 348 | PM_WKEN); | ||
| 349 | } | 233 | } |
| 350 | 234 | ||
| 351 | static int __init omap3xxx_prcm_init(void) | 235 | int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm) |
| 352 | { | 236 | { |
| 353 | int ret = 0; | 237 | struct clkdm_dep *cd; |
| 354 | 238 | u32 mask = 0; | |
| 355 | if (cpu_is_omap34xx()) { | 239 | |
| 356 | omap3xxx_prm_enable_io_wakeup(); | 240 | for (cd = clkdm->wkdep_srcs; cd && cd->clkdm_name; cd++) { |
| 357 | ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); | 241 | if (!cd->clkdm) |
| 358 | if (!ret) | 242 | continue; /* only happens if data is erroneous */ |
| 359 | irq_set_status_flags(omap_prcm_event_to_irq("io"), | 243 | |
| 360 | IRQ_NOAUTOEN); | 244 | /* PRM accesses are slow, so minimize them */ |
| 245 | mask |= 1 << cd->clkdm->dep_bit; | ||
| 246 | atomic_set(&cd->wkdep_usecount, 0); | ||
| 361 | } | 247 | } |
| 362 | 248 | ||
| 363 | return ret; | 249 | omap2_prm_clear_mod_reg_bits(mask, clkdm->pwrdm.ptr->prcm_offs, |
| 250 | PM_WKDEP); | ||
| 251 | return 0; | ||
| 364 | } | 252 | } |
| 365 | subsys_initcall(omap3xxx_prcm_init); | 253 | |
diff --git a/arch/arm/mach-omap2/prm2xxx_3xxx.h b/arch/arm/mach-omap2/prm2xxx_3xxx.h index c19d249b4816..78532d6fecd7 100644 --- a/arch/arm/mach-omap2/prm2xxx_3xxx.h +++ b/arch/arm/mach-omap2/prm2xxx_3xxx.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * OMAP2/3 Power/Reset Management (PRM) register definitions | 2 | * OMAP2xxx/3xxx-common Power/Reset Management (PRM) register definitions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007-2009, 2011 Texas Instruments, Inc. | 4 | * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc. |
| 5 | * Copyright (C) 2008-2010 Nokia Corporation | 5 | * Copyright (C) 2008-2010 Nokia Corporation |
| 6 | * Paul Walmsley | 6 | * Paul Walmsley |
| 7 | * | 7 | * |
| @@ -19,160 +19,6 @@ | |||
| 19 | #include "prcm-common.h" | 19 | #include "prcm-common.h" |
| 20 | #include "prm.h" | 20 | #include "prm.h" |
| 21 | 21 | ||
| 22 | #define OMAP2420_PRM_REGADDR(module, reg) \ | ||
| 23 | OMAP2_L4_IO_ADDRESS(OMAP2420_PRM_BASE + (module) + (reg)) | ||
| 24 | #define OMAP2430_PRM_REGADDR(module, reg) \ | ||
| 25 | OMAP2_L4_IO_ADDRESS(OMAP2430_PRM_BASE + (module) + (reg)) | ||
| 26 | #define OMAP34XX_PRM_REGADDR(module, reg) \ | ||
| 27 | OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg)) | ||
| 28 | |||
| 29 | |||
| 30 | /* | ||
| 31 | * OMAP2-specific global PRM registers | ||
| 32 | * Use __raw_{read,write}l() with these registers. | ||
| 33 | * | ||
| 34 | * With a few exceptions, these are the register names beginning with | ||
| 35 | * PRCM_* on 24xx. (The exceptions are the IRQSTATUS and IRQENABLE | ||
| 36 | * bits.) | ||
| 37 | * | ||
| 38 | */ | ||
| 39 | |||
| 40 | #define OMAP2_PRCM_REVISION_OFFSET 0x0000 | ||
| 41 | #define OMAP2420_PRCM_REVISION OMAP2420_PRM_REGADDR(OCP_MOD, 0x0000) | ||
| 42 | #define OMAP2_PRCM_SYSCONFIG_OFFSET 0x0010 | ||
| 43 | #define OMAP2420_PRCM_SYSCONFIG OMAP2420_PRM_REGADDR(OCP_MOD, 0x0010) | ||
| 44 | |||
| 45 | #define OMAP2_PRCM_IRQSTATUS_MPU_OFFSET 0x0018 | ||
| 46 | #define OMAP2420_PRCM_IRQSTATUS_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x0018) | ||
| 47 | #define OMAP2_PRCM_IRQENABLE_MPU_OFFSET 0x001c | ||
| 48 | #define OMAP2420_PRCM_IRQENABLE_MPU OMAP2420_PRM_REGADDR(OCP_MOD, 0x001c) | ||
| 49 | |||
| 50 | #define OMAP2_PRCM_VOLTCTRL_OFFSET 0x0050 | ||
| 51 | #define OMAP2420_PRCM_VOLTCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0050) | ||
| 52 | #define OMAP2_PRCM_VOLTST_OFFSET 0x0054 | ||
| 53 | #define OMAP2420_PRCM_VOLTST OMAP2420_PRM_REGADDR(OCP_MOD, 0x0054) | ||
| 54 | #define OMAP2_PRCM_CLKSRC_CTRL_OFFSET 0x0060 | ||
| 55 | #define OMAP2420_PRCM_CLKSRC_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0060) | ||
| 56 | #define OMAP2_PRCM_CLKOUT_CTRL_OFFSET 0x0070 | ||
| 57 | #define OMAP2420_PRCM_CLKOUT_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0070) | ||
| 58 | #define OMAP2_PRCM_CLKEMUL_CTRL_OFFSET 0x0078 | ||
| 59 | #define OMAP2420_PRCM_CLKEMUL_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0078) | ||
| 60 | #define OMAP2_PRCM_CLKCFG_CTRL_OFFSET 0x0080 | ||
| 61 | #define OMAP2420_PRCM_CLKCFG_CTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0080) | ||
| 62 | #define OMAP2_PRCM_CLKCFG_STATUS_OFFSET 0x0084 | ||
| 63 | #define OMAP2420_PRCM_CLKCFG_STATUS OMAP2420_PRM_REGADDR(OCP_MOD, 0x0084) | ||
| 64 | #define OMAP2_PRCM_VOLTSETUP_OFFSET 0x0090 | ||
| 65 | #define OMAP2420_PRCM_VOLTSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0090) | ||
| 66 | #define OMAP2_PRCM_CLKSSETUP_OFFSET 0x0094 | ||
| 67 | #define OMAP2420_PRCM_CLKSSETUP OMAP2420_PRM_REGADDR(OCP_MOD, 0x0094) | ||
| 68 | #define OMAP2_PRCM_POLCTRL_OFFSET 0x0098 | ||
| 69 | #define OMAP2420_PRCM_POLCTRL OMAP2420_PRM_REGADDR(OCP_MOD, 0x0098) | ||
| 70 | |||
| 71 | #define OMAP2430_PRCM_REVISION OMAP2430_PRM_REGADDR(OCP_MOD, 0x0000) | ||
| 72 | #define OMAP2430_PRCM_SYSCONFIG OMAP2430_PRM_REGADDR(OCP_MOD, 0x0010) | ||
| 73 | |||
| 74 | #define OMAP2430_PRCM_IRQSTATUS_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x0018) | ||
| 75 | #define OMAP2430_PRCM_IRQENABLE_MPU OMAP2430_PRM_REGADDR(OCP_MOD, 0x001c) | ||
| 76 | |||
| 77 | #define OMAP2430_PRCM_VOLTCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0050) | ||
| 78 | #define OMAP2430_PRCM_VOLTST OMAP2430_PRM_REGADDR(OCP_MOD, 0x0054) | ||
| 79 | #define OMAP2430_PRCM_CLKSRC_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0060) | ||
| 80 | #define OMAP2430_PRCM_CLKOUT_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0070) | ||
| 81 | #define OMAP2430_PRCM_CLKEMUL_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0078) | ||
| 82 | #define OMAP2430_PRCM_CLKCFG_CTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0080) | ||
| 83 | #define OMAP2430_PRCM_CLKCFG_STATUS OMAP2430_PRM_REGADDR(OCP_MOD, 0x0084) | ||
| 84 | #define OMAP2430_PRCM_VOLTSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0090) | ||
| 85 | #define OMAP2430_PRCM_CLKSSETUP OMAP2430_PRM_REGADDR(OCP_MOD, 0x0094) | ||
| 86 | #define OMAP2430_PRCM_POLCTRL OMAP2430_PRM_REGADDR(OCP_MOD, 0x0098) | ||
| 87 | |||
| 88 | /* | ||
| 89 | * OMAP3-specific global PRM registers | ||
| 90 | * Use __raw_{read,write}l() with these registers. | ||
| 91 | * | ||
| 92 | * With a few exceptions, these are the register names beginning with | ||
| 93 | * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE | ||
| 94 | * bits.) | ||
| 95 | */ | ||
| 96 | |||
| 97 | #define OMAP3_PRM_REVISION_OFFSET 0x0004 | ||
| 98 | #define OMAP3430_PRM_REVISION OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004) | ||
| 99 | #define OMAP3_PRM_SYSCONFIG_OFFSET 0x0014 | ||
| 100 | #define OMAP3430_PRM_SYSCONFIG OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014) | ||
| 101 | |||
| 102 | #define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018 | ||
| 103 | #define OMAP3430_PRM_IRQSTATUS_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018) | ||
| 104 | #define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c | ||
| 105 | #define OMAP3430_PRM_IRQENABLE_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c) | ||
| 106 | |||
| 107 | |||
| 108 | #define OMAP3_PRM_VC_SMPS_SA_OFFSET 0x0020 | ||
| 109 | #define OMAP3430_PRM_VC_SMPS_SA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020) | ||
| 110 | #define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET 0x0024 | ||
| 111 | #define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024) | ||
| 112 | #define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET 0x0028 | ||
| 113 | #define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028) | ||
| 114 | #define OMAP3_PRM_VC_CMD_VAL_0_OFFSET 0x002c | ||
| 115 | #define OMAP3430_PRM_VC_CMD_VAL_0 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c) | ||
| 116 | #define OMAP3_PRM_VC_CMD_VAL_1_OFFSET 0x0030 | ||
| 117 | #define OMAP3430_PRM_VC_CMD_VAL_1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030) | ||
| 118 | #define OMAP3_PRM_VC_CH_CONF_OFFSET 0x0034 | ||
| 119 | #define OMAP3430_PRM_VC_CH_CONF OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034) | ||
| 120 | #define OMAP3_PRM_VC_I2C_CFG_OFFSET 0x0038 | ||
| 121 | #define OMAP3430_PRM_VC_I2C_CFG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038) | ||
| 122 | #define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c | ||
| 123 | #define OMAP3430_PRM_VC_BYPASS_VAL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c) | ||
| 124 | #define OMAP3_PRM_RSTCTRL_OFFSET 0x0050 | ||
| 125 | #define OMAP3430_PRM_RSTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050) | ||
| 126 | #define OMAP3_PRM_RSTTIME_OFFSET 0x0054 | ||
| 127 | #define OMAP3430_PRM_RSTTIME OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054) | ||
| 128 | #define OMAP3_PRM_RSTST_OFFSET 0x0058 | ||
| 129 | #define OMAP3430_PRM_RSTST OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058) | ||
| 130 | #define OMAP3_PRM_VOLTCTRL_OFFSET 0x0060 | ||
| 131 | #define OMAP3430_PRM_VOLTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060) | ||
| 132 | #define OMAP3_PRM_SRAM_PCHARGE_OFFSET 0x0064 | ||
| 133 | #define OMAP3430_PRM_SRAM_PCHARGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064) | ||
| 134 | #define OMAP3_PRM_CLKSRC_CTRL_OFFSET 0x0070 | ||
| 135 | #define OMAP3430_PRM_CLKSRC_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070) | ||
| 136 | #define OMAP3_PRM_VOLTSETUP1_OFFSET 0x0090 | ||
| 137 | #define OMAP3430_PRM_VOLTSETUP1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090) | ||
| 138 | #define OMAP3_PRM_VOLTOFFSET_OFFSET 0x0094 | ||
| 139 | #define OMAP3430_PRM_VOLTOFFSET OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094) | ||
| 140 | #define OMAP3_PRM_CLKSETUP_OFFSET 0x0098 | ||
| 141 | #define OMAP3430_PRM_CLKSETUP OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098) | ||
| 142 | #define OMAP3_PRM_POLCTRL_OFFSET 0x009c | ||
| 143 | #define OMAP3430_PRM_POLCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c) | ||
| 144 | #define OMAP3_PRM_VOLTSETUP2_OFFSET 0x00a0 | ||
| 145 | #define OMAP3430_PRM_VOLTSETUP2 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0) | ||
| 146 | #define OMAP3_PRM_VP1_CONFIG_OFFSET 0x00b0 | ||
| 147 | #define OMAP3430_PRM_VP1_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0) | ||
| 148 | #define OMAP3_PRM_VP1_VSTEPMIN_OFFSET 0x00b4 | ||
| 149 | #define OMAP3430_PRM_VP1_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4) | ||
| 150 | #define OMAP3_PRM_VP1_VSTEPMAX_OFFSET 0x00b8 | ||
| 151 | #define OMAP3430_PRM_VP1_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8) | ||
| 152 | #define OMAP3_PRM_VP1_VLIMITTO_OFFSET 0x00bc | ||
| 153 | #define OMAP3430_PRM_VP1_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc) | ||
| 154 | #define OMAP3_PRM_VP1_VOLTAGE_OFFSET 0x00c0 | ||
| 155 | #define OMAP3430_PRM_VP1_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0) | ||
| 156 | #define OMAP3_PRM_VP1_STATUS_OFFSET 0x00c4 | ||
| 157 | #define OMAP3430_PRM_VP1_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4) | ||
| 158 | #define OMAP3_PRM_VP2_CONFIG_OFFSET 0x00d0 | ||
| 159 | #define OMAP3430_PRM_VP2_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0) | ||
| 160 | #define OMAP3_PRM_VP2_VSTEPMIN_OFFSET 0x00d4 | ||
| 161 | #define OMAP3430_PRM_VP2_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4) | ||
| 162 | #define OMAP3_PRM_VP2_VSTEPMAX_OFFSET 0x00d8 | ||
| 163 | #define OMAP3430_PRM_VP2_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8) | ||
| 164 | #define OMAP3_PRM_VP2_VLIMITTO_OFFSET 0x00dc | ||
| 165 | #define OMAP3430_PRM_VP2_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc) | ||
| 166 | #define OMAP3_PRM_VP2_VOLTAGE_OFFSET 0x00e0 | ||
| 167 | #define OMAP3430_PRM_VP2_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0) | ||
| 168 | #define OMAP3_PRM_VP2_STATUS_OFFSET 0x00e4 | ||
| 169 | #define OMAP3430_PRM_VP2_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4) | ||
| 170 | |||
| 171 | #define OMAP3_PRM_CLKSEL_OFFSET 0x0040 | ||
| 172 | #define OMAP3430_PRM_CLKSEL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040) | ||
| 173 | #define OMAP3_PRM_CLKOUT_CTRL_OFFSET 0x0070 | ||
| 174 | #define OMAP3430_PRM_CLKOUT_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070) | ||
| 175 | |||
| 176 | /* | 22 | /* |
| 177 | * Module specific PRM register offsets from PRM_BASE + domain offset | 23 | * Module specific PRM register offsets from PRM_BASE + domain offset |
| 178 | * | 24 | * |
| @@ -200,66 +46,83 @@ | |||
| 200 | #define PM_EVGENONTIM 0x00d8 | 46 | #define PM_EVGENONTIM 0x00d8 |
| 201 | #define PM_EVGENOFFTIM 0x00dc | 47 | #define PM_EVGENOFFTIM 0x00dc |
| 202 | 48 | ||
| 203 | /* OMAP2xxx specific register offsets */ | ||
| 204 | #define OMAP24XX_PM_WKEN2 0x00a4 | ||
| 205 | #define OMAP24XX_PM_WKST2 0x00b4 | ||
| 206 | |||
| 207 | #define OMAP24XX_PRCM_IRQSTATUS_DSP 0x00f0 /* IVA mod */ | ||
| 208 | #define OMAP24XX_PRCM_IRQENABLE_DSP 0x00f4 /* IVA mod */ | ||
| 209 | #define OMAP24XX_PRCM_IRQSTATUS_IVA 0x00f8 | ||
| 210 | #define OMAP24XX_PRCM_IRQENABLE_IVA 0x00fc | ||
| 211 | 49 | ||
| 212 | /* OMAP3 specific register offsets */ | 50 | #ifndef __ASSEMBLER__ |
| 213 | #define OMAP3430ES2_PM_WKEN3 0x00f0 | ||
| 214 | #define OMAP3430ES2_PM_WKST3 0x00b8 | ||
| 215 | |||
| 216 | #define OMAP3430_PM_MPUGRPSEL 0x00a4 | ||
| 217 | #define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL | ||
| 218 | #define OMAP3430ES2_PM_MPUGRPSEL3 0x00f8 | ||
| 219 | |||
| 220 | #define OMAP3430_PM_IVAGRPSEL 0x00a8 | ||
| 221 | #define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL | ||
| 222 | #define OMAP3430ES2_PM_IVAGRPSEL3 0x00f4 | ||
| 223 | |||
| 224 | #define OMAP3430_PM_PREPWSTST 0x00e8 | ||
| 225 | |||
| 226 | #define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8 | ||
| 227 | #define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc | ||
| 228 | 51 | ||
| 52 | #include <linux/io.h> | ||
| 53 | #include "powerdomain.h" | ||
| 229 | 54 | ||
| 230 | #ifndef __ASSEMBLER__ | ||
| 231 | /* Power/reset management domain register get/set */ | 55 | /* Power/reset management domain register get/set */ |
| 232 | extern u32 omap2_prm_read_mod_reg(s16 module, u16 idx); | 56 | static inline u32 omap2_prm_read_mod_reg(s16 module, u16 idx) |
| 233 | extern void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx); | 57 | { |
| 234 | extern u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx); | 58 | return __raw_readl(prm_base + module + idx); |
| 235 | extern u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx); | 59 | } |
| 236 | extern u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx); | 60 | |
| 237 | extern u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask); | 61 | static inline void omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) |
| 62 | { | ||
| 63 | __raw_writel(val, prm_base + module + idx); | ||
| 64 | } | ||
| 65 | |||
| 66 | /* Read-modify-write a register in a PRM module. Caller must lock */ | ||
| 67 | static inline u32 omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, | ||
| 68 | s16 idx) | ||
| 69 | { | ||
| 70 | u32 v; | ||
| 71 | |||
| 72 | v = omap2_prm_read_mod_reg(module, idx); | ||
| 73 | v &= ~mask; | ||
| 74 | v |= bits; | ||
| 75 | omap2_prm_write_mod_reg(v, module, idx); | ||
| 76 | |||
| 77 | return v; | ||
| 78 | } | ||
| 79 | |||
| 80 | /* Read a PRM register, AND it, and shift the result down to bit 0 */ | ||
| 81 | static inline u32 omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) | ||
| 82 | { | ||
| 83 | u32 v; | ||
| 84 | |||
| 85 | v = omap2_prm_read_mod_reg(domain, idx); | ||
| 86 | v &= mask; | ||
| 87 | v >>= __ffs(mask); | ||
| 88 | |||
| 89 | return v; | ||
| 90 | } | ||
| 91 | |||
| 92 | static inline u32 omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) | ||
| 93 | { | ||
| 94 | return omap2_prm_rmw_mod_reg_bits(bits, bits, module, idx); | ||
| 95 | } | ||
| 96 | |||
| 97 | static inline u32 omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) | ||
| 98 | { | ||
| 99 | return omap2_prm_rmw_mod_reg_bits(bits, 0x0, module, idx); | ||
| 100 | } | ||
| 238 | 101 | ||
| 239 | /* These omap2_ PRM functions apply to both OMAP2 and 3 */ | 102 | /* These omap2_ PRM functions apply to both OMAP2 and 3 */ |
| 240 | extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); | 103 | extern int omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift); |
| 241 | extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); | 104 | extern int omap2_prm_assert_hardreset(s16 prm_mod, u8 shift); |
| 242 | extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); | 105 | extern int omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, u8 st_shift); |
| 243 | 106 | ||
| 244 | /* OMAP3-specific VP functions */ | 107 | extern int omap2_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); |
| 245 | u32 omap3_prm_vp_check_txdone(u8 vp_id); | 108 | extern int omap2_pwrdm_read_next_pwrst(struct powerdomain *pwrdm); |
| 246 | void omap3_prm_vp_clear_txdone(u8 vp_id); | 109 | extern int omap2_pwrdm_read_pwrst(struct powerdomain *pwrdm); |
| 247 | 110 | extern int omap2_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, | |
| 248 | /* | 111 | u8 pwrst); |
| 249 | * OMAP3 access functions for voltage controller (VC) and | 112 | extern int omap2_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, |
| 250 | * voltage proccessor (VP) in the PRM. | 113 | u8 pwrst); |
| 251 | */ | 114 | extern int omap2_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank); |
| 252 | extern u32 omap3_prm_vcvp_read(u8 offset); | 115 | extern int omap2_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank); |
| 253 | extern void omap3_prm_vcvp_write(u32 val, u8 offset); | 116 | extern int omap2_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst); |
| 254 | extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); | 117 | extern int omap2_pwrdm_wait_transition(struct powerdomain *pwrdm); |
| 255 | 118 | ||
| 256 | extern void omap3xxx_prm_reconfigure_io_chain(void); | 119 | extern int omap2_clkdm_add_wkdep(struct clockdomain *clkdm1, |
| 257 | 120 | struct clockdomain *clkdm2); | |
| 258 | /* PRM interrupt-related functions */ | 121 | extern int omap2_clkdm_del_wkdep(struct clockdomain *clkdm1, |
| 259 | extern void omap3xxx_prm_read_pending_irqs(unsigned long *events); | 122 | struct clockdomain *clkdm2); |
| 260 | extern void omap3xxx_prm_ocp_barrier(void); | 123 | extern int omap2_clkdm_read_wkdep(struct clockdomain *clkdm1, |
| 261 | extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask); | 124 | struct clockdomain *clkdm2); |
| 262 | extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); | 125 | extern int omap2_clkdm_clear_all_wkdeps(struct clockdomain *clkdm); |
| 263 | 126 | ||
| 264 | #endif /* __ASSEMBLER */ | 127 | #endif /* __ASSEMBLER */ |
| 265 | 128 | ||
| @@ -348,7 +211,9 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); | |||
| 348 | * | 211 | * |
| 349 | * 3430: RM_RSTST_CORE, RM_RSTST_EMU | 212 | * 3430: RM_RSTST_CORE, RM_RSTST_EMU |
| 350 | */ | 213 | */ |
| 214 | #define OMAP_GLOBALWARM_RST_SHIFT 1 | ||
| 351 | #define OMAP_GLOBALWARM_RST_MASK (1 << 1) | 215 | #define OMAP_GLOBALWARM_RST_MASK (1 << 1) |
| 216 | #define OMAP_GLOBALCOLD_RST_SHIFT 0 | ||
| 352 | #define OMAP_GLOBALCOLD_RST_MASK (1 << 0) | 217 | #define OMAP_GLOBALCOLD_RST_MASK (1 << 0) |
| 353 | 218 | ||
| 354 | /* | 219 | /* |
| @@ -376,11 +241,4 @@ extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); | |||
| 376 | #define OMAP_LOGICRETSTATE_MASK (1 << 2) | 241 | #define OMAP_LOGICRETSTATE_MASK (1 << 2) |
| 377 | 242 | ||
| 378 | 243 | ||
| 379 | /* | ||
| 380 | * MAX_MODULE_HARDRESET_WAIT: Maximum microseconds to wait for an OMAP | ||
| 381 | * submodule to exit hardreset | ||
| 382 | */ | ||
| 383 | #define MAX_MODULE_HARDRESET_WAIT 10000 | ||
| 384 | |||
| 385 | |||
| 386 | #endif | 244 | #endif |
diff --git a/arch/arm/mach-omap2/prm33xx.c b/arch/arm/mach-omap2/prm33xx.c index 0d8abb577669..1ac73883f891 100644 --- a/arch/arm/mach-omap2/prm33xx.c +++ b/arch/arm/mach-omap2/prm33xx.c | |||
| @@ -20,6 +20,7 @@ | |||
| 20 | #include <linux/io.h> | 20 | #include <linux/io.h> |
| 21 | 21 | ||
| 22 | #include "common.h" | 22 | #include "common.h" |
| 23 | #include "powerdomain.h" | ||
| 23 | #include "prm33xx.h" | 24 | #include "prm33xx.h" |
| 24 | #include "prm-regbits-33xx.h" | 25 | #include "prm-regbits-33xx.h" |
| 25 | 26 | ||
| @@ -131,3 +132,204 @@ int am33xx_prm_deassert_hardreset(u8 shift, s16 inst, | |||
| 131 | 132 | ||
| 132 | return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; | 133 | return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0; |
| 133 | } | 134 | } |
| 135 | |||
| 136 | static int am33xx_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 137 | { | ||
| 138 | am33xx_prm_rmw_reg_bits(OMAP_POWERSTATE_MASK, | ||
| 139 | (pwrst << OMAP_POWERSTATE_SHIFT), | ||
| 140 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 141 | return 0; | ||
| 142 | } | ||
| 143 | |||
| 144 | static int am33xx_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | ||
| 145 | { | ||
| 146 | u32 v; | ||
| 147 | |||
| 148 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 149 | v &= OMAP_POWERSTATE_MASK; | ||
| 150 | v >>= OMAP_POWERSTATE_SHIFT; | ||
| 151 | |||
| 152 | return v; | ||
| 153 | } | ||
| 154 | |||
| 155 | static int am33xx_pwrdm_read_pwrst(struct powerdomain *pwrdm) | ||
| 156 | { | ||
| 157 | u32 v; | ||
| 158 | |||
| 159 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 160 | v &= OMAP_POWERSTATEST_MASK; | ||
| 161 | v >>= OMAP_POWERSTATEST_SHIFT; | ||
| 162 | |||
| 163 | return v; | ||
| 164 | } | ||
| 165 | |||
| 166 | static int am33xx_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | ||
| 167 | { | ||
| 168 | u32 v; | ||
| 169 | |||
| 170 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 171 | v &= AM33XX_LASTPOWERSTATEENTERED_MASK; | ||
| 172 | v >>= AM33XX_LASTPOWERSTATEENTERED_SHIFT; | ||
| 173 | |||
| 174 | return v; | ||
| 175 | } | ||
| 176 | |||
| 177 | static int am33xx_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm) | ||
| 178 | { | ||
| 179 | am33xx_prm_rmw_reg_bits(AM33XX_LOWPOWERSTATECHANGE_MASK, | ||
| 180 | (1 << AM33XX_LOWPOWERSTATECHANGE_SHIFT), | ||
| 181 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 182 | return 0; | ||
| 183 | } | ||
| 184 | |||
| 185 | static int am33xx_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) | ||
| 186 | { | ||
| 187 | am33xx_prm_rmw_reg_bits(AM33XX_LASTPOWERSTATEENTERED_MASK, | ||
| 188 | AM33XX_LASTPOWERSTATEENTERED_MASK, | ||
| 189 | pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | |||
| 193 | static int am33xx_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 194 | { | ||
| 195 | u32 m; | ||
| 196 | |||
| 197 | m = pwrdm->logicretstate_mask; | ||
| 198 | if (!m) | ||
| 199 | return -EINVAL; | ||
| 200 | |||
| 201 | am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)), | ||
| 202 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 203 | |||
| 204 | return 0; | ||
| 205 | } | ||
| 206 | |||
| 207 | static int am33xx_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | ||
| 208 | { | ||
| 209 | u32 v; | ||
| 210 | |||
| 211 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 212 | v &= AM33XX_LOGICSTATEST_MASK; | ||
| 213 | v >>= AM33XX_LOGICSTATEST_SHIFT; | ||
| 214 | |||
| 215 | return v; | ||
| 216 | } | ||
| 217 | |||
| 218 | static int am33xx_pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
| 219 | { | ||
| 220 | u32 v, m; | ||
| 221 | |||
| 222 | m = pwrdm->logicretstate_mask; | ||
| 223 | if (!m) | ||
| 224 | return -EINVAL; | ||
| 225 | |||
| 226 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 227 | v &= m; | ||
| 228 | v >>= __ffs(m); | ||
| 229 | |||
| 230 | return v; | ||
| 231 | } | ||
| 232 | |||
| 233 | static int am33xx_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, | ||
| 234 | u8 pwrst) | ||
| 235 | { | ||
| 236 | u32 m; | ||
| 237 | |||
| 238 | m = pwrdm->mem_on_mask[bank]; | ||
| 239 | if (!m) | ||
| 240 | return -EINVAL; | ||
| 241 | |||
| 242 | am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)), | ||
| 243 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 244 | |||
| 245 | return 0; | ||
| 246 | } | ||
| 247 | |||
| 248 | static int am33xx_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, | ||
| 249 | u8 pwrst) | ||
| 250 | { | ||
| 251 | u32 m; | ||
| 252 | |||
| 253 | m = pwrdm->mem_ret_mask[bank]; | ||
| 254 | if (!m) | ||
| 255 | return -EINVAL; | ||
| 256 | |||
| 257 | am33xx_prm_rmw_reg_bits(m, (pwrst << __ffs(m)), | ||
| 258 | pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 259 | |||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | |||
| 263 | static int am33xx_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 264 | { | ||
| 265 | u32 m, v; | ||
| 266 | |||
| 267 | m = pwrdm->mem_pwrst_mask[bank]; | ||
| 268 | if (!m) | ||
| 269 | return -EINVAL; | ||
| 270 | |||
| 271 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs); | ||
| 272 | v &= m; | ||
| 273 | v >>= __ffs(m); | ||
| 274 | |||
| 275 | return v; | ||
| 276 | } | ||
| 277 | |||
| 278 | static int am33xx_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank) | ||
| 279 | { | ||
| 280 | u32 m, v; | ||
| 281 | |||
| 282 | m = pwrdm->mem_retst_mask[bank]; | ||
| 283 | if (!m) | ||
| 284 | return -EINVAL; | ||
| 285 | |||
| 286 | v = am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstctrl_offs); | ||
| 287 | v &= m; | ||
| 288 | v >>= __ffs(m); | ||
| 289 | |||
| 290 | return v; | ||
| 291 | } | ||
| 292 | |||
| 293 | static int am33xx_pwrdm_wait_transition(struct powerdomain *pwrdm) | ||
| 294 | { | ||
| 295 | u32 c = 0; | ||
| 296 | |||
| 297 | /* | ||
| 298 | * REVISIT: pwrdm_wait_transition() may be better implemented | ||
| 299 | * via a callback and a periodic timer check -- how long do we expect | ||
| 300 | * powerdomain transitions to take? | ||
| 301 | */ | ||
| 302 | |||
| 303 | /* XXX Is this udelay() value meaningful? */ | ||
| 304 | while ((am33xx_prm_read_reg(pwrdm->prcm_offs, pwrdm->pwrstst_offs) | ||
| 305 | & OMAP_INTRANSITION_MASK) && | ||
| 306 | (c++ < PWRDM_TRANSITION_BAILOUT)) | ||
| 307 | udelay(1); | ||
| 308 | |||
| 309 | if (c > PWRDM_TRANSITION_BAILOUT) { | ||
| 310 | pr_err("powerdomain: %s: waited too long to complete transition\n", | ||
| 311 | pwrdm->name); | ||
| 312 | return -EAGAIN; | ||
| 313 | } | ||
| 314 | |||
| 315 | pr_debug("powerdomain: completed transition in %d loops\n", c); | ||
| 316 | |||
| 317 | return 0; | ||
| 318 | } | ||
| 319 | |||
| 320 | struct pwrdm_ops am33xx_pwrdm_operations = { | ||
| 321 | .pwrdm_set_next_pwrst = am33xx_pwrdm_set_next_pwrst, | ||
| 322 | .pwrdm_read_next_pwrst = am33xx_pwrdm_read_next_pwrst, | ||
| 323 | .pwrdm_read_pwrst = am33xx_pwrdm_read_pwrst, | ||
| 324 | .pwrdm_read_prev_pwrst = am33xx_pwrdm_read_prev_pwrst, | ||
| 325 | .pwrdm_set_logic_retst = am33xx_pwrdm_set_logic_retst, | ||
| 326 | .pwrdm_read_logic_pwrst = am33xx_pwrdm_read_logic_pwrst, | ||
| 327 | .pwrdm_read_logic_retst = am33xx_pwrdm_read_logic_retst, | ||
| 328 | .pwrdm_clear_all_prev_pwrst = am33xx_pwrdm_clear_all_prev_pwrst, | ||
| 329 | .pwrdm_set_lowpwrstchange = am33xx_pwrdm_set_lowpwrstchange, | ||
| 330 | .pwrdm_read_mem_pwrst = am33xx_pwrdm_read_mem_pwrst, | ||
| 331 | .pwrdm_read_mem_retst = am33xx_pwrdm_read_mem_retst, | ||
| 332 | .pwrdm_set_mem_onst = am33xx_pwrdm_set_mem_onst, | ||
| 333 | .pwrdm_set_mem_retst = am33xx_pwrdm_set_mem_retst, | ||
| 334 | .pwrdm_wait_transition = am33xx_pwrdm_wait_transition, | ||
| 335 | }; | ||
diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c new file mode 100644 index 000000000000..b86116cf0db9 --- /dev/null +++ b/arch/arm/mach-omap2/prm3xxx.c | |||
| @@ -0,0 +1,417 @@ | |||
| 1 | /* | ||
| 2 | * OMAP3xxx PRM module functions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2010-2012 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2010 Nokia Corporation | ||
| 6 | * Benoît Cousson | ||
| 7 | * Paul Walmsley | ||
| 8 | * Rajendra Nayak <rnayak@ti.com> | ||
| 9 | * | ||
| 10 | * This program is free software; you can redistribute it and/or modify | ||
| 11 | * it under the terms of the GNU General Public License version 2 as | ||
| 12 | * published by the Free Software Foundation. | ||
| 13 | */ | ||
| 14 | |||
| 15 | #include <linux/kernel.h> | ||
| 16 | #include <linux/errno.h> | ||
| 17 | #include <linux/err.h> | ||
| 18 | #include <linux/io.h> | ||
| 19 | #include <linux/irq.h> | ||
| 20 | |||
| 21 | #include "common.h" | ||
| 22 | #include <plat/cpu.h> | ||
| 23 | |||
| 24 | #include "vp.h" | ||
| 25 | #include "powerdomain.h" | ||
| 26 | #include "prm3xxx.h" | ||
| 27 | #include "prm2xxx_3xxx.h" | ||
| 28 | #include "cm2xxx_3xxx.h" | ||
| 29 | #include "prm-regbits-34xx.h" | ||
| 30 | |||
| 31 | static const struct omap_prcm_irq omap3_prcm_irqs[] = { | ||
| 32 | OMAP_PRCM_IRQ("wkup", 0, 0), | ||
| 33 | OMAP_PRCM_IRQ("io", 9, 1), | ||
| 34 | }; | ||
| 35 | |||
| 36 | static struct omap_prcm_irq_setup omap3_prcm_irq_setup = { | ||
| 37 | .ack = OMAP3_PRM_IRQSTATUS_MPU_OFFSET, | ||
| 38 | .mask = OMAP3_PRM_IRQENABLE_MPU_OFFSET, | ||
| 39 | .nr_regs = 1, | ||
| 40 | .irqs = omap3_prcm_irqs, | ||
| 41 | .nr_irqs = ARRAY_SIZE(omap3_prcm_irqs), | ||
| 42 | .irq = 11 + OMAP_INTC_START, | ||
| 43 | .read_pending_irqs = &omap3xxx_prm_read_pending_irqs, | ||
| 44 | .ocp_barrier = &omap3xxx_prm_ocp_barrier, | ||
| 45 | .save_and_clear_irqen = &omap3xxx_prm_save_and_clear_irqen, | ||
| 46 | .restore_irqen = &omap3xxx_prm_restore_irqen, | ||
| 47 | }; | ||
| 48 | |||
| 49 | /* | ||
| 50 | * omap3_prm_reset_src_map - map from bits in the PRM_RSTST hardware | ||
| 51 | * register (which are specific to OMAP3xxx SoCs) to reset source ID | ||
| 52 | * bit shifts (which is an OMAP SoC-independent enumeration) | ||
| 53 | */ | ||
| 54 | static struct prm_reset_src_map omap3xxx_prm_reset_src_map[] = { | ||
| 55 | { OMAP3430_GLOBAL_COLD_RST_SHIFT, OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT }, | ||
| 56 | { OMAP3430_GLOBAL_SW_RST_SHIFT, OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT }, | ||
| 57 | { OMAP3430_SECURITY_VIOL_RST_SHIFT, OMAP_SECU_VIOL_RST_SRC_ID_SHIFT }, | ||
| 58 | { OMAP3430_MPU_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT }, | ||
| 59 | { OMAP3430_SECURE_WD_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT }, | ||
| 60 | { OMAP3430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT }, | ||
| 61 | { OMAP3430_VDD1_VOLTAGE_MANAGER_RST_SHIFT, | ||
| 62 | OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT }, | ||
| 63 | { OMAP3430_VDD2_VOLTAGE_MANAGER_RST_SHIFT, | ||
| 64 | OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT }, | ||
| 65 | { OMAP3430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT }, | ||
| 66 | { OMAP3430_ICECRUSHER_RST_SHIFT, OMAP_ICECRUSHER_RST_SRC_ID_SHIFT }, | ||
| 67 | { -1, -1 }, | ||
| 68 | }; | ||
| 69 | |||
| 70 | /* PRM VP */ | ||
| 71 | |||
| 72 | /* | ||
| 73 | * struct omap3_vp - OMAP3 VP register access description. | ||
| 74 | * @tranxdone_status: VP_TRANXDONE_ST bitmask in PRM_IRQSTATUS_MPU reg | ||
| 75 | */ | ||
| 76 | struct omap3_vp { | ||
| 77 | u32 tranxdone_status; | ||
| 78 | }; | ||
| 79 | |||
| 80 | static struct omap3_vp omap3_vp[] = { | ||
| 81 | [OMAP3_VP_VDD_MPU_ID] = { | ||
| 82 | .tranxdone_status = OMAP3430_VP1_TRANXDONE_ST_MASK, | ||
| 83 | }, | ||
| 84 | [OMAP3_VP_VDD_CORE_ID] = { | ||
| 85 | .tranxdone_status = OMAP3430_VP2_TRANXDONE_ST_MASK, | ||
| 86 | }, | ||
| 87 | }; | ||
| 88 | |||
| 89 | #define MAX_VP_ID ARRAY_SIZE(omap3_vp); | ||
| 90 | |||
| 91 | u32 omap3_prm_vp_check_txdone(u8 vp_id) | ||
| 92 | { | ||
| 93 | struct omap3_vp *vp = &omap3_vp[vp_id]; | ||
| 94 | u32 irqstatus; | ||
| 95 | |||
| 96 | irqstatus = omap2_prm_read_mod_reg(OCP_MOD, | ||
| 97 | OMAP3_PRM_IRQSTATUS_MPU_OFFSET); | ||
| 98 | return irqstatus & vp->tranxdone_status; | ||
| 99 | } | ||
| 100 | |||
| 101 | void omap3_prm_vp_clear_txdone(u8 vp_id) | ||
| 102 | { | ||
| 103 | struct omap3_vp *vp = &omap3_vp[vp_id]; | ||
| 104 | |||
| 105 | omap2_prm_write_mod_reg(vp->tranxdone_status, | ||
| 106 | OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); | ||
| 107 | } | ||
| 108 | |||
| 109 | u32 omap3_prm_vcvp_read(u8 offset) | ||
| 110 | { | ||
| 111 | return omap2_prm_read_mod_reg(OMAP3430_GR_MOD, offset); | ||
| 112 | } | ||
| 113 | |||
| 114 | void omap3_prm_vcvp_write(u32 val, u8 offset) | ||
| 115 | { | ||
| 116 | omap2_prm_write_mod_reg(val, OMAP3430_GR_MOD, offset); | ||
| 117 | } | ||
| 118 | |||
| 119 | u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset) | ||
| 120 | { | ||
| 121 | return omap2_prm_rmw_mod_reg_bits(mask, bits, OMAP3430_GR_MOD, offset); | ||
| 122 | } | ||
| 123 | |||
| 124 | /** | ||
| 125 | * omap3xxx_prm_dpll3_reset - use DPLL3 reset to reboot the OMAP SoC | ||
| 126 | * | ||
| 127 | * Set the DPLL3 reset bit, which should reboot the SoC. This is the | ||
| 128 | * recommended way to restart the SoC, considering Errata i520. No | ||
| 129 | * return value. | ||
| 130 | */ | ||
| 131 | void omap3xxx_prm_dpll3_reset(void) | ||
| 132 | { | ||
| 133 | omap2_prm_set_mod_reg_bits(OMAP_RST_DPLL3_MASK, OMAP3430_GR_MOD, | ||
| 134 | OMAP2_RM_RSTCTRL); | ||
| 135 | /* OCP barrier */ | ||
| 136 | omap2_prm_read_mod_reg(OMAP3430_GR_MOD, OMAP2_RM_RSTCTRL); | ||
| 137 | } | ||
| 138 | |||
| 139 | /** | ||
| 140 | * omap3xxx_prm_read_pending_irqs - read pending PRM MPU IRQs into @events | ||
| 141 | * @events: ptr to a u32, preallocated by caller | ||
| 142 | * | ||
| 143 | * Read PRM_IRQSTATUS_MPU bits, AND'ed with the currently-enabled PRM | ||
| 144 | * MPU IRQs, and store the result into the u32 pointed to by @events. | ||
| 145 | * No return value. | ||
| 146 | */ | ||
| 147 | void omap3xxx_prm_read_pending_irqs(unsigned long *events) | ||
| 148 | { | ||
| 149 | u32 mask, st; | ||
| 150 | |||
| 151 | /* XXX Can the mask read be avoided (e.g., can it come from RAM?) */ | ||
| 152 | mask = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); | ||
| 153 | st = omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_IRQSTATUS_MPU_OFFSET); | ||
| 154 | |||
| 155 | events[0] = mask & st; | ||
| 156 | } | ||
| 157 | |||
| 158 | /** | ||
| 159 | * omap3xxx_prm_ocp_barrier - force buffered MPU writes to the PRM to complete | ||
| 160 | * | ||
| 161 | * Force any buffered writes to the PRM IP block to complete. Needed | ||
| 162 | * by the PRM IRQ handler, which reads and writes directly to the IP | ||
| 163 | * block, to avoid race conditions after acknowledging or clearing IRQ | ||
| 164 | * bits. No return value. | ||
| 165 | */ | ||
| 166 | void omap3xxx_prm_ocp_barrier(void) | ||
| 167 | { | ||
| 168 | omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); | ||
| 169 | } | ||
| 170 | |||
| 171 | /** | ||
| 172 | * omap3xxx_prm_save_and_clear_irqen - save/clear PRM_IRQENABLE_MPU reg | ||
| 173 | * @saved_mask: ptr to a u32 array to save IRQENABLE bits | ||
| 174 | * | ||
| 175 | * Save the PRM_IRQENABLE_MPU register to @saved_mask. @saved_mask | ||
| 176 | * must be allocated by the caller. Intended to be used in the PRM | ||
| 177 | * interrupt handler suspend callback. The OCP barrier is needed to | ||
| 178 | * ensure the write to disable PRM interrupts reaches the PRM before | ||
| 179 | * returning; otherwise, spurious interrupts might occur. No return | ||
| 180 | * value. | ||
| 181 | */ | ||
| 182 | void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask) | ||
| 183 | { | ||
| 184 | saved_mask[0] = omap2_prm_read_mod_reg(OCP_MOD, | ||
| 185 | OMAP3_PRM_IRQENABLE_MPU_OFFSET); | ||
| 186 | omap2_prm_write_mod_reg(0, OCP_MOD, OMAP3_PRM_IRQENABLE_MPU_OFFSET); | ||
| 187 | |||
| 188 | /* OCP barrier */ | ||
| 189 | omap2_prm_read_mod_reg(OCP_MOD, OMAP3_PRM_REVISION_OFFSET); | ||
| 190 | } | ||
| 191 | |||
| 192 | /** | ||
| 193 | * omap3xxx_prm_restore_irqen - set PRM_IRQENABLE_MPU register from args | ||
| 194 | * @saved_mask: ptr to a u32 array of IRQENABLE bits saved previously | ||
| 195 | * | ||
| 196 | * Restore the PRM_IRQENABLE_MPU register from @saved_mask. Intended | ||
| 197 | * to be used in the PRM interrupt handler resume callback to restore | ||
| 198 | * values saved by omap3xxx_prm_save_and_clear_irqen(). No OCP | ||
| 199 | * barrier should be needed here; any pending PRM interrupts will fire | ||
| 200 | * once the writes reach the PRM. No return value. | ||
| 201 | */ | ||
| 202 | void omap3xxx_prm_restore_irqen(u32 *saved_mask) | ||
| 203 | { | ||
| 204 | omap2_prm_write_mod_reg(saved_mask[0], OCP_MOD, | ||
| 205 | OMAP3_PRM_IRQENABLE_MPU_OFFSET); | ||
| 206 | } | ||
| 207 | |||
| 208 | /** | ||
| 209 | * omap3xxx_prm_reconfigure_io_chain - clear latches and reconfigure I/O chain | ||
| 210 | * | ||
| 211 | * Clear any previously-latched I/O wakeup events and ensure that the | ||
| 212 | * I/O wakeup gates are aligned with the current mux settings. Works | ||
| 213 | * by asserting WUCLKIN, waiting for WUCLKOUT to be asserted, and then | ||
| 214 | * deasserting WUCLKIN and clearing the ST_IO_CHAIN WKST bit. No | ||
| 215 | * return value. | ||
| 216 | */ | ||
| 217 | void omap3xxx_prm_reconfigure_io_chain(void) | ||
| 218 | { | ||
| 219 | int i = 0; | ||
| 220 | |||
| 221 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, | ||
| 222 | PM_WKEN); | ||
| 223 | |||
| 224 | omap_test_timeout(omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST) & | ||
| 225 | OMAP3430_ST_IO_CHAIN_MASK, | ||
| 226 | MAX_IOPAD_LATCH_TIME, i); | ||
| 227 | if (i == MAX_IOPAD_LATCH_TIME) | ||
| 228 | pr_warn("PRM: I/O chain clock line assertion timed out\n"); | ||
| 229 | |||
| 230 | omap2_prm_clear_mod_reg_bits(OMAP3430_EN_IO_CHAIN_MASK, WKUP_MOD, | ||
| 231 | PM_WKEN); | ||
| 232 | |||
| 233 | omap2_prm_set_mod_reg_bits(OMAP3430_ST_IO_CHAIN_MASK, WKUP_MOD, | ||
| 234 | PM_WKST); | ||
| 235 | |||
| 236 | omap2_prm_read_mod_reg(WKUP_MOD, PM_WKST); | ||
| 237 | } | ||
| 238 | |||
| 239 | /** | ||
| 240 | * omap3xxx_prm_enable_io_wakeup - enable wakeup events from I/O wakeup latches | ||
| 241 | * | ||
| 242 | * Activates the I/O wakeup event latches and allows events logged by | ||
| 243 | * those latches to signal a wakeup event to the PRCM. For I/O | ||
| 244 | * wakeups to occur, WAKEUPENABLE bits must be set in the pad mux | ||
| 245 | * registers, and omap3xxx_prm_reconfigure_io_chain() must be called. | ||
| 246 | * No return value. | ||
| 247 | */ | ||
| 248 | static void __init omap3xxx_prm_enable_io_wakeup(void) | ||
| 249 | { | ||
| 250 | if (omap3_has_io_wakeup()) | ||
| 251 | omap2_prm_set_mod_reg_bits(OMAP3430_EN_IO_MASK, WKUP_MOD, | ||
| 252 | PM_WKEN); | ||
| 253 | } | ||
| 254 | |||
| 255 | /** | ||
| 256 | * omap3xxx_prm_read_reset_sources - return the last SoC reset source | ||
| 257 | * | ||
| 258 | * Return a u32 representing the last reset sources of the SoC. The | ||
| 259 | * returned reset source bits are standardized across OMAP SoCs. | ||
| 260 | */ | ||
| 261 | static u32 omap3xxx_prm_read_reset_sources(void) | ||
| 262 | { | ||
| 263 | struct prm_reset_src_map *p; | ||
| 264 | u32 r = 0; | ||
| 265 | u32 v; | ||
| 266 | |||
| 267 | v = omap2_prm_read_mod_reg(WKUP_MOD, OMAP2_RM_RSTST); | ||
| 268 | |||
| 269 | p = omap3xxx_prm_reset_src_map; | ||
| 270 | while (p->reg_shift >= 0 && p->std_shift >= 0) { | ||
| 271 | if (v & (1 << p->reg_shift)) | ||
| 272 | r |= 1 << p->std_shift; | ||
| 273 | p++; | ||
| 274 | } | ||
| 275 | |||
| 276 | return r; | ||
| 277 | } | ||
| 278 | |||
| 279 | /* Powerdomain low-level functions */ | ||
| 280 | |||
| 281 | /* Applicable only for OMAP3. Not supported on OMAP2 */ | ||
| 282 | static int omap3_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | ||
| 283 | { | ||
| 284 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 285 | OMAP3430_PM_PREPWSTST, | ||
| 286 | OMAP3430_LASTPOWERSTATEENTERED_MASK); | ||
| 287 | } | ||
| 288 | |||
| 289 | static int omap3_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | ||
| 290 | { | ||
| 291 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 292 | OMAP2_PM_PWSTST, | ||
| 293 | OMAP3430_LOGICSTATEST_MASK); | ||
| 294 | } | ||
| 295 | |||
| 296 | static int omap3_pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
| 297 | { | ||
| 298 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 299 | OMAP2_PM_PWSTCTRL, | ||
| 300 | OMAP3430_LOGICSTATEST_MASK); | ||
| 301 | } | ||
| 302 | |||
| 303 | static int omap3_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | ||
| 304 | { | ||
| 305 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 306 | OMAP3430_PM_PREPWSTST, | ||
| 307 | OMAP3430_LASTLOGICSTATEENTERED_MASK); | ||
| 308 | } | ||
| 309 | |||
| 310 | static int omap3_get_mem_bank_lastmemst_mask(u8 bank) | ||
| 311 | { | ||
| 312 | switch (bank) { | ||
| 313 | case 0: | ||
| 314 | return OMAP3430_LASTMEM1STATEENTERED_MASK; | ||
| 315 | case 1: | ||
| 316 | return OMAP3430_LASTMEM2STATEENTERED_MASK; | ||
| 317 | case 2: | ||
| 318 | return OMAP3430_LASTSHAREDL2CACHEFLATSTATEENTERED_MASK; | ||
| 319 | case 3: | ||
| 320 | return OMAP3430_LASTL2FLATMEMSTATEENTERED_MASK; | ||
| 321 | default: | ||
| 322 | WARN_ON(1); /* should never happen */ | ||
| 323 | return -EEXIST; | ||
| 324 | } | ||
| 325 | return 0; | ||
| 326 | } | ||
| 327 | |||
| 328 | static int omap3_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 329 | { | ||
| 330 | u32 m; | ||
| 331 | |||
| 332 | m = omap3_get_mem_bank_lastmemst_mask(bank); | ||
| 333 | |||
| 334 | return omap2_prm_read_mod_bits_shift(pwrdm->prcm_offs, | ||
| 335 | OMAP3430_PM_PREPWSTST, m); | ||
| 336 | } | ||
| 337 | |||
| 338 | static int omap3_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) | ||
| 339 | { | ||
| 340 | omap2_prm_write_mod_reg(0, pwrdm->prcm_offs, OMAP3430_PM_PREPWSTST); | ||
| 341 | return 0; | ||
| 342 | } | ||
| 343 | |||
| 344 | static int omap3_pwrdm_enable_hdwr_sar(struct powerdomain *pwrdm) | ||
| 345 | { | ||
| 346 | return omap2_prm_rmw_mod_reg_bits(0, | ||
| 347 | 1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, | ||
| 348 | pwrdm->prcm_offs, OMAP2_PM_PWSTCTRL); | ||
| 349 | } | ||
| 350 | |||
| 351 | static int omap3_pwrdm_disable_hdwr_sar(struct powerdomain *pwrdm) | ||
| 352 | { | ||
| 353 | return omap2_prm_rmw_mod_reg_bits(1 << OMAP3430ES2_SAVEANDRESTORE_SHIFT, | ||
| 354 | 0, pwrdm->prcm_offs, | ||
| 355 | OMAP2_PM_PWSTCTRL); | ||
| 356 | } | ||
| 357 | |||
| 358 | struct pwrdm_ops omap3_pwrdm_operations = { | ||
| 359 | .pwrdm_set_next_pwrst = omap2_pwrdm_set_next_pwrst, | ||
| 360 | .pwrdm_read_next_pwrst = omap2_pwrdm_read_next_pwrst, | ||
| 361 | .pwrdm_read_pwrst = omap2_pwrdm_read_pwrst, | ||
| 362 | .pwrdm_read_prev_pwrst = omap3_pwrdm_read_prev_pwrst, | ||
| 363 | .pwrdm_set_logic_retst = omap2_pwrdm_set_logic_retst, | ||
| 364 | .pwrdm_read_logic_pwrst = omap3_pwrdm_read_logic_pwrst, | ||
| 365 | .pwrdm_read_logic_retst = omap3_pwrdm_read_logic_retst, | ||
| 366 | .pwrdm_read_prev_logic_pwrst = omap3_pwrdm_read_prev_logic_pwrst, | ||
| 367 | .pwrdm_set_mem_onst = omap2_pwrdm_set_mem_onst, | ||
| 368 | .pwrdm_set_mem_retst = omap2_pwrdm_set_mem_retst, | ||
| 369 | .pwrdm_read_mem_pwrst = omap2_pwrdm_read_mem_pwrst, | ||
| 370 | .pwrdm_read_mem_retst = omap2_pwrdm_read_mem_retst, | ||
| 371 | .pwrdm_read_prev_mem_pwrst = omap3_pwrdm_read_prev_mem_pwrst, | ||
| 372 | .pwrdm_clear_all_prev_pwrst = omap3_pwrdm_clear_all_prev_pwrst, | ||
| 373 | .pwrdm_enable_hdwr_sar = omap3_pwrdm_enable_hdwr_sar, | ||
| 374 | .pwrdm_disable_hdwr_sar = omap3_pwrdm_disable_hdwr_sar, | ||
| 375 | .pwrdm_wait_transition = omap2_pwrdm_wait_transition, | ||
| 376 | }; | ||
| 377 | |||
| 378 | /* | ||
| 379 | * | ||
| 380 | */ | ||
| 381 | |||
| 382 | static struct prm_ll_data omap3xxx_prm_ll_data = { | ||
| 383 | .read_reset_sources = &omap3xxx_prm_read_reset_sources, | ||
| 384 | }; | ||
| 385 | |||
| 386 | static int __init omap3xxx_prm_init(void) | ||
| 387 | { | ||
| 388 | int ret; | ||
| 389 | |||
| 390 | if (!cpu_is_omap34xx()) | ||
| 391 | return 0; | ||
| 392 | |||
| 393 | ret = prm_register(&omap3xxx_prm_ll_data); | ||
| 394 | if (ret) | ||
| 395 | return ret; | ||
| 396 | |||
| 397 | omap3xxx_prm_enable_io_wakeup(); | ||
| 398 | ret = omap_prcm_register_chain_handler(&omap3_prcm_irq_setup); | ||
| 399 | if (!ret) | ||
| 400 | irq_set_status_flags(omap_prcm_event_to_irq("io"), | ||
| 401 | IRQ_NOAUTOEN); | ||
| 402 | |||
| 403 | |||
| 404 | return ret; | ||
| 405 | } | ||
| 406 | subsys_initcall(omap3xxx_prm_init); | ||
| 407 | |||
| 408 | static void __exit omap3xxx_prm_exit(void) | ||
| 409 | { | ||
| 410 | if (!cpu_is_omap34xx()) | ||
| 411 | return; | ||
| 412 | |||
| 413 | /* Should never happen */ | ||
| 414 | WARN(prm_unregister(&omap3xxx_prm_ll_data), | ||
| 415 | "%s: prm_ll_data function pointer mismatch\n", __func__); | ||
| 416 | } | ||
| 417 | __exitcall(omap3xxx_prm_exit); | ||
diff --git a/arch/arm/mach-omap2/prm3xxx.h b/arch/arm/mach-omap2/prm3xxx.h new file mode 100644 index 000000000000..10cd41a8129e --- /dev/null +++ b/arch/arm/mach-omap2/prm3xxx.h | |||
| @@ -0,0 +1,162 @@ | |||
| 1 | /* | ||
| 2 | * OMAP3xxx Power/Reset Management (PRM) register definitions | ||
| 3 | * | ||
| 4 | * Copyright (C) 2007-2009, 2011-2012 Texas Instruments, Inc. | ||
| 5 | * Copyright (C) 2008-2010 Nokia Corporation | ||
| 6 | * Paul Walmsley | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify | ||
| 9 | * it under the terms of the GNU General Public License version 2 as | ||
| 10 | * published by the Free Software Foundation. | ||
| 11 | * | ||
| 12 | * The PRM hardware modules on the OMAP2/3 are quite similar to each | ||
| 13 | * other. The PRM on OMAP4 has a new register layout, and is handled | ||
| 14 | * in a separate file. | ||
| 15 | */ | ||
| 16 | #ifndef __ARCH_ARM_MACH_OMAP2_PRM3XXX_H | ||
| 17 | #define __ARCH_ARM_MACH_OMAP2_PRM3XXX_H | ||
| 18 | |||
| 19 | #include "prcm-common.h" | ||
| 20 | #include "prm.h" | ||
| 21 | #include "prm2xxx_3xxx.h" | ||
| 22 | |||
| 23 | #define OMAP34XX_PRM_REGADDR(module, reg) \ | ||
| 24 | OMAP2_L4_IO_ADDRESS(OMAP3430_PRM_BASE + (module) + (reg)) | ||
| 25 | |||
| 26 | |||
| 27 | /* | ||
| 28 | * OMAP3-specific global PRM registers | ||
| 29 | * Use __raw_{read,write}l() with these registers. | ||
| 30 | * | ||
| 31 | * With a few exceptions, these are the register names beginning with | ||
| 32 | * PRM_* on 34xx. (The exceptions are the IRQSTATUS and IRQENABLE | ||
| 33 | * bits.) | ||
| 34 | */ | ||
| 35 | |||
| 36 | #define OMAP3_PRM_REVISION_OFFSET 0x0004 | ||
| 37 | #define OMAP3430_PRM_REVISION OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0004) | ||
| 38 | #define OMAP3_PRM_SYSCONFIG_OFFSET 0x0014 | ||
| 39 | #define OMAP3430_PRM_SYSCONFIG OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0014) | ||
| 40 | |||
| 41 | #define OMAP3_PRM_IRQSTATUS_MPU_OFFSET 0x0018 | ||
| 42 | #define OMAP3430_PRM_IRQSTATUS_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x0018) | ||
| 43 | #define OMAP3_PRM_IRQENABLE_MPU_OFFSET 0x001c | ||
| 44 | #define OMAP3430_PRM_IRQENABLE_MPU OMAP34XX_PRM_REGADDR(OCP_MOD, 0x001c) | ||
| 45 | |||
| 46 | |||
| 47 | #define OMAP3_PRM_VC_SMPS_SA_OFFSET 0x0020 | ||
| 48 | #define OMAP3430_PRM_VC_SMPS_SA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0020) | ||
| 49 | #define OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET 0x0024 | ||
| 50 | #define OMAP3430_PRM_VC_SMPS_VOL_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0024) | ||
| 51 | #define OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET 0x0028 | ||
| 52 | #define OMAP3430_PRM_VC_SMPS_CMD_RA OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0028) | ||
| 53 | #define OMAP3_PRM_VC_CMD_VAL_0_OFFSET 0x002c | ||
| 54 | #define OMAP3430_PRM_VC_CMD_VAL_0 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x002c) | ||
| 55 | #define OMAP3_PRM_VC_CMD_VAL_1_OFFSET 0x0030 | ||
| 56 | #define OMAP3430_PRM_VC_CMD_VAL_1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0030) | ||
| 57 | #define OMAP3_PRM_VC_CH_CONF_OFFSET 0x0034 | ||
| 58 | #define OMAP3430_PRM_VC_CH_CONF OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0034) | ||
| 59 | #define OMAP3_PRM_VC_I2C_CFG_OFFSET 0x0038 | ||
| 60 | #define OMAP3430_PRM_VC_I2C_CFG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0038) | ||
| 61 | #define OMAP3_PRM_VC_BYPASS_VAL_OFFSET 0x003c | ||
| 62 | #define OMAP3430_PRM_VC_BYPASS_VAL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x003c) | ||
| 63 | #define OMAP3_PRM_RSTCTRL_OFFSET 0x0050 | ||
| 64 | #define OMAP3430_PRM_RSTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0050) | ||
| 65 | #define OMAP3_PRM_RSTTIME_OFFSET 0x0054 | ||
| 66 | #define OMAP3430_PRM_RSTTIME OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0054) | ||
| 67 | #define OMAP3_PRM_RSTST_OFFSET 0x0058 | ||
| 68 | #define OMAP3430_PRM_RSTST OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0058) | ||
| 69 | #define OMAP3_PRM_VOLTCTRL_OFFSET 0x0060 | ||
| 70 | #define OMAP3430_PRM_VOLTCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0060) | ||
| 71 | #define OMAP3_PRM_SRAM_PCHARGE_OFFSET 0x0064 | ||
| 72 | #define OMAP3430_PRM_SRAM_PCHARGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0064) | ||
| 73 | #define OMAP3_PRM_CLKSRC_CTRL_OFFSET 0x0070 | ||
| 74 | #define OMAP3430_PRM_CLKSRC_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0070) | ||
| 75 | #define OMAP3_PRM_VOLTSETUP1_OFFSET 0x0090 | ||
| 76 | #define OMAP3430_PRM_VOLTSETUP1 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0090) | ||
| 77 | #define OMAP3_PRM_VOLTOFFSET_OFFSET 0x0094 | ||
| 78 | #define OMAP3430_PRM_VOLTOFFSET OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0094) | ||
| 79 | #define OMAP3_PRM_CLKSETUP_OFFSET 0x0098 | ||
| 80 | #define OMAP3430_PRM_CLKSETUP OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x0098) | ||
| 81 | #define OMAP3_PRM_POLCTRL_OFFSET 0x009c | ||
| 82 | #define OMAP3430_PRM_POLCTRL OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x009c) | ||
| 83 | #define OMAP3_PRM_VOLTSETUP2_OFFSET 0x00a0 | ||
| 84 | #define OMAP3430_PRM_VOLTSETUP2 OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00a0) | ||
| 85 | #define OMAP3_PRM_VP1_CONFIG_OFFSET 0x00b0 | ||
| 86 | #define OMAP3430_PRM_VP1_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b0) | ||
| 87 | #define OMAP3_PRM_VP1_VSTEPMIN_OFFSET 0x00b4 | ||
| 88 | #define OMAP3430_PRM_VP1_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b4) | ||
| 89 | #define OMAP3_PRM_VP1_VSTEPMAX_OFFSET 0x00b8 | ||
| 90 | #define OMAP3430_PRM_VP1_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00b8) | ||
| 91 | #define OMAP3_PRM_VP1_VLIMITTO_OFFSET 0x00bc | ||
| 92 | #define OMAP3430_PRM_VP1_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00bc) | ||
| 93 | #define OMAP3_PRM_VP1_VOLTAGE_OFFSET 0x00c0 | ||
| 94 | #define OMAP3430_PRM_VP1_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c0) | ||
| 95 | #define OMAP3_PRM_VP1_STATUS_OFFSET 0x00c4 | ||
| 96 | #define OMAP3430_PRM_VP1_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00c4) | ||
| 97 | #define OMAP3_PRM_VP2_CONFIG_OFFSET 0x00d0 | ||
| 98 | #define OMAP3430_PRM_VP2_CONFIG OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d0) | ||
| 99 | #define OMAP3_PRM_VP2_VSTEPMIN_OFFSET 0x00d4 | ||
| 100 | #define OMAP3430_PRM_VP2_VSTEPMIN OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d4) | ||
| 101 | #define OMAP3_PRM_VP2_VSTEPMAX_OFFSET 0x00d8 | ||
| 102 | #define OMAP3430_PRM_VP2_VSTEPMAX OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00d8) | ||
| 103 | #define OMAP3_PRM_VP2_VLIMITTO_OFFSET 0x00dc | ||
| 104 | #define OMAP3430_PRM_VP2_VLIMITTO OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00dc) | ||
| 105 | #define OMAP3_PRM_VP2_VOLTAGE_OFFSET 0x00e0 | ||
| 106 | #define OMAP3430_PRM_VP2_VOLTAGE OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e0) | ||
| 107 | #define OMAP3_PRM_VP2_STATUS_OFFSET 0x00e4 | ||
| 108 | #define OMAP3430_PRM_VP2_STATUS OMAP34XX_PRM_REGADDR(OMAP3430_GR_MOD, 0x00e4) | ||
| 109 | |||
| 110 | #define OMAP3_PRM_CLKSEL_OFFSET 0x0040 | ||
| 111 | #define OMAP3430_PRM_CLKSEL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0040) | ||
| 112 | #define OMAP3_PRM_CLKOUT_CTRL_OFFSET 0x0070 | ||
| 113 | #define OMAP3430_PRM_CLKOUT_CTRL OMAP34XX_PRM_REGADDR(OMAP3430_CCR_MOD, 0x0070) | ||
| 114 | |||
| 115 | /* OMAP3 specific register offsets */ | ||
| 116 | #define OMAP3430ES2_PM_WKEN3 0x00f0 | ||
| 117 | #define OMAP3430ES2_PM_WKST3 0x00b8 | ||
| 118 | |||
| 119 | #define OMAP3430_PM_MPUGRPSEL 0x00a4 | ||
| 120 | #define OMAP3430_PM_MPUGRPSEL1 OMAP3430_PM_MPUGRPSEL | ||
| 121 | #define OMAP3430ES2_PM_MPUGRPSEL3 0x00f8 | ||
| 122 | |||
| 123 | #define OMAP3430_PM_IVAGRPSEL 0x00a8 | ||
| 124 | #define OMAP3430_PM_IVAGRPSEL1 OMAP3430_PM_IVAGRPSEL | ||
| 125 | #define OMAP3430ES2_PM_IVAGRPSEL3 0x00f4 | ||
| 126 | |||
| 127 | #define OMAP3430_PM_PREPWSTST 0x00e8 | ||
| 128 | |||
| 129 | #define OMAP3430_PRM_IRQSTATUS_IVA2 0x00f8 | ||
| 130 | #define OMAP3430_PRM_IRQENABLE_IVA2 0x00fc | ||
| 131 | |||
| 132 | |||
| 133 | #ifndef __ASSEMBLER__ | ||
| 134 | |||
| 135 | /* OMAP3-specific VP functions */ | ||
| 136 | u32 omap3_prm_vp_check_txdone(u8 vp_id); | ||
| 137 | void omap3_prm_vp_clear_txdone(u8 vp_id); | ||
| 138 | |||
| 139 | /* | ||
| 140 | * OMAP3 access functions for voltage controller (VC) and | ||
| 141 | * voltage proccessor (VP) in the PRM. | ||
| 142 | */ | ||
| 143 | extern u32 omap3_prm_vcvp_read(u8 offset); | ||
| 144 | extern void omap3_prm_vcvp_write(u32 val, u8 offset); | ||
| 145 | extern u32 omap3_prm_vcvp_rmw(u32 mask, u32 bits, u8 offset); | ||
| 146 | |||
| 147 | extern void omap3xxx_prm_reconfigure_io_chain(void); | ||
| 148 | |||
| 149 | /* PRM interrupt-related functions */ | ||
| 150 | extern void omap3xxx_prm_read_pending_irqs(unsigned long *events); | ||
| 151 | extern void omap3xxx_prm_ocp_barrier(void); | ||
| 152 | extern void omap3xxx_prm_save_and_clear_irqen(u32 *saved_mask); | ||
| 153 | extern void omap3xxx_prm_restore_irqen(u32 *saved_mask); | ||
| 154 | |||
| 155 | extern void omap3xxx_prm_dpll3_reset(void); | ||
| 156 | |||
| 157 | extern u32 omap3xxx_prm_get_reset_sources(void); | ||
| 158 | |||
| 159 | #endif /* __ASSEMBLER */ | ||
| 160 | |||
| 161 | |||
| 162 | #endif | ||
diff --git a/arch/arm/mach-omap2/prm44xx.c b/arch/arm/mach-omap2/prm44xx.c index f0c4d5f4a174..6d3467af205d 100644 --- a/arch/arm/mach-omap2/prm44xx.c +++ b/arch/arm/mach-omap2/prm44xx.c | |||
| @@ -1,10 +1,11 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * OMAP4 PRM module functions | 2 | * OMAP4 PRM module functions |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2011 Texas Instruments, Inc. | 4 | * Copyright (C) 2011-2012 Texas Instruments, Inc. |
| 5 | * Copyright (C) 2010 Nokia Corporation | 5 | * Copyright (C) 2010 Nokia Corporation |
| 6 | * Benoît Cousson | 6 | * Benoît Cousson |
| 7 | * Paul Walmsley | 7 | * Paul Walmsley |
| 8 | * Rajendra Nayak <rnayak@ti.com> | ||
| 8 | * | 9 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
| @@ -17,7 +18,6 @@ | |||
| 17 | #include <linux/err.h> | 18 | #include <linux/err.h> |
| 18 | #include <linux/io.h> | 19 | #include <linux/io.h> |
| 19 | 20 | ||
| 20 | #include <plat/prcm.h> | ||
| 21 | 21 | ||
| 22 | #include "soc.h" | 22 | #include "soc.h" |
| 23 | #include "iomap.h" | 23 | #include "iomap.h" |
| @@ -27,6 +27,9 @@ | |||
| 27 | #include "prm-regbits-44xx.h" | 27 | #include "prm-regbits-44xx.h" |
| 28 | #include "prcm44xx.h" | 28 | #include "prcm44xx.h" |
| 29 | #include "prminst44xx.h" | 29 | #include "prminst44xx.h" |
| 30 | #include "powerdomain.h" | ||
| 31 | |||
| 32 | /* Static data */ | ||
| 30 | 33 | ||
| 31 | static const struct omap_prcm_irq omap4_prcm_irqs[] = { | 34 | static const struct omap_prcm_irq omap4_prcm_irqs[] = { |
| 32 | OMAP_PRCM_IRQ("wkup", 0, 0), | 35 | OMAP_PRCM_IRQ("wkup", 0, 0), |
| @@ -46,6 +49,33 @@ static struct omap_prcm_irq_setup omap4_prcm_irq_setup = { | |||
| 46 | .restore_irqen = &omap44xx_prm_restore_irqen, | 49 | .restore_irqen = &omap44xx_prm_restore_irqen, |
| 47 | }; | 50 | }; |
| 48 | 51 | ||
| 52 | /* | ||
| 53 | * omap44xx_prm_reset_src_map - map from bits in the PRM_RSTST | ||
| 54 | * hardware register (which are specific to OMAP44xx SoCs) to reset | ||
| 55 | * source ID bit shifts (which is an OMAP SoC-independent | ||
| 56 | * enumeration) | ||
| 57 | */ | ||
| 58 | static struct prm_reset_src_map omap44xx_prm_reset_src_map[] = { | ||
| 59 | { OMAP4430_RST_GLOBAL_WARM_SW_SHIFT, | ||
| 60 | OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT }, | ||
| 61 | { OMAP4430_RST_GLOBAL_COLD_SW_SHIFT, | ||
| 62 | OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT }, | ||
| 63 | { OMAP4430_MPU_SECURITY_VIOL_RST_SHIFT, | ||
| 64 | OMAP_SECU_VIOL_RST_SRC_ID_SHIFT }, | ||
| 65 | { OMAP4430_MPU_WDT_RST_SHIFT, OMAP_MPU_WD_RST_SRC_ID_SHIFT }, | ||
| 66 | { OMAP4430_SECURE_WDT_RST_SHIFT, OMAP_SECU_WD_RST_SRC_ID_SHIFT }, | ||
| 67 | { OMAP4430_EXTERNAL_WARM_RST_SHIFT, OMAP_EXTWARM_RST_SRC_ID_SHIFT }, | ||
| 68 | { OMAP4430_VDD_MPU_VOLT_MGR_RST_SHIFT, | ||
| 69 | OMAP_VDD_MPU_VM_RST_SRC_ID_SHIFT }, | ||
| 70 | { OMAP4430_VDD_IVA_VOLT_MGR_RST_SHIFT, | ||
| 71 | OMAP_VDD_IVA_VM_RST_SRC_ID_SHIFT }, | ||
| 72 | { OMAP4430_VDD_CORE_VOLT_MGR_RST_SHIFT, | ||
| 73 | OMAP_VDD_CORE_VM_RST_SRC_ID_SHIFT }, | ||
| 74 | { OMAP4430_ICEPICK_RST_SHIFT, OMAP_ICEPICK_RST_SRC_ID_SHIFT }, | ||
| 75 | { OMAP4430_C2C_RST_SHIFT, OMAP_C2C_RST_SRC_ID_SHIFT }, | ||
| 76 | { -1, -1 }, | ||
| 77 | }; | ||
| 78 | |||
| 49 | /* PRM low-level functions */ | 79 | /* PRM low-level functions */ |
| 50 | 80 | ||
| 51 | /* Read a register in a CM/PRM instance in the PRM module */ | 81 | /* Read a register in a CM/PRM instance in the PRM module */ |
| @@ -291,12 +321,324 @@ static void __init omap44xx_prm_enable_io_wakeup(void) | |||
| 291 | OMAP4_PRM_IO_PMCTRL_OFFSET); | 321 | OMAP4_PRM_IO_PMCTRL_OFFSET); |
| 292 | } | 322 | } |
| 293 | 323 | ||
| 294 | static int __init omap4xxx_prcm_init(void) | 324 | /** |
| 325 | * omap44xx_prm_read_reset_sources - return the last SoC reset source | ||
| 326 | * | ||
| 327 | * Return a u32 representing the last reset sources of the SoC. The | ||
| 328 | * returned reset source bits are standardized across OMAP SoCs. | ||
| 329 | */ | ||
| 330 | static u32 omap44xx_prm_read_reset_sources(void) | ||
| 331 | { | ||
| 332 | struct prm_reset_src_map *p; | ||
| 333 | u32 r = 0; | ||
| 334 | u32 v; | ||
| 335 | |||
| 336 | v = omap4_prm_read_inst_reg(OMAP4430_PRM_OCP_SOCKET_INST, | ||
| 337 | OMAP4_RM_RSTST); | ||
| 338 | |||
| 339 | p = omap44xx_prm_reset_src_map; | ||
| 340 | while (p->reg_shift >= 0 && p->std_shift >= 0) { | ||
| 341 | if (v & (1 << p->reg_shift)) | ||
| 342 | r |= 1 << p->std_shift; | ||
| 343 | p++; | ||
| 344 | } | ||
| 345 | |||
| 346 | return r; | ||
| 347 | } | ||
| 348 | |||
| 349 | /* Powerdomain low-level functions */ | ||
| 350 | |||
| 351 | static int omap4_pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 352 | { | ||
| 353 | omap4_prminst_rmw_inst_reg_bits(OMAP_POWERSTATE_MASK, | ||
| 354 | (pwrst << OMAP_POWERSTATE_SHIFT), | ||
| 355 | pwrdm->prcm_partition, | ||
| 356 | pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL); | ||
| 357 | return 0; | ||
| 358 | } | ||
| 359 | |||
| 360 | static int omap4_pwrdm_read_next_pwrst(struct powerdomain *pwrdm) | ||
| 361 | { | ||
| 362 | u32 v; | ||
| 363 | |||
| 364 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 365 | OMAP4_PM_PWSTCTRL); | ||
| 366 | v &= OMAP_POWERSTATE_MASK; | ||
| 367 | v >>= OMAP_POWERSTATE_SHIFT; | ||
| 368 | |||
| 369 | return v; | ||
| 370 | } | ||
| 371 | |||
| 372 | static int omap4_pwrdm_read_pwrst(struct powerdomain *pwrdm) | ||
| 373 | { | ||
| 374 | u32 v; | ||
| 375 | |||
| 376 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 377 | OMAP4_PM_PWSTST); | ||
| 378 | v &= OMAP_POWERSTATEST_MASK; | ||
| 379 | v >>= OMAP_POWERSTATEST_SHIFT; | ||
| 380 | |||
| 381 | return v; | ||
| 382 | } | ||
| 383 | |||
| 384 | static int omap4_pwrdm_read_prev_pwrst(struct powerdomain *pwrdm) | ||
| 385 | { | ||
| 386 | u32 v; | ||
| 387 | |||
| 388 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 389 | OMAP4_PM_PWSTST); | ||
| 390 | v &= OMAP4430_LASTPOWERSTATEENTERED_MASK; | ||
| 391 | v >>= OMAP4430_LASTPOWERSTATEENTERED_SHIFT; | ||
| 392 | |||
| 393 | return v; | ||
| 394 | } | ||
| 395 | |||
| 396 | static int omap4_pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm) | ||
| 397 | { | ||
| 398 | omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOWPOWERSTATECHANGE_MASK, | ||
| 399 | (1 << OMAP4430_LOWPOWERSTATECHANGE_SHIFT), | ||
| 400 | pwrdm->prcm_partition, | ||
| 401 | pwrdm->prcm_offs, OMAP4_PM_PWSTCTRL); | ||
| 402 | return 0; | ||
| 403 | } | ||
| 404 | |||
| 405 | static int omap4_pwrdm_clear_all_prev_pwrst(struct powerdomain *pwrdm) | ||
| 406 | { | ||
| 407 | omap4_prminst_rmw_inst_reg_bits(OMAP4430_LASTPOWERSTATEENTERED_MASK, | ||
| 408 | OMAP4430_LASTPOWERSTATEENTERED_MASK, | ||
| 409 | pwrdm->prcm_partition, | ||
| 410 | pwrdm->prcm_offs, OMAP4_PM_PWSTST); | ||
| 411 | return 0; | ||
| 412 | } | ||
| 413 | |||
| 414 | static int omap4_pwrdm_set_logic_retst(struct powerdomain *pwrdm, u8 pwrst) | ||
| 415 | { | ||
| 416 | u32 v; | ||
| 417 | |||
| 418 | v = pwrst << __ffs(OMAP4430_LOGICRETSTATE_MASK); | ||
| 419 | omap4_prminst_rmw_inst_reg_bits(OMAP4430_LOGICRETSTATE_MASK, v, | ||
| 420 | pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 421 | OMAP4_PM_PWSTCTRL); | ||
| 422 | |||
| 423 | return 0; | ||
| 424 | } | ||
| 425 | |||
| 426 | static int omap4_pwrdm_set_mem_onst(struct powerdomain *pwrdm, u8 bank, | ||
| 427 | u8 pwrst) | ||
| 428 | { | ||
| 429 | u32 m; | ||
| 430 | |||
| 431 | m = omap2_pwrdm_get_mem_bank_onstate_mask(bank); | ||
| 432 | |||
| 433 | omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)), | ||
| 434 | pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 435 | OMAP4_PM_PWSTCTRL); | ||
| 436 | |||
| 437 | return 0; | ||
| 438 | } | ||
| 439 | |||
| 440 | static int omap4_pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, | ||
| 441 | u8 pwrst) | ||
| 442 | { | ||
| 443 | u32 m; | ||
| 444 | |||
| 445 | m = omap2_pwrdm_get_mem_bank_retst_mask(bank); | ||
| 446 | |||
| 447 | omap4_prminst_rmw_inst_reg_bits(m, (pwrst << __ffs(m)), | ||
| 448 | pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 449 | OMAP4_PM_PWSTCTRL); | ||
| 450 | |||
| 451 | return 0; | ||
| 452 | } | ||
| 453 | |||
| 454 | static int omap4_pwrdm_read_logic_pwrst(struct powerdomain *pwrdm) | ||
| 455 | { | ||
| 456 | u32 v; | ||
| 457 | |||
| 458 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 459 | OMAP4_PM_PWSTST); | ||
| 460 | v &= OMAP4430_LOGICSTATEST_MASK; | ||
| 461 | v >>= OMAP4430_LOGICSTATEST_SHIFT; | ||
| 462 | |||
| 463 | return v; | ||
| 464 | } | ||
| 465 | |||
| 466 | static int omap4_pwrdm_read_logic_retst(struct powerdomain *pwrdm) | ||
| 295 | { | 467 | { |
| 296 | if (cpu_is_omap44xx()) { | 468 | u32 v; |
| 297 | omap44xx_prm_enable_io_wakeup(); | 469 | |
| 298 | return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); | 470 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, |
| 471 | OMAP4_PM_PWSTCTRL); | ||
| 472 | v &= OMAP4430_LOGICRETSTATE_MASK; | ||
| 473 | v >>= OMAP4430_LOGICRETSTATE_SHIFT; | ||
| 474 | |||
| 475 | return v; | ||
| 476 | } | ||
| 477 | |||
| 478 | /** | ||
| 479 | * omap4_pwrdm_read_prev_logic_pwrst - read the previous logic powerstate | ||
| 480 | * @pwrdm: struct powerdomain * to read the state for | ||
| 481 | * | ||
| 482 | * Reads the previous logic powerstate for a powerdomain. This | ||
| 483 | * function must determine the previous logic powerstate by first | ||
| 484 | * checking the previous powerstate for the domain. If that was OFF, | ||
| 485 | * then logic has been lost. If previous state was RETENTION, the | ||
| 486 | * function reads the setting for the next retention logic state to | ||
| 487 | * see the actual value. In every other case, the logic is | ||
| 488 | * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET | ||
| 489 | * depending whether the logic was retained or not. | ||
| 490 | */ | ||
| 491 | static int omap4_pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) | ||
| 492 | { | ||
| 493 | int state; | ||
| 494 | |||
| 495 | state = omap4_pwrdm_read_prev_pwrst(pwrdm); | ||
| 496 | |||
| 497 | if (state == PWRDM_POWER_OFF) | ||
| 498 | return PWRDM_POWER_OFF; | ||
| 499 | |||
| 500 | if (state != PWRDM_POWER_RET) | ||
| 501 | return PWRDM_POWER_RET; | ||
| 502 | |||
| 503 | return omap4_pwrdm_read_logic_retst(pwrdm); | ||
| 504 | } | ||
| 505 | |||
| 506 | static int omap4_pwrdm_read_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 507 | { | ||
| 508 | u32 m, v; | ||
| 509 | |||
| 510 | m = omap2_pwrdm_get_mem_bank_stst_mask(bank); | ||
| 511 | |||
| 512 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 513 | OMAP4_PM_PWSTST); | ||
| 514 | v &= m; | ||
| 515 | v >>= __ffs(m); | ||
| 516 | |||
| 517 | return v; | ||
| 518 | } | ||
| 519 | |||
| 520 | static int omap4_pwrdm_read_mem_retst(struct powerdomain *pwrdm, u8 bank) | ||
| 521 | { | ||
| 522 | u32 m, v; | ||
| 523 | |||
| 524 | m = omap2_pwrdm_get_mem_bank_retst_mask(bank); | ||
| 525 | |||
| 526 | v = omap4_prminst_read_inst_reg(pwrdm->prcm_partition, pwrdm->prcm_offs, | ||
| 527 | OMAP4_PM_PWSTCTRL); | ||
| 528 | v &= m; | ||
| 529 | v >>= __ffs(m); | ||
| 530 | |||
| 531 | return v; | ||
| 532 | } | ||
| 533 | |||
| 534 | /** | ||
| 535 | * omap4_pwrdm_read_prev_mem_pwrst - reads the previous memory powerstate | ||
| 536 | * @pwrdm: struct powerdomain * to read mem powerstate for | ||
| 537 | * @bank: memory bank index | ||
| 538 | * | ||
| 539 | * Reads the previous memory powerstate for a powerdomain. This | ||
| 540 | * function must determine the previous memory powerstate by first | ||
| 541 | * checking the previous powerstate for the domain. If that was OFF, | ||
| 542 | * then logic has been lost. If previous state was RETENTION, the | ||
| 543 | * function reads the setting for the next memory retention state to | ||
| 544 | * see the actual value. In every other case, the logic is | ||
| 545 | * retained. Returns either PWRDM_POWER_OFF or PWRDM_POWER_RET | ||
| 546 | * depending whether logic was retained or not. | ||
| 547 | */ | ||
| 548 | static int omap4_pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) | ||
| 549 | { | ||
| 550 | int state; | ||
| 551 | |||
| 552 | state = omap4_pwrdm_read_prev_pwrst(pwrdm); | ||
| 553 | |||
| 554 | if (state == PWRDM_POWER_OFF) | ||
| 555 | return PWRDM_POWER_OFF; | ||
| 556 | |||
| 557 | if (state != PWRDM_POWER_RET) | ||
| 558 | return PWRDM_POWER_RET; | ||
| 559 | |||
| 560 | return omap4_pwrdm_read_mem_retst(pwrdm, bank); | ||
| 561 | } | ||
| 562 | |||
| 563 | static int omap4_pwrdm_wait_transition(struct powerdomain *pwrdm) | ||
| 564 | { | ||
| 565 | u32 c = 0; | ||
| 566 | |||
| 567 | /* | ||
| 568 | * REVISIT: pwrdm_wait_transition() may be better implemented | ||
| 569 | * via a callback and a periodic timer check -- how long do we expect | ||
| 570 | * powerdomain transitions to take? | ||
| 571 | */ | ||
| 572 | |||
| 573 | /* XXX Is this udelay() value meaningful? */ | ||
| 574 | while ((omap4_prminst_read_inst_reg(pwrdm->prcm_partition, | ||
| 575 | pwrdm->prcm_offs, | ||
| 576 | OMAP4_PM_PWSTST) & | ||
| 577 | OMAP_INTRANSITION_MASK) && | ||
| 578 | (c++ < PWRDM_TRANSITION_BAILOUT)) | ||
| 579 | udelay(1); | ||
| 580 | |||
| 581 | if (c > PWRDM_TRANSITION_BAILOUT) { | ||
| 582 | pr_err("powerdomain: %s: waited too long to complete transition\n", | ||
| 583 | pwrdm->name); | ||
| 584 | return -EAGAIN; | ||
| 299 | } | 585 | } |
| 586 | |||
| 587 | pr_debug("powerdomain: completed transition in %d loops\n", c); | ||
| 588 | |||
| 300 | return 0; | 589 | return 0; |
| 301 | } | 590 | } |
| 302 | subsys_initcall(omap4xxx_prcm_init); | 591 | |
| 592 | struct pwrdm_ops omap4_pwrdm_operations = { | ||
| 593 | .pwrdm_set_next_pwrst = omap4_pwrdm_set_next_pwrst, | ||
| 594 | .pwrdm_read_next_pwrst = omap4_pwrdm_read_next_pwrst, | ||
| 595 | .pwrdm_read_pwrst = omap4_pwrdm_read_pwrst, | ||
| 596 | .pwrdm_read_prev_pwrst = omap4_pwrdm_read_prev_pwrst, | ||
| 597 | .pwrdm_set_lowpwrstchange = omap4_pwrdm_set_lowpwrstchange, | ||
| 598 | .pwrdm_clear_all_prev_pwrst = omap4_pwrdm_clear_all_prev_pwrst, | ||
| 599 | .pwrdm_set_logic_retst = omap4_pwrdm_set_logic_retst, | ||
| 600 | .pwrdm_read_logic_pwrst = omap4_pwrdm_read_logic_pwrst, | ||
| 601 | .pwrdm_read_prev_logic_pwrst = omap4_pwrdm_read_prev_logic_pwrst, | ||
| 602 | .pwrdm_read_logic_retst = omap4_pwrdm_read_logic_retst, | ||
| 603 | .pwrdm_read_mem_pwrst = omap4_pwrdm_read_mem_pwrst, | ||
| 604 | .pwrdm_read_mem_retst = omap4_pwrdm_read_mem_retst, | ||
| 605 | .pwrdm_read_prev_mem_pwrst = omap4_pwrdm_read_prev_mem_pwrst, | ||
| 606 | .pwrdm_set_mem_onst = omap4_pwrdm_set_mem_onst, | ||
| 607 | .pwrdm_set_mem_retst = omap4_pwrdm_set_mem_retst, | ||
| 608 | .pwrdm_wait_transition = omap4_pwrdm_wait_transition, | ||
| 609 | }; | ||
| 610 | |||
| 611 | /* | ||
| 612 | * XXX document | ||
| 613 | */ | ||
| 614 | static struct prm_ll_data omap44xx_prm_ll_data = { | ||
| 615 | .read_reset_sources = &omap44xx_prm_read_reset_sources, | ||
| 616 | }; | ||
| 617 | |||
| 618 | static int __init omap44xx_prm_init(void) | ||
| 619 | { | ||
| 620 | int ret; | ||
| 621 | |||
| 622 | if (!cpu_is_omap44xx()) | ||
| 623 | return 0; | ||
| 624 | |||
| 625 | ret = prm_register(&omap44xx_prm_ll_data); | ||
| 626 | if (ret) | ||
| 627 | return ret; | ||
| 628 | |||
| 629 | omap44xx_prm_enable_io_wakeup(); | ||
| 630 | |||
| 631 | return omap_prcm_register_chain_handler(&omap4_prcm_irq_setup); | ||
| 632 | } | ||
| 633 | subsys_initcall(omap44xx_prm_init); | ||
| 634 | |||
| 635 | static void __exit omap44xx_prm_exit(void) | ||
| 636 | { | ||
| 637 | if (!cpu_is_omap44xx()) | ||
| 638 | return; | ||
| 639 | |||
| 640 | /* Should never happen */ | ||
| 641 | WARN(prm_unregister(&omap44xx_prm_ll_data), | ||
| 642 | "%s: prm_ll_data function pointer mismatch\n", __func__); | ||
| 643 | } | ||
| 644 | __exitcall(omap44xx_prm_exit); | ||
diff --git a/arch/arm/mach-omap2/prm44xx.h b/arch/arm/mach-omap2/prm44xx.h index ee72ae6bd8c9..c8e1accdc90e 100644 --- a/arch/arm/mach-omap2/prm44xx.h +++ b/arch/arm/mach-omap2/prm44xx.h | |||
| @@ -771,6 +771,8 @@ extern void omap44xx_prm_ocp_barrier(void); | |||
| 771 | extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask); | 771 | extern void omap44xx_prm_save_and_clear_irqen(u32 *saved_mask); |
| 772 | extern void omap44xx_prm_restore_irqen(u32 *saved_mask); | 772 | extern void omap44xx_prm_restore_irqen(u32 *saved_mask); |
| 773 | 773 | ||
| 774 | extern u32 omap44xx_prm_get_reset_sources(void); | ||
| 775 | |||
| 774 | # endif | 776 | # endif |
| 775 | 777 | ||
| 776 | #endif | 778 | #endif |
diff --git a/arch/arm/mach-omap2/prm_common.c b/arch/arm/mach-omap2/prm_common.c index 3442227d3f0b..f596e1e91ffd 100644 --- a/arch/arm/mach-omap2/prm_common.c +++ b/arch/arm/mach-omap2/prm_common.c | |||
| @@ -24,10 +24,11 @@ | |||
| 24 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
| 25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
| 26 | 26 | ||
| 27 | #include <plat/prcm.h> | ||
| 28 | |||
| 29 | #include "prm2xxx_3xxx.h" | 27 | #include "prm2xxx_3xxx.h" |
| 28 | #include "prm2xxx.h" | ||
| 29 | #include "prm3xxx.h" | ||
| 30 | #include "prm44xx.h" | 30 | #include "prm44xx.h" |
| 31 | #include "common.h" | ||
| 31 | 32 | ||
| 32 | /* | 33 | /* |
| 33 | * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs | 34 | * OMAP_PRCM_MAX_NR_PENDING_REG: maximum number of PRM_IRQ*_MPU regs |
| @@ -52,6 +53,16 @@ static struct irq_chip_generic **prcm_irq_chips; | |||
| 52 | */ | 53 | */ |
| 53 | static struct omap_prcm_irq_setup *prcm_irq_setup; | 54 | static struct omap_prcm_irq_setup *prcm_irq_setup; |
| 54 | 55 | ||
| 56 | /* prm_base: base virtual address of the PRM IP block */ | ||
| 57 | void __iomem *prm_base; | ||
| 58 | |||
| 59 | /* | ||
| 60 | * prm_ll_data: function pointers to SoC-specific implementations of | ||
| 61 | * common PRM functions | ||
| 62 | */ | ||
| 63 | static struct prm_ll_data null_prm_ll_data; | ||
| 64 | static struct prm_ll_data *prm_ll_data = &null_prm_ll_data; | ||
| 65 | |||
| 55 | /* Private functions */ | 66 | /* Private functions */ |
| 56 | 67 | ||
| 57 | /* | 68 | /* |
| @@ -318,64 +329,82 @@ err: | |||
| 318 | return -ENOMEM; | 329 | return -ENOMEM; |
| 319 | } | 330 | } |
| 320 | 331 | ||
| 321 | /* | 332 | /** |
| 322 | * Stubbed functions so that common files continue to build when | 333 | * omap2_set_globals_prm - set the PRM base address (for early use) |
| 323 | * custom builds are used | 334 | * @prm: PRM base virtual address |
| 324 | * XXX These are temporary and should be removed at the earliest possible | 335 | * |
| 325 | * opportunity | 336 | * XXX Will be replaced when the PRM/CM drivers are completed. |
| 326 | */ | 337 | */ |
| 327 | u32 __weak omap2_prm_read_mod_reg(s16 module, u16 idx) | 338 | void __init omap2_set_globals_prm(void __iomem *prm) |
| 328 | { | 339 | { |
| 329 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | 340 | prm_base = prm; |
| 330 | return 0; | ||
| 331 | } | 341 | } |
| 332 | 342 | ||
| 333 | void __weak omap2_prm_write_mod_reg(u32 val, s16 module, u16 idx) | 343 | /** |
| 344 | * prm_read_reset_sources - return the sources of the SoC's last reset | ||
| 345 | * | ||
| 346 | * Return a u32 bitmask representing the reset sources that caused the | ||
| 347 | * SoC to reset. The low-level per-SoC functions called by this | ||
| 348 | * function remap the SoC-specific reset source bits into an | ||
| 349 | * OMAP-common set of reset source bits, defined in | ||
| 350 | * arch/arm/mach-omap2/prm.h. Returns the standardized reset source | ||
| 351 | * u32 bitmask from the hardware upon success, or returns (1 << | ||
| 352 | * OMAP_UNKNOWN_RST_SRC_ID_SHIFT) if no low-level read_reset_sources() | ||
| 353 | * function was registered. | ||
| 354 | */ | ||
| 355 | u32 prm_read_reset_sources(void) | ||
| 334 | { | 356 | { |
| 335 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | 357 | u32 ret = 1 << OMAP_UNKNOWN_RST_SRC_ID_SHIFT; |
| 336 | } | ||
| 337 | 358 | ||
| 338 | u32 __weak omap2_prm_rmw_mod_reg_bits(u32 mask, u32 bits, | 359 | if (prm_ll_data->read_reset_sources) |
| 339 | s16 module, s16 idx) | 360 | ret = prm_ll_data->read_reset_sources(); |
| 340 | { | 361 | else |
| 341 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | 362 | WARN_ONCE(1, "prm: %s: no mapping function defined for reset sources\n", __func__); |
| 342 | return 0; | ||
| 343 | } | ||
| 344 | 363 | ||
| 345 | u32 __weak omap2_prm_set_mod_reg_bits(u32 bits, s16 module, s16 idx) | 364 | return ret; |
| 346 | { | ||
| 347 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | ||
| 348 | return 0; | ||
| 349 | } | 365 | } |
| 350 | 366 | ||
| 351 | u32 __weak omap2_prm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx) | 367 | /** |
| 368 | * prm_register - register per-SoC low-level data with the PRM | ||
| 369 | * @pld: low-level per-SoC OMAP PRM data & function pointers to register | ||
| 370 | * | ||
| 371 | * Register per-SoC low-level OMAP PRM data and function pointers with | ||
| 372 | * the OMAP PRM common interface. The caller must keep the data | ||
| 373 | * pointed to by @pld valid until it calls prm_unregister() and | ||
| 374 | * it returns successfully. Returns 0 upon success, -EINVAL if @pld | ||
| 375 | * is NULL, or -EEXIST if prm_register() has already been called | ||
| 376 | * without an intervening prm_unregister(). | ||
| 377 | */ | ||
| 378 | int prm_register(struct prm_ll_data *pld) | ||
| 352 | { | 379 | { |
| 353 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | 380 | if (!pld) |
| 354 | return 0; | 381 | return -EINVAL; |
| 355 | } | ||
| 356 | 382 | ||
| 357 | u32 __weak omap2_prm_read_mod_bits_shift(s16 domain, s16 idx, u32 mask) | 383 | if (prm_ll_data != &null_prm_ll_data) |
| 358 | { | 384 | return -EEXIST; |
| 359 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | ||
| 360 | return 0; | ||
| 361 | } | ||
| 362 | 385 | ||
| 363 | int __weak omap2_prm_is_hardreset_asserted(s16 prm_mod, u8 shift) | 386 | prm_ll_data = pld; |
| 364 | { | ||
| 365 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | ||
| 366 | return 0; | ||
| 367 | } | ||
| 368 | 387 | ||
| 369 | int __weak omap2_prm_assert_hardreset(s16 prm_mod, u8 shift) | ||
| 370 | { | ||
| 371 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | ||
| 372 | return 0; | 388 | return 0; |
| 373 | } | 389 | } |
| 374 | 390 | ||
| 375 | int __weak omap2_prm_deassert_hardreset(s16 prm_mod, u8 rst_shift, | 391 | /** |
| 376 | u8 st_shift) | 392 | * prm_unregister - unregister per-SoC low-level data & function pointers |
| 393 | * @pld: low-level per-SoC OMAP PRM data & function pointers to unregister | ||
| 394 | * | ||
| 395 | * Unregister per-SoC low-level OMAP PRM data and function pointers | ||
| 396 | * that were previously registered with prm_register(). The | ||
| 397 | * caller may not destroy any of the data pointed to by @pld until | ||
| 398 | * this function returns successfully. Returns 0 upon success, or | ||
| 399 | * -EINVAL if @pld is NULL or if @pld does not match the struct | ||
| 400 | * prm_ll_data * previously registered by prm_register(). | ||
| 401 | */ | ||
| 402 | int prm_unregister(struct prm_ll_data *pld) | ||
| 377 | { | 403 | { |
| 378 | WARN(1, "prm: omap2xxx/omap3xxx specific function called on non-omap2xxx/3xxx\n"); | 404 | if (!pld || prm_ll_data != pld) |
| 405 | return -EINVAL; | ||
| 406 | |||
| 407 | prm_ll_data = &null_prm_ll_data; | ||
| 408 | |||
| 379 | return 0; | 409 | return 0; |
| 380 | } | 410 | } |
| 381 | |||
diff --git a/arch/arm/mach-omap2/prminst44xx.h b/arch/arm/mach-omap2/prminst44xx.h index 46f2efb36596..a2ede2d65481 100644 --- a/arch/arm/mach-omap2/prminst44xx.h +++ b/arch/arm/mach-omap2/prminst44xx.h | |||
| @@ -30,4 +30,6 @@ extern int omap4_prminst_assert_hardreset(u8 shift, u8 part, s16 inst, | |||
| 30 | extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, | 30 | extern int omap4_prminst_deassert_hardreset(u8 shift, u8 part, s16 inst, |
| 31 | u16 rstctrl_offs); | 31 | u16 rstctrl_offs); |
| 32 | 32 | ||
| 33 | extern 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 c64ee1904be8..dae7e4804a48 100644 --- a/arch/arm/mach-omap2/sdrc.c +++ b/arch/arm/mach-omap2/sdrc.c | |||
| @@ -112,12 +112,10 @@ int omap2_sdrc_get_params(unsigned long r, | |||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | 114 | ||
| 115 | void __init omap2_set_globals_sdrc(struct omap_globals *omap2_globals) | 115 | void __init omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms) |
| 116 | { | 116 | { |
| 117 | if (omap2_globals->sdrc) | 117 | omap2_sdrc_base = sdrc; |
| 118 | omap2_sdrc_base = omap2_globals->sdrc; | 118 | omap2_sms_base = sms; |
| 119 | if (omap2_globals->sms) | ||
| 120 | omap2_sms_base = omap2_globals->sms; | ||
| 121 | } | 119 | } |
| 122 | 120 | ||
| 123 | /** | 121 | /** |
diff --git a/arch/arm/mach-omap2/sdrc.h b/arch/arm/mach-omap2/sdrc.h index 69c4b329452e..446aa13511fd 100644 --- a/arch/arm/mach-omap2/sdrc.h +++ b/arch/arm/mach-omap2/sdrc.h | |||
| @@ -51,6 +51,8 @@ static inline u32 sms_read_reg(u16 reg) | |||
| 51 | return __raw_readl(OMAP_SMS_REGADDR(reg)); | 51 | return __raw_readl(OMAP_SMS_REGADDR(reg)); |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | extern void omap2_set_globals_sdrc(void __iomem *sdrc, void __iomem *sms); | ||
| 55 | |||
| 54 | 56 | ||
| 55 | /** | 57 | /** |
| 56 | * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate | 58 | * struct omap_sdrc_params - SDRC parameters for a given SDRC clock rate |
diff --git a/arch/arm/mach-omap2/sdrc2xxx.c b/arch/arm/mach-omap2/sdrc2xxx.c index 20cc950db4de..907291714643 100644 --- a/arch/arm/mach-omap2/sdrc2xxx.c +++ b/arch/arm/mach-omap2/sdrc2xxx.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | #include "soc.h" | 27 | #include "soc.h" |
| 28 | #include "iomap.h" | 28 | #include "iomap.h" |
| 29 | #include "common.h" | 29 | #include "common.h" |
| 30 | #include "prm2xxx_3xxx.h" | 30 | #include "prm2xxx.h" |
| 31 | #include "clock.h" | 31 | #include "clock.h" |
| 32 | #include "sdrc.h" | 32 | #include "sdrc.h" |
| 33 | #include "sram.h" | 33 | #include "sram.h" |
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S index 7046c3c67181..d1dedc8195ed 100644 --- a/arch/arm/mach-omap2/sleep34xx.S +++ b/arch/arm/mach-omap2/sleep34xx.S | |||
| @@ -28,8 +28,8 @@ | |||
| 28 | 28 | ||
| 29 | #include "omap34xx.h" | 29 | #include "omap34xx.h" |
| 30 | #include "iomap.h" | 30 | #include "iomap.h" |
| 31 | #include "cm2xxx_3xxx.h" | 31 | #include "cm3xxx.h" |
| 32 | #include "prm2xxx_3xxx.h" | 32 | #include "prm3xxx.h" |
| 33 | #include "sdrc.h" | 33 | #include "sdrc.h" |
| 34 | #include "sram.h" | 34 | #include "sram.h" |
| 35 | #include "control.h" | 35 | #include "control.h" |
diff --git a/arch/arm/mach-omap2/sram242x.S b/arch/arm/mach-omap2/sram242x.S index 8f7326cd435b..680a7c56cc3e 100644 --- a/arch/arm/mach-omap2/sram242x.S +++ b/arch/arm/mach-omap2/sram242x.S | |||
| @@ -34,8 +34,8 @@ | |||
| 34 | 34 | ||
| 35 | #include "soc.h" | 35 | #include "soc.h" |
| 36 | #include "iomap.h" | 36 | #include "iomap.h" |
| 37 | #include "prm2xxx_3xxx.h" | 37 | #include "prm2xxx.h" |
| 38 | #include "cm2xxx_3xxx.h" | 38 | #include "cm2xxx.h" |
| 39 | #include "sdrc.h" | 39 | #include "sdrc.h" |
| 40 | 40 | ||
| 41 | .text | 41 | .text |
diff --git a/arch/arm/mach-omap2/sram243x.S b/arch/arm/mach-omap2/sram243x.S index b140d6578529..a1e9edd673f4 100644 --- a/arch/arm/mach-omap2/sram243x.S +++ b/arch/arm/mach-omap2/sram243x.S | |||
| @@ -34,8 +34,8 @@ | |||
| 34 | 34 | ||
| 35 | #include "soc.h" | 35 | #include "soc.h" |
| 36 | #include "iomap.h" | 36 | #include "iomap.h" |
| 37 | #include "prm2xxx_3xxx.h" | 37 | #include "prm2xxx.h" |
| 38 | #include "cm2xxx_3xxx.h" | 38 | #include "cm2xxx.h" |
| 39 | #include "sdrc.h" | 39 | #include "sdrc.h" |
| 40 | 40 | ||
| 41 | .text | 41 | .text |
diff --git a/arch/arm/mach-omap2/sram34xx.S b/arch/arm/mach-omap2/sram34xx.S index 2d0ceaa23fb8..1446331b576a 100644 --- a/arch/arm/mach-omap2/sram34xx.S +++ b/arch/arm/mach-omap2/sram34xx.S | |||
| @@ -32,7 +32,7 @@ | |||
| 32 | #include "soc.h" | 32 | #include "soc.h" |
| 33 | #include "iomap.h" | 33 | #include "iomap.h" |
| 34 | #include "sdrc.h" | 34 | #include "sdrc.h" |
| 35 | #include "cm2xxx_3xxx.h" | 35 | #include "cm3xxx.h" |
| 36 | 36 | ||
| 37 | /* | 37 | /* |
| 38 | * This file needs be built unconditionally as ARM to interoperate correctly | 38 | * This file needs be built unconditionally as ARM to interoperate correctly |
diff --git a/arch/arm/mach-omap2/ti81xx.h b/arch/arm/mach-omap2/ti81xx.h index 8f9843f78422..a1e6caf0dba6 100644 --- a/arch/arm/mach-omap2/ti81xx.h +++ b/arch/arm/mach-omap2/ti81xx.h | |||
| @@ -22,6 +22,15 @@ | |||
| 22 | #define TI81XX_CTRL_BASE TI81XX_SCM_BASE | 22 | #define TI81XX_CTRL_BASE TI81XX_SCM_BASE |
| 23 | #define TI81XX_PRCM_BASE 0x48180000 | 23 | #define TI81XX_PRCM_BASE 0x48180000 |
| 24 | 24 | ||
| 25 | /* | ||
| 26 | * Adjust TAP register base such that omap3_check_revision accesses the correct | ||
| 27 | * TI81XX register for checking device ID (it adds 0x204 to tap base while | ||
| 28 | * TI81XX DEVICE ID register is at offset 0x600 from control base). | ||
| 29 | */ | ||
| 30 | #define TI81XX_TAP_BASE (TI81XX_CTRL_BASE + \ | ||
| 31 | TI81XX_CONTROL_DEVICE_ID - 0x204) | ||
| 32 | |||
| 33 | |||
| 25 | #define TI81XX_ARM_INTC_BASE 0x48200000 | 34 | #define TI81XX_ARM_INTC_BASE 0x48200000 |
| 26 | 35 | ||
| 27 | #endif /* __ASM_ARCH_TI81XX_H */ | 36 | #endif /* __ASM_ARCH_TI81XX_H */ |
diff --git a/arch/arm/mach-omap2/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 | |||
| 32 | int omap2_wd_timer_disable(struct omap_hwmod *oh) | 35 | int 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 | |||
| 106 | static 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 | } | ||
| 133 | subsys_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 | |||
| 30 | u32 omap_prcm_get_reset_sources(void); | ||
| 31 | int 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, | |||
| 202 | static long omap_wdt_ioctl(struct file *file, unsigned int cmd, | 202 | static 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 | */ | ||
| 34 | struct omap_wd_timer_platform_data { | ||
| 35 | u32 (*read_reset_sources)(void); | ||
| 36 | }; | ||
| 37 | |||
| 38 | #endif | ||
