CC: [email protected] TO: Otavio Salvador <[email protected]>
tree: https://github.com/Freescale/linux-fslc 5.4-2.3.x-imx head: 549889f65d65baa0e9efa8790dc81ce8c580d842 commit: 124d288c85caab0f868cec5387a1a32f39871392 [12739/16811] MLK-24495 i2c: lpi2c: fix i2c timing issue :::::: branch date: 6 hours ago :::::: commit date: 5 months ago config: x86_64-randconfig-m001-20210129 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> New smatch warnings: drivers/i2c/busses/i2c-imx-lpi2c.c:243 lpi2c_imx_config() warn: the 'I2C_CLK_RATIO' macro might need parens Old smatch warnings: drivers/i2c/busses/i2c-imx-lpi2c.c:583 lpi2c_imx_init_recovery_info() warn: passing zero to 'PTR_ERR' vim +/I2C_CLK_RATIO +243 drivers/i2c/busses/i2c-imx-lpi2c.c a55fa9d0e42e31 Gao Pan 2016-11-30 217 124d288c85caab Clark Wang 2020-08-19 218 /* CLKLO = (1 - I2C_CLK_RATIO) * clk_cycle, SETHOLD = CLKHI, DATAVD = CLKHI/2 124d288c85caab Clark Wang 2020-08-19 219 CLKHI = I2C_CLK_RATIO * clk_cycle */ a55fa9d0e42e31 Gao Pan 2016-11-30 220 static int lpi2c_imx_config(struct lpi2c_imx_struct *lpi2c_imx) a55fa9d0e42e31 Gao Pan 2016-11-30 221 { a55fa9d0e42e31 Gao Pan 2016-11-30 222 u8 prescale, filt, sethold, clkhi, clklo, datavd; a55fa9d0e42e31 Gao Pan 2016-11-30 223 unsigned int clk_rate, clk_cycle; a55fa9d0e42e31 Gao Pan 2016-11-30 224 enum lpi2c_imx_pincfg pincfg; a55fa9d0e42e31 Gao Pan 2016-11-30 225 unsigned int temp; a55fa9d0e42e31 Gao Pan 2016-11-30 226 a55fa9d0e42e31 Gao Pan 2016-11-30 227 lpi2c_imx_set_mode(lpi2c_imx); a55fa9d0e42e31 Gao Pan 2016-11-30 228 c846995d43e1d2 Gao Pan 2018-01-19 229 clk_rate = clk_get_rate(lpi2c_imx->clk_per); c846995d43e1d2 Gao Pan 2018-01-19 230 if (!clk_rate) { c846995d43e1d2 Gao Pan 2018-01-19 231 dev_dbg(&lpi2c_imx->adapter.dev, "clk_per rate is 0\n"); c846995d43e1d2 Gao Pan 2018-01-19 232 return -EINVAL; c846995d43e1d2 Gao Pan 2018-01-19 233 } c846995d43e1d2 Gao Pan 2018-01-19 234 a55fa9d0e42e31 Gao Pan 2016-11-30 235 if (lpi2c_imx->mode == HS || lpi2c_imx->mode == ULTRA_FAST) a55fa9d0e42e31 Gao Pan 2016-11-30 236 filt = 0; a55fa9d0e42e31 Gao Pan 2016-11-30 237 else a55fa9d0e42e31 Gao Pan 2016-11-30 238 filt = 2; a55fa9d0e42e31 Gao Pan 2016-11-30 239 a55fa9d0e42e31 Gao Pan 2016-11-30 240 for (prescale = 0; prescale <= 7; prescale++) { a55fa9d0e42e31 Gao Pan 2016-11-30 241 clk_cycle = clk_rate / ((1 << prescale) * lpi2c_imx->bitrate) 124d288c85caab Clark Wang 2020-08-19 242 - (2 + filt) / (1 << prescale); 124d288c85caab Clark Wang 2020-08-19 @243 clkhi = clk_cycle * I2C_CLK_RATIO; a55fa9d0e42e31 Gao Pan 2016-11-30 244 clklo = clk_cycle - clkhi; a55fa9d0e42e31 Gao Pan 2016-11-30 245 if (clklo < 64) a55fa9d0e42e31 Gao Pan 2016-11-30 246 break; a55fa9d0e42e31 Gao Pan 2016-11-30 247 } a55fa9d0e42e31 Gao Pan 2016-11-30 248 a55fa9d0e42e31 Gao Pan 2016-11-30 249 if (prescale > 7) a55fa9d0e42e31 Gao Pan 2016-11-30 250 return -EINVAL; a55fa9d0e42e31 Gao Pan 2016-11-30 251 a55fa9d0e42e31 Gao Pan 2016-11-30 252 /* set MCFGR1: PINCFG, PRESCALE, IGNACK */ a55fa9d0e42e31 Gao Pan 2016-11-30 253 if (lpi2c_imx->mode == ULTRA_FAST) a55fa9d0e42e31 Gao Pan 2016-11-30 254 pincfg = TWO_PIN_OO; a55fa9d0e42e31 Gao Pan 2016-11-30 255 else a55fa9d0e42e31 Gao Pan 2016-11-30 256 pincfg = TWO_PIN_OD; a55fa9d0e42e31 Gao Pan 2016-11-30 257 temp = prescale | pincfg << 24; a55fa9d0e42e31 Gao Pan 2016-11-30 258 a55fa9d0e42e31 Gao Pan 2016-11-30 259 if (lpi2c_imx->mode == ULTRA_FAST) a55fa9d0e42e31 Gao Pan 2016-11-30 260 temp |= MCFGR1_IGNACK; a55fa9d0e42e31 Gao Pan 2016-11-30 261 a55fa9d0e42e31 Gao Pan 2016-11-30 262 writel(temp, lpi2c_imx->base + LPI2C_MCFGR1); a55fa9d0e42e31 Gao Pan 2016-11-30 263 a55fa9d0e42e31 Gao Pan 2016-11-30 264 /* set MCFGR2: FILTSDA, FILTSCL */ a55fa9d0e42e31 Gao Pan 2016-11-30 265 temp = (filt << 16) | (filt << 24); a55fa9d0e42e31 Gao Pan 2016-11-30 266 writel(temp, lpi2c_imx->base + LPI2C_MCFGR2); a55fa9d0e42e31 Gao Pan 2016-11-30 267 a55fa9d0e42e31 Gao Pan 2016-11-30 268 /* set MCCR: DATAVD, SETHOLD, CLKHI, CLKLO */ a55fa9d0e42e31 Gao Pan 2016-11-30 269 sethold = clkhi; a55fa9d0e42e31 Gao Pan 2016-11-30 270 datavd = clkhi >> 1; a55fa9d0e42e31 Gao Pan 2016-11-30 271 temp = datavd << 24 | sethold << 16 | clkhi << 8 | clklo; a55fa9d0e42e31 Gao Pan 2016-11-30 272 a55fa9d0e42e31 Gao Pan 2016-11-30 273 if (lpi2c_imx->mode == HS) a55fa9d0e42e31 Gao Pan 2016-11-30 274 writel(temp, lpi2c_imx->base + LPI2C_MCCR1); a55fa9d0e42e31 Gao Pan 2016-11-30 275 else a55fa9d0e42e31 Gao Pan 2016-11-30 276 writel(temp, lpi2c_imx->base + LPI2C_MCCR0); a55fa9d0e42e31 Gao Pan 2016-11-30 277 a55fa9d0e42e31 Gao Pan 2016-11-30 278 return 0; a55fa9d0e42e31 Gao Pan 2016-11-30 279 } a55fa9d0e42e31 Gao Pan 2016-11-30 280 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
