Skip to content

Commit 0493258

Browse files
committed
Merge tag 'ti-clk-for-5.5-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/kristo/linux into clk-ti
Pull TI clk driver updates from Tero Kristo: As the clock and reset handling is tightly coupled on the hardware level on OMAP SoCs, we must ensure the events are sequenced properly. This series makes sure that the clock side is behaving properly, and the sequencing of the events is left for the bus driver (ti-sysc.) The series also includes revamp of the TI divider clock implementation to handle max divider values properly in cases where the max value is not limited by the bitfield of the IO register but instead limited to some arbitrary value. Previously this resulted in too high divider values to be used in some cases causing HW malfunction. Additionally, a couple of smaller changes needed by remoteproc support are added; checking of the standby status and some missing clkctrl data for omap5/dra7. * tag 'ti-clk-for-5.5-v2' of git://git.kernel.org/pub/scm/linux/kernel/git/kristo/linux: ARM: dts: omap3: fix DPLL4 M4 divider max value clk: ti: divider: convert to use min,max,mask instead of width clk: ti: divider: cleanup ti_clk_parse_divider_data API clk: ti: divider: cleanup _register_divider and ti_clk_get_div_table clk: ti: am43xx: drop idlest polling from gfx clock clk: ti: am33xx: drop idlest polling from gfx clock clk: ti: am33xx: drop idlest polling from pruss clkctrl clock clk: ti: am43xx: drop idlest polling from pruss clkctrl clock clk: ti: omap5: Drop idlest polling from IPU & DSP clkctrl clocks clk: ti: omap4: Drop idlest polling from IPU & DSP clkctrl clocks clk: ti: dra7xx: Drop idlest polling from IPU & DSP clkctrl clocks clk: ti: omap5: add IVA subsystem clkctrl data dt-bindings: clk: add omap5 iva clkctrl definitions clk: ti: clkctrl: add new exported API for checking standby info clk: ti: clkctrl: convert to use bit helper macros instead of bitops clk: ti: clkctrl: fix setting up clkctrl clocks
2 parents 54ecb8f + f586919 commit 0493258

File tree

12 files changed

+187
-191
lines changed

12 files changed

+187
-191
lines changed

arch/arm/boot/dts/omap36xx-clocks.dtsi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,7 @@
105105
<&mcbsp4_ick>, <&uart4_fck>;
106106
};
107107
};
108+
109+
&dpll4_m4_ck {
110+
ti,max-div = <31>;
111+
};

arch/arm/boot/dts/omap3xxx-clocks.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@
416416
#clock-cells = <0>;
417417
compatible = "ti,divider-clock";
418418
clocks = <&dpll4_ck>;
419-
ti,max-div = <32>;
419+
ti,max-div = <16>;
420420
reg = <0x0e40>;
421421
ti,index-starts-at-one;
422422
};

drivers/clk/ti/clk-33xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static const struct omap_clkctrl_reg_data am3_l4hs_clkctrl_regs[] __initconst =
107107
};
108108

109109
static const struct omap_clkctrl_reg_data am3_pruss_ocp_clkctrl_regs[] __initconst = {
110-
{ AM3_PRUSS_OCP_PRUSS_CLKCTRL, NULL, CLKF_SW_SUP, "pruss_ocp_gclk" },
110+
{ AM3_PRUSS_OCP_PRUSS_CLKCTRL, NULL, CLKF_SW_SUP | CLKF_NO_IDLEST, "pruss_ocp_gclk" },
111111
{ 0 },
112112
};
113113

@@ -217,7 +217,7 @@ static const struct omap_clkctrl_reg_data am3_l4_rtc_clkctrl_regs[] __initconst
217217
};
218218

219219
static const struct omap_clkctrl_reg_data am3_gfx_l3_clkctrl_regs[] __initconst = {
220-
{ AM3_GFX_L3_GFX_CLKCTRL, NULL, CLKF_SW_SUP, "gfx_fck_div_ck" },
220+
{ AM3_GFX_L3_GFX_CLKCTRL, NULL, CLKF_SW_SUP | CLKF_NO_IDLEST, "gfx_fck_div_ck" },
221221
{ 0 },
222222
};
223223

drivers/clk/ti/clk-43xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static const struct omap_clkctrl_reg_data am4_mpu_clkctrl_regs[] __initconst = {
7373
};
7474

