From patchwork Sat Jul 18 16:20:03 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 497380 X-Patchwork-Delegate: sjg@chromium.org 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 1AA2D140D4D for ; Sun, 19 Jul 2015 02:20:50 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=jHH2DJQv; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6E5894B688; Sat, 18 Jul 2015 18:20:45 +0200 (CEST) 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 3tBaG8PQKYpO; Sat, 18 Jul 2015 18:20:45 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3E37A4B669; Sat, 18 Jul 2015 18:20:42 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A2BDB4B669 for ; Sat, 18 Jul 2015 18:20:38 +0200 (CEST) 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 95I_-4I5Nss1 for ; Sat, 18 Jul 2015 18:20:38 +0200 (CEST) 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-ob0-f174.google.com (mail-ob0-f174.google.com [209.85.214.174]) by theia.denx.de (Postfix) with ESMTPS id 2845E4B66A for ; Sat, 18 Jul 2015 18:20:30 +0200 (CEST) Received: by obre1 with SMTP id e1so81438565obr.1 for ; Sat, 18 Jul 2015 09:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:subject:date:in-reply-to:references:mime-version :content-type; bh=oCPgpv8yqkwlFwE2QOJz4+wHjfk7DSvpWpWNZ+jFXac=; b=jHH2DJQv323dLPFM1C1Tt7MM3EdZTD99zLKdDS5MEtqkvTPUHRQpcjeRSyeEjXV9Zt lffzmGiIhfMvUdDdCLHf/fdjDi/ca3Yj0PiQHceMuKB5MWY5Bs2sHy6aXum9sE6g/dgJ k2iQhPQRf+PqpdWG6CpuZ5mVqsUJAhtzrpbbct2br4eBJGfCxaEZLwTTI3OVf9O186o6 vYLG3s2aVDCPppXimnhJ1ZHtU2kTE0Vof4CGQFpIHopXcpZArhHjrwyskBmx3Jc3INB1 keDi0u0iguo4V3XYuMikm/q9cnAitXAucoVtukV4S0KCepAgrwE37nIEC0Ztik0BrPlh unpw== X-Received: by 10.60.54.1 with SMTP id f1mr19254505oep.68.1437236429611; Sat, 18 Jul 2015 09:20:29 -0700 (PDT) Received: from mail.hotmail.com (blu004-wss1s3.hotmail.com. [134.170.2.218]) by smtp.gmail.com with ESMTPSA id a76sm8295809oib.26.2015.07.18.09.20.29 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 18 Jul 2015 09:20:29 -0700 (PDT) Received: from BLU436-SMTP119 ([134.170.2.215]) by BLU004-WSS1S3.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Sat, 18 Jul 2015 09:20:28 -0700 X-TMN: [cGFwENU0c8M4mqfgCJSgO+sIbDMnVnC+] Message-ID: From: Bin Meng To: Simon Glass , U-Boot Mailing List Date: Sun, 19 Jul 2015 00:20:03 +0800 X-Mailer: git-send-email 2.3.2 (Apple Git-55) In-Reply-To: <1437236407-1916-1-git-send-email-bmeng.cn@gmail.com> References: <1437236407-1916-1-git-send-email-bmeng.cn@gmail.com> X-OriginalArrivalTime: 18 Jul 2015 16:20:27.0409 (UTC) FILETIME=[A8624010:01D0C175] MIME-Version: 1.0 Subject: [U-Boot] [PATCH 2/6] dm: pci: Correct primary/secondary/subordinate bus number assignment X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In driver model, each pci bridge device has its own hose structure. hose->first_busno points to the bridge device's device number, so we should not substract hose->first_busno before programming the bridge device's primary/secondary/subordinate bus number registers. Signed-off-by: Bin Meng Acked-by: Simon Glass Tested-by: Simon Glass --- drivers/pci/pci_auto.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c index e034ed1..ef6dc4f 100644 --- a/drivers/pci/pci_auto.c +++ b/drivers/pci/pci_auto.c @@ -224,10 +224,15 @@ void pciauto_prescan_setup_bridge(struct pci_controller *hose, prefechable_64 &= PCI_PREF_RANGE_TYPE_MASK; /* Configure bus number registers */ +#ifdef CONFIG_DM_PCI + pci_hose_write_config_byte(hose, dev, PCI_PRIMARY_BUS, PCI_BUS(dev)); + pci_hose_write_config_byte(hose, dev, PCI_SECONDARY_BUS, sub_bus); +#else pci_hose_write_config_byte(hose, dev, PCI_PRIMARY_BUS, PCI_BUS(dev) - hose->first_busno); pci_hose_write_config_byte(hose, dev, PCI_SECONDARY_BUS, sub_bus - hose->first_busno); +#endif pci_hose_write_config_byte(hose, dev, PCI_SUBORDINATE_BUS, 0xff); if (pci_mem) { @@ -295,8 +300,12 @@ void pciauto_postscan_setup_bridge(struct pci_controller *hose, struct pci_region *pci_io = hose->pci_io; /* Configure bus number registers */ +#ifdef CONFIG_DM_PCI + pci_hose_write_config_byte(hose, dev, PCI_SUBORDINATE_BUS, sub_bus); +#else pci_hose_write_config_byte(hose, dev, PCI_SUBORDINATE_BUS, sub_bus - hose->first_busno); +#endif if (pci_mem) { /* Round memory allocator to 1MB boundary */