* [PATCH v1 1/1] i2c: k1: Use generic definitions for bus frequencies
@ 2026-06-18 14:11 Andy Shevchenko
2026-06-23 6:38 ` Troy Mitchell
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2026-06-18 14:11 UTC (permalink / raw)
To: Troy Mitchell, linux-i2c, linux-kernel; +Cc: Andi Shyti, Andy Shevchenko
Since we have generic definitions for bus frequencies, let's use them.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/i2c/busses/i2c-k1.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/drivers/i2c/busses/i2c-k1.c b/drivers/i2c/busses/i2c-k1.c
index 9152cf436bea..7732dd8b9074 100644
--- a/drivers/i2c/busses/i2c-k1.c
+++ b/drivers/i2c/busses/i2c-k1.c
@@ -91,9 +91,6 @@
/* i2c bus recover timeout: us */
#define SPACEMIT_I2C_BUS_BUSY_TIMEOUT 100000
-#define SPACEMIT_I2C_MAX_STANDARD_MODE_FREQ 100000 /* Hz */
-#define SPACEMIT_I2C_MAX_FAST_MODE_FREQ 400000 /* Hz */
-
#define SPACEMIT_SR_ERR (SPACEMIT_SR_BED | SPACEMIT_SR_RXOV | SPACEMIT_SR_ALD)
#define SPACEMIT_BUS_RESET_CLK_CNT_MAX 9
@@ -286,7 +283,7 @@ static void spacemit_i2c_init(struct spacemit_i2c_dev *i2c)
val |= SPACEMIT_CR_MSDIE;
}
- if (i2c->clock_freq == SPACEMIT_I2C_MAX_FAST_MODE_FREQ)
+ if (i2c->clock_freq == I2C_MAX_FAST_MODE_FREQ)
val |= SPACEMIT_CR_MODE_FAST;
/* disable response to general call */
@@ -703,14 +700,14 @@ static int spacemit_i2c_probe(struct platform_device *pdev)
dev_warn(dev, "failed to read clock-frequency property: %d\n", ret);
/* For now, this driver doesn't support high-speed. */
- if (!i2c->clock_freq || i2c->clock_freq > SPACEMIT_I2C_MAX_FAST_MODE_FREQ) {
+ if (!i2c->clock_freq || i2c->clock_freq > I2C_MAX_FAST_MODE_FREQ) {
dev_warn(dev, "unsupported clock frequency %u; using %u\n",
- i2c->clock_freq, SPACEMIT_I2C_MAX_FAST_MODE_FREQ);
- i2c->clock_freq = SPACEMIT_I2C_MAX_FAST_MODE_FREQ;
- } else if (i2c->clock_freq < SPACEMIT_I2C_MAX_STANDARD_MODE_FREQ) {
+ i2c->clock_freq, I2C_MAX_FAST_MODE_FREQ);
+ i2c->clock_freq = I2C_MAX_FAST_MODE_FREQ;
+ } else if (i2c->clock_freq < I2C_MAX_STANDARD_MODE_FREQ) {
dev_warn(dev, "unsupported clock frequency %u; using %u\n",
- i2c->clock_freq, SPACEMIT_I2C_MAX_STANDARD_MODE_FREQ);
- i2c->clock_freq = SPACEMIT_I2C_MAX_STANDARD_MODE_FREQ;
+ i2c->clock_freq, I2C_MAX_STANDARD_MODE_FREQ);
+ i2c->clock_freq = I2C_MAX_STANDARD_MODE_FREQ;
}
i2c->dev = &pdev->dev;
--
2.50.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] i2c: k1: Use generic definitions for bus frequencies
2026-06-18 14:11 [PATCH v1 1/1] i2c: k1: Use generic definitions for bus frequencies Andy Shevchenko
@ 2026-06-23 6:38 ` Troy Mitchell
0 siblings, 0 replies; 2+ messages in thread
From: Troy Mitchell @ 2026-06-23 6:38 UTC (permalink / raw)
To: Andy Shevchenko, Troy Mitchell, linux-i2c, linux-kernel; +Cc: Andi Shyti
On Thu Jun 18, 2026 at 10:11 PM CST, Andy Shevchenko wrote:
> Since we have generic definitions for bus frequencies, let's use them.
Thanks, Andy. Indeed, this macro was introduced in e6282fc6f889d.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-06-23 6:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-18 14:11 [PATCH v1 1/1] i2c: k1: Use generic definitions for bus frequencies Andy Shevchenko
2026-06-23 6:38 ` Troy Mitchell
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.