[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <16698a59-1a2f-4816-98fe-56b125be669b@oss.qualcomm.com>
Date: Tue, 2 Sep 2025 11:14:46 +0200
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
To: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>,
Manivannan Sadhasivam <mani@...nel.org>,
Richard Cochran <richardcochran@...il.com>
Cc: mhi@...ts.linux.dev, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
taniya.das@....qualcomm.com, imran.shaik@....qualcomm.com,
quic_vbadigan@...cinc.com, quic_mrana@...cinc.com
Subject: Re: [PATCH 4/5] bus: mhi: host: Update the Time sync logic to read 64
bit register value
On 8/18/25 8:55 AM, Krishna Chaitanya Chundru wrote:
> Instead of reading low and high of the mhi registers twice use 64 bit
> register value to avoid any time penality.
>
> Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>
> ---
> drivers/bus/mhi/host/main.c | 19 +++++++++++++++----
> 1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c
> index b7ceeb7261b708d46572d1f68dc277b6e1186b6e..f628198218ef9dc760bbfc3ec496603d1a45dfc1 100644
> --- a/drivers/bus/mhi/host/main.c
> +++ b/drivers/bus/mhi/host/main.c
> @@ -1719,6 +1719,7 @@ static int mhi_get_remote_time(struct mhi_controller *mhi_cntrl, struct mhi_time
> struct mhi_timesync_info *time)
> {
> struct device *dev = &mhi_cntrl->mhi_dev->dev;
> + u64 val = U64_MAX;
> int ret, i;
>
> if (!mhi_tsync && !mhi_tsync->time_reg) {
> @@ -1756,15 +1757,25 @@ static int mhi_get_remote_time(struct mhi_controller *mhi_cntrl, struct mhi_time
> * transition to L0.
> */
> for (i = 0; i < MHI_NUM_BACK_TO_BACK_READS; i++) {
> - ret = mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg,
> - TSC_TIMESYNC_TIME_LOW_OFFSET, &time->t_dev_lo);
> + if (mhi_cntrl->read_reg64) {
> + ret = mhi_read_reg64(mhi_cntrl, mhi_tsync->time_reg,
> + TSC_TIMESYNC_TIME_LOW_OFFSET, &val);
Since you're passing mhi_cntrl to the read_reg64 function anyway,
perhaps this could remove some verbosity:
int mhi_read_reg64(...) {
u32 val_hi, val_lo;
u64 val;
if (mhi_cntrl->read_reg64) {
...
} else {
...
val = FIELD_PREP(GENMASK(63, 32), val_hi)) |
FIELD_PREP(GENMASK(31, 0), val_lo));
}
return val
}
Konrad
Powered by blists - more mailing lists