From patchwork Wed Oct 2 11:19:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 13819672 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 E89F6CF31B4 for ; Wed, 2 Oct 2024 11:25:52 +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=4V7Qw24AIjD9e3DTOuaXw9uJfa/Y+gcgalY/kZOlqpg=; b=2ZdRucB5Hh9iq6R/UqX5bWUt7O PHp7yHiUU4FrrynqvkHQbu6IrNHPn5MJIJOCDp3m3/9PofHSF/Ht+qPCHWe+1ZKgKKjuPtnZOvqIA D9C0koK+hPIfq7MHN/LG7od5ijyER2o9JqTxfGIDzn6cqbi/yPEx8XutEePA1kpF3mqWXhuAZvTbr 3V/WYOtQ6kA8KJqbJWjJN/R7nn5aVNC6OScTKDzikW8XMhqKYroOOnKWbccPa/VcxheEglwxVn3a3 SEVRgSy9PgjYx8bQcWrPwmgpx8cOD3em2WnyT9fsQZc8Tz36KBck5uPTst0nmnD1o4Aiej9DP/nZU eNTPPrDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svxUE-00000005eNz-0Utj; Wed, 02 Oct 2024 11:25:42 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svxPF-00000005d7h-2aMt for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2024 11:20:35 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42cb6f3a5bcso80549415e9.2 for ; Wed, 02 Oct 2024 04:20:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1727868032; x=1728472832; 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=4V7Qw24AIjD9e3DTOuaXw9uJfa/Y+gcgalY/kZOlqpg=; b=Q2L2enIQ51FpeSM3Cu5R1ZRZXvHdEXBL6CPOtABJOrU53upPq8HfJifbg981YQejmY fHwssRrXQUEo59bMi26owePbtklldTR5JoLUiojqqdFBJ3fmrA/4Oqipm25PU3x8WsGL T24KvHvL8NXouIghYx4ppXhfx11HqJ+eb0NLQVJQlYfW+K7xoaKUd6WiK5Rea6MYdzj+ z+vtvBb1dMe6XwqB2mh40nkW09JTB35qNxH445IHfi9Qii/DI4bevYEyOWuH3T9TV6So 9l0zRSfAAqmL33BWCg+7isiUQO/xCo0mcuChgvAd3UpjJW3o6moTn1pRAe68m+H2y5Lj ilPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727868032; x=1728472832; 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=4V7Qw24AIjD9e3DTOuaXw9uJfa/Y+gcgalY/kZOlqpg=; b=KrSsYxzXbKExkTUGguHv0pDFKEMOkRaKs3hLmNbQO2dKiKzCexX0sPrnjuDX+LYeko HD/1sSo7aiVveFQIUkak3XR+Zgem4yCftujf+/DL88OUX29Zl5TFTaA83Z4SQrtC69fy 2opai4c6EPi5fRF0agaJMxmOWGikhhmfT0uecT2JfmixTanNBMBeTQwzIClwSAJ1v6Sk WejgyXi/LxWOK59KnB2pMmw0pArSplnNrQpzUkml2HpY6GCxm45XM1xCqidNB2CrI6+J PBzHPbU4EIcJdmApt0tqd+GSFAZvdj8sgfAHsUXVBqKyuikl6Alfgf8Oc8VNZEDF1iVA gJzQ== X-Forwarded-Encrypted: i=1; AJvYcCXwt2xx/3/oxL/JJtXpRvB7hBv0N5aE00qcILRMQemNDv5KSoUZPBRnH4ZEt2TVu+WYPSsMnXxNDacbixL9FUOd@lists.infradead.org X-Gm-Message-State: AOJu0YyNFjsqKs4zsM/ydSmNofSouIZO7YDn1chuyhhFQ8P8lZBa9ap/ q4Jl/q8dc7Ku4LVBjHd+9r4MOs98bNj2k8rjEWM1lZuxinK0DO+1a1KTfSEW X-Google-Smtp-Source: AGHT+IGehBz2wvp4octtBZnLUT1OhdST1Vf9e5fzfCVsKngbJHX2vTvVmrVGdPh9ghtRzv5CYCn1eQ== X-Received: by 2002:a05:600c:1d88:b0:42c:a387:6a6f with SMTP id 5b1f17b1804b1-42f777c365fmr23211065e9.20.1727868032188; Wed, 02 Oct 2024 04:20:32 -0700 (PDT) Received: from eichest-laptop.corp.toradex.com (31-10-206-125.static.upc.ch. [31.10.206.125]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f771a1209sm23530685e9.0.2024.10.02.04.20.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 04:20:31 -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, 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, francesco.dolcini@toradex.com, Stefan Eichenberger Subject: [PATCH v4 3/4] i2c: imx: use readb_relaxed and writeb_relaxed Date: Wed, 2 Oct 2024 13:19:41 +0200 Message-ID: <20241002112020.23913-4-eichest@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002112020.23913-1-eichest@gmail.com> References: <20241002112020.23913-1-eichest@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_042033_685391_A819F8C6 X-CRM114-Status: GOOD ( 14.44 ) 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 8e9cdeff278a8..f70522a83f823 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)