From patchwork Fri Oct 8 16:35:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Peter X-Patchwork-Id: 12545823 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 9C080C433EF for ; Fri, 8 Oct 2021 16:41:07 +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 5449460F9C for ; Fri, 8 Oct 2021 16:41:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5449460F9C 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=GsGEdPuh2uymCaZN/HLFeULB0TMa6D3CCex+Ly3z/vQ=; b=SkIILQWmvktlOg 4ghlAqtFmIB8pydrJ8inSoZZIDdLM7pYkXHfmovuhDFUHq9Ns0DbEnpYWEEm4sjsrcTzi7Pen6TvC gQPbAue5IDF+2ZLhkFLAhT5paUzFlUYtfmKl8uuYMxVRvkO3+IK1IlI00WWLAYRqI7azWXbcJvjXj CnOnCmkkZiIX80bfirGmP2KLkEfdDXtW80wjTzb9tr5XKQtbzcdv6MVz+H1QXQNU/k7XVj94eabv6 UdyNf3F5lUAC+2NpoguNg74x1j3vul/3WSR1D9fBmHpNHWd+oPfWBQniXzoD7D6M6seSQn5R9ypu4 xJrnIK6mCVgKPGltu7og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYstb-003Xwy-5c; Fri, 08 Oct 2021 16:38:55 +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 1mYsr6-003XLX-Pq for linux-arm-kernel@lists.infradead.org; Fri, 08 Oct 2021 16:36:22 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailnew.nyi.internal (Postfix) with ESMTP id 22692581009; Fri, 8 Oct 2021 12:36:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 08 Oct 2021 12:36:20 -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=3gVs60z+GZXZn xMyWBUAI98Vy1vUJV8dXTwiEbS9uIY=; b=RmuEne/F7tjZzGUT07pkBKHFK+fpy 1rYBUjpzvmXxhNlBOZFnET+UqwezORS9olGwXcJb3C8LNtbF5oxih77H0gmEbMyD 1luNlUbYVlxHmELdINlNjrFr18jFaIpYl3l3yL18sM1tbKpOzZ5UhkCjgbjcFxEr WxqwtEs3Arp3uIcC1cvn/+uMS+QtiNLLdrTru1DxREAcp+KGlL6ESwqSeFnDBc7j ZFdT/25Bso7VKm3SZKoZOUWTl2Dy0o3IBi2EG2KQzZvb35Dy+dRigcZZvoVLVgS8 7mCFOS0Bd79lmCfLhi4d6HdpmjQcU6+5pP7xzKh/zxe4ibbfJ61D55UGQ== 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= fm1; bh=3gVs60z+GZXZnxMyWBUAI98Vy1vUJV8dXTwiEbS9uIY=; b=H/rd2lmy /MZXkXI0uPT9k8Jzu0qZ0lW3aFVBcGdrtY+sN7jZOzETg03URd6Ndldgv6v9YjkO yiYv1xLDLTxHCX44bjEQn6kw8mfPo35fLzbpyU9Ks6h1+PBQbjn6jmo63LSJFmoQ VW/XFvhsoo56RDuyHODkf9VoTeP72X/jf2o9/3YayamhNUW2Fst1m2+4rBGL6KAV eSVspKcgHrHPQeRhORSAitRgp1R1xw62t0o5zCi3m+9AALbyWWI4ehCLk7usBrqe byYv+eiWBiLecAL8f+d1Okf0D303+XE8eRtGwSYNMbTuV8WhdALjlGQPF06b2DAt peQ58/MvDGoUYg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddttddguddttdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefhvffufffkofgjfhgggfestdekredtredttdenucfhrhhomhepufhvvghn ucfrvghtvghruceoshhvvghnsehsvhgvnhhpvghtvghrrdguvghvqeenucggtffrrghtth gvrhhnpeetvdekteeluefffffhkeetteffgefggfevheeileeufedvtdeuffevveelhfef jeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehsvh gvnhesshhvvghnphgvthgvrhdruggvvh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 8 Oct 2021 12:36:17 -0400 (EDT) From: Sven Peter To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Olof Johansson , Christian Zigotzky , Wolfram Sang 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 v2 02/11] i2c: pasemi: Use io{read,write}32 Date: Fri, 8 Oct 2021 18:35:23 +0200 Message-Id: <20211008163532.75569-3-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) In-Reply-To: <20211008163532.75569-1-sven@svenpeter.dev> References: <20211008163532.75569-1-sven@svenpeter.dev> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211008_093620_962178_BCBCF639 X-CRM114-Status: GOOD ( 12.58 ) 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 pci_iomap and ioread32/iowrite32. Reviewed-by: Arnd Bergmann Signed-off-by: Sven Peter --- v1 -> v2: replaced ioport_map with pci_iomap 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..39fcc584264a 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 = pci_iomap(dev, 0, 0); + 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: + pci_iounmap(dev, 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); + pci_iounmap(dev, smbus->ioaddr); release_region(smbus->base, smbus->size); kfree(smbus); }