From patchwork Mon Jan 10 12:42:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baidu Boy X-Patchwork-Id: 78135 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D3F74B708B for ; Mon, 10 Jan 2011 23:42:59 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 88FF8280B1; Mon, 10 Jan 2011 13:42:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RAVcMlfH-1-k; Mon, 10 Jan 2011 13:42:54 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 15D25280B2; Mon, 10 Jan 2011 13:42:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 98057280B2 for ; Mon, 10 Jan 2011 13:42:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LPn0x8VjD3-z for ; Mon, 10 Jan 2011 13:42:42 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yx0-f172.google.com (mail-yx0-f172.google.com [209.85.213.172]) by theia.denx.de (Postfix) with ESMTP id 158D3280B1 for ; Mon, 10 Jan 2011 13:42:40 +0100 (CET) Received: by yxt33 with SMTP id 33so7724220yxt.3 for ; Mon, 10 Jan 2011 04:42:39 -0800 (PST) Received: by 10.236.109.168 with SMTP id s28mr11732151yhg.74.1294663359757; Mon, 10 Jan 2011 04:42:39 -0800 (PST) Received: from LENOVOE5CA6843 ([117.88.185.36]) by mx.google.com with ESMTPS id h23sm2876233yha.36.2011.01.10.04.42.35 (version=SSLv3 cipher=RC4-MD5); Mon, 10 Jan 2011 04:42:39 -0800 (PST) From: "Baidu Boy" To: Date: Mon, 10 Jan 2011 20:42:28 +0800 Message-ID: <000001cbb0c3$dd923910$6401a8c0@LENOVOE5CA6843> MIME-Version: 1.0 X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acuww9czMwWYZDpZRzSezzXSuDKsPg== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 Subject: [U-Boot] [PATCH V3] mpc83xx: fix pcie configuration space read/write X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This patch fix a problem for the pcie enumeration when the mpc83xx pcie controller is connected with switch or we use both of the two pcie controller Signed-off-by: Baidu Boy --- Changes for V2: - Avoid line wrap in the patch Changes for V3 - Add space between ) and { arch/powerpc/cpu/mpc83xx/pcie.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/cpu/mpc83xx/pcie.c b/arch/powerpc/cpu/mpc83xx/pcie.c index 46a706d..8429848 100644 --- a/arch/powerpc/cpu/mpc83xx/pcie.c +++ b/arch/powerpc/cpu/mpc83xx/pcie.c @@ -46,13 +46,15 @@ static struct { #endif }; +static u8 pcie_index = 0; + #ifdef CONFIG_83XX_GENERIC_PCIE_REGISTER_HOSES static int mpc83xx_pcie_remap_cfg(struct pci_controller *hose, pci_dev_t dev) { int bus = PCI_BUS(dev) - hose->first_busno; immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; - pex83xx_t *pex = &immr->pciexp[bus]; + pex83xx_t *pex = &immr->pciexp[pcie_index]; struct pex_outbound_window *out_win = &pex->bridge.pex_outbound_win[0]; u8 devfn = PCI_DEV(dev) << 3 | PCI_FUNC(dev); u32 dev_base = bus << 24 | devfn << 16; @@ -324,6 +326,8 @@ void mpc83xx_pcie_init(int num_buses, struct pci_region **reg) num_buses = ARRAY_SIZE(mpc83xx_pcie_cfg_space); } - for (i = 0; i < num_buses; i++) + for (i = 0; i < num_buses; i++) { + pcie_index = i; mpc83xx_pcie_init_bus(i, reg[i]); + } }