From patchwork Sun Aug 19 20:21:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darren Stevens X-Patchwork-Id: 959454 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41tqjZ6d0bz9ryn for ; Mon, 20 Aug 2018 07:25:38 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=stevens-zone.net Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41tqjZ59SrzF1qF for ; Mon, 20 Aug 2018 07:25:38 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=stevens-zone.net X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (mailfrom) smtp.mailfrom=stevens-zone.net (client-ip=212.227.126.187; helo=mout.kundenserver.de; envelope-from=darren@stevens-zone.net; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=stevens-zone.net Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41tqdR1wmLzF1S4 for ; Mon, 20 Aug 2018 07:22:02 +1000 (AEST) Received: from mintppc.home ([86.171.142.179]) by mrelayeu.kundenserver.de (mreue007 [212.227.15.163]) with ESMTPA (Nemesis) id 0Lvdma-1fubDW0y4K-017XJ2; Sun, 19 Aug 2018 23:21:58 +0200 From: Darren Stevens To: linuxppc-dev@lists.ozlabs.org Date: Sun, 19 Aug 2018 21:21:55 +0100 (BST) Message-ID: <4c6da03cac4.3957dfc0@auth.smtp.1and1.co.uk> User-Agent: YAM/2.9p1 (AmigaOS4; PPC; rv:20140418r7798) Subject: [PATCH NEXT v2 1/4] powerpc/pasemi: Add PCI initialisation for Nemo board. MIME-Version: 1.0 Content-type: multipart/mixed; boundary="--=_BOUNDARY.6c124c6035e4feb9.65" X-Provags-ID: V03:K1:rtHIeE7yvKjtTmU8zBVK59FtKlQuQwoPIl6q82NM0bRURnVTaVJ /3Pa+UoAq+HAall5hRQyBlZ9ojNrdWYlV2PfGxNvUghdwXudqkb/iarSDZpV6AWzNeugHwU Ka3RzY1q/ErITSgPra8abyPYbNIfPSwcQr2pQsBWdradVWBwP6TOhW2Kp3bg2OBYj1TkZgn AYlctrx3BP8YV6ArDzJ5g== X-UI-Out-Filterresults: notjunk:1; V01:K0:KRRGh4MewVQ=:eIoCCIfjI66rHB4X2fJ9OC UFNj2OJ/a/nVprXYV8KD6Y0FibcSGwi0emfEVv6lXD/aNrpZF+9/NXfudrJWhvD7ICDjW1Gjs TdUfp5xRYUzGg5Vy5P8cbKbmAc9FEPoa06jGd9XVfn4C1eoUW6jnblqA1GH1MUpWvoz7PQ6xg SrLEd66zlgU5FpGCpibQnv/avF7/iPTFqT8OQISKKPUxr9O0Qx9b9SG8c2Fj0IV9j8eXgTcB4 RDU+Sxp0fPHmbj7OdLlcUE72Ny9a0XU8Mar5hYZNEzuZfXQmfu6VOCJ6uPgwBaXgKQIUCSuzr nGasXXtObtPr0qCJCi8TnVZM2D9JkGAx+PY3rUqjNQ9nCbN+GPEeFQCJhEF53TICfQnN/DcVX ZwytkDEvv4J8pvmhfEkCvDLG4JV9dXmGh2GLfOMee1K4Xgk4wJ1vbzJPGjAblhqgZhA6FToLo A6IKcVfCeksyXnKmvMMIjvpp/dmAk9kFG0EYR8giR05B2DHqoOr6xIl5MuILoSA+nZFdFd2zs HkVVWMjK5oAlUEA4MOrp1aw3h9chzurI1eC8vURRp+4Yogt4AmBWy/2b0S7jIWoYJtLyDcEQz J6lmwqmAlyLBB/cDyF4yHZz69OfKqU4A/mGVvFn1ML0rdh/r4Sh4EqZpetqM0hG50tT8Ecimw ijsBVW9aqyocOdQlnICoMIFm876Z1ykisbYCx3IhSznga2K8wEK/KPzrhv/84l9AKpn0= X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: chzigotzky@xenosoft.de Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" The A-Eon Amigaone X1000's Nemo motherboard has an AMD SB600 connected to one of the PCI-e root ports on its PaSemi Pwrficient 1628M SoC. Normally the SB600 southbridge would be connected to a hidden PCI-e port on the system's northbridge, and as a result doesn't fully comply with the PCI-e spec. Add code to relax the PCI-e detection in both the root port and the Linux kernel allowing on board devices to be detected. Signed-off-by: Darren Stevens --- Changes made: v2: Replaced sb600_bus with a define, moved iob_mapbase into sb600_set_flag() Created some register/Flag names (as I don't have the docs for the PA6T-1682M) diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c index c3c6417..116c0fe 100644 --- a/arch/powerpc/platforms/pasemi/pci.c +++ b/arch/powerpc/platforms/pasemi/pci.c @@ -108,6 +108,61 @@ static int workaround_5945(struct pci_bus *bus, unsigned int devfn, return 1; } +#ifdef CONFIG_PPC_PASEMI_NEMO +#define PXP_ERR_CFG_REG 0x4 +#define PXP_IGNORE_PCIE_ERRORS 0x800 +#define SB600_BUS 5 + +static void sb600_set_flag(int bus) +{ + static void __iomem *iob_mapbase = NULL; + struct resource res; + struct device_node *dn; + int err; + + if (iob_mapbase == NULL) { + dn = of_find_compatible_node(NULL, "isa", "pasemi,1682m-iob"); + if (!dn) { + pr_crit("NEMO SB600 missing iob node\n"); + return; + } + + err = of_address_to_resource(dn, 0, &res); + of_node_put(dn); + + if (err) { + pr_crit("NEMO SB600 missing resource\n"); + return; + } + + pr_info("NEMO SB600 IOB base %08llx\n",res.start); + + iob_mapbase = ioremap(res.start + 0x100, 0x94); + } + + if (iob_mapbase != NULL) { + if (bus == SB600_BUS) { + /* + * This is the SB600's bus, tell the PCI-e root port + * to allow non-zero devices to enumerate. + */ + out_le32(iob_mapbase + PXP_ERR_CFG_REG, in_le32(iob_mapbase + PXP_ERR_CFG_REG) | PXP_IGNORE_PCIE_ERRORS); + } else { + /* + * Only scan device 0 on other busses + */ + out_le32(iob_mapbase + PXP_ERR_CFG_REG, in_le32(iob_mapbase + PXP_ERR_CFG_REG) & ~PXP_IGNORE_PCIE_ERRORS); + } + } +} + +#else + +static void sb600_set_flag(int bus) +{ +} +#endif + static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn, int offset, int len, u32 *val) {