OMAP: more clock/powerdomain/hwmod patches for 2.6.34
Subsystems (7)
Paul Walmsley
maintainercover OMAP: more clock/powerdomain/hwmod patches for 2.6.34
Hello,
Here are some more OMAP clock, clockdomain, powerdomain, and hwmod patches intended for 2.6.34, posted in case anyone has any comments.
- Paul
---
Abhijit Pagare (1):
ARM: OMAP4 clock domain: Add check for avoiding dependency related update.
Kevin Hilman (4):
OMAP: omap_device: add omap_device_is_valid()
OMAP: omap_device: when 'called from invalid state', print state
OMAP3: clock: use std _MASK suffix for CM_FCLKEN_IVA2 defines OMAP2/3: PRCM: fix misc. compiler warnings
Mike Turquette (1):
OMAP3630: Clock: Workaround for DPLL HS divider limitation
Ranjith Lohithakshan (2):
OMAP2/3 clock: Extend find_idlest() to pass back idle state value
AM35xx: Add clock support for new modules on AM35xx
Richard Woodruff (1):
OMAP3 clock: introduce DPLL4 Jtype
Sanjeev Premi (1):
OMAP3 clock: Check return values for clk_get()
Tero Kristo (1):
OMAP3: Clock: Added IDLEST definitions for SGX
Thara Gopinath (5):
OMAP2/3 PM: Adding powerdomain APIs for reading the next logic and mem state OMAP3 PM: Defining .pwrsts_logic_ret field for core power domain structure OMAP3 PM: Adding counters for power domain logic off and mem off during retention.
OMAP3: hwmod: support to specify the offset position of various SYSCONFIG register bits.
OMAP: HWMOD: Add support for early device register into omap device layer
Vishwanath BS (3):
OMAP3 clock: Remove FreqSel for 3630
OMAP3 clock: Introduce 3630 DPLL4 HSDivider changes OMAP3 clock: add support for 192Mhz DPLL4M2 output
arch/arm/mach-omap2/Makefile | 3 arch/arm/mach-omap2/clkt2xxx_apll.c | 2 arch/arm/mach-omap2/clock.c | 25 +- arch/arm/mach-omap2/clock.h | 6 arch/arm/mach-omap2/clock2xxx.c | 5 arch/arm/mach-omap2/clock34xx.c | 167 +++++++++++ arch/arm/mach-omap2/clock34xx.h | 7 arch/arm/mach-omap2/clock34xx_data.c | 381 ++++++++++++++++++++++++- arch/arm/mach-omap2/clock44xx_data.c | 1 arch/arm/mach-omap2/clockdomain.c | 30 ++ arch/arm/mach-omap2/cm-regbits-34xx.h | 28 ++ arch/arm/mach-omap2/cm.h | 3 arch/arm/mach-omap2/dpll3xxx.c | 78 +++++ arch/arm/mach-omap2/id.c | 3 arch/arm/mach-omap2/omap_hwmod.c | 100 ++++++- arch/arm/mach-omap2/omap_hwmod_common_data.c | 44 +++ arch/arm/mach-omap2/pm-debug.c | 5 arch/arm/mach-omap2/pm34xx.c | 2 arch/arm/mach-omap2/powerdomain.c | 98 ++++++ arch/arm/mach-omap2/powerdomains34xx.h | 2 arch/arm/mach-omap2/prcm.c | 18 + arch/arm/plat-omap/include/plat/clock.h | 16 + arch/arm/plat-omap/include/plat/cpu.h | 2 arch/arm/plat-omap/include/plat/omap_device.h | 7 arch/arm/plat-omap/include/plat/omap_hwmod.h | 73 ++++- arch/arm/plat-omap/include/plat/powerdomain.h | 4 arch/arm/plat-omap/include/plat/prcm.h | 3 arch/arm/plat-omap/omap_device.c | 61 +++- 28 files changed, 1077 insertions(+), 97 deletions(-) create mode 100644 arch/arm/mach-omap2/omap_hwmod_common_data.c
Paul Walmsley
maintainerPATCH 1/19 OMAP: omap_device: add omap_device_is_valid()
From: Kevin Hilman <[email protected]>
The omap_device struct contains a 'struct platform_device'. Normally, converting a platform_device pointer to an omap_device pointer consists of simply doing a container_of(), as is done currently by the to_omap_device() macro.
However, if this is attempted when using platform_device that has not been created as part of the omap_device creation, the container_of() will point to a memory location before the platform_device pointer which will contain random data.
Therefore, we need a way to detect valid omap_device pointers. This patch solves this by using the simple magic number approach.
--- arch/arm/plat-omap/include/plat/omap_device.h | 2 ++ arch/arm/plat-omap/omap_device.c | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-)
arch/arm/plat-omap/include/plat/omap_device.h +2 -0
@@ -62,6 +62,7 @@* */ struct omap_device { +u32 magic;struct platform_device pdev;struct omap_hwmod **hwmods;struct omap_device_pm_latency *pm_lats;
@@ -81,6 +82,7 @@ int omap_device_shutdown(struct platform_device *pdev);/* Core code interface */ +bool omap_device_is_valid (struct omap_device *od);int omap_device_count_resources (struct omap_device *od);int omap_device_fill_resources (struct omap_device *od,struct resource *res);
arch/arm/plat-omap/omap_device.c +16 -0
@@ -90,6 +90,8 @@#define IGNORE_WAKEUP_LAT 1 +#define OMAP_DEVICE_MAGIC 0xf00dcafe +/* Private functions */ /**
@@ -403,6 +405,8 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, od->pm_lats = pm_lats; od->pm_lats_cnt = pm_lats_cnt; + od->magic =OMAP_DEVICE_MAGIC ; + ret =omap_device_register (od);if (ret) goto odbs_exit4;
@@ -589,6 +593,18 @@ int omap_device_align_pm_lat(struct platform_device *pdev, }/** +* omap_device_is_valid - Check if pointer is a valid omap_device +* @od: struct omap_device * +* +* Return whether struct omap_device pointer @od points to a valid +* omap_device. +*/ +bool omap_device_is_valid (struct omap_device *od) +{ +return (od && od->magic ==OMAP_DEVICE_MAGIC ); +} + +/** * omap_device_get_pwrdm - return the powerdomain * associated with @od * @od: struct omap_device * *
Paul Walmsley
maintainerPATCH 2/19 OMAP: omap_device: when 'called from invalid state', print state
In reply to Paul WalmsleyFrom: Kevin Hilman <[email protected]>
The omap_device_[enable|idle|shutdown] functions print a warning when called from an invalid state. Print the invalid state in the warning messages. This also uses __func__ to get the function name.
Also, move the entire print string onto a single line to facilitate grepping or error messages. Recent discussions on LKML show strong preference for grep-able code vs. strict 80 column limit.
--- arch/arm/plat-omap/omap_device.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
arch/arm/plat-omap/omap_device.c +6 -6
@@ -466,8 +466,8 @@ int omap_device_enable(struct platform_device *pdev) od =_find_by_pdev (pdev);if (od->_state ==OMAP_DEVICE_STATE_ENABLED ) { -WARN (1 ,"omap_device: %s.%d: omap_device_enable() called from " -"invalid state\n" , od->pdev.name, od->pdev.id); +WARN (1 ,"omap_device: %s.%d: %s() called from invalid state %d\n" , + od->pdev.name, od->pdev.id, __func__, od->_state);return -EINVAL ; }
@@ -505,8 +505,8 @@ int omap_device_idle(struct platform_device *pdev) od =_find_by_pdev (pdev);if (od->_state !=OMAP_DEVICE_STATE_ENABLED ) { -WARN (1 ,"omap_device: %s.%d: omap_device_idle() called from " -"invalid state\n" , od->pdev.name, od->pdev.id); +WARN (1 ,"omap_device: %s.%d: %s() called from invalid state %d\n" , + od->pdev.name, od->pdev.id, __func__, od->_state);return -EINVAL ; }
@@ -538,8 +538,8 @@ int omap_device_shutdown(struct platform_device *pdev)if (od->_state !=OMAP_DEVICE_STATE_ENABLED && od->_state !=OMAP_DEVICE_STATE_IDLE ) { -WARN (1 ,"omap_device: %s.%d: omap_device_shutdown() called " -"from invalid state\n" , od->pdev.name, od->pdev.id); +WARN (1 ,"omap_device: %s.%d: %s() called from invalid state %d\n" , + od->pdev.name, od->pdev.id, __func__, od->_state);return -EINVAL ; }
Paul Walmsley
maintainerPATCH 3/19 OMAP3: clock: use std _MASK suffix for CM_FCLKEN_IVA2 defines
In reply to Paul WalmsleyFrom: Kevin Hilman <[email protected]>
Add _MASK suffix to CM_FCLKEN_IVA2 bitfieds to conform with the rest of the usage in cm-regbits-34xx.h of using _SHIFT and _MASK suffixes.
--- arch/arm/mach-omap2/cm-regbits-34xx.h | 2 +- arch/arm/mach-omap2/pm34xx.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-omap2/cm-regbits-34xx.h +1 -1
@@ -55,7 +55,7 @@/* Bits specific to each register */ /* CM_FCLKEN_IVA2 */ -#define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2 (1 << 0) +#define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_MASK (1 << 0)#define OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_SHIFT 0/* CM_CLKEN_PLL_IVA2 */
arch/arm/mach-omap2/pm34xx.c +1 -1
@@ -688,7 +688,7 @@ static void __init omap3_iva_idle(void) OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);/* Enable IVA2 clock */ -cm_write_mod_reg (OMAP3430_CM_FCLKEN_IVA2_EN_IVA2 , +cm_write_mod_reg (OMAP3430_CM_FCLKEN_IVA2_EN_IVA2_MASK ,OMAP3430_IVA2_MOD ,CM_FCLKEN );/* Set IVA2 boot mode to 'idle' */
Paul Walmsley
maintainerPATCH 4/19 OMAP3: Clock: Added IDLEST definitions for SGX
In reply to Paul WalmsleyFrom: Tero Kristo <[email protected]>
Added definitions for OMAP3430ES2_ST_SGX_SHIFT and OMAP3430ES2_ST_SGX_MASK as these were missing.
--- arch/arm/mach-omap2/cm-regbits-34xx.h | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/cm-regbits-34xx.h +4 -0
@@ -379,6 +379,10 @@#define OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_SHIFT 1#define OMAP3430ES2_CM_FCLKEN_SGX_EN_SGX_MASK (1 << 1) +/* CM_IDLEST_SGX */ +#define OMAP3430ES2_ST_SGX_SHIFT 1 +#define OMAP3430ES2_ST_SGX_MASK (1 << 1) +/* CM_ICLKEN_SGX */ #define OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_SHIFT 0#define OMAP3430ES2_CM_ICLKEN_SGX_EN_SGX_MASK (1 << 0)
Paul Walmsley
maintainerPATCH 5/19 OMAP2/3 PM: Adding powerdomain APIs for reading the next logic and mem state
In reply to Paul WalmsleyFrom: Thara Gopinath <[email protected]>
This patch adds APIs pwrdm_read_logic_retst and pwrdm_read_mem_retst for reading the next programmed logic and memory state a powerdomain is to hit in event of the next power domain state being retention. These are needed for OSWR support.
--- arch/arm/mach-omap2/powerdomain.c | 73 +++++++++++++++++++++++++ arch/arm/plat-omap/include/plat/powerdomain.h | 2 + 2 files changed, 75 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomain.c +73 -0
@@ -679,6 +679,29 @@ int pwrdm_read_prev_logic_pwrst(struct powerdomain *pwrdm) }/** +* pwrdm_read_logic_retst - get next powerdomain logic power state +* @pwrdm: struct powerdomain * to get next logic power state +* +* Return the powerdomain pwrdm's logic power state. Returns -EINVAL +* if the powerdomain pointer is null or returns the next logic +* power state upon success. +*/ +int pwrdm_read_logic_retst (struct powerdomain *pwrdm) +{ +if (!pwrdm) +return -EINVAL ; + +/* +* The register bit names below may not correspond to the +* actual names of the bits in each powerdomain's register, +* but the type of value returned is the same for each +* powerdomain. +*/ +return prm_read_mod_bits_shift (pwrdm->prcm_offs, pwrstctrl_reg_offs, +OMAP3430_LOGICSTATEST ); +} + +/** * pwrdm_read_mem_pwrst - get current memory bank power state * @pwrdm: struct powerdomain * to get current memory bank power state * @bank: memory bank number (0-3)
@@ -785,6 +808,56 @@ int pwrdm_read_prev_mem_pwrst(struct powerdomain *pwrdm, u8 bank) }/** +* pwrdm_read_mem_retst - get next memory bank power state +* @pwrdm: struct powerdomain * to get mext memory bank power state +* @bank: memory bank number (0-3) +* +* Return the powerdomain pwrdm's next memory power state for bank +* x. Returns -EINVAL if the powerdomain pointer is null, -EEXIST if +* the target memory bank does not exist or is not controllable, or +* returns the next memory power state upon success. +*/ +int pwrdm_read_mem_retst (struct powerdomain *pwrdm,u8 bank) +{ +u32 m; + +if (!pwrdm) +return -EINVAL ; + +if (pwrdm->banks < (bank +1 )) +return -EEXIST ; + +/* +* The register bit names below may not correspond to the +* actual names of the bits in each powerdomain's register, +* but the type of value returned is the same for each +* powerdomain. +*/ +switch (bank) { +case 0 : + m =OMAP_MEM0_RETSTATE_MASK ; +break ; +case 1 : + m =OMAP_MEM1_RETSTATE_MASK ; +break ; +case 2 : + m =OMAP_MEM2_RETSTATE_MASK ; +break ; +case 3 : + m =OMAP_MEM3_RETSTATE_MASK ; +break ; +case 4 : + m =OMAP_MEM4_RETSTATE_MASK ; +default : +WARN_ON (1 );/* should never happen */ +return -EEXIST ; + } + +return prm_read_mod_bits_shift (pwrdm->prcm_offs, + pwrstctrl_reg_offs, m); +} + +/** * pwrdm_clear_all_prev_pwrst - clear previous powerstate register for a pwrdm * @pwrdm: struct powerdomain * to clear *
arch/arm/plat-omap/include/plat/powerdomain.h +2 -0
@@ -137,8 +137,10 @@ int pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst);int pwrdm_read_logic_pwrst (struct powerdomain *pwrdm);int pwrdm_read_prev_logic_pwrst (struct powerdomain *pwrdm); +int pwrdm_read_logic_retst (struct powerdomain *pwrdm);int pwrdm_read_mem_pwrst (struct powerdomain *pwrdm,u8 bank);int pwrdm_read_prev_mem_pwrst (struct powerdomain *pwrdm,u8 bank); +int pwrdm_read_mem_retst (struct powerdomain *pwrdm,u8 bank);int pwrdm_enable_hdwr_sar (struct powerdomain *pwrdm);int pwrdm_disable_hdwr_sar (struct powerdomain *pwrdm);
Paul Walmsley
maintainerPATCH 6/19 OMAP3 PM: Defining .pwrsts_logic_ret field for core power domain structure
In reply to Paul WalmsleyFrom: Thara Gopinath <[email protected]>
This patch adds the flag .pwrsts_logic_ret info for the core power domain in the associated powerdomain structure. This flag specifies the states core domain logic can hit in event of the domain entering retention.
--- arch/arm/mach-omap2/powerdomains34xx.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/powerdomains34xx.h +2 -0
@@ -82,6 +82,7 @@ static struct powerdomain core_3xxx_pre_es3_1_pwrdm = {CHIP_IS_OMAP3430ES2 | CHIP_IS_OMAP3430ES3_0), .pwrsts = PWRSTS_OFF_RET_ON, + .pwrsts_logic_ret = PWRSTS_OFF_RET, .banks = 2, .pwrsts_mem_ret = { [0] = PWRSTS_OFF_RET, /* MEM1RETSTATE */
@@ -98,6 +99,7 @@ static struct powerdomain core_3xxx_es3_1_pwrdm = { .prcm_offs = CORE_MOD, .omap_chip = OMAP_CHIP_INIT(CHIP_GE_OMAP3430ES3_1), .pwrsts = PWRSTS_OFF_RET_ON, + .pwrsts_logic_ret = PWRSTS_OFF_RET, .flags = PWRDM_HAS_HDWR_SAR, /* for USBTLL only */ .banks = 2, .pwrsts_mem_ret = {
Paul Walmsley
maintainerPATCH 7/19 OMAP3 PM: Adding counters for power domain logic off and mem off during retention.
In reply to Paul WalmsleyFrom: Thara Gopinath <[email protected]>
This patch adds counters to keep track of whether the powerdomain logic or software controllable memory banks are turned off when the power domain enters retention. During power domain retention if logic gets turned off, the scenario is known as Open Switch Retention. Also during retention s/w controllable memory banks of a power domain can be chosen to be kept in retention or off.
This patch adds one counter per powerdomain to track the power domain logic state during retention. Number of memory bank state counters added depends on the number of software controllable memory banks of the powerdomain. To view these counters do
cat ../debug/pm_debug/count
[paul at pwsan.com: conditional expressions simplified; counter increment
code moved to its own function]
--- arch/arm/mach-omap2/pm-debug.c | 5 +++++ arch/arm/mach-omap2/powerdomain.c | 25 +++++++++++++++++++++++++ arch/arm/plat-omap/include/plat/powerdomain.h | 2 ++ 3 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/pm-debug.c +5 -0
@@ -385,6 +385,11 @@ static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user)seq_printf (s,",%s:%d" , pwrdm_state_names[i], pwrdm->state_counter[i]); +seq_printf (s,",RET-LOGIC-OFF:%d" , pwrdm->ret_logic_off_counter); +for (i =0 ; i < pwrdm->banks; i++) +seq_printf (s,",RET-MEMBANK%d-OFF:%d" , i +1 , + pwrdm->ret_mem_off_counter[i]); +seq_printf (s,"\n" );return 0 ;
arch/arm/mach-omap2/powerdomain.c +25 -0
@@ -125,6 +125,10 @@ static int _pwrdm_register(struct powerdomain *pwrdm)for (i =0 ; i <PWRDM_MAX_PWRSTS ; i++) pwrdm->state_counter[i] =0 ; + pwrdm->ret_logic_off_counter =0 ; +for (i =0 ; i < pwrdm->banks; i++) + pwrdm->ret_mem_off_counter[i] =0 ; +pwrdm_wait_transition (pwrdm); pwrdm->state =pwrdm_read_pwrst (pwrdm); pwrdm->state_counter[pwrdm->state] =1 ;
@@ -134,6 +138,25 @@ static int _pwrdm_register(struct powerdomain *pwrdm)return 0 ; } +static void _update_logic_membank_counters (struct powerdomain *pwrdm) +{ +int i; +u8 prev_logic_pwrst, prev_mem_pwrst; + + prev_logic_pwrst =pwrdm_read_prev_logic_pwrst (pwrdm); +if ((pwrdm->pwrsts_logic_ret ==PWRSTS_OFF_RET ) && + (prev_logic_pwrst ==PWRDM_POWER_OFF )) + pwrdm->ret_logic_off_counter++; + +for (i =0 ; i < pwrdm->banks; i++) { + prev_mem_pwrst =pwrdm_read_prev_mem_pwrst (pwrdm, i); + +if ((pwrdm->pwrsts_mem_ret[i] ==PWRSTS_OFF_RET ) && + (prev_mem_pwrst ==PWRDM_POWER_OFF )) + pwrdm->ret_mem_off_counter[i]++; + } +} +static int _pwrdm_state_switch (struct powerdomain *pwrdm,int flag) {
@@ -153,6 +176,8 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) prev =pwrdm_read_prev_pwrst (pwrdm);if (pwrdm->state != prev) pwrdm->state_counter[prev]++; +if (prev ==PWRDM_POWER_RET ) +_update_logic_membank_counters (pwrdm);break ;default :return -EINVAL ;
arch/arm/plat-omap/include/plat/powerdomain.h +2 -0
@@ -100,6 +100,8 @@ struct powerdomain {struct list_head node;int state;unsigned state_counter[PWRDM_MAX_PWRSTS ]; +unsigned ret_logic_off_counter; +unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS ];#ifdef CONFIG_PM_DEBUG s64 timer;
Paul Walmsley
maintainerPATCH 8/19 OMAP2/3 clock: Extend find_idlest() to pass back idle state value
In reply to Paul WalmsleyFrom: Ranjith Lohithakshan <[email protected]>
Current implementation defines clock idle state indicators based on the cpu information (cpu_is_omap24xx() or cpu_is_omap34xx()) in a system wide manner. This patch extends the find_idlest() function in clkops to pass back the idle state indicator for that clock, thus allowing idle state indicators to be defined on a per clock basis if required.
This is specifically needed on AM35xx devices as the new IPSS clocks indicates the idle status (0 is idle, 1 is ready) in a way just opposite to how its handled in OMAP3 (0 is ready, 1 is idle).
--- arch/arm/mach-omap2/clkt2xxx_apll.c | 2 +- arch/arm/mach-omap2/clock.c | 25 ++++++++++++++++++++----- arch/arm/mach-omap2/clock.h | 2 +- arch/arm/mach-omap2/clock2xxx.c | 5 ++++- arch/arm/mach-omap2/clock34xx.c | 15 ++++++++++++--- arch/arm/mach-omap2/cm.h | 3 +++ arch/arm/mach-omap2/prcm.c | 14 +++++--------- arch/arm/plat-omap/include/plat/clock.h | 6 ++++-- arch/arm/plat-omap/include/plat/prcm.h | 3 ++- 9 files changed, 52 insertions(+), 23 deletions(-)
arch/arm/mach-omap2/clkt2xxx_apll.c +1 -1
@@ -57,7 +57,7 @@ static int omap2_clk_apll_enable(struct clk *clk, u32 status_mask)cm_write_mod_reg (cval,PLL_MOD ,CM_CLKEN );omap2_cm_wait_idlest (OMAP_CM_REGADDR (PLL_MOD ,CM_IDLEST ), status_mask, - clk->name); +OMAP24XX_CM_IDLEST_VAL , clk->name);/* * REVISIT: Should we return an error code if omap2_wait_clock_ready()
arch/arm/mach-omap2/clock.c +20 -5
@@ -57,7 +57,7 @@ u8 cpu_mask;static void _omap2_module_wait_ready (struct clk *clk) {void __iomem *companion_reg, *idlest_reg; -u8 other_bit, idlest_bit; +u8 other_bit, idlest_bit, idlest_val;/* Not all modules have multiple clocks that their IDLEST depends on */ if (clk->ops->find_companion) {
@@ -66,9 +66,10 @@ static void _omap2_module_wait_ready(struct clk *clk)return ; } - clk->ops->find_idlest (clk, &idlest_reg, &idlest_bit); + clk->ops->find_idlest (clk, &idlest_reg, &idlest_bit, &idlest_val); -omap2_cm_wait_idlest (idlest_reg, (1 << idlest_bit), clk->name); +omap2_cm_wait_idlest (idlest_reg, (1 << idlest_bit), idlest_val, + clk->name); }/* Enables clock without considering parent dependencies or use count
@@ -175,7 +176,8 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,* omap2_clk_dflt_find_idlest - find CM_IDLEST reg va, bit shift for @clk * @clk: struct clk * to find IDLEST info for * @idlest_reg: void __iomem ** to return the CM_IDLEST va in -* @idlest_bit: u8 ** to return the CM_IDLEST bit shift in +* @idlest_bit: u8 * to return the CM_IDLEST bit shift in +* @idlest_val: u8 * to return the idle status indicator * * Return the CM_IDLEST register address and bit shift corresponding * to the module that "owns" this clock. This default code assumes
@@ -185,13 +187,26 @@ void omap2_clk_dflt_find_companion(struct clk *clk, void __iomem **other_reg,* CM_IDLEST2). This is not true for all modules. No return value. */ void omap2_clk_dflt_find_idlest (struct clk *clk,void __iomem **idlest_reg, -u8 *idlest_bit) +u8 *idlest_bit,u8 *idlest_val) {u32 r; r = (((__force u32 )clk->enable_reg & ~0xf0 ) |0x20 ); *idlest_reg = (__force void __iomem *)r; *idlest_bit = clk->enable_bit; + +/* +* 24xx uses 0 to indicate not ready, and 1 to indicate ready. +* 34xx reverses this, just to keep us on our toes +* AM35xx uses both, depending on the module. +*/ +if (cpu_is_omap24xx ()) + *idlest_val =OMAP24XX_CM_IDLEST_VAL ; +else if (cpu_is_omap34xx ()) + *idlest_val =OMAP34XX_CM_IDLEST_VAL ; +else +BUG (); + }int omap2_dflt_clk_enable (struct clk *clk)
arch/arm/mach-omap2/clock.h +1 -1
@@ -88,7 +88,7 @@ void omap2_dflt_clk_disable(struct clk *clk);void omap2_clk_dflt_find_companion (struct clk *clk,void __iomem **other_reg,u8 *other_bit);void omap2_clk_dflt_find_idlest (struct clk *clk,void __iomem **idlest_reg, -u8 *idlest_bit); +u8 *idlest_bit,u8 *idlest_val);void omap2xxx_clk_commit (struct clk *clk);extern u8 cpu_mask;
arch/arm/mach-omap2/clock2xxx.c +4 -1
@@ -42,6 +42,7 @@ struct clk *vclk, *sclk, *dclk;* @clk: struct clk * being enabled * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into +* @idlest_val: pointer to a u8 to store the CM_IDLEST indicator * * OMAP2430 I2CHS CM_IDLEST bits are in CM_IDLEST1_CORE, but the * CM_*CLKEN bits are in CM_{I,F}CLKEN2_CORE. This custom function
@@ -50,10 +51,12 @@ struct clk *vclk, *sclk, *dclk;*/ static void omap2430_clk_i2chs_find_idlest (struct clk *clk,void __iomem **idlest_reg, -u8 *idlest_bit) +u8 *idlest_bit, +u8 *idlest_val) { *idlest_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_IDLEST ); *idlest_bit = clk->enable_bit; + *idlest_val =OMAP24XX_CM_IDLEST_VAL ; }#else
arch/arm/mach-omap2/clock34xx.c +12 -3
@@ -47,6 +47,7 @@ struct clk *sdrc_ick_p, *arm_fck_p;* @clk: struct clk * being enabled * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into +* @idlest_val: pointer to a u8 to store the CM_IDLEST indicator * * The OMAP3430ES2 SSI target CM_IDLEST bit is at a different shift * from the CM_{I,F}CLKEN bit. Pass back the correct info via
@@ -54,13 +55,15 @@ struct clk *sdrc_ick_p, *arm_fck_p;*/ static void omap3430es2_clk_ssi_find_idlest (struct clk *clk,void __iomem **idlest_reg, -u8 *idlest_bit) +u8 *idlest_bit, +u8 *idlest_val) {u32 r; r = (((__force u32 )clk->enable_reg & ~0xf0 ) |0x20 ); *idlest_reg = (__force void __iomem *)r; *idlest_bit =OMAP3430ES2_ST_SSI_IDLE_SHIFT ; + *idlest_val =OMAP34XX_CM_IDLEST_VAL ; }const struct clkops clkops_omap3430es2_ssi_wait = {
@@ -75,6 +78,7 @@ const struct clkops clkops_omap3430es2_ssi_wait = {* @clk: struct clk * being enabled * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into +* @idlest_val: pointer to a u8 to store the CM_IDLEST indicator * * Some OMAP modules on OMAP3 ES2+ chips have both initiator and * target IDLEST bits. For our purposes, we are concerned with the
@@ -85,7 +89,8 @@ const struct clkops clkops_omap3430es2_ssi_wait = {*/ static void omap3430es2_clk_dss_usbhost_find_idlest (struct clk *clk,void __iomem **idlest_reg, -u8 *idlest_bit) +u8 *idlest_bit, +u8 *idlest_val) {u32 r;
@@ -93,6 +98,7 @@ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, *idlest_reg = (__force void __iomem *)r;/* USBHOST_IDLE has same shift */ *idlest_bit =OMAP3430ES2_ST_DSS_IDLE_SHIFT ; + *idlest_val =OMAP34XX_CM_IDLEST_VAL ; }const struct clkops clkops_omap3430es2_dss_usbhost_wait = {
@@ -107,6 +113,7 @@ const struct clkops clkops_omap3430es2_dss_usbhost_wait = {* @clk: struct clk * being enabled * @idlest_reg: void __iomem ** to store CM_IDLEST reg address into * @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into +* @idlest_val: pointer to a u8 to store the CM_IDLEST indicator * * The OMAP3430ES2 HSOTGUSB target CM_IDLEST bit is at a different * shift from the CM_{I,F}CLKEN bit. Pass back the correct info via
@@ -114,13 +121,15 @@ const struct clkops clkops_omap3430es2_dss_usbhost_wait = {*/ static void omap3430es2_clk_hsotgusb_find_idlest (struct clk *clk,void __iomem **idlest_reg, -u8 *idlest_bit) +u8 *idlest_bit, +u8 *idlest_val) {u32 r; r = (((__force u32 )clk->enable_reg & ~0xf0 ) |0x20 ); *idlest_reg = (__force void __iomem *)r; *idlest_bit =OMAP3430ES2_ST_HSOTGUSB_IDLE_SHIFT ; + *idlest_val =OMAP34XX_CM_IDLEST_VAL ; }const struct clkops clkops_omap3430es2_hsotgusb_wait = {
arch/arm/mach-omap2/cm.h +3 -0
@@ -139,5 +139,8 @@ static inline u32 cm_clear_mod_reg_bits(u32 bits, s16 module, s16 idx)/* CM_IDLEST_GFX */ #define OMAP_ST_GFX (1 << 0) +/* CM_IDLEST indicator */ +#define OMAP24XX_CM_IDLEST_VAL 0 +#define OMAP34XX_CM_IDLEST_VAL 1#endif
arch/arm/mach-omap2/prcm.c +5 -9
@@ -242,26 +242,22 @@ u32 cm_rmw_mod_reg_bits(u32 mask, u32 bits, s16 module, s16 idx)* omap2_cm_wait_idlest - wait for IDLEST bit to indicate module readiness * @reg: physical address of module IDLEST register * @mask: value to mask against to determine if the module is active +* @idlest: idle state indicator (0 or 1) for the clock * @name: name of the clock (for printk) * * Returns 1 if the module indicated readiness in time, or 0 if it * failed to enable in roughly MAX_MODULE_ENABLE_WAIT microseconds. */ -int omap2_cm_wait_idlest (void __iomem *reg,u32 mask,const char *name) +int omap2_cm_wait_idlest (void __iomem *reg,u32 mask,u8 idlest, +const char *name) {int i =0 ;int ena =0 ; -/* -* 24xx uses 0 to indicate not ready, and 1 to indicate ready. -* 34xx reverses this, just to keep us on our toes -*/ -if (cpu_is_omap24xx ()) - ena = mask; -else if (cpu_is_omap34xx ()) +if (idlest) ena =0 ;else -BUG (); + ena = mask;/* Wait for lock */ omap_test_timeout(((__raw_readl(reg) & mask) == ena),
arch/arm/plat-omap/include/plat/clock.h +4 -2
@@ -22,8 +22,10 @@ struct clockdomain;struct clkops {int (*enable)(struct clk *);void (*disable)(struct clk *); -void (*find_idlest)(struct clk *,void __iomem **,u8 *); -void (*find_companion)(struct clk *,void __iomem **,u8 *); +void (*find_idlest)(struct clk *,void __iomem **, +u8 *,u8 *); +void (*find_companion)(struct clk *,void __iomem **, +u8 *); }; #if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3) || \
arch/arm/plat-omap/include/plat/prcm.h +2 -1
@@ -25,7 +25,8 @@u32 omap_prcm_get_reset_sources (void );void omap_prcm_arch_reset (char mode); -int omap2_cm_wait_idlest (void __iomem *reg,u32 mask,const char *name); +int omap2_cm_wait_idlest (void __iomem *reg,u32 mask,u8 idlest, +const char *name);#define START_PADCONF_SAVE 0x2#define PADCONF_SAVE_DONE 0x1
Paul Walmsley
maintainerPATCH 9/19 AM35xx: Add clock support for new modules on AM35xx
In reply to Paul WalmsleyFrom: Ranjith Lohithakshan <[email protected]>
This patch adds clock support for the following AM35xx modules
- Ethernet MAC
- CAN Controller (HECC)
- New MUSB OTG Controller with integrated Phy
- Video Processing Front End (VPFE)
- Additional UART (UART4)
--- arch/arm/mach-omap2/clock34xx.c | 93 ++++++++++++++++++++++++++ arch/arm/mach-omap2/clock34xx.h | 4 + arch/arm/mach-omap2/clock34xx_data.c | 118 +++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/cm-regbits-34xx.h | 10 +++ 4 files changed, 225 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.c +93 -0
@@ -39,6 +39,16 @@*/ #define DPLL5_FREQ_FOR_USBHOST 120000000 +/* +* In AM35xx IPSS, the {ICK,FCK} enable bits for modules are exported +* in the same register at a bit offset of 0x8. The EN_ACK for ICK is +* at an offset of 4 from ICK enable bit. +*/ +#define AM35XX_IPSS_ICK_MASK 0xF +#define AM35XX_IPSS_ICK_EN_ACK_OFFSET 0x4 +#define AM35XX_IPSS_ICK_FCK_OFFSET 0x8 +#define AM35XX_IPSS_CLK_IDLEST_VAL 0 +/* needed by omap3_core_dpll_m2_set_rate() */ struct clk *sdrc_ick_p, *arm_fck_p;
@@ -144,6 +154,89 @@ const struct clkops clkops_noncore_dpll_ops = { .disable = omap3_noncore_dpll_disable, }; +/** +* am35xx_clk_find_idlest - return clock ACK info for AM35XX IPSS +* @clk: struct clk * being enabled +* @idlest_reg: void __iomem ** to store CM_IDLEST reg address into +* @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into +* @idlest_val: pointer to a u8 to store the CM_IDLEST indicator +* +* The interface clocks on AM35xx IPSS reflects the clock idle status +* in the enable register itsel at a bit offset of 4 from the enable +* bit. A value of 1 indicates that clock is enabled. +*/ +static void am35xx_clk_find_idlest (struct clk *clk, +void __iomem **idlest_reg, +u8 *idlest_bit, +u8 *idlest_val) +{ + *idlest_reg = (__force void __iomem *)(clk->enable_reg); + *idlest_bit = clk->enable_bit +AM35XX_IPSS_ICK_EN_ACK_OFFSET ; + *idlest_val =AM35XX_IPSS_CLK_IDLEST_VAL ; +} + +/** +* am35xx_clk_find_companion - find companion clock to @clk +* @clk: struct clk * to find the companion clock of +* @other_reg: void __iomem ** to return the companion clock CM_*CLKEN va in +* @other_bit: u8 ** to return the companion clock bit shift in +* +* Some clocks don't have companion clocks. For example, modules with +* only an interface clock (such as HECC) don't have a companion +* clock. Right now, this code relies on the hardware exporting a bit +* in the correct companion register that indicates that the +* nonexistent 'companion clock' is active. Future patches will +* associate this type of code with per-module data structures to +* avoid this issue, and remove the casts. No return value. +*/ +static void am35xx_clk_find_companion (struct clk *clk,void __iomem **other_reg, +u8 *other_bit) +{ + *other_reg = (__force void __iomem *)(clk->enable_reg); +if (clk->enable_bit &AM35XX_IPSS_ICK_MASK ) + *other_bit = clk->enable_bit +AM35XX_IPSS_ICK_FCK_OFFSET ; +else + *other_bit = clk->enable_bit -AM35XX_IPSS_ICK_FCK_OFFSET ; +} + +const struct clkops clkops_am35xx_ipss_module_wait = { + .enable = omap2_dflt_clk_enable, + .disable = omap2_dflt_clk_disable, + .find_idlest = am35xx_clk_find_idlest, + .find_companion = am35xx_clk_find_companion, +}; + +/** +* am35xx_clk_ipss_find_idlest - return CM_IDLEST info for IPSS +* @clk: struct clk * being enabled +* @idlest_reg: void __iomem ** to store CM_IDLEST reg address into +* @idlest_bit: pointer to a u8 to store the CM_IDLEST bit shift into +* @idlest_val: pointer to a u8 to store the CM_IDLEST indicator +* +* The IPSS target CM_IDLEST bit is at a different shift from the +* CM_{I,F}CLKEN bit. Pass back the correct info via @idlest_reg +* and @idlest_bit. No return value. +*/ +static void am35xx_clk_ipss_find_idlest (struct clk *clk, +void __iomem **idlest_reg, +u8 *idlest_bit, +u8 *idlest_val) +{ +u32 r; + + r = (((__force u32 )clk->enable_reg & ~0xf0 ) |0x20 ); + *idlest_reg = (__force void __iomem *)r; + *idlest_bit =AM35XX_ST_IPSS_SHIFT ; + *idlest_val =OMAP34XX_CM_IDLEST_VAL ; +} + +const struct clkops clkops_am35xx_ipss_wait = { + .enable = omap2_dflt_clk_enable, + .disable = omap2_dflt_clk_disable, + .find_idlest = am35xx_clk_ipss_find_idlest, + .find_companion = omap2_clk_dflt_find_companion, +}; +int omap3_dpll4_set_rate (struct clk *clk,unsigned long rate) {/*
arch/arm/mach-omap2/clock34xx.h +4 -0
@@ -22,4 +22,8 @@ extern const struct clkops clkops_omap3430es2_hsotgusb_wait;extern const struct clkops clkops_omap3430es2_dss_usbhost_wait;extern const struct clkops clkops_noncore_dpll_ops; +/* AM35xx-specific clkops */ +extern const struct clkops clkops_am35xx_ipss_module_wait; +extern const struct clkops clkops_am35xx_ipss_wait; +#endif
arch/arm/mach-omap2/clock34xx_data.c +118 -0
130 lines not on this page · raw message
arch/arm/mach-omap2/cm-regbits-34xx.h +10 -0
@@ -168,6 +168,12 @@#define OMAP3430_EN_SDRC (1 << 1)#define OMAP3430_EN_SDRC_SHIFT 1 +/* AM35XX specific CM_ICLKEN1_CORE bits */ +#define AM35XX_EN_IPSS_MASK (1 << 4) +#define AM35XX_EN_IPSS_SHIFT 4 +#define AM35XX_EN_UART4_MASK (1 << 23) +#define AM35XX_EN_UART4_SHIFT 23 +/* CM_ICLKEN2_CORE */ #define OMAP3430_EN_PKA (1 << 4)#define OMAP3430_EN_PKA_SHIFT 4
@@ -220,6 +226,10 @@#define OMAP3430_ST_SSI_STDBY_SHIFT 0#define OMAP3430_ST_SSI_STDBY_MASK (1 << 0) +/* AM35xx specific CM_IDLEST1_CORE bits */ +#define AM35XX_ST_IPSS_SHIFT 5 +#define AM35XX_ST_IPSS_MASK (1 << 5) +/* CM_IDLEST2_CORE */ #define OMAP3430_ST_PKA_SHIFT 4#define OMAP3430_ST_PKA_MASK (1 << 4)
Paul Walmsley
maintainerPATCH 10/19 OMAP3 clock: Check return values for clk_get()
In reply to Paul WalmsleyFrom: Sanjeev Premi <[email protected]>
This patch checks if clk_get() returned success for the clocks used in function omap2_clk_arch_init().
This version incorporates review comments from Kevin Hilman and Paul Walmsley.
--- arch/arm/mach-omap2/clock34xx.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.c +16 -0
@@ -21,6 +21,7 @@#include <linux/delay.h> #include <linux/clk.h> #include <linux/io.h> +#include <linux/err.h> #include <plat/cpu.h> #include <plat/clock.h>
@@ -286,6 +287,7 @@ static int __init omap3xxx_clk_arch_init(void) {struct clk *osc_sys_ck, *dpll1_ck, *arm_fck, *core_ck;unsigned long osc_sys_rate; +bool err =0 ;if (!cpu_is_omap34xx ())return 0 ;
@@ -295,9 +297,23 @@ static int __init omap3xxx_clk_arch_init(void)/* XXX test these for success */ dpll1_ck =clk_get (NULL ,"dpll1_ck" ); +if (WARN (IS_ERR (dpll1_ck),"Failed to get dpll1_ck.\n" )) + err =1 ; + arm_fck =clk_get (NULL ,"arm_fck" ); +if (WARN (IS_ERR (arm_fck),"Failed to get arm_fck.\n" )) + err =1 ; + core_ck =clk_get (NULL ,"core_ck" ); +if (WARN (IS_ERR (core_ck),"Failed to get core_ck.\n" )) + err =1 ; + osc_sys_ck =clk_get (NULL ,"osc_sys_ck" ); +if (WARN (IS_ERR (osc_sys_ck),"Failed to get osc_sys_ck.\n" )) + err =1 ; + +if (err) +return -ENOENT ;/* REVISIT: not yet ready for 343x */ if (clk_set_rate (dpll1_ck, mpurate))
Paul Walmsley
maintainerPATCH 11/19 OMAP2/3: PRCM: fix misc. compiler warnings
In reply to Paul WalmsleyFrom: Kevin Hilman <[email protected]>
- missing return in omap_prcm_get_reset_sources()
- potential use of uninitialized variable in omap_prcm_arch_reset()
--- arch/arm/mach-omap2/prcm.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-omap2/prcm.c +3 -1
@@ -127,13 +127,15 @@ u32 omap_prcm_get_reset_sources(void)return prm_read_mod_reg (WKUP_MOD ,OMAP2_RM_RSTST ) &0x7f ;if (cpu_is_omap44xx ())return prm_read_mod_reg (WKUP_MOD ,OMAP4_RM_RSTST ) &0x7f ; + +return 0 ; }EXPORT_SYMBOL (omap_prcm_get_reset_sources);/* Resets clock rates and reboots the system. Only called from system.h */ void omap_prcm_arch_reset (char mode) { -s16 prcm_offs; +s16 prcm_offs =0 ;if (cpu_is_omap24xx ()) {omap2xxx_clk_prepare_for_reboot ();
Paul Walmsley
maintainerPATCH 12/19 OMAP3 clock: Remove FreqSel for 3630
In reply to Paul WalmsleyFrom: Vishwanath BS <[email protected]>
DPLL_FREQSEL field in CLKEN_PLL register is no longer valid for OMAP3630. So remove references to that.
--- arch/arm/mach-omap2/dpll3xxx.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/dpll3xxx.c +7 -4
@@ -243,8 +243,11 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)/* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ _omap3_noncore_dpll_bypass (clk); -/* Set jitter correction */ -if (!cpu_is_omap44xx ()) { +/* +* Set jitter correction. No jitter correction for OMAP4 and 3630 +* since freqsel is field is no longer present +*/ +if (!cpu_is_omap44xx () && !cpu_is_omap3630 ()) { v =__raw_readl (dd->control_reg); v &= ~dd->freqsel_mask; v |= freqsel <<__ffs (dd->freqsel_mask);
@@ -387,8 +390,8 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)if (dd->last_rounded_rate ==0 )return -EINVAL ; -/* No freqsel on OMAP4 */ -if (!cpu_is_omap44xx ()) { +/* No freqsel on OMAP4 and OMAP3630 */ +if (!cpu_is_omap44xx () && !cpu_is_omap3630 ()) { freqsel =_omap3_dpll_compute_freqsel (clk, dd->last_rounded_n);if (!freqsel)
PATCH 12/19 OMAP3 clock: Remove FreqSel for 3630
Hello.
Quoted 16 lines · Paul Walmsley
From: Vishwanath BS <[email protected]>
DPLL_FREQSELfield inCLKEN_PLLregister is no longer valid for OMAP3630. So remove references to that.Signed-off-by Vishwanath BS <[email protected]>Signed-off-by Paul Walmsley <[email protected]>--- arch/arm/mach-omap2/dpll3xxx.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)arch/arm/mach-omap2/dpll3xxx.c +0
-0
arch/arm/mach-omap2/dpll3xxx.c static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) · line 249
Quoted 9 lines
arch/arm/mach-omap2/dpll3xxx.c +3
-2@@ -243,8 +243,11 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)/* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ _omap3_noncore_dpll_bypass (clk); -/* Set jitter correction */ -if (!cpu_is_omap44xx ()) { +/* +* Set jitter correction. No jitter correction for OMAP4 and 3630 +* since freqsel is field is no longer present
I can't parse that comment. I guess first "is" is not needed. :-)
WBR, Sergei
Paul Walmsley
maintainerPATCH 12/19 OMAP3 clock: Remove FreqSel for 3630
Hello Sergei,
Quoted 4 lines · Sergei Shtylyov
Quoted 2 lines · Paul Walmsley
From: Vishwanath BS <[email protected]>
Quoted 16 lines
Quoted 5 lines
arch/arm/mach-omap2/dpll3xxx.c +0
-0arch/arm/mach-omap2/dpll3xxx.c static int omap3_noncore_dpll_program(struct clk *clk, · line 250
Quoted 9 lines
arch/arm/mach-omap2/dpll3xxx.c +3
-1@@ -243,8 +243,11 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)/* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ _omap3_noncore_dpll_bypass (clk ); - /* Set jitter correction */ - if (!cpu_is_omap44xx()) { +/* +* Set jitter correction. No jitter correction for OMAP4 and 3630 +* since freqsel is field is no longer present I can't parse that comment. I guess first "is" is not needed. :-)
Thanks Sergei; fixed in the for_2.6.34_dev branch; revised branch below.
- Paul
From: Vishwanath BS <[email protected]>
Date: Fri, 12 Feb 2010 14:25:04 -0700
Subject: [PATCH] OMAP3 clock: Remove FreqSel for 3630
DPLL_FREQSEL field in CLKEN_PLL register is no longer valid for OMAP3630. So remove references to that.
--- arch/arm/mach-omap2/dpll3xxx.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/dpll3xxx.c +7 -4
@@ -243,8 +243,11 @@ static int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel)/* 3430 ES2 TRM: 4.7.6.9 DPLL Programming Sequence */ _omap3_noncore_dpll_bypass (clk); -/* Set jitter correction */ -if (!cpu_is_omap44xx ()) { +/* +* Set jitter correction. No jitter correction for OMAP4 and 3630 +* since freqsel field is no longer present +*/ +if (!cpu_is_omap44xx () && !cpu_is_omap3630 ()) { v =__raw_readl (dd->control_reg); v &= ~dd->freqsel_mask; v |= freqsel <<__ffs (dd->freqsel_mask);
@@ -387,8 +390,8 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)if (dd->last_rounded_rate ==0 )return -EINVAL ; -/* No freqsel on OMAP4 */ -if (!cpu_is_omap44xx ()) { +/* No freqsel on OMAP4 and OMAP3630 */ +if (!cpu_is_omap44xx () && !cpu_is_omap3630 ()) { freqsel =_omap3_dpll_compute_freqsel (clk, dd->last_rounded_n);if (!freqsel)
Signature · 1 line
1.6.6.GIT
Paul Walmsley
maintainerPATCH 13/19 OMAP3: hwmod: support to specify the offset position of various SYSCONFIG register bits.
In reply to Paul WalmsleyFrom: Thara Gopinath <[email protected]>
In OMAP3 Some modules like Smartreflex do not have the regular sysconfig register.Instead clockactivity bits are part of another register at a different bit position than the usual bit positions 8 and 9.
In OMAP4, a new scheme is available due to the new protocol between the PRCM and the IPs. Depending of the scheme, the SYSCONFIG bitfields position will be different.
The IP_REVISION register should be at offset 0x00.
It should contain a SCHEME field. From this we can determine whether the IP follows legacy scheme or the new scheme.
31:30 SCHEME Used to distinguish between old scheme and current.
Read 0x0: Legacy protocol.
Read 0x1: New PRCM protocol defined for new OMAP4 IPs
For legacy IP
13:12 MIDLEMODE
11:8 CLOCKACTIVITY 6 EMUSOFT 5 EMUFREE 4:3 SIDLEMODE 2 ENAWAKEUP 1 SOFTRESET 0 AUTOIDLE
For new OMAP4 IP's, the bit position in SYSCONFIG is (for simple target):
5:4 STANDBYMODE (Ex MIDLEMODE) 3:2 IDLEMODE (Ex SIDLEMODE) 1 FREEEMU (Ex EMUFREE) 0 SOFTRESET
Unfortunately In OMAP4 also some IPs will not follow any of these two schemes. This is the case at least for McASP, SmartReflex and some security IPs.
This patch introduces a new field sysc_fields in omap_hwmod_sysconfig which can be used by the hwmod structures to specify the offsets for the sysconfig register of the IP.Also two static structures omap_hwmod_sysc_type1 and omap_hwmod_sysc_type2 are defined which can be used directly to populate the sysc_fields if the IP follows legacy or new OMAP4 scheme. If the IP follows none of these two schemes a new omap_hwmod_sysc_fields structure has to be defined and passed as part of omap_hwmod_sysconfig.
--- arch/arm/mach-omap2/Makefile | 3 + arch/arm/mach-omap2/omap_hwmod.c | 100 +++++++++++++++++++++++--- arch/arm/mach-omap2/omap_hwmod_common_data.c | 44 +++++++++++ arch/arm/plat-omap/include/plat/omap_hwmod.h | 73 +++++++++++++++---- 4 files changed, 191 insertions(+), 29 deletions(-) create mode 100644 arch/arm/mach-omap2/omap_hwmod_common_data.c
arch/arm/mach-omap2/Makefile +2 -1
@@ -5,7 +5,8 @@ # Common support obj-y := id.o io.o control.o mux.o devices.o serial.o gpmc.o timer-gp.o -omap-2-3-common = irq.o sdrc.o omap_hwmod.o +omap-2-3-common = irq.o sdrc.o omap_hwmod.o \ + omap_hwmod_common_data.o omap-3-4-common = dpll3xxx.o prcm-common = prcm.o powerdomain.o clock-common = clock.o clock_common_data.o \
arch/arm/mach-omap2/omap_hwmod.c +87 -13
174 lines not on this page · raw message
arch/arm/mach-omap2/omap_hwmod_common_data.c new file +44 -0
44 lines not on this page · raw message
arch/arm/plat-omap/include/plat/omap_hwmod.h +58 -15
108 lines not on this page · raw message
Paul Walmsley
maintainerPATCH 14/19 OMAP: HWMOD: Add support for early device register into omap device layer
In reply to Paul WalmsleyFrom: Thara Gopinath <[email protected]>
This patch adds support in omap device layer to register devices as early platform devices. Certain devices needed during system boot up like timers, gpio etc can be registered as early devices. This will allow for them to be probed very early on during system boot up. This patch adds a parameter is_early_device in omap_device_build. Depending on this parameter a call to early_platform_add_devices or platform_register_device is made.
--- arch/arm/plat-omap/include/plat/omap_device.h | 5 ++-- arch/arm/plat-omap/omap_device.c | 33 ++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 6 deletions(-)
arch/arm/plat-omap/include/plat/omap_device.h +3 -2
@@ -90,15 +90,16 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, struct omap_hwmod *oh, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, - int pm_lats_cnt); + int pm_lats_cnt, int is_early_device);struct omap_device *omap_device_build_ss (const char *pdev_name,int pdev_id,struct omap_hwmod **oh,int oh_cnt,void *pdata,int pdata_len,struct omap_device_pm_latency *pm_lats, -int pm_lats_cnt); +int pm_lats_cnt,int is_early_device);int omap_device_register (struct omap_device *od); +int omap_early_device_register (struct omap_device *od);/* OMAP PM interface */ int omap_device_align_pm_lat(struct platform_device *pdev,
arch/arm/plat-omap/omap_device.c +29 -4
@@ -307,6 +307,7 @@ int omap_device_fill_resources(struct omap_device *od, struct resource *res)* @pdata_len: amount of memory pointed to by @pdata * @pm_lats: pointer to a omap_device_pm_latency array for this device * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats +* @is_early_device: should the device be registered as an early device or not * * Convenience function for building and registering a single * omap_device record, which in turn builds and registers a
@@ -318,7 +319,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, struct omap_hwmod *oh, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, - int pm_lats_cnt) + int pm_lats_cnt, int is_early_device) { struct omap_hwmod *ohs[] = { oh };
@@ -326,7 +327,8 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,return ERR_PTR (-EINVAL );return omap_device_build_ss (pdev_name, pdev_id, ohs,1 , pdata, - pdata_len, pm_lats, pm_lats_cnt); + pdata_len, pm_lats, pm_lats_cnt, + is_early_device); }/**
@@ -338,6 +340,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,* @pdata_len: amount of memory pointed to by @pdata * @pm_lats: pointer to a omap_device_pm_latency array for this device * @pm_lats_cnt: ARRAY_SIZE() of @pm_lats +* @is_early_device: should the device be registered as an early device or not * * Convenience function for building and registering an omap_device * subsystem record. Subsystem records consist of multiple
@@ -349,7 +352,7 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, struct omap_hwmod **ohs, int oh_cnt, void *pdata, int pdata_len, struct omap_device_pm_latency *pm_lats, - int pm_lats_cnt) + int pm_lats_cnt, int is_early_device) { int ret = -ENOMEM;struct omap_device *od;
@@ -407,7 +410,11 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, od->magic =OMAP_DEVICE_MAGIC ; - ret =omap_device_register (od); +if (is_early_device) + ret =omap_early_device_register (od); +else + ret =omap_device_register (od); +if (ret) goto odbs_exit4;
@@ -428,6 +435,24 @@ odbs_exit1: }/** +* omap_early_device_register - register an omap_device as an early platform +* device. +* @od: struct omap_device * to register +* +* Register the omap_device structure. This currently just calls +* platform_early_add_device() on the underlying platform_device. +* Returns 0 by default. +*/ +int omap_early_device_register (struct omap_device *od) +{ +struct platform_device *devices[1 ]; + + devices[0 ] = &(od->pdev); +early_platform_add_devices (devices,1 ); +return 0 ; +} + +/** * omap_device_register - register an omap_device with one omap_hwmod * @od: struct omap_device * to register *
Paul Walmsley
maintainerPATCH 15/19 OMAP3630: Clock: Workaround for DPLL HS divider limitation
In reply to Paul WalmsleyFrom: Mike Turquette <[email protected]>
This patch implements a workaround for the DPLL HS divider limitation in OMAP3630 as given by Errata ID: i556.
Errata:
When PWRDN bit is set, it resets the internal HSDIVIDER divide-by value (Mx). The reset value gets loaded instead of the previous value.
The following HSDIVIDERs exhibit above behavior:
. DPLL4 : M6 / M5 / M4 / M3 / M2 (CM_CLKEN_PLL[31:26] register bits) . DPLL3 : M3 (CM_CLKEN_PLL[12] register bit).
Work Around:
It is mandatory to apply the following sequence to ensure the write value will
be loaded in DPLL HSDIVIDER FSM:
The global sequence when using PWRDN bit is the following:
. Disable Mx HSDIVIDER clock output related functional clock enable bits
(in CM_FCLKEN_xxx / CM_ICLKEN_xxx)
. Enable PWRDN bit of HSDIVIDER
. Disable PWRDN bit of HSDIVIDER
. Read current HSDIVIDER register value
. Write different value in HSDIVIDER register
. Write expected value in HSDIVIDER register
. Enable Mx HSDIVIDER clock output related functional clocks
(CM_FCLKEN_xxx / CM_ICLKEN_xxx)
[paul at pwsan.com: updated patch to apply; made workaround function static;
marked as being 36xx-specific]
--- arch/arm/mach-omap2/clock34xx.c | 43 ++++++++++++++++++++++++++++++++++ arch/arm/mach-omap2/clock34xx.h | 3 ++ arch/arm/mach-omap2/clock34xx_data.c | 19 +++++++++++++++ 3 files changed, 65 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/clock34xx.c +43 -0
@@ -150,6 +150,49 @@ const struct clkops clkops_omap3430es2_hsotgusb_wait = { .find_companion = omap2_clk_dflt_find_companion, }; +/** +* omap36xx_pwrdn_clk_enable_with_hsdiv_restore - enable clocks suffering +* from HSDivider PWRDN problem Implements Errata ID: i556. +* @clk: DPLL output struct clk +* +* 3630 only: dpll3_m3_ck, dpll4_m2_ck, dpll4_m3_ck, dpll4_m4_ck, +* dpll4_m5_ck & dpll4_m6_ck dividers gets loaded with reset +* valueafter their respective PWRDN bits are set. Any dummy write +* (Any other value different from the Read value) to the +* corresponding CM_CLKSEL register will refresh the dividers. +*/ +static int omap36xx_pwrdn_clk_enable_with_hsdiv_restore (struct clk *clk) +{ +u32 dummy_v, orig_v, clksel_shift; +int ret; + +/* Clear PWRDN bit of HSDIVIDER */ + ret =omap2_dflt_clk_enable (clk); + +/* Restore the dividers */ +if (!ret) { + clksel_shift =__ffs (clk->parent->clksel_mask); + orig_v =__raw_readl (clk->parent->clksel_reg); + dummy_v = orig_v; + +/* Write any other value different from the Read value */ + dummy_v ^= (1 << clksel_shift); +__raw_writel (dummy_v, clk->parent->clksel_reg); + +/* Write the original divider */ +__raw_writel (orig_v, clk->parent->clksel_reg); + } + +return ret; +} + +const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore = { + .enable = omap36xx_pwrdn_clk_enable_with_hsdiv_restore, + .disable = omap2_dflt_clk_disable, + .find_companion = omap2_clk_dflt_find_companion, + .find_idlest = omap2_clk_dflt_find_idlest, +}; +const struct clkops clkops_noncore_dpll_ops = { .enable = omap3_noncore_dpll_enable, .disable = omap3_noncore_dpll_disable,
arch/arm/mach-omap2/clock34xx.h +3 -0
@@ -26,4 +26,7 @@ extern const struct clkops clkops_noncore_dpll_ops;extern const struct clkops clkops_am35xx_ipss_module_wait;extern const struct clkops clkops_am35xx_ipss_wait; +/* OMAP36xx-specific clkops */ +extern const struct clkops clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; +#endif
arch/arm/mach-omap2/clock34xx_data.c +19 -0
@@ -3358,6 +3358,25 @@ int __init omap3xxx_clk_init(void) } } +if (cpu_is_omap3630 ()) { +/* +* For 3630: override clkops_omap2_dflt_wait for the +* clocks affected from PWRDN reset Limitation +*/ + dpll3_m3x2_ck.ops = + &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; + dpll4_m2x2_ck.ops = + &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; + dpll4_m3x2_ck.ops = + &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; + dpll4_m4x2_ck.ops = + &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; + dpll4_m5x2_ck.ops = + &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; + dpll4_m6x2_ck.ops = + &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; + } +clk_init (&omap2_clk_functions);for (c = omap3xxx_clks; c < omap3xxx_clks +ARRAY_SIZE (omap3xxx_clks); c++)
Paul Walmsley
maintainerPATCH 16/19 ARM: OMAP4 clock domain: Add check for avoiding dependency related update.
In reply to Paul WalmsleyFrom: Abhijit Pagare <[email protected]>
A check is added for avoiding the sleep/wakeup dependency updates for OMAP4 as the structures for the dependencies are currently absent.
--- arch/arm/mach-omap2/clockdomain.c | 30 ++++++++++++++++++++++++------ 1 files changed, 24 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/clockdomain.c +24 -6
@@ -1,8 +1,8 @@/* * OMAP2/3/4 clockdomain framework functions * -* Copyright (C) 2008-2009 Texas Instruments, Inc. -* Copyright (C) 2008-2009 Nokia Corporation +* Copyright (C) 2008-2010 Texas Instruments, Inc. +* Copyright (C) 2008-2010 Nokia Corporation * * Written by Paul Walmsley and Jouni H?gander * Added OMAP4 specific support by Abhijit Pagare <[email protected]>
@@ -891,8 +891,17 @@ void omap2_clkdm_allow_idle(struct clockdomain *clkdm)pr_debug ("clockdomain: enabling automatic idle transitions for %s\n" , clkdm->name); -if (atomic_read (&clkdm->usecount) >0 ) -_clkdm_add_autodeps (clkdm); +/* +* XXX This should be removed once TI adds wakeup/sleep +* dependency code and data for OMAP4. +*/ +if (cpu_is_omap44xx ()) { +WARN_ONCE (1 ,"clockdomain: OMAP4 wakeup/sleep dependency " +"support is not yet implemented\n" ); + }else { +if (atomic_read (&clkdm->usecount) >0 ) +_clkdm_add_autodeps (clkdm); + }_omap2_clkdm_set_hwsup (clkdm,1 );
@@ -924,8 +933,17 @@ void omap2_clkdm_deny_idle(struct clockdomain *clkdm)_omap2_clkdm_set_hwsup (clkdm,0 ); -if (atomic_read (&clkdm->usecount) >0 ) -_clkdm_del_autodeps (clkdm); +/* +* XXX This should be removed once TI adds wakeup/sleep +* dependency code and data for OMAP4. +*/ +if (cpu_is_omap44xx ()) { +WARN_ONCE (1 ,"clockdomain: OMAP4 wakeup/sleep dependency " +"support is not yet implemented\n" ); + }else { +if (atomic_read (&clkdm->usecount) >0 ) +_clkdm_del_autodeps (clkdm); + } }
Paul Walmsley
maintainerPATCH 17/19 OMAP3 clock: introduce DPLL4 Jtype
In reply to Paul WalmsleyFrom: Richard Woodruff <[email protected]>
DPLL4 for 3630 introduces a changed block called j type dpll, requiring special divisor bits and additional reg fields. To allow for silicons to use this, this is introduced as a flag and is enabled for 3630 silicon. OMAP4 also has j type dpll for usb.
Tested with 3630 ZOOM3 and OMAP3430 ZOOM2
[paul at pwsan.com: added some comments; updated copyrights and credits; fixed
some style issues]
--- arch/arm/mach-omap2/clock.h | 4 ++ arch/arm/mach-omap2/clock34xx_data.c | 32 ++++++++++++++- arch/arm/mach-omap2/clock44xx_data.c | 1 arch/arm/mach-omap2/cm-regbits-34xx.h | 5 ++ arch/arm/mach-omap2/dpll3xxx.c | 67 +++++++++++++++++++++++++++++-- arch/arm/plat-omap/include/plat/clock.h | 5 ++ 6 files changed, 109 insertions(+), 5 deletions(-)
arch/arm/mach-omap2/clock.h +4 -0
@@ -47,6 +47,10 @@#define DPLL_LOW_POWER_BYPASS 0x5#define DPLL_LOCKED 0x7 +/* DPLL Type and DCO Selection Flags */ +#define DPLL_J_TYPE 0x1 +#define DPLL_NO_DCO_SEL 0x2 +int omap2_clk_enable (struct clk *clk);void omap2_clk_disable (struct clk *clk);long omap2_clk_round_rate (struct clk *clk,unsigned long rate);
arch/arm/mach-omap2/clock34xx_data.c +31 -1
@@ -38,6 +38,7 @@/* Maximum DPLL multiplier, divider values for OMAP3 */ #define OMAP3_MAX_DPLL_MULT 2048 +#define OMAP3630_MAX_JTYPE_DPLL_MULT 4095#define OMAP3_MAX_DPLL_DIV 128/*
@@ -529,7 +530,8 @@ static struct clk emu_core_alwon_ck = {/* DPLL4 */ /* Supplies 96MHz, 54Mhz TV DAC, DSS fclk, CAM sensor clock, emul trace clk */ /* Type: DPLL */ -static struct dpll_data dpll4_dd = { +static struct dpll_data dpll4_dd; +static struct dpll_data dpll4_dd_34xx__initdata = { .mult_div1_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_CLKSEL2 ), .mult_mask =OMAP3430_PERIPH_DPLL_MULT_MASK , .div1_mask =OMAP3430_PERIPH_DPLL_DIV_MASK ,
@@ -552,6 +554,29 @@ static struct dpll_data dpll4_dd = { .rate_tolerance = DEFAULT_DPLL_RATE_TOLERANCE }; +static struct dpll_data dpll4_dd_3630__initdata = { + .mult_div1_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_CLKSEL2 ), + .mult_mask =OMAP3630_PERIPH_DPLL_MULT_MASK , + .div1_mask =OMAP3430_PERIPH_DPLL_DIV_MASK , + .clk_bypass = &sys_ck, + .clk_ref = &sys_ck, + .control_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_CLKEN ), + .enable_mask =OMAP3430_EN_PERIPH_DPLL_MASK , + .modes = (1 <<DPLL_LOW_POWER_STOP ) | (1 <<DPLL_LOCKED ), + .auto_recal_bit =OMAP3430_EN_PERIPH_DPLL_DRIFTGUARD_SHIFT , + .recal_en_bit =OMAP3430_PERIPH_DPLL_RECAL_EN_SHIFT , + .recal_st_bit =OMAP3430_PERIPH_DPLL_ST_SHIFT , + .autoidle_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_AUTOIDLE ), + .autoidle_mask =OMAP3430_AUTO_PERIPH_DPLL_MASK , + .idlest_reg =OMAP_CM_REGADDR (PLL_MOD ,CM_IDLEST ), + .idlest_mask =OMAP3430_ST_PERIPH_CLK_MASK , + .max_multiplier =OMAP3630_MAX_JTYPE_DPLL_MULT , + .min_divider =1 , + .max_divider =OMAP3_MAX_DPLL_DIV , + .rate_tolerance =DEFAULT_DPLL_RATE_TOLERANCE , + .flags =DPLL_J_TYPE +}; +static struct clk dpll4_ck = { .name ="dpll4_ck" , .ops = &clkops_noncore_dpll_ops,
@@ -3377,6 +3402,11 @@ int __init omap3xxx_clk_init(void) &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; } +if (cpu_is_omap3630 ()) + dpll4_dd = dpll4_dd_3630; +else + dpll4_dd = dpll4_dd_34xx; +clk_init (&omap2_clk_functions);for (c = omap3xxx_clks; c < omap3xxx_clks +ARRAY_SIZE (omap3xxx_clks); c++)
arch/arm/mach-omap2/clock44xx_data.c +1 -0
@@ -980,6 +980,7 @@ static struct dpll_data dpll_usb_dd = { .max_multiplier = OMAP4430_MAX_DPLL_MULT, .max_divider = OMAP4430_MAX_DPLL_DIV, .min_divider = 1, + .flags = DPLL_J_TYPE | DPLL_NO_DCO_SEL };
arch/arm/mach-omap2/cm-regbits-34xx.h +5 -0
@@ -531,8 +531,13 @@/* CM_CLKSEL2_PLL */ #define OMAP3430_PERIPH_DPLL_MULT_SHIFT 8#define OMAP3430_PERIPH_DPLL_MULT_MASK (0x7ff << 8) +#define OMAP3630_PERIPH_DPLL_MULT_MASK (0xfff << 8)#define OMAP3430_PERIPH_DPLL_DIV_SHIFT 0#define OMAP3430_PERIPH_DPLL_DIV_MASK (0x7f << 0) +#define OMAP3630_PERIPH_DPLL_DCO_SEL_SHIFT 21 +#define OMAP3630_PERIPH_DPLL_DCO_SEL_MASK (0x7 << 21) +#define OMAP3630_PERIPH_DPLL_SD_DIV_SHIFT 24 +#define OMAP3630_PERIPH_DPLL_SD_DIV_MASK (0xff << 24)/* CM_CLKSEL3_PLL */ #define OMAP3430_DIV_96M_SHIFT 0
arch/arm/mach-omap2/dpll3xxx.c +63 -4
93 lines not on this page · raw message
arch/arm/plat-omap/include/plat/clock.h +5 -0
@@ -42,6 +42,10 @@ struct clksel {const struct clksel_rate *rates; }; +/* +* A new flag called flag has been added which indicates what is the +* type of dpll (like j_type, no_dco_sel) +*/ struct dpll_data {void __iomem *mult_div1_reg;u32 mult_mask;
@@ -68,6 +72,7 @@ struct dpll_data {u8 auto_recal_bit;u8 recal_en_bit;u8 recal_st_bit; +u8 flags;# endif };
Paul Walmsley
maintainerPATCH 18/19 OMAP3 clock: Introduce 3630 DPLL4 HSDivider changes
In reply to Paul WalmsleyFrom: Vishwanath BS <[email protected]>
Divider (M2, M3, M4, M5 and M6) field width has been increased by 1 bit in 3630. This patch has changes to accommodate this in CM dynamically based on chip version.
Basically new clock nodes have been added for 3630 DPLL4 M2,M3,M4,M5 and M6 and value of these nodes are used if cpu type is 3630.
--- arch/arm/mach-omap2/clock34xx_data.c | 146 ++++++++++++++++++++++++++++++- arch/arm/mach-omap2/cm-regbits-34xx.h | 5 + arch/arm/plat-omap/include/plat/clock.h | 5 + 3 files changed, 149 insertions(+), 7 deletions(-)
arch/arm/mach-omap2/clock34xx_data.c +141 -5
@@ -237,6 +237,42 @@ static const struct clksel_rate div16_dpll_rates[] = { { .div = 0 } }; +static const struct clksel_rate div32_dpll4_rates_3630[] = { + { .div =1 , .val =1 , .flags =RATE_IN_36XX |DEFAULT_RATE }, + { .div =2 , .val =2 , .flags =RATE_IN_36XX }, + { .div =3 , .val =3 , .flags =RATE_IN_36XX }, + { .div =4 , .val =4 , .flags =RATE_IN_36XX }, + { .div =5 , .val =5 , .flags =RATE_IN_36XX }, + { .div =6 , .val =6 , .flags =RATE_IN_36XX }, + { .div =7 , .val =7 , .flags =RATE_IN_36XX }, + { .div =8 , .val =8 , .flags =RATE_IN_36XX }, + { .div =9 , .val =9 , .flags =RATE_IN_36XX }, + { .div =10 , .val =10 , .flags =RATE_IN_36XX }, + { .div =11 , .val =11 , .flags =RATE_IN_36XX }, + { .div =12 , .val =12 , .flags =RATE_IN_36XX }, + { .div =13 , .val =13 , .flags =RATE_IN_36XX }, + { .div =14 , .val =14 , .flags =RATE_IN_36XX }, + { .div =15 , .val =15 , .flags =RATE_IN_36XX }, + { .div =16 , .val =16 , .flags =RATE_IN_36XX }, + { .div =17 , .val =17 , .flags =RATE_IN_36XX }, + { .div =18 , .val =18 , .flags =RATE_IN_36XX }, + { .div =19 , .val =19 , .flags =RATE_IN_36XX }, + { .div =20 , .val =20 , .flags =RATE_IN_36XX }, + { .div =21 , .val =21 , .flags =RATE_IN_36XX }, + { .div =22 , .val =22 , .flags =RATE_IN_36XX }, + { .div =23 , .val =23 , .flags =RATE_IN_36XX }, + { .div =24 , .val =24 , .flags =RATE_IN_36XX }, + { .div =25 , .val =25 , .flags =RATE_IN_36XX }, + { .div =26 , .val =26 , .flags =RATE_IN_36XX }, + { .div =27 , .val =27 , .flags =RATE_IN_36XX }, + { .div =28 , .val =28 , .flags =RATE_IN_36XX }, + { .div =29 , .val =29 , .flags =RATE_IN_36XX }, + { .div =30 , .val =30 , .flags =RATE_IN_36XX }, + { .div =31 , .val =31 , .flags =RATE_IN_36XX }, + { .div =32 , .val =32 , .flags =RATE_IN_36XX }, + { .div =0 } +}; +/* DPLL1 */ /* MPU clock source */ /* Type: DPLL */
@@ -606,8 +642,15 @@ static const struct clksel div16_dpll4_clksel[] = { { .parent = NULL } }; +static const struct clksel div32_dpll4_clksel[] = { + { .parent = &dpll4_ck, .rates = div32_dpll4_rates_3630 }, + { .parent =NULL } +}; +/* This virtual clock is the source for dpll4_m2x2_ck */ -static struct clk dpll4_m2_ck = { +static struct clk dpll4_m2_ck; + +static struct clk dpll4_m2_ck_34xx__initdata = { .name ="dpll4_m2_ck" , .ops = &clkops_null, .parent = &dpll4_ck,
@@ -619,6 +662,18 @@ static struct clk dpll4_m2_ck = { .recalc = &omap2_clksel_recalc, }; +static struct clk dpll4_m2_ck_3630__initdata = { + .name ="dpll4_m2_ck" , + .ops = &clkops_null, + .parent = &dpll4_ck, + .init = &omap2_init_clksel_parent, + .clksel_reg =OMAP_CM_REGADDR (PLL_MOD ,OMAP3430_CM_CLKSEL3 ), + .clksel_mask =OMAP3630_DIV_96M_MASK , + .clksel = div32_dpll4_clksel, + .clkdm_name ="dpll4_clkdm" , + .recalc = &omap2_clksel_recalc, +}; +/* The PWRDN bit is apparently only available on 3430ES2 and above */ static struct clk dpll4_m2x2_ck = { .name ="dpll4_m2x2_ck" ,
@@ -679,7 +734,9 @@ static struct clk omap_96m_fck = { };/* This virtual clock is the source for dpll4_m3x2_ck */ -static struct clk dpll4_m3_ck = { +static struct clk dpll4_m3_ck; + +static struct clk dpll4_m3_ck_34xx__initdata = { .name ="dpll4_m3_ck" , .ops = &clkops_null, .parent = &dpll4_ck,
@@ -691,6 +748,18 @@ static struct clk dpll4_m3_ck = { .recalc = &omap2_clksel_recalc, }; +static struct clk dpll4_m3_ck_3630__initdata = { + .name ="dpll4_m3_ck" , + .ops = &clkops_null, + .parent = &dpll4_ck, + .init = &omap2_init_clksel_parent, + .clksel_reg =OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,CM_CLKSEL ), + .clksel_mask =OMAP3630_CLKSEL_TV_MASK , + .clksel = div32_dpll4_clksel, + .clkdm_name ="dpll4_clkdm" , + .recalc = &omap2_clksel_recalc, +}; +/* The PWRDN bit is apparently only available on 3430ES2 and above */ static struct clk dpll4_m3x2_ck = { .name ="dpll4_m3x2_ck" ,
@@ -764,7 +833,9 @@ static struct clk omap_12m_fck = { };/* This virstual clock is the source for dpll4_m4x2_ck */ -static struct clk dpll4_m4_ck = { +static struct clk dpll4_m4_ck; + +static struct clk dpll4_m4_ck_34xx__initdata = { .name ="dpll4_m4_ck" , .ops = &clkops_null, .parent = &dpll4_ck,
@@ -778,6 +849,20 @@ static struct clk dpll4_m4_ck = { .round_rate = &omap2_clksel_round_rate, }; +static struct clk dpll4_m4_ck_3630__initdata = { + .name ="dpll4_m4_ck" , + .ops = &clkops_null, + .parent = &dpll4_ck, + .init = &omap2_init_clksel_parent, + .clksel_reg =OMAP_CM_REGADDR (OMAP3430_DSS_MOD ,CM_CLKSEL ), + .clksel_mask =OMAP3630_CLKSEL_DSS1_MASK , + .clksel = div32_dpll4_clksel, + .clkdm_name ="dpll4_clkdm" , + .recalc = &omap2_clksel_recalc, + .set_rate = &omap2_clksel_set_rate, + .round_rate = &omap2_clksel_round_rate, +}; +/* The PWRDN bit is apparently only available on 3430ES2 and above */ static struct clk dpll4_m4x2_ck = { .name ="dpll4_m4x2_ck" ,
@@ -791,7 +876,9 @@ static struct clk dpll4_m4x2_ck = { };/* This virtual clock is the source for dpll4_m5x2_ck */ -static struct clk dpll4_m5_ck = { +static struct clk dpll4_m5_ck; + +static struct clk dpll4_m5_ck_34xx__initdata = { .name ="dpll4_m5_ck" , .ops = &clkops_null, .parent = &dpll4_ck,
@@ -805,6 +892,18 @@ static struct clk dpll4_m5_ck = { .recalc = &omap2_clksel_recalc, }; +static struct clk dpll4_m5_ck_3630__initdata = { + .name ="dpll4_m5_ck" , + .ops = &clkops_null, + .parent = &dpll4_ck, + .init = &omap2_init_clksel_parent, + .clksel_reg =OMAP_CM_REGADDR (OMAP3430_CAM_MOD ,CM_CLKSEL ), + .clksel_mask =OMAP3630_CLKSEL_CAM_MASK , + .clksel = div32_dpll4_clksel, + .clkdm_name ="dpll4_clkdm" , + .recalc = &omap2_clksel_recalc, +}; +/* The PWRDN bit is apparently only available on 3430ES2 and above */ static struct clk dpll4_m5x2_ck = { .name ="dpll4_m5x2_ck" ,
@@ -818,7 +917,9 @@ static struct clk dpll4_m5x2_ck = { };/* This virtual clock is the source for dpll4_m6x2_ck */ -static struct clk dpll4_m6_ck = { +static struct clk dpll4_m6_ck; + +static struct clk dpll4_m6_ck_34xx__initdata = { .name ="dpll4_m6_ck" , .ops = &clkops_null, .parent = &dpll4_ck,
@@ -830,6 +931,18 @@ static struct clk dpll4_m6_ck = { .recalc = &omap2_clksel_recalc, }; +static struct clk dpll4_m6_ck_3630__initdata = { + .name ="dpll4_m6_ck" , + .ops = &clkops_null, + .parent = &dpll4_ck, + .init = &omap2_init_clksel_parent, + .clksel_reg =OMAP_CM_REGADDR (OMAP3430_EMU_MOD ,CM_CLKSEL1 ), + .clksel_mask =OMAP3630_DIV_DPLL4_MASK , + .clksel = div32_dpll4_clksel, + .clkdm_name ="dpll4_clkdm" , + .recalc = &omap2_clksel_recalc, +}; +/* The PWRDN bit is apparently only available on 3430ES2 and above */ static struct clk dpll4_m6x2_ck = { .name ="dpll4_m6x2_ck" ,
@@ -3384,6 +3497,19 @@ int __init omap3xxx_clk_init(void) }if (cpu_is_omap3630 ()) { + cpu_mask |=RATE_IN_36XX ; + cpu_clkflg |=CK_36XX ; + +/* +* XXX This type of dynamic rewriting of the clock tree is +* deprecated and should be revised soon. +*/ + dpll4_m2_ck = dpll4_m2_ck_3630; + dpll4_m3_ck = dpll4_m3_ck_3630; + dpll4_m4_ck = dpll4_m4_ck_3630; + dpll4_m5_ck = dpll4_m5_ck_3630; + dpll4_m6_ck = dpll4_m6_ck_3630; +/* * For 3630: override clkops_omap2_dflt_wait for the * clocks affected from PWRDN reset Limitation
@@ -3400,6 +3526,16 @@ int __init omap3xxx_clk_init(void) &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; dpll4_m6x2_ck.ops = &clkops_omap36xx_pwrdn_with_hsdiv_wait_restore; + }else { +/* +* XXX This type of dynamic rewriting of the clock tree is +* deprecated and should be revised soon. +*/ + dpll4_m2_ck = dpll4_m2_ck_34xx; + dpll4_m3_ck = dpll4_m3_ck_34xx; + dpll4_m4_ck = dpll4_m4_ck_34xx; + dpll4_m5_ck = dpll4_m5_ck_34xx; + dpll4_m6_ck = dpll4_m6_ck_34xx; }if (cpu_is_omap3630 ())
arch/arm/mach-omap2/cm-regbits-34xx.h +5 -0
@@ -542,6 +542,7 @@/* CM_CLKSEL3_PLL */ #define OMAP3430_DIV_96M_SHIFT 0#define OMAP3430_DIV_96M_MASK (0x1f << 0) +#define OMAP3630_DIV_96M_MASK (0x3f << 0)/* CM_CLKSEL4_PLL */ #define OMAP3430ES2_PERIPH2_DPLL_MULT_SHIFT 8
@@ -588,8 +589,10 @@/* CM_CLKSEL_DSS */ #define OMAP3430_CLKSEL_TV_SHIFT 8#define OMAP3430_CLKSEL_TV_MASK (0x1f << 8) +#define OMAP3630_CLKSEL_TV_MASK (0x3f << 8)#define OMAP3430_CLKSEL_DSS1_SHIFT 0#define OMAP3430_CLKSEL_DSS1_MASK (0x1f << 0) +#define OMAP3630_CLKSEL_DSS1_MASK (0x3f << 0)/* CM_SLEEPDEP_DSS specific bits */
@@ -617,6 +620,7 @@/* CM_CLKSEL_CAM */ #define OMAP3430_CLKSEL_CAM_SHIFT 0#define OMAP3430_CLKSEL_CAM_MASK (0x1f << 0) +#define OMAP3630_CLKSEL_CAM_MASK (0x3f << 0)/* CM_SLEEPDEP_CAM specific bits */
@@ -712,6 +716,7 @@/* CM_CLKSEL1_EMU */ #define OMAP3430_DIV_DPLL4_SHIFT 24#define OMAP3430_DIV_DPLL4_MASK (0x1f << 24) +#define OMAP3630_DIV_DPLL4_MASK (0x3f << 24)#define OMAP3430_DIV_DPLL3_SHIFT 16#define OMAP3430_DIV_DPLL3_MASK (0x1f << 16)#define OMAP3430_CLKSEL_TRACECLK_SHIFT 11
arch/arm/plat-omap/include/plat/clock.h +3 -2
@@ -169,8 +169,9 @@ extern const struct clkops clkops_null;#define RATE_IN_242X (1 << 1)#define RATE_IN_243X (1 << 2)#define RATE_IN_343X (1 << 3)/* rates common to all 343X */ -#define RATE_IN_3430ES2 (1 << 4)/* 3430ES2 rates only */ -#define RATE_IN_4430 (1 << 5) +#define RATE_IN_3430ES2 (1 << 4)/* 3430ES2 rates only */ +#define RATE_IN_36XX (1 << 5) +#define RATE_IN_4430 (1 << 6)#define RATE_IN_24XX (RATE_IN_242X | RATE_IN_243X)
Paul Walmsley
maintainerPATCH 19/19 OMAP3 clock: add support for 192Mhz DPLL4M2 output
In reply to Paul WalmsleyFrom: Vishwanath BS <[email protected]>
In 3630, DPLL4M2 output can be 96MHz or 192MHz (for SGX to run at 192). This patch has changes to support this feature. 96MHz clock is generated by dividing 192Mhz clock by 2 using CM_CLKSEL_CORE register. SGX can select Core Clock, 192MHz clock or CM_96M_FCLK as it's functional clock. In summary changes done are:
1. Added a feature called omap3_has_192mhz_clk and enabled for 3630
2. Added a new clock node called omap_192m_alwon_ck
3. Made omap_96m_alwon_fck to derive its clock from omap_192m_alwon_ck
--- arch/arm/mach-omap2/clock34xx_data.c | 66 +++++++++++++++++++++++++++++---- arch/arm/mach-omap2/cm-regbits-34xx.h | 2 + arch/arm/mach-omap2/id.c | 3 ++ arch/arm/plat-omap/include/plat/cpu.h | 2 + 4 files changed, 65 insertions(+), 8 deletions(-)
arch/arm/mach-omap2/clock34xx_data.c +58 -8
@@ -692,18 +692,24 @@ static struct clk dpll4_m2x2_ck = {* 96M_ALWON_FCLK (called "omap_96m_alwon_fck" below) and * CM_96K_(F)CLK. */ -static struct clk omap_96m_alwon_fck = { - .name ="omap_96m_alwon_fck" , + +/* Adding 192MHz Clock node needed by SGX */ +static struct clk omap_192m_alwon_fck = { + .name ="omap_192m_alwon_fck" , .ops = &clkops_null, .parent = &dpll4_m2x2_ck, .recalc = &followparent_recalc, }; -static struct clk cm_96m_fck = { - .name ="cm_96m_fck" , - .ops = &clkops_null, - .parent = &omap_96m_alwon_fck, - .recalc = &followparent_recalc, +static const struct clksel_rate omap_96m_alwon_fck_rates[] = { + { .div =1 , .val =1 , .flags =RATE_IN_36XX }, + { .div =2 , .val =2 , .flags =RATE_IN_36XX |DEFAULT_RATE }, + { .div =0 } +}; + +static const struct clksel omap_96m_alwon_fck_clksel[] = { + { .parent = &omap_192m_alwon_fck, .rates = omap_96m_alwon_fck_rates }, + { .parent =NULL } };static const struct clksel_rate omap_96m_dpll_rates[] = {
@@ -716,6 +722,31 @@ static const struct clksel_rate omap_96m_sys_rates[] = { { .div = 0 } }; +static struct clk omap_96m_alwon_fck = { + .name ="omap_96m_alwon_fck" , + .ops = &clkops_null, + .parent = &dpll4_m2x2_ck, + .recalc = &followparent_recalc, +}; + +static struct clk omap_96m_alwon_fck_3630 = { + .name ="omap_96m_alwon_fck" , + .parent = &omap_192m_alwon_fck, + .init = &omap2_init_clksel_parent, + .ops = &clkops_null, + .recalc = &omap2_clksel_recalc, + .clksel_reg =OMAP_CM_REGADDR (CORE_MOD ,CM_CLKSEL ), + .clksel_mask =OMAP3630_CLKSEL_96M_MASK , + .clksel = omap_96m_alwon_fck_clksel +}; + +static struct clk cm_96m_fck = { + .name ="cm_96m_fck" , + .ops = &clkops_null, + .parent = &omap_96m_alwon_fck, + .recalc = &followparent_recalc, +}; +static const struct clksel omap_96m_fck_clksel[] = { { .parent = &cm_96m_fck, .rates = omap_96m_dpll_rates }, { .parent = &sys_ck, .rates = omap_96m_sys_rates },
@@ -1304,12 +1335,24 @@ static struct clk gfx_cg2_ck = {/* SGX power domain - 3430ES2 only */ static const struct clksel_rate sgx_core_rates[] = { + { .div =2 , .val =5 , .flags =RATE_IN_36XX }, { .div =3 , .val =0 , .flags =RATE_IN_343X |DEFAULT_RATE }, { .div =4 , .val =1 , .flags =RATE_IN_343X }, { .div =6 , .val =2 , .flags =RATE_IN_343X }, { .div =0 }, }; +static const struct clksel_rate sgx_192m_rates[] = { + { .div =1 , .val =4 , .flags =RATE_IN_36XX |DEFAULT_RATE }, + { .div =0 }, +}; + +static const struct clksel_rate sgx_corex2_rates[] = { + { .div =3 , .val =6 , .flags =RATE_IN_36XX |DEFAULT_RATE }, + { .div =5 , .val =7 , .flags =RATE_IN_36XX }, + { .div =0 }, +}; +static const struct clksel_rate sgx_96m_rates[] = { { .div =1 , .val =3 , .flags =RATE_IN_343X |DEFAULT_RATE }, { .div =0 },
@@ -1318,7 +1361,9 @@ static const struct clksel_rate sgx_96m_rates[] = {static const struct clksel sgx_clksel[] = { { .parent = &core_ck, .rates = sgx_core_rates }, { .parent = &cm_96m_fck, .rates = sgx_96m_rates }, - { .parent =NULL }, + { .parent = &omap_192m_alwon_fck, .rates = sgx_192m_rates }, + { .parent = &corex2_fck, .rates = sgx_corex2_rates }, + { .parent =NULL } };static struct clk sgx_fck = {
@@ -1332,6 +1377,8 @@ static struct clk sgx_fck = { .clksel = sgx_clksel, .clkdm_name = "sgx_clkdm", .recalc = &omap2_clksel_recalc, + .set_rate = &omap2_clksel_set_rate, + .round_rate = &omap2_clksel_round_rate };static struct clk sgx_ick = {
@@ -3262,6 +3309,7 @@ static struct omap_clk omap3xxx_clks[] = {CLK ("etb" ,"emu_core_alwon_ck" , &emu_core_alwon_ck,CK_3XXX ),CLK (NULL ,"dpll4_ck" , &dpll4_ck,CK_3XXX ),CLK (NULL ,"dpll4_x2_ck" , &dpll4_x2_ck,CK_3XXX ), +CLK (NULL ,"omap_192m_alwon_fck" , &omap_192m_alwon_fck,CK_36XX ),CLK (NULL ,"omap_96m_alwon_fck" , &omap_96m_alwon_fck,CK_3XXX ),CLK (NULL ,"omap_96m_fck" , &omap_96m_fck,CK_3XXX ), CLK(NULL, "cm_96m_fck", &cm_96m_fck, CK_3XXX),
@@ -3495,6 +3543,8 @@ int __init omap3xxx_clk_init(void) cpu_clkflg |=CK_3430ES2 ; } } +if (omap3_has_192mhz_clk ()) + omap_96m_alwon_fck = omap_96m_alwon_fck_3630;if (cpu_is_omap3630 ()) { cpu_mask |=RATE_IN_36XX ;
arch/arm/mach-omap2/cm-regbits-34xx.h +2 -0
@@ -346,6 +346,8 @@#define OMAP3430_CLKSEL_L4_MASK (0x3 << 2)#define OMAP3430_CLKSEL_L3_SHIFT 0#define OMAP3430_CLKSEL_L3_MASK (0x3 << 0) +#define OMAP3630_CLKSEL_96M_SHIFT 12 +#define OMAP3630_CLKSEL_96M_MASK (0x3 << 12)/* CM_CLKSTCTRL_CORE */ #define OMAP3430ES1_CLKTRCTRL_D2D_SHIFT 4
arch/arm/mach-omap2/id.c +3 -0
@@ -175,6 +175,8 @@ void __init omap3_check_features(void)OMAP3_CHECK_FEATURE (status,SGX );OMAP3_CHECK_FEATURE (status,NEON );OMAP3_CHECK_FEATURE (status,ISP ); +if (cpu_is_omap3630 ()) + omap3_features |=OMAP3_HAS_192MHZ_CLK ;/* * TODO: Get additional info (where applicable)
@@ -359,6 +361,7 @@ void __init omap3_cpuinfo(void)OMAP3_SHOW_FEATURE (sgx);OMAP3_SHOW_FEATURE (neon);OMAP3_SHOW_FEATURE (isp); + OMAP3_SHOW_FEATURE(192mhz_clk);printk (")\n" ); }
arch/arm/plat-omap/include/plat/cpu.h +2 -0
@@ -507,6 +507,7 @@ extern u32 omap3_features;#define OMAP3_HAS_SGX BIT(2)#define OMAP3_HAS_NEON BIT(3)#define OMAP3_HAS_ISP BIT(4) +#define OMAP3_HAS_192MHZ_CLK BIT(5)#define OMAP3_HAS_FEATURE (feat,flag) \ static inline unsigned int omap3_has_ ##feat(void) \
@@ -519,5 +520,6 @@ OMAP3_HAS_FEATURE(sgx, SGX) OMAP3_HAS_FEATURE(iva, IVA) OMAP3_HAS_FEATURE(neon, NEON) OMAP3_HAS_FEATURE(isp, ISP) +OMAP3_HAS_FEATURE(192mhz_clk, 192MHZ_CLK)#endif