Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3221471ybg; Fri, 25 Oct 2019 00:38:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyRVJAq+YyGtBIkrJ0C36kKvhtVWaRfLTq3TJ3bAE2THpEKn6CxFamTJSaNupgGuroHsDw6 X-Received: by 2002:a17:906:5502:: with SMTP id r2mr2126438ejp.3.1571989101707; Fri, 25 Oct 2019 00:38:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571989101; cv=none; d=google.com; s=arc-20160816; b=mKSr58Ea2d5q37a0Kh0dxQllIRiU14cn6L2Xp7xHgaV7qq7YzMZcNJqe0btLrwo873 DV45mroOybz+5zZPzD1S3FKHiLao/WyE9du9fxtEV3+Y43LDKy5r1KPEiwkQM+hRINtt whXCYBZ36+LMzzO8xTL9V724oRXG7iJMKx1gLHZzXQmkLnDUJMAvD9STEDf5/OgErbze pfNpjxxSQGRlnYbkAx2h5k0duTUTL77PVcCQC/mAvkx/yQ1Hqi9m3/rfk3WpF4rc0xEv KVNCfVdfN299vZPzt9Lk9i0KbjJMDDSrolTv5ro4T/w4Jl65FdJwWdvRCoZ7hXOf41sq HpOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from; bh=b/OeL+KmvnrhTirN8cV5321NFAEct9hduCy2bXzSeJQ=; b=Df/t4B37o4yT8hYp/4ypnMsCy1lQYmIM8a1rc/+vQimiWQETHgEOG/65PUhyHIbyBW KPpe70RWs5/RssHyn1onYk/Ew+epy7qzQoFiP7QAo1hn5ohdrCnISlPCV/Ac8YzQ8gBG e9Ai3qKeJM0ZMjN54n8imQ0eArKlkjgpXOK2XziAz6SzjFQcmZARYRJfZafjbOEwT+WO j2Eu9Fh2cAsZxR83a7Ylx8dbyi8yyofdjxJR6VO8Jt/Jt4qJmvlDeXFYGILJLUl6mvVU plKkH2ym4dyeD9KJys8yqY0mqOmSHhpUc01/jKl808ajgxbTi2JjYh7qGiW0xwMQ4/44 QizA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v11si724098edl.371.2019.10.25.00.37.58; Fri, 25 Oct 2019 00:38:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393284AbfJXKSi (ORCPT + 99 others); Thu, 24 Oct 2019 06:18:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:34202 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2392678AbfJXKSh (ORCPT ); Thu, 24 Oct 2019 06:18:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 04F6BB4F1; Thu, 24 Oct 2019 10:18:36 +0000 (UTC) From: Thomas Bogendoerfer To: Ralf Baechle , Paul Burton , James Hogan , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] MIPS: PCI: make phys_to_dma/dma_to_phys for pci-xtalk-bridge common Date: Thu, 24 Oct 2019 12:18:28 +0200 Message-Id: <20191024101829.12543-1-tbogendoerfer@suse.de> X-Mailer: git-send-email 2.16.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All platforms using pci-xtalk-bridge can share common phys_to_dma/ dma_to_phys function. So we move it form ip27 specific file to pci-xtalk-bridge.c Signed-off-by: Thomas Bogendoerfer --- arch/mips/pci/pci-ip27.c | 13 ------------- arch/mips/pci/pci-xtalk-bridge.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/arch/mips/pci/pci-ip27.c b/arch/mips/pci/pci-ip27.c index 0d2eb86e8a1e..8e26b120f994 100644 --- a/arch/mips/pci/pci-ip27.c +++ b/arch/mips/pci/pci-ip27.c @@ -14,19 +14,6 @@ #include #include -dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct bridge_controller *bc = BRIDGE_CONTROLLER(pdev->bus); - - return bc->baddr + paddr; -} - -phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr) -{ - return dma_addr & ~(0xffUL << 56); -} - #ifdef CONFIG_NUMA int pcibus_to_node(struct pci_bus *bus) { diff --git a/arch/mips/pci/pci-xtalk-bridge.c b/arch/mips/pci/pci-xtalk-bridge.c index 0dd5edb76cbb..b475cf5aef2f 100644 --- a/arch/mips/pci/pci-xtalk-bridge.c +++ b/arch/mips/pci/pci-xtalk-bridge.c @@ -22,6 +22,22 @@ #define CRC16_INIT 0 #define CRC16_VALID 0xb001 +/* + * Common phys<->dma mapping for platforms using pci xtalk bridge + */ +dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t paddr) +{ + struct pci_dev *pdev = to_pci_dev(dev); + struct bridge_controller *bc = BRIDGE_CONTROLLER(pdev->bus); + + return bc->baddr + paddr; +} + +phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr) +{ + return dma_addr & ~(0xffUL << 56); +} + /* * Most of the IOC3 PCI config register aren't present * we emulate what is needed for a normal PCI enumeration -- 2.16.4