From nobody Thu Oct 9 02:21:20 2025 Received: from mx0b-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 9EB291FDA6D for ; Fri, 20 Jun 2025 17:37:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750441035; cv=none; b=pLL3Cma4PmdmjpA8ZPHpHYKP2+osRflym54F+R879gTOGFP/41H+uQG4JL6j287YKzZNcCPI8knqAedjSHg50RByKI6b5Pg6T3dQH1VgW5LHy9e8jGeMdAkFtpefMwAi3mc85+JwKpst4G3lt62ONccMNyn33M5ZwzEoAl3+RGI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750441035; c=relaxed/simple; bh=PS5s/QBW43OvzQxcKYQhEXkr0Batot5Uxg2zA/CNRwU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=i3pl6PaeQB5UYlLllzsghwcbYw/Zbvzt8vCLYjclabMnt/b+VooRm/GTwRmWFD5xWYuvKzXfy5in/jqmyuAQWMHbu56wtrTtgKkYtcb3HVCI4LmFCVOxqKZNi1zAlq7QVtx8d+EtEveBVKMFA+c08u5g2kNjk95Xg/Voyk0LjOw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=RfUgABe+; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="RfUgABe+" Received: from pps.filterd (m0375855.ppops.net [127.0.0.1]) by mx0b-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55KEeA4m025086; Fri, 20 Jun 2025 13:37:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=LFhHY 4/QVtIa0kQIgs/Sgv+DYjNYIL6mAP1r7dJR0Rw=; b=RfUgABe+9IpWGGGmhZMao 0OVvYG6tXvPU7O/xX50yJy2b+fNshgx3/H6zCyUrU6R5/taKlVSTcrhmBXahZlLc PVlPqvvHdp/me073w4F+Cq7RUrKdQBDsi7Un+BPk3RCEUgmgOd0SdlIZcRRWOUkr jibX1t10/zxrBFDCOOnYKvMHOjPhDitXFm/fayMPC65b3kMgZbSC3HJ+bwNGB0Z2 pifLaocR0uCguVP3brT8NlT3Ji9ja+j8N25DCTpxa0wRNq6s0xPWyrWyfaEnywpR oqo2oBuybepRrVqH3Kd8lpTGFGot4U1/vXM6NKWbJqaI5C59loij3np23zqFvwXz Q== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0b-00128a01.pphosted.com (PPS) with ESMTPS id 47d350auvn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Jun 2025 13:37:00 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 55KHaxTG008660 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 20 Jun 2025 13:36:59 -0400 Received: from ASHBCASHYB4.ad.analog.com (10.64.17.132) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 20 Jun 2025 13:36:59 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBCASHYB4.ad.analog.com (10.64.17.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 20 Jun 2025 13:36:59 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Fri, 20 Jun 2025 13:36:59 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.32.14.29]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 55KHajbK030665; Fri, 20 Jun 2025 13:36:49 -0400 From: Jorge Marques Date: Fri, 20 Jun 2025 18:54:59 +0200 Subject: [PATCH 1/3] i3c: master: Add inline i3c_master_readsl and i3c_master_writesl 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: <20250620-i3c-writesl-readsl-v1-1-e0aa1c014dff@analog.com> References: <20250620-i3c-writesl-readsl-v1-0-e0aa1c014dff@analog.com> In-Reply-To: <20250620-i3c-writesl-readsl-v1-0-e0aa1c014dff@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , "Jorge Marques" X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1750438498; l=1842; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=PS5s/QBW43OvzQxcKYQhEXkr0Batot5Uxg2zA/CNRwU=; b=mEAEkZYVoburTPfWo12Tpjwgh0p1lOuw69ATrEK+H/3fePr3tg5OSfgLxOt3CF5AQKhWw1Zqc O7gDLrOq6CjBifIWM/+Z6pEfrXJTl8bn3GJBmyvxKYvHcGXlmNxeHfj X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=WJB/XmsR c=1 sm=1 tr=0 ts=68559c3c cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=gAnH3GRIAAAA:8 a=QMVJh2PuZ69kPaAn0y8A:9 a=QEXdDO2ut3YA:10 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjIwMDEyMyBTYWx0ZWRfX4DPtIMrfW8Ih ybiw3lJtKnsPrM/DQ/LkX8RUzRmSDkBnnlVlFqOrPIAeuN44382zmsYIPZ6OL7Ky3h6yvY/d3iQ 9ekbfZPk9dXThwWNxhXJU9Nq0zIrhd4OFhhtB3mTL3o4bgF2HsdFBj0M6cqdoKXKrUKYHTGVlG8 JkOprhkzDG5NyvcgLy+Y+U5Pj1tWJjSczq+lVcd4Y1caLWAXR83qxntE55GzLCP8JmBYu5UYni1 N87WF+eVkEnY+/MIpcBaZrJOmTt0k0qtaqV2qZov1ZnPWGaishx94HPWHZTHOicVNGoFGvVim+H dS5rrizNL6z61lZ8jLTbs/0Ew6429Znn9fiJN76o9Vy9JzWcpDSeszVBWEGw5rVF2drj5NuvcvU EyBE3dVIyjpO7Y8geoiVDyZduM7w70XVzAqkHTVbP9iXszyOsvC9Knu1lmZMIcvGX0YlFRe4 X-Proofpoint-ORIG-GUID: QjVbuyybouWu7aZyG29c2_lSPx1DZvCu X-Proofpoint-GUID: QjVbuyybouWu7aZyG29c2_lSPx1DZvCu X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-20_07,2025-06-20_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxlogscore=720 suspectscore=0 phishscore=0 mlxscore=0 bulkscore=0 adultscore=0 impostorscore=0 clxscore=1011 spamscore=0 lowpriorityscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506200123 The i3c abstraction excepts u8 buffers, but some controllers have a bus width of 32-bits and don't support flagging valid bytes, so it is required to read/write long words and to use memcpy on the remainder of the number of bytes by 32-bits to not write/read outside the buffer bounds. Signed-off-by: Jorge Marques Suggested-by: Wolfram Sang --- include/linux/i3c/master.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index c67922ece617d6320c0c7e4838c2e7edda8c19f5..11401f2acb42e4d3a60df33b7c7= 94d8a0360cdc2 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -674,6 +674,42 @@ i3c_master_get_bus(struct i3c_master_controller *maste= r) return &master->bus; } =20 +/** + * i3c_master_writesl- Write bytes to long memory region from byte array + * @addr: Register to write to + * @bytes: Pointer to the data bytes to write + * @nbytes: Number of bytes to write + */ +static inline void i3c_master_writesl(void __iomem *addr, const u8 *bytes, + int nbytes) +{ +writesl(addr, bytes, nbytes / 4); + if (nbytes & 3) { + u32 tmp =3D 0; + + memcpy(&tmp, bytes + (nbytes & ~3), nbytes & 3); + writel(tmp, addr); + } +} + +/** + * i3c_master_readsl - Read bytes from long memory region to byte array + * @addr: Register to read from + * @bytes: Pointer to the buffer to store read bytes + * @nbytes: Number of bytes to read + */ +static inline void i3c_master_readsl(const void __iomem *addr, u8 *bytes, + int nbytes) +{ +readsl(addr, bytes, nbytes / 4); + if (nbytes & 3) { + u32 tmp; + + tmp =3D readl(addr); + memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3); + } +} + struct i3c_generic_ibi_pool; =20 struct i3c_generic_ibi_pool * --=20 2.49.0 From nobody Thu Oct 9 02:21:20 2025 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 5ED2F2D3A6E for ; Fri, 20 Jun 2025 17:37:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750441047; cv=none; b=ZJUUlM82iA3xOkTWCDfbeNnipZ6wYZbj7Bpxqq1+IuM4jJ0FRtFs7x6ujxLwhHBzp9tkiMX49ShI6gX8iE5mhSjSi79pjsgaO/Z2fuGPww9Xzh9UlwwMSryJz77EgbwK0+KsZgI6+u9saXDZo72bb8DVHYcl8p1Bu6rYfWqcnH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750441047; c=relaxed/simple; bh=HEHqQQ7md4AtnD1WNTKFI9O4LORm/dcbnxJwhQIFoMA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=JUkfi+3z7K6p1yFedKQtm5P0iHjOXEpevpIVKDjTpyRGVIAjQiStTe7n4A9zZUDUqqqlGu0TvJtR/HqfsieTF3BlRsKXM3J2C3xpWL24FmtmIrlxlHvmAb1Oz4W2sFjVtA6mx6+ptAiw2XPiMkgGFWDjyyGn1yWHy25LvZwXwB0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=fQ3l7e4g; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="fQ3l7e4g" Received: from pps.filterd (m0167089.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55KF6rR4002421; Fri, 20 Jun 2025 13:37:17 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=RldU0 ApsscJBkOsNIbr0aQ4uVjATZO+7iODdIhAK34M=; b=fQ3l7e4gxyPX+bgIdqVq+ 1mBc04cMvcSC/SZ4D56A/DLwxQRR+qdpYkPFQiTVmapq0UalzGYEij1COU/grBtC 29mF0DsB4N7J/Io7+kG9Z/J1NZ48T2NEWW9edPF2ksDcHtNrCLHdsHsSYVNHscsj ewym8j/oqtNxlmspCk7BWOnGSZuXTgReM3yjwZ9lYuyQCevwdE/+sDAmHKgMwEyu AjDegcsMKPRrHuy+klpdq0YLLxMpYmArZ53CHfxvR2DDqNTFM04Rr3J9+SzXkOKK hFUbKjHCbdSMoKMyqlSiTxqCM4EQ7QH9r8RUwMBcItdzvRAwYm/u4B1iP7WriESR Q== Received: from nwd2mta4.analog.com ([137.71.173.58]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 47d3bntqag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Jun 2025 13:37:17 -0400 (EDT) Received: from ASHBMBX9.ad.analog.com (ASHBMBX9.ad.analog.com [10.64.17.10]) by nwd2mta4.analog.com (8.14.7/8.14.7) with ESMTP id 55KHbGFB008685 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 20 Jun 2025 13:37:16 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX9.ad.analog.com (10.64.17.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 20 Jun 2025 13:37:16 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Fri, 20 Jun 2025 13:37:16 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.32.14.29]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 55KHb0Iq030676; Fri, 20 Jun 2025 13:37:04 -0400 From: Jorge Marques Date: Fri, 20 Jun 2025 18:55:00 +0200 Subject: [PATCH 2/3] i3c: master: cdns: Use i3c_master_writesl and i3c_master_readsl 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: <20250620-i3c-writesl-readsl-v1-2-e0aa1c014dff@analog.com> References: <20250620-i3c-writesl-readsl-v1-0-e0aa1c014dff@analog.com> In-Reply-To: <20250620-i3c-writesl-readsl-v1-0-e0aa1c014dff@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , Jorge Marques X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1750438498; l=2002; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=HEHqQQ7md4AtnD1WNTKFI9O4LORm/dcbnxJwhQIFoMA=; b=c0aVDhL8Nh127EsCHwm2w9l5CSYzxla9ItyGfLOtB6WXpUw54tBogpQrEl5ViEudhL2aGW9Td d0DKvr2qlb7AOYzfCWXPYxJJSwSzgsBVKvZnC1qQYGccmfDPTN4a0Vv X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Proofpoint-GUID: mNXToBSh2MktLd6_M9tcFYqsNKPdouM2 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjIwMDEyNCBTYWx0ZWRfXyq1g304CgMWr 2K9P7c/4CiODmXG0ZwuB9M511xAZ+JPkzaYOeHbAybNkmOSThlxmJdqYTRorjJaxN05VLvDaGRK mLbktTcD0x15LNDRuBIOWVGuNl2nwUChpNpQsK94FrntUZTwK8iI++7CVCtZgN7hk8CDtJ21PNd JY0ZYD2UbyzKbcFB0SKcbzMaWKB5vkfp+uIaCLmDtbUezq/pABHkDxEnFjsNxJOW9GTVsS10njR 0+8VrueacdN2gi91oer1FTjpgEMVOrk/lilwuCLk/l0jEfAM2hP+mOv2RotDI4ObMmBv5aue4nO sGZHFFZDCuUFKhkFvx++DcB89KDzPJziJ2IMHVZp8q+Fz+076nb72zzV0eIY97zmGjztPQOFtSh LyJUu18TRQvb5VNVBUvBw7nkprIacxTaAruQj9MEs4jduaiLm9DUcNaILzMIh3qrWwCxL2aH X-Authority-Analysis: v=2.4 cv=c+irQQ9l c=1 sm=1 tr=0 ts=68559c4d cx=c_pps a=3WNzaoukacrqR9RwcOSAdA==:117 a=3WNzaoukacrqR9RwcOSAdA==:17 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=gAnH3GRIAAAA:8 a=-g-jYOOAgZ6Gv6mRHeUA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-ORIG-GUID: mNXToBSh2MktLd6_M9tcFYqsNKPdouM2 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-20_07,2025-06-20_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 clxscore=1011 malwarescore=0 lowpriorityscore=0 impostorscore=0 suspectscore=0 mlxlogscore=693 adultscore=0 mlxscore=0 spamscore=0 phishscore=0 priorityscore=1501 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506200124 Use the inline write/read methods common to controllers that have a bus width of 32-bits. Signed-off-by: Jorge Marques --- drivers/i3c/master/i3c-master-cdns.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/drivers/i3c/master/i3c-master-cdns.c b/drivers/i3c/master/i3c-= master-cdns.c index fd3752cea654954ed1e37337754e45fddbbbf68e..6775751144ae86c1795abf45cee= de17e1961bb74 100644 --- a/drivers/i3c/master/i3c-master-cdns.c +++ b/drivers/i3c/master/i3c-master-cdns.c @@ -427,25 +427,13 @@ to_cdns_i3c_master(struct i3c_master_controller *mast= er) static void cdns_i3c_master_wr_to_tx_fifo(struct cdns_i3c_master *master, const u8 *bytes, int nbytes) { - writesl(master->regs + TX_FIFO, bytes, nbytes / 4); - if (nbytes & 3) { - u32 tmp =3D 0; - - memcpy(&tmp, bytes + (nbytes & ~3), nbytes & 3); - writesl(master->regs + TX_FIFO, &tmp, 1); - } + i3c_master_writesl(master->regs + TX_FIFO, bytes, nbytes); } =20 static void cdns_i3c_master_rd_from_rx_fifo(struct cdns_i3c_master *master, u8 *bytes, int nbytes) { - readsl(master->regs + RX_FIFO, bytes, nbytes / 4); - if (nbytes & 3) { - u32 tmp; - - readsl(master->regs + RX_FIFO, &tmp, 1); - memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3); - } + i3c_master_readsl(master->regs + RX_FIFO, bytes, nbytes); } =20 static bool cdns_i3c_master_supports_ccc_cmd(struct i3c_master_controller = *m, @@ -1330,12 +1318,7 @@ static void cdns_i3c_master_handle_ibi(struct cdns_i= 3c_master *master, buf =3D slot->data; =20 nbytes =3D IBIR_XFER_BYTES(ibir); - readsl(master->regs + IBI_DATA_FIFO, buf, nbytes / 4); - if (nbytes % 3) { - u32 tmp =3D __raw_readl(master->regs + IBI_DATA_FIFO); - - memcpy(buf + (nbytes & ~3), &tmp, nbytes & 3); - } + i3c_master_readsl(master->regs + IBI_DATA_FIFO, buf, nbytes); =20 slot->len =3D min_t(unsigned int, IBIR_XFER_BYTES(ibir), dev->ibi->max_payload_len); --=20 2.49.0 From nobody Thu Oct 9 02:21:20 2025 Received: from mx0a-00128a01.pphosted.com (mx0a-00128a01.pphosted.com [148.163.135.77]) (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 8C3382E6125 for ; Fri, 20 Jun 2025 17:37:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.135.77 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750441062; cv=none; b=YlaHFOZiELCaWqpWE25ZSYfSZqg+qfwc4EZB55p3TCNgspQgzSR6Ul05OIJDhb7PR+0vPHtJnyF/HrI8pO1ctBxrnfstA/36lMWP6u9ko90Txy9+azB+BP6phtjqz+nBIvvHXmRsFby7lfpAYxhAyU58k6c67HP9jpwvS0qTB8k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750441062; c=relaxed/simple; bh=BAY7XByXgMFVNwFKD6933qf59V3/WCIDwbV+JGWtPFk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=fapYA9xi0+jjY9Fm+Vc/x7Gpkjc32s/VmCkvEko/mZP47vq4u/CqSRjUloJO74vPdavPWg5QVtcwRIbNXHAzo6UXp3olmC45j0Vt3FHTima2VX+mE5G3FeLWDOrcd5hdNIV5MMk8QmQqfDzC3qp35ox7CRLnl6ZK9lbqkFIejJo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com; spf=pass smtp.mailfrom=analog.com; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b=by1XIGAy; arc=none smtp.client-ip=148.163.135.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=analog.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=analog.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=analog.com header.i=@analog.com header.b="by1XIGAy" Received: from pps.filterd (m0167088.ppops.net [127.0.0.1]) by mx0a-00128a01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 55KGQQBt019233; Fri, 20 Jun 2025 13:37:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=analog.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=DKIM; bh=irglX W9m1Q5FXxONXVbLB2k7lP7/bhTQkoZzemTVQjE=; b=by1XIGAyTkYpfgphefAlF t42OJltXrh9jIRPSGSn9e8hx8L10rxMQ/l/Q5rmbGUeuMpaQyaWZmMoMB6ZA7UX+ vLjSEKj9HvgfOEW1kEzhJ3aPCs733A1i5E4kgx4GUrG0E4Vv6Jx2Fj1F+rtUtd6l Wfq8KEF4Y/wj8KlQ85zVxU64s8Jv759U942NQPc2g0LNFCXbiO9HncquEsLuuPNv c486jV3KbjKvlH8sPWuh67OfVsake/llOjYtarDXmJuK+Xkw/Uy5VGDhlnQOF34X pQhX9BMaCyge8zOb7F04Ykld6IgNSzXQVq2KmLCJPQADcQ6h/JopH1+HsN6ARIjQ g== Received: from nwd2mta3.analog.com ([137.71.173.56]) by mx0a-00128a01.pphosted.com (PPS) with ESMTPS id 47d21du56j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 20 Jun 2025 13:37:31 -0400 (EDT) Received: from ASHBMBX8.ad.analog.com (ASHBMBX8.ad.analog.com [10.64.17.5]) by nwd2mta3.analog.com (8.14.7/8.14.7) with ESMTP id 55KHbU5X032843 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 20 Jun 2025 13:37:30 -0400 Received: from ASHBMBX8.ad.analog.com (10.64.17.5) by ASHBMBX8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1748.10; Fri, 20 Jun 2025 13:37:30 -0400 Received: from zeus.spd.analog.com (10.66.68.11) by ashbmbx8.ad.analog.com (10.64.17.5) with Microsoft SMTP Server id 15.2.1748.10 via Frontend Transport; Fri, 20 Jun 2025 13:37:30 -0400 Received: from HYB-DlYm71t3hSl.ad.analog.com (HYB-DlYm71t3hSl.ad.analog.com [10.32.14.29]) by zeus.spd.analog.com (8.15.1/8.15.1) with ESMTP id 55KHbEPc030681; Fri, 20 Jun 2025 13:37:18 -0400 From: Jorge Marques Date: Fri, 20 Jun 2025 18:55:01 +0200 Subject: [PATCH 3/3] i3c: master: dw: Use i3c_master_writesl and i3c_master_readsl 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: <20250620-i3c-writesl-readsl-v1-3-e0aa1c014dff@analog.com> References: <20250620-i3c-writesl-readsl-v1-0-e0aa1c014dff@analog.com> In-Reply-To: <20250620-i3c-writesl-readsl-v1-0-e0aa1c014dff@analog.com> To: Alexandre Belloni , Frank Li , =?utf-8?q?Przemys=C5=82aw_Gaj?= CC: , , Jorge Marques X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1750438498; l=1902; i=jorge.marques@analog.com; s=20250303; h=from:subject:message-id; bh=BAY7XByXgMFVNwFKD6933qf59V3/WCIDwbV+JGWtPFk=; b=VntJQT3NsYb6lAlu+PDBwgBaqastKOhto2s4j6qCOIKpuqVPXTJJr0UuD6iHWyBVRVX+i4o/I DxypYZkZyejBxaMBAnqDRJx9jcuyZvtXNDopkllWlsrdCBxEjzRKP77 X-Developer-Key: i=jorge.marques@analog.com; a=ed25519; pk=NUR1IZZMH0Da3QbJ2tBSznSPVfRpuoWdhBzKGSpAdbg= X-ADIRuleOP-NewSCL: Rule Triggered X-Authority-Analysis: v=2.4 cv=Z4zsHGRA c=1 sm=1 tr=0 ts=68559c5c cx=c_pps a=PpDZqlmH/M8setHirZLBMw==:117 a=PpDZqlmH/M8setHirZLBMw==:17 a=IkcTkHD0fZMA:10 a=6IFa9wvqVegA:10 a=gAnH3GRIAAAA:8 a=lSS91xS1W9WTNWmX6BAA:9 a=QEXdDO2ut3YA:10 X-Proofpoint-GUID: fx9dTcQQoCQiWBlP4T6W77ojUQ7kCb0W X-Proofpoint-ORIG-GUID: fx9dTcQQoCQiWBlP4T6W77ojUQ7kCb0W X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNjIwMDEyNCBTYWx0ZWRfX8eh/UKl0Ubpg tFiwRPhqG85qzLKT9G8fNiNh0TNyLEgodBi3pC6xwwtZ1cHM2cNFSRuo00Xj5bDzDciOZ8oNykX MERZWvxq+nabbfoUuULr6JLOqBBlz2CPyO8h4YbqjDpMgA+uHLBuYqxrf/MrdworARdGZrAzzVT gMgdes6MvpD1AYPEpCWmHm25DA6GDaGQhvMDB+/Kk7KaPzNxajz7r0WW6iuGsxamcOhPu3SzpHR 7QLYv/8H6X21i2W83YW3OTiDAGlUMeo8EgJUw07JoBUtBSwLlPnSAw0RgFJ/YwhV+YEsxin6f77 PP/V5DxMbZbUUEAJtqYy5w+/6BigGvSTrAAEWfon0dAJzLx0r+pffMSxW+Maq4dOObOT82rSP0L dJWQUZO6XbKq8BoELj3YiGX4r49QbTmy6WHnVggyJspioTR9Sri2pgF1ACroGty+0jvXT8JG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.0.736,FMLib:17.12.80.40 definitions=2025-06-20_07,2025-06-20_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 phishscore=0 bulkscore=0 spamscore=0 mlxlogscore=723 suspectscore=0 clxscore=1015 malwarescore=0 priorityscore=1501 adultscore=0 lowpriorityscore=0 mlxscore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2506200124 Use the inline write/read methods common to controllers that have a bus width of 32-bits. Signed-off-by: Jorge Marques --- drivers/i3c/master/dw-i3c-master.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c= -master.c index 611c22b72c1572ddf717c8ad473e44a3b8fcceaf..eb1346409829dc64cdd1d738e98= 70993d38bbb0f 100644 --- a/drivers/i3c/master/dw-i3c-master.c +++ b/drivers/i3c/master/dw-i3c-master.c @@ -336,37 +336,19 @@ static int dw_i3c_master_get_free_pos(struct dw_i3c_m= aster *master) static void dw_i3c_master_wr_tx_fifo(struct dw_i3c_master *master, const u8 *bytes, int nbytes) { - writesl(master->regs + RX_TX_DATA_PORT, bytes, nbytes / 4); - if (nbytes & 3) { - u32 tmp =3D 0; - - memcpy(&tmp, bytes + (nbytes & ~3), nbytes & 3); - writesl(master->regs + RX_TX_DATA_PORT, &tmp, 1); - } -} - -static void dw_i3c_master_read_fifo(struct dw_i3c_master *master, - int reg, u8 *bytes, int nbytes) -{ - readsl(master->regs + reg, bytes, nbytes / 4); - if (nbytes & 3) { - u32 tmp; - - readsl(master->regs + reg, &tmp, 1); - memcpy(bytes + (nbytes & ~3), &tmp, nbytes & 3); - } + i3c_master_writesl(master->regs + RX_TX_DATA_PORT, bytes, nbytes); } =20 static void dw_i3c_master_read_rx_fifo(struct dw_i3c_master *master, u8 *bytes, int nbytes) { - return dw_i3c_master_read_fifo(master, RX_TX_DATA_PORT, bytes, nbytes); + i3c_master_readsl(master + RX_TX_DATA_PORT, bytes, nbytes); } =20 static void dw_i3c_master_read_ibi_fifo(struct dw_i3c_master *master, u8 *bytes, int nbytes) { - return dw_i3c_master_read_fifo(master, IBI_QUEUE_STATUS, bytes, nbytes); + i3c_master_readsl(master + IBI_QUEUE_STATUS, bytes, nbytes); } =20 static struct dw_i3c_xfer * --=20 2.49.0