From patchwork Fri Jun 8 09:42:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongtao Jia X-Patchwork-Id: 163748 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id DBCEC1007D6 for ; Fri, 8 Jun 2012 20:05:24 +1000 (EST) Received: from va3outboundpool.messaging.microsoft.com (va3ehsobe001.messaging.microsoft.com [216.32.180.11]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client CN "mail.global.frontbridge.com", Issuer "Microsoft Secure Server Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 9CA8BB6FF4 for ; Fri, 8 Jun 2012 20:00:38 +1000 (EST) Received: from mail202-va3-R.bigfish.com (10.7.14.243) by VA3EHSOBE009.bigfish.com (10.7.40.29) with Microsoft SMTP Server id 14.1.225.23; Fri, 8 Jun 2012 09:59:42 +0000 Received: from mail202-va3 (localhost [127.0.0.1]) by mail202-va3-R.bigfish.com (Postfix) with ESMTP id 2A145D80097; Fri, 8 Jun 2012 09:59:42 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1202hzz8275bhz2dh2a8h668h839he5bhf0ah) Received: from mail202-va3 (localhost.localdomain [127.0.0.1]) by mail202-va3 (MessageSwitch) id 1339149578952125_24098; Fri, 8 Jun 2012 09:59:38 +0000 (UTC) Received: from VA3EHSMHS021.bigfish.com (unknown [10.7.14.248]) by mail202-va3.bigfish.com (Postfix) with ESMTP id E6419640047; Fri, 8 Jun 2012 09:59:38 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS021.bigfish.com (10.7.99.31) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 8 Jun 2012 09:59:37 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.298.5; Fri, 8 Jun 2012 05:00:26 -0500 Received: from rock.am.freescale.net (rock.ap.freescale.net [10.193.20.106]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id q58A02W3005252; Fri, 8 Jun 2012 03:00:22 -0700 From: Jia Hongtao To: , Subject: [PATCH V3 3/6] powerpc/fsl-pci: Only scan PCI bus if configured as a host Date: Fri, 8 Jun 2012 17:42:04 +0800 Message-ID: <1339148527-16911-4-git-send-email-B38951@freescale.com> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: <1339148527-16911-1-git-send-email-B38951@freescale.com> References: <1339148527-16911-1-git-send-email-B38951@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Cc: R65777@freescale.com, b38951@freescale.com, B07421@freescale.com X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15rc1 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" If we're an agent/end-point or fsl_add_bridge doesn't succeed due to some resource failure we should not scan the PCI bus. We change fsl_add_bridge() to return -ENODEV in the case we're an agent/end-point. Signed-off-by: Jia Hongtao Signed-off-by: Li Yang --- arch/powerpc/sysdev/fsl_pci.c | 27 +++++++++++++++------------ 1 files changed, 15 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 4c3d130..a5e573c 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -465,7 +465,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary) iounmap(hose->cfg_data); iounmap(hose->cfg_addr); pcibios_free_controller(hose); - return 0; + return -ENODEV; } setup_pci_cmd(hose); @@ -836,17 +836,20 @@ static int __devinit fsl_pci_probe(struct platform_device *pdev) ret = fsl_add_bridge(pdev->dev.of_node, is_primary); #ifdef CONFIG_SWIOTLB - hose = pci_find_hose_for_OF_device(pdev->dev.of_node); - /* - * if we couldn't map all of DRAM via the dma windows - * we need SWIOTLB to handle buffers located outside of - * dma capable memory region - */ - if (memblock_end_of_DRAM() > hose->dma_window_base_cur - + hose->dma_window_size) { - ppc_swiotlb_enable = 1; - set_pci_dma_ops(&swiotlb_dma_ops); - ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; + if (ret == 0) { + hose = pci_find_hose_for_OF_device(pdev->dev.of_node); + /* + * if we couldn't map all of DRAM via the dma windows + * we need SWIOTLB to handle buffers located outside of + * dma capable memory region + */ + if (memblock_end_of_DRAM() > hose->dma_window_base_cur + + hose->dma_window_size) { + ppc_swiotlb_enable = 1; + set_pci_dma_ops(&swiotlb_dma_ops); + ppc_md.pci_dma_dev_setup = + pci_dma_dev_setup_swiotlb; + } } #endif }