[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <q6bl7sbskt4ukd3mylfgwpo6dmv444umdpycs6xp7ozd2kv335@syeymu62fczb>
Date: Tue, 16 Apr 2024 00:11:03 +0200
From: Andi Shyti <andi.shyti@...nel.org>
To: Eddie James <eajames@...ux.ibm.com>
Cc: linux-fsi@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org, devicetree@...r.kernel.org, alistair@...ple.id.au,
joel@....id.au, jk@...abs.org, robh@...nel.org,
krzysztof.kozlowski+dt@...aro.org, conor+dt@...nel.org, lakshmiy@...ibmcom
Subject: Re: [PATCH v2 25/31] i2c: fsi: Calculate clock divider from local
bus frequency
Hi Eddie,
> @@ -689,6 +692,20 @@ static int fsi_i2c_probe(struct device *dev)
> mutex_init(&i2c->lock);
> i2c->fsi = to_fsi_dev(dev);
> INIT_LIST_HEAD(&i2c->ports);
> + i2c->clock_div = I2C_DEFAULT_CLK_DIV;
> +
> + lbus = fsi_device_local_bus_frequency(i2c->fsi);
> + if (lbus) {
> + u32 clock = I2C_DEFAULT_CLK_RATE;
I don't see the need for initialization.
> +
> + if (!device_property_read_u32(dev, "clock-frequency", &clock)) {
> + if (!clock)
> + clock = I2C_DEFAULT_CLK_RATE;
> + }
no need for brackets.
> +
> + // i2c clock rate = local bus clock / (4 * (i2c clock div + 1))
You forgot to remove this.
Andi
> + i2c->clock_div = (((lbus + (clock - 1)) / clock) / 4) - 1;
> + }
>
> rc = fsi_i2c_dev_init(i2c);
> if (rc)
> --
> 2.39.3
>
Powered by blists - more mailing lists