7575
static const struct omap_clkctrl_reg_data am4_gfx_l3_clkctrl_regs[] __initconst = {
76-
{ AM4_GFX_L3_GFX_CLKCTRL, NULL, CLKF_SW_SUP, "gfx_fck_div_ck" },
76+
{ AM4_GFX_L3_GFX_CLKCTRL, NULL, CLKF_SW_SUP | CLKF_NO_IDLEST, "gfx_fck_div_ck" },
7777
{ 0 },
7878
};
7979

@@ -126,7 +126,7 @@ static const struct omap_clkctrl_reg_data am4_l3s_clkctrl_regs[] __initconst = {
126126
};
127127

128128
static const struct omap_clkctrl_reg_data am4_pruss_ocp_clkctrl_regs[] __initconst = {
129-
{ AM4_PRUSS_OCP_PRUSS_CLKCTRL, NULL, CLKF_SW_SUP, "pruss_ocp_gclk" },
129+
{ AM4_PRUSS_OCP_PRUSS_CLKCTRL, NULL, CLKF_SW_SUP | CLKF_NO_IDLEST, "pruss_ocp_gclk" },
130130
{ 0 },
131131
};
132132

drivers/clk/ti/clk-44xx.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static const struct omap_clkctrl_reg_data omap4_mpuss_clkctrl_regs[] __initconst
3737
};
3838

3939
static const struct omap_clkctrl_reg_data omap4_tesla_clkctrl_regs[] __initconst = {
40-
{ OMAP4_DSP_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_iva_m4x2_ck" },
40+
{ OMAP4_DSP_CLKCTRL, NULL, CLKF_HW_SUP | CLKF_NO_IDLEST, "dpll_iva_m4x2_ck" },
4141
{ 0 },
4242
};
4343

@@ -219,7 +219,7 @@ static const struct omap_clkctrl_reg_data omap4_l3_2_clkctrl_regs[] __initconst
219219
};
220220

221221
static const struct omap_clkctrl_reg_data omap4_ducati_clkctrl_regs[] __initconst = {
222-
{ OMAP4_IPU_CLKCTRL, NULL, CLKF_HW_SUP, "ducati_clk_mux_ck" },
222+
{ OMAP4_IPU_CLKCTRL, NULL, CLKF_HW_SUP | CLKF_NO_IDLEST, "ducati_clk_mux_ck" },
223223
{ 0 },
224224
};
225225

drivers/clk/ti/clk-54xx.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static const struct omap_clkctrl_reg_data omap5_mpu_clkctrl_regs[] __initconst =
3131
};
3232

3333
static const struct omap_clkctrl_reg_data omap5_dsp_clkctrl_regs[] __initconst = {
34-
{ OMAP5_MMU_DSP_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_iva_h11x2_ck" },
34+
{ OMAP5_MMU_DSP_CLKCTRL, NULL, CLKF_HW_SUP | CLKF_NO_IDLEST, "dpll_iva_h11x2_ck" },
3535
{ 0 },
3636
};
3737

@@ -145,7 +145,7 @@ static const struct omap_clkctrl_reg_data omap5_l3main2_clkctrl_regs[] __initcon
145145
};
146146

147147
static const struct omap_clkctrl_reg_data omap5_ipu_clkctrl_regs[] __initconst = {
148-
{ OMAP5_MMU_IPU_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_core_h22x2_ck" },
148+
{ OMAP5_MMU_IPU_CLKCTRL, NULL, CLKF_HW_SUP | CLKF_NO_IDLEST, "dpll_core_h22x2_ck" },
149149
{ 0 },
150150
};
151151

@@ -286,6 +286,12 @@ static const struct omap_clkctrl_reg_data omap5_l4per_clkctrl_regs[] __initconst
286286
{ 0 },
287287
};
288288

