ARM: tegra: Define Tegra114 CAR binding
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH v6 1/10 clk: tegra: Refactor PLL programming code
Refactor the PLL programming code to make it useable by the new PLL types introduced by Tegra114.
The following changes were done:
* Split programming the PLL into updating m,n,p and updating cpcon
* Move locking from _update_pll_cpcon() to clk_pll_set_rate()
* Introduce _get_pll_mnp() helper
* Move check for identical m,n,p values to clk_pll_set_rate()
* struct tegra_clk_pll_freq_table will always contain the values as defined by the hardware.
* Simplify the arguments to clk_pll_wait_for_lock()
* Split _tegra_clk_register_pll()
--- drivers/clk/tegra/clk-pll.c | 262 ++++++++++++++++++++++++--------------- drivers/clk/tegra/clk-tegra20.c | 144 +++++++++++----------- drivers/clk/tegra/clk-tegra30.c | 234 +++++++++++++++++----------------- drivers/clk/tegra/clk.h | 9 +- 4 files changed, 356 insertions(+), 293 deletions(-)
drivers/clk/tegra/clk-pll.c +161 -101
@@ -1,5 +1,5 @@/* -* Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. +* Copyright (c) 2012, 2013, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License,
@@ -113,20 +113,28 @@ static void clk_pll_enable_lock(struct tegra_clk_pll *pll)pll_writel_misc (val, pll); } -static int clk_pll_wait_for_lock (struct tegra_clk_pll *pll, -void __iomem *lock_addr,u32 lock_bit_idx) +static int clk_pll_wait_for_lock (struct tegra_clk_pll *pll) {int i; -u32 val; +u32 val, lock_bit; +void __iomem *lock_addr;if (!(pll->flags &TEGRA_PLL_USE_LOCK )) {udelay (pll->params->lock_delay);return 0 ; } + lock_addr = pll->clk_base; +if (pll->flags &TEGRA_PLL_LOCK_MISC ) + lock_addr += pll->params->misc_reg; +else + lock_addr += pll->params->base_reg; + + lock_bit =BIT (pll->params->lock_bit_idx); +for (i =0 ; i < pll->params->lock_delay; i++) { val =readl_relaxed (lock_addr); -if (val &BIT (lock_bit_idx)) { +if (val & lock_bit) {udelay (PLL_POST_LOCK_DELAY );return 0 ; }
@@ -155,7 +163,7 @@ static int clk_pll_is_enabled(struct clk_hw *hw)return val &PLL_BASE_ENABLE ?1 :0 ; } -static int _clk_pll_enable (struct clk_hw *hw) +static void _clk_pll_enable (struct clk_hw *hw) {struct tegra_clk_pll *pll =to_clk_pll (hw);u32 val;
@@ -172,11 +180,6 @@ static int _clk_pll_enable(struct clk_hw *hw) val |=PMC_PLLP_WB0_OVERRIDE_PLLM_ENABLE ;writel_relaxed (val, pll->pmc +PMC_PLLP_WB0_OVERRIDE ); } - -clk_pll_wait_for_lock (pll, pll->clk_base + pll->params->base_reg, - pll->params->lock_bit_idx); - -return 0 ; }static void _clk_pll_disable (struct clk_hw *hw)
@@ -204,7 +207,9 @@ static int clk_pll_enable(struct clk_hw *hw)if (pll->lock)spin_lock_irqsave (pll->lock, flags); - ret =_clk_pll_enable (hw); +_clk_pll_enable (hw); + + ret =clk_pll_wait_for_lock (pll);if (pll->lock)spin_unlock_irqrestore (pll->lock, flags);
@@ -241,8 +246,6 @@ static int _get_table_rate(struct clk_hw *hw,if (sel->input_rate ==0 )return -EINVAL ; -BUG_ON (sel->p <1 ); - cfg->input_rate = sel->input_rate; cfg->output_rate = sel->output_rate; cfg->m = sel->m;
@@ -290,88 +293,109 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, cfg->output_rate <<= 1) p_div++; - cfg->p =1 << p_div; + cfg->p = p_div; cfg->m = parent_rate / cfreq; cfg->n = cfg->output_rate / cfreq; cfg->cpcon =OUT_OF_TABLE_CPCON ;if (cfg->m >divm_max (pll) || cfg->n >divn_max (pll) || - cfg->p >divp_max (pll) || cfg->output_rate > pll->params->vco_max) { + (1 << p_div) >divp_max (pll) + || cfg->output_rate > pll->params->vco_max) {pr_err ("%s: Failed to set %s rate %lu\n" , __func__,__clk_get_name (hw->clk), rate);return -EINVAL ; } +if (pll->flags &TEGRA_PLLU ) + cfg->p ^=1 ; +return 0 ; } -static int _program_pll (struct clk_hw *hw,struct tegra_clk_pll_freq_table *cfg, -unsigned long rate) +static void _update_pll_mnp (struct tegra_clk_pll *pll, +struct tegra_clk_pll_freq_table *cfg) { -struct tegra_clk_pll *pll =to_clk_pll (hw); -unsigned long flags =0 ; -u32 divp, val, old_base; -int state; - - divp =__ffs (cfg->p); - -if (pll->flags &TEGRA_PLLU ) - divp ^=1 ; +u32 val; -if (pll->lock) -spin_lock_irqsave (pll->lock, flags); + val =pll_readl_base (pll); - old_base = val =pll_readl_base (pll); val &= ~((divm_mask (pll) << pll->divm_shift) | (divn_mask (pll) << pll->divn_shift) | (divp_mask (pll) << pll->divp_shift)); val |= ((cfg->m << pll->divm_shift) | (cfg->n << pll->divn_shift) | - (divp << pll->divp_shift)); -if (val == old_base) { -if (pll->lock) -spin_unlock_irqrestore (pll->lock, flags); -return 0 ; + (cfg->p << pll->divp_shift)); + +pll_writel_base (val, pll); +} + +static void _get_pll_mnp (struct tegra_clk_pll *pll, +struct tegra_clk_pll_freq_table *cfg) +{ +u32 val; + + val =pll_readl_base (pll); + + cfg->m = (val >> pll->divm_shift) & (divm_mask (pll)); + cfg->n = (val >> pll->divn_shift) & (divn_mask (pll)); + cfg->p = (val >> pll->divp_shift) & (divp_mask (pll)); +} + +static void _update_pll_cpcon (struct tegra_clk_pll *pll, +struct tegra_clk_pll_freq_table *cfg, +unsigned long rate) +{ +u32 val; + + val =pll_readl_misc (pll); + + val &= ~(PLL_MISC_CPCON_MASK <<PLL_MISC_CPCON_SHIFT ); + val |= cfg->cpcon <<PLL_MISC_CPCON_SHIFT ; + +if (pll->flags &TEGRA_PLL_SET_LFCON ) { + val &= ~(PLL_MISC_LFCON_MASK <<PLL_MISC_LFCON_SHIFT ); +if (cfg->n >=PLLDU_LFCON_SET_DIVN ) + val |=1 <<PLL_MISC_LFCON_SHIFT ; + }else if (pll->flags &TEGRA_PLL_SET_DCCON ) { + val &= ~(1 <<PLL_MISC_DCCON_SHIFT ); +if (rate >= (pll->params->vco_max >>1 )) + val |=1 <<PLL_MISC_DCCON_SHIFT ; } +pll_writel_misc (val, pll); +} + +static int _program_pll (struct clk_hw *hw,struct tegra_clk_pll_freq_table *cfg, +unsigned long rate) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +int state, ret =0 ; + state =clk_pll_is_enabled (hw); -if (state) { +if (state)_clk_pll_disable (hw); - val &= ~(PLL_BASE_BYPASS |PLL_BASE_ENABLE ); - } -pll_writel_base (val, pll); -if (pll->flags &TEGRA_PLL_HAS_CPCON ) { - val =pll_readl_misc (pll); - val &= ~(PLL_MISC_CPCON_MASK <<PLL_MISC_CPCON_SHIFT ); - val |= cfg->cpcon <<PLL_MISC_CPCON_SHIFT ; -if (pll->flags &TEGRA_PLL_SET_LFCON ) { - val &= ~(PLL_MISC_LFCON_MASK <<PLL_MISC_LFCON_SHIFT ); -if (cfg->n >=PLLDU_LFCON_SET_DIVN ) - val |=0x1 <<PLL_MISC_LFCON_SHIFT ; - }else if (pll->flags &TEGRA_PLL_SET_DCCON ) { - val &= ~(0x1 <<PLL_MISC_DCCON_SHIFT ); -if (rate >= (pll->params->vco_max >>1 )) - val |=0x1 <<PLL_MISC_DCCON_SHIFT ; - } -pll_writel_misc (val, pll); - } +_update_pll_mnp (pll, cfg); -if (pll->lock) -spin_unlock_irqrestore (pll->lock, flags); +if (pll->flags &TEGRA_PLL_HAS_CPCON ) +_update_pll_cpcon (pll, cfg, rate); -if (state) -clk_pll_enable (hw); +if (state) { +_clk_pll_enable (hw); + ret =clk_pll_wait_for_lock (pll); + } -return 0 ; +return ret; }static int clk_pll_set_rate (struct clk_hw *hw,unsigned long rate,unsigned long parent_rate) {struct tegra_clk_pll *pll =to_clk_pll (hw); -struct tegra_clk_pll_freq_table cfg; +struct tegra_clk_pll_freq_table cfg, old_cfg; +unsigned long flags =0 ; +int ret =0 ;if (pll->flags &TEGRA_PLL_FIXED ) {if (rate != pll->fixed_rate) {
@@ -387,7 +411,18 @@ static int clk_pll_set_rate(struct clk_hw *hw, unsigned long rate, _calc_rate(hw, &cfg, rate, parent_rate))return -EINVAL ; -return _program_pll (hw, &cfg, rate); +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + +_get_pll_mnp (pll, &old_cfg); + +if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p) + ret =_program_pll (hw, &cfg, rate); + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return ret; } static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,
@@ -409,7 +444,7 @@ static long clk_pll_round_rate(struct clk_hw *hw, unsigned long rate,return -EINVAL ; output_rate *= cfg.n; -do_div (output_rate, cfg.m * cfg.p); +do_div (output_rate, cfg.m * (1 << cfg.p));return output_rate; }
@@ -418,10 +453,12 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) {struct tegra_clk_pll *pll =to_clk_pll (hw); -u32 val =pll_readl_base (pll); -u32 divn =0 , divm =0 , divp =0 ; +struct tegra_clk_pll_freq_table cfg; +u32 val;u64 rate = parent_rate; + val =pll_readl_base (pll); +if (val &PLL_BASE_BYPASS )return parent_rate;
@@ -435,16 +472,16 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,return pll->fixed_rate; } - divp = (val >> pll->divp_shift) & (divp_mask (pll)); +_get_pll_mnp (pll, &cfg); +if (pll->flags &TEGRA_PLLU ) - divp ^=1 ; + cfg.p ^=1 ; - divn = (val >> pll->divn_shift) & (divn_mask (pll)); - divm = (val >> pll->divm_shift) & (divm_mask (pll)); - divm *= (1 << divp); + cfg.m *=1 << cfg.p; + + rate *= cfg.n; +do_div (rate, cfg.m); - rate *= divn; -do_div (rate, divm);return rate; }
@@ -538,8 +575,8 @@ static int clk_plle_enable(struct clk_hw *hw) val |= (PLL_BASE_BYPASS |PLL_BASE_ENABLE );pll_writel_base (val, pll); -clk_pll_wait_for_lock (pll, pll->clk_base + pll->params->misc_reg, - pll->params->lock_bit_idx); +clk_pll_wait_for_lock (pll); +return 0 ; }
@@ -577,28 +614,17 @@ const struct clk_ops tegra_clk_plle_ops = { .enable = clk_plle_enable, }; -static struct clk *_tegra_clk_register_pll (const char *name, -const char *parent_name,void __iomem *clk_base, -void __iomem *pmc,unsigned long flags, -unsigned long fixed_rate, -struct tegra_clk_pll_params *pll_params,u8 pll_flags, -struct tegra_clk_pll_freq_table *freq_table,spinlock_t *lock, -const struct clk_ops *ops) +static struct tegra_clk_pll *_tegra_init_pll (void __iomem *clk_base, +void __iomem *pmc,unsigned long fixed_rate, +struct tegra_clk_pll_params *pll_params,u32 pll_flags, +struct tegra_clk_pll_freq_table *freq_table,spinlock_t *lock) {struct tegra_clk_pll *pll; -struct clk *clk; -struct clk_init_data init; pll =kzalloc (sizeof (*pll),GFP_KERNEL );if (!pll)return ERR_PTR (-ENOMEM ); - init.name = name; - init.ops = ops; - init.flags = flags; - init.parent_names = (parent_name ? &parent_name :NULL ); - init.num_parents = (parent_name ?1 :0 ); - pll->clk_base = clk_base; pll->pmc = pmc;
@@ -615,34 +641,68 @@ static struct clk *_tegra_clk_register_pll(const char *name, pll->divm_shift =PLL_BASE_DIVM_SHIFT ; pll->divm_width =PLL_BASE_DIVM_WIDTH ; +return pll; +} + +static struct clk *_tegra_clk_register_pll (struct tegra_clk_pll *pll, +const char *name,const char *parent_name,unsigned long flags, +const struct clk_ops *ops) +{ +struct clk_init_data init; + + init.name = name; + init.ops = ops; + init.flags = flags; + init.parent_names = (parent_name ? &parent_name :NULL ); + init.num_parents = (parent_name ?1 :0 ); +/* Data in .init is copied by clk_register(), so stack variable OK */ pll->hw.init = &init; - clk =clk_register (NULL , &pll->hw); -if (IS_ERR (clk)) -kfree (pll); - -return clk; +return clk_register (NULL , &pll->hw); }struct clk *tegra_clk_register_pll (const char *name,const char *parent_name,void __iomem *clk_base,void __iomem *pmc,unsigned long flags,unsigned long fixed_rate, -struct tegra_clk_pll_params *pll_params,u8 pll_flags, +struct tegra_clk_pll_params *pll_params,u32 pll_flags,struct tegra_clk_pll_freq_table *freq_table,spinlock_t *lock) { -return _tegra_clk_register_pll (name, parent_name, clk_base, pmc, - flags, fixed_rate, pll_params, pll_flags, freq_table, - lock, &tegra_clk_pll_ops); +struct tegra_clk_pll *pll; +struct clk *clk; + + pll =_tegra_init_pll (clk_base, pmc, fixed_rate, pll_params, pll_flags, + freq_table, lock); +if (IS_ERR (pll)) +return ERR_CAST (pll); + + clk =_tegra_clk_register_pll (pll, name, parent_name, flags, + &tegra_clk_pll_ops); +if (IS_ERR (clk)) +kfree (pll); + +return clk; }struct clk *tegra_clk_register_plle (const char *name,const char *parent_name,void __iomem *clk_base,void __iomem *pmc,unsigned long flags,unsigned long fixed_rate, -struct tegra_clk_pll_params *pll_params,u8 pll_flags, +struct tegra_clk_pll_params *pll_params,u32 pll_flags,struct tegra_clk_pll_freq_table *freq_table,spinlock_t *lock) { -return _tegra_clk_register_pll (name, parent_name, clk_base, pmc, - flags, fixed_rate, pll_params, pll_flags, freq_table, - lock, &tegra_clk_plle_ops); +struct tegra_clk_pll *pll; +struct clk *clk; + pll_flags |=TEGRA_PLL_LOCK_MISC ; + + pll =_tegra_init_pll (clk_base, pmc, fixed_rate, pll_params, pll_flags, + freq_table, lock); +if (IS_ERR (pll)) +return ERR_CAST (pll); + + clk =_tegra_clk_register_pll (pll, name, parent_name, flags, + &tegra_clk_plle_ops); +if (IS_ERR (clk)) +kfree (pll); + +return clk; }
drivers/clk/tegra/clk-tegra20.c +72 -72
197 lines not on this page · raw message
drivers/clk/tegra/clk-tegra30.c +117 -117
281 lines not on this page · raw message
drivers/clk/tegra/clk.h +6 -3
@@ -182,12 +182,14 @@ struct tegra_clk_pll_params {* TEGRA_PLL_FIXED - We are not supposed to change output frequency * of some plls. * TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling. +* TEGRA_PLL_LOCK_MISC - Lock bit is in the misc register instead of the +* base register. */ struct tegra_clk_pll {struct clk_hw hw;void __iomem *clk_base;void __iomem *pmc; -u8 flags; +u32 flags;unsigned long fixed_rate;spinlock_t *lock;u8 divn_shift;
@@ -210,18 +212,19 @@ struct tegra_clk_pll {#define TEGRA_PLLM BIT(5)#define TEGRA_PLL_FIXED BIT(6)#define TEGRA_PLLE_CONFIGURE BIT(7) +#define TEGRA_PLL_LOCK_MISC BIT(8)extern const struct clk_ops tegra_clk_pll_ops;extern const struct clk_ops tegra_clk_plle_ops;struct clk *tegra_clk_register_pll (const char *name,const char *parent_name,void __iomem *clk_base,void __iomem *pmc,unsigned long flags,unsigned long fixed_rate, -struct tegra_clk_pll_params *pll_params,u8 pll_flags, +struct tegra_clk_pll_params *pll_params,u32 pll_flags,struct tegra_clk_pll_freq_table *freq_table,spinlock_t *lock);struct clk *tegra_clk_register_plle (const char *name,const char *parent_name,void __iomem *clk_base,void __iomem *pmc,unsigned long flags,unsigned long fixed_rate, -struct tegra_clk_pll_params *pll_params,u8 pll_flags, +struct tegra_clk_pll_params *pll_params,u32 pll_flags,struct tegra_clk_pll_freq_table *freq_table,spinlock_t *lock);/**
Signature · 1 line
1.7.1
PATCH v6 2/10 clk: tegra: Add TEGRA_PLL_BYPASS flag
In reply to a message not in the archiveNot all PLLs in Tegra114 have a bypass bit. Adapt the common code to only use this bit when available.
--- drivers/clk/tegra/clk-pll.c | 12 ++++++++---- drivers/clk/tegra/clk.h | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-)
drivers/clk/tegra/clk-pll.c +8 -4
@@ -171,7 +171,8 @@ static void _clk_pll_enable(struct clk_hw *hw)clk_pll_enable_lock (pll); val =pll_readl_base (pll); - val &= ~PLL_BASE_BYPASS ; +if (pll->flags &TEGRA_PLL_BYPASS ) + val &= ~PLL_BASE_BYPASS ; val |=PLL_BASE_ENABLE ;pll_writel_base (val, pll);
@@ -188,7 +189,9 @@ static void _clk_pll_disable(struct clk_hw *hw)u32 val; val =pll_readl_base (pll); - val &= ~(PLL_BASE_BYPASS |PLL_BASE_ENABLE ); +if (pll->flags &TEGRA_PLL_BYPASS ) + val &= ~PLL_BASE_BYPASS ; + val &= ~PLL_BASE_ENABLE ;pll_writel_base (val, pll);if (pll->flags &TEGRA_PLLM ) {
@@ -459,7 +462,7 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, val =pll_readl_base (pll); -if (val &PLL_BASE_BYPASS ) +if ((pll->flags &TEGRA_PLL_BYPASS ) && (val &PLL_BASE_BYPASS ))return parent_rate;if ((pll->flags &TEGRA_PLL_FIXED ) && !(val &PLL_BASE_OVERRIDE )) {
@@ -671,6 +674,7 @@ struct clk *tegra_clk_register_pll(const char *name, const char *parent_name,struct tegra_clk_pll *pll;struct clk *clk; + pll_flags |=TEGRA_PLL_BYPASS ; pll =_tegra_init_pll (clk_base, pmc, fixed_rate, pll_params, pll_flags, freq_table, lock);if (IS_ERR (pll))
@@ -692,8 +696,8 @@ struct clk *tegra_clk_register_plle(const char *name, const char *parent_name, {struct tegra_clk_pll *pll;struct clk *clk; - pll_flags |=TEGRA_PLL_LOCK_MISC ; + pll_flags |=TEGRA_PLL_LOCK_MISC |TEGRA_PLL_BYPASS ; pll =_tegra_init_pll (clk_base, pmc, fixed_rate, pll_params, pll_flags, freq_table, lock);if (IS_ERR (pll))
drivers/clk/tegra/clk.h +2 -0
@@ -184,6 +184,7 @@ struct tegra_clk_pll_params {* TEGRA_PLLE_CONFIGURE - Configure PLLE when enabling. * TEGRA_PLL_LOCK_MISC - Lock bit is in the misc register instead of the * base register. +* TEGRA_PLL_BYPASS - PLL has bypass bit */ struct tegra_clk_pll {struct clk_hw hw;
@@ -213,6 +214,7 @@ struct tegra_clk_pll {#define TEGRA_PLL_FIXED BIT(6)#define TEGRA_PLLE_CONFIGURE BIT(7)#define TEGRA_PLL_LOCK_MISC BIT(8) +#define TEGRA_PLL_BYPASS BIT(9)extern const struct clk_ops tegra_clk_pll_ops;extern const struct clk_ops tegra_clk_plle_ops;
Signature · 1 line
1.7.1
PATCH v6 3/10 clk: tegra: Add PLL post divider table
In reply to a message not in the archiveSome PLLs in Tegra114 don't use a power of 2 mapping for the post divider. Introduce a table based approach and switch PLLU to it.
--- drivers/clk/tegra/clk-pll.c | 38 ++++++++++++++++++++++++++++++++------ drivers/clk/tegra/clk-tegra20.c | 7 +++++++ drivers/clk/tegra/clk-tegra30.c | 7 +++++++ drivers/clk/tegra/clk.h | 13 +++++++++++++ 4 files changed, 59 insertions(+), 6 deletions(-)
drivers/clk/tegra/clk-pll.c +32 -6
@@ -263,6 +263,7 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, unsigned long rate, unsigned long parent_rate) { struct tegra_clk_pll *pll = to_clk_pll(hw); +struct pdiv_map *p_tohw = pll->params->pdiv_tohw;unsigned long cfreq;u32 p_div =0 ;
@@ -296,7 +297,6 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg, cfg->output_rate <<= 1) p_div++; - cfg->p = p_div; cfg->m = parent_rate / cfreq; cfg->n = cfg->output_rate / cfreq; cfg->cpcon =OUT_OF_TABLE_CPCON ;
@@ -309,8 +309,19 @@ static int _calc_rate(struct clk_hw *hw, struct tegra_clk_pll_freq_table *cfg,return -EINVAL ; } -if (pll->flags &TEGRA_PLLU ) - cfg->p ^=1 ; +if (p_tohw) { + p_div =1 << p_div; +while (p_tohw->pdiv) { +if (p_div <= p_tohw->pdiv) { + cfg->p = p_tohw->hw_val; +break ; + } + p_tohw++; + } +if (!p_tohw->pdiv) +return -EINVAL ; + }else + cfg->p = p_div;return 0 ; }
@@ -457,8 +468,10 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw, {struct tegra_clk_pll *pll =to_clk_pll (hw);struct tegra_clk_pll_freq_table cfg; +struct pdiv_map *p_tohw = pll->params->pdiv_tohw;u32 val;u64 rate = parent_rate; +int pdiv; val =pll_readl_base (pll);
@@ -477,10 +490,23 @@ static unsigned long clk_pll_recalc_rate(struct clk_hw *hw,_get_pll_mnp (pll, &cfg); -if (pll->flags &TEGRA_PLLU ) - cfg.p ^=1 ; +if (p_tohw) { +while (p_tohw->pdiv) { +if (cfg.p == p_tohw->hw_val) { + pdiv = p_tohw->pdiv; +break ; + } + p_tohw++; + } + +if (!p_tohw->pdiv) { +WARN_ON (1 ); + pdiv =1 ; + } + }else + pdiv =1 << cfg.p; - cfg.m *=1 << cfg.p; + cfg.m *= pdiv; rate *= cfg.n;do_div (rate, cfg.m);
drivers/clk/tegra/clk-tegra20.c +7 -0
@@ -440,6 +440,12 @@ static struct tegra_clk_pll_params pll_d_params = { .lock_delay = 1000, }; +static struct pdiv_map pllu_p[] = { + { .pdiv =1 , .hw_val =1 }, + { .pdiv =2 , .hw_val =0 }, + { .pdiv =0 , .hw_val =0 }, +}; +static struct tegra_clk_pll_params pll_u_params = { .input_min =2000000 , .input_max =40000000 ,
@@ -452,6 +458,7 @@ static struct tegra_clk_pll_params pll_u_params = { .lock_bit_idx = PLL_BASE_LOCK, .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, .lock_delay = 1000, + .pdiv_tohw = pllu_p, };static struct tegra_clk_pll_params pll_x_params = {
drivers/clk/tegra/clk-tegra30.c +7 -0
@@ -466,6 +466,12 @@ static struct tegra_clk_pll_freq_table pll_d_freq_table[] = { { 0, 0, 0, 0, 0, 0 }, }; +static struct pdiv_map pllu_p[] = { + { .pdiv =1 , .hw_val =1 }, + { .pdiv =2 , .hw_val =0 }, + { .pdiv =0 , .hw_val =0 }, +}; +static struct tegra_clk_pll_freq_table pll_u_freq_table[] = { {12000000 ,480000000 ,960 ,12 ,0 ,12 }, { 13000000, 480000000, 960, 13, 0, 12},
@@ -639,6 +645,7 @@ static struct tegra_clk_pll_params pll_u_params = { .lock_bit_idx = PLL_BASE_LOCK, .lock_enable_bit_idx = PLLDU_MISC_LOCK_ENABLE, .lock_delay = 1000, + .pdiv_tohw = pllu_p, };static struct tegra_clk_pll_params pll_x_params = {
drivers/clk/tegra/clk.h +13 -0
@@ -117,6 +117,17 @@ struct tegra_clk_pll_freq_table { };/** +* struct pdiv_map - map post divider to hw value +* +* @pdiv: post divider +* @hw_val: value to be written to the PLL hw +*/ +struct pdiv_map { +u8 pdiv; +u8 hw_val; +}; + +/** * struct clk_pll_params - PLL parameters * * @input_min: Minimum input frequency
@@ -146,6 +157,8 @@ struct tegra_clk_pll_params {u32 lock_bit_idx;u32 lock_enable_bit_idx;int lock_delay; +int max_p; +struct pdiv_map *pdiv_tohw; };/**
Signature · 1 line
1.7.1
PATCH v6 4/10 clk: tegra: Add new fields and PLL types for Tegra114
In reply to a message not in the archiveTegra114 introduces new PLL types. This requires new clocktypes as well as some new fields in the pll structure.
--- drivers/clk/tegra/clk-pll.c | 836 +++++++++++++++++++++++++++++++++++++++++++ drivers/clk/tegra/clk.h | 48 +++ 2 files changed, 884 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk-pll.c +836 -0
@@ -79,6 +79,48 @@#define PLLE_SS_CTRL 0x68#define PLLE_SS_DISABLE (7 << 10) +#define PLLE_AUX_PLLP_SEL BIT(2) +#define PLLE_AUX_ENABLE_SWCTL BIT(4) +#define PLLE_AUX_SEQ_ENABLE BIT(24) +#define PLLE_AUX_PLLRE_SEL BIT(28) + +#define PLLE_MISC_PLLE_PTS BIT(8) +#define PLLE_MISC_IDDQ_SW_VALUE BIT(13) +#define PLLE_MISC_IDDQ_SW_CTRL BIT(14) +#define PLLE_MISC_VREG_BG_CTRL_SHIFT 4 +#define PLLE_MISC_VREG_BG_CTRL_MASK (3 << PLLE_MISC_VREG_BG_CTRL_SHIFT) +#define PLLE_MISC_VREG_CTRL_SHIFT 2 +#define PLLE_MISC_VREG_CTRL_MASK (2 << PLLE_MISC_VREG_CTRL_SHIFT) + +#define PLLCX_MISC_STROBE BIT(31) +#define PLLCX_MISC_RESET BIT(30) +#define PLLCX_MISC_SDM_DIV_SHIFT 28 +#define PLLCX_MISC_SDM_DIV_MASK (0x3 << PLLCX_MISC_SDM_DIV_SHIFT) +#define PLLCX_MISC_FILT_DIV_SHIFT 26 +#define PLLCX_MISC_FILT_DIV_MASK (0x3 << PLLCX_MISC_FILT_DIV_SHIFT) +#define PLLCX_MISC_ALPHA_SHIFT 18 +#define PLLCX_MISC_DIV_LOW_RANGE \ + ((0x2 << PLLCX_MISC_SDM_DIV_SHIFT) | \ + (0x2 << PLLCX_MISC_FILT_DIV_SHIFT)) +#define PLLCX_MISC_DIV_HIGH_RANGE \ + ((0x1 << PLLCX_MISC_SDM_DIV_SHIFT) | \ + (0x1 << PLLCX_MISC_FILT_DIV_SHIFT)) +#define PLLCX_MISC_COEF_LOW_RANGE \ + ((0x14 << PLLCX_MISC_KA_SHIFT) | (0x38 << PLLCX_MISC_KB_SHIFT)) +#define PLLCX_MISC_KA_SHIFT 2 +#define PLLCX_MISC_KB_SHIFT 9 +#define PLLCX_MISC_DEFAULT (PLLCX_MISC_COEF_LOW_RANGE | \ + (0x19 << PLLCX_MISC_ALPHA_SHIFT) | \ + PLLCX_MISC_DIV_LOW_RANGE | \ + PLLCX_MISC_RESET) +#define PLLCX_MISC1_DEFAULT 0x000d2308 +#define PLLCX_MISC2_DEFAULT 0x30211200 +#define PLLCX_MISC3_DEFAULT 0x200 + +#define PMC_PLLM_WB0_OVERRIDE 0x1dc +#define PMC_PLLM_WB0_OVERRIDE_2 0x2b0 +#define PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK BIT(27) +#define PMC_SATA_PWRGT 0x1ac#define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5)#define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4)
@@ -101,6 +143,24 @@#define divn_max (p) (divn_mask(p))#define divp_max (p) (1 << (divp_mask(p))) + +#ifdef CONFIG_ARCH_TEGRA_114_SOC +/* PLLXC has 4-bit PDIV, but entry 15 is not allowed in h/w */ +#define PLLXC_PDIV_MAX 14 + +/* non-monotonic mapping below is not a typo */ +static u8 pllxc_p[PLLXC_PDIV_MAX +1 ] = { +/* PDIV: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14 */ +/* p: */ 1 ,2 ,3 ,4 ,5 ,6 ,8 ,10 ,12 ,16 ,12 ,16 ,20 ,24 ,32 +}; + +#define PLLCX_PDIV_MAX 7 +static u8 pllcx_p[PLLCX_PDIV_MAX +1 ] = { +/* PDIV: 0, 1, 2, 3, 4, 5, 6, 7 */ +/* p: */ 1 ,2 ,3 ,4 ,6 ,8 ,12 ,16 +}; +#endif +static void clk_pll_enable_lock (struct tegra_clk_pll *pll) {u32 val;
@@ -643,6 +703,520 @@ const struct clk_ops tegra_clk_plle_ops = { .enable = clk_plle_enable, }; +#ifdef CONFIG_ARCH_TEGRA_114_SOC + +static int _pll_fixed_mdiv (struct tegra_clk_pll_params *pll_params, +unsigned long parent_rate) +{ +if (parent_rate > pll_params->cf_max) +return 2 ; +else +return 1 ; +} + +static int clk_pll_iddq_enable (struct clk_hw *hw) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +unsigned long flags =0 ; + +u32 val; +int ret; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + + val =pll_readl (pll->params->iddq_reg, pll); + val &= ~BIT (pll->params->iddq_bit_idx); +pll_writel (val, pll->params->iddq_reg, pll); +udelay (2 ); + +_clk_pll_enable (hw); + + ret =clk_pll_wait_for_lock (pll); + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return 0 ; +} + +static void clk_pll_iddq_disable (struct clk_hw *hw) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +unsigned long flags =0 ; +u32 val; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + +_clk_pll_disable (hw); + + val =pll_readl (pll->params->iddq_reg, pll); + val |=BIT (pll->params->iddq_bit_idx); +pll_writel (val, pll->params->iddq_reg, pll); +udelay (2 ); + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); +} + +static int _calc_dynamic_ramp_rate (struct clk_hw *hw, +struct tegra_clk_pll_freq_table *cfg, +unsigned long rate,unsigned long parent_rate) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +unsigned int p; + +if (!rate) +return -EINVAL ; + + p =DIV_ROUND_UP (pll->params->vco_min, rate); + cfg->m =_pll_fixed_mdiv (pll->params, parent_rate); + cfg->p = p; + cfg->output_rate = rate * cfg->p; + cfg->n = cfg->output_rate * cfg->m / parent_rate; + +if (cfg->n >divn_max (pll) || cfg->output_rate > pll->params->vco_max) +return -EINVAL ; + +return 0 ; +} + +static int _pll_ramp_calc_pll (struct clk_hw *hw, +struct tegra_clk_pll_freq_table *cfg, +unsigned long rate,unsigned long parent_rate) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +int err =0 ; + + err =_get_table_rate (hw, cfg, rate, parent_rate); +if (err <0 ) + err =_calc_dynamic_ramp_rate (hw, cfg, rate, parent_rate); +else if (cfg->m !=_pll_fixed_mdiv (pll->params, parent_rate)) { +WARN_ON (1 ); + err = -EINVAL ; + goto out; + } + +if (!cfg->p || (cfg->p > pll->params->max_p)) + err = -EINVAL ; + +out: +return err; +} + +static int clk_pllxc_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +struct tegra_clk_pll_freq_table cfg, old_cfg; +unsigned long flags =0 ; +int ret =0 ; +u8 old_p; + + ret =_pll_ramp_calc_pll (hw, &cfg, rate, parent_rate); +if (ret <0 ) +return ret; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + +_get_pll_mnp (pll, &old_cfg); + + old_p = pllxc_p[old_cfg.p]; +if (old_cfg.m != cfg.m && old_cfg.n != cfg.n && old_p != cfg.p) { + cfg.p -=1 ; + ret =_program_pll (hw, &cfg, rate); + } + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return ret; +} + +static long clk_pll_ramp_round_rate (struct clk_hw *hw,unsigned long rate, +unsigned long *prate) +{ +struct tegra_clk_pll_freq_table cfg; +int ret =0 ; +u64 output_rate = *prate; + + ret =_pll_ramp_calc_pll (hw, &cfg, rate, *prate); +if (ret <0 ) +return ret; + + output_rate *= cfg.n; +do_div (output_rate, cfg.m * cfg.p); + +return output_rate; +} + +static int clk_pllm_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate) +{ +struct tegra_clk_pll_freq_table cfg; +struct tegra_clk_pll *pll =to_clk_pll (hw); +unsigned long flags =0 ; +int state, ret =0 ; +u32 val; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + + state =clk_pll_is_enabled (hw); +if (state) { +if (rate !=clk_get_rate (hw->clk)) { +pr_err ("%s: Cannot change active PLLM\n" , __func__); + ret = -EINVAL ; + goto out; + } + goto out; + } + + ret =_pll_ramp_calc_pll (hw, &cfg, rate, parent_rate); +if (ret <0 ) + goto out; + + cfg.p -=1 ; + + val =readl_relaxed (pll->pmc +PMC_PLLM_WB0_OVERRIDE ); +if (val &PMC_PLLP_WB0_OVERRIDE_PLLM_OVERRIDE ) { + val =readl_relaxed (pll->pmc +PMC_PLLM_WB0_OVERRIDE_2 ); + val = cfg.p ? (val |PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK ) : + (val & ~PMC_PLLM_WB0_OVERRIDE_2_DIVP_MASK ); +writel_relaxed (val, pll->pmc +PMC_PLLM_WB0_OVERRIDE_2 ); + + val =readl_relaxed (pll->pmc +PMC_PLLM_WB0_OVERRIDE ); + val &= ~(divn_mask (pll) |divm_mask (pll)); + val |= (cfg.m << pll->divm_shift) | (cfg.n << pll->divn_shift); +writel_relaxed (val, pll->pmc +PMC_PLLM_WB0_OVERRIDE ); + }else +_update_pll_mnp (pll, &cfg); + + +out: +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return ret; +} + +static void _pllcx_strobe (struct tegra_clk_pll *pll) +{ +u32 val; + + val =pll_readl_misc (pll); + val |=PLLCX_MISC_STROBE ; +pll_writel_misc (val, pll); +udelay (2 ); + + val &= ~PLLCX_MISC_STROBE ; +pll_writel_misc (val, pll); +} + +static int clk_pllc_enable (struct clk_hw *hw) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +u32 val; +int ret =0 ; +unsigned long flags =0 ; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + +_clk_pll_enable (hw); +udelay (2 ); + + val =pll_readl_misc (pll); + val &= ~PLLCX_MISC_RESET ; +pll_writel_misc (val, pll); +udelay (2 ); + +_pllcx_strobe (pll); + + ret =clk_pll_wait_for_lock (pll); + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return ret; +} + +static void _clk_pllc_disable (struct clk_hw *hw) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +u32 val; + +_clk_pll_disable (hw); + + val =pll_readl_misc (pll); + val |=PLLCX_MISC_RESET ; +pll_writel_misc (val, pll); +udelay (2 ); +} + +static void clk_pllc_disable (struct clk_hw *hw) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +unsigned long flags =0 ; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + +_clk_pllc_disable (hw); + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); +} + +static int _pllcx_update_dynamic_coef (struct tegra_clk_pll *pll, +unsigned long input_rate,u32 n) +{ +u32 val, n_threshold; + +switch (input_rate) { +case 12000000 : + n_threshold =70 ; +break ; +case 13000000 : +case 26000000 : + n_threshold =71 ; +break ; +case 16800000 : + n_threshold =55 ; +break ; +case 19200000 : + n_threshold =48 ; +break ; +default : +pr_err ("%s: Unexpected reference rate %lu\n" , + __func__, input_rate); +return -EINVAL ; + } + + val =pll_readl_misc (pll); + val &= ~(PLLCX_MISC_SDM_DIV_MASK |PLLCX_MISC_FILT_DIV_MASK ); + val |= n <= n_threshold ? +PLLCX_MISC_DIV_LOW_RANGE :PLLCX_MISC_DIV_HIGH_RANGE ; +pll_writel_misc (val, pll); + +return 0 ; +} + +static int clk_pllc_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate) +{ +struct tegra_clk_pll_freq_table cfg; +struct tegra_clk_pll *pll =to_clk_pll (hw); +unsigned long flags =0 ; +int state, ret =0 ; +u32 val; +u16 old_m, old_n; +u8 old_p; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + + ret =_pll_ramp_calc_pll (hw, &cfg, rate, parent_rate); +if (ret <0 ) + goto out; + + val =pll_readl_base (pll); + old_m = (val >> pll->divm_shift) & (divm_mask (pll)); + old_n = (val >> pll->divn_shift) & (divn_mask (pll)); + old_p = pllcx_p[(val >> pll->divp_shift) & (divp_mask (pll))]; + +if (cfg.m != old_m) { +WARN_ON (1 ); + goto out; + } + +if (old_n == cfg.n && old_p == cfg.p) + goto out; + + cfg.p -=1 ; + + state =clk_pll_is_enabled (hw); +if (state) +_clk_pllc_disable (hw); + + ret =_pllcx_update_dynamic_coef (pll, parent_rate, cfg.n); +if (ret <0 ) + goto out; + +_update_pll_mnp (pll, &cfg); + +if (state) + ret =clk_pllc_enable (hw); + +out: +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return ret; +} + +static long _pllre_calc_rate (struct tegra_clk_pll *pll, +struct tegra_clk_pll_freq_table *cfg, +unsigned long rate,unsigned long parent_rate) +{ +u16 m, n; +u64 output_rate = parent_rate; + + m =_pll_fixed_mdiv (pll->params, parent_rate); + n = rate * m / parent_rate; + + output_rate *= n; +do_div (output_rate, m); + +if (cfg) { + cfg->m = m; + cfg->n = n; + } + +return output_rate; +} +static int clk_pllre_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate) +{ +struct tegra_clk_pll_freq_table cfg, old_cfg; +struct tegra_clk_pll *pll =to_clk_pll (hw); +unsigned long flags =0 ; +int state, ret =0 ; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + +_pllre_calc_rate (pll, &cfg, rate, parent_rate); +_get_pll_mnp (pll, &old_cfg); + cfg.p = old_cfg.p; + +if (cfg.m != old_cfg.m || cfg.n != old_cfg.n) { + state =clk_pll_is_enabled (hw); +if (state) +_clk_pll_disable (hw); + +_update_pll_mnp (pll, &cfg); + +if (state) { +_clk_pll_enable (hw); + ret =clk_pll_wait_for_lock (pll); + } + } + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return ret; +} + +static unsigned long clk_pllre_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct tegra_clk_pll_freq_table cfg; +struct tegra_clk_pll *pll =to_clk_pll (hw); +u64 rate = parent_rate; + +_get_pll_mnp (pll, &cfg); + + rate *= cfg.n; +do_div (rate, cfg.m); + +return rate; +} + +static long clk_pllre_round_rate (struct clk_hw *hw,unsigned long rate, +unsigned long *prate) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); + +return _pllre_calc_rate (pll,NULL , rate, *prate); +} + +static int clk_plle_tegra114_enable (struct clk_hw *hw) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +struct tegra_clk_pll_freq_table sel; +u32 val; +int ret; +unsigned long flags =0 ; +unsigned long input_rate =clk_get_rate (clk_get_parent (hw->clk)); + +if (_get_table_rate (hw, &sel, pll->fixed_rate, input_rate)) +return -EINVAL ; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + + val =pll_readl_base (pll); + val &= ~BIT (29 );/* Disable lock override */ +pll_writel_base (val, pll); + + val =pll_readl (pll->params->aux_reg, pll); + val |=PLLE_AUX_ENABLE_SWCTL ; + val &= ~PLLE_AUX_SEQ_ENABLE ; +pll_writel (val, pll->params->aux_reg, pll); +udelay (1 ); + + val =pll_readl_misc (pll); + val |=PLLE_MISC_LOCK_ENABLE ; + val |=PLLE_MISC_IDDQ_SW_CTRL ; + val &= ~PLLE_MISC_IDDQ_SW_VALUE ; + val |=PLLE_MISC_PLLE_PTS ; + val |=PLLE_MISC_VREG_BG_CTRL_MASK |PLLE_MISC_VREG_CTRL_MASK ; +pll_writel_misc (val, pll); +udelay (5 ); + + val =pll_readl (PLLE_SS_CTRL , pll); + val |=PLLE_SS_DISABLE ; +pll_writel (val,PLLE_SS_CTRL , pll); + + val =pll_readl_base (pll); + val &= ~(divm_mask (pll) |divn_mask (pll) |divp_mask (pll)); + val &= ~(PLLE_BASE_DIVCML_WIDTH <<PLLE_BASE_DIVCML_SHIFT ); + val |= sel.m << pll->divm_shift; + val |= sel.n << pll->divn_shift; + val |= sel.cpcon <<PLLE_BASE_DIVCML_SHIFT ; +pll_writel_base (val, pll); +udelay (1 ); + +_clk_pll_enable (hw); + ret =clk_pll_wait_for_lock (pll); + +if (ret <0 ) + goto out; + +/* TODO: enable hw control of xusb brick pll */ + +out: +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return ret; +} + +static void clk_plle_tegra114_disable (struct clk_hw *hw) +{ +struct tegra_clk_pll *pll =to_clk_pll (hw); +unsigned long flags =0 ; +u32 val; + +if (pll->lock) +spin_lock_irqsave (pll->lock, flags); + +_clk_pll_disable (hw); + + val =pll_readl_misc (pll); + val |=PLLE_MISC_IDDQ_SW_CTRL |PLLE_MISC_IDDQ_SW_VALUE ; +pll_writel_misc (val, pll); +udelay (1 ); + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); +} +#endif + static struct tegra_clk_pll *_tegra_init_pll(void __iomem *clk_base, void __iomem *pmc, unsigned long fixed_rate, struct tegra_clk_pll_params *pll_params, u32 pll_flags,
@@ -736,3 +1310,265 @@ struct clk *tegra_clk_register_plle(const char *name, const char *parent_name,return clk; } + +#ifdef CONFIG_ARCH_TEGRA_114_SOC +const struct clk_ops tegra_clk_pllxc_ops = { + .is_enabled = clk_pll_is_enabled, + .enable = clk_pll_iddq_enable, + .disable = clk_pll_iddq_disable, + .recalc_rate = clk_pll_recalc_rate, + .round_rate = clk_pll_ramp_round_rate, + .set_rate = clk_pllxc_set_rate, +}; + +const struct clk_ops tegra_clk_pllm_ops = { + .is_enabled = clk_pll_is_enabled, + .enable = clk_pll_iddq_enable, + .disable = clk_pll_iddq_disable, + .recalc_rate = clk_pll_recalc_rate, + .round_rate = clk_pll_ramp_round_rate, + .set_rate = clk_pllm_set_rate, +}; + +const struct clk_ops tegra_clk_pllc_ops = { + .is_enabled = clk_pll_is_enabled, + .enable = clk_pllc_enable, + .disable = clk_pllc_disable, + .recalc_rate = clk_pll_recalc_rate, + .round_rate = clk_pll_ramp_round_rate, + .set_rate = clk_pllc_set_rate, +}; + +const struct clk_ops tegra_clk_pllre_ops = { + .is_enabled = clk_pll_is_enabled, + .enable = clk_pll_iddq_enable, + .disable = clk_pll_iddq_disable, + .recalc_rate = clk_pllre_recalc_rate, + .round_rate = clk_pllre_round_rate, + .set_rate = clk_pllre_set_rate, +}; + +const struct clk_ops tegra_clk_plle_tegra114_ops = { + .is_enabled = clk_pll_is_enabled, + .enable = clk_plle_tegra114_enable, + .disable = clk_plle_tegra114_disable, + .recalc_rate = clk_pll_recalc_rate, +}; + + +struct clk *tegra_clk_register_pllxc (const char *name,const char *parent_name, +void __iomem *clk_base,void __iomem *pmc, +unsigned long flags,unsigned long fixed_rate, +struct tegra_clk_pll_params *pll_params, +u32 pll_flags, +struct tegra_clk_pll_freq_table *freq_table, +spinlock_t *lock) +{ +struct tegra_clk_pll *pll; +struct clk *clk; + +if (!pll_params->pdiv_tohw) +return ERR_PTR (-EINVAL ); + + pll =_tegra_init_pll (clk_base, pmc, fixed_rate, pll_params, pll_flags, + freq_table, lock); +if (IS_ERR (pll)) +return ERR_CAST (pll); + + clk =_tegra_clk_register_pll (pll, name, parent_name, flags, + &tegra_clk_pllxc_ops); +if (IS_ERR (clk)) +kfree (pll); + +return clk; +} + +struct clk *tegra_clk_register_pllre (const char *name,const char *parent_name, +void __iomem *clk_base,void __iomem *pmc, +unsigned long flags,unsigned long fixed_rate, +struct tegra_clk_pll_params *pll_params, +u32 pll_flags, +struct tegra_clk_pll_freq_table *freq_table, +spinlock_t *lock,unsigned long parent_rate) +{ +u32 val; +struct tegra_clk_pll *pll; +struct clk *clk; + + pll =_tegra_init_pll (clk_base, pmc, fixed_rate, pll_params, pll_flags, + freq_table, lock); +if (IS_ERR (pll)) +return ERR_CAST (pll); + +/* program minimum rate by default */ + + val =pll_readl_base (pll); +if (val &PLL_BASE_ENABLE ) +WARN_ON (val & pll_params->iddq_bit_idx); +else { +int m; + + m =_pll_fixed_mdiv (pll_params, parent_rate); + val = m <<PLL_BASE_DIVM_SHIFT ; + val |= (pll_params->vco_min / parent_rate) + <<PLL_BASE_DIVN_SHIFT ; +pll_writel_base (val, pll); + } + +/* disable lock override */ + + val =pll_readl_misc (pll); + val &= ~BIT (29 ); +pll_writel_misc (val, pll); + + pll_flags |=TEGRA_PLL_LOCK_MISC ; + clk =_tegra_clk_register_pll (pll, name, parent_name, flags, + &tegra_clk_pllre_ops); +if (IS_ERR (clk)) +kfree (pll); + +return clk; +} + +struct clk *tegra_clk_register_pllm (const char *name,const char *parent_name, +void __iomem *clk_base,void __iomem *pmc, +unsigned long flags,unsigned long fixed_rate, +struct tegra_clk_pll_params *pll_params, +u32 pll_flags, +struct tegra_clk_pll_freq_table *freq_table, +spinlock_t *lock) +{ +struct tegra_clk_pll *pll; +struct clk *clk; + +if (!pll_params->pdiv_tohw) +return ERR_PTR (-EINVAL ); + + pll_flags |=TEGRA_PLL_BYPASS ; + pll =_tegra_init_pll (clk_base, pmc, fixed_rate, pll_params, pll_flags, + freq_table, lock); +if (IS_ERR (pll)) +return ERR_CAST (pll); + + clk =_tegra_clk_register_pll (pll, name, parent_name, flags, + &tegra_clk_pllxc_ops); +if (IS_ERR (clk)) +kfree (pll); + +return clk; +} + +struct clk *tegra_clk_register_pllc (const char *name,const char *parent_name, +void __iomem *clk_base,void __iomem *pmc, +unsigned long flags,unsigned long fixed_rate, +struct tegra_clk_pll_params *pll_params, +u32 pll_flags, +struct tegra_clk_pll_freq_table *freq_table, +spinlock_t *lock) +{ +struct clk *parent, *clk; +struct pdiv_map *p_tohw = pll_params->pdiv_tohw; +struct tegra_clk_pll *pll; +struct tegra_clk_pll_freq_table cfg; +unsigned long parent_rate; + +if (!p_tohw) +return ERR_PTR (-EINVAL ); + + parent =__clk_lookup (parent_name); +if (IS_ERR (parent)) { +WARN (1 ,"parent clk %s of %s must be registered first\n" , + name, parent_name); +return ERR_PTR (-EINVAL ); + } + + pll_flags |=TEGRA_PLL_BYPASS ; + pll =_tegra_init_pll (clk_base, pmc, fixed_rate, pll_params, pll_flags, + freq_table, lock); +if (IS_ERR (pll)) +return ERR_CAST (pll); + + parent_rate =__clk_get_rate (parent); + +/* +* Most of PLLC register fields are shadowed, and can not be read +* directly from PLL h/w. Hence, actual PLLC boot state is unknown. +* Initialize PLL to default state: disabled, reset; shadow registers +* loaded with default parameters; dividers are preset for half of +* minimum VCO rate (the latter assured that shadowed divider settings +* are within supported range). +*/ + + cfg.m =_pll_fixed_mdiv (pll_params, parent_rate); + cfg.n = cfg.m * pll_params->vco_min / parent_rate; + +while (p_tohw->pdiv) { +if (p_tohw->pdiv ==2 ) { + cfg.p = p_tohw->hw_val; +break ; + } + p_tohw++; + } + +if (!p_tohw->pdiv) { +WARN_ON (1 ); +return ERR_PTR (-EINVAL ); + } + +pll_writel_base (0 , pll); +_update_pll_mnp (pll, &cfg); + +pll_writel_misc (PLLCX_MISC_DEFAULT , pll); +pll_writel (PLLCX_MISC1_DEFAULT , pll_params->ext_misc_reg[0 ], pll); +pll_writel (PLLCX_MISC2_DEFAULT , pll_params->ext_misc_reg[1 ], pll); +pll_writel (PLLCX_MISC3_DEFAULT , pll_params->ext_misc_reg[2 ], pll); + +_pllcx_update_dynamic_coef (pll, parent_rate, cfg.n); + + clk =_tegra_clk_register_pll (pll, name, parent_name, flags, + &tegra_clk_pllc_ops); +if (IS_ERR (clk)) +kfree (pll); + +return clk; +} + +struct clk *tegra_clk_register_plle_tegra114 (const char *name, +const char *parent_name, +void __iomem *clk_base,unsigned long flags, +unsigned long fixed_rate, +struct tegra_clk_pll_params *pll_params, +struct tegra_clk_pll_freq_table *freq_table, +spinlock_t *lock) +{ +struct tegra_clk_pll *pll; +struct clk *clk; +u32 val, val_aux; + + pll =_tegra_init_pll (clk_base,NULL , fixed_rate, pll_params,0 , + freq_table, lock); +if (IS_ERR (pll)) +return ERR_CAST (pll); + +/* ensure parent is set to pll_re_vco */ + + val =pll_readl_base (pll); + val_aux =pll_readl (pll_params->aux_reg, pll); + +if (val &PLL_BASE_ENABLE ) { +if (!(val_aux &PLLE_AUX_PLLRE_SEL )) +WARN (1 ,"pll_e enabled with unsupported parent %s\n" , + (val &PLLE_AUX_PLLP_SEL ) ?"pllp_out0" :"pll_ref" ); + }else { + val_aux |=PLLE_AUX_PLLRE_SEL ; +pll_writel (val, pll_params->aux_reg, pll); + } + + clk =_tegra_clk_register_pll (pll, name, parent_name, flags, + &tegra_clk_plle_tegra114_ops); +if (IS_ERR (clk)) +kfree (pll); + +return clk; +} +#endif
drivers/clk/tegra/clk.h +48 -0
66 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v6 5/10 clk: tegra: Add flags to tegra_clk_periph()
In reply to a message not in the archiveWe will need some tegra peripheral clocks with the CLK_IGNORE_UNUSED flag, most notably mselect, which is a bridge between AXI and most peripherals.
--- drivers/clk/tegra/clk-periph.c | 11 ++++++----- drivers/clk/tegra/clk-tegra20.c | 2 +- drivers/clk/tegra/clk-tegra30.c | 2 +- drivers/clk/tegra/clk.h | 9 ++++++--- 4 files changed, 14 insertions(+), 10 deletions(-)
drivers/clk/tegra/clk-periph.c +6 -5
@@ -170,14 +170,15 @@ const struct clk_ops tegra_clk_periph_nodiv_ops = {static struct clk *_tegra_clk_register_periph (const char *name,const char **parent_names,int num_parents,struct tegra_clk_periph *periph, -void __iomem *clk_base,u32 offset,bool div) +void __iomem *clk_base,u32 offset,bool div, +unsigned long flags) {struct clk *clk;struct clk_init_data init; init.name = name; init.ops = div ? &tegra_clk_periph_ops : &tegra_clk_periph_nodiv_ops; - init.flags = div ?0 :CLK_SET_RATE_PARENT ; + init.flags = flags; init.parent_names = parent_names; init.num_parents = num_parents;
@@ -202,10 +203,10 @@ static struct clk *_tegra_clk_register_periph(const char *name,struct clk *tegra_clk_register_periph (const char *name,const char **parent_names,int num_parents,struct tegra_clk_periph *periph,void __iomem *clk_base, -u32 offset) +u32 offset,unsigned long flags) {return _tegra_clk_register_periph (name, parent_names, num_parents, - periph, clk_base, offset, true); + periph, clk_base, offset, true, flags); } struct clk *tegra_clk_register_periph_nodiv(const char *name,
@@ -214,5 +215,5 @@ struct clk *tegra_clk_register_periph_nodiv(const char *name, u32 offset) {return _tegra_clk_register_periph (name, parent_names, num_parents, - periph, clk_base, offset, false); + periph, clk_base, offset, false,CLK_SET_RATE_PARENT ); }
drivers/clk/tegra/clk-tegra20.c +1 -1
@@ -1048,7 +1048,7 @@ static void __init tegra20_periph_clk_init(void) data = &tegra_periph_clk_list[i]; clk =tegra_clk_register_periph (data->name, data->parent_names, data->num_parents, &data->periph, - clk_base, data->offset); + clk_base, data->offset, data->flags);clk_register_clkdev (clk, data->con_id, data->dev_id); clks[data->clk_id] = clk; }
drivers/clk/tegra/clk-tegra30.c +1 -1
@@ -1665,7 +1665,7 @@ static void __init tegra30_periph_clk_init(void) data = &tegra_periph_clk_list[i]; clk =tegra_clk_register_periph (data->name, data->parent_names, data->num_parents, &data->periph, - clk_base, data->offset); + clk_base, data->offset, data->flags);clk_register_clkdev (clk, data->con_id, data->dev_id); clks[data->clk_id] = clk; }
drivers/clk/tegra/clk.h +6 -3
@@ -415,7 +415,7 @@ extern const struct clk_ops tegra_clk_periph_ops;struct clk *tegra_clk_register_periph (const char *name,const char **parent_names,int num_parents,struct tegra_clk_periph *periph,void __iomem *clk_base, -u32 offset); +u32 offset,unsigned long flags); struct clk *tegra_clk_register_periph_nodiv(const char *name, const char **parent_names, int num_parents, struct tegra_clk_periph *periph, void __iomem *clk_base,
@@ -458,12 +458,14 @@ struct tegra_periph_init_data {u32 offset;const char *con_id;const char *dev_id; +unsigned long flags; };#define TEGRA_INIT_DATA_TABLE (_name, _con_id, _dev_id, _parent_names, _offset,\ _mux_shift, _mux_mask, _mux_flags, _div_shift, \ _div_width, _div_frac_width, _div_flags, _regs, \ - _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table) \ + _clk_num, _enb_refcnt, _gate_flags, _clk_id, _table,\ + _flags) \ { \ .name = _name, \ .clk_id = _clk_id, \
@@ -478,6 +480,7 @@ struct tegra_periph_init_data { .offset = _offset, \ .con_id = _con_id, \ .dev_id = _dev_id, \ + .flags = _flags \ } #define TEGRA_INIT_DATA(_name, _con_id, _dev_id, _parent_names, _offset,\
@@ -488,7 +491,7 @@ struct tegra_periph_init_data { _mux_shift,BIT (_mux_width) -1 , _mux_flags, \ _div_shift, _div_width, _div_frac_width, _div_flags, \ _regs, _clk_num, _enb_refcnt, _gate_flags, _clk_id,\ - NULL) + NULL, 0)/** * struct clk_super_mux - super clock
Signature · 1 line
1.7.1
PATCH v6 6/10 clk: tegra: Workaround for Tegra114 MSENC problem
In reply to a message not in the archiveWorkaround a hardware bug in MSENC during clock enable.
--- drivers/clk/tegra/clk-periph-gate.c | 9 +++++++++ drivers/clk/tegra/clk.h | 2 ++ 2 files changed, 11 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk-periph-gate.c +9 -0
@@ -43,6 +43,8 @@ static DEFINE_SPINLOCK(periph_ref_lock);#define periph_clk_to_bit (periph) (1 << (gate->clk_num % 32)) +#define LVL2_CLK_GATE_OVRE 0x554 +/* Peripheral gate clock ops */ static int clk_periph_is_enabled (struct clk_hw *hw) {
@@ -83,6 +85,13 @@ static int clk_periph_enable(struct clk_hw *hw) } } +if (gate->flags &TEGRA_PERIPH_WAR_1005168 ) { +writel_relaxed (0 , gate->clk_base +LVL2_CLK_GATE_OVRE ); +writel_relaxed (BIT (22 ), gate->clk_base +LVL2_CLK_GATE_OVRE ); +udelay (1 ); +writel_relaxed (0 , gate->clk_base +LVL2_CLK_GATE_OVRE ); + } +spin_unlock_irqrestore (&periph_ref_lock, flags);return 0 ;
drivers/clk/tegra/clk.h +2 -0
@@ -356,6 +356,7 @@ struct tegra_clk_periph_regs {* TEGRA_PERIPH_ON_APB - If peripheral is in the APB bus then read the * bus to flush the write operation in apb bus. This flag indicates * that this peripheral is in apb bus. +* TEGRA_PERIPH_WAR_1005168 - Apply workaround for Tegra114 MSENC bug */ struct tegra_clk_periph_gate {u32 magic;
@@ -375,6 +376,7 @@ struct tegra_clk_periph_gate {#define TEGRA_PERIPH_NO_RESET BIT(0)#define TEGRA_PERIPH_MANUAL_RESET BIT(1)#define TEGRA_PERIPH_ON_APB BIT(2) +#define TEGRA_PERIPH_WAR_1005168 BIT(3)void tegra_periph_reset (struct tegra_clk_periph_gate *gate,bool assert);extern const struct clk_ops tegra_clk_periph_gate_ops;
Signature · 1 line
1.7.1
PATCH v6 7/10 ARM: tegra: Define Tegra114 CAR binding
In reply to a message not in the archiveThe device tree binding models Tegra114 CAR (Clock And Reset) as a single monolithic clock provider.
--- .../bindings/clock/nvidia,tegra114-car.txt | 316 ++++++++++++++++++++ 1 files changed, 316 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt
Documentation/devicetree/bindings/clock/nvidia,tegra114-car.txt new file +316 -0
@@ -0,0 +1,316 @@ +NVIDIA Tegra114 Clock And Reset Controller + +This binding uses the common clock binding: +Documentation/devicetree/bindings/clock/clock-bindings.txt + +The CAR (Clock And Reset) Controller on Tegra is the HW module responsible +for muxing and gating Tegra's clocks, and setting their rates. + +Required properties : +- compatible : Should be "nvidia,tegra114-car" +- reg : Should contain CAR registers location and length +- clocks : Should contain phandle and clock specifiers for two clocks: + the 32 KHz "32k_in", and the board-specific oscillator "osc". +- #clock-cells : Should be 1. + In clock consumers, this cell represents the clock ID exposed by the CAR. + + The first 160 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB + registers. These IDs often match those in the CAR's RST_DEVICES registers, + but not in all cases. Some bits in CLK_OUT_ENB affect multiple clocks. In + this case, those clocks are assigned IDs above 160 in order to highlight + this issue. Implementations that interpret these clock IDs as bit values + within the CLK_OUT_ENB or RST_DEVICES registers should be careful to + explicitly handle these special cases. + + The balance of the clocks controlled by the CAR are assigned IDs of 160 and + above. + + 0 cpu + 1 unassigned + 2 unassigned + 3 unassigned + 4 rtc + 5 timer + 6 uarta + 7 unassigned (register bit affects uartb and vfir) + 8 unassigned + 9 sdmmc2 + 10 unassigned (register bit affects spdif_in and spdif_out) + 11 i2s1 + 12 i2c1 + 13 ndflash + 14 sdmmc1 + 15 sdmmc4 + 16 unassigned + 17 pwm + 18 i2s2 + 19 epp + 20 unassigned (register bit affects vi and vi_sensor) + 21 2d + 22 usbd + 23 isp + 24 3d + 25 unassigned + 26 disp2 + 27 disp1 + 28 host1x + 29 vcp + 30 i2s0 + 31 unassigned + + 32 unassigned + 33 unassigned + 34 apbdma + 35 unassigned + 36 kbc + 37 unassigned + 38 unassigned + 39 unassigned (register bit affects fuse and fuse_burn) + 40 kfuse + 41 sbc1 + 42 nor + 43 unassigned + 44 sbc2 + 45 unassigned + 46 sbc3 + 47 i2c5 + 48 dsia + 49 unassigned + 50 mipi + 51 hdmi + 52 csi + 53 unassigned + 54 i2c2 + 55 uartc + 56 mipi-cal + 57 unassigned + 58 usb2 + 59 usb3 + 60 msenc + 61 vde + 62 bsea + 63 bsev + + 64 unassigned + 65 uartd + 66 unassigned + 67 i2c3 + 68 sbc4 + 69 sdmmc3 + 70 unassigned + 71 owr + 72 afi + 73 csite + 74 unassigned + 75 unassigned + 76 la + 77 trace + 78 soc_therm + 79 dtv + 80 ndspeed + 81 i2cslow + 82 dsib + 83 tsec + 84 unassigned + 85 unassigned + 86 unassigned + 87 unassigned + 88 unassigned + 89 xusb_host + 90 unassigned + 91 msenc + 92 csus + 93 unassigned + 94 unassigned + 95 unassigned (bit affects xusb_dev and xusb_dev_src) + + 96 unassigned + 97 unassigned + 98 unassigned + 99 mselect + 100 tsensor + 101 i2s3 + 102 i2s4 + 103 i2c4 + 104 sbc5 + 105 sbc6 + 106 d_audio + 107 apbif + 108 dam0 + 109 dam1 + 110 dam2 + 111 hda2codec_2x + 112 unassigned + 113 audio0_2x + 114 audio1_2x + 115 audio2_2x + 116 audio3_2x + 117 audio4_2x + 118 spdif_2x + 119 actmon + 120 extern1 + 121 extern2 + 122 extern3 + 123 unassigned + 124 unassigned + 125 hda + 126 unassigned + 127 se + + 128 hda2hdmi + 129 unassigned + 130 unassigned + 131 unassigned + 132 unassigned + 133 unassigned + 134 unassigned + 135 unassigned + 136 unassigned + 137 unassigned + 138 unassigned + 139 unassigned + 140 unassigned + 141 unassigned + 142 unassigned + 143 unassigned (bit affects xusb_falcon_src, xusb_fs_src, + xusb_host_src and xusb_ss_src) + 144 cilab + 145 cilcd + 146 cile + 147 dsialp + 148 dsiblp + 149 unassigned + 150 dds + 151 unassigned + 152 dp2 + 153 amx + 154 adx + 155 unassigned + 156 xusb_ss + + 192 uartb + 193 vfir + 194 spdif_in + 195 spdif_out + 196 vi + 197 vi_sensor + 198 fuse + 199 fuse_burn + 200 clk_32k + 201 clk_m + 202 clk_m_div2 + 203 clk_m_div4 + 204 pll_ref + 205 pll_c + 206 pll_c_out1 + 207 pll_c2 + 208 pll_c3 + 209 pll_m + 210 pll_m_out1 + 211 pll_p + 212 pll_p_out1 + 213 pll_p_out2 + 214 pll_p_out3 + 214 mipi_cal_fast + 214 dsi1_fixed + 214 dsi2_fixed + 215 pll_p_out4 + 216 pll_a + 217 pll_a_out1 + 218 pll_d + 219 pll_d_out0 + 220 pll_d2 + 221 pll_d2_out0 + 222 pll_u + 223 pll_u_480M + 224 pll_u_60M + 225 pll_u_48M + 226 pll_u_12M + 227 pll_x + 228 pll_x_out0 + 229 pll_re_vco + 230 pll_re_out + 231 pll_e_out0 + 232 spdif_in_sync + 233 i2s0_sync + 234 i2s1_sync + 235 i2s2_sync + 236 i2s3_sync + 237 i2s4_sync + 238 vimclk_sync + 239 audio0 + 240 audio1 + 241 audio2 + 242 audio3 + 243 audio4 + 244 spdif + 245 clk_out_1 + 246 clk_out_2 + 247 clk_out_3 + 248 blink + 252 xusb_host_src + 253 xusb_falcon_src + 254 xusb_fs_src + 255 xusb_ss_src + 256 xusb_dev_src + 257 xusb_dev + 258 xusb_hs_src + 259 sclk + 260 hclk + 261 pclk + 262 cclk_g + 263 cclk_lp + +Mux clocks + + 300 audio0_mux + 301 audio1_mux + 302 audio2_mux + 303 audio3_mux + 304 audio4_mux + 305 spdif_mux + 306 clk_out_1_mux + 307 clk_out_2_mux + 308 clk_out_3_mux + +Example SoC include file: + +/ { + tegra_car: clock { + compatible = "nvidia,tegra114-car"; + reg = <0x60006000 0x1000>; + #clock-cells = <1>; + }; + + usb@c5004000 { + clocks = <&tegra_car 58>; /* usb2 */ + }; +}; + +Example board file: + +/ { + clocks { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <0>; + + osc: clock@0 { + compatible = "fixed-clock"; + reg = <0>; + #clock-cells = <0>; + clock-frequency = <12000000>; + }; + + clk_32k: clock@1 { + compatible = "fixed-clock"; + reg = <1>; + #clock-cells = <0>; + clock-frequency = <32768>; + }; + }; + + &tegra_car { + clocks = <&clk_32k> <&osc>; + }; +};
Signature · 1 line
1.7.1
PATCH v6 8/10 ARM: dt: Add references to tegra_car clocks
In reply to a message not in the archiveAdd references to tegra_car clocks for the basic device nodes.
--- arch/arm/boot/dts/tegra114.dtsi | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
arch/arm/boot/dts/tegra114.dtsi +7 -1
@@ -24,10 +24,11 @@ 0 42 0x04 0 121 0x04 0 122 0x04>; + clocks = <&tegra_car 5>; }; tegra_car: clock { - compatible = "nvidia,tegra114-car, nvidia,tegra30-car"; + compatible = "nvidia,tegra114-car"; reg = <0x60006000 0x1000>; #clock-cells = <1>; };
@@ -43,6 +44,7 @@ reg-shift = <2>; interrupts = <0 36 0x04>; status = "disabled"; + clocks = <&tegra_car 6>; }; serial at 70006040 {
@@ -51,6 +53,7 @@ reg-shift = <2>; interrupts = <0 37 0x04>; status = "disabled"; + clocks = <&tegra_car 192>; }; serial at 70006200 {
@@ -59,6 +62,7 @@ reg-shift = <2>; interrupts = <0 46 0x04>; status = "disabled"; + clocks = <&tegra_car 55>; }; serial at 70006300 {
@@ -67,12 +71,14 @@ reg-shift = <2>; interrupts = <0 90 0x04>; status = "disabled"; + clocks = <&tegra_car 65>; }; rtc { compatible = "nvidia,tegra114-rtc", "nvidia,tegra20-rtc"; reg = <0x7000e000 0x100>; interrupts = <0 2 0x04>; + clocks = <&tegra_car 4>; }; pmc {
Signature · 1 line
1.7.1
Re: [PATCH v6 08/10] ARM: dt: Add references to tegra_car clocks
Hi,
arch/arm/boot/dts/tegra114.dtsi line 31
Quoted 3 lines · Peter De Schrijver
arch/arm/boot/dts/tegra114.dtsi +1
-1tegra_car: clock { - compatible = "nvidia,tegra114-car, nvidia,tegra30-car"; + compatible = "nvidia,tegra114-car";
trailing change or intentional ?
Signature · 8 lines
balbi -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130208/202974d2/attachment.sig>
Re: [PATCH v6 08/10] ARM: dt: Add references to tegra_car clocks
Quoted 8 lines · Felipe Balbi
Hi,
Quoted 2 lines · Peter De Schrijver
tegra_car: clock { - compatible = "nvidia,tegra114-car,
nvidia,tegra30-car"; + compatible = "nvidia,tegra114-car";trailing change or intentional ?
I believe it's intentional since the HW isn't fully backwards-compatible. However, the commit description should mention this.
Re: [PATCH v6 08/10] ARM: dt: Add references to tegra_car clocks
In reply to Felipe BalbiQuoted 10 lines · Felipe Balbi
* PGP Signed by an unknown key
Hi,
arch/arm/boot/dts/tegra114.dtsi line 31
Quoted 3 lines · Peter De Schrijver
arch/arm/boot/dts/tegra114.dtsi +1
-1tegra_car: clock { - compatible = "nvidia,tegra114-car, nvidia,tegra30-car"; + compatible = "nvidia,tegra114-car";trailing change or intentional ?
No, the Tegra30 car driver shouldn't be used for Tegra114.
Cheers,
Peter.
PATCH v6 9/10 clk: tegra: Implement clocks for Tegra114
In reply to a message not in the archiveImplement clocks for Tegra114.
--- drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-tegra114.c | 2036 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 2037 insertions(+), 0 deletions(-) create mode 100644 drivers/clk/tegra/clk-tegra114.c
drivers/clk/tegra/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-y += clk-super.o obj-$(CONFIG_ARCH_TEGRA_2x_SOC) += clk-tegra20.o obj-$(CONFIG_ARCH_TEGRA_3x_SOC) += clk-tegra30.o +obj-$(CONFIG_ARCH_TEGRA_114_SOC) += clk-tegra114.o
drivers/clk/tegra/clk-tegra114.c new file +2036 -0
2,036 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v6 10/10 clk: tegra: devicetree match for nvidia,tegra114-car
In reply to a message not in the archive--- drivers/clk/tegra/clk.c | 1 + drivers/clk/tegra/clk.h | 7 +++++++ 2 files changed, 8 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk.c +1 -0
@@ -76,6 +76,7 @@ void __init tegra_init_from_table(struct tegra_clk_init_table *tbl,static const struct of_device_id tegra_dt_clk_match[] = { { .compatible ="nvidia,tegra20-car" , .data = tegra20_clock_init }, { .compatible ="nvidia,tegra30-car" , .data = tegra30_clock_init }, + { .compatible ="nvidia,tegra114-car" , .data = tegra114_clock_init }, { } };
drivers/clk/tegra/clk.h +7 -0
@@ -581,4 +581,11 @@ void tegra30_clock_init(struct device_node *np);static inline void tegra30_clock_init (struct device_node *np) {}#endif /* CONFIG_ARCH_TEGRA_3x_SOC */ +#ifdef CONFIG_ARCH_TEGRA_114_SOC +void tegra114_clock_init (struct device_node *np); +#else +static inline void tegra114_clock_init (struct device_node *np) {} +#endif /* CONFIG_ARCH_TEGRA114_SOC */ + +#endif /* TEGRA_CLK_H */
Signature · 1 line
1.7.1