Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+84 -10
+62 -3
drivers/clk/clk-renesas-pcie.c
··· 90 90 .n_yes_ranges = ARRAY_SIZE(rs9_writeable_ranges), 91 91 }; 92 92 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 + 93 144 static const struct regmap_config rs9_regmap_config = { 94 145 .reg_bits = 8, 95 146 .val_bits = 8, 96 - .cache_type = REGCACHE_FLAT, 97 - .max_register = 0x8, 147 + .cache_type = REGCACHE_NONE, 148 + .max_register = RS9_REG_BCP, 98 149 .rd_table = &rs9_readable_table, 99 150 .wr_table = &rs9_writeable_table, 151 + .reg_write = rs9_regmap_i2c_write, 152 + .reg_read = rs9_regmap_i2c_read, 100 153 }; 101 154 102 155 static int rs9_get_output_config(struct rs9_driver_data *rs9, int idx) ··· 295 242 return ret; 296 243 } 297 244 298 - rs9->regmap = devm_regmap_init_i2c(client, &rs9_regmap_config); 245 + rs9->regmap = devm_regmap_init(&client->dev, NULL, 246 + client, &rs9_regmap_config); 299 247 if (IS_ERR(rs9->regmap)) 300 248 return dev_err_probe(&client->dev, PTR_ERR(rs9->regmap), 301 249 "Failed to allocate register map\n"); 250 + 251 + /* Always read back 1 Byte via I2C */ 252 + ret = regmap_write(rs9->regmap, RS9_REG_BCP, 1); 253 + if (ret < 0) 254 + return ret; 302 255 303 256 /* Register clock */ 304 257 for (i = 0; i < rs9->chip_info->num_clks; i++) {
+5 -1
drivers/clk/clk.c
··· 1459 1459 { 1460 1460 struct clk_core *parent; 1461 1461 1462 - if (WARN_ON(!core || !req)) 1462 + if (WARN_ON(!req)) 1463 1463 return; 1464 1464 1465 1465 memset(req, 0, sizeof(*req)); 1466 + req->max_rate = ULONG_MAX; 1467 + 1468 + if (!core) 1469 + return; 1466 1470 1467 1471 req->rate = rate; 1468 1472 clk_core_get_boundaries(core, &req->min_rate, &req->max_rate);
+3 -1
drivers/clk/mediatek/clk-mt8195-topckgen.c
··· 1270 1270 hw = devm_clk_hw_register_mux(&pdev->dev, "mfg_ck_fast_ref", mfg_fast_parents, 1271 1271 ARRAY_SIZE(mfg_fast_parents), CLK_SET_RATE_PARENT, 1272 1272 (base + 0x250), 8, 1, 0, &mt8195_clk_lock); 1273 - if (IS_ERR(hw)) 1273 + if (IS_ERR(hw)) { 1274 + r = PTR_ERR(hw); 1274 1275 goto unregister_muxes; 1276 + } 1275 1277 top_clk_data->hws[CLK_TOP_MFG_CK_FAST_REF] = hw; 1276 1278 1277 1279 r = clk_mt8195_reg_mfg_mux_notifier(&pdev->dev,
+1
drivers/clk/qcom/gcc-sc7280.c
··· 3467 3467 regmap_update_bits(regmap, 0x28004, BIT(0), BIT(0)); 3468 3468 regmap_update_bits(regmap, 0x28014, BIT(0), BIT(0)); 3469 3469 regmap_update_bits(regmap, 0x71004, BIT(0), BIT(0)); 3470 + regmap_update_bits(regmap, 0x7100C, BIT(13), BIT(13)); 3470 3471 3471 3472 ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks, 3472 3473 ARRAY_SIZE(gcc_dfs_clocks));
+1
drivers/clk/qcom/gpucc-sc7280.c
··· 463 463 */ 464 464 regmap_update_bits(regmap, 0x1170, BIT(0), BIT(0)); 465 465 regmap_update_bits(regmap, 0x1098, BIT(0), BIT(0)); 466 + regmap_update_bits(regmap, 0x1098, BIT(13), BIT(13)); 466 467 467 468 return qcom_cc_really_probe(pdev, &gpu_cc_sc7280_desc, regmap); 468 469 }
+9 -4
drivers/clk/renesas/r8a779g0-cpg-mssr.c
··· 47 47 CLK_S0_VIO, 48 48 CLK_S0_VC, 49 49 CLK_S0_HSC, 50 + CLK_SASYNCPER, 50 51 CLK_SV_VIP, 51 52 CLK_SV_IR, 52 53 CLK_SDSRC, ··· 85 84 DEF_FIXED(".s0_vio", CLK_S0_VIO, CLK_PLL1_DIV2, 2, 1), 86 85 DEF_FIXED(".s0_vc", CLK_S0_VC, CLK_PLL1_DIV2, 2, 1), 87 86 DEF_FIXED(".s0_hsc", CLK_S0_HSC, CLK_PLL1_DIV2, 2, 1), 87 + DEF_FIXED(".sasyncper", CLK_SASYNCPER, CLK_PLL5_DIV4, 3, 1), 88 88 DEF_FIXED(".sv_vip", CLK_SV_VIP, CLK_PLL1, 5, 1), 89 89 DEF_FIXED(".sv_ir", CLK_SV_IR, CLK_PLL1, 5, 1), 90 90 DEF_BASE(".sdsrc", CLK_SDSRC, CLK_TYPE_GEN4_SDSRC, CLK_PLL5), ··· 130 128 DEF_FIXED("s0d4_hsc", R8A779G0_CLK_S0D4_HSC, CLK_S0_HSC, 4, 1), 131 129 DEF_FIXED("cl16m_hsc", R8A779G0_CLK_CL16M_HSC, CLK_S0_HSC, 48, 1), 132 130 DEF_FIXED("s0d2_cc", R8A779G0_CLK_S0D2_CC, CLK_S0, 2, 1), 131 + DEF_FIXED("sasyncperd1",R8A779G0_CLK_SASYNCPERD1, CLK_SASYNCPER,1, 1), 132 + DEF_FIXED("sasyncperd2",R8A779G0_CLK_SASYNCPERD2, CLK_SASYNCPER,2, 1), 133 + DEF_FIXED("sasyncperd4",R8A779G0_CLK_SASYNCPERD4, CLK_SASYNCPER,4, 1), 133 134 DEF_FIXED("svd1_ir", R8A779G0_CLK_SVD1_IR, CLK_SV_IR, 1, 1), 134 135 DEF_FIXED("svd2_ir", R8A779G0_CLK_SVD2_IR, CLK_SV_IR, 2, 1), 135 136 DEF_FIXED("svd1_vip", R8A779G0_CLK_SVD1_VIP, CLK_SV_VIP, 1, 1), ··· 158 153 DEF_MOD("avb0", 211, R8A779G0_CLK_S0D4_HSC), 159 154 DEF_MOD("avb1", 212, R8A779G0_CLK_S0D4_HSC), 160 155 DEF_MOD("avb2", 213, R8A779G0_CLK_S0D4_HSC), 161 - DEF_MOD("hscif0", 514, R8A779G0_CLK_S0D3_PER), 162 - DEF_MOD("hscif1", 515, R8A779G0_CLK_S0D3_PER), 163 - DEF_MOD("hscif2", 516, R8A779G0_CLK_S0D3_PER), 164 - DEF_MOD("hscif3", 517, R8A779G0_CLK_S0D3_PER), 156 + DEF_MOD("hscif0", 514, R8A779G0_CLK_SASYNCPERD1), 157 + DEF_MOD("hscif1", 515, R8A779G0_CLK_SASYNCPERD1), 158 + DEF_MOD("hscif2", 516, R8A779G0_CLK_SASYNCPERD1), 159 + DEF_MOD("hscif3", 517, R8A779G0_CLK_SASYNCPERD1), 165 160 DEF_MOD("i2c0", 518, R8A779G0_CLK_S0D6_PER), 166 161 DEF_MOD("i2c1", 519, R8A779G0_CLK_S0D6_PER), 167 162 DEF_MOD("i2c2", 520, R8A779G0_CLK_S0D6_PER),
+3 -1
drivers/clk/sifive/Kconfig
··· 2 2 3 3 menuconfig CLK_SIFIVE 4 4 bool "SiFive SoC driver support" 5 - depends on RISCV || COMPILE_TEST 5 + depends on SOC_SIFIVE || COMPILE_TEST 6 + default SOC_SIFIVE 6 7 help 7 8 SoC drivers for SiFive Linux-capable SoCs. 8 9 ··· 11 10 12 11 config CLK_SIFIVE_PRCI 13 12 bool "PRCI driver for SiFive SoCs" 13 + default SOC_SIFIVE 14 14 select RESET_CONTROLLER 15 15 select RESET_SIMPLE 16 16 select CLK_ANALOGBITS_WRPLL_CLN28HPC