From patchwork Sun Sep 26 09:58:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12518203 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2F32C433EF for ; Sun, 26 Sep 2021 10:02:21 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 797AE61019 for ; Sun, 26 Sep 2021 10:02:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 797AE61019 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=svenpeter.dev Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=w+0qJ/4zJAATANcv7j8k8YZELTB1Yx6bnbojPk+aCLw=; b=Mq5OaRbnp89Ohj YzJ+fI2t5MkUdNS3wloZW29JQ6DOeXLItdNtCdLxqyD6dNnDh29JLz6G2S610E3Lm07nwx9fuijkI eOxiZD/4f21lDL2JGtW9J8/2hjy18CM5otBD7lanVa7jMCjkjdfxau07Z9CxyE+eub5xo07WGwfjz P3nQuq6eKPw2Rt4YLWSrzF2O9NLMD9gK29HDVmZDn7E+5KPlJV91Bnn9LU1Cn0MQsJITnBnv8fvB2 lZrkLrzVNjKLzroiDEif8ccI/5j5gF7Ite//tkl7z5eEC7eqac82HX8w+16zR4XMnKMfyqkKSg5Y5 607g++BLqe0xeSAkhfTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUQx4-000KKJ-LW; Sun, 26 Sep 2021 10:00:06 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mUQwi-000KEE-3T for linux-arm-kernel@lists.infradead.org; Sun, 26 Sep 2021 09:59:45 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 80880580FBE; Sun, 26 Sep 2021 05:59:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 26 Sep 2021 05:59:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm2; bh=eDm2w0r9qdgIL osKDjxLOSNSl2XVh+4nrRVQCj+3Zbg=; b=loKi3BylPqTFC87PBvT1beyL5AI3a 9oJICsw/yvFiFn7dZ+kDGmryQJ9VBPB34mw7OVDyvgBAWl+wFqA6ZGvrprsWhj/q tCxS4J9zxxlTbm29lYKOPcVqGpuW1ikQqDUWkrg/7rQ3srGoZMMEV5y1Z027ADEJ JmA6hdEgIt4kPLJYYJ6xd+nEVmxIIUowxvEjXVIJoIJL7nwzjhCJYQRzWwP1Elre 5nbvr1IZTXHycYf1daUNpoD5xJ5ExOOTRorbPcMroI7sGtZVHycm/HBRxm9gQcWq 8C5+IvmGC06grdkFb8TW+320n9VQyirzr5igOTLCTZdMxhBovjBS/S1xQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=eDm2w0r9qdgILosKDjxLOSNSl2XVh+4nrRVQCj+3Zbg=; b=Dzc1jhNB fWkJWAQ+pgASl5fF5XLxl4RqcO4B1G8A6ILOjmF4zORhzR+aOtUUvIqbmffoXH+V 5dXsu2pDvl4AZk8LHP7DAIbcOSyf/gLe//4HkOXoAVtPwzsw0YG+wuTwbcIapMQl tJu/7G4oRZxkIuPr1EXhn6VzqE4yWQzuRnMXmhNvZwDOvpBEX7BsJdd1hOlRpSRr FEreJOzRLo+bOYxLLFT9HNiw89z9PGbsp88qI++9O14sl2Gza4P1O6eL0Wly/PLX fC6gtsbxjEZUcDz/w3anl/E5ACRublM4b1NmtrDkulOCF40/cHHyD+u1mQZk4I4G 6P7WizXTlOup0w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudejiedgvddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkffojghfggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcu rfgvthgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvg hrnheptedvkeetleeuffffhfekteetffeggffgveehieelueefvddtueffveevlefhfeej necuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvg hnsehsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 26 Sep 2021 05:59:41 -0400 (EDT) From: Sven Peter To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Olof Johansson Cc: Sven Peter , Arnd Bergmann , Hector Martin , Mohamed Mediouni , Stan Skowronek , Mark Kettenis , Alyssa Rosenzweig , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/10] i2c: pasemi: Use io{read,write}32 Date: Sun, 26 Sep 2021 11:58:39 +0200 Message-Id: <20210926095847.38261-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20210926095847.38261-1-sven@svenpeter.dev> References: <20210926095847.38261-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210926_025944_232866_0A6CFB7E X-CRM114-Status: GOOD ( 12.17 ) 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 In preparation for splitting this driver up into a platform_driver and a pci_driver, replace outl/inl usage with ioport_map and ioread32/iowrite32. Signed-off-by: Sven Peter --- drivers/i2c/busses/i2c-pasemi.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c index 20f2772c0e79..dd31d902a621 100644 --- a/drivers/i2c/busses/i2c-pasemi.c +++ b/drivers/i2c/busses/i2c-pasemi.c @@ -20,6 +20,7 @@ static struct pci_driver pasemi_smb_driver; struct pasemi_smbus { struct pci_dev *dev; struct i2c_adapter adapter; + void __iomem *ioaddr; unsigned long base; int size; }; @@ -53,13 +54,13 @@ static inline void reg_write(struct pasemi_smbus *smbus, int reg, int val) { dev_dbg(&smbus->dev->dev, "smbus write reg %lx val %08x\n", smbus->base + reg, val); - outl(val, smbus->base + reg); + iowrite32(val, smbus->ioaddr + reg); } static inline int reg_read(struct pasemi_smbus *smbus, int reg) { int ret; - ret = inl(smbus->base + reg); + ret = ioread32(smbus->ioaddr + reg); dev_dbg(&smbus->dev->dev, "smbus read reg %lx val %08x\n", smbus->base + reg, ret); return ret; @@ -351,6 +352,12 @@ static int pasemi_smb_probe(struct pci_dev *dev, goto out_kfree; } + smbus->ioaddr = ioport_map(smbus->base, smbus->size); + if (!smbus->ioaddr) { + error = -EBUSY; + goto out_release_region; + } + smbus->adapter.owner = THIS_MODULE; snprintf(smbus->adapter.name, sizeof(smbus->adapter.name), "PA Semi SMBus adapter at 0x%lx", smbus->base); @@ -366,12 +373,14 @@ static int pasemi_smb_probe(struct pci_dev *dev, error = i2c_add_adapter(&smbus->adapter); if (error) - goto out_release_region; + goto out_ioport_unmap; pci_set_drvdata(dev, smbus); return 0; + out_ioport_unmap: + ioport_unmap(smbus->ioaddr); out_release_region: release_region(smbus->base, smbus->size); out_kfree: @@ -384,6 +393,7 @@ static void pasemi_smb_remove(struct pci_dev *dev) struct pasemi_smbus *smbus = pci_get_drvdata(dev); i2c_del_adapter(&smbus->adapter); + ioport_unmap(smbus->ioaddr); release_region(smbus->base, smbus->size); kfree(smbus); }