From patchwork Sat Jan 10 02:34:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 5603791 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9F8CFC058D for ; Sat, 10 Jan 2015 02:37:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0CBE20617 for ; Sat, 10 Jan 2015 02:37:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D73702061C for ; Sat, 10 Jan 2015 02:37:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754577AbbAJChA (ORCPT ); Fri, 9 Jan 2015 21:37:00 -0500 Received: from mail-ob0-f169.google.com ([209.85.214.169]:39129 "EHLO mail-ob0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756318AbbAJCfw (ORCPT ); Fri, 9 Jan 2015 21:35:52 -0500 Received: by mail-ob0-f169.google.com with SMTP id vb8so15942431obc.0; Fri, 09 Jan 2015 18:35:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=6723kM1EU/yyXMhMl6mUv3EbPyHVIbUO5lreCdwMh9k=; b=R6hXSAxWJrn6jOIRvtqo4xTDnm8kc61XHHtCInOiLJa7TkP5YsL+Oz2K3QyvuKw3ZD GliX8WB3mskzFJUWbHf9WttLhBq/OAhsNrJeKT2x6Jzcenx1D9L1MLrTPvPviChvwVLk xipxzhHSkzuDPwVBMY0RNIVmiCGXxivqf+ni732fEfEMQb8jfuKBPckBE5UmfmnF/nMV XAZv8AALL9IIKvsWy+kS5hMhQmMuaSBvFssGeuFKqeNLB8GYbrYcVKD/syvL8AtH8z8S sAcW7bjnP4JJX/tT68th1exCFwE+HeCRmp+/li3tXxL8O/WgWCFEDyVIaKLl6ymy27O8 GDCQ== X-Received: by 10.202.73.6 with SMTP id w6mr10659013oia.37.1420857351890; Fri, 09 Jan 2015 18:35:51 -0800 (PST) Received: from rob-laptop.herring.priv (72-48-98-129.dyn.grandenetworks.net. [72.48.98.129]) by mx.google.com with ESMTPSA id b192sm5326257oih.4.2015.01.09.18.35.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Jan 2015 18:35:51 -0800 (PST) From: Rob Herring To: linux-kernel@vger.kernel.org Cc: Arnd Bergmann , linux-pci@vger.kernel.org, Bjorn Helgaas , Rob Herring , Simon Horman , linux-sh@vger.kernel.org Subject: [PATCH 13/16] pci/host: rcar-gen2: convert to use generic config accesses Date: Fri, 9 Jan 2015 20:34:47 -0600 Message-Id: <1420857290-8373-14-git-send-email-robh@kernel.org> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1420857290-8373-1-git-send-email-robh@kernel.org> References: <1420857290-8373-1-git-send-email-robh@kernel.org> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Convert the rcar-gen2 host PCI driver to use the generic config access functions. This changes the i/o accessors from io(read|write)X to readX/writeX variants which are equivalent on ARM. Signed-off-by: Rob Herring Cc: Simon Horman Cc: Bjorn Helgaas Cc: linux-pci@vger.kernel.org Cc: linux-sh@vger.kernel.org Acked-by: Geert Uytterhoeven --- drivers/pci/host/pci-rcar-gen2.c | 51 +++------------------------------------- 1 file changed, 3 insertions(+), 48 deletions(-) diff --git a/drivers/pci/host/pci-rcar-gen2.c b/drivers/pci/host/pci-rcar-gen2.c index d9c042f..dd6b84e 100644 --- a/drivers/pci/host/pci-rcar-gen2.c +++ b/drivers/pci/host/pci-rcar-gen2.c @@ -131,52 +131,6 @@ static void __iomem *rcar_pci_cfg_base(struct pci_bus *bus, unsigned int devfn, return priv->reg + (slot >> 1) * 0x100 + where; } -static int rcar_pci_read_config(struct pci_bus *bus, unsigned int devfn, - int where, int size, u32 *val) -{ - void __iomem *reg = rcar_pci_cfg_base(bus, devfn, where); - - if (!reg) - return PCIBIOS_DEVICE_NOT_FOUND; - - switch (size) { - case 1: - *val = ioread8(reg); - break; - case 2: - *val = ioread16(reg); - break; - default: - *val = ioread32(reg); - break; - } - - return PCIBIOS_SUCCESSFUL; -} - -static int rcar_pci_write_config(struct pci_bus *bus, unsigned int devfn, - int where, int size, u32 val) -{ - void __iomem *reg = rcar_pci_cfg_base(bus, devfn, where); - - if (!reg) - return PCIBIOS_DEVICE_NOT_FOUND; - - switch (size) { - case 1: - iowrite8(val, reg); - break; - case 2: - iowrite16(val, reg); - break; - default: - iowrite32(val, reg); - break; - } - - return PCIBIOS_SUCCESSFUL; -} - /* PCI interrupt mapping */ static int rcar_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) { @@ -325,8 +279,9 @@ static int rcar_pci_setup(int nr, struct pci_sys_data *sys) } static struct pci_ops rcar_pci_ops = { - .read = rcar_pci_read_config, - .write = rcar_pci_write_config, + .map_bus = rcar_pci_cfg_base, + .read = pci_generic_config_read, + .write = pci_generic_config_write, }; static int rcar_pci_probe(struct platform_device *pdev)