[PATCH v6 4/4] i2c: thunderx: Adding ioclk support

Piyush Malgujar posted 4 patches 1 year, 10 months ago
There is a newer version of this series
[PATCH v6 4/4] i2c: thunderx: Adding ioclk support
Posted by Piyush Malgujar 1 year, 10 months ago
Read the ioclk property as reference clock if sclk not present in acpi
table to make it SOC agnostic.
In case, it's not populated from dts/acpi table, use the default clock
of 800 MHz which is optimal in either case of sclk/ioclk.

Signed-off-by: Piyush Malgujar <pmalgujar@marvell.com>
---
 drivers/i2c/busses/i2c-thunderx-pcidrv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
index 31f11b77ab663626967c86086a03213876bf4a07..32d0e3930b675484138084e1bbed2e7cf898e1e1 100644
--- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
+++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
@@ -27,7 +27,7 @@
 
 #define PCI_DEVICE_ID_THUNDER_TWSI	0xa012
 
-#define SYS_FREQ_DEFAULT		700000000
+#define SYS_FREQ_DEFAULT		800000000
 #define OTX2_REF_FREQ_DEFAULT		100000000
 
 #define TWSI_INT_ENA_W1C		0x1028
@@ -100,7 +100,8 @@ static void thunder_i2c_clock_enable(struct device *dev, struct octeon_i2c *i2c)
 		i2c->sys_freq = clk_get_rate(i2c->clk);
 	} else {
 		/* ACPI */
-		device_property_read_u32(dev, "sclk", &i2c->sys_freq);
+		if (device_property_read_u32(dev, "sclk", &i2c->sys_freq))
+			device_property_read_u32(dev, "ioclk", &i2c->sys_freq);
 	}
 
 skip:
-- 
2.43.0
Re: [PATCH v6 4/4] i2c: thunderx: Adding ioclk support
Posted by Andi Shyti 1 year, 9 months ago
Hi Piyush,

On Tue, Apr 02, 2024 at 06:40:14AM -0700, Piyush Malgujar wrote:
> Read the ioclk property as reference clock if sclk not present in acpi
> table to make it SOC agnostic.
> In case, it's not populated from dts/acpi table, use the default clock
> of 800 MHz which is optimal in either case of sclk/ioclk.
> 
> Signed-off-by: Piyush Malgujar <pmalgujar@marvell.com>

just acking as a reminder to myself:

Acked-by: Andi Shyti <andi.shyti@kernel.org>

Everything looks good, if you manage to split patch 2 in two
different patches, then I think it's good to go.

Thanks,
Andi