Linux-i2c Archive mirror
 help / color / mirror / Atom feed
From: Piyush Malgujar <pmalgujar@marvell.com>
To: <andi.shyti@kernel.org>, <linux-i2c@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Cc: <sgarapati@marvell.com>, <cchavva@marvell.com>,
	<jannadurai@marvell.com>, Piyush Malgujar <pmalgujar@marvell.com>
Subject: [PATCH v6 4/4] i2c: thunderx: Adding ioclk support
Date: Tue, 2 Apr 2024 06:40:14 -0700	[thread overview]
Message-ID: <20240402134018.2686919-5-pmalgujar@marvell.com> (raw)
In-Reply-To: <20240402134018.2686919-1-pmalgujar@marvell.com>

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


  parent reply	other threads:[~2024-04-02 13:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02 13:40 [PATCH v6 0/4] i2c: thunderx: Marvell thunderx i2c changes Piyush Malgujar
2024-04-02 13:40 ` [PATCH v6 1/4] i2c: thunderx: Clock divisor logic changes Piyush Malgujar
2024-04-16 13:08   ` Piyush Malgujar
2024-04-18 19:07     ` Andi Shyti
2024-04-02 13:40 ` [PATCH v6 2/4] i2c: thunderx: Support for High speed mode Piyush Malgujar
2024-04-18 19:12   ` Andi Shyti
2024-04-02 13:40 ` [PATCH v6 3/4] i2c: octeon: Handle watchdog timeout Piyush Malgujar
2024-04-02 13:40 ` Piyush Malgujar [this message]
2024-04-18 19:14   ` [PATCH v6 4/4] i2c: thunderx: Adding ioclk support Andi Shyti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240402134018.2686919-5-pmalgujar@marvell.com \
    --to=pmalgujar@marvell.com \
    --cc=andi.shyti@kernel.org \
    --cc=cchavva@marvell.com \
    --cc=jannadurai@marvell.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sgarapati@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).