Skip to content

Commit

Permalink
Merge branches 'clk-samsung', 'clk-imx', 'clk-rockchip', 'clk-clkdev'…
Browse files Browse the repository at this point in the history
… and 'clk-rate-exclusive' into clk-next

 - Increase dev_id len for clkdev lookups

* clk-samsung: (25 commits)
  clk: samsung: Add CPU clock support for Exynos850
  clk: samsung: Pass mask to wait_until_mux_stable()
  clk: samsung: Keep register offsets in chip specific structure
  clk: samsung: Keep CPU clock chip specific data in a dedicated struct
  clk: samsung: Pass register layout type explicitly to CLK_CPU()
  clk: samsung: Pass actual CPU clock registers base to CPU_CLK()
  clk: samsung: Group CPU clock functions by chip
  clk: samsung: Use single CPU clock notifier callback for all chips
  clk: samsung: Reduce params count in exynos_register_cpu_clock()
  clk: samsung: Pull struct exynos_cpuclk into clk-cpu.c
  clk: samsung: Improve clk-cpu.c style
  dt-bindings: clock: exynos850: Add CMU_CPUCLK0 and CMU_CPUCL1
  clk: samsung: gs101: add support for cmu_peric1
  clk: samsung: gs101: drop extra empty line
  dt-bindings: clock: google,gs101-clock: add PERIC1 clock management unit
  clk: samsung: exynos850: Propagate SPI IPCLK rate change
  clk: samsung: gs101: gpio_peric0_pclk needs to be kept on
  clk: samsung: exynos850: Add PDMA clocks
  dt-bindings: clock: tesla,fsd: Fix spelling mistake
  clk: samsung: gs101: add support for cmu_peric0
  ...

* clk-imx:
  clk: imx: imx8mp: Fix SAI_MCLK_SEL definition
  clk: imx: scu: Use common error handling code in imx_clk_scu_alloc_dev()
  clk: imx: composite-8m: Delete two unnecessary initialisations in __imx8m_clk_hw_composite()
  clk: imx: composite-8m: Less function calls in __imx8m_clk_hw_composite() after error detection

* clk-rockchip:
  clk: rockchip: rk3399: Allow to set rate of clk_i2s0_frac's parent
  clk: rockchip: rk3588: use linked clock ID for GATE_LINK
  clk: rockchip: rk3588: fix indent
  clk: rockchip: rk3588: fix pclk_vo0grf and pclk_vo1grf
  dt-bindings: clock: rk3588: add missing PCLK_VO1GRF
  dt-bindings: clock: rk3588: drop CLK_NR_CLKS
  clk: rockchip: rk3588: fix CLK_NR_CLKS usage
  clk: rockchip: rk3568: Add PLL rate for 128MHz

* clk-clkdev:
  clkdev: Update clkdev id usage to allow for longer names

* clk-rate-exclusive:
  clk: Add a devm variant of clk_rate_exclusive_get()
  • Loading branch information
bebarino committed Mar 13, 2024
6 parents 68e4ebd + d289ca7 + 79b92ba + 3e76237 + 99f4570 + b0cde62 commit 3066c52
Show file tree
Hide file tree
Showing 27 changed files with 1,771 additions and 297 deletions.
32 changes: 28 additions & 4 deletions Documentation/devicetree/bindings/clock/google,gs101-clock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@ properties:
- google,gs101-cmu-top
- google,gs101-cmu-apm
- google,gs101-cmu-misc
- google,gs101-cmu-peric0
- google,gs101-cmu-peric1

clocks:
minItems: 1
maxItems: 2
maxItems: 3

clock-names:
minItems: 1
maxItems: 2
maxItems: 3

"#clock-cells":
const: 1
Expand Down Expand Up @@ -85,8 +87,30 @@ allOf:

clock-names:
items:
- const: dout_cmu_misc_bus
- const: dout_cmu_misc_sss
- const: bus
- const: sss

- if:
properties:
compatible:
contains:
enum:
- google,gs101-cmu-peric0
- google,gs101-cmu-peric1

then:
properties:
clocks:
items:
- description: External reference clock (24.576 MHz)
- description: Connectivity Peripheral 0/1 bus clock (from CMU_TOP)
- description: Connectivity Peripheral 0/1 IP clock (from CMU_TOP)

clock-names:
items:
- const: oscclk
- const: bus
- const: ip

additionalProperties: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ properties:
- samsung,exynos850-cmu-aud
- samsung,exynos850-cmu-cmgp
- samsung,exynos850-cmu-core
- samsung,exynos850-cmu-cpucl0
- samsung,exynos850-cmu-cpucl1
- samsung,exynos850-cmu-dpu
- samsung,exynos850-cmu-g3d
- samsung,exynos850-cmu-hsi
Expand Down Expand Up @@ -152,6 +154,46 @@ allOf:
- const: dout_core_mmc_embd
- const: dout_core_sss

- if:
properties:
compatible:
contains:
const: samsung,exynos850-cmu-cpucl0

