Skip to content

Commit 3d85412

Browse files
committed
Merge tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
Pull clk fixes from Michael Turquette: "The first set of clk fixes for 4.1 are all driver bugs, with the exception of a single locking fix in the core code. All driver fixes are for code that was merged recently. The Samsung stuff is mostly fixes around suspend/resume, the Qualcomm fixes are for invalid hardware configuration data and the Silicon Labs patches are fixes following their move away from platform_data to Device Tree" * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: si5351: Do not pass struct clk in platform_data clk: si5351: Mention clock-names in the binding documentation clk: add missing lock when call clk_core_enable in clk_set_parent clk: exynos5420: Restore GATE_BUS_TOP on suspend clk: qcom: Fix MSM8916 gfx3d_clk_src configuration clk: qcom: Fix MSM8916 venus divider value clk: exynos5433: Fix wrong PMS value of exynos5433_pll_rates clk: exynos5433: Fix wrong parent clock of sclk_apollo clock clk: exynos5433: Fix CLK_PCLK_MONOTONIC_CNT clk register assignment clk: exynos5433: Fix wrong offset of PCLK_MSCL_SECURE_SMMU_JPEG clk: Use CONFIG_ARCH_EXYNOS instead of CONFIG_ARCH_EXYNOS5433
2 parents 4cce593 + 0cd3be6 commit 3d85412

File tree

8 files changed

+66
-32
lines changed

8 files changed

+66
-32
lines changed

Documentation/devicetree/bindings/clock/silabs,si5351.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ Required properties:
1717
- #clock-cells: from common clock binding; shall be set to 1.
1818
- clocks: from common clock binding; list of parent clock
1919
handles, shall be xtal reference clock or xtal and clkin for
20-
si5351c only.
20+
si5351c only. Corresponding clock input names are "xtal" and
21+
"clkin" respectively.
2122
- #address-cells: shall be set to 1.
2223
- #size-cells: shall be set to 0.
2324

@@ -71,6 +72,7 @@ i2c-master-node {
7172

7273
/* connect xtal input to 25MHz reference */
7374
clocks = <&ref25>;
75+
clock-names = "xtal";
7476

7577
/* connect xtal input as source of pll0 and pll1 */
7678
silabs,pll-source = <0 0>, <1 0>;

drivers/clk/clk-si5351.c

Lines changed: 45 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,13 +1128,6 @@ static int si5351_dt_parse(struct i2c_client *client,
11281128
if (!pdata)
11291129
return -ENOMEM;
11301130

1131-
pdata->clk_xtal = of_clk_get(np, 0);
1132-
if (!IS_ERR(pdata->clk_xtal))
1133-
clk_put(pdata->clk_xtal);
1134-
pdata->clk_clkin = of_clk_get(np, 1);
1135-
if (!IS_ERR(pdata->clk_clkin))
1136-
clk_put(pdata->clk_clkin);
1137-
11381131
/*
11391132
* property silabs,pll-source : <num src>, [<..>]
11401133
* allow to selectively set pll source
@@ -1328,8 +1321,22 @@ static int si5351_i2c_probe(struct i2c_client *client,
13281321
i2c_set_clientdata(client, drvdata);
13291322
drvdata->client = client;
13301323
drvdata->variant = variant;
1331-
drvdata->pxtal = pdata->clk_xtal;
1332-
drvdata->pclkin = pdata->clk_clkin;
1324+
drvdata->pxtal = devm_clk_get(&client->dev, "xtal");
1325+
drvdata->pclkin = devm_clk_get(&client->dev, "clkin");
1326+
1327+
if (PTR_ERR(drvdata->pxtal) == -EPROBE_DEFER ||
1328+
PTR_ERR(drvdata->pclkin) == -EPROBE_DEFER)
1329+
return -EPROBE_DEFER;
1330+
1331+
/*
1332+
* Check for valid parent clock: VARIANT_A and VARIANT_B need XTAL,
1333+
* VARIANT_C can have CLKIN instead.
1334+
*/
1335+
if (IS_ERR(drvdata->pxtal) &&
1336+
(drvdata->variant != SI5351_VARIANT_C || IS_ERR(drvdata->pclkin))) {
1337+
dev_err(&client->dev, "missing parent clock\n");
1338+
return -EINVAL;
1339+
}
13331340

13341341
drvdata->regmap = devm_regmap_init_i2c(client, &si5351_regmap_config);
13351342
if (IS_ERR(drvdata->regmap)) {
@@ -1393,6 +1400,11 @@ static int si5351_i2c_probe(struct i2c_client *client,
13931400
}
13941401
}
13951402

1403+
if (!IS_ERR(drvdata->pxtal))
1404+
clk_prepare_enable(drvdata->pxtal);
1405+
if (!IS_ERR(drvdata->pclkin))
1406+
clk_prepare_enable(drvdata->pclkin);
1407+
13961408
/* register xtal input clock gate */
13971409
memset(&init, 0, sizeof(init));
13981410
init.name = si5351_input_names[0];
@@ -1407,7 +1419,8 @@ static int si5351_i2c_probe(struct i2c_client *client,
14071419
clk = devm_clk_register(&client->dev, &drvdata->xtal);
14081420
if (IS_ERR(clk)) {
14091421
dev_err(&client->dev, "unable to register %s\n", init.name);
1410-
return PTR_ERR(clk);
1422+
ret = PTR_ERR(clk);
1423+
goto err_clk;
14111424
}
14121425

14131426
/* register clkin input clock gate */
@@ -1425,7 +1438,8 @@ static int si5351_i2c_probe(struct i2c_client *client,
14251438
if (IS_ERR(clk)) {
14261439
dev_err(&client->dev, "unable to register %s\n",
14271440
init.name);
1428-
return PTR_ERR(clk);
1441+
ret = PTR_ERR(clk);
1442+
goto err_clk;
14291443
}
14301444
}
14311445

@@ -1447,7 +1461,8 @@ static int si5351_i2c_probe(struct i2c_client *client,
14471461
clk = devm_clk_register(&client->dev, &drvdata->pll[0].hw);
14481462
if (IS_ERR(clk)) {
14491463
dev_err(&client->dev, "unable to register %s\n", init.name);
1450-
return -EINVAL;
1464+
ret = PTR_ERR(clk);
1465+
goto err_clk;
14511466
}
14521467

14531468
/* register PLLB or VXCO (Si5351B) */
@@ -1471,7 +1486,8 @@ static int si5351_i2c_probe(struct i2c_client *client,
14711486
clk = devm_clk_register(&client->dev, &drvdata->pll[1].hw);
14721487
if (IS_ERR(clk)) {
14731488
dev_err(&client->dev, "unable to register %s\n", init.name);
1474-
return -EINVAL;
1489+
ret = PTR_ERR(clk);
1490+
goto err_clk;
14751491
}
14761492

14771493
/* register clk multisync and clk out divider */
@@ -1492,8 +1508,10 @@ static int si5351_i2c_probe(struct i2c_client *client,
14921508
num_clocks * sizeof(*drvdata->onecell.clks), GFP_KERNEL);
14931509

14941510
if (WARN_ON(!drvdata->msynth || !drvdata->clkout ||
1495-
!drvdata->onecell.clks))
1496-
return -ENOMEM;
1511+
!drvdata->onecell.clks)) {
1512+
ret = -ENOMEM;
1513+
goto err_clk;
1514+
}
14971515

14981516
for (n = 0; n < num_clocks; n++) {
14991517
drvdata->msynth[n].num = n;
@@ -1511,7 +1529,8 @@ static int si5351_i2c_probe(struct i2c_client *client,
15111529
if (IS_ERR(clk)) {
15121530
dev_err(&client->dev, "unable to register %s\n",
15131531
init.name);
1514-
return -EINVAL;
1532+
ret = PTR_ERR(clk);
1533+
goto err_clk;
15151534
}
15161535
}
15171536

@@ -1538,7 +1557,8 @@ static int si5351_i2c_probe(struct i2c_client *client,
15381557
if (IS_ERR(clk)) {
15391558
dev_err(&client->dev, "unable to register %s\n",
15401559
init.name);
1541-
return -EINVAL;
1560+
ret = PTR_ERR(clk);
1561+
goto err_clk;
15421562
}
15431563
drvdata->onecell.clks[n] = clk;
15441564

@@ -1557,10 +1577,17 @@ static int si5351_i2c_probe(struct i2c_client *client,
15571577
&drvdata->onecell);
15581578
if (ret) {
15591579
dev_err(&client->dev, "unable to add clk provider\n");
1560-
return ret;
1580+
goto err_clk;
15611581
}
15621582

15631583
return 0;
1584+
1585+
err_clk:
1586+
if (!IS_ERR(drvdata->pxtal))
1587+
clk_disable_unprepare(drvdata->pxtal);
1588+
if (!IS_ERR(drvdata->pclkin))
1589+
clk_disable_unprepare(drvdata->pclkin);
1590+
return ret;
15641591
}
15651592

15661593
static const struct i2c_device_id si5351_i2c_ids[] = {

drivers/clk/clk.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,8 +1475,10 @@ static struct clk_core *__clk_set_parent_before(struct clk_core *clk,
14751475
*/
14761476
if (clk->prepare_count) {
14771477
clk_core_prepare(parent);
1478+
flags = clk_enable_lock();
14781479
clk_core_enable(parent);
14791480
clk_core_enable(clk);
1481+
clk_enable_unlock(flags);
14801482
}
14811483

14821484
/* update the clk tree topology */
@@ -1491,13 +1493,17 @@ static void __clk_set_parent_after(struct clk_core *core,
14911493
struct clk_core *parent,
14921494
struct clk_core *old_parent)
14931495
{
1496+
unsigned long flags;
1497+
14941498
/*
14951499
* Finish the migration of prepare state and undo the changes done
14961500
* for preventing a race with clk_enable().
14971501
*/
14981502
if (core->prepare_count) {
1503+
flags = clk_enable_lock();
14991504
clk_core_disable(core);
15001505
clk_core_disable(old_parent);
1506+
clk_enable_unlock(flags);
15011507
clk_core_unprepare(old_parent);
15021508
}
15031509
}
@@ -1525,8 +1531,10 @@ static int __clk_set_parent(struct clk_core *clk, struct clk_core *parent,
15251531
clk_enable_unlock(flags);
15261532

15271533
if (clk->prepare_count) {
1534+
flags = clk_enable_lock();
15281535
clk_core_disable(clk);
15291536
clk_core_disable(parent);
1537+
clk_enable_unlock(flags);
15301538
clk_core_unprepare(parent);
15311539
}
15321540
return ret;

drivers/clk/qcom/gcc-msm8916.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ static const char *gcc_xo_gpll0_bimc[] = {
7171
static const struct parent_map gcc_xo_gpll0a_gpll1_gpll2a_map[] = {
7272
{ P_XO, 0 },
7373
{ P_GPLL0_AUX, 3 },
74-
{ P_GPLL2_AUX, 2 },
7574
{ P_GPLL1, 1 },
75+
{ P_GPLL2_AUX, 2 },
7676
};
7777

7878
static const char *gcc_xo_gpll0a_gpll1_gpll2a[] = {
@@ -1115,7 +1115,7 @@ static struct clk_rcg2 usb_hs_system_clk_src = {
11151115
static const struct freq_tbl ftbl_gcc_venus0_vcodec0_clk[] = {
11161116
F(100000000, P_GPLL0, 8, 0, 0),
11171117
F(160000000, P_GPLL0, 5, 0, 0),
1118-
F(228570000, P_GPLL0, 5, 0, 0),
1118+
F(228570000, P_GPLL0, 3.5, 0, 0),
11191119
{ }
11201120
};
11211121

drivers/clk/samsung/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ obj-$(CONFIG_SOC_EXYNOS5250) += clk-exynos5250.o
1010
obj-$(CONFIG_SOC_EXYNOS5260) += clk-exynos5260.o
1111
obj-$(CONFIG_SOC_EXYNOS5410) += clk-exynos5410.o
1212
obj-$(CONFIG_SOC_EXYNOS5420) += clk-exynos5420.o
13-
obj-$(CONFIG_ARCH_EXYNOS5433) += clk-exynos5433.o
13+
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos5433.o
1414
obj-$(CONFIG_SOC_EXYNOS5440) += clk-exynos5440.o
1515
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-audss.o
1616
obj-$(CONFIG_ARCH_EXYNOS) += clk-exynos-clkout.o

drivers/clk/samsung/clk-exynos5420.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ static const struct samsung_clk_reg_dump exynos5420_set_clksrc[] = {
271271
{ .offset = SRC_MASK_PERIC0, .value = 0x11111110, },
272272
{ .offset = SRC_MASK_PERIC1, .value = 0x11111100, },
273273
{ .offset = SRC_MASK_ISP, .value = 0x11111000, },
274+
{ .offset = GATE_BUS_TOP, .value = 0xffffffff, },
274275
{ .offset = GATE_BUS_DISP1, .value = 0xffffffff, },
275276
{ .offset = GATE_IP_PERIC, .value = 0xffffffff, },
276277
};

drivers/clk/samsung/clk-exynos5433.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ static struct samsung_pll_rate_table exynos5443_pll_rates[] = {
748748
PLL_35XX_RATE(825000000U, 275, 4, 1),
749749
PLL_35XX_RATE(800000000U, 400, 6, 1),
750750
PLL_35XX_RATE(733000000U, 733, 12, 1),
751-
PLL_35XX_RATE(700000000U, 360, 6, 1),
751+
PLL_35XX_RATE(700000000U, 175, 3, 1),
752752
PLL_35XX_RATE(667000000U, 222, 4, 1),
753753
PLL_35XX_RATE(633000000U, 211, 4, 1),
754754
PLL_35XX_RATE(600000000U, 500, 5, 2),
@@ -760,14 +760,14 @@ static struct samsung_pll_rate_table exynos5443_pll_rates[] = {
760760
PLL_35XX_RATE(444000000U, 370, 5, 2),
761761
PLL_35XX_RATE(420000000U, 350, 5, 2),
762762
PLL_35XX_RATE(400000000U, 400, 6, 2),
763-
PLL_35XX_RATE(350000000U, 360, 6, 2),
763+
PLL_35XX_RATE(350000000U, 350, 6, 2),
764764
PLL_35XX_RATE(333000000U, 222, 4, 2),
765765
PLL_35XX_RATE(300000000U, 500, 5, 3),
766766
PLL_35XX_RATE(266000000U, 532, 6, 3),
767767
PLL_35XX_RATE(200000000U, 400, 6, 3),
768768
PLL_35XX_RATE(166000000U, 332, 6, 3),
769769
PLL_35XX_RATE(160000000U, 320, 6, 3),
770-
PLL_35XX_RATE(133000000U, 552, 6, 4),
770+
PLL_35XX_RATE(133000000U, 532, 6, 4),
771771
PLL_35XX_RATE(100000000U, 400, 6, 4),
772772
{ /* sentinel */ }
773773
};
@@ -1490,7 +1490,7 @@ static struct samsung_gate_clock mif_gate_clks[] __initdata = {
14901490

14911491
/* ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT */
14921492
GATE(CLK_PCLK_MONOTONIC_CNT, "pclk_monotonic_cnt", "div_aclk_mif_133",
1493-
ENABLE_PCLK_MIF_SECURE_RTC, 0, 0, 0),
1493+
ENABLE_PCLK_MIF_SECURE_MONOTONIC_CNT, 0, 0, 0),
14941494

14951495
/* ENABLE_PCLK_MIF_SECURE_RTC */
14961496
GATE(CLK_PCLK_RTC, "pclk_rtc", "div_aclk_mif_133",
@@ -3665,7 +3665,7 @@ static struct samsung_gate_clock apollo_gate_clks[] __initdata = {
36653665
ENABLE_SCLK_APOLLO, 3, CLK_IGNORE_UNUSED, 0),
36663666
GATE(CLK_SCLK_HPM_APOLLO, "sclk_hpm_apollo", "div_sclk_hpm_apollo",
36673667
ENABLE_SCLK_APOLLO, 1, CLK_IGNORE_UNUSED, 0),
3668-
GATE(CLK_SCLK_APOLLO, "sclk_apollo", "div_apollo_pll",
3668+
GATE(CLK_SCLK_APOLLO, "sclk_apollo", "div_apollo2",
36693669
ENABLE_SCLK_APOLLO, 0, CLK_IGNORE_UNUSED, 0),
36703670
};
36713671

@@ -3927,7 +3927,7 @@ CLK_OF_DECLARE(exynos5433_cmu_atlas, "samsung,exynos5433-cmu-atlas",
39273927
#define ENABLE_PCLK_MSCL 0x0900
39283928
#define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER0 0x0904
39293929
#define ENABLE_PCLK_MSCL_SECURE_SMMU_M2MSCALER1 0x0908
3930-
#define ENABLE_PCLK_MSCL_SECURE_SMMU_JPEG 0x000c
3930+
#define ENABLE_PCLK_MSCL_SECURE_SMMU_JPEG 0x090c
39313931
#define ENABLE_SCLK_MSCL 0x0a00
39323932
#define ENABLE_IP_MSCL0 0x0b00
39333933
#define ENABLE_IP_MSCL1 0x0b04

include/linux/platform_data/si5351.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#ifndef __LINUX_PLATFORM_DATA_SI5351_H__
66
#define __LINUX_PLATFORM_DATA_SI5351_H__
77

8-
struct clk;
9-
108
/**
119
* enum si5351_pll_src - Si5351 pll clock source
1210
* @SI5351_PLL_SRC_DEFAULT: default, do not change eeprom config
@@ -107,8 +105,6 @@ struct si5351_clkout_config {
107105
* @clkout: array of clkout configuration
108106
*/
109107
struct si5351_platform_data {
110-
struct clk *clk_xtal;
111-
struct clk *clk_clkin;
112108
enum si5351_pll_src pll_src[2];
113109
struct si5351_clkout_config clkout[8];
114110
};

0 commit comments

Comments
 (0)