From patchwork Mon Aug 19 07:19:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Eichenberger X-Patchwork-Id: 13768009 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 DA4D0C3DA4A for ; Mon, 19 Aug 2024 07:23: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=hORPvwJyh1pncU6srJU2aZd0plw9XdxlfvVdC6EA72Y=; b=Q8wdmS9mJf4hzwReiYnQdRARMf IJjWnKQ5d0u3MIfYxxtVJVKRMRhZrsP91l8vBn7ZgU4ex9P+4JkOjkskosvxPikrzzLMDNDyIW4r3 v+fIQzC/B2QdcwOeGKAc5bFugsWyG5eBZuUE0GA5xBDtqLX4zHj9l/yt5GLTxnPnwLzPXFTePX3H9 C4YZLi5moagxFAuCvdImfKeTqD6zn5SXJHS+4+4hANHou3iQI3BDOVhWUM/+crGAjj7HQmT9RAid/ QgMFKOYbR2m3T8TIR/k/ZWC++ZTsSAak2ntJInJW4Opb+Dc7I2V5o/9/AZBa2xxoIaDTzxw9nr78w C6E+QjZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfwjs-00000000cdg-0XGd; Mon, 19 Aug 2024 07:23:40 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sfwhJ-00000000bqi-0BZh for linux-arm-kernel@lists.infradead.org; Mon, 19 Aug 2024 07:21:02 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-4280c55e488so20418755e9.0 for ; Mon, 19 Aug 2024 00:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724052059; x=1724656859; 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=hORPvwJyh1pncU6srJU2aZd0plw9XdxlfvVdC6EA72Y=; b=jDbpIupoDsFVaE+gbnbYeCbcJ9aNL5+0dxF/TdQO9yUepti6bkvlV8vdvTbrqAzLa/ wN47sM8jFMdDSLnP4Ywf+oEb/8VsrdxTd75eIx8+GewADa71ZT1YYhvqEzOSlju3Cp4f WuArWIcq8YU+utqW07n7a8YQzrqDxi70XWKKwGGw4hTMIeTGIhP3KbqB0HkCLEMqMJIm /Ydq0Z4vtfCqs7MCQyPsTHGZUZmL1fW8JjuVPeBjteGsSER41FxfXCeffabu0rkEx+Mk zvM4wkKuaKdfkrbAiQfluAjmL9QLXrT1ElrfJ8c/LyLBlyQIERKLDIxqITAbboIVfd4F J9gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724052059; x=1724656859; 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=hORPvwJyh1pncU6srJU2aZd0plw9XdxlfvVdC6EA72Y=; b=tOPF+eo+b8pLkskpEveNxlWFW3Cv10fHlXrOgps5UtOTrPe3uaqc+guuVYN4CfO0NL 91Z1tD9p6ldRAVr+DHs2H7rSvTxQsHKIKgePdEaIaosff0c8VleKEGdsBBnAOxZoE/oR uZc5wHXM2FtdU4GL97w8UrRvSn6WO4RlCyPzrx8v3p/R1MYGjFKoHyq+qf9Lrx/gMdJ2 M+DJdMmM8cHTmeLGSBV2rSSWXHZuUWgeom67f5AcKSMaQ9dsElScc9Jsw1K7GTEhjTSC ollUdkEPDNpw8VGg9Aa2yiTF8LMZdjLJfblnBrKfXpkJBWPNKz96L+eUjKqisumshTQl I6SA== X-Forwarded-Encrypted: i=1; AJvYcCX+BhJ/zF5Fnn/xMSQU1d3pQitX5bK0Z95zHOz+/iurZc62S1GcA+Ku4nJ+++PxBsslR5fH/lhIK+wmoga+s0+OlyUnlcpjdj5KPNlh4jHtggCzWqA= X-Gm-Message-State: AOJu0Yyp57XPf0+yxpnUVE6HhH911EBbpbsAtMWuM2F8p0pbBo0IFHTt HW8c/PX3Wo/kjXRsNqfhiPuNYGQ2SnpzyxxfHVahzLgsUvgrQnzs X-Google-Smtp-Source: AGHT+IGOTzKSg8W8hVyaEXI0HVPdRysysLEpf0RHZuY8lmPFwi3NAM0xoi+k233+RjaJ9gKYv0ipDw== X-Received: by 2002:a05:600c:4f52:b0:426:5e32:4857 with SMTP id 5b1f17b1804b1-429ed8a3958mr68907965e9.0.1724052059061; Mon, 19 Aug 2024 00:20:59 -0700 (PDT) Received: from eichest-laptop.toradex.int ([2a02:168:af72:0:a64c:8731:e4fb:38f1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-37189896a9csm9683734f8f.79.2024.08.19.00.20.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2024 00:20:58 -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, francesco.dolcini@toradex.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 v2 3/4] i2c: imx: use readb_relaxed and writeb_relaxed Date: Mon, 19 Aug 2024 09:19:09 +0200 Message-ID: <20240819072052.8722-4-eichest@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240819072052.8722-1-eichest@gmail.com> References: <20240819072052.8722-1-eichest@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240819_002101_132139_55A66A95 X-CRM114-Status: GOOD ( 14.56 ) 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 e242166cb6638..ccb466c50f598 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)