summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-thunderx-pcidrv.c
diff options
context:
space:
mode:
authorSuneel Garapati <sgarapati@marvell.com>2024-04-23 09:46:04 +0200
committerAndi Shyti <andi.shyti@kernel.org>2024-05-06 00:56:38 +0200
commit114c69f4be3f3a55355b2f1db46a820bb0364457 (patch)
tree1771e87edf114494ec53d54a0e036ea6911513b2 /drivers/i2c/busses/i2c-thunderx-pcidrv.c
parenti2c: cadence: Add RISCV architecture support (diff)
downloadlinux-114c69f4be3f3a55355b2f1db46a820bb0364457.tar.xz
linux-114c69f4be3f3a55355b2f1db46a820bb0364457.zip
i2c: thunderx: Clock divisor logic changes
Handle changes to clock divisor logic for OcteonTX2 SoC family using subsystem ID and using default reference clock source as 100MHz. Signed-off-by: Suneel Garapati <sgarapati@marvell.com> Signed-off-by: Piyush Malgujar <pmalgujar@marvell.com> Acked-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Diffstat (limited to '')
-rw-r--r--drivers/i2c/busses/i2c-thunderx-pcidrv.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-thunderx-pcidrv.c b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
index a77cd86fe75e..755697740038 100644
--- a/drivers/i2c/busses/i2c-thunderx-pcidrv.c
+++ b/drivers/i2c/busses/i2c-thunderx-pcidrv.c
@@ -28,6 +28,7 @@
#define PCI_DEVICE_ID_THUNDER_TWSI 0xa012
#define SYS_FREQ_DEFAULT 700000000
+#define OTX2_REF_FREQ_DEFAULT 100000000
#define TWSI_INT_ENA_W1C 0x1028
#define TWSI_INT_ENA_W1S 0x1030
@@ -205,6 +206,12 @@ static int thunder_i2c_probe_pci(struct pci_dev *pdev,
if (ret)
goto error;
+ /*
+ * For OcteonTX2 chips, set reference frequency to 100MHz
+ * as refclk_src in TWSI_MODE register defaults to 100MHz.
+ */
+ if (octeon_i2c_is_otx2(pdev))
+ i2c->sys_freq = OTX2_REF_FREQ_DEFAULT;
octeon_i2c_set_clock(i2c);
i2c->adap = thunderx_i2c_ops;