289+
static const struct omap_clkctrl_reg_data omap5_iva_clkctrl_regs[] __initconst = {
290+
{ OMAP5_IVA_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_iva_h12x2_ck" },
291+
{ OMAP5_SL2IF_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_iva_h12x2_ck" },
292+
{ 0 },
293+
};
294+
289295
static const char * const omap5_dss_dss_clk_parents[] __initconst = {
290296
"dpll_per_h12x2_ck",
291297
NULL,
@@ -502,6 +508,7 @@ const struct omap_clkctrl_data omap5_clkctrl_data[] __initconst = {
502508
{ 0x4a008d20, omap5_l4cfg_clkctrl_regs },
503509
{ 0x4a008e20, omap5_l3instr_clkctrl_regs },
504510
{ 0x4a009020, omap5_l4per_clkctrl_regs },
511+
{ 0x4a009220, omap5_iva_clkctrl_regs },
505512
{ 0x4a009420, omap5_dss_clkctrl_regs },
506513
{ 0x4a009520, omap5_gpu_clkctrl_regs },
507514
{ 0x4a009620, omap5_l3init_clkctrl_regs },

drivers/clk/ti/clk-7xx.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ static const struct omap_clkctrl_reg_data dra7_mpu_clkctrl_regs[] __initconst =
2525
};
2626

2727
static const struct omap_clkctrl_reg_data dra7_dsp1_clkctrl_regs[] __initconst = {
28-
{ DRA7_DSP1_MMU0_DSP1_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_dsp_m2_ck" },
28+
{ DRA7_DSP1_MMU0_DSP1_CLKCTRL, NULL, CLKF_HW_SUP | CLKF_NO_IDLEST, "dpll_dsp_m2_ck" },
2929
{ 0 },
3030
};
3131

@@ -41,7 +41,7 @@ static const struct omap_clkctrl_bit_data dra7_mmu_ipu1_bit_data[] __initconst =
4141
};
4242

4343
static const struct omap_clkctrl_reg_data dra7_ipu1_clkctrl_regs[] __initconst = {
44-
{ DRA7_IPU1_MMU_IPU1_CLKCTRL, dra7_mmu_ipu1_bit_data, CLKF_HW_SUP, "ipu1-clkctrl:0000:24" },
44+
{ DRA7_IPU1_MMU_IPU1_CLKCTRL, dra7_mmu_ipu1_bit_data, CLKF_HW_SUP | CLKF_NO_IDLEST, "ipu1-clkctrl:0000:24" },
4545
{ 0 },
4646
};
4747

@@ -137,7 +137,7 @@ static const struct omap_clkctrl_reg_data dra7_ipu_clkctrl_regs[] __initconst =
137137
};
138138

139139
static const struct omap_clkctrl_reg_data dra7_dsp2_clkctrl_regs[] __initconst = {
140-
{ DRA7_DSP2_MMU0_DSP2_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_dsp_m2_ck" },
140+
{ DRA7_DSP2_MMU0_DSP2_CLKCTRL, NULL, CLKF_HW_SUP | CLKF_NO_IDLEST, "dpll_dsp_m2_ck" },
141141
{ 0 },
142142
};
143143

@@ -164,7 +164,7 @@ static const struct omap_clkctrl_reg_data dra7_l3main1_clkctrl_regs[] __initcons
164164
};
165165

166166
static const struct omap_clkctrl_reg_data dra7_ipu2_clkctrl_regs[] __initconst = {
167-
{ DRA7_IPU2_MMU_IPU2_CLKCTRL, NULL, CLKF_HW_SUP, "dpll_core_h22x2_ck" },
167+
{ DRA7_IPU2_MMU_IPU2_CLKCTRL, NULL, CLKF_HW_SUP | CLKF_NO_IDLEST, "dpll_core_h22x2_ck" },
168168
{ 0 },
169169
};
170170

drivers/clk/ti/clkctrl.c

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <linux/timekeeping.h>
2525
#include "clock.h"
2626

27-
#define NO_IDLEST 0x1
27+
#define NO_IDLEST 0
2828

2929
#define OMAP4_MODULEMODE_MASK 0x3
3030

@@ -34,6 +34,9 @@
3434
#define OMAP4_IDLEST_MASK (0x3 << 16)
3535
#define OMAP4_IDLEST_SHIFT 16
3636

37+
#define OMAP4_STBYST_MASK BIT(18)
38+
#define OMAP4_STBYST_SHIFT 18
39+
3740
#define CLKCTRL_IDLEST_FUNCTIONAL 0x0
3841
#define CLKCTRL_IDLEST_INTERFACE_IDLE 0x2
3942
#define CLKCTRL_IDLEST_DISABLED 0x3
@@ -158,7 +161,7 @@ static int _omap4_clkctrl_clk_enable(struct clk_hw *hw)
158161

159162
ti_clk_ll_ops->clk_writel(val, &clk->enable_reg);
160163

161-
if (clk->flags & NO_IDLEST)
164+
if (test_bit(NO_IDLEST, &clk->flags))
162165
return 0;
163166

164167
/* Wait until module is enabled */
@@ -187,7 +190,7 @@ static void _omap4_clkctrl_clk_disable(struct clk_hw *hw)
187190

188191
ti_clk_ll_ops->clk_writel(val, &clk->enable_reg);
189192

190-
if (clk->flags & NO_IDLEST)
193+
if (test_bit(NO_IDLEST, &clk->flags))
191194
goto exit;
192195

193196
/* Wait until module is disabled */
@@ -380,7 +383,7 @@ _ti_clkctrl_setup_div(struct omap_clkctrl_provider *provider,
380383

381384
if (ti_clk_parse_divider_data((int *)div_data->dividers, 0,
382385
div_data->max_div, div_flags,
383-
&div->width, &div->table)) {
386+
div)) {
384387
pr_err("%s: Data parsing for %pOF:%04x:%d failed\n", __func__,
385388
node, offset, data->bit);
386389
kfree(div);
@@ -596,7 +599,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
596599
if (reg_data->flags & CLKF_HW_SUP)
597600
hw->enable_bit = MODULEMODE_HWCTRL;
598601
if (reg_data->flags & CLKF_NO_IDLEST)
599-
hw->flags |= NO_IDLEST;
602+
set_bit(NO_IDLEST, &hw->flags);
600603

601604
if (reg_data->clkdm_name)
602605
hw->clkdm_name = reg_data->clkdm_name;
@@ -622,7 +625,7 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
622625
init.ops = &omap4_clkctrl_clk_ops;
623626
hw->hw.init = &init;
624627

625-
clk = ti_clk_register(NULL, &hw->hw, init.name);
628+
clk = ti_clk_register_omap_hw(NULL, &hw->hw, init.name);
626629
if (IS_ERR_OR_NULL(clk))
627630
goto cleanup;
628631

@@ -647,3 +650,33 @@ static void __init _ti_omap4_clkctrl_setup(struct device_node *node)
647650
}
648651
CLK_OF_DECLARE(ti_omap4_clkctrl_clock, "ti,clkctrl",
649652
_ti_omap4_clkctrl_setup);
653+
654+
/**
655+
* ti_clk_is_in_standby - Check if clkctrl clock is in standby or not
656+
* @clk: clock to check standby status for
657+
*
658+
* Finds whether the provided clock is in standby mode or not. Returns
659+
* true if the provided clock is a clkctrl type clock and it is in standby,
660+
* false otherwise.
661+
*/
662+
bool ti_clk_is_in_standby(struct clk *clk)
663+
{
664+
struct clk_hw *hw;
665+
struct clk_hw_omap *hwclk;
666+
u32 val;
667+
668+
hw = __clk_get_hw(clk);
669+
670+
if (!omap2_clk_is_hw_omap(hw))
671+
return false;
672+
673+
hwclk = to_clk_hw_omap(hw);
674+
675+
val = ti_clk_ll_ops->clk_readl(&hwclk->enable_reg);
676+
677+
if (val & OMAP4_STBYST_MASK)
678+
return true;
679+
680+
return false;
681+
}
682+
EXPORT_SYMBOL_GPL(ti_clk_is_in_standby);

drivers/clk/ti/clock.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ struct clk_omap_divider {
2020
struct clk_hw hw;
2121
struct clk_omap_reg reg;
2222
u8 shift;
23-
u8 width;
2423
u8 flags;
2524
s8 latch;
25+
u16 min;
26+
u16 max;
27+
u16 mask;
2628
const struct clk_div_table *table;
2729
u32 context;
2830
};
@@ -220,8 +222,7 @@ void ti_clk_latch(struct clk_omap_reg *reg, s8 shift);
220222
struct clk_hw *ti_clk_build_component_mux(struct ti_clk_mux *setup);
221223

222224
int ti_clk_parse_divider_data(int *div_table, int num_dividers, int max_div,
223-
u8 flags, u8 *width,
224-
const struct clk_div_table **table);
225+
u8 flags, struct clk_omap_divider *div);
225226

226227
int ti_clk_get_reg_addr(struct device_node *node, int index,
227228
struct clk_omap_reg *reg);

0 commit comments

Comments
 (0)