From: Andi Shyti <andi.shyti@kernel.org>
To: Piyush Malgujar <pmalgujar@marvell.com>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
wsa@kernel.org, rric@kernel.org, jannadurai@marvell.com,
cchavva@marvell.com, Suneel Garapati <sgarapati@marvell.com>
Subject: Re: [PATCH 2/3] i2c: thunderx: Add support for High speed mode
Date: Sat, 10 Jun 2023 14:42:52 +0200 [thread overview]
Message-ID: <20230610124252.o7qmwgavqyrkfhq6@intel.intel> (raw)
In-Reply-To: <20230330133953.21074-3-pmalgujar@marvell.com>
Hi Suneel and Piyush,
[...]
> @@ -61,10 +61,19 @@ static int octeon_i2c_wait(struct octeon_i2c *i2c)
> return octeon_i2c_test_iflg(i2c) ? 0 : -ETIMEDOUT;
> }
>
> - i2c->int_enable(i2c);
> - time_left = wait_event_timeout(i2c->queue, octeon_i2c_test_iflg(i2c),
> - i2c->adap.timeout);
> - i2c->int_disable(i2c);
> + if (IS_LS_FREQ(i2c->twsi_freq)) {
> + i2c->int_enable(i2c);
> + time_left = wait_event_timeout(i2c->queue,
> + octeon_i2c_test_iflg(i2c),
> + i2c->adap.timeout);
> + i2c->int_disable(i2c);
> + } else {
> + time_left = 1000; /* 1ms */
> + do {
> + if (time_left--)
> + __udelay(1);
Are you sure you want to wait 1ms with __udelay(). This is a bit
dsruptive, can we use a more relaxed waiting method?
> + } while (!octeon_i2c_test_iflg(i2c) && time_left);
> + }
[...]
> * Find divisors to produce target frequency, start with large delta
> * to cover wider range of divisors, note thp = TCLK half period.
> */
> - int thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = huge_delta;
> + int ds = 10, thp = 0x18, mdiv = 2, ndiv = 0, delta_hz = huge_delta;
unsigned?
[...]
> + if (octeon_i2c_is_otx2(to_pci_dev(i2c->dev))) {
> + u64 mode;
> +
> + mode = __raw_readq(i2c->twsi_base + MODE(i2c));
> + /* Set REFCLK_SRC and HS_MODE in TWSX_MODE register */
> + if (!IS_LS_FREQ(i2c->twsi_freq))
> + mode |= BIT(4) | BIT(0);
> + else
> + mode &= ~(BIT(4) | BIT(0));
would be nice to have this defined and with some meaning as
comment.
> + octeon_i2c_writeq_flush(mode, i2c->twsi_base + MODE(i2c));
> + }
Robert, any comment here?
Thanks,
Andi
next prev parent reply other threads:[~2023-06-10 12:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-30 13:39 [PATCH 0/3] i2c: thunderx: Marvell thunderx i2c changes Piyush Malgujar
2023-03-30 13:39 ` [PATCH 1/3] i2c: thunderx: Clock divisor logic changes Piyush Malgujar
2023-06-10 12:29 ` Andi Shyti
2023-03-30 13:39 ` [PATCH 2/3] i2c: thunderx: Add support for High speed mode Piyush Malgujar
2023-03-30 15:46 ` kernel test robot
2023-03-30 17:39 ` kernel test robot
2023-06-10 12:42 ` Andi Shyti [this message]
2023-03-30 13:39 ` [PATCH 3/3] i2c: octeon: Handle watchdog timeout Piyush Malgujar
2023-06-10 13:24 ` 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=20230610124252.o7qmwgavqyrkfhq6@intel.intel \
--to=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=pmalgujar@marvell.com \
--cc=rric@kernel.org \
--cc=sgarapati@marvell.com \
--cc=wsa@kernel.org \
/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 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.