Tegra124 clock support
v2 cover Tegra124 clock support
This series introduces support for the Tegra124 CAR clocks. Based on '[PATCH v3 00/12] Introduce common infra for tegra clocks'
changes since v1:
+ suspend/resume for LP1 (Joseph Lo)
+ fixed some comments
+ account for changes to the common infra code
Joseph Lo (2):
clk: tegra124: add wait_for_reset and disable_clock for
tegra_cpu_car_ops
clk: tegra124: add suspend/resume function for tegra_cpu_car_ops
Peter De Schrijver (5):
clk: tegra: Add support for PLLSS
clk: tegra: Add periph regs bank X
clk: tegra124: Add common clk IDs to clk-id.h
clk: tegra124: Add new peripheral clocks
clk: tegra124: Add support for Tegra124 clocks
drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-id.h | 20 + drivers/clk/tegra/clk-pll.c | 172 ++++ drivers/clk/tegra/clk-tegra-periph.c | 55 ++ drivers/clk/tegra/clk-tegra124.c | 1430 ++++++++++++++++++++++++++++++ drivers/clk/tegra/clk.c | 10 + drivers/clk/tegra/clk.h | 5 + include/dt-bindings/clock/tegra124-car.h | 341 +++++++ 8 files changed, 2034 insertions(+), 0 deletions(-) create mode 100644 drivers/clk/tegra/clk-tegra124.c create mode 100644 include/dt-bindings/clock/tegra124-car.h
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
PATCH v2 1/7 clk: tegra: Add support for PLLSS
Tegra124 introduces a new PLL type, PLLSS. Add support for it.
--- drivers/clk/tegra/clk-pll.c | 172 +++++++++++++++++++++++++++++++++++++++++++ drivers/clk/tegra/clk.h | 5 + 2 files changed, 177 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk-pll.c +172 -0
@@ -137,6 +137,36 @@#define PMC_SATA_PWRGT_PLLE_IDDQ_VALUE BIT(5)#define PMC_SATA_PWRGT_PLLE_IDDQ_SWCTL BIT(4) +#define PLLSS_MISC_KCP 0 +#define PLLSS_MISC_KVCO 0 +#define PLLSS_MISC_SETUP 0 +#define PLLSS_EN_SDM 0 +#define PLLSS_EN_SSC 0 +#define PLLSS_EN_DITHER2 0 +#define PLLSS_EN_DITHER 1 +#define PLLSS_SDM_RESET 0 +#define PLLSS_CLAMP 0 +#define PLLSS_SDM_SSC_MAX 0 +#define PLLSS_SDM_SSC_MIN 0 +#define PLLSS_SDM_SSC_STEP 0 +#define PLLSS_SDM_DIN 0 +#define PLLSS_MISC_DEFAULT ((PLLSS_MISC_KCP << 25) | \ + (PLLSS_MISC_KVCO << 24) | \ + PLLSS_MISC_SETUP) +#define PLLSS_CFG_DEFAULT ((PLLSS_EN_SDM << 31) | \ + (PLLSS_EN_SSC << 30) | \ + (PLLSS_EN_DITHER2 << 29) | \ + (PLLSS_EN_DITHER << 28) | \ + (PLLSS_SDM_RESET) << 27 | \ + (PLLSS_CLAMP << 22)) +#define PLLSS_CTRL1_DEFAULT \ + ((PLLSS_SDM_SSC_MAX << 16) | PLLSS_SDM_SSC_MIN) +#define PLLSS_CTRL2_DEFAULT \ + ((PLLSS_SDM_SSC_STEP << 16) | PLLSS_SDM_DIN) +#define PLLSS_LOCK_OVERRIDE BIT(24) +#define PLLSS_REF_SRC_SEL_SHIFT 25 +#define PLLSS_REF_SRC_SEL_MASK (3 << PLLSS_REF_SRC_SEL_SHIFT) +#define pll_readl (offset, p) readl_relaxed(p->clk_base + offset)#define pll_readl_base (p) pll_readl(p->params->base_reg, p)#define pll_readl_misc (p) pll_readl(p->params->misc_reg, p)
@@ -1319,6 +1349,51 @@ static void clk_plle_tegra114_disable(struct clk_hw *hw) }#endif +static int clk_pllss_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 ; + + 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); + +if (old_cfg.m != cfg.m || old_cfg.n != cfg.n || old_cfg.p != cfg.p) { +u32 val; +int state =clk_pll_is_enabled (hw); + +if (state) { + val =pll_readl_base (pll); + val &= ~PLL_BASE_ENABLE ; +pll_writel_base (val, pll); +udelay (1 ); + } + +_update_pll_mnp (pll, &cfg); + +if (state) { + val =pll_readl_base (pll); + val |=PLL_BASE_ENABLE ; +pll_writel_base (val, pll); +udelay (2 ); +clk_pll_wait_for_lock (pll); + } + } + +if (pll->lock) +spin_unlock_irqrestore (pll->lock, flags); + +return ret; +} +static struct tegra_clk_pll *_tegra_init_pll (void __iomem *clk_base,void __iomem *pmc,struct tegra_clk_pll_params *pll_params,spinlock_t *lock)
@@ -1698,3 +1773,100 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,return clk; }#endif + +const struct clk_ops tegra_clk_pllss_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_pllss_set_rate, +}; + +struct clk *tegra_clk_register_pllss (const char *name,const char *parent_name, +void __iomem *clk_base,unsigned long flags, +struct tegra_clk_pll_params *pll_params, +spinlock_t *lock) +{ +struct tegra_clk_pll *pll; +struct clk *clk, *parent; +struct tegra_clk_pll_freq_table cfg; +unsigned long parent_rate; +u32 val; +int i; + +if (!pll_params->div_nmp) +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_params->flags =TEGRA_PLL_HAS_LOCK_ENABLE |TEGRA_PLL_USE_LOCK ; + pll =_tegra_init_pll (clk_base,NULL , pll_params, lock); +if (IS_ERR (pll)) +return ERR_CAST (pll); + + val =pll_readl_base (pll); +if (val &PLLSS_REF_SRC_SEL_MASK ) { +WARN (1 ,"Unknown parent selected for %s: %d\n" , name, + (val &PLLSS_REF_SRC_SEL_MASK ) >> +PLLSS_REF_SRC_SEL_SHIFT ); +kfree (pll); +return ERR_PTR (-EINVAL ); + } + +_get_pll_mnp (pll, &cfg); +if (cfg.n >1 ) { +WARN (1 ,"%s should not be initialized\n" , name); +kfree (pll); +return ERR_PTR (-EINVAL ); + } + + parent_rate =__clk_get_rate (parent); + + pll_params->vco_min =_clip_vco_min (pll_params->vco_min, parent_rate); + + cfg.m =_pll_fixed_mdiv (pll_params, parent_rate); + cfg.n = cfg.m * pll_params->vco_min / parent_rate; + +for (i =0 ; pll_params->pdiv_tohw[i].pdiv; i++) + ; +if (!i) { +kfree (pll); +return ERR_PTR (-EINVAL ); + } + + cfg.p = pll_params->pdiv_tohw[i-1 ].hw_val; + +_update_pll_mnp (pll, &cfg); + +pll_writel_misc (PLLSS_MISC_DEFAULT , pll); +pll_writel (PLLSS_CFG_DEFAULT , pll_params->ext_misc_reg[0 ], pll); +pll_writel (PLLSS_CTRL1_DEFAULT , pll_params->ext_misc_reg[1 ], pll); +pll_writel (PLLSS_CTRL1_DEFAULT , pll_params->ext_misc_reg[2 ], pll); + + val =pll_readl_base (pll); +if (val &PLL_BASE_ENABLE ) { +if (val &BIT (pll_params->iddq_bit_idx)) { +WARN (1 ,"%s is on but IDDQ set\n" , name); +kfree (pll); +return ERR_PTR (-EINVAL ); + } + }else + val |=BIT (pll_params->iddq_bit_idx); + + val &= ~PLLSS_LOCK_OVERRIDE ; +pll_writel_base (val, pll); + + clk =_tegra_clk_register_pll (pll, name, parent_name, flags, + &tegra_clk_pllss_ops); + +if (IS_ERR (clk)) +kfree (pll); + +return clk; +}
drivers/clk/tegra/clk.h +5 -0
@@ -298,6 +298,11 @@ struct clk *tegra_clk_register_plle_tegra114(const char *name,struct tegra_clk_pll_params *pll_params, spinlock_t *lock); +struct clk *tegra_clk_register_pllss (const char *name,const char *parent_name, +void __iomem *clk_base,unsigned long flags, +struct tegra_clk_pll_params *pll_params, +spinlock_t *lock); +/** * struct tegra_clk_pll_out - PLL divider down clock *
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
PATCH v2 2/7 clk: tegra: Add periph regs bank X
In reply to Peter De SchrijverTegra124 has an extra bank of peripheral clock registers. Add it to the generic peripheral clock code.
--- drivers/clk/tegra/clk.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk.c +10 -0
@@ -57,6 +57,8 @@#define RST_DEVICES_CLR_V 0x434#define RST_DEVICES_SET_W 0x438#define RST_DEVICES_CLR_W 0x43c +#define RST_DEVICES_SET_X 0x290 +#define RST_DEVICES_CLR_X 0x294/* Global data of Tegra CPU CAR ops */ static struct tegra_cpu_car_ops dummy_car_ops;
@@ -109,6 +111,14 @@ static struct tegra_clk_periph_regs periph_regs[] = { .rst_set_reg = RST_DEVICES_SET_W, .rst_clr_reg = RST_DEVICES_CLR_W, }, + [5] = { + .enb_reg = CLK_OUT_ENB_X, + .enb_set_reg = CLK_OUT_ENB_SET_X, + .enb_clr_reg = CLK_OUT_ENB_CLR_X, + .rst_reg = RST_DEVICES_X, + .rst_set_reg = RST_DEVICES_SET_X, + .rst_clr_reg = RST_DEVICES_CLR_X, + }, };struct tegra_clk_periph_regs *__init get_reg_bank (int clkid)
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
PATCH v2 3/7 clk: tegra124: Add common clk IDs to clk-id.h
In reply to Peter De SchrijverTegra124 introduces a number of a new clocks. Introduce the corresponding the IDs for them.
--- drivers/clk/tegra/clk-id.h | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk-id.h +20 -0
@@ -7,8 +7,10 @@enum clk_id { tegra_clk_actmon, tegra_clk_adx, + tegra_clk_adx1, tegra_clk_afi, tegra_clk_amx, + tegra_clk_amx1, tegra_clk_apbdma, tegra_clk_apbif, tegra_clk_audio0,
@@ -35,6 +37,7 @@ enum clk_id { tegra_clk_cilcd, tegra_clk_cile, tegra_clk_clk_32k, + tegra_clk_clk72Mhz, tegra_clk_clk_m, tegra_clk_clk_m_div2, tegra_clk_clk_m_div4,
@@ -44,6 +47,8 @@ enum clk_id { tegra_clk_clk_out_2_mux, tegra_clk_clk_out_3, tegra_clk_clk_out_3_mux, + tegra_clk_cml0, + tegra_clk_cml1, tegra_clk_csi, tegra_clk_csite, tegra_clk_csus,
@@ -58,6 +63,7 @@ enum clk_id { tegra_clk_disp1, tegra_clk_disp2, tegra_clk_dp2, + tegra_clk_dpaux, tegra_clk_dsia, tegra_clk_dsialp, tegra_clk_dsia_mux,
@@ -66,6 +72,7 @@ enum clk_id { tegra_clk_dsib_mux, tegra_clk_dtv, tegra_clk_emc, + tegra_clk_entropy, tegra_clk_epp, tegra_clk_epp_8, tegra_clk_extern1,
@@ -73,6 +80,7 @@ enum clk_id { tegra_clk_extern3, tegra_clk_fuse, tegra_clk_fuse_burn, + tegra_clk_gpu, tegra_clk_gr2d, tegra_clk_gr2d_8, tegra_clk_gr3d,
@@ -82,6 +90,7 @@ enum clk_id { tegra_clk_hda2codec_2x, tegra_clk_hda2hdmi, tegra_clk_hdmi, + tegra_clk_hdmi_audio, tegra_clk_host1x, tegra_clk_host1x_8, tegra_clk_i2c1,
@@ -89,6 +98,7 @@ enum clk_id { tegra_clk_i2c3, tegra_clk_i2c4, tegra_clk_i2c5, + tegra_clk_i2c6, tegra_clk_i2cslow, tegra_clk_i2s0, tegra_clk_i2s0_sync,
@@ -101,6 +111,8 @@ enum clk_id { tegra_clk_i2s4, tegra_clk_i2s4_sync, tegra_clk_isp, + tegra_clk_isp_8, + tegra_clk_ispb, tegra_clk_kbc, tegra_clk_kfuse, tegra_clk_la,
@@ -115,17 +127,20 @@ enum clk_id { tegra_clk_ndspeed_8, tegra_clk_nor, tegra_clk_owr, + tegra_clk_pcie, tegra_clk_pclk, tegra_clk_pll_a, tegra_clk_pll_a_out0, tegra_clk_pll_c, tegra_clk_pll_c2, tegra_clk_pll_c3, + tegra_clk_pll_c4, tegra_clk_pll_c_out1, tegra_clk_pll_d, tegra_clk_pll_d2, tegra_clk_pll_d2_out0, tegra_clk_pll_d_out0, + tegra_clk_pll_dp, tegra_clk_pll_e_out0, tegra_clk_pll_m, tegra_clk_pll_m_out1,
@@ -135,6 +150,7 @@ enum clk_id { tegra_clk_pll_p_out2_int, tegra_clk_pll_p_out3, tegra_clk_pll_p_out4, + tegra_clk_pll_p_out5, tegra_clk_pll_ref, tegra_clk_pll_re_out, tegra_clk_pll_re_vco,
@@ -169,6 +185,7 @@ enum clk_id { tegra_clk_sdmmc4, tegra_clk_se, tegra_clk_soc_therm, + tegra_clk_sor0, tegra_clk_spdif, tegra_clk_spdif_2x, tegra_clk_spdif_in,
@@ -195,8 +212,11 @@ enum clk_id { tegra_clk_vfir, tegra_clk_vi, tegra_clk_vi_8, + tegra_clk_vic03, + tegra_clk_vim2_clk, tegra_clk_vimclk_sync, tegra_clk_vi_sensor, + tegra_clk_vi_sensor2, tegra_clk_vi_sensor_8, tegra_clk_xusb_dev, tegra_clk_xusb_dev_src,
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
PATCH v2 4/7 clk: tegra124: Add new peripheral clocks
In reply to Peter De SchrijverTegra124 introduces a number of new peripheral clocks. This patch adds those to the common peripheral clock code.
--- drivers/clk/tegra/clk-tegra-periph.c | 55 ++++++++++++++++++++++++++++++++++ 1 files changed, 55 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk-tegra-periph.c +55 -0
@@ -37,7 +37,9 @@#define CLK_SOURCE_SPDIF_IN 0x10c#define CLK_SOURCE_PWM 0x110#define CLK_SOURCE_ADX 0x638 +#define CLK_SOURCE_ADX1 0x670#define CLK_SOURCE_AMX 0x63c +#define CLK_SOURCE_AMX1 0x674#define CLK_SOURCE_HDA 0x428#define CLK_SOURCE_HDA2CODEC_2X 0x3e4#define CLK_SOURCE_SBC1 0x134
@@ -69,6 +71,7 @@#define CLK_SOURCE_I2C3 0x1b8#define CLK_SOURCE_I2C4 0x3c4#define CLK_SOURCE_I2C5 0x128 +#define CLK_SOURCE_I2C6 0x65c#define CLK_SOURCE_UARTA 0x178#define CLK_SOURCE_UARTB 0x17c#define CLK_SOURCE_UARTC 0x1a0
@@ -77,6 +80,7 @@#define CLK_SOURCE_3D 0x158#define CLK_SOURCE_2D 0x15c#define CLK_SOURCE_MPE 0x170 +#define CLK_SOURCE_UARTE 0x1c4#define CLK_SOURCE_VI_SENSOR 0x1a8#define CLK_SOURCE_VI 0x148#define CLK_SOURCE_EPP 0x16c
@@ -111,6 +115,16 @@#define CLK_SOURCE_XUSB_FS_SRC 0x608#define CLK_SOURCE_XUSB_SS_SRC 0x610#define CLK_SOURCE_XUSB_DEV_SRC 0x60c +#define CLK_SOURCE_ISP 0x144 +#define CLK_SOURCE_SOR0 0x414 +#define CLK_SOURCE_DPAUX 0x418 +#define CLK_SOURCE_SATA_OOB 0x420 +#define CLK_SOURCE_SATA 0x424 +#define CLK_SOURCE_ENTROPY 0x628 +#define CLK_SOURCE_VI_SENSOR2 0x658 +#define CLK_SOURCE_HDMI_AUDIO 0x668 +#define CLK_SOURCE_VIC03 0x678 +#define CLK_SOURCE_CLK72MHZ 0x66c#define MASK (x) (BIT(x) - 1)
@@ -197,12 +211,14 @@#define PLLP_MISC 0xac#define PLLP_OUTA 0xa4#define PLLP_OUTB 0xa8 +#define PLLP_OUTC 0x67c#define PLL_BASE_LOCK BIT(27)#define PLL_MISC_LOCK_ENABLE 18static DEFINE_SPINLOCK (PLLP_OUTA_lock);static DEFINE_SPINLOCK (PLLP_OUTB_lock); +static DEFINE_SPINLOCK (PLLP_OUTC_lock);#define MUX_I2S_SPDIF (_id) \ static const char *mux_pllaout0_##_id##_2x_pllp_clkm[] = { "pll_a_out0", \
@@ -319,6 +335,29 @@ static const char *mux_pllp_plld_pllc_clkm[] = {"pll_p" ,"pll_d_out0" ,"pll_c" ,"clk_m" };#define mux_pllp_plld_pllc_clkm_idx NULL +static const char *mux_pllm_pllc_pllp_plla_clkm_pllc4[] = { +"pll_m" ,"pll_c" ,"pll_p" ,"pll_a_out0" ,"clk_m" ,"pll_c4" , +}; +static u32 mux_pllm_pllc_pllp_plla_clkm_pllc4_idx[] = { + [0 ] =0 , [1 ] =1 , [2 ] =3 , [3 ] =3 , [4 ] =6 , [5 ] =7 , +}; + +static const char *mux_pllp_clkm1[] = { +"pll_p" ,"clk_m" , +}; +#define mux_pllp_clkm1_idx NULL + +static const char *mux_pllp3_pllc_clkm[] = { +"pll_p_out3" ,"pll_c" ,"pll_c2" ,"clk_m" , +}; +#define mux_pllp3_pllc_clkm_idx NULL + +static const char *mux_pllm_pllc_pllp_plla_pllc2_c3_clkm[] = { +"pll_m" ,"pll_c" ,"pll_p" ,"pll_a" ,"pll_c2" ,"pll_c3" ,"clk_m" +}; +static u32 mux_pllm_pllc_pllp_plla_pllc2_c3_clkm_idx[] = { + [0 ] =0 , [1 ] =1 , [2 ] =2 , [3 ] =3 , [4 ] =4 , [5 ] =6 , +};static struct tegra_periph_init_data periph_clks[] = { AUDIO("d_audio", CLK_SOURCE_D_AUDIO, 106, TEGRA_PERIPH_ON_APB, tegra_clk_d_audio),
@@ -346,6 +385,7 @@ static struct tegra_periph_init_data periph_clks[] = {INT8 ("se" , mux_pllp_pllc2_c_c3_pllm_clkm,CLK_SOURCE_SE ,127 ,TEGRA_PERIPH_ON_APB , tegra_clk_se),INT8 ("2d" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_2D ,21 ,0 , tegra_clk_gr2d_8),INT8 ("3d" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_3D ,24 ,0 , tegra_clk_gr3d_8), +INT8 ("vic03" , mux_pllm_pllc_pllp_plla_pllc2_c3_clkm,CLK_SOURCE_VIC03 ,178 ,0 , tegra_clk_vic03),INT_FLAGS ("mselect" , mux_pllp_clkm,CLK_SOURCE_MSELECT ,99 ,0 , tegra_clk_mselect,CLK_IGNORE_UNUSED ),MUX ("i2s0" , mux_pllaout0_audio0_2x_pllp_clkm,CLK_SOURCE_I2S0 ,30 ,TEGRA_PERIPH_ON_APB , tegra_clk_i2s0), MUX("i2s1", mux_pllaout0_audio1_2x_pllp_clkm, CLK_SOURCE_I2S1, 11, TEGRA_PERIPH_ON_APB, tegra_clk_i2s1),
@@ -393,6 +433,9 @@ static struct tegra_periph_init_data periph_clks[] = {MUX ("ndspeed" , mux_pllp_pllc_pllm_clkm,CLK_SOURCE_NDSPEED ,80 ,TEGRA_PERIPH_ON_APB , tegra_clk_ndspeed),MUX ("sata_oob" , mux_pllp_pllc_pllm_clkm,CLK_SOURCE_SATA_OOB ,123 ,TEGRA_PERIPH_ON_APB , tegra_clk_sata_oob),MUX ("sata" , mux_pllp_pllc_pllm_clkm,CLK_SOURCE_SATA ,124 ,TEGRA_PERIPH_ON_APB , tegra_clk_sata), +MUX ("adx1" , mux_plla_pllc_pllp_clkm,CLK_SOURCE_ADX1 ,180 ,TEGRA_PERIPH_ON_APB , tegra_clk_adx1), +MUX ("amx1" , mux_plla_pllc_pllp_clkm,CLK_SOURCE_AMX1 ,185 ,TEGRA_PERIPH_ON_APB , tegra_clk_amx1), +MUX ("vi_sensor2" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_VI_SENSOR2 ,20 ,TEGRA_PERIPH_NO_RESET , tegra_clk_vi_sensor2),MUX8 ("sbc1" , mux_pllp_pllc2_c_c3_pllm_clkm,CLK_SOURCE_SBC1 ,41 ,TEGRA_PERIPH_ON_APB , tegra_clk_sbc1_8),MUX8 ("sbc2" , mux_pllp_pllc2_c_c3_pllm_clkm,CLK_SOURCE_SBC2 ,44 ,TEGRA_PERIPH_ON_APB , tegra_clk_sbc2_8), MUX8("sbc3", mux_pllp_pllc2_c_c3_pllm_clkm, CLK_SOURCE_SBC3, 46, TEGRA_PERIPH_ON_APB, tegra_clk_sbc3_8),
@@ -407,6 +450,11 @@ static struct tegra_periph_init_data periph_clks[] = {MUX8 ("extern3" , mux_plla_clk32_pllp_clkm_plle,CLK_SOURCE_EXTERN3 ,122 ,0 , tegra_clk_extern3),MUX8 ("soc_therm" , mux_pllm_pllc_pllp_plla,CLK_SOURCE_SOC_THERM ,78 ,TEGRA_PERIPH_ON_APB , tegra_clk_soc_therm),MUX8 ("vi_sensor" , mux_pllm_pllc2_c_c3_pllp_plla,CLK_SOURCE_VI_SENSOR ,20 ,TEGRA_PERIPH_NO_RESET , tegra_clk_vi_sensor_8), +MUX8 ("isp" , mux_pllm_pllc_pllp_plla_clkm_pllc4,CLK_SOURCE_ISP ,23 ,TEGRA_PERIPH_ON_APB , tegra_clk_isp_8), +MUX8 ("entropy" , mux_pllp_clkm1,CLK_SOURCE_ENTROPY ,149 ,0 , tegra_clk_entropy), +MUX8 ("hdmi_audio" , mux_pllp3_pllc_clkm,CLK_SOURCE_HDMI_AUDIO ,176 ,TEGRA_PERIPH_NO_RESET , tegra_clk_hdmi_audio), +MUX8 ("clk72mhz" , mux_pllp3_pllc_clkm,CLK_SOURCE_CLK72MHZ ,177 ,TEGRA_PERIPH_NO_RESET , tegra_clk_clk72Mhz), +MUX8 ("sor0" , mux_pllp_pllm_plld_plla_pllc_plld2_clkm,CLK_SOURCE_SOR0 ,182 ,0 , tegra_clk_sor0),MUX_FLAGS ("csite" , mux_pllp_pllc_pllm_clkm,CLK_SOURCE_CSITE ,73 ,TEGRA_PERIPH_ON_APB , tegra_clk_csite,CLK_IGNORE_UNUSED ),NODIV ("disp1" , mux_pllp_pllm_plld_plla_pllc_plld2_clkm,CLK_SOURCE_DISP1 ,29 ,7 ,27 ,0 , tegra_clk_disp1), NODIV("disp2", mux_pllp_pllm_plld_plla_pllc_plld2_clkm, CLK_SOURCE_DISP2, 29, 7, 26, 0, tegra_clk_disp2),
@@ -453,6 +501,12 @@ static struct tegra_periph_init_data gate_clks[] = {GATE ("dsib" ,"dsib_mux" ,82 ,0 , tegra_clk_dsib,0 ),GATE ("emc" ,"emc_mux" ,57 ,0 , tegra_clk_emc,CLK_IGNORE_UNUSED ),GATE ("sata_cold" ,"clk_m" ,129 ,TEGRA_PERIPH_ON_APB , tegra_clk_sata_cold,0 ), +GATE ("sata_cold" ,"clk_m" ,129 ,TEGRA_PERIPH_ON_APB , tegra_clk_sata_cold,0 ), +GATE ("ispb" ,"clk_m" ,3 ,0 , tegra_clk_ispb,0 ), +GATE ("vim2_clk" ,"clk_m" ,11 ,0 , tegra_clk_vim2_clk,0 ), +GATE ("pcie" ,"clk_m" ,70 ,0 , tegra_clk_pcie,0 ), +GATE ("dpaux" ,"clk_m" ,181 ,0 , tegra_clk_dpaux,0 ), + GATE("gpu", "pll_ref", 184, 0, tegra_clk_gpu, 0), }; struct pll_out_data {
@@ -485,6 +539,7 @@ static struct pll_out_data pllp_out_clks[] = {PLL_OUT (2 ,PLLP_OUTA ,24 ,TEGRA_DIVIDER_INT ,16 , pll_p_out2_int),PLL_OUT (3 ,PLLP_OUTB ,8 ,0 ,0 , pll_p_out3),PLL_OUT (4 ,PLLP_OUTB ,24 ,0 ,16 , pll_p_out4), + PLL_OUT(5, PLLP_OUTC, 24, 0, 16, pll_p_out5), }; static void __init periph_clk_init(void __iomem *clk_base,
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
PATCH v2 5/7 clk: tegra124: Add support for Tegra124 clocks
In reply to Peter De SchrijverImplement clock support for Tegra124.
--- drivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-tegra124.c | 1377 ++++++++++++++++++++++++++++++ include/dt-bindings/clock/tegra124-car.h | 341 ++++++++ 3 files changed, 1719 insertions(+), 0 deletions(-) create mode 100644 drivers/clk/tegra/clk-tegra124.c create mode 100644 include/dt-bindings/clock/tegra124-car.h
drivers/clk/tegra/Makefile +1 -0
@@ -14,3 +14,4 @@ obj-y += clk-tegra-super-gen4.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 +obj-$(CONFIG_ARCH_TEGRA_124_SOC) += clk-tegra124.o
drivers/clk/tegra/clk-tegra124.c new file +1377 -0
1,377 lines not on this page · raw message
include/dt-bindings/clock/tegra124-car.h new file +341 -0
341 lines not on this page · raw message
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
PATCH v2 6/7 clk: tegra124: add wait_for_reset and disable_clock for tegra_cpu_car_ops
In reply to Peter De SchrijverFrom: Joseph Lo <[email protected]>
Hook the functions for CPU hotplug support. After the CPU is hot unplugged, the flow controller will handle to clock gate the CPU clock. But still need to implement an empty function to avoid warning message.
--- drivers/clk/tegra/clk-tegra124.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk-tegra124.c +26 -0
@@ -114,6 +114,9 @@#define UTMIPLL_HW_PWRDN_CFG0_IDDQ_OVERRIDE BIT(1)#define UTMIPLL_HW_PWRDN_CFG0_IDDQ_SWCTL BIT(0) +/* Tegra CPU clock and reset control regs */ +#define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470 +static void __iomem *clk_base;static void __iomem *pmc_base;
@@ -1289,6 +1292,27 @@ static void __init tegra124_pll_init(void __iomem *clk_base, } +/* Tegra124 CPU clock and reset control functions */ +static void tegra124_wait_cpu_in_reset (u32 cpu) +{ +unsigned int reg; + +do { + reg =readl (clk_base +CLK_RST_CONTROLLER_CPU_CMPLX_STATUS ); +cpu_relax (); + }while (!(reg & (1 << cpu)));/* check CPU been reset or not */ +} + +static void tegra124_disable_cpu_clock (u32 cpu) +{ +/* flow controller would take care in the power sequence. */ +} + +static struct tegra_cpu_car_ops tegra124_cpu_car_ops = { + .wait_for_reset = tegra124_wait_cpu_in_reset, + .disable_clock = tegra124_disable_cpu_clock, +}; +static const struct of_device_id pmc_match[]__initconst = { { .compatible ="nvidia,tegra124-pmc" }, {},
@@ -1373,5 +1397,7 @@ static void __init tegra124_clock_init(struct device_node *np)tegra_register_devclks (devclks,ARRAY_SIZE (devclks)); tegra_clk_apply_init_table = tegra124_clock_apply_init_table; + + tegra_cpu_car_ops = &tegra124_cpu_car_ops; }CLK_OF_DECLARE (tegra124,"nvidia,tegra124-car" , tegra124_clock_init);
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
PATCH v2 7/7 clk: tegra124: add suspend/resume function for tegra_cpu_car_ops
In reply to Peter De SchrijverFrom: Joseph Lo <[email protected]>
Adding suspend/resume function for tegra_cpu_car_ops. We only save and restore the setting of the clock of CoreSight. Other clocks still need to be taken care by clock driver.
--- drivers/clk/tegra/clk-tegra124.c | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-)
drivers/clk/tegra/clk-tegra124.c +27 -0
@@ -28,6 +28,7 @@#include "clk.h" #include "clk-id.h" +#define CLK_SOURCE_CSITE 0x1d4#define CLK_SOURCE_EMC 0x19c#define CLK_SOURCE_XUSB_SS_SRC 0x610
@@ -117,6 +118,12 @@/* Tegra CPU clock and reset control regs */ #define CLK_RST_CONTROLLER_CPU_CMPLX_STATUS 0x470 +#ifdef CONFIG_PM_SLEEP +static struct cpu_clk_suspend_context { +u32 clk_csite_src; +} tegra124_cpu_clk_sctx; +#endif +static void __iomem *clk_base;static void __iomem *pmc_base;
@@ -1308,9 +1315,29 @@ static void tegra124_disable_cpu_clock(u32 cpu)/* flow controller would take care in the power sequence. */ } +#ifdef CONFIG_PM_SLEEP +static void tegra124_cpu_clock_suspend (void ) +{ +/* switch coresite to clk_m, save off original source */ + tegra124_cpu_clk_sctx.clk_csite_src = +readl (clk_base +CLK_SOURCE_CSITE ); +writel (3 <<30 , clk_base +CLK_SOURCE_CSITE ); +} + +static void tegra124_cpu_clock_resume (void ) +{ +writel (tegra124_cpu_clk_sctx.clk_csite_src, + clk_base +CLK_SOURCE_CSITE ); +} +#endif +static struct tegra_cpu_car_ops tegra124_cpu_car_ops = { .wait_for_reset = tegra124_wait_cpu_in_reset, .disable_clock = tegra124_disable_cpu_clock, +#ifdef CONFIG_PM_SLEEP + .suspend = tegra124_cpu_clock_suspend, + .resume = tegra124_cpu_clock_resume, +#endif };static const struct of_device_id pmc_match[]__initconst = {
Signature · 1 line
1.7.7.rc0.72.g4b5ea.dirty
[devicetree to bcc]
Peter,
Please don't post driver/platform patches to the devicetree list. Only bindings updates should be posted here.
Otherwise the volume of patches make the people who need to see the and review the bindings run for the hills. :-)
-Olof
Quoted 40 lines · Peter De Schrijver
This series introduces support for the Tegra124 CAR clocks. Based on '[PATCH v3 00/12] Introduce common infra for tegra clocks'
changes since v1:
+ suspend/resume for LP1 (Joseph Lo)
+ fixed some comments
+ account for changes to the common infra codeJoseph Lo (2):
clk: tegra124: addwait_for_resetanddisable_clockfor
tegra_cpu_car_ops
clk: tegra124: add suspend/resume function fortegra_cpu_car_opsPeter De Schrijver (5):
clk: tegra: Add support for PLLSS
clk: tegra: Add periph regs bank X
clk: tegra124: Add common clk IDs toclk-id.h
clk: tegra124: Add new peripheral clocks
clk: tegra124: Add support for Tegra124 clocksdrivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-id.h | 20 + drivers/clk/tegra/clk-pll.c | 172 ++++ drivers/clk/tegra/clk-tegra-periph.c | 55 ++ drivers/clk/tegra/clk-tegra124.c | 1430 ++++++++++++++++++++++++++++++ drivers/clk/tegra/clk.c | 10 + drivers/clk/tegra/clk.h | 5 + include/dt-bindings/clock/tegra124-car.h | 341 +++++++ 8 files changed, 2034 insertions(+), 0 deletions(-) create mode 100644 drivers/clk/tegra/clk-tegra124.c create mode 100644 include/dt-bindings/clock/tegra124-car.h--
1.7.7.rc0.72.g4b5ea.dirty--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[devicetree to bcc]
Peter,
Please don't post driver/platform patches to the devicetree list. Only bindings updates should be posted here.
Otherwise the volume of patches make the people who need to see the and review the bindings run for the hills. :-)
-Olof
Quoted 33 lines · Peter De Schrijver
This series introduces support for the Tegra124 CAR clocks. Based on '[PATCH v3 00/12] Introduce common infra for tegra clocks'
changes since v1:
+ suspend/resume for LP1 (Joseph Lo)
+ fixed some comments
+ account for changes to the common infra codeJoseph Lo (2):
clk: tegra124: addwait_for_resetanddisable_clockfor
tegra_cpu_car_ops
clk: tegra124: add suspend/resume function fortegra_cpu_car_opsPeter De Schrijver (5):
clk: tegra: Add support for PLLSS
clk: tegra: Add periph regs bank X
clk: tegra124: Add common clk IDs toclk-id.h
clk: tegra124: Add new peripheral clocks
clk: tegra124: Add support for Tegra124 clocksdrivers/clk/tegra/Makefile | 1 + drivers/clk/tegra/clk-id.h | 20 + drivers/clk/tegra/clk-pll.c | 172 ++++ drivers/clk/tegra/clk-tegra-periph.c | 55 ++ drivers/clk/tegra/clk-tegra124.c | 1430 ++++++++++++++++++++++++++++++ drivers/clk/tegra/clk.c | 10 + drivers/clk/tegra/clk.h | 5 + include/dt-bindings/clock/tegra124-car.h | 341 +++++++ 8 files changed, 2034 insertions(+), 0 deletions(-) create mode 100644 drivers/clk/tegra/clk-tegra124.c create mode 100644 include/dt-bindings/clock/tegra124-car.h
Quoted 7 lines
--
1.7.7.rc0.72.g4b5ea.dirty--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 1/7] clk: tegra: Add support for PLLSS
In reply to Peter De Schrijverdrivers/clk/tegra/clk-pll.c static void clk_plle_tegra114_disable(struct clk_hw *hw) · line 1353
Quoted 7 lines · Peter De Schrijver
Tegra124 introduces a new PLL type, PLLSS. Add support for it.
drivers/clk/tegra/clk-pll.c +2
-0+static int clk_pllss_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate)
This function seems pretty generic. Is it possible to share a bit more code with any of the other pllXXX_set_rate() functions?
drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1820
Quoted 13 lines
drivers/clk/tegra/clk-pll.c +12
-0+struct clk *tegra_clk_register_pllss (const char *name,const char *parent_name, +void __iomem *clk_base,unsigned long flags, +struct tegra_clk_pll_params *pll_params, +spinlock_t *lock) + val =pll_readl_base (pll); +if (val &PLLSS_REF_SRC_SEL_MASK ) { +WARN (1 ,"Unknown parent selected for %s: %d\n" , name, + (val &PLLSS_REF_SRC_SEL_MASK ) >> +PLLSS_REF_SRC_SEL_SHIFT ); +kfree (pll); +return ERR_PTR (-EINVAL ); + }
If there's a field in HW that muxes the clock input between n clocks, why does this function assume there's a single parent for this PLL, by taking a "const char *parent_name" parameter?
What happens if the bootloader changed this field in HW; is the kernel simply not able to boot?
Quoted 15 lines
drivers/clk/tegra/clk-pll.c +15
-0+ +_get_pll_mnp (pll, &cfg); +if (cfg.n >1 ) { +WARN (1 ,"%s should not be initialized\n" , name); +kfree (pll); +return ERR_PTR (-EINVAL ); + } + + parent_rate =__clk_get_rate (parent); + + pll_params->vco_min =_clip_vco_min (pll_params->vco_min, parent_rate); + + cfg.m =_pll_fixed_mdiv (pll_params, parent_rate); + cfg.n = cfg.m * pll_params->vco_min / parent_rate; +
drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1845
Quoted 10 lines
drivers/clk/tegra/clk-pll.c +10
-0+for (i =0 ; pll_params->pdiv_tohw[i].pdiv; i++) + ; +if (!i) { +kfree (pll); +return ERR_PTR (-EINVAL ); + } + + cfg.p = pll_params->pdiv_tohw[i-1 ].hw_val; + +_update_pll_mnp (pll, &cfg);
I *guess* that seems to be forcing a particular configuration of the PLL. Why not do that in the initialization table? Some comments here re:
why this is done might be nice.
Re: [PATCH v2 4/7] clk: tegra124: Add new peripheral clocks
In reply to Peter De Schrijverdrivers/clk/tegra/clk-tegra-periph.c static struct tegra_periph_init_data gate_clks[] = { · line 504
Quoted 10 lines · Peter De Schrijver
Tegra124 introduces a number of new peripheral clocks. This patch adds those to the common peripheral clock code.
drivers/clk/tegra/clk-tegra-periph.c +1
-0@@ -453,6 +501,12 @@ static struct tegra_periph_init_data gate_clks[] = {GATE ("dsib" ,"dsib_mux" ,82 ,0 , tegra_clk_dsib,0 ),GATE ("emc" ,"emc_mux" ,57 ,0 , tegra_clk_emc,CLK_IGNORE_UNUSED ),GATE ("sata_cold" ,"clk_m" ,129 ,TEGRA_PERIPH_ON_APB , tegra_clk_sata_cold,0 ), + GATE("sata_cold", "clk_m", 129, TEGRA_PERIPH_ON_APB, tegra_clk_sata_cold, 0),
That's a duplicate.
Re: [PATCH v2 5/7] clk: tegra124: Add support for Tegra124 clocks
In reply to Peter De SchrijverQuoted 7 lines · Peter De Schrijver
Implement clock support for Tegra124.
drivers/clk/tegra/clk-tegra124.c +3
-0+static struct pdiv_map pll12g_ssd_esd_p[] = { + { .pdiv =1 , .hw_val =0 }, + { .pdiv =2 , .hw_val =1 },
...
drivers/clk/tegra/clk-tegra124.c line 343
Quoted 4 lines
drivers/clk/tegra/clk-tegra124.c +4
-0+ { .pdiv = 24, .hw_val = 13 }, + { .pdiv = 32, .hw_val = 14 }, + { .pdiv = 0, .hw_val = 15 }, +};
I'm curious why that last entry doesn't have .hw_val = 0, since I think it's a sentinel value. For example, the last entry in pllxc_p[] does have .hw_val = 0.
include/dt-bindings/clock/tegra124-car.h
Quoted 1 line
include/dt-bindings/clock/tegra124-car.h +0
-0
I think you also need to create Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txt in this patch. All the other SoCs have their own binding file. That said, given all the clock IDs have moved into <dt-bindings/clock/tegraNNN-car.h>, perhaps we should just have a separate patch that removes the separate bindings for Tegra30 and Tegra114, and simply add their compatible values into the existing nvidia,tegra20-car.txt (and also make the header file reference in that file more generic so it applies to any Tegra SoC)?
include/dt-bindings/clock/tegra124-car.h line 5
Quoted 6 lines
include/dt-bindings/clock/tegra124-car.h +5
-0@@ -0,0 +1,341 @@ +/* +* This header provides constants for binding nvidia,tegra124-car. +* +* The first 185 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB +* registers.
Shouldn't that be 192 (== 185 * 32)? Perhaps some bits aren't allocated, but in previous SoCs, I rounded the ID space for peripheral clocks up to whole registers. I see that as far as the clock IDs, this is already fine; it's just this description that says 185 not 192.
Quoted 2 lines · Peter De Schrijver
This series introduces support for the Tegra124 CAR clocks. Based on '[PATCH v3 00/12] Introduce common infra for tegra clocks'
Again, this series looks reasonable, but I'll hold my ack until the testing issues I reported are resolved.
Re: [PATCH v2 1/7] clk: tegra: Add support for PLLSS
In reply to Stephen WarrenQuoted 30 lines · Stephen Warren
drivers/clk/tegra/clk-pll.c static void clk_plle_tegra114_disable(struct clk_hw *hw) · line 1353
Quoted 7 lines · Peter De Schrijver
Tegra124 introduces a new PLL type, PLLSS. Add support for it.
drivers/clk/tegra/clk-pll.c +2
-0+static int clk_pllss_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate)This function seems pretty generic. Is it possible to share a bit more code with any of the other
pllXXX_set_rate()functions?drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1820
Quoted 13 lines
drivers/clk/tegra/clk-pll.c +12
-0+struct clk *tegra_clk_register_pllss (const char *name,const char *parent_name, +void __iomem *clk_base,unsigned long flags, +struct tegra_clk_pll_params *pll_params, +spinlock_t *lock) + val =pll_readl_base (pll); +if (val &PLLSS_REF_SRC_SEL_MASK ) { +WARN (1 ,"Unknown parent selected for %s: %d\n" , name, + (val &PLLSS_REF_SRC_SEL_MASK ) >> +PLLSS_REF_SRC_SEL_SHIFT ); +kfree (pll); +return ERR_PTR (-EINVAL ); + }If there's a field in HW that muxes the clock input between n clocks, why does this function assume there's a single parent for this PLL, by taking a "const char
*parent_name" parameter?
Quoted 3 lines
What happens if the bootloader changed this field in HW; is the kernel simply not able to boot?
This logic comes from downstream. I guess it means we're running in an unvalidated configuration. Do you think we should expose all parents anyway? Even if not all configurations have been validated? (which is quite likely)
Cheers,
Peter.
Re: [PATCH v2 5/7] clk: tegra124: Add support for Tegra124 clocks
In reply to Stephen WarrenQuoted 18 lines · Stephen Warren
Quoted 7 lines · Peter De Schrijver
Implement clock support for Tegra124.
drivers/clk/tegra/clk-tegra124.c +3
-0+static struct pdiv_map pll12g_ssd_esd_p[] = { + { .pdiv =1 , .hw_val =0 }, + { .pdiv =2 , .hw_val =1 },...
drivers/clk/tegra/clk-tegra124.c line 343
Quoted 4 lines
drivers/clk/tegra/clk-tegra124.c +4
-0+ { .pdiv = 24, .hw_val = 13 }, + { .pdiv = 32, .hw_val = 14 }, + { .pdiv = 0, .hw_val = 15 }, +};I'm curious why that last entry doesn't have .hw_val = 0, since I think it's a sentinel value. For example, the last entry in pllxc_p[] does have .hw_val = 0.
Quoted 11 lines
include/dt-bindings/clock/tegra124-car.h
Quoted 1 line
include/dt-bindings/clock/tegra124-car.h +0
-0I think you also need to create
Documentation/devicetree/bindings/clock/nvidia,tegra124-car.txtin this patch. All the other SoCs have their own binding file. That said, given all the clock IDs have moved into <dt-bindings/clock/tegraNNN-car.h>, perhaps we should just have a separate patch that removes the separate bindings for Tegra30 and Tegra114, and simply add their compatible values into the existing nvidia,tegra20-car.txt (and also make the header file reference in that file more generic so it applies to any Tegra SoC)?
Maybe yes...
Quoted 9 lines
include/dt-bindings/clock/tegra124-car.h line 5
Quoted 7 lines
include/dt-bindings/clock/tegra124-car.h +5
-0@@ -0,0 +1,341 @@ +/* +* This header provides constants for binding nvidia,tegra124-car. +* +* The first 185 clocks are numbered to match the bits in the CAR's CLK_OUT_ENB +* registers. Shouldn't that be 192 (== 185 * 32)? Perhaps some bits aren't allocated,
I guess you mean 6 * 32?
Quoted 3 lines
but in previous SoCs, I rounded the ID space for peripheral clocks up to whole registers. I see that as far as the clock IDs, this is already fine; it's just this description that says 185 not 192.
Ok.
Cheers,
Peter.
Re: [PATCH v2 1/7] clk: tegra: Add support for PLLSS
In reply to Peter De SchrijverQuoted 31 lines · Peter De Schrijver
Quoted 30 lines · Stephen Warren
drivers/clk/tegra/clk-pll.c static void clk_plle_tegra114_disable(struct clk_hw *hw) · line 1353
Quoted 7 lines · Peter De Schrijver
Tegra124 introduces a new PLL type, PLLSS. Add support for it.
drivers/clk/tegra/clk-pll.c +2
-0+static int clk_pllss_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate)This function seems pretty generic. Is it possible to share a bit more code with any of the other
pllXXX_set_rate()functions?drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1820
Quoted 13 lines
drivers/clk/tegra/clk-pll.c +12
-0+struct clk *tegra_clk_register_pllss (const char *name,const char *parent_name, +void __iomem *clk_base,unsigned long flags, +struct tegra_clk_pll_params *pll_params, +spinlock_t *lock) + val =pll_readl_base (pll); +if (val &PLLSS_REF_SRC_SEL_MASK ) { +WARN (1 ,"Unknown parent selected for %s: %d\n" , name, + (val &PLLSS_REF_SRC_SEL_MASK ) >> +PLLSS_REF_SRC_SEL_SHIFT ); +kfree (pll); +return ERR_PTR (-EINVAL ); + }If there's a field in HW that muxes the clock input between n clocks, why does this function assume there's a single parent for this PLL, by taking a "const char
*parent_name" parameter?
Quoted 8 lines
Quoted 3 lines
What happens if the bootloader changed this field in HW; is the kernel simply not able to boot?
This logic comes from downstream. I guess it means we're running in an unvalidated configuration. Do you think we should expose all parents anyway? Even if not all configurations have been validated? (which is quite likely)
If we only support one particular parent, why not force the register field to the desired value, rather than failing?
Re: [PATCH v2 1/7] clk: tegra: Add support for PLLSS
Quoted 36 lines · Stephen Warren
Quoted 35 lines · Peter De Schrijver
Quoted 33 lines · Stephen Warren
drivers/clk/tegra/clk-pll.c static void clk_plle_tegra114_disable(struct clk_hw *hw) · line 1353
Quoted 7 lines · Peter De Schrijver
Tegra124 introduces a new PLL type, PLLSS. Add support for it.
drivers/clk/tegra/clk-pll.c +2
-0+static int clk_pllss_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate)This function seems pretty generic. Is it possible to share a bit more code with any of the other
pllXXX_set_rate()functions?drivers/clk/tegra/clk-pll.c struct clk *tegra_clk_register_plle_tegra114(const char *name, · line 1820
Quoted 13 lines
drivers/clk/tegra/clk-pll.c +12
-0+struct clk *tegra_clk_register_pllss (const char *name,const char *parent_name, +void __iomem *clk_base,unsigned long flags, +struct tegra_clk_pll_params *pll_params, +spinlock_t *lock) + val =pll_readl_base (pll); +if (val &PLLSS_REF_SRC_SEL_MASK ) { +WARN (1 ,"Unknown parent selected for %s: %d\n" , name, + (val &PLLSS_REF_SRC_SEL_MASK ) >> +PLLSS_REF_SRC_SEL_SHIFT ); +kfree (pll); +return ERR_PTR (-EINVAL ); + }If there's a field in HW that muxes the clock input between n clocks, why does this function assume there's a single parent for this PLL, by taking a "const char
*parent_name" parameter?What happens if the bootloader changed this field in HW; is the kernel simply not able to boot?
Quoted 7 lines
Quoted 4 lines
This logic comes from downstream. I guess it means we're running in an unvalidated configuration. Do you think we should expose all parents anyway? Even if not all configurations have been validated? (which is quite likely)
If we only support one particular parent, why not force the register field to the desired value, rather than failing?
Sounds reasonable indeed. I will do that in the next version.
Cheers,
Peter.