then:
properties:
clocks:
items:
- description: External reference clock (26 MHz)
- description: CPUCL0 switch clock (from CMU_TOP)
- description: CPUCL0 debug clock (from CMU_TOP)

clock-names:
items:
- const: oscclk
- const: dout_cpucl0_switch
- const: dout_cpucl0_dbg

- if:
properties:
compatible:
contains:
const: samsung,exynos850-cmu-cpucl1

then:
properties:
clocks:
items:
- description: External reference clock (26 MHz)
- description: CPUCL1 switch clock (from CMU_TOP)
- description: CPUCL1 debug clock (from CMU_TOP)

clock-names:
items:
- const: oscclk
- const: dout_cpucl1_switch
- const: dout_cpucl1_dbg

- if:
properties:
compatible:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ maintainers:

description: |
FSD clock controller consist of several clock management unit
(CMU), which generates clocks for various inteernal SoC blocks.
(CMU), which generates clocks for various internal SoC blocks.
The root clock comes from external OSC clock (24 MHz).
All available clocks are defined as preprocessor macros in
Expand Down
19 changes: 19 additions & 0 deletions drivers/clk/clk.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,25 @@ int clk_rate_exclusive_get(struct clk *clk)
}
EXPORT_SYMBOL_GPL(clk_rate_exclusive_get);

static void devm_clk_rate_exclusive_put(void *data)
{
struct clk *clk = data;

clk_rate_exclusive_put(clk);
}

int devm_clk_rate_exclusive_get(struct device *dev, struct clk *clk)
{
int ret;

ret = clk_rate_exclusive_get(clk);
if (ret)
return ret;

return devm_add_action_or_reset(dev, devm_clk_rate_exclusive_put, clk);
}
EXPORT_SYMBOL_GPL(devm_clk_rate_exclusive_get);

static void clk_core_unprepare(struct clk_core *core)
{
lockdep_assert_held(&prepare_lock);
Expand Down
2 changes: 1 addition & 1 deletion drivers/clk/clkdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void clkdev_add_table(struct clk_lookup *cl, size_t num)
mutex_unlock(&clocks_mutex);
}

#define MAX_DEV_ID 20
#define MAX_DEV_ID 24
#define MAX_CON_ID 16

struct clk_lookup_alloc {
Expand Down
16 changes: 9 additions & 7 deletions drivers/clk/imx/clk-composite-8m.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,15 +212,15 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
{
struct clk_hw *hw = ERR_PTR(-ENOMEM), *mux_hw;
struct clk_hw *div_hw, *gate_hw = NULL;
struct clk_divider *div = NULL;
struct clk_divider *div;
struct clk_gate *gate = NULL;
struct clk_mux *mux = NULL;
struct clk_mux *mux;
const struct clk_ops *divider_ops;
const struct clk_ops *mux_ops;

mux = kzalloc(sizeof(*mux), GFP_KERNEL);
if (!mux)
goto fail;
return ERR_CAST(hw);

mux_hw = &mux->hw;
mux->reg = reg;
Expand All @@ -230,7 +230,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,

div = kzalloc(sizeof(*div), GFP_KERNEL);
if (!div)
goto fail;
goto free_mux;

div_hw = &div->hw;
div->reg = reg;
Expand Down Expand Up @@ -260,7 +260,7 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
if (!mcore_booted) {
gate = kzalloc(sizeof(*gate), GFP_KERNEL);
if (!gate)
goto fail;
goto free_div;

gate_hw = &gate->hw;
gate->reg = reg;
Expand All @@ -272,13 +272,15 @@ struct clk_hw *__imx8m_clk_hw_composite(const char *name,
mux_hw, mux_ops, div_hw,
divider_ops, gate_hw, &clk_gate_ops, flags);
if (IS_ERR(hw))
goto fail;
goto free_gate;

return hw;

fail:
free_gate:
kfree(gate);
free_div:
kfree(div);
free_mux:
kfree(mux);
return ERR_CAST(hw);
}
Expand Down
11 changes: 8 additions & 3 deletions drivers/clk/imx/clk-imx8mp-audiomix.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@

#define CLKEN0 0x000
#define CLKEN1 0x004
#define SAI_MCLK_SEL(n) (0x300 + 4 * (n)) /* n in 0..5 */
#define SAI1_MCLK_SEL 0x300
#define SAI2_MCLK_SEL 0x304
#define SAI3_MCLK_SEL 0x308
#define SAI5_MCLK_SEL 0x30C
#define SAI6_MCLK_SEL 0x310
#define SAI7_MCLK_SEL 0x314
#define PDM_SEL 0x318
#define SAI_PLL_GNRL_CTL 0x400

Expand Down Expand Up @@ -95,13 +100,13 @@ static const struct clk_parent_data clk_imx8mp_audiomix_pll_bypass_sels[] = {
IMX8MP_CLK_AUDIOMIX_SAI##n##_MCLK1_SEL, {}, \
clk_imx8mp_audiomix_sai##n##_mclk1_parents, \
ARRAY_SIZE(clk_imx8mp_audiomix_sai##n##_mclk1_parents), \
SAI_MCLK_SEL(n), 1, 0 \
SAI##n##_MCLK_SEL, 1, 0 \
}, { \
"sai"__stringify(n)"_mclk2_sel", \
IMX8MP_CLK_AUDIOMIX_SAI##n##_MCLK2_SEL, {}, \
clk_imx8mp_audiomix_sai_mclk2_parents, \
ARRAY_SIZE(clk_imx8mp_audiomix_sai_mclk2_parents), \
SAI_MCLK_SEL(n), 4, 1 \
SAI##n##_MCLK_SEL, 4, 1 \
}, { \
"sai"__stringify(n)"_ipg_cg", \
IMX8MP_CLK_AUDIOMIX_SAI##n##_IPG, \
Expand Down
22 changes: 10 additions & 12 deletions drivers/clk/imx/clk-scu.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,31 +712,29 @@ struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
}

ret = platform_device_add_data(pdev, &clk, sizeof(clk));
if (ret) {
platform_device_put(pdev);
return ERR_PTR(ret);
}
if (ret)
goto put_device;

ret = driver_set_override(&pdev->dev, &pdev->driver_override,
"imx-scu-clk", strlen("imx-scu-clk"));
if (ret) {
platform_device_put(pdev);
return ERR_PTR(ret);
}
if (ret)
goto put_device;

ret = imx_clk_scu_attach_pd(&pdev->dev, rsrc_id);
if (ret)
pr_warn("%s: failed to attached the power domain %d\n",
name, ret);

ret = platform_device_add(pdev);
if (ret) {
platform_device_put(pdev);
return ERR_PTR(ret);
}
if (ret)
goto put_device;

/* For API backwards compatiblilty, simply return NULL for success */
return NULL;

put_device:
platform_device_put(pdev);
return ERR_PTR(ret);
}

void imx_clk_scu_unregister(void)
Expand Down
6 changes: 3 additions & 3 deletions drivers/clk/rockchip/clk-rk3399.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
COMPOSITE(0, "clk_i2s0_div", mux_pll_src_cpll_gpll_p, 0,
RK3399_CLKSEL_CON(28), 7, 1, MFLAGS, 0, 7, DFLAGS,
RK3399_CLKGATE_CON(8), 3, GFLAGS),
COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", 0,
COMPOSITE_FRACMUX(0, "clk_i2s0_frac", "clk_i2s0_div", CLK_SET_RATE_PARENT,
RK3399_CLKSEL_CON(96), 0,
RK3399_CLKGATE_CON(8), 4, GFLAGS,
&rk3399_i2s0_fracmux),
Expand All @@ -607,7 +607,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
COMPOSITE(0, "clk_i2s1_div", mux_pll_src_cpll_gpll_p, 0,
RK3399_CLKSEL_CON(29), 7, 1, MFLAGS, 0, 7, DFLAGS,
RK3399_CLKGATE_CON(8), 6, GFLAGS),
COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", 0,
COMPOSITE_FRACMUX(0, "clk_i2s1_frac", "clk_i2s1_div", CLK_SET_RATE_PARENT,
RK3399_CLKSEL_CON(97), 0,
RK3399_CLKGATE_CON(8), 7, GFLAGS,
&rk3399_i2s1_fracmux),
Expand All @@ -617,7 +617,7 @@ static struct rockchip_clk_branch rk3399_clk_branches[] __initdata = {
COMPOSITE(0, "clk_i2s2_div", mux_pll_src_cpll_gpll_p, 0,
RK3399_CLKSEL_CON(30), 7, 1, MFLAGS, 0, 7, DFLAGS,
RK3399_CLKGATE_CON(8), 9, GFLAGS),
COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", 0,
COMPOSITE_FRACMUX(0, "clk_i2s2_frac", "clk_i2s2_div", CLK_SET_RATE_PARENT,
RK3399_CLKSEL_CON(98), 0,
RK3399_CLKGATE_CON(8), 10, GFLAGS,
&rk3399_i2s2_fracmux),
Expand Down
1 change: 1 addition & 0 deletions drivers/clk/rockchip/clk-rk3568.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ static struct rockchip_pll_rate_table rk3568_pll_rates[] = {
RK3036_PLL_RATE(200000000, 1, 100, 3, 4, 1, 0),
RK3036_PLL_RATE(148500000, 1, 99, 4, 4, 1, 0),
RK3036_PLL_RATE(135000000, 2, 45, 4, 1, 1, 0),
RK3036_PLL_RATE(128000000, 1, 16, 3, 1, 1, 0),
RK3036_PLL_RATE(126400000, 1, 79, 5, 3, 1, 0),
RK3036_PLL_RATE(119000000, 3, 119, 4, 2, 1, 0),
RK3036_PLL_RATE(115200000, 1, 24, 5, 1, 1, 0),
Expand Down
Loading

0 comments on commit 3066c52

Please sign in to comment.