linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Jia Hongtao <B38951@freescale.com>
To: <linuxppc-dev@lists.ozlabs.org>, <galak@kernel.crashing.org>
Cc: R65777@freescale.com, b38951@freescale.com, B07421@freescale.com
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	[thread overview]
Message-ID: <1339148527-16911-4-git-send-email-B38951@freescale.com> (raw)
In-Reply-To: <1339148527-16911-1-git-send-email-B38951@freescale.com>

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 <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 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
 	}
-- 
1.7.5.1

  parent reply	other threads:[~2012-06-08 10:00 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-08  9:42 [PATCH 0/6] Description for PCI patches using platform driver Jia Hongtao
2012-06-08  9:42 ` [PATCH V3 1/6] powerpc/fsl-pci: Unify pci/pcie initialization code Jia Hongtao
2012-06-08  9:42 ` [PATCH V3 2/6] powerpc/fsl-pci: Using common pci/pcie initialization for all boards Jia Hongtao
2012-06-08  9:42 ` Jia Hongtao [this message]
2012-06-08  9:42 ` [PATCH V3 4/6] powerpc/fsl-pci: Add pci inbound/outbound PM support Jia Hongtao
2012-06-08  9:42 ` [PATCH V3 5/6] Avoid duplicate probe for of platform devices Jia Hongtao
2012-06-08  9:42 ` [PATCH V3 6/6] Edac/85xx: Register mpc85xx_pci_err_driver by fsl_pci_driver Jia Hongtao
2012-06-08 10:47 ` [PATCH 0/6] Description for PCI patches using platform driver Bhushan Bharat-R65777
2012-06-11  2:33   ` Jia Hongtao-B38951
2012-06-11 13:24     ` Bhushan Bharat-R65777
2012-06-12  2:24       ` Jia Hongtao-B38951
2012-06-14  9:52         ` Bhushan Bharat-R65777
2012-06-20  2:33           ` Jia Hongtao-B38951
2012-06-26  2:33             ` Jia Hongtao-B38951
2012-06-26  2:46               ` Benjamin Herrenschmidt
2012-06-26  2:54                 ` Jia Hongtao-B38951
2012-06-26 10:05                 ` Jia Hongtao-B38951
2012-06-11 15:43     ` Scott Wood
2012-06-12  2:27       ` Jia Hongtao-B38951

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339148527-16911-4-git-send-email-B38951@freescale.com \
    --to=b38951@freescale.com \
    --cc=B07421@freescale.com \
    --cc=R65777@freescale.com \
    --cc=galak@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).