From patchwork Mon Sep 2 07:42:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 13786871 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EC72BCD13CF for ; Mon, 2 Sep 2024 07:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M6uJEhYo1wgA15wfbrz/2U4r9R3nPVkJpmSXzlK2nlI=; b=19ak5NxWd5S7KhPg9f+to+TI4P LnpZr+15yKyBLcsk+TJL5ghh/JNAMCD6PA6jGpc2wqkean3CCg2U2sayik4dQdnB+pCiEGqu3XOza 1WuaawVLDXD8i/Bdpb4atjEcZuB0Nsb0DkrCPw+gdNb2hY/JhdCCsQB/ltv8Yb3oZby7NSHbZ8Rlc 00oYtVd5Mypfg5Klu/UsQ0P4UxPooSRvvmwUve9QMIgEVQFKRsHVfV6zWA1/anP4E39Zl19dR2nY7 DWJiQbTslxkwO/hrGtm8A6AzLHxNSiOcqOiAvRUhEOsukpJHu6UEDs+lpt34h82ilkOfLheoATfp0 kNe5NWiw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl1mH-0000000DMe8-1kFq; Mon, 02 Sep 2024 07:47:09 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl1is-0000000DLux-2ojg for linux-arm-kernel@lists.infradead.org; Mon, 02 Sep 2024 07:43:39 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5c25f01879fso535439a12.1 for ; Mon, 02 Sep 2024 00:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725263017; x=1725867817; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M6uJEhYo1wgA15wfbrz/2U4r9R3nPVkJpmSXzlK2nlI=; b=jT6uJac81S967QGxnbcrweJYrtljHUZAaWUmcdoBgDrYr4pQGYscIPra+SGtmtkFqI RlR8LAIhMwRTY39SFnp0l0BhfcS8Mp18Q5PSQdyl2XlZYc9uxfC5gRbqvpS0dgfzHppL CRbNjOmPdYaYvMt3+xMtX3atFRX/kXjZBmamEQNQvGsdsV1MdsihKUryeOtZGH9RlqhK /cNcIfSZUJPLpIvxmnmgLrScN9TBMp75XUTIlVchmT8fVCNwtmhwYqMJHm6rKHPvpSC4 6T7JIWDMKdxupABerJQI8fe5mazm6bT5H+i6NUwxpMNqJK15QDLl5trCD52m8GBSHHX1 iR2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725263017; x=1725867817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M6uJEhYo1wgA15wfbrz/2U4r9R3nPVkJpmSXzlK2nlI=; b=dQrQ6pfWu0zswuFQD8Dga7ksCXgWTxBjbAojse1TiiXEMhnM+8gF+fhJvN8cw95DJ9 VsnotLfEI+2hoYMlL3vzg6++oDBcnJ0NV+C2y+0ZnKD9KjlD5+s3jyq2IyDUm8YEF1cY ANuQ7BM8esIA+Vi5A2AW3/QEhctNNvbs2+i5kqpVhYGCzg3rzqkav8yBBtgAOw2IjsBD P8Xpz81xQLzaJudjOb5MA/k1o+npip+Xp0s/xxG7ZnpEqpEzaXKG2PaMH7mDdbC+b7Gh AsWYkGby5cX+5L8BzBj6X7moQ+kloyJXqHMzXvZDlghBS03/KsioDkPTfg2eNetwfSl6 gGiw== X-Forwarded-Encrypted: i=1; AJvYcCX1wJ+2stdqo/5F1yzvzKysAJmXHZHeeCwxDRvauLbve6qdUQpiDm2AT8H/YiAQuk4A8sx8KrMNB2IXC1vKKdGU@lists.infradead.org X-Gm-Message-State: AOJu0Yx3UoNMCTQXvw8Wu18MVmLqvVe+2OxyDYSB0pGmCCCnaVtafGwS 2Gh1sET++i3OQVOhtk6GqZT3mnYzPlR1f0gCt3q8vahjtt/wpwnW X-Google-Smtp-Source: AGHT+IF+gPp7Guk0AwVW4KWTtsV4XPy/sheRsdCIms+DFiV6eNdF0CbTkwUp9ipAFhx6UBzgr4w99g== X-Received: by 2002:a05:6402:35c4:b0:5c2:2ba2:6841 with SMTP id 4fb4d7f45d1cf-5c24236d23bmr4206113a12.20.1725263016697; Mon, 02 Sep 2024 00:43:36 -0700 (PDT) Received: from eichest-laptop.lan ([2a02:168:af72:0:3786:cf07:4865:dc9f]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c24ff04551sm1975931a12.35.2024.09.02.00.43.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 00:43:36 -0700 (PDT) From: Stefan Eichenberger To: o.rempel@pengutronix.de, kernel@pengutronix.de, andi.shyti@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, francesco.dolcini@toradex.com, Frank.Li@nxp.com Cc: linux-i2c@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Eichenberger Subject: [PATCH v3 3/4] i2c: imx: use readb_relaxed and writeb_relaxed Date: Mon, 2 Sep 2024 09:42:03 +0200 Message-ID: <20240902074330.6349-4-eichest@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240902074330.6349-1-eichest@gmail.com> References: <20240902074330.6349-1-eichest@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_004338_748111_B2B561BC X-CRM114-Status: GOOD ( 14.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Stefan Eichenberger Use the relaxed version of readb and writeb to reduce overhead. It is safe to use the relaxed version because we either do not rely on dma completion, or we use a dma callback to ensure that the dma transfer is complete before we continue. Signed-off-by: Stefan Eichenberger Acked-by: Oleksij Rempel --- drivers/i2c/busses/i2c-imx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 2e86d363e186d..9917f3e1d06cf 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -313,13 +313,13 @@ static inline int is_vf610_i2c(struct imx_i2c_struct *i2c_imx) static inline void imx_i2c_write_reg(unsigned int val, struct imx_i2c_struct *i2c_imx, unsigned int reg) { - writeb(val, i2c_imx->base + (reg << i2c_imx->hwdata->regshift)); + writeb_relaxed(val, i2c_imx->base + (reg << i2c_imx->hwdata->regshift)); } static inline unsigned char imx_i2c_read_reg(struct imx_i2c_struct *i2c_imx, unsigned int reg) { - return readb(i2c_imx->base + (reg << i2c_imx->hwdata->regshift)); + return readb_relaxed(i2c_imx->base + (reg << i2c_imx->hwdata->regshift)); } static void i2c_imx_clear_irq(struct imx_i2c_struct *i2c_imx, unsigned int bits)