From patchwork Fri Dec 15 08:04:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Zigotzky X-Patchwork-Id: 849045 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yyjjY0XNRz9sPm for ; Fri, 15 Dec 2017 19:08:17 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xenosoft.de header.i=@xenosoft.de header.b="A4H+wJgx"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yyjjX5dyQzDrmx for ; Fri, 15 Dec 2017 19:08:16 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xenosoft.de header.i=@xenosoft.de header.b="A4H+wJgx"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (helo) smtp.helo=mo6-p00-ob.smtp.rzone.de (client-ip=2a01:238:20a:202:5300::4; helo=mo6-p00-ob.smtp.rzone.de; envelope-from=chzigotzky@xenosoft.de; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=xenosoft.de header.i=@xenosoft.de header.b="A4H+wJgx"; dkim-atps=neutral Received: from mo6-p00-ob.smtp.rzone.de (mo6-p00-ob.smtp.rzone.de [IPv6:2a01:238:20a:202:5300::4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yyjgH5hrhzDrjD for ; Fri, 15 Dec 2017 19:06:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1513325174; s=domk; d=xenosoft.de; h=Content-Type:In-Reply-To:Date:Message-ID:References:To:From:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject; bh=mtiwAtbL3dnVxnP9UHNBVrlUDCjgV7IO/yY3qdaYhzs=; b=A4H+wJgxkqPJ42yEINtCA/OcRViMFqgRjaZTuhzj8SMnSF8o8jjD4Yw3Q0GYsy240V rIYLSlNiuunplpFMjcbE3knQAHi70jbIjfOmSRmN7sAauDn3RPXx9aBMGG9jo1Wsg9pa FCAUgkPek1ks/Fpm+eOtCZLgJPo6YYkshHhJo= X-RZG-AUTH: :L2QefEenb+UdBJSdRCXu93KJ1bmSGnhMdmOod1DhGM4l4Hio94KKxRySf+VvAflxJtId40wmzN9c X-RZG-CLASS-ID: mo00 Received: from [192.168.1.134] (ppp-188-174-71-194.dynamic.mnet-online.de [188.174.71.194]) by smtp.strato.de (RZmta 42.14 DYNA|AUTH) with ESMTPSA id c05579tBF84p7U2 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Fri, 15 Dec 2017 09:04:51 +0100 (CET) Subject: [PATCH] SB600 for the Nemo board has non-zero devices on non-root bus From: Christian Zigotzky To: Michael Ellerman , Bjorn Helgaas , Darren Stevens , "linux-pci@vger.kernel.org" , Bjorn Helgaas , Olof Johansson , linuxppc-dev References: <20171130224243.GB19640@bhelgaas-glaptop.roam.corp.google.com> <406ba7c4-7305-4069-227f-81afed202e47@xenosoft.de> <20171201232716.GA18780@bhelgaas-glaptop.roam.corp.google.com> <6d2505ab-a985-bdb0-ad3a-e7659cc2c54d@xenosoft.de> <20171202230052.34y2ivxgpgr3osct@localhost> <4CEE49CE-68F3-457F-B302-54BA8550F36A@xenosoft.de> <1d5276c3-1d29-114a-c868-6f022eee58e7@xenosoft.de> <99f78122-cd53-100f-4f58-be5bf7927d4e@xenosoft.de> <87fu8odnfk.fsf@concordia.ellerman.id.au> <20171206210637.GO23510@bhelgaas-glaptop.roam.corp.google.com> <877etxh1lf.fsf@concordia.ellerman.id.au> Message-ID: <98c7e034-b523-a703-e637-957e2857ab32@xenosoft.de> Date: Fri, 15 Dec 2017 09:04:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: Content-Language: de-DE X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.24 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" On 09 December 2017 at 7:03PM, Christian Zigotzky wrote: > On 08 December 2017 at 12:59PM, Michael Ellerman wrote: > > > >> Darren's idea of doing it at the same time you tweak the SB600 "relax > >> pci-e" bit is ideal because then the two pieces are obviously > >> connected and it wouldn't affect any other systems at all. > > > > Yes that would be ideal. That patch is currently out-of-tree I gather, > > but I guess everyone who's using these machines must have that patch > > anyway. > > > > Darren what does that code look like? Can we get it upstream and close > > the loop on this? > > > > cheers > > > > Hi Michael, > > Please find attached the code. > > Thanks, > Christian Hi All, I haven't received any response yet. Is this the correct patch you are looking for? Thanks, Christian diff -rupN a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c --- a/arch/powerpc/platforms/pasemi/pci.c 2017-11-16 08:18:35.078874462 +0100 +++ b/arch/powerpc/platforms/pasemi/pci.c 2017-11-16 08:17:22.034367975 +0100 @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -108,6 +109,69 @@ static int workaround_5945(struct pci_bu return 1; } +#ifdef CONFIG_PPC_PASEMI_NEMO +static int sb600_bus = 5; +static void __iomem *iob_mapbase = NULL; + +static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn, + int offset, int len, u32 *val); + +static void sb600_set_flag(int bus) +{ + struct resource res; + struct device_node *dn; + struct pci_bus *busp; + u32 val; + int err; + + if (sb600_bus == -1) + { + busp = pci_find_bus(0, 0); + pa_pxp_read_config(busp, PCI_DEVFN(17,0), PCI_SECONDARY_BUS, 1, &val); + + sb600_bus = val; + + printk(KERN_CRIT "NEMO SB600 on bus %d.\n",sb600_bus); + } + + if (iob_mapbase == NULL) + { + dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob"); + if (!dn) + { + printk(KERN_CRIT "NEMO SB600 missing iob node\n"); + return; + } + + err = of_address_to_resource(dn, 0, &res); + of_node_put(dn); + + if (err) + { + printk(KERN_CRIT "NEMO SB600 missing resource\n"); + return; + } + + printk(KERN_CRIT "NEMO SB600 IOB base %08lx\n",res.start); + + iob_mapbase = ioremap(res.start + 0x100, 0x94); + } + + if (iob_mapbase != NULL) + { + if (bus == sb600_bus) + { + out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) | 0x800); + } + else + { + out_le32(iob_mapbase + 4, in_le32(iob_mapbase + 4) & ~0x800); + } + } +} +#endif + + static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn, int offset, int len, u32 *val) { @@ -126,6 +190,10 @@ static int pa_pxp_read_config(struct pci addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); +#ifdef CONFIG_PPC_PASEMI_NEMO + sb600_set_flag(bus->number); +#endif + /* * Note: the caller has already checked that offset is * suitably aligned and that len is 1, 2 or 4. @@ -210,6 +278,9 @@ static int __init pas_add_bridge(struct /* Interpret the "ranges" property */ pci_process_bridge_OF_ranges(hose, dev, 1); + /* Scan for an isa bridge. */ + isa_bridge_find_early(hose); + return 0; }