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

i3c: master: cdns: Update maximum prescaler value for i2c clock

As per the Cadence IP document fixed the I2C clock divider value limit from
16 bits instead of 10 bits. Without this change setting up the I2C clock to
low frequencies will not work as the prescaler value might be greater than
10 bit number.

I3C clock divider value is 10 bits only. Updating the macro names for both.

Signed-off-by: Harshit Shah <harshitshah.opendev@gmail.com>
Link: https://lore.kernel.org/r/1703927483-28682-1-git-send-email-harshitshah.opendev@gmail.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>

authored by

Harshit Shah and committed by
Alexandre Belloni
374c13f9 18e57948

+4 -3
+4 -3
drivers/i3c/master/i3c-master-cdns.c
··· 76 76 #define PRESCL_CTRL0 0x14 77 77 #define PRESCL_CTRL0_I2C(x) ((x) << 16) 78 78 #define PRESCL_CTRL0_I3C(x) (x) 79 - #define PRESCL_CTRL0_MAX GENMASK(9, 0) 79 + #define PRESCL_CTRL0_I3C_MAX GENMASK(9, 0) 80 + #define PRESCL_CTRL0_I2C_MAX GENMASK(15, 0) 80 81 81 82 #define PRESCL_CTRL1 0x18 82 83 #define PRESCL_CTRL1_PP_LOW_MASK GENMASK(15, 8) ··· 1234 1233 return -EINVAL; 1235 1234 1236 1235 pres = DIV_ROUND_UP(sysclk_rate, (bus->scl_rate.i3c * 4)) - 1; 1237 - if (pres > PRESCL_CTRL0_MAX) 1236 + if (pres > PRESCL_CTRL0_I3C_MAX) 1238 1237 return -ERANGE; 1239 1238 1240 1239 bus->scl_rate.i3c = sysclk_rate / ((pres + 1) * 4); ··· 1247 1246 max_i2cfreq = bus->scl_rate.i2c; 1248 1247 1249 1248 pres = (sysclk_rate / (max_i2cfreq * 5)) - 1; 1250 - if (pres > PRESCL_CTRL0_MAX) 1249 + if (pres > PRESCL_CTRL0_I2C_MAX) 1251 1250 return -ERANGE; 1252 1251 1253 1252 bus->scl_rate.i2c = sysclk_rate / ((pres + 1) * 5);