clockdomains: add OMAP2/3 clockdomain code, link 34xx clocks with clockdomains
Subsystems (5)
Paul Walmsley
maintainercover clockdomains: add OMAP2/3 clockdomain code, link 34xx clocks with clockdomains
Hi everyone,
This is the second version of the clockdomain patches. It:
. adds the IVA1 clockdomain in the DSP powerdomain, for OMAP2420 only
. replaces omap_type_t typedef with struct omap_chip_id
. removes all EXPORT_SYMBOLs - these can be added back in if clockdomain
code needs to be used from loadable PM modules - the expectation is that it will only be used from PM code
. creates _clkdm_lookup() to avoid potential race in clkdm_register()
. fixes several clockdomain platform flag bugs
. gets rid of tabs in comments
. is refreshed against current git head (e015fc7)
This version is tested against 3430SDP ES2.1, and compile-tested with N800 and 2430SDP configs. Size, diffstat have been updated below.
Thanks to Tony & Jouni for review and comments. More comments welcome,
- Paul
-------------------------
Hello,
this patch series adds a hardware control interface for OMAP2/3 clockdomains. Also added is clockdomain usecounting of underlying clocks, so hardware-supervised and software-supervised clockdomain transitions can occur correctly. The interface is fully documented in the code.
24xx clocks are not yet linked with clockdomains. This will be done in a later patchset.
This series must be applied after the powerdomain series, posted earlier.
Clockdomain code tested on 3430SDP ES2.1; also boot-tested on N800.
Many people at Nokia and TI provided commentary and review during the development of the clockdomain patches. Particular help came from (in alphabetical order): Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Igor Stoppa, and Richard Woodruff. Jouni Högander merits special mention; he took the original code and made it do what it was supposed to do on the hardware, testing and fixing many bugs.
-----------
size:
text data bss dec hex filename
3269405 152552 100736 3522693 35c085 vmlinux.3430sdp.orig 3272093 154920 100736 3527749 35d445 vmlinux.3430sdp
Paul Walmsley (4):
Subject: Integrate OMAP3 clocks with clockdomain code
Subject: encode OMAP2/3 clockdomains
Subject: connect clockdomain code to powerdomain code
Subject: add base OMAP2/3 clockdomain code
arch/arm/mach-omap2/Makefile | 3 arch/arm/mach-omap2/clock.c | 45 ++ arch/arm/mach-omap2/clock.h | 1 arch/arm/mach-omap2/clock34xx.c | 4 arch/arm/mach-omap2/clock34xx.h | 196 +++++++++- arch/arm/mach-omap2/clockdomain.c | 606 +++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clockdomains.h | 298 +++++++++++++++ arch/arm/mach-omap2/cm-regbits-24xx.h | 24 + arch/arm/mach-omap2/cm-regbits-34xx.h | 42 ++ arch/arm/mach-omap2/io.c | 4 arch/arm/mach-omap2/pm.c | 12 - arch/arm/mach-omap2/powerdomain.c | 132 +++++++ arch/arm/plat-omap/Kconfig | 12 + drivers/dsp/dspgateway/dsp_core.c | 2 include/asm-arm/arch-omap/clock.h | 4 include/asm-arm/arch-omap/clockdomain.h | 105 +++++ include/asm-arm/arch-omap/powerdomain.h | 16 + 17 files changed, 1457 insertions(+), 49 deletions(-) create mode 100644 arch/arm/mach-omap2/clockdomain.c create mode 100644 arch/arm/mach-omap2/clockdomains.h create mode 100644 include/asm-arm/arch-omap/clockdomain.h
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Paul Walmsley
maintainerPATCH 1/4 clockdomains: add base OMAP2/3 clockdomain code
This patch creates an interface to the clockdomain registers in the PRM/CM modules on OMAP2/3. This interface is intended to be used by PM code, e.g., pm.c; not by device drivers directly.
The patch also adds clockdomain usecount tracking. This is intended to be called whenever the first clock in a clockdomain is enabled, or when the last enabled clock in a clockdomain is disabled. If the clockdomain is in software-supervised mode, the code will force-wakeup or force-sleep the clockdomain. If the clockdomain is in hardware-supervised mode, the first clock enable will add sleep and wakeup dependencies on a user-selectable set of parent domains (usually MPU & IVA2), and the disable will remove them.
Each clockdomain will be defined in later patches as static structures. The clockdomain structures are linked into a list at boot by clkdm_register(), similar to the OMAP clock code.
The patch adds a Kconfig option, CONFIG_OMAP_DEBUG_CLOCKDOMAIN, which when enabled will emit verbose debug messages via pr_debug().
---
arch/arm/mach-omap2/Makefile | 3 arch/arm/mach-omap2/clockdomain.c | 602 +++++++++++++++++++++++++++++++ arch/arm/plat-omap/Kconfig | 12 + include/asm-arm/arch-omap/clockdomain.h | 105 +++++ 4 files changed, 721 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-omap2/clockdomain.c create mode 100644 include/asm-arm/arch-omap/clockdomain.h
arch/arm/mach-omap2/Makefile +2 -1
@@ -4,7 +4,8 @@ # Common support obj-y := irq.o id.o io.o memory.o control.o prcm.o clock.o mux.o \ - devices.o serial.o gpmc.o timer-gp.o powerdomain.o + devices.o serial.o gpmc.o timer-gp.o powerdomain.o \ + clockdomain.o # Functions loaded to SRAM obj-$(CONFIG_ARCH_OMAP2) += sram24xx.o
arch/arm/mach-omap2/clockdomain.c new file +602 -0
602 lines not on this page · raw message
arch/arm/plat-omap/Kconfig +12 -0
@@ -54,6 +54,18 @@ config OMAP_DEBUG_POWERDOMAIN for every powerdomain register write. However, the extra detail costs some memory. +config OMAP_DEBUG_CLOCKDOMAIN + bool "Emit debug messages from clockdomain layer" + depends on ARCH_OMAP2 || ARCH_OMAP3 + default n + help + Say Y here if you want to compile in clockdomain layer + debugging messages for OMAP2/3. These messages can + provide more detail as to why some clockdomain calls + may be failing, and will also emit a descriptive message + for every clockdomain register write. However, the + extra detail costs some memory. + config OMAP_RESET_CLOCKS bool "Reset unused clocks during boot" depends on ARCH_OMAP
include/asm-arm/arch-omap/clockdomain.h new file +105 -0
105 lines not on this page · raw message
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Paul Walmsley
maintainerPATCH 2/4 clockdomains: connect clockdomain code to powerdomain code
In reply to Paul WalmsleyThie patch adds code to the powerdomain layer to track the clockdomains associated with each powerdomain.
It also modifies the clockdomain code to register clockdomains with their corresponding powerdomain when the clockdomain is registered.
---
arch/arm/mach-omap2/clockdomain.c | 4 + arch/arm/mach-omap2/powerdomain.c | 132 +++++++++++++++++++++++++++++++ include/asm-arm/arch-omap/powerdomain.h | 16 ++++ 3 files changed, 152 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clockdomain.c +4 -0
@@ -218,6 +218,8 @@ int clkdm_register(struct clockdomain *clkdm)list_add (&clkdm->node, &clkdm_list); +pwrdm_add_clkdm (pwrdm, clkdm); +pr_debug ("clockdomain: registered %s\n" , clkdm->name); ret =0 ;
@@ -239,6 +241,8 @@ int clkdm_unregister(struct clockdomain *clkdm)if (!clkdm)return -EINVAL ; +pwrdm_del_clkdm (clkdm->pwrdm, clkdm); +mutex_lock (&clkdm_mutex);list_del (&clkdm->node);mutex_unlock (&clkdm_mutex);
arch/arm/mach-omap2/powerdomain.c +132 -0
144 lines not on this page · raw message
include/asm-arm/arch-omap/powerdomain.h +16 -0
@@ -44,9 +44,16 @@*/ #define PWRDM_MAX_MEM_BANKS 4 +/* +* Maximum number of clockdomains that can be associated with a powerdomain. +* CORE powerdomain is probably the worst case. +*/ +#define PWRDM_MAX_CLKDMS 3 +/* XXX A completely arbitrary number. What is reasonable here? */ #define PWRDM_TRANSITION_BAILOUT 100000 +struct clockdomain ;struct powerdomain ;/* Encodes dependencies between powerdomains - statically defined */
@@ -98,6 +105,9 @@ struct powerdomain {/* Possible memory bank pwrstates when pwrdm is ON */ const u8 pwrsts_mem_on[PWRDM_MAX_MEM_BANKS ]; +/* Clockdomains in this powerdomain */ +struct clockdomain *pwrdm_clkdms[PWRDM_MAX_CLKDMS ]; +struct list_head node; };
@@ -111,6 +121,12 @@ struct powerdomain *pwrdm_lookup(const char *name);int pwrdm_for_each (int (*fn)(struct powerdomain *pwrdm)); +int pwrdm_add_clkdm (struct powerdomain *pwrdm,struct clockdomain *clkdm); +int pwrdm_del_clkdm (struct powerdomain *pwrdm,struct clockdomain *clkdm); +int pwrdm_for_each_clkdm (struct powerdomain *pwrdm, +int (*fn)(struct powerdomain *pwrdm, +struct clockdomain *clkdm)); +int pwrdm_add_wkdep (struct powerdomain *pwrdm1,struct powerdomain *pwrdm2);int pwrdm_del_wkdep (struct powerdomain *pwrdm1,struct powerdomain *pwrdm2);int pwrdm_read_wkdep (struct powerdomain *pwrdm1,struct powerdomain *pwrdm2);
Paul Walmsley
maintainerPATCH 3/4 clockdomains: encode OMAP2/3 clockdomains
In reply to Paul WalmsleyAdd clockdomain definitions for OMAP24xx and OMAP34xx chips.
---
arch/arm/mach-omap2/clockdomains.h | 298 +++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/cm-regbits-24xx.h | 24 ++- arch/arm/mach-omap2/cm-regbits-34xx.h | 42 +++-- arch/arm/mach-omap2/io.c | 4 arch/arm/mach-omap2/pm.c | 12 + drivers/dsp/dspgateway/dsp_core.c | 2 6 files changed, 357 insertions(+), 25 deletions(-) create mode 100644 arch/arm/mach-omap2/clockdomains.h
arch/arm/mach-omap2/clockdomains.h new file +298 -0
@@ -0,0 +1,298 @@ +/* +* OMAP2/3 clockdomains +* +* Copyright (C) 2008 Texas Instruments, Inc. +* Copyright (C) 2008 Nokia Corporation +* +* Written by Paul Walmsley +*/ + +#ifndef __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_H +#define __ARCH_ARM_MACH_OMAP2_CLOCKDOMAINS_H + +#include <asm/arch/clockdomain.h> + +/* +* OMAP2/3-common clockdomains +*/ + +/* This is an implicit clockdomain - it is never defined as such in TRM */ +static struct clockdomain wkup_clkdm = { + .name ="wkup_clkdm" , + .pwrdm_name ="wkup_pwrdm" , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX |CHIP_IS_OMAP3430 ), +}; + +/* +* 2420-only clockdomains +*/ + +#if defined(CONFIG_ARCH_OMAP2420 ) + +static struct clockdomain mpu_2420_clkdm = { + .name ="mpu_clkdm" , + .pwrdm_name ="mpu_pwrdm" , + .flags =CLKDM_CAN_HWSUP , + .clktrctrl_mask =OMAP24XX_AUTOSTATE_MPU_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2420 ), +}; + +static struct clockdomain iva1_2420_clkdm = { + .name ="iva1_clkdm" , + .pwrdm_name ="dsp_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP2420_AUTOSTATE_IVA_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2420 ), +}; + +#endif /* CONFIG_ARCH_OMAP2420 */ + + +/* +* 2430-only clockdomains +*/ + +#if defined(CONFIG_ARCH_OMAP2430 ) + +static struct clockdomain mpu_2430_clkdm = { + .name ="mpu_clkdm" , + .pwrdm_name ="mpu_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP24XX_AUTOSTATE_MPU_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2430 ), +}; + +static struct clockdomain mdm_clkdm = { + .name ="mdm_clkdm" , + .pwrdm_name ="mdm_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP2430_AUTOSTATE_MDM_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP2430 ), +}; + +#endif /* CONFIG_ARCH_OMAP2430 */ + + +/* +* 24XX-only clockdomains +*/ + +#if defined(CONFIG_ARCH_OMAP24XX ) + +static struct clockdomain dsp_clkdm = { + .name ="dsp_clkdm" , + .pwrdm_name ="dsp_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP24XX_AUTOSTATE_DSP_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX ), +}; + +static struct clockdomain gfx_24xx_clkdm = { + .name ="gfx_clkdm" , + .pwrdm_name ="gfx_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP24XX_AUTOSTATE_GFX_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX ), +}; + +static struct clockdomain core_l3_24xx_clkdm = { + .name ="core_l3_clkdm" , + .pwrdm_name ="core_pwrdm" , + .flags =CLKDM_CAN_HWSUP , + .clktrctrl_mask =OMAP24XX_AUTOSTATE_L3_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX ), +}; + +static struct clockdomain core_l4_24xx_clkdm = { + .name ="core_l4_clkdm" , + .pwrdm_name ="core_pwrdm" , + .flags =CLKDM_CAN_HWSUP , + .clktrctrl_mask =OMAP24XX_AUTOSTATE_L4_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX ), +}; + +static struct clockdomain dss_24xx_clkdm = { + .name ="dss_clkdm" , + .pwrdm_name ="core_pwrdm" , + .flags =CLKDM_CAN_HWSUP , + .clktrctrl_mask =OMAP24XX_AUTOSTATE_DSS_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP24XX ), +}; + +#endif /* CONFIG_ARCH_OMAP24XX */ + + +/* +* 34xx clockdomains +*/ + +#if defined(CONFIG_ARCH_OMAP34XX ) + +static struct clockdomain mpu_34xx_clkdm = { + .name ="mpu_clkdm" , + .pwrdm_name ="mpu_pwrdm" , + .flags =CLKDM_CAN_HWSUP |CLKDM_CAN_FORCE_WAKEUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_MPU_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain neon_clkdm = { + .name ="neon_clkdm" , + .pwrdm_name ="neon_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_NEON_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain iva2_clkdm = { + .name ="iva2_clkdm" , + .pwrdm_name ="iva2_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_IVA2_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain gfx_3430es1_clkdm = { + .name ="gfx_clkdm" , + .pwrdm_name ="gfx_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP3430ES1_CLKTRCTRL_GFX_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES1 ), +}; + +static struct clockdomain sgx_clkdm = { + .name ="sgx_clkdm" , + .pwrdm_name ="sgx_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP3430ES2_CLKTRCTRL_SGX_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), +}; + +static struct clockdomain d2d_clkdm = { + .name ="d2d_clkdm" , + .pwrdm_name ="core_pwrdm" , + .flags =CLKDM_CAN_HWSUP , + .clktrctrl_mask =OMAP3430ES1_CLKTRCTRL_D2D_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES1 ), +}; + +static struct clockdomain core_l3_34xx_clkdm = { + .name ="core_l3_clkdm" , + .pwrdm_name ="core_pwrdm" , + .flags =CLKDM_CAN_HWSUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_L3_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain core_l4_34xx_clkdm = { + .name ="core_l4_clkdm" , + .pwrdm_name ="core_pwrdm" , + .flags =CLKDM_CAN_HWSUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_L4_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain dss_34xx_clkdm = { + .name ="dss_clkdm" , + .pwrdm_name ="dss_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_DSS_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain cam_clkdm = { + .name ="cam_clkdm" , + .pwrdm_name ="cam_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_CAM_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain usbhost_clkdm = { + .name ="usbhost_clkdm" , + .pwrdm_name ="usbhost_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP3430ES2_CLKTRCTRL_USBHOST_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430ES2 ), +}; + +static struct clockdomain per_clkdm = { + .name ="per_clkdm" , + .pwrdm_name ="per_pwrdm" , + .flags =CLKDM_CAN_HWSUP_SWSUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_PER_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +static struct clockdomain emu_clkdm = { + .name ="emu_clkdm" , + .pwrdm_name ="emu_pwrdm" , + .flags =CLKDM_CAN_ENABLE_AUTO |CLKDM_CAN_SWSUP , + .clktrctrl_mask =OMAP3430_CLKTRCTRL_EMU_MASK , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ), +}; + +#endif /* CONFIG_ARCH_OMAP34XX */ + +/* +* Clockdomain-powerdomain hwsup dependencies (34XX only) +*/ + +static struct clkdm_pwrdm_autodep clkdm_pwrdm_autodeps[] = { + { + .pwrdm_name ="mpu_pwrdm" , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ) + }, + { + .pwrdm_name ="iva2_pwrdm" , + .omap_chip =OMAP_CHIP_INIT (CHIP_IS_OMAP3430 ) + }, + {NULL } +}; + +/* +* +*/ + +static struct clockdomain *clockdomains_omap[] = { + + &wkup_clkdm, + +#ifdef CONFIG_ARCH_OMAP2420 + &mpu_2420_clkdm, + &iva1_2420_clkdm, +#endif + +#ifdef CONFIG_ARCH_OMAP2430 + &mpu_2430_clkdm, + &mdm_clkdm, +#endif + +#ifdef CONFIG_ARCH_OMAP24XX + &dsp_clkdm, + &gfx_24xx_clkdm, + &core_l3_24xx_clkdm, + &core_l4_24xx_clkdm, + &dss_24xx_clkdm, +#endif + +#ifdef CONFIG_ARCH_OMAP34XX + &mpu_34xx_clkdm, + &neon_clkdm, + &iva2_clkdm, + &gfx_3430es1_clkdm, + &sgx_clkdm, + &d2d_clkdm, + &core_l3_34xx_clkdm, + &core_l4_34xx_clkdm, + &dss_34xx_clkdm, + &cam_clkdm, + &usbhost_clkdm, + &per_clkdm, + &emu_clkdm, +#endif + +NULL , +}; + +#endif
arch/arm/mach-omap2/cm-regbits-24xx.h +16 -8
@@ -63,7 +63,8 @@#define OMAP24XX_CLKSEL_MPU_MASK (0x1f << 0)/* CM_CLKSTCTRL_MPU */ -#define OMAP24XX_AUTOSTATE_MPU (1 << 0) +#define OMAP24XX_AUTOSTATE_MPU_SHIFT 0 +#define OMAP24XX_AUTOSTATE_MPU_MASK (1 << 0)/* CM_FCLKEN1_CORE specific bits*/ #define OMAP24XX_EN_TV_SHIFT 2
@@ -238,9 +239,12 @@#define OMAP24XX_CLKSEL_GPT2_MASK (0x3 << 2)/* CM_CLKSTCTRL_CORE */ -#define OMAP24XX_AUTOSTATE_DSS (1 << 2) -#define OMAP24XX_AUTOSTATE_L4 (1 << 1) -#define OMAP24XX_AUTOSTATE_L3 (1 << 0) +#define OMAP24XX_AUTOSTATE_DSS_SHIFT 2 +#define OMAP24XX_AUTOSTATE_DSS_MASK (1 << 2) +#define OMAP24XX_AUTOSTATE_L4_SHIFT 1 +#define OMAP24XX_AUTOSTATE_L4_MASK (1 << 1) +#define OMAP24XX_AUTOSTATE_L3_SHIFT 0 +#define OMAP24XX_AUTOSTATE_L3_MASK (1 << 0)/* CM_FCLKEN_GFX */ #define OMAP24XX_EN_3D_SHIFT 2
@@ -255,7 +259,8 @@/* CM_CLKSEL_GFX specific bits */ /* CM_CLKSTCTRL_GFX */ -#define OMAP24XX_AUTOSTATE_GFX (1 << 0) +#define OMAP24XX_AUTOSTATE_GFX_SHIFT 0 +#define OMAP24XX_AUTOSTATE_GFX_MASK (1 << 0)/* CM_FCLKEN_WKUP specific bits */
@@ -367,8 +372,10 @@#define OMAP24XX_CLKSEL_DSP_MASK (0x1f << 0)/* CM_CLKSTCTRL_DSP */ -#define OMAP2420_AUTOSTATE_IVA (1 << 8) -#define OMAP24XX_AUTOSTATE_DSP (1 << 0) +#define OMAP2420_AUTOSTATE_IVA_SHIFT 8 +#define OMAP2420_AUTOSTATE_IVA_MASK (1 << 8) +#define OMAP24XX_AUTOSTATE_DSP_SHIFT 0 +#define OMAP24XX_AUTOSTATE_DSP_MASK (1 << 0)/* CM_FCLKEN_MDM */ /* 2430 only */
@@ -396,6 +403,7 @@/* CM_CLKSTCTRL_MDM */ /* 2430 only */ -#define OMAP2430_AUTOSTATE_MDM (1 << 0) +#define OMAP2430_AUTOSTATE_MDM_SHIFT 0 +#define OMAP2430_AUTOSTATE_MDM_MASK (1 << 0)#endif
arch/arm/mach-omap2/cm-regbits-34xx.h +31 -11
101 lines not on this page · raw message
arch/arm/mach-omap2/io.c +4 -0
@@ -31,6 +31,9 @@#include "powerdomains.h" +#include <asm/arch/clockdomain.h> +#include "clockdomains.h" +extern void omap_sram_init (void );extern int omap2_clk_init (void );extern void omap2_check_revision (void );
@@ -193,6 +196,7 @@ void __init omap2_init_common_hw(void) {omap2_mux_init ();pwrdm_init (powerdomains_omap); +clkdm_init (clockdomains_omap, clkdm_pwrdm_autodeps);omap2_clk_init ();omap2_init_memory ();gpmc_init ();
arch/arm/mach-omap2/pm.c +7 -5
@@ -679,12 +679,14 @@ static void __init prcm_setup_regs(void) GFX_MOD, PM_PWSTCTRL);/* Enable clock auto control for all domains */ -cm_write_mod_reg (OMAP24XX_AUTOSTATE_MPU ,MPU_MOD ,CM_CLKSTCTRL ); -cm_write_mod_reg (OMAP24XX_AUTOSTATE_DSS |OMAP24XX_AUTOSTATE_L4 | -OMAP24XX_AUTOSTATE_L3 , +cm_write_mod_reg (OMAP24XX_AUTOSTATE_MPU_MASK ,MPU_MOD ,CM_CLKSTCTRL ); +cm_write_mod_reg (OMAP24XX_AUTOSTATE_DSS_MASK | +OMAP24XX_AUTOSTATE_L4_MASK | +OMAP24XX_AUTOSTATE_L3_MASK ,CORE_MOD ,CM_CLKSTCTRL ); -cm_write_mod_reg (OMAP24XX_AUTOSTATE_GFX ,GFX_MOD ,CM_CLKSTCTRL ); -cm_write_mod_reg (OMAP2420_AUTOSTATE_IVA |OMAP24XX_AUTOSTATE_DSP , +cm_write_mod_reg (OMAP24XX_AUTOSTATE_GFX_MASK ,GFX_MOD ,CM_CLKSTCTRL ); +cm_write_mod_reg (OMAP2420_AUTOSTATE_IVA_MASK | +OMAP24XX_AUTOSTATE_DSP_MASK ,OMAP24XX_DSP_MOD ,CM_CLKSTCTRL );/* Enable clock autoidle for all domains */
drivers/dsp/dspgateway/dsp_core.c +1 -1
@@ -467,7 +467,7 @@ static inline void dsp_clk_enable(void)cm_set_mod_reg_bits (OMAP2420_AUTO_DSP_IPI ,OMAP24XX_DSP_MOD ,CM_AUTOIDLE ); -cm_set_mod_reg_bits (OMAP24XX_AUTOSTATE_DSP ,OMAP24XX_DSP_MOD , +cm_set_mod_reg_bits (OMAP24XX_AUTOSTATE_DSP_MASK ,OMAP24XX_DSP_MOD ,CM_CLKSTCTRL );clk_enable (dsp_fck_handle);
Paul Walmsley
maintainerPATCH 4/4 clockdomains: integrate OMAP3 clocks with clockdomain code
In reply to Paul WalmsleyThis patch integrates the OMAP3 clock tree with the clockdomain code. This patch:
- marks OMAP34xx clocks with their corresponding clockdomain.
- adds code to convert the clockdomain name to a clockdomain pointer in the struct clk during clk_register().
- modifies OMAP2 clock usecounting to call into the clockdomain code when clocks are enabled or disabled.
---
arch/arm/mach-omap2/clock.c | 45 ++++++++ arch/arm/mach-omap2/clock.h | 1 arch/arm/mach-omap2/clock34xx.c | 4 + arch/arm/mach-omap2/clock34xx.h | 196 ++++++++++++++++++++++++++++++++++--- include/asm-arm/arch-omap/clock.h | 4 + 5 files changed, 227 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/clock.c +41 -4
@@ -62,10 +62,36 @@u8 cpu_mask;/*------------------------------------------------------------------------- -* Omap2 specific clock functions +* OMAP2/3 specific clock functions *-------------------------------------------------------------------------*/ /** +* omap2_init_clk_clkdm - look up a clockdomain name, store pointer in clk +* @clk: OMAP clock struct ptr to use +* +* Convert a clockdomain name stored in a struct clk 'clk' into a +* clockdomain pointer, and save it into the struct clk. Intended to be +* called during clk_register(). No return value. +*/ +void omap2_init_clk_clkdm (struct clk *clk) +{ +struct clockdomain *clkdm; + +if (!clk->clkdm_name) +return ; + + clkdm =clkdm_lookup (clk->clkdm_name); +if (clkdm) { +pr_debug ("clock: associated clk %s to clkdm %s\n" , + clk->name, clk->clkdm_name); + clk->clkdm = clkdm; + }else { +pr_debug ("clock: could not associate clk %s to " +"clkdm %s\n" , clk->name, clk->clkdm_name); + } +} + +/** * omap2_init_clksel_parent - set a clksel clk's parent field from the hardware * @clk: OMAP clock struct ptr to use *
@@ -308,6 +334,9 @@ void omap2_clk_disable(struct clk *clk)_omap2_clk_disable (clk);if (likely ((u32 )clk->parent))omap2_clk_disable (clk->parent); +if (clk->clkdm) +omap2_clkdm_clk_disable (clk->clkdm, clk); + } }
@@ -324,11 +353,19 @@ int omap2_clk_enable(struct clk *clk)return ret; } +if (clk->clkdm) +omap2_clkdm_clk_enable (clk->clkdm, clk); + ret =_omap2_clk_enable (clk); -if (unlikely (ret !=0 ) && clk->parent) { -omap2_clk_disable (clk->parent); - clk->usecount--; +if (unlikely (ret !=0 )) { +if (clk->clkdm) +omap2_clkdm_clk_disable (clk->clkdm, clk); + +if (clk->parent) { +omap2_clk_disable (clk->parent); + clk->usecount--; + } } }
arch/arm/mach-omap2/clock.h +1 -0
@@ -36,6 +36,7 @@ void omap2_clk_disable_unused(struct clk *clk);#endif void omap2_clksel_recalc (struct clk *clk); +void omap2_init_clk_clkdm (struct clk *clk);void omap2_init_clksel_parent (struct clk *clk);u32 omap2_clksel_get_divisor (struct clk *clk); u32 omap2_clksel_round_rate_div(struct clk *clk, unsigned long target_rate,
arch/arm/mach-omap2/clock34xx.c +3 -1
@@ -621,8 +621,10 @@ int __init omap2_clk_init(void)for (clkp = onchip_34xx_clks; clkp < onchip_34xx_clks +ARRAY_SIZE (onchip_34xx_clks); clkp++) { -if ((*clkp)->flags & cpu_clkflg) +if ((*clkp)->flags & cpu_clkflg) {clk_register (*clkp); +omap2_init_clk_clkdm (*clkp); + } }/* REVISIT: Not yet ready for OMAP3 */
arch/arm/mach-omap2/clock34xx.h +178 -18
1,138 lines not on this page · raw message
include/asm-arm/arch-omap/clock.h +4 -0
@@ -15,6 +15,8 @@#ifndef __ARCH_ARM_OMAP_CLOCK_H#define __ARCH_ARM_OMAP_CLOCK_H +#include <asm/arch/clockdomain.h> +struct module ;struct clk ;
@@ -82,6 +84,8 @@ struct clk {u32 clksel_mask;const struct clksel *clksel;struct dpll_data *dpll_data; +const char *clkdm_name; +struct clockdomain *clkdm;#else __u8 rate_offset;__u8 src_offset;
Tony Lindgren
maintainerQuoted 17 lines · Paul Walmsley
Hi everyone,
This is the second version of the clockdomain patches. It:
. adds the IVA1 clockdomain in the DSP powerdomain, for OMAP2420 only
. replaces
omap_type_ttypedef with structomap_chip_id. removes all
EXPORT_SYMBOLs- these can be added back in if clockdomain
code needs to be used from loadable PM modules - the expectation is that it will only be used from PM code. creates
_clkdm_lookup()to avoid potential race inclkdm_register(). fixes several clockdomain platform flag bugs
Quoted 8 lines
. gets rid of tabs in comments
. is refreshed against current git head (e015fc7)
This version is tested against 3430SDP ES2.1, and compile-tested with N800 and 2430SDP configs. Size, diffstat have been updated below.
Thanks to Tony & Jouni for review and comments. More comments welcome,
Pushing today.
Tony
Quoted 56 lines
- Paul
-------------------------
Hello,
this patch series adds a hardware control interface for OMAP2/3 clockdomains. Also added is clockdomain usecounting of underlying clocks, so hardware-supervised and software-supervised clockdomain transitions can occur correctly. The interface is fully documented in the code.
24xx clocks are not yet linked with clockdomains. This will be done in a later patchset.
This series must be applied after the powerdomain series, posted earlier.
Clockdomain code tested on 3430SDP ES2.1; also boot-tested on N800.
Many people at Nokia and TI provided commentary and review during the development of the clockdomain patches. Particular help came from (in alphabetical order): Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Igor Stoppa, and Richard Woodruff. Jouni Högander merits special mention; he took the original code and made it do what it was supposed to do on the hardware, testing and fixing many bugs.
-----------
size:
text data bss dec hex filename3269405 152552 100736 3522693 35c085 vmlinux.3430sdp.orig 3272093 154920 100736 3527749 35d445 vmlinux.3430sdpPaul Walmsley (4):
Subject: Integrate OMAP3 clocks with clockdomain code
Subject: encode OMAP2/3 clockdomains
Subject: connect clockdomain code to powerdomain code
Subject: add base OMAP2/3 clockdomain codearch/arm/mach-omap2/Makefile | 3 arch/arm/mach-omap2/clock.c | 45 ++ arch/arm/mach-omap2/clock.h | 1 arch/arm/mach-omap2/clock34xx.c | 4 arch/arm/mach-omap2/clock34xx.h | 196 +++++++++- arch/arm/mach-omap2/clockdomain.c | 606 +++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clockdomains.h | 298 +++++++++++++++ arch/arm/mach-omap2/cm-regbits-24xx.h | 24 + arch/arm/mach-omap2/cm-regbits-34xx.h | 42 ++ arch/arm/mach-omap2/io.c | 4 arch/arm/mach-omap2/pm.c | 12 - arch/arm/mach-omap2/powerdomain.c | 132 +++++++ arch/arm/plat-omap/Kconfig | 12 +
Quoted 9 lines
drivers/dsp/dspgateway/dsp_core.c | 2 include/asm-arm/arch-omap/clock.h | 4 include/asm-arm/arch-omap/clockdomain.h | 105 +++++ include/asm-arm/arch-omap/powerdomain.h | 16 + 17 files changed, 1457 insertions(+), 49 deletions(-) create mode 100644 arch/arm/mach-omap2/clockdomain.c create mode 100644 arch/arm/mach-omap2/clockdomains.h create mode 100644 include/asm-arm/arch-omap/clockdomain.h
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html