Skip to content

Commit db385e0

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 Stephen Boyd: "Fixes in clk drivers and some clk rate range fixes in the core as well: - Make sure the struct clk_rate_request is more sane - Remove a WARN_ON that was triggering for clks with no parents that can change frequency - Fix bad i2c bus transactions on Renesas rs9 - Actually return an error in clk_mt8195_topck_probe() on an error path - Keep the GPU memories powered while the clk isn't enabled on Qualcomm's sc7280 SoC - Fix the parent clk for HSCIF modules on Renesas' R-Car V4H SoC" * tag 'clk-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: clk: qcom: Update the force mem core bit for GPU clocks clk: Initialize max_rate in struct clk_rate_request clk: Initialize the clk_rate_request even if clk_core is NULL clk: Remove WARN_ON NULL parent in clk_core_init_rate_req() clk: renesas: r8a779g0: Fix HSCIF parent clocks clk: renesas: r8a779g0: Add SASYNCPER clocks clk: mediatek: clk-mt8195-topckgen: Fix error return code in clk_mt8195_topck_probe() clk: sifive: select by default if SOC_SIFIVE clk: rs9: Fix I2C accessors
2 parents ee6050c + ffa20aa commit db385e0

File tree

7 files changed

+84
-10
lines changed

7 files changed

+84
-10
lines changed

drivers/clk/clk-renesas-pcie.c

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,66 @@ static const struct regmap_access_table rs9_writeable_table = {
9090
.n_yes_ranges = ARRAY_SIZE(rs9_writeable_ranges),
9191
};
9292

93+
static int rs9_regmap_i2c_write(void *context,
94+
unsigned int reg, unsigned int val)
95+
{
96+
struct i2c_client *i2c = context;
97+
const u8 data[3] = { reg, 1, val };
98+
const int count = ARRAY_SIZE(data);
99+
int ret;
100+
101+
ret = i2c_master_send(i2c, data, count);
102+
if (ret == count)
103+
return 0;
104+
else if (ret < 0)
105+
return ret;
106+
else
107+
return -EIO;
108+
}
109+
110+
static int rs9_regmap_i2c_read(void *context,
111+
unsigned int reg, unsigned int *val)
112+
{
113+
struct i2c_client *i2c = context;
114+
struct i2c_msg xfer[2];
115+
u8 txdata = reg;
116+
u8 rxdata[2];
117+
int ret;
118+
119+
xfer[0].addr = i2c->addr;
120+
xfer[0].flags = 0;
121+
xfer[0].len = 1;
122+
xfer[0].buf = (void *)&txdata;
123+
124+
xfer[1].addr = i2c->addr;
125+
xfer[1].flags = I2C_M_RD;
126+
xfer[1].len = 2;
127+
xfer[1].buf = (void *)rxdata;
128+
129+
ret = i2c_transfer(i2c->adapter, xfer, 2);
130+
if (ret < 0)
131+
return ret;
132+
if (ret != 2)
133+
return -EIO;
134+
135+
/*
136+
* Byte 0 is transfer length, which is always 1 due
137+
* to BCP register programming to 1 in rs9_probe(),
138+
* ignore it and use data from Byte 1.
139+
*/
140+
*val = rxdata[1];
141+
return 0;
142+
}
143+
93144
static const struct regmap_config rs9_regmap_config = {
94145
.reg_bits = 8,
95146
.val_bits = 8,
96-
.cache_type = REGCACHE_FLAT,
97-
.max_register = 0x8,
147+
.cache_type = REGCACHE_NONE,
148+
.max_register = RS9_REG_BCP,
98149
.rd_table = &rs9_readable_table,
99150
.wr_table = &rs9_writeable_table,
151+
.reg_write = rs9_regmap_i2c_write,
152+
.reg_read = rs9_regmap_i2c_read,
100153
};
101154

102155
static int rs9_get_output_config(struct rs9_driver_data *rs9, int idx)
@@ -242,11 +295,17 @@ static int rs9_probe(struct i2c_client *client)
242295
return ret;
243296
}
244297

245-
rs9->regmap = devm_regmap_init_i2c(client, &rs9_regmap_config);
298+
rs9->regmap = devm_regmap_init(&client->dev, NULL,
299+
client, &rs9_regmap_config);
246300
if (IS_ERR(rs9->regmap))
247301
return dev_err_probe(&client->dev, PTR_ERR(rs9->regmap),
248302
"Failed to allocate register map\n");
249303

304+
/* Always read back 1 Byte via I2C */
305+
ret = regmap_write(rs9->regmap, RS9_REG_BCP, 1);
306+
if (ret < 0)
307+
return ret;
308+
250309
/* Register clock */
251310
for (i = 0; i < rs9->chip_info->num_clks; i++) {
252311
snprintf(name, 5, "DIF%d", i);

drivers/clk/clk.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,10 +1459,14 @@ static void clk_core_init_rate_req(struct clk_core * const core,
14591459
{
14601460
struct clk_core *parent;
14611461

1462-
if (WARN_ON(!core || !req))
1462+
if (WARN_ON(!req))
14631463
return;
14641464

14651465
memset(req, 0, sizeof(*req));
1466+
req->max_rate = ULONG_MAX;
1467+
1468+
if (!core)
1469+
return;
14661470

14671471
req->rate = rate;
14681472
clk_core_get_boundaries(core, &req->min_rate, &req->max_rate);

drivers/clk/mediatek/clk-mt8195-topckgen.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1270,8 +1270,10 @@ static int clk_mt8195_topck_probe(struct platform_device *pdev)
12701270
hw = devm_clk_hw_register_mux(&pdev->dev, "mfg_ck_fast_ref", mfg_fast_parents,
12711271
ARRAY_SIZE(mfg_fast_parents), CLK_SET_RATE_PARENT,
12721272
(base + 0x250), 8, 1, 0, &mt8195_clk_lock);
1273-
if (IS_ERR(hw))
1273+
if (IS_ERR(hw)) {
1274+
r = PTR_ERR(hw);
12741275
goto unregister_muxes;
1276+
}
12751277
top_clk_data->hws[CLK_TOP_MFG_CK_FAST_REF] = hw;
12761278

12771279
r = clk_mt8195_reg_mfg_mux_notifier(&pdev->dev,

drivers/clk/qcom/gcc-sc7280.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3467,6 +3467,7 @@ static int gcc_sc7280_probe(struct platform_device *pdev)
34673467
regmap_update_bits(regmap, 0x28004, BIT(0), BIT(0));
34683468
regmap_update_bits(regmap, 0x28014, BIT(0), BIT(0));
34693469
regmap_update_bits(regmap, 0x71004, BIT(0), BIT(0));
3470+
regmap_update_bits(regmap, 0x7100C, BIT(13), BIT(13));
34703471

34713472
ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks,
34723473
ARRAY_SIZE(gcc_dfs_clocks));

drivers/clk/qcom/gpucc-sc7280.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ static int gpu_cc_sc7280_probe(struct platform_device *pdev)
463463
*/
464464
regmap_update_bits(regmap, 0x1170, BIT(0), BIT(0));
465465
regmap_update_bits(regmap, 0x1098, BIT(0), BIT(0));
466+
regmap_update_bits(regmap, 0x1098, BIT(13), BIT(13));
466467

467468
return qcom_cc_really_probe(pdev, &gpu_cc_sc7280_desc, regmap);
468469
}

drivers/clk/renesas/r8a779g0-cpg-mssr.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ enum clk_ids {
4747
CLK_S0_VIO,
4848
CLK_S0_VC,
4949
CLK_S0_HSC,
50+
CLK_SASYNCPER,
5051
CLK_SV_VIP,
5152
CLK_SV_IR,
5253
CLK_SDSRC,
@@ -84,6 +85,7 @@ static const struct cpg_core_clk r8a779g0_core_clks[] __initconst = {
8485
DEF_FIXED(".s0_vio", CLK_S0_VIO, CLK_PLL1_DIV2, 2, 1),
8586
DEF_FIXED(".s0_vc", CLK_S0_VC, CLK_PLL1_DIV2, 2, 1),
8687
DEF_FIXED(".s0_hsc", CLK_S0_HSC, CLK_PLL1_DIV2, 2, 1),
88+
DEF_FIXED(".sasyncper", CLK_SASYNCPER, CLK_PLL5_DIV4, 3, 1),
8789
DEF_FIXED(".sv_vip", CLK_SV_VIP, CLK_PLL1, 5, 1),
8890
DEF_FIXED(".sv_ir", CLK_SV_IR, CLK_PLL1, 5, 1),
8991
DEF_BASE(".sdsrc", CLK_SDSRC, CLK_TYPE_GEN4_SDSRC, CLK_PLL5),
@@ -128,6 +130,9 @@ static const struct cpg_core_clk r8a779g0_core_clks[] __initconst = {
128130
DEF_FIXED("s0d4_hsc", R8A779G0_CLK_S0D4_HSC, CLK_S0_HSC, 4, 1),
129131
DEF_FIXED("cl16m_hsc", R8A779G0_CLK_CL16M_HSC, CLK_S0_HSC, 48, 1),
130132
DEF_FIXED("s0d2_cc", R8A779G0_CLK_S0D2_CC, CLK_S0, 2, 1),
133+
DEF_FIXED("sasyncperd1",R8A779G0_CLK_SASYNCPERD1, CLK_SASYNCPER,1, 1),
134+
DEF_FIXED("sasyncperd2",R8A779G0_CLK_SASYNCPERD2, CLK_SASYNCPER,2, 1),
135+
DEF_FIXED("sasyncperd4",R8A779G0_CLK_SASYNCPERD4, CLK_SASYNCPER,4, 1),
131136
DEF_FIXED("svd1_ir", R8A779G0_CLK_SVD1_IR, CLK_SV_IR, 1, 1),
132137
DEF_FIXED("svd2_ir", R8A779G0_CLK_SVD2_IR, CLK_SV_IR, 2, 1),
133138
DEF_FIXED("svd1_vip", R8A779G0_CLK_SVD1_VIP, CLK_SV_VIP, 1, 1),
@@ -153,10 +158,10 @@ static const struct mssr_mod_clk r8a779g0_mod_clks[] __initconst = {
153158
DEF_MOD("avb0", 211, R8A779G0_CLK_S0D4_HSC),
154159
DEF_MOD("avb1", 212, R8A779G0_CLK_S0D4_HSC),
155160
DEF_MOD("avb2", 213, R8A779G0_CLK_S0D4_HSC),
156-
DEF_MOD("hscif0", 514, R8A779G0_CLK_S0D3_PER),
157-
DEF_MOD("hscif1", 515, R8A779G0_CLK_S0D3_PER),
158-
DEF_MOD("hscif2", 516, R8A779G0_CLK_S0D3_PER),
159-
DEF_MOD("hscif3", 517, R8A779G0_CLK_S0D3_PER),
161+
DEF_MOD("hscif0", 514, R8A779G0_CLK_SASYNCPERD1),
162+
DEF_MOD("hscif1", 515, R8A779G0_CLK_SASYNCPERD1),
163+
DEF_MOD("hscif2", 516, R8A779G0_CLK_SASYNCPERD1),
164+
DEF_MOD("hscif3", 517, R8A779G0_CLK_SASYNCPERD1),
160165
DEF_MOD("i2c0", 518, R8A779G0_CLK_S0D6_PER),
161166
DEF_MOD("i2c1", 519, R8A779G0_CLK_S0D6_PER),
162167
DEF_MOD("i2c2", 520, R8A779G0_CLK_S0D6_PER),

drivers/clk/sifive/Kconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@
22

33
menuconfig CLK_SIFIVE
44
bool "SiFive SoC driver support"
5-
depends on RISCV || COMPILE_TEST
5+
depends on SOC_SIFIVE || COMPILE_TEST
6+
default SOC_SIFIVE
67
help
78
SoC drivers for SiFive Linux-capable SoCs.
89

910
if CLK_SIFIVE
1011

1112
config CLK_SIFIVE_PRCI
1213
bool "PRCI driver for SiFive SoCs"
14+
default SOC_SIFIVE
1315
select RESET_CONTROLLER
1416
select RESET_SIMPLE
1517
select CLK_ANALOGBITS_WRPLL_CLN28HPC

0 commit comments

Comments
 (0)