From nobody Fri Sep 25 03:17:52 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6C41047604E for ; Thu, 17 Sep 2026 07:08:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628917; cv=none; b=qHTpKmgq+F82oS0zpQYaRGHPRamIYjium99jeupnhhasttDq5Jt2iRuzpgGbF6bdHCGjYDER59bAJT1DRryXtmoGr4zQQovTyr9xvi15NXFnpSgvVhcxUjCR5W4s+VOaeayZRS5WT5IR0rubhQk9aRHlurX2jULBXObgWMy3Wyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628917; c=relaxed/simple; bh=+JeOcCKCJT9TzZJOqCr35ckMrsBUUbL5W5ule19GD10=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kFod9iw+2OKqBhloGthMmrfXekFPKzcAAGrJDRaa93+gj1zDJwALf77+Y3SBO1j6h7dcI1CJNqwcUdr51nfGpovSXegEXeoXtnbUCP+kwz/8meXaw/YC/vynQk1G+kvQE6B+Z5MnPPr8uVKtshpKUxX21WLe6WItPQlvc86cjnU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ZvDGX5jE; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=HWzrS64R; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ZvDGX5jE"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="HWzrS64R" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68H60kxg663559 for ; Thu, 17 Sep 2026 07:08:34 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= FvKzqYphaIeLTQrNu5cABi1Q09xRTU6c92RkEhIvSW4=; b=ZvDGX5jELdG/1TuK WedbuiquKmbLPNq2yz8NBFSwany6WnHfJrXVXvhYONvjE3a3ujemYddOM8D5Hbx4 zLnBS2BoUc2wHBPOjOkieI/KrqPv71Gkca0tZ2j071ufmbW3egtug2XCp3ANWo8o 6oqMkoloXaMqDGvd61+1WlgQ8MFm3iVgqXq4QxrODmZMTorlyhQYOb726SKkDiY1 hqeXbevjeCCVUqP/Siosp8LsGiH//PRbh9LsA8xQbMAhkfcJ9C8X0d3V/9zRvSOR 4moZLGBcE3dWZ1c/PuGc7ziv70gK6VqMEfc9PrAsF8ezAEXBDZGaiIxYzNaQjCvB M6+d2w== Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gqyga2sjk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 07:08:34 +0000 (GMT) Received: by mail-ot1-f69.google.com with SMTP id 46e09a7af769-7f4e0b45e4bso729561a34.2 for ; Thu, 17 Sep 2026 00:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789628913; x=1790233713; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=FvKzqYphaIeLTQrNu5cABi1Q09xRTU6c92RkEhIvSW4=; b=HWzrS64R58YBbF+4nNtJkvf0O3GIA5dx/IxFtQYansLqzE3CqGhXo/iz8QS7lg1/Cj t4l7BZkHTYRU55ahU1QZdCZFC6rlMtVHXJvj0WHRVYrf0mjisSg1xoFS9M81Kj8AxCVJ 58g7cByzcyJm8Mb7FHyr2L6MjUF+QOqHTKthnnUqTEcjv7QmI1Rc8I2/XXWHlgwVQE/y jaATBUQ6QJBkw5XRXLafeYGOtmxSs4bAQ6nl8yyH39MsTriRuytEYf06EaFHtRn7h0vO VnFHKr0I+I+ODKzu/eCVEoXIDBJ7TAcze04wb0wBMWrDm/my4G+GCGGpclUKtfoWhw4l 5lKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789628913; x=1790233713; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=FvKzqYphaIeLTQrNu5cABi1Q09xRTU6c92RkEhIvSW4=; b=yFhn1Rd59o1l7B0LMRT0QxZG1t3BGI1l7V2NL6AWVVUWwxoo/zXYa41SQKLb0eJEKU iv32zD9xV1U0cNYgnKOv4RW0wXUm5LtqJVqc31o4NziebcUBhJ+0yZQFIe0TLIKJmfcG a7S2qq705rTVu/6LlVRULmlFmE7gZzlgaiP0mTi+8HbA+Cl1aSBuyC7oq65YMmmZzhy4 hXtqjFzt6cOFrA2foPe1Ll5cn7/sENyPVtk8nf4vQnkkqm/K1vitDOzOQ6FQ48z97uI8 3VAv0MuzEHmSL/0ivMyL7+nTlUC3P6m1TOER46ZFOyW6X/kLs9PWlDdnEm18KlKjlNtb gX0A== X-Forwarded-Encrypted: i=1; AKwUvByzZ65qvmAMzVbsTdxHDc+naq51nLfuBmvOMNadGRaEWjGpPx1dn+tXJvRy0V7HRvsowCdh+p7FeHs8QbY=@vger.kernel.org X-Gm-Message-State: AFuF++mgx0y6BwHnTkQLBVcPXevspo/+zqQCOcY7eKzF847N8bbVM2ue Bc37GUQpOy7cCwR1yFFfhSPZpSn+pt9rCndJgWP/xFdkT3KU2UC7oyv0Dvr0+XYdLthUf24yWHY dPe0sDfaVgYGNznwGHz6AX8bhl4pZSg/KPz9QTS1w7EGOJ9FDa9aMTZlp6NVV6DO8zgg= X-Gm-Gg: AYBFou2E1irxaLtIEZaP+yzSESozYqH9L6l7OE2ewI4fNR3TM0YzBD+e3I5ohXh3X0v 23mHUpyd/lrSQsDfkRNdZPDhbMUQgLrl/rCv/laPqGxMh1eI539Sin56bZ5hLmxctqkKVEVheEE xfkiok8YOQcjeLjgYCfAcD0/BUJrKk/qq3+i412nJTVqzwuzKBg3eO0for9vMKyipGgeDECFeK0 fGrlRy8Jv1SuD2jW3aLNjJuhzwxYY3XBJVG9QuffC0m93CHuUoWNfKvxKUHWeuy3Kv1YIJgVptc a743dfDbNsRe7r+QoDgQWke+bqMaok7igVmVYzz/6QgvBTyJvLk5JjkOe0g5SZKDuUzLejx4Oew AHL3WT9rJnfXjfpSGm/rYN5OAqTk9k7Ymev4= X-Received: by 2002:a05:6820:1899:b0:6c0:66ae:ba91 with SMTP id 006d021491bc7-6c7d0ee5129mr4794621eaf.28.1789628913633; Thu, 17 Sep 2026 00:08:33 -0700 (PDT) X-Received: by 2002:a05:6820:1899:b0:6c0:66ae:ba91 with SMTP id 006d021491bc7-6c7d0ee5129mr4794593eaf.28.1789628913142; Thu, 17 Sep 2026 00:08:33 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33bf5e40494sm13280835eec.15.2026.09.17.00.08.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 00:08:32 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 17 Sep 2026 12:38:02 +0530 Subject: [PATCH v3 1/6] bus: mhi: host: Add support to read MHI capabilities Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260917-tsc_timesync-v3-1-6826d5d2d527@oss.qualcomm.com> References: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> In-Reply-To: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Richard Cochran Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Krishna Chaitanya Chundru , Vivek Pernamitta , Sivareddy Surasani X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789628904; l=3082; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=JclDFIoQQmU13ybasYFbXZ7aKUGUQ3PPLi7vjPeAauw=; b=dWhPBK3oKBwqaXPL4W4EjaTr6g3gbUYII/k9qYfnqAqLMsDoscAd2NEWHr7hsbXw/7d4ln4Ny PZ1ugcCeg+KBXaA9KkDH1WFik8LwsAQfemljUID9++iWggEIW7HuaP5 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-ORIG-GUID: UuegRsz3nmA6Zn2ZsetnNUvIjX7KS6vw X-Proofpoint-GUID: UuegRsz3nmA6Zn2ZsetnNUvIjX7KS6vw X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX4ip6jvK84gx4 VBSlkhJsGm7axo2PlQeUIagda3vQOf6ePSFKWTqQVmUPOJKbMN6oCi9YdqNftM0HQa50T+M5BW9 61Y31HftdhSjBOaq+wnCgpQWTHHtOa0= X-Authority-Analysis: v=2.4 cv=I9fw19gg c=1 sm=1 tr=0 ts=6aab91f2 cx=c_pps a=z9lCQkyTxNhZyzAvolXo/A==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=CnzCB1l8zP_khqs2e6IA:9 a=QEXdDO2ut3YA:10 a=EyFUmsFV_t8cxB2kMr4A:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX8MBSv82h0uGK k0sorOUkwqpgYfTxIl+ouljgPRaRjHBicwE+uyBIJu4qPaj6l6n1vm59swztAOfo0Z+Ysiy9noI Z2jeJv11Vw6XZuzWeaK5/OgJlLOSaEPc73JaOqovCqgiYq2wWm5yMEQyHgcDcqy6REQmHjiMHNS jsAURiFqwo728fviA8QzTiUSF0DZsOp/BkqQ3UpNsdHSvGyqNR8HtXvNIlM1y4JaHS1Yk+sZBmZ CBkOU6iy635rP0q0PupGPoTLDHmvcUlZWX89GPLYLLknzkYOu5i/di5Nu930q6Ailya/vfDCEWM tNUCVH5nKAtkMGxN2FwKBuWuQlE4FdmGWCqX6RWc71+fKpkLBmQ8xj4DXbV3ER/e6R5b9A9AVh8 qI0rRoIPy/hBRYOB1qqZieIu7258cchNx9cy5wp/uytuFpTDml9QMj1v1cZXOB4suoQAx2hCPVv /7a+jqBtcvM6I80QgDw== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_01,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 spamscore=0 lowpriorityscore=0 priorityscore=1501 adultscore=0 clxscore=1015 bulkscore=0 phishscore=0 suspectscore=0 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170094 From: Vivek Pernamitta As per MHI spec v1.2,sec 6.6, MHI has capability registers which are located after the ERDB array. The location of this group of registers is indicated by the MISCOFF register. Each capability has a capability ID to determine which functionality is supported and each capability will point to the next capability supported. Add a basic function to read those capabilities offsets. Signed-off-by: Vivek Pernamitta Signed-off-by: Sivareddy Surasani Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/common.h | 11 +++++++++++ drivers/bus/mhi/host/init.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/drivers/bus/mhi/common.h b/drivers/bus/mhi/common.h index dda340aaed95..4c316f3d5a68 100644 --- a/drivers/bus/mhi/common.h +++ b/drivers/bus/mhi/common.h @@ -16,6 +16,7 @@ #define MHICFG 0x10 #define CHDBOFF 0x18 #define ERDBOFF 0x20 +#define MISCOFF 0x24 #define BHIOFF 0x28 #define BHIEOFF 0x2c #define DEBUGOFF 0x30 @@ -113,6 +114,9 @@ #define MHISTATUS_MHISTATE_MASK GENMASK(15, 8) #define MHISTATUS_SYSERR_MASK BIT(2) #define MHISTATUS_READY_MASK BIT(0) +#define MISC_CAP_MASK GENMASK(31, 0) +#define CAP_CAPID_MASK GENMASK(31, 24) +#define CAP_NEXT_CAP_MASK GENMASK(23, 12) =20 /* Command Ring Element macros */ /* No operation command */ @@ -204,6 +208,13 @@ #define MHI_RSCTRE_DATA_DWORD1 cpu_to_le32(FIELD_PREP(GENMASK(23, 16), \ MHI_PKT_TYPE_COALESCING)) =20 +#define MHI_CAP_ID_INTX 0x1 +#define MHI_CAP_ID_TIME_SYNC 0x2 +#define MHI_CAP_ID_BW_SCALE 0x3 +#define MHI_CAP_ID_TSC_TIME_SYNC 0x4 +#define MHI_CAP_ID_MAX_TRB_LEN 0x5 +#define MHI_CAP_ID_MAX 0x6 + enum mhi_pkt_type { MHI_PKT_TYPE_INVALID =3D 0x0, MHI_PKT_TYPE_NOOP_CMD =3D 0x1, diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c index fd3050889412..7ca2fe48c9ac 100644 --- a/drivers/bus/mhi/host/init.c +++ b/drivers/bus/mhi/host/init.c @@ -465,6 +465,38 @@ static int mhi_init_dev_ctxt(struct mhi_controller *mh= i_cntrl) return ret; } =20 +static int mhi_find_capability(struct mhi_controller *mhi_cntrl, u32 capab= ility) +{ + u32 val, cur_cap, next_offset, cur_offset; + int ret; + + /* Get the first supported capability offset */ + ret =3D mhi_read_reg_field(mhi_cntrl, mhi_cntrl->regs, MISCOFF, MISC_CAP_= MASK, &cur_offset); + if (ret) + return 0; + + do { + if (cur_offset >=3D mhi_cntrl->reg_len) + return 0; + + ret =3D mhi_read_reg(mhi_cntrl, mhi_cntrl->regs, cur_offset, &val); + if (ret) + return 0; + + cur_cap =3D FIELD_GET(CAP_CAPID_MASK, val); + next_offset =3D FIELD_GET(CAP_NEXT_CAP_MASK, val); + if (cur_cap >=3D MHI_CAP_ID_MAX) + return 0; + + if (cur_cap =3D=3D capability) + return cur_offset; + + cur_offset =3D next_offset; + } while (next_offset); + + return 0; +} + int mhi_init_mmio(struct mhi_controller *mhi_cntrl) { u32 val; --=20 2.34.1 From nobody Fri Sep 25 03:17:52 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C3A84486E40 for ; Thu, 17 Sep 2026 07:08:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628923; cv=none; b=iluAGOg15HYZ1OKcZhq27NIV1GV9TFnQAu9ssxRup0hE223LXh4xTp78eISxPTRJudWHlFvdGLzyMg92p/ld4pznwM3DjmF1OoCMUYbF97zI/unTkQkwSZd4EhlwwD6sRGWtKnpJ8aPifZAyFihp3JRIXiFZzrNBSktuz1owMXw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628923; c=relaxed/simple; bh=fQRTehV8CGvInRDeTZfSW2KH/zmeYIa2G7vVDgqcZGA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g4AMabk81Te+jlBwz24QZTdj5OrEHRkvVq5cSgg0TXlrdDsrAX9FvnsSncY6U+lnhpXeIhg5KHmtlMWcQTzf+SIGrJdBGpIpxlyqYfGh2Lg+MDJ9kc8mJFrs72wYXqVeKN4BLeZ0Y5QEFLFe30H8XPM59ZATBfZ2HvWsxOsDzAM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=VpIgR1Ni; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=dQ91inPN; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="VpIgR1Ni"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="dQ91inPN" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68H61YoX776821 for ; Thu, 17 Sep 2026 07:08:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= EucckBjq0ZAUvNX5HMtokHxW375byZlwFwCAHxjfgdA=; b=VpIgR1NiCpRlmKhi 5gYrJOnz8dVlQUVKTR7VbO5aQi3F1v7JC+N08NDf0MqoQ86bohMeSVGY82q7RFi4 oJgOlW1BkHX662DSsCp5220jJQ82QBws/6yduN2v/x/Qz22LMF3VxaCtKYtqW5ee 7Zb/o9MuCiw3em4NzThvGOUq7kS7H6rL4BDzJjvgd9985fPJKF4hzQtWOWcLnpXC 0RsPtZBV9WPQfjOU9Vxj1RzcwaF0PdpajZjU9MBMomjyp8wgaLIts0OC2cB92N54 h+kUSEmedQp211e6RMiSpq1QucgWciBol17rtKlX22mCEuUwMYUsHpL6aeqKm0Qg 9Mz5zA== Received: from mail-oo1-f70.google.com (mail-oo1-f70.google.com [209.85.161.70]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gquw2uymj-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 07:08:38 +0000 (GMT) Received: by mail-oo1-f70.google.com with SMTP id 006d021491bc7-6c1bb6ec882so642712eaf.2 for ; Thu, 17 Sep 2026 00:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789628918; x=1790233718; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=EucckBjq0ZAUvNX5HMtokHxW375byZlwFwCAHxjfgdA=; b=dQ91inPNFv5A7KA/V4x7cT6ZFTdxbrmaL7zmU6yhgOP14D0p8mvftHDeau2Hk7tn9G hhtN545IcHL9VoL+buaUYnHEwajJFjYHF1MOCk/Koedcdcc+lRZQdpGmPbscleIFFuom OrtYQcAWQkDNvHCYThws8zCvNmSmsalt5od41Fq7QSL5GUMdKWiKV4apjBw0UwIwD8qL kXYV0ElngmVROpg6YalSwXJum8zut7nliO1FOcZYv6U5YkogzLdz7Y0kSwMdRZSNP3PR pztt1DUzPKzM4cy3uM6MPunLiorvG9vjYghaF4ZDyEPPPeke1qCzNQyxNF/I+rNdv8Q6 J4AA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789628918; x=1790233718; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=EucckBjq0ZAUvNX5HMtokHxW375byZlwFwCAHxjfgdA=; b=abLdBMRs0yATrr8uqm4qJXwd4u90eE3iXl9IOvvQ7WrV+/1KIhm3gHqf2MLaetAyVI JJLhtPfVcNmco8ec2P1krgjuMvfc5S0K2YSSnP9971xA5bH8mPiwgmmZY3ot7XszuLBr jekOOZ8FUEF1dyfONhG4rfxfehWPCVwHVNj7JwM/OET3ZVeMWpv2AVZgtyqZokkMxaux J8KxlPWAoH7qj++J7NWzSEQHeUCDYITx+pktCYFTykWyWAX9Mmy28ba/EJH8YrQfS8Ru htHTfedFzo2H2Q1lVvGoC2tTRp2/htFil9VInSoKQDdfneDtt/+seiMIv36+NLJSWhuy xl1Q== X-Forwarded-Encrypted: i=1; AKwUvBx2wfabW1A5ZLDPoXcMekqSIr/YlfgqjNNqwzMzRXSrjRcphr3kEnX1MJr90gXbDetbnwCPYMQvTfKoY4U=@vger.kernel.org X-Gm-Message-State: AFuF++njXX8Vx2AylE/FziEeC7YA2z6DTI3rov+L18sR1jgFZA9VaAK3 xJLRRl/g1gJV5fHYnahm4CKMRTCFAiVNP568YHNOWKA3WWNjOX2OlT3DrqqAGuJW2kD+me89hlT sNL5HSOe9DFT6DER74aPD8v2vwNW/Y13DbYk/i/CzBjh3G2Kd23HITI7Jw4fmOcOxsMw= X-Gm-Gg: AYBFou2yDuI66SMPw6z4WoJckhZ61moIr6Ev+hHdV45tMR3XpUD5tuAWrG21lESiJwr bkfVFb8boKIKZ/H7lOY6EaW2Ik8tFtAgyPeqondgALw6rOsEQpxz7Negf2HesGl/39pdUq0fGet FmvGHUqH7FiAhX04lHBkL9zUIn5tAM57R00z/HwllR5nEPiZSUAfZRIJdRC2CGxABqFEX3Uq8Do oRfRQjM7SFs8+Lmw/DB+4VUnqMgf2pyoon5ArvR0QsWz3Q5pjquDXiWIf+IkBbzfedyWW+QPLAI xwSlFjg4SvJimXRPeko6pVOgcgpEbjJbif20yso31DoZkWdWPRJmpta86SurdZWvJVAa3p3Zs+7 SPpumYN24Fph0xDMVy1iVrGB7JSA2w1wcEuQ= X-Received: by 2002:a05:6820:2010:b0:6be:47ed:f3f8 with SMTP id 006d021491bc7-6c7ce737ecdmr5130342eaf.0.1789628917668; Thu, 17 Sep 2026 00:08:37 -0700 (PDT) X-Received: by 2002:a05:6820:2010:b0:6be:47ed:f3f8 with SMTP id 006d021491bc7-6c7ce737ecdmr5130313eaf.0.1789628917092; Thu, 17 Sep 2026 00:08:37 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33bf5e40494sm13280835eec.15.2026.09.17.00.08.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 00:08:36 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 17 Sep 2026 12:38:03 +0530 Subject: [PATCH v3 2/6] bus: mhi: host: mhi_phc: Add support for PHC over MHI Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260917-tsc_timesync-v3-2-6826d5d2d527@oss.qualcomm.com> References: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> In-Reply-To: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Richard Cochran Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Krishna Chaitanya Chundru , Taniya Das , Imran Shaik , Vivek Pernamitta X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789628904; l=13466; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=fQRTehV8CGvInRDeTZfSW2KH/zmeYIa2G7vVDgqcZGA=; b=ai4fr621DQxotey/YzDMDhoijfLkFfHkg6p/sW6HCp1lk+b4/RJtcyzjD6NrVTlzj8EVSwR4S c1D3neTJoTkAf30dBHG/nyIeN/0tsQQD9saqnvo+3n6ACVnMCD4ALXG X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX/UYW70Q0ZFBE ufy1mhdlmSqJ66f1RpUeI5AeqTAWzirL2DwVDqyCRk2hRzOB1SWhyU40DYAKBWmzOxn5rsJa4+I 2GKU4VoSaH/TD9GDtrwGv6a3vzKtM2I= X-Proofpoint-GUID: do1XycZdNeK1bOBq8zlHWaaAf1rjaj7E X-Authority-Analysis: v=2.4 cv=N4m8hG9B c=1 sm=1 tr=0 ts=6aab91f6 cx=c_pps a=lkkFf9KBb43tY3aOjL++dA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=EUspDBNiAAAA:8 a=COk6AnOGAAAA:8 a=nd-n_nVWBVQei7lK5GYA:9 a=QEXdDO2ut3YA:10 a=k4UEASGLJojhI9HsvVT1:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-ORIG-GUID: do1XycZdNeK1bOBq8zlHWaaAf1rjaj7E X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfXyc8Jxl7krBU6 +HyGRaTA5oBchNgbKz9rsh2QCAMqZkXZzZObc5Vij0ijcVICE6vMZkSR2MASrhBXrEJKIahxDvS qXaQRAUYSFfsouX0ZCABeCTbNQvk6RWJ4fvW0+rt0yw6Z44104dkQ+YhJUo+bpUKMEOgGmA0Zq8 BsLXt31jM3o9CUhEpha63JL0EICODtKV2TKX2+f4xlKMNT3iEMyCRPuwuD5xTde2KUg6lhrcHse 2ennKtKwlfZ/N7qXc0+uyYUsq7OFu0oEmtYtrHsJ/JRmD4G//7kXPhS61sa9mmle1NuzRMoPdAh 3o01rYxgS6kSxIcSJl54LXZKBTHaECTwJ9xkbXPTmjXreRwtFgSkI1+0TkKMNS5k7Yj20kCtXIH birSeVdKIv5wl0tdGxjCPa3/H28TrHQaqYsZdMaC1xYULVMJwsrTkflx1cx2OA2CVRu2kE3cbKy i631Lqi3KMlRAsBkrdQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_01,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 clxscore=1015 phishscore=0 adultscore=0 spamscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170094 Implement the non-posted time synchronization mechanism described in section 5.1.1 of the MHI v1.2 specification and expose the device clock as a PTP Hardware Clock. Discover the TSC Timesync capability during MHI controller initialization and use the capability offset to access the device TIME registers. Register the PHC when the device enters mission mode and unregister it when the device encounters a fatal error, enters a system error state, or is removed. When userspace requests a timestamp, keep the MHI device runtime-active and bring it to the M0 state before accessing the device registers. Capture system timestamps immediately before and after reading the device timestamp, allowing userspace to correlate the host and device clocks through the standard Linux PTP interface. Co-developed-by: Taniya Das Signed-off-by: Taniya Das Co-developed-by: Imran Shaik Signed-off-by: Imran Shaik Co-developed-by: Vivek Pernamitta Signed-off-by: Vivek Pernamitta Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/common.h | 4 + drivers/bus/mhi/host/Kconfig | 9 +++ drivers/bus/mhi/host/Makefile | 2 + drivers/bus/mhi/host/init.c | 33 ++++++++ drivers/bus/mhi/host/internal.h | 31 ++++++++ drivers/bus/mhi/host/mhi_phc.c | 154 +++++++++++++++++++++++++++++++++= ++++ drivers/bus/mhi/host/mhi_phc.h | 21 +++++ drivers/bus/mhi/host/pci_generic.c | 6 ++ include/linux/mhi.h | 5 ++ 9 files changed, 265 insertions(+) diff --git a/drivers/bus/mhi/common.h b/drivers/bus/mhi/common.h index 4c316f3d5a68..64f9b2b94387 100644 --- a/drivers/bus/mhi/common.h +++ b/drivers/bus/mhi/common.h @@ -118,6 +118,10 @@ #define CAP_CAPID_MASK GENMASK(31, 24) #define CAP_NEXT_CAP_MASK GENMASK(23, 12) =20 +/* MHI TSC Timesync */ +#define TSC_TIMESYNC_TIME_LOW_OFFSET (0x8) +#define TSC_TIMESYNC_TIME_HIGH_OFFSET (0xC) + /* Command Ring Element macros */ /* No operation command */ #define MHI_TRE_CMD_NOOP_PTR 0 diff --git a/drivers/bus/mhi/host/Kconfig b/drivers/bus/mhi/host/Kconfig index da5cd0c9fc62..7609768c0efe 100644 --- a/drivers/bus/mhi/host/Kconfig +++ b/drivers/bus/mhi/host/Kconfig @@ -29,3 +29,12 @@ config MHI_BUS_PCI_GENERIC This driver provides MHI PCI controller driver for devices such as Qualcomm SDX55 based PCIe modems. =20 +config MHI_BUS_PHC + tristate "MHI PHC driver" + depends on MHI_BUS + depends on PTP_1588_CLOCK + help + This driver provides Precision Time Protocol (PTP) clock and + communicates with MHI PCI driver to get the device side timestamp, + which enables precise time synchronization between the host and + the device. diff --git a/drivers/bus/mhi/host/Makefile b/drivers/bus/mhi/host/Makefile index 859c2f38451c..f16b3195a03a 100644 --- a/drivers/bus/mhi/host/Makefile +++ b/drivers/bus/mhi/host/Makefile @@ -4,3 +4,5 @@ mhi-$(CONFIG_MHI_BUS_DEBUG) +=3D debugfs.o =20 obj-$(CONFIG_MHI_BUS_PCI_GENERIC) +=3D mhi_pci_generic.o mhi_pci_generic-y +=3D pci_generic.o + +obj-$(CONFIG_MHI_BUS_PHC) +=3D mhi_phc.o diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c index 7ca2fe48c9ac..caa307c71890 100644 --- a/drivers/bus/mhi/host/init.c +++ b/drivers/bus/mhi/host/init.c @@ -497,6 +497,32 @@ static int mhi_find_capability(struct mhi_controller *= mhi_cntrl, u32 capability) return 0; } =20 +#if IS_ENABLED(CONFIG_MHI_BUS_PHC) +int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl) +{ + struct device *dev =3D &mhi_cntrl->mhi_dev->dev; + struct mhi_timesync *mhi_tsync; + u32 time_offset; + + time_offset =3D mhi_find_capability(mhi_cntrl, MHI_CAP_ID_TSC_TIME_SYNC); + if (!time_offset) + return -ENXIO; + + mhi_tsync =3D devm_kzalloc(dev, sizeof(*mhi_tsync), GFP_KERNEL); + if (!mhi_tsync) + return -ENOMEM; + + mutex_init(&mhi_tsync->ts_mutex); + + /* save time_offset for obtaining time via MMIO register reads */ + mhi_tsync->time_reg =3D mhi_cntrl->regs + time_offset; + + mhi_cntrl->tsc_timesync =3D mhi_tsync; + + return 0; +} +#endif + int mhi_init_mmio(struct mhi_controller *mhi_cntrl) { u32 val; @@ -634,6 +660,13 @@ int mhi_init_mmio(struct mhi_controller *mhi_cntrl) return ret; } =20 + /* Discover TSC time sync capability, if present */ + ret =3D mhi_init_tsc_timesync(mhi_cntrl); + if (ret && ret !=3D -ENXIO) { + dev_err(dev, "Error configuring TSC time sync\n"); + return ret; + } + return 0; } =20 diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/interna= l.h index 7b0ee5e3a12d..ca50961769fa 100644 --- a/drivers/bus/mhi/host/internal.h +++ b/drivers/bus/mhi/host/internal.h @@ -9,6 +9,10 @@ =20 #include "../common.h" =20 +#if IS_ENABLED(CONFIG_MHI_BUS_PHC) +#include +#endif + extern const struct bus_type mhi_bus_type; =20 /* Host request register */ @@ -24,6 +28,24 @@ struct mhi_ctxt { dma_addr_t cmd_ctxt_addr; }; =20 +#if IS_ENABLED(CONFIG_MHI_BUS_PHC) +/** + * struct mhi_timesync - MHI time synchronization structure + * @time_reg: Points to address of Timesync register + * @ts_mutex: Mutex for synchronization + * @ptp_clock: associated PTP clock + * @ptp_clock_info: PTP clock information + * @mhi_dev: associated mhi device object + */ +struct mhi_timesync { + void __iomem *time_reg; + struct mutex ts_mutex; + struct ptp_clock *ptp_clock; + struct ptp_clock_info ptp_clock_info; + struct mhi_device *mhi_dev; +}; +#endif + struct bhi_vec_entry { __le64 dma_addr; __le64 size; @@ -388,6 +410,15 @@ int mhi_rddm_prepare(struct mhi_controller *mhi_cntrl, struct image_info *img_info); void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl); =20 +#if IS_ENABLED(CONFIG_MHI_BUS_PHC) +int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl); +#else +static inline int mhi_init_tsc_timesync(struct mhi_controller *mhi_cntrl) +{ + return 0; +} +#endif + int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl, struct mhi_chan *mhi_chan); void mhi_deinit_chan_ctxt(struct mhi_controller *mhi_cntrl, diff --git a/drivers/bus/mhi/host/mhi_phc.c b/drivers/bus/mhi/host/mhi_phc.c new file mode 100644 index 000000000000..783f05b5d144 --- /dev/null +++ b/drivers/bus/mhi/host/mhi_phc.c @@ -0,0 +1,154 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2026, Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#include +#include +#include +#include "../common.h" +#include "internal.h" +#include "mhi_phc.h" + +/** + * struct mhi_timesync_info - MHI time sync info structure + * @t_dev_lo: MHI device time of lower dword + * @t_dev_hi: MHI device time of higher dword + */ +struct mhi_timesync_info { + u32 t_dev_lo; + u32 t_dev_hi; +}; + +static int mhi_get_remote_tsc_time_sync(struct mhi_device *mhi_dev, struct= mhi_timesync_info *time, + struct ptp_system_timestamp *sts) +{ + struct mhi_controller *mhi_cntrl =3D mhi_dev->mhi_cntrl; + struct mhi_timesync *mhi_tsync =3D mhi_cntrl->tsc_timesync; + struct device *dev =3D &mhi_cntrl->mhi_dev->dev; + u64 val =3D U64_MAX; + u32 hi, lo =3D 0; + int ret; + + if (!mhi_tsync || !mhi_tsync->time_reg) { + dev_err(dev, "Time sync is not supported\n"); + return -EOPNOTSUPP; + } + + mhi_cntrl->runtime_get(mhi_cntrl); + + /* bring to M0 state */ + ret =3D mhi_device_get_sync(mhi_cntrl->mhi_dev); + if (ret) { + mhi_cntrl->runtime_put(mhi_cntrl); + return ret; + } + + guard(mutex)(&mhi_tsync->ts_mutex); + + // TODO: Disable ASPM + + /* + * time critical code to fetch device time, delay between these two steps + * should be deterministic as possible. + */ + preempt_disable(); + local_irq_disable(); + + ptp_read_system_prets(sts); + + /* + * Read the high dword twice around the low dword and retry if it + * changed, to avoid a torn read across a device-side rollover. + */ + do { + ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, + TSC_TIMESYNC_TIME_HIGH_OFFSET, &hi); + if (ret) + break; + + ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, + TSC_TIMESYNC_TIME_LOW_OFFSET, &lo); + if (ret) + break; + + ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, + TSC_TIMESYNC_TIME_HIGH_OFFSET, &time->t_dev_hi); + } while (!ret && hi !=3D time->t_dev_hi); + + time->t_dev_lo =3D lo; + + ptp_read_system_postts(sts); + + local_irq_enable(); + preempt_enable(); + + mhi_device_put(mhi_cntrl->mhi_dev); + + mhi_cntrl->runtime_put(mhi_cntrl); + + return ret; +} + +static int qcom_ptp_gettimex64(struct ptp_clock_info *ptp, struct timespec= 64 *ts, + struct ptp_system_timestamp *sts) +{ + struct mhi_timesync *mhi_tsync =3D container_of(ptp, struct mhi_timesync,= ptp_clock_info); + struct mhi_timesync_info time; + ktime_t ktime_cur; + int ret; + + ret =3D mhi_get_remote_tsc_time_sync(mhi_tsync->mhi_dev, &time, sts); + if (ret) + return ret; + + ktime_cur =3D time.t_dev_hi * NSEC_PER_SEC + time.t_dev_lo; + *ts =3D ktime_to_timespec64(ktime_cur); + + return 0; +} + +static struct ptp_clock_info qcom_ptp_clock_info =3D { + .owner =3D THIS_MODULE, + .gettimex64 =3D qcom_ptp_gettimex64, +}; + +int mhi_phc_init(struct mhi_controller *mhi_cntrl) +{ + struct mhi_device *mhi_dev =3D mhi_cntrl->mhi_dev; + struct mhi_timesync *mhi_tsync =3D mhi_cntrl->tsc_timesync; + int ret; + + if (!mhi_tsync) + return -ENODEV; + + mhi_tsync->mhi_dev =3D mhi_dev; + + mhi_tsync->ptp_clock_info =3D qcom_ptp_clock_info; + strscpy(mhi_tsync->ptp_clock_info.name, mhi_dev->name, PTP_CLOCK_NAME_LEN= ); + + mhi_tsync->ptp_clock =3D ptp_clock_register(&mhi_tsync->ptp_clock_info, &= mhi_dev->dev); + if (IS_ERR(mhi_tsync->ptp_clock)) { + ret =3D PTR_ERR(mhi_tsync->ptp_clock); + dev_err(&mhi_dev->dev, "Failed to register PTP clock\n"); + return ret; + } + + return 0; +} +EXPORT_SYMBOL_GPL(mhi_phc_init); + +void mhi_phc_exit(struct mhi_controller *mhi_cntrl) +{ + struct mhi_timesync *mhi_tsync =3D mhi_cntrl->tsc_timesync; + + if (!mhi_tsync || !mhi_tsync->ptp_clock) + return; + + ptp_clock_unregister(mhi_tsync->ptp_clock); + mhi_tsync->ptp_clock =3D NULL; +} +EXPORT_SYMBOL_GPL(mhi_phc_exit); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("MHI PHC driver"); diff --git a/drivers/bus/mhi/host/mhi_phc.h b/drivers/bus/mhi/host/mhi_phc.h new file mode 100644 index 000000000000..263574ca53da --- /dev/null +++ b/drivers/bus/mhi/host/mhi_phc.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2026, Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#ifndef _MHI_PHC_H +#define _MHI_PHC_H + +#if IS_ENABLED(CONFIG_MHI_BUS_PHC) +int mhi_phc_init(struct mhi_controller *mhi_cntrl); +void mhi_phc_exit(struct mhi_controller *mhi_cntrl); +#else +static inline int mhi_phc_init(struct mhi_controller *mhi_cntrl) +{ + return 0; +} + +static inline void mhi_phc_exit(struct mhi_controller *mhi_cntrl) {} +#endif + +#endif /* _MHI_PHC_H */ diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_= generic.c index b636e2c23b4d..f47867ced1d6 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -16,6 +16,7 @@ #include #include #include +#include "mhi_phc.h" =20 #define MHI_PCI_DEFAULT_BAR_NUM 0 =20 @@ -1123,9 +1124,11 @@ static void mhi_pci_status_cb(struct mhi_controller = *mhi_cntrl, case MHI_CB_FATAL_ERROR: case MHI_CB_SYS_ERROR: dev_warn(&pdev->dev, "firmware crashed (%u)\n", cb); + mhi_phc_exit(mhi_cntrl); pm_runtime_forbid(&pdev->dev); break; case MHI_CB_EE_MISSION_MODE: + mhi_phc_init(mhi_cntrl); pm_runtime_allow(&pdev->dev); break; default: @@ -1491,6 +1494,9 @@ static void mhi_pci_remove(struct pci_dev *pdev) timer_delete_sync(&mhi_pdev->health_check_timer); cancel_work_sync(&mhi_pdev->recovery_work); =20 + /* Remove PHC */ + mhi_phc_exit(mhi_cntrl); + if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) { mhi_power_down(mhi_cntrl, true); mhi_unprepare_after_power_down(mhi_cntrl); diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 8616bacd8675..e994ca4f9810 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -23,6 +23,8 @@ struct mhi_event; struct mhi_ctxt; struct mhi_cmd; struct mhi_buf_info; +struct mhi_timesync; + =20 /** * enum mhi_callback - MHI callback @@ -341,6 +343,7 @@ struct mhi_controller_config { * @mhi_event: MHI event ring configurations table * @mhi_cmd: MHI command ring configurations table * @mhi_ctxt: MHI device context, shared memory between host and device + * @tsc_timesync: MHI TSC timesync * @pm_mutex: Mutex for suspend/resume operation * @pm_lock: Lock for protecting MHI power management state * @timeout_ms: Timeout in ms for state transitions @@ -422,6 +425,8 @@ struct mhi_controller { struct mhi_cmd *mhi_cmd; struct mhi_ctxt *mhi_ctxt; =20 + struct mhi_timesync *tsc_timesync; + struct mutex pm_mutex; rwlock_t pm_lock; u32 timeout_ms; --=20 2.34.1 From nobody Fri Sep 25 03:17:52 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 72729486E78 for ; Thu, 17 Sep 2026 07:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628926; cv=none; b=Fx+UJ2ONOvPGYGK11qoHIr3l9v9D9mvhX4f8JUBW2z75CiCTwyyNLpMDr707ZpnXHpp/bNpevhV2+wpjGN5cBSJLiJJZ4sdfcvv1sxdUhqsaZuLenAiLyiBcap7fatMUPJ5ZFHDHVW8N99ZfHToIqZkoG30lyLaItS6v/69Kho0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628926; c=relaxed/simple; bh=DWQkc7G6x9/l9HXB7zRBR28OwQe/issVxWGt7hAyuBE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fHNABTXz0+Eajwoxn5Hxn9BG5If3RX+zS6zYj+TonvgpT8/6Mo3bhxJBY4wcmjQbCtycxu/hqxheZn9RVfIrmVrV+RL16KQJGc9lklHNydnl8JOWJciFKYxAUNS8JJJfQy+6B4zfMtOX3fLS+Mhq3tlf2U/zLsm4D+BCDaP4epA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=XUcIzge0; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=df5g1zGw; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="XUcIzge0"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="df5g1zGw" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68H60VK91211736 for ; Thu, 17 Sep 2026 07:08:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= q+mXYarnrnNTKxSI2lhAir8/DlTJRjNeh9Ip0hboFrM=; b=XUcIzge0pfaj0sYs Wr8UXHRK6IR2oHrG56gHmPdQjQMkrycO+QVrsSXdWAXxXmdZMx31lp9DqCrZ3v5H E+/azQcs0UDg4MOn5+shFlNbaFg+2kZHkAxp3mJOmNhve/hiIv3qvmiQCBYxJBAH p70VesisGNvPmev5aqLciOnE91OjltxyNDuSK3hXr9eIp58x71jbdOaMMxTEAYJ/ KE8FXPuwFZQsraxc+No5fEnyVTt6hdrTKSVtpLOiDJ93A5zE+DMvsMSZS0tWJTQd xhaG8GikyU6vA0c4uCLYB4FsQt6EAEuxsoQGJfzxJLz8uuQ8svO1JZZDVvU5gZgs fTHO2A== Received: from mail-oi1-f198.google.com (mail-oi1-f198.google.com [209.85.167.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gqxayb7xy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 07:08:41 +0000 (GMT) Received: by mail-oi1-f198.google.com with SMTP id 5614622812f47-4c55ba309c2so761793b6e.1 for ; Thu, 17 Sep 2026 00:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789628921; x=1790233721; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=q+mXYarnrnNTKxSI2lhAir8/DlTJRjNeh9Ip0hboFrM=; b=df5g1zGwCG+GUHtGAG/FQvZAsyMMPTcU5l1RT36TVKa31xIlDF//R0vVToM5daATBC AmTagvzQJU8R/ACrCv3b1o5sG+BfS3aNeGOEu8+vhLPjsPhfDyb+4ZVEC8mrNbdQ0qPU +/JViF0aTRanqQJNm3kfXJyo+yO0Q1m7nM6DLFuWQuFu3Epg00/I9eCpYq3UB0TcnYnE BiWXIjw0y8iiwbNe5PBWWKJcHCuv+LVFhqLeA/gfEw6VOQ0ea2rAJIkeYeKZJMHqhvY0 S9k/xaGRziK8unRYMyAYf4pkhm3Yu8SNXSbsxRomble6Z86hQVZrwg/XZdsRdGXoKNyE n8wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789628921; x=1790233721; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=q+mXYarnrnNTKxSI2lhAir8/DlTJRjNeh9Ip0hboFrM=; b=cyJfniVzqG6KUl0NT5S2gNHCtPQFuNFJIbLKXnTCZ2bemgHhZdwey7Yp60eSwiWD/p aMBzaDfLlkxea62UF3JQqyC/CwI1OR4SZqnhsBP42Ax39aNujmgc0J52IwzfSCgePT1Y cyTqcUmjTRQt6orx4T4rC8T1CsQP3sau+rjbfq57/66OchlokZdPXsp5NmdVZOQ8+VX+ 5UHaKLNb4+eHsd175h3yARfxaol+2gVoMnM8qedfN0Kjyid21MQo2x4PlLz4wfvAQwSd QUr80oLxaNnj92LeP+cEylrcYZ9QMYQDAQJ/7f5jjRfPQfnF5zHArnGuBABZfCBWwTPa dKoQ== X-Forwarded-Encrypted: i=1; AKwUvBxhDr6NDedYJWuVsQVeaFdhGY2TjQPVV4WT7rttbQ5mSJwkR/ba/fk1JcIxKhpzSMZ4NGUjmPGLpOrVzGc=@vger.kernel.org X-Gm-Message-State: AFuF++ko573TjWOl0e5pHxxCkfFIolhOGchIKvWAKVp2bT58ceBZXdI+ yYoSx5lcYdSZqh/vnRJXr2viIctO/MAn6Lo4/CmW9vAvWwoF8Uy75jgKPWsImjkABqnAN3JzRB1 9X1FGwTMmP+l94EGScXhVL7NWkWEdTRKYygvgfQgNM2bpXhTMOjNzP4Er8F3lQqvbLco= X-Gm-Gg: AYBFou2vN6G6xatfHnafwvMFTzxWhMxzWqQ9M1aDTwzIL+mOA+JsWWtPMSs39qdSBot WohTfiOAbEmQRic+Y94o0TJBzzstVoedBCS5U35LWycBAmfRutxF1twFjA8RP2MvyhCdAgnN0w8 rpwCODd3gCqwgeOKguEZrPlJVjzbs51jaNEo0Ph7MuiSlkUJOtEpxE5KIga1r1LPsEyyEH7M4gi LUgATcEyuCIp3JLj0QuD2Biu02M2i6T2BTYKCBzGuEDPfc4h/HNR8X/J5vwe6L62g/GZLqxVtcy KKsMrOtmuziKepP2t4biPc1SolsUmu/VA011lzDz2W6c3EMfsiCl00jpcivGz3RytOjA+wlBYwF N/b3VpXamnpPb+VcHwXojTdxN7BHw/gjHkBg= X-Received: by 2002:a05:6808:1782:b0:4b9:a8ac:47e with SMTP id 5614622812f47-4ca4c283485mr6719339b6e.28.1789628920719; Thu, 17 Sep 2026 00:08:40 -0700 (PDT) X-Received: by 2002:a05:6808:1782:b0:4b9:a8ac:47e with SMTP id 5614622812f47-4ca4c283485mr6719320b6e.28.1789628920293; Thu, 17 Sep 2026 00:08:40 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33bf5e40494sm13280835eec.15.2026.09.17.00.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 00:08:39 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 17 Sep 2026 12:38:04 +0530 Subject: [PATCH v3 3/6] bus: mhi: host: Add support for 64bit register reads and writes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260917-tsc_timesync-v3-3-6826d5d2d527@oss.qualcomm.com> References: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> In-Reply-To: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Richard Cochran Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Krishna Chaitanya Chundru X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789628904; l=3724; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=DWQkc7G6x9/l9HXB7zRBR28OwQe/issVxWGt7hAyuBE=; b=MEY/Kgj6zt4Jwmsz9JirKEr9cooGz2obeJh2fDuBhTYOvHZuY3ZS9gOWbkITFCnH3PAZZbC1f 2OAIbxunUWAD4BoQFAANvna7ar2L4xw7jpHUuEqswyWyZbI4TO/nPr4 X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX3JiF3AlV/3UJ hY3mePD2Mee2wqD03jv1ikivIISnf6OJf2MIkXTNxLh3VAphxexmVnkFrDfi8/BqnC0/JRHcaUq L3qrsRYzGh0MR0QJicO0wt+93GadNYt/W0ycn7rq6acOJXZCK27VF1MncKlS6GDMxyRUqijp+98 bCIBDB6+gGWZUgLmLmcCZvrayz7JM344q/PDmSCCENyKedvbvIkgHPRTet29h4nur3FGhy/0C2A vpkuZ9yWDfMRqKflQzt8Fv42u+K16drb9qQmjAAF62oruyl/pWUYlZjBo2mcSmv6Ux9PgAJNrpa E+qgr3h2CdazJkAviVfmCYmlPJTwxA58Ys7FKetu3AtHzusmf9uPmu8Ee5t8tkUXGpG+s3mt5pV EdMBtAHuuRY+sEo89GmvdcuQMX0Jqsf6lrtlORsfzJdCYxTiIeh5/KhGkF1dfjNPxf0xuFksgMo zUDj6y65klfmI9FeeWw== X-Proofpoint-GUID: GEbDV6VfQILu2c44_uBuRm28Tg98VOpl X-Authority-Analysis: v=2.4 cv=EoJHPicA c=1 sm=1 tr=0 ts=6aab91f9 cx=c_pps a=4ztaESFFfuz8Af0l9swBwA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=EUspDBNiAAAA:8 a=CnzCB1l8zP_khqs2e6IA:9 a=QEXdDO2ut3YA:10 a=O8hF6Hzn-FEA:10 a=TPnrazJqx2CeVZ-ItzZ-:22 X-Proofpoint-ORIG-GUID: GEbDV6VfQILu2c44_uBuRm28Tg98VOpl X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX52Wck7YcYEZS 3apoEpWvhx93Nc+7yvT/NtGTMFn4rxP44r2x4EuzIoP98IknIKs9WrsXGl9XrtKfFerJ0LfzWGg DpbDhb4R2d6P6jB18DcZMAQvXOUGTO8= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_01,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 malwarescore=0 suspectscore=0 spamscore=0 adultscore=0 impostorscore=0 clxscore=1015 lowpriorityscore=0 priorityscore=1501 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170094 Some mhi registers are of 64 bit size, instead of reading high value and low value separately provide a new function op to read & write to 64 bit register. Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/internal.h | 4 ++++ drivers/bus/mhi/host/main.c | 13 +++++++++++++ include/linux/mhi.h | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/interna= l.h index ca50961769fa..bb96dfffabb6 100644 --- a/drivers/bus/mhi/host/internal.h +++ b/drivers/bus/mhi/host/internal.h @@ -386,6 +386,8 @@ void mhi_db_brstmode_disable(struct mhi_controller *mhi= _cntrl, dma_addr_t db_val); int __must_check mhi_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *base, u32 offset, u32 *out); +int __must_check mhi_read_reg64(struct mhi_controller *mhi_cntrl, + void __iomem *base, u32 offset, u64 *out); int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl, void __iomem *base, u32 offset, u32 mask, u32 *out); @@ -394,6 +396,8 @@ int __must_check mhi_poll_reg_field(struct mhi_controll= er *mhi_cntrl, u32 val, u32 delayus, u32 timeout_ms); void mhi_write_reg(struct mhi_controller *mhi_cntrl, void __iomem *base, u32 offset, u32 val); +void __maybe_unused mhi_write_reg64(struct mhi_controller *mhi_cntrl, void= __iomem *base, + u32 offset, u64 val); int __must_check mhi_write_reg_field(struct mhi_controller *mhi_cntrl, void __iomem *base, u32 offset, u32 mask, u32 val); diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index 4d458396233a..bfeb5cf53448 100644 --- a/drivers/bus/mhi/host/main.c +++ b/drivers/bus/mhi/host/main.c @@ -67,6 +67,19 @@ void mhi_write_reg(struct mhi_controller *mhi_cntrl, voi= d __iomem *base, mhi_cntrl->write_reg(mhi_cntrl, base + offset, val); } =20 +int __must_check mhi_read_reg64(struct mhi_controller *mhi_cntrl, + void __iomem *base, u32 offset, u64 *out) +{ + return mhi_cntrl->read_reg64(mhi_cntrl, base + offset, out); +} +EXPORT_SYMBOL_GPL(mhi_read_reg64); + +void __maybe_unused mhi_write_reg64(struct mhi_controller *mhi_cntrl, void= __iomem *base, + u32 offset, u64 val) +{ + mhi_cntrl->write_reg64(mhi_cntrl, base + offset, val); +} + int __must_check mhi_write_reg_field(struct mhi_controller *mhi_cntrl, void __iomem *base, u32 offset, u32 mask, u32 val) diff --git a/include/linux/mhi.h b/include/linux/mhi.h index e994ca4f9810..3dc1844222cd 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -374,6 +374,8 @@ struct mhi_controller_config { * @unmap_single: CB function to destroy TRE buffer * @read_reg: Read a MHI register via the physical link (required) * @write_reg: Write a MHI register via the physical link (required) + * @read_reg64: Read a 64 bit MHI register via the physical link (optional) + * @write_reg64: Write a 64 bit MHI register via the physical link (option= al) * @reset: Controller specific reset function (optional) * @edl_trigger: CB function to trigger EDL mode (optional) * @buffer_len: Bounce buffer length @@ -461,6 +463,10 @@ struct mhi_controller { u32 *out); void (*write_reg)(struct mhi_controller *mhi_cntrl, void __iomem *addr, u32 val); + int (*read_reg64)(struct mhi_controller *mhi_cntrl, void __iomem *addr, + u64 *out); + void (*write_reg64)(struct mhi_controller *mhi_cntrl, void __iomem *addr, + u64 val); void (*reset)(struct mhi_controller *mhi_cntrl); int (*edl_trigger)(struct mhi_controller *mhi_cntrl); =20 --=20 2.34.1 From nobody Fri Sep 25 03:17:52 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B718B486BB5 for ; Thu, 17 Sep 2026 07:08:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628928; cv=none; b=BvcfNsHKRC9k9t/WfLBrWiqiyTE/YHM5lMhOwB/9OgSgEV4ANw5V2r7n9S6X/0XX8N7kK/iUZkDH5F0Va6q0vU8kB+SSo7lynMFvlIVpIYrcYkxAPkWWIQL8ZaJjJ9+cYBJEkf5TZj3JSg+7FUw2kLjOFjEDe1ZAD4x77ibEgFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628928; c=relaxed/simple; bh=mquGpw2Jeks3u4pZSzMvUe6ezLRM/XKipJPSpWcGRsY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ahykq2ZQq4/sIdlMYtd9vjk/agzmHREJzA+WdVv7MgLdwZMcVWiuUQERaBWMbbhmBqiN8obaYDdS7+yt4QFoXj0w8Sz2SCbt2yZxBjA8HuaG9aTIicWuHk0+rMFylTWTfhETFIqcXjNjmaP5OBusG35ATdDLxLKlML4fVm2cmoE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ZV2OAd4R; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=a+terzDg; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="ZV2OAd4R"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="a+terzDg" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68H61GOY133171 for ; Thu, 17 Sep 2026 07:08:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= CyEv4YRY+fDKmX+R2j/i0iuRIUl+0Tgi8q01fbNyyJE=; b=ZV2OAd4RrB2ongbN cmi2DHPJGVauNJrzFQ5h00OkHa8XHpOTJ22gZtjb70F2qsxVMV26wu2N6fPG/OCz z6O7DNzqm2un7iCZ9Th7Hai0El/aMi2Ium7K2e/oVdxrS1XTdtseCzKdm63zcQfU iNC24871sqEuxpn/3ce7QZecM9C2kfbJonXuS71uHQqJ+sqEfFH8haRT7CCtd6kl dDPdJhEg3K+I/onEKAkWOT1ivAN0HsvgrnAVwGv3L6VQDWqXY5B3FBlaDx42iCfJ vXJyRmGX6wPAaheTnx8ZyKEFbjFXfpVElvKCjRWT8GPOfVooBl6l5QpRkyi3h0Dd GRncWA== Received: from mail-oi1-f199.google.com (mail-oi1-f199.google.com [209.85.167.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gqtn549n6-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 07:08:44 +0000 (GMT) Received: by mail-oi1-f199.google.com with SMTP id 5614622812f47-4a41f46d629so1020859b6e.3 for ; Thu, 17 Sep 2026 00:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789628924; x=1790233724; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=CyEv4YRY+fDKmX+R2j/i0iuRIUl+0Tgi8q01fbNyyJE=; b=a+terzDgEl4vewu1wQoNsApwwnNPivSVm5UITEWbbBMbe0w3OQnn+MwP8bCEu9M+LE LruWXTFTBv82aCUO8wdpmZSN4Y9jNfNAagueRdv9fQuY5L+dp0hJo+ozTb/z8p8taEWZ QyvjumdGti44+8XcXOEi8Stzuq16T+8VbPEJFcR5ktZVaVYJIGGZO+ahR/4gsXQTQZ8A LBmN47tAH4zf1elZK+Ul18i4ldM8h19arc4bBIaQz52fa9Sv+6kUZn5K2Go/WaE3dVdS h9IYyMS5camJtN00HUL5pQ0lk7ODXse7cMKuCbSVyZl9WTjn3zFffCvTsP3zxPH1wLIl 5O5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789628924; x=1790233724; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=CyEv4YRY+fDKmX+R2j/i0iuRIUl+0Tgi8q01fbNyyJE=; b=rkG2RJpRqthN+GruvxtZYNRBrWU/psnzp+ZPyHYrwoGSBr50+qI/LPsmLDVqrpb3uZ W067HD1TJZIr8RAsZV2qPtrivZH8UDJEfyvIHmoPjupDhNCuqu0qDwaHSEUMUppmnnhy VFeZ37ayvQgKuSXDryMIyCzO2fSVEuX0l612HBH5zDYXYeG4yOEwACEAc04GfSCdarV1 jUhwrnjsvBZHG0+k2WoSZLArn/3hLtEq1GJHJxevkMGMm5lSi5uN+QyyfKVHt9yZJgpB fydVisDZZJ9WyZy40SHDc6+z4FxrtQwOXhxx2sSrNLD2Busxb5uIZcNZSZ0UkFlZMEb6 aP1A== X-Forwarded-Encrypted: i=1; AKwUvBzCj1mHQ3LIyW32PgWlwAYjaKNEQwOnazhI4DOXyhC9r0L6bz+uP2jBSuAIFRhrv76olK60Yu2X7XC6fDE=@vger.kernel.org X-Gm-Message-State: AFuF++lKZM4Uh4zwwBgNBxc7wPI9EhlHG5rVP1LCxx5pRHWP9oJgdMiX pZJ08mn/54YwTU9gSjtg1YtHhUDK/1g7xfLF0ZAq4/5MayXl9xchcF5u7IOC15Oy8tSlgzqm2Cn Og4M5YGqmUbk2SKVABjboKppuNtZ5aQWirgHpalPx6zoCtriRNBrGqDiI8C2ySOG5moc= X-Gm-Gg: AYBFou3qEoNfIC6Eo4z5eDU56gZFCXSZPdUXZLNNcmRCQkeebAbSxHt6k6YuP0oPnGt FBK1dTeRumn8unzoSV/SOD3PEv2QRgayajyycNAN0KAEWrkD0amUx1usS1vZm9DktPa8lmSL5b2 wZTrF1IdRo4ng4CmsIVb6q+a5OhkF6bfT/SonAV/OFVbi0bGXLJxP9v8RxhcmmEJ73dHJtA8oUB bVCZtCG7H36SRWiwFWDfgFzZo5TsVz84ueiH/JoiNh46dS19ctF/H73VOCUQVN/2vcm8GZZwbY0 3YDHXLR0vLUfL2W8eCc/SaC+GXXAeXQ1Yi4KiiN/XFLMXTBlzee6Yqjhmqm/CD+badMugqBU9Jj rftO3/KTQJwt2Pw4BJQGatZH827wHIpYaTjw= X-Received: by 2002:a05:6808:4f11:b0:4b2:8ee8:8a38 with SMTP id 5614622812f47-4ca46878257mr7083032b6e.0.1789628923861; Thu, 17 Sep 2026 00:08:43 -0700 (PDT) X-Received: by 2002:a05:6808:4f11:b0:4b2:8ee8:8a38 with SMTP id 5614622812f47-4ca46878257mr7083009b6e.0.1789628923419; Thu, 17 Sep 2026 00:08:43 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33bf5e40494sm13280835eec.15.2026.09.17.00.08.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 00:08:43 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 17 Sep 2026 12:38:05 +0530 Subject: [PATCH v3 4/6] bus: mhi: pci_generic: Add support for 64 bit register read & write Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260917-tsc_timesync-v3-4-6826d5d2d527@oss.qualcomm.com> References: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> In-Reply-To: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Richard Cochran Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Krishna Chaitanya Chundru X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789628904; l=1521; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=mquGpw2Jeks3u4pZSzMvUe6ezLRM/XKipJPSpWcGRsY=; b=RTgaytB4AD/U8vad/HkXDKJIftkQ19zqM3nTTYNeWMINkQvbsInXOFtlDCi9TfEv6a0cZ1aSc +ms9OBxP7SKBF/JBbNgy4kWhzfzA0eYbgun+9opB+BS0yexgvE5FBfn X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX/PHU07oznKDr x/Yqn+NUXhXRtZ1j33/4WOwWPLJZA57hbGXRQAslBeYuyM6qgyeNdLj4zoo30OJvmROwDOQONzt +Rc+J6Rom4cb2xIEtCyeh4HKQ1mT5qv1y+YQduv84unSJves73ipiarBtXd/7HMfY5g7rN9Y2aF pKN/LhLmqUpK9O8kj987ps60+RbWSkSSHD6vy1dX0/ckRX1PSeLb3lWD9KxxJE/1QTrha7nWK2Y M87t3z3LXzv5ZN79lpLNhAgMTg6Ky6dbyxUYjmFHyDYuUCGkjR2HFXpmmdNuEmNQ9FVxt3uum2x eKzvAmtXdbiHikuD1itUDQY66h9qbtHjKBErCrBuNApmYDxzXFwdmC8b5Aqsi+vcZfhn/OLBKKY y/9oiifzP3ojISSwaTJV+/AByL7hdWqOb2cwLfaZhg3TcERH5ZMfMcp8ySqTn7Yw2AW6W5FFKkI tKKaQtwJO02hfosJYZA== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX8/MInfUOQ/FC R8CNT1Lx0sfj5Aw6GKRZutzGYORYaN//XVRjb28tQAuUEdw5FY2dpHaSvxH1gaiZw0P233iQbUe B7joUZicw7i4HE+v/krBtfnzMCLbWk8= X-Proofpoint-ORIG-GUID: qynzLtHfaefK3aWIoFMl1HQF258yFLqc X-Authority-Analysis: v=2.4 cv=K7O3jCWI c=1 sm=1 tr=0 ts=6aab91fc cx=c_pps a=yymyAM/LQ7lj/HqAiIiKTw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=MXGvhfJtNsboA4ndukAA:9 a=QEXdDO2ut3YA:10 a=efpaJB4zofY2dbm2aIRb:22 X-Proofpoint-GUID: qynzLtHfaefK3aWIoFMl1HQF258yFLqc X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_01,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 phishscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 adultscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170094 Add support for reading and writing 64 bit mhi pcie registers. Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/pci_generic.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_= generic.c index f47867ced1d6..0aa5cee49bdc 100644 --- a/drivers/bus/mhi/host/pci_generic.c +++ b/drivers/bus/mhi/host/pci_generic.c @@ -1101,6 +1101,27 @@ struct mhi_pci_device { bool reset_on_remove; }; =20 +#ifdef readq +static int mhi_pci_read_reg64(struct mhi_controller *mhi_cntrl, + void __iomem *addr, u64 *out) +{ + *out =3D readq(addr); + return 0; +} +#else +#define mhi_pci_read_reg64 NULL +#endif + +#ifdef writeq +static void mhi_pci_write_reg64(struct mhi_controller *mhi_cntrl, + void __iomem *addr, u64 val) +{ + writeq(val, addr); +} +#else +#define mhi_pci_write_reg64 NULL +#endif + static int mhi_pci_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr, u32 *out) { @@ -1406,6 +1427,8 @@ static int mhi_pci_probe(struct pci_dev *pdev, const = struct pci_device_id *id) =20 mhi_cntrl->read_reg =3D mhi_pci_read_reg; mhi_cntrl->write_reg =3D mhi_pci_write_reg; + mhi_cntrl->read_reg64 =3D mhi_pci_read_reg64; + mhi_cntrl->write_reg64 =3D mhi_pci_write_reg64; mhi_cntrl->status_cb =3D mhi_pci_status_cb; mhi_cntrl->runtime_get =3D mhi_pci_runtime_get; mhi_cntrl->runtime_put =3D mhi_pci_runtime_put; --=20 2.34.1 From nobody Fri Sep 25 03:17:52 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3F34548F01E for ; Thu, 17 Sep 2026 07:08:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628930; cv=none; b=sOovwuSErf1ItKRbGPZ2LZgPmBAOZpTJjbm2nDpEWQyahzn7ufNXoP8CvmHpGriV2cG9wchM/bYYdncH/Y0JrxSfEVC5w3eANVFhGW7Ue9yCauJ7veMpmMpEteCJKzGMzcfy9u6dmEZfHANkVKgSnUwF3HoCg+Z1iX0YN4XWWSw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628930; c=relaxed/simple; bh=OED1Xg9S3SY51ta3t3mrt819UPQ3wW6IVv1lWH/7UEk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=V3kr3kD1Qht/5ZbcaalvRXdopH7Ag4g7+0R0M/o9pQbxLEziWICk+rJTktGPVYKsTvY0UARE8fS7PjQD+Lm3wkOrzaP3NEOZ7g84mKu0cXNV2k7MslrbMNZU0j9PXt7vdQEwhmB3Bckv6Quo/hSZm6vev6l7uyHty7+CfV2FAdQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=dJsDnUwm; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=RHwPOUSW; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="dJsDnUwm"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RHwPOUSW" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68H60sDt1031517 for ; Thu, 17 Sep 2026 07:08:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= gYxybknD8fyl/ZIeJU/5fWIVVbydgp9JHWKqHgXGOx4=; b=dJsDnUwmZ6T+ylZW MnZ1y7IHLV6y9+rz3xQtFkPBkJNo1DE1wl2nviWAq5klmOKfvA9TEz/FjB94+SOw hfVmoIa0N4aEhtfF5Ecp+sFMN3dJjbivK2NYUGpW7W6eVHZ6Vuv4scbZ7mLoV2T3 oYPejvfUOvHafio2YjPDlm+8V6rPcoKu9CTBptsygt0YWlqfAdSn2QauGyl+QM25 XGLrwXd826ieySuDolaQ46gh4xOGmABPfqr150g8wpIMQ42TGVYuRDWHOdPHNE2U 6/e7fYOlOtbfHTrB1QdkUm+Hsn2gEIF2peyBcYpE7T4GLtcXErb/xUe2zCnpflEI J70hoA== Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gqy7haxbm-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 07:08:48 +0000 (GMT) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-38e1118e4abso1056143a91.0 for ; Thu, 17 Sep 2026 00:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789628927; x=1790233727; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gYxybknD8fyl/ZIeJU/5fWIVVbydgp9JHWKqHgXGOx4=; b=RHwPOUSWyX3XQy2/xnPT6MKRFGbY03xUFvXhmyu0+X3KkVfGy6KpPaHTOnD06gQ5HN JKu4Z1wOnNiLVIkfLdCQBpRjmKyCANcAYy8l/pj+iJ5wtTRcnUAZUMOKr96PRXJ+UHAh l/iTHKEHIBw0Ory7yHWBzcFp0bb7HhpVUJHcO9qg/OJW+Vln0Pv6W24bFjikmDReGayW vdWwX7l102gguOpqq+/6gAVumP3QMjAcS3czAw0sDni2BWGij05koAQBEG9BRBJPPNDR l1tY/n6aJRygKYmrGDjy+0tXpHpqJ/vkS2+1tw+ARH9cOUx4Bkx/ZM2aYuY8q/7vLA6c iiYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789628927; x=1790233727; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=gYxybknD8fyl/ZIeJU/5fWIVVbydgp9JHWKqHgXGOx4=; b=JSrQ6hnHNjMWhAhLyeEcLXkB4KznQz7hlv/nJFSIkei773Qjk8oGcGQ62ujntuIm0A 7DdXv3XQRVyWcs6OZEedsYfRZi2ZN/phq0hQgV97a9cfVn39Nj3mzomjoZkO1yYwuwLB 9AC57tPJA1BsVgz28w6MJwk7ftKjkbXLBqUO66zVYT53Is9XyLWfVAi0r+lkuwYEExuW mPdk+0ShjdFCCaE4GYb53Fmc2agPIb4piTxpvk0gB1rgrQgQi9for48kCmpTFWnjZmod 3gMXTNjv2TJZpWkoU7/8jV2gudOtbHcb9xpm/kLDRST6SAWjbAyTGQmoybfGhguQe+zd FYag== X-Forwarded-Encrypted: i=1; AKwUvBx8tOZdRCYtLhiC6i/z4K6ZXz3HBgPR8mzw04PRMg6HjmGzZV7p0qEEKDnEsmbE+c4HV3MXt7rDqGxLJ0M=@vger.kernel.org X-Gm-Message-State: AFuF++mu4DSOKKBwA850VMluZpmv9zS2ULXAn0cDd0CC3JTz9oSAX6Ns H23j2mTXEOro+S38wkv+dGRtTZSRB2BhHUgpADYlt7yrBj7sIsroy8eW0BywkpLTcq1afaXm6YF KEIyXsSp405KDu2xqR514mxKdC6JuTqbG81+nmVBVL8RY2wlYpjg7VQlsjB9YdZbwL0M= X-Gm-Gg: AYBFou0dFtrZ5P2ZyKhmuHflmwi9/zYtON6O/UDo/+piGBjsfBnaVEczYp77tn0F1qK MMidApj00HiI5RjkZRs5Bhl80JFjHTzpxyqelfmfDTmLEt93DSPsNSl4r7DA3V3gS9SprSzqAMY knozl41IQcISQMQ3LoIvrKVxGJqJwBrqSrHD0Vbp+7Ku0SkD5mhof6eRUB/SbYCSvV/1uDRLi06 7e3Y6MQqiq8l55seDWlRVlsuxBOIQMPyzKz+/Kg4ClF+YMeFHhcGTOdPnW/aeTNtNlQJWBf6yxv M2rY8lxMbEw/TC6fj8ctvPfHGZ8P+jqsRftZAMIVpsDlhbvEysf7i0xmJ2jYgZotTCV+hwWEUD3 lb0YrgXDDW4Rnxr0gNISnBBQ8HRyb/AZY4OQ= X-Received: by 2002:a17:90b:5866:b0:39d:f97c:bb2f with SMTP id 98e67ed59e1d1-39e1e25a32fmr12976114a91.3.1789628927177; Thu, 17 Sep 2026 00:08:47 -0700 (PDT) X-Received: by 2002:a17:90b:5866:b0:39d:f97c:bb2f with SMTP id 98e67ed59e1d1-39e1e25a32fmr12976047a91.3.1789628926542; Thu, 17 Sep 2026 00:08:46 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33bf5e40494sm13280835eec.15.2026.09.17.00.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 00:08:46 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 17 Sep 2026 12:38:06 +0530 Subject: [PATCH v3 5/6] bus: mhi: host: Export mhi_read_reg Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260917-tsc_timesync-v3-5-6826d5d2d527@oss.qualcomm.com> References: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> In-Reply-To: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Richard Cochran Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Krishna Chaitanya Chundru X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789628904; l=768; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=OED1Xg9S3SY51ta3t3mrt819UPQ3wW6IVv1lWH/7UEk=; b=j6FqE8uIa9myda6e0cGJaEMyZV5FzuN+gNvRGsEJK2+iBFQtaMsERaolLY+L5XroL4jWTvl82 pnUZEryBqnfAggYjQK3PyeHlbN+6jhhaD9e1BpY8eiIcZcSeTmvBpbW X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX+iGbgHTjoeot LcfWUH8kDczYH8EgA83nqGH2HYy5h3eZ3QXX0tOwofXzJ/hhSzkjexzMlxGLWWLtANUnMig5Xd5 K9TE3WNbXo3zuKokKB29zaWl4yJPFNuAjqhxzNQUJD69Hfdk2evvhq4q4W+Uf8TeMCiAJnoRDjU wDQm7WRp6Fppzjt4iBpz1o21kyTzfKJJ8p5b6UUTgSDA1EyMSfORRbXCfyGI2pnkUqooEJ1WL6X 9vQQWmFSKiG34f52nO+oHhvz6LV9ZN0PL9TjmuuTfMXNldn3cIcI4KNheyatCPLVLPu8eUAxnKO CLZ8dIKz5eCtLenfHtUe1g3jDcLGM1Ebj0hfkVQD1XQ+zdFjPQeMp71UE5mjPsixnYKrp17+f1H SmmlNF5BdW9LFBz+IrUWojw85PE3/Dv921eewN6dA7PLP6Q3FtcK+P/rcwzmc2oSv0kbH0kgdL3 yMLoWGbTaCLlApZV9Pg== X-Authority-Analysis: v=2.4 cv=L8aI0OT8 c=1 sm=1 tr=0 ts=6aab9200 cx=c_pps a=UNFcQwm+pnOIJct1K4W+Mw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=EUspDBNiAAAA:8 a=V1CThsli6YUvQZXG0mQA:9 a=QEXdDO2ut3YA:10 a=uKXjsCUrEbL0IQVhDsJ9:22 X-Proofpoint-GUID: mOH2DcN1cFyhbjQW1M4SmRGDVCsYBPHb X-Proofpoint-ORIG-GUID: mOH2DcN1cFyhbjQW1M4SmRGDVCsYBPHb X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX73oYZNca8QO4 6PzsTfeaVW9F8Y5W0HPpiUSKH8QRJtoslQWnGvQda8aeYXyt7m3lX1Oh/Bv+y4t/nKPGmDshUNS jIzo6qr5mHY4cKpmaVmq0ShDh9z4ThQ= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_01,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 impostorscore=0 spamscore=0 phishscore=0 bulkscore=0 clxscore=1015 suspectscore=0 adultscore=0 priorityscore=1501 malwarescore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170094 Export mhi_read_reg() so it can be called from other MHI bus modules that are built separately from mhi.ko. Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bus/mhi/host/main.c b/drivers/bus/mhi/host/main.c index bfeb5cf53448..1ca9f781bbdb 100644 --- a/drivers/bus/mhi/host/main.c +++ b/drivers/bus/mhi/host/main.c @@ -22,6 +22,7 @@ int __must_check mhi_read_reg(struct mhi_controller *mhi_= cntrl, { return mhi_cntrl->read_reg(mhi_cntrl, base + offset, out); } +EXPORT_SYMBOL_GPL(mhi_read_reg); =20 int __must_check mhi_read_reg_field(struct mhi_controller *mhi_cntrl, void __iomem *base, u32 offset, --=20 2.34.1 From nobody Fri Sep 25 03:17:52 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5D1C1491591 for ; Thu, 17 Sep 2026 07:08:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628934; cv=none; b=bU7IuRDVkksZ5trYHQBGa6qwpUHHn477UCX1ijS5EWtpu9+si/P96ztTuoF0u2/XfQmEuyBz5CQG79+IE+taBoQYlCopU+rUT9NfmRdCo66jLCRFFBKo2CPJDlShCb4Xewc5l3zF4LItVu0oskyaKrFhw56C4pWYjEySecO6ysE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789628934; c=relaxed/simple; bh=PDFtCkUMe5xgCgX5ms0kKIDJuV9MuZTF0CtXgl87Z4k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gRORGpggxpOlmcbrxL0rjSKOcvLSvdzga0KJtF2XNJt9XWxKIMfakWzX9GUR69Eyk6IghVYb+7F0M8Bw1rBlIycpGSLl3AeSy6zQRX4LIHFs4+N8IUHTbwdth3gTJLrCAz3eBR+4UgeRkm/Ko8K/kCSy0c3XMiOaljlUdY9C3og= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=RW44YZoU; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=RmDF9igX; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="RW44YZoU"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="RmDF9igX" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68H61ESR133120 for ; Thu, 17 Sep 2026 07:08:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= A7dL3ucP/imtNL8M2nWHaBKLW8DZgN5o/nieYjIGjzM=; b=RW44YZoU3AwpllwT pQCrFOiX60XozoBmw1eJYYb7ZQ0Wk5SXjZ2XAPtk55HJckrPWMMRQGPoX9RFFhdF a8ph/wt18EnO7/5L63OruGjTiDgn+hIUzmCY2NZNuj4T2S+7yk338Ii8QeLM864N upp/Bv6QkzF5Og27a64k4jgASi74gF3zV9lj2pycx+oLrX4+GBVDzBcaDlprQ2UT MPh79tPzebPXyQhdDl6WeB+nKDwkAZDvHoAsa/lcLs6QTA5z6ElSvwtD+FxAqtKG rGisxZpunCqQ25GlJV4Gdmbqw1XqKtqceZlTCUEnewl4zNlMOnUHxojv3cjgVoz2 viINAQ== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gqtn549nh-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 17 Sep 2026 07:08:51 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-39e3f521346so422374a91.0 for ; Thu, 17 Sep 2026 00:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789628930; x=1790233730; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=A7dL3ucP/imtNL8M2nWHaBKLW8DZgN5o/nieYjIGjzM=; b=RmDF9igXxld/SLpUhR58DdkAIWIxTMESeNlZ1WZ+92GtLIJCK7aTaPDeH4mN7PJo7p XV4nbAR5SxJ4kGXrNYdh042FXRjhk21XTNxP1nxulCHZOVsJUmUfpOsPMVuOwrYb8AMb hIeNBW0IOnWDySAsHa7mjC6+YBuKZtGtnTFsQXSpob3QehUJtU6kIQTNXScLI3PkfHvG Ilehsw6BWk9vXYIvVtRaNmFXnwjrrLnjCvTiPxXLYXQoXSB4MrvYG8YeLo0P8JjlP1hU S2wdx1MxxRCbb0KucU7X86xCQUGpgO6oJbykq8Z7kL2wtoUPK3lKfAPccI7i0J5+Xq7/ 22Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789628930; x=1790233730; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=A7dL3ucP/imtNL8M2nWHaBKLW8DZgN5o/nieYjIGjzM=; b=iZVRfwryzxQIQPOoLhRkV56IQYy3bE/lGs8QrkL6HABMw5IKnr/oPVzCIJ5q20qAmq A5Qwyl8odUz4FnWK4ztBSRBUCul6velNdhCTYEIEW+IXbGUyK+hVwa2QPvU5sEnIOMxO dLcWeH4lV6J16C4A3UxdLpP+/UfFNt3J/GfIUCW8f0twlX12vQ6ftjBYR9bmm/WbCSX5 SGiZxxzAXaoXeufo+5GXRtvnsKVqDCyvI3D/KqyJMEEGMdAs5/GcL7sY3DYVfpG2ZQBb q7zVY4VzJukQVHvoyUHPEYZ9wXdTm3Cg4ux4eoWgKa8BMdzJftkG788CYzubtpErYVvl rCGA== X-Forwarded-Encrypted: i=1; AKwUvBydZ5jbjW2TPOQlP5bi4V732bxk0WbEOFe9h3r1B4xTh5IvP6mh642dTaaivnYEjMBTbc1HRZLah8ogZCI=@vger.kernel.org X-Gm-Message-State: AFuF++kHwKjzC3Ddrdzqh6dFABTrrblQhKUKipTBdysICxLumWGRk1E2 QUr8qXHf09HzY3+l3sRNN0UqdrlHK2vH7y63Uol1sHq05/T/+DpONeBdRBSTaSYkq8goXP4oaWo HUXPpy3yAS1v1xY+wLR8wk2DbkgHForvqQkgjMN3+SPvm1Bzw61DZg1eYUPFu0Xd+x1s= X-Gm-Gg: AYBFou0J6FeCMa57IX8lXA9tWGUzTxjDsLzMqVlKdXYqGIzqNCnmtZPQQt1VwnQYJjp Dn5FSu1dRPteVFG2id4BBqKLZZldTX2uPh2lrlQsGVgbvu8pLc/mhhyEJ6TiFBLc3K+nGSKxasH aurvdx0lPcYdcpy3ghy6MlxTYCBG8QCaE+H6wz52oQHODilyiNYxvlgyZeg0m/VWgpdCp7/Pkr1 xroyZRaSpdUUpXseKWK0ZawAh1WDHnvZTiJfqzYeSjvmh6T7R0nx9urdT12+8ltzL9P3W1GxLtG SFM99NzJ6Q+bdxIjAr2ly/C2kyqyw12RmraXs3cULmCzayUpf6b32j0WiPpa5kXDbM2l+Pppunh hzUEVBPtNYOXNL1HMgowZ5QD7+K+fcar6e7A= X-Received: by 2002:a17:90b:3ccb:b0:398:ba9e:75ff with SMTP id 98e67ed59e1d1-39e1e52627bmr13473456a91.21.1789628930273; Thu, 17 Sep 2026 00:08:50 -0700 (PDT) X-Received: by 2002:a17:90b:3ccb:b0:398:ba9e:75ff with SMTP id 98e67ed59e1d1-39e1e52627bmr13473403a91.21.1789628929744; Thu, 17 Sep 2026 00:08:49 -0700 (PDT) Received: from hu-krichai-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33bf5e40494sm13280835eec.15.2026.09.17.00.08.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2026 00:08:49 -0700 (PDT) From: Krishna Chaitanya Chundru Date: Thu, 17 Sep 2026 12:38:07 +0530 Subject: [PATCH v3 6/6] bus: mhi: host: mhi_phc: Update the Time sync logic to read 64 bit register value Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260917-tsc_timesync-v3-6-6826d5d2d527@oss.qualcomm.com> References: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> In-Reply-To: <20260917-tsc_timesync-v3-0-6826d5d2d527@oss.qualcomm.com> To: Manivannan Sadhasivam , Jeff Hugo , Richard Cochran Cc: mhi@lists.linux.dev, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Krishna Chaitanya Chundru X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789628904; l=2155; i=krishna.chundru@oss.qualcomm.com; s=20230907; h=from:subject:message-id; bh=PDFtCkUMe5xgCgX5ms0kKIDJuV9MuZTF0CtXgl87Z4k=; b=buSyD+p+9ce7wxdFM3rWvxg7ISBYYLinSYPJpFZVQ/JTKyPD8HFIu4l89pamZwcXJ5OCHBlsx jU9mJ2iYS1iA7Yf4OdTsqm10MM0aO66EN6OZRTSTOs+sENrXkfM0pEk X-Developer-Key: i=krishna.chundru@oss.qualcomm.com; a=ed25519; pk=10CL2pdAKFyzyOHbfSWHCD0X0my7CXxj8gJScmn1FAg= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX1OIGXNeDnLLK yZXVVvVEz3qlKKnxahOmfh35IqKlpRTZw6AXp7sXTxO5xKq37c1guVQjeEfxfbBnMJKfukYpkVG yy2erdSKL6TVOceLNKZDCTUseOr5TmNJBf2JQa3nUHt/YbXXUYZ4NXosd8zxm//ahO7MxbKGL1Q 8EwRZBqYqH5iN/u2hg5eEbsGvnr2eEDWS31/EFPJUV5TcrXFcTFO8hbAM99s9oprIMtqiXZwV6a leWh6rNmLAsyg1zSb5Ht511KHt4Ck4rAztA6pIFv8fMuLe1mdYUQ4iTljs0mzSP4qirqE8GCuBO 2rDfQmmw+VWxFCgZ4L6Mb/ID/6tmdaqkroFYcVb50KuCpBOf7PD/4poRTqvV179HPan11vxx86E 6Vur9WKJ/zKSD7OdLSM6/K4rB0A/vpwwR/TErAcHAm9Yi9acOjtUVJy4k8+fTA6FNxnYvDaMG3T efIAAG5h0o9Bm+PXbhQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTE3MDA5NCBTYWx0ZWRfX1lE+hSS71qKM qyfH+cMDgRsnNXMngb5NG9QIgj4wRGQkoMUkmRa99aN0J7RmwFG3XDzG7zpUYhb/ttVMa+RSekq LQ+nv/FZweXAwShTbckvvmTWqCFsFrM= X-Proofpoint-ORIG-GUID: _Z6dOQ9JQ9Zk1ZFQqW2At5BgpYWxz5bg X-Authority-Analysis: v=2.4 cv=K7O3jCWI c=1 sm=1 tr=0 ts=6aab9203 cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yx91gb_oNiZeI1HMLzn7:22 a=EUspDBNiAAAA:8 a=-ftiAGXnolOcdJctExEA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 X-Proofpoint-GUID: _Z6dOQ9JQ9Zk1ZFQqW2At5BgpYWxz5bg X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-17_01,2026-09-16_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 phishscore=0 bulkscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 adultscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609170094 Instead of reading low and high of the mhi registers twice use 64 bit register value to avoid any time penalty. Signed-off-by: Krishna Chaitanya Chundru --- drivers/bus/mhi/host/mhi_phc.c | 47 ++++++++++++++++++++++++--------------= ---- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/drivers/bus/mhi/host/mhi_phc.c b/drivers/bus/mhi/host/mhi_phc.c index 783f05b5d144..b1d10431bd30 100644 --- a/drivers/bus/mhi/host/mhi_phc.c +++ b/drivers/bus/mhi/host/mhi_phc.c @@ -57,26 +57,33 @@ static int mhi_get_remote_tsc_time_sync(struct mhi_devi= ce *mhi_dev, struct mhi_t =20 ptp_read_system_prets(sts); =20 - /* - * Read the high dword twice around the low dword and retry if it - * changed, to avoid a torn read across a device-side rollover. - */ - do { - ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, - TSC_TIMESYNC_TIME_HIGH_OFFSET, &hi); - if (ret) - break; - - ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, - TSC_TIMESYNC_TIME_LOW_OFFSET, &lo); - if (ret) - break; - - ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, - TSC_TIMESYNC_TIME_HIGH_OFFSET, &time->t_dev_hi); - } while (!ret && hi !=3D time->t_dev_hi); - - time->t_dev_lo =3D lo; + if (mhi_cntrl->read_reg64) { + ret =3D mhi_read_reg64(mhi_cntrl, mhi_tsync->time_reg, + TSC_TIMESYNC_TIME_LOW_OFFSET, &val); + time->t_dev_lo =3D (u32)val; + time->t_dev_hi =3D (u32)(val >> 32); + } else { + /* + * Read the high dword twice around the low dword and retry if it + * changed, to avoid a torn read across a device-side rollover. + */ + do { + ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, + TSC_TIMESYNC_TIME_HIGH_OFFSET, &hi); + if (ret) + break; + + ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, + TSC_TIMESYNC_TIME_LOW_OFFSET, &lo); + if (ret) + break; + + ret =3D mhi_read_reg(mhi_cntrl, mhi_tsync->time_reg, + TSC_TIMESYNC_TIME_HIGH_OFFSET, &time->t_dev_hi); + } while (!ret && hi !=3D time->t_dev_hi); + + time->t_dev_lo =3D lo; + } =20 ptp_read_system_postts(sts); =20 --=20 2.34.1