Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp473513ybv; Sat, 22 Feb 2020 07:27:17 -0800 (PST) X-Google-Smtp-Source: APXvYqwWBnICaqctfpmeVrH5vA4SCwxsS8upQkypQR47xGhnrWfrvAaCY/pyIBH2zjhu37vBZova X-Received: by 2002:aca:cf07:: with SMTP id f7mr6538597oig.5.1582385237709; Sat, 22 Feb 2020 07:27:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582385237; cv=none; d=google.com; s=arc-20160816; b=HQnm1W2GqD0YM7RGh9j+stDgHEDaAL2mWkXKYG77Dsg0MsJl5madTLDs6OuEoJj80c zPFglGw2RKOGsuRqMu3/Ma7o9ix5BH/hbjGazYb62W796/Q7W5hFMn7GU6VnL7eqADJE NMtyXV/8+ry5vKaVaswsvcqwJ304s8S4NBvrRORXeMdLvBpCZabBecSbQdOTWN89RQ3d Nf21rqSytVzIfdG1Us1yF6TDjnCtS7RutvMSUC3Ic4E7IL/sRJZoDbdZ02z8MjqEfVBV 4z/CL0llGqHqMBieyMYznyWiq87PJPoj2UamTGl+YrG3k21zYFHIVy3bHQX1kkndQDTb mePw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:subject:message-id:date:from :mime-version:dkim-signature; bh=ZG5hRcyWVVqkC4F/dn/YObRHxUhmkezvdHoGQ54qJ9w=; b=gHKvN5qq3GZEQkmpLb7f0udmyPAN8aC5JyxSF6uIo1FJlZflUoIxBnxGWdevTl5Jj0 jjqVWtocCavasx0RjI/A00wrTib7CGrwzAdhxh1xTixDksWSIaDqeVbfX7w9nqB/LlLu HZtK7D7Vfuspqh12rqMPMZmSdxJb6Mq0nsycpeB52OGcyK9HtZ4BkVRuQiBk5w3MVEuE 2r2QQxgkZh41HirABep6YT9R/ZgyJdYHZNYtTxMJJAgzeioT6Ieo+ynOLQ9N3cSQd5rk OMBp2uJIVDxgfFvdec0IB4fR613B3Roa/IiZLFLwLfDLiXUqTufhhIZqVtSvsHsZe684 neTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J5hED42D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k66si2472279oih.200.2020.02.22.07.27.03; Sat, 22 Feb 2020 07:27:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=J5hED42D; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727781AbgBVPZz (ORCPT + 99 others); Sat, 22 Feb 2020 10:25:55 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:38533 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727445AbgBVPZy (ORCPT ); Sat, 22 Feb 2020 10:25:54 -0500 Received: by mail-qk1-f193.google.com with SMTP id z19so4779948qkj.5; Sat, 22 Feb 2020 07:25:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ZG5hRcyWVVqkC4F/dn/YObRHxUhmkezvdHoGQ54qJ9w=; b=J5hED42DZ8hYQ54gzaRNllbjyjBIOF9o9d+FPHUh6PQ37uHPgMw+GeoHKtdvv7OEDD QBD62hjINZJmm2NrnVoj7CVLU/MnCiRZrRs7g0W+eVSC6gQADnkr5J3qDpLoEXpAxR9J ItaNJ2/gcSevXOP9Arj5YmfzEAxt2YHksQsZiRUtzw3+ZyzMQhMJTEVt2Kvi1RrYicB/ 51Yadr6Aj6xeaG3GS4qfRi7vERxPAUVmqHwYPPwcWc4lZisPEdp5zCc+5ktGSK4ZOcgq XLadmMxHAwpSYNeDM5iqmu0eIJZG26SFd4RKq7bpXH/M5YBfULsvQ7/lejvx3q+AhhJT I63A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ZG5hRcyWVVqkC4F/dn/YObRHxUhmkezvdHoGQ54qJ9w=; b=iXjdHo+jhFcptOMM+MzcSfu5pO2ySrIkgFpJ7tVKNC9c0uASKF2G6/V/q5k+q+N4Wv SvyNCQ0PRTBzVGbU5imRSUQMP95YynBhvxGinadffEEEI4QAvLkgDgPx239y1Lnem5zB jRvgUVtRC6mDvD6q8oh5prmmYODXQRJ806R5Hk8QGPuT/4zujIBAc6yCA0JdfRZq6txC 0SMQJy1uLWsuWPCCt0kgvfp6gnzj5av9d6hF9oofDXYngksDT3uDm01kAiPP4S9f42y7 3ozf1X9YLQV89a0IzsLfUf7ZLsRh/UF9pdUDshT6B7bRv6iBRLi5mxE5TLsXHmrs1a8F VyYA== X-Gm-Message-State: APjAAAW/05fkTroilz3KGVOpfmCxBi0xwPaPC5mfwRtTFOqriQUpBJ2i euO0KcI24VL5mmKyrIWHtZWEEeEpTiTGHZ1AeYpSNgpgmt0= X-Received: by 2002:a37:742:: with SMTP id 63mr40047459qkh.31.1582385152175; Sat, 22 Feb 2020 07:25:52 -0800 (PST) MIME-Version: 1.0 From: Fawad Lateef Date: Sat, 22 Feb 2020 16:25:41 +0100 Message-ID: Subject: Help needed in understanding weird PCIe issue on imx6q (PCIe just goes bad) To: Linux Kernel Mailing List , linux-pci@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, I am trying to figure-out an issue on our i.MX6Q platform based design where PCIe interface goes bad. We have a Phytec i.MX6Q eMMC SOM, attached to our custom designed board. PCIe root-complex from i.MX6Q is attached to PLX switch (PEX8605). Linux kernel version is 4.19.9x and also 4.14.134 (from phytec's linux-mainline repo). Kernel do not have PCIe hot-plug and PNP enabled in config. PLX switch #PERST is attached to a GPIO pin and stays in disable state until Linux is booted. So at boot time only PCIe root-complex is initialized by kernel. After boot if I do "lspci -v" and see everything good from PCIe root-complex (below): ~ # lspci -v 00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0, IRQ 295 Memory at 01000000 (32-bit, non-prefetchable) [size=1M] Bus: primary=00, secondary=01, subordinate=ff, sec-latency=0 I/O behind bridge: None Memory behind bridge: None Prefetchable memory behind bridge: None [virtual] Expansion ROM at 01100000 [disabled] [size=64K] Capabilities: [40] Power Management version 3 Capabilities: [50] MSI: Enable+ Count=1/1 Maskable+ 64bit+ Capabilities: [70] Express Root Port (Slot-), MSI 00 Capabilities: [100] Advanced Error Reporting Capabilities: [140] Virtual Channel Kernel driver in use: pcieport Then I enable the #PERST pin of PLX switch, everything is still good (no rescan on Linux is done yet) ~ # echo 139 > /sys/class/gpio/export ~ # echo out > /sys/class/gpio/gpio139/direction ~ # echo 1 > /sys/class/gpio/gpio139/value ~ # lspci -v 00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01) (prog-if 00 [Normal decode]) Flags: bus master, fast devsel, latency 0, IRQ 295 Memory at 01000000 (32-bit, non-prefetchable) [size=1M] Bus: primary=00, secondary=01, subordinate=ff, sec-latency=0 I/O behind bridge: None Memory behind bridge: None Prefetchable memory behind bridge: None [virtual] Expansion ROM at 01100000 [disabled] [size=64K] Capabilities: [40] Power Management version 3 Capabilities: [50] MSI: Enable+ Count=1/1 Maskable+ 64bit+ Capabilities: [70] Express Root Port (Slot-), MSI 00 Capabilities: [100] Advanced Error Reporting Capabilities: [140] Virtual Channel Kernel driver in use: pcieport Now just disable/put-in-reset the PLX switch (Linux don't see the switch yet, as no rescan on PCIe was done). Now "lspci -v" and root-complex goes bad. ~ # echo 0 > /sys/class/gpio/gpio139/value ~ # lspci -v 00:00.0 PCI bridge: Synopsys, Inc. Device abcd (rev 01) (prog-if 00 [Normal decode]) Flags: fast devsel, IRQ 295 Memory at 01000000 (64-bit, prefetchable) [disabled] [size=1M] Bus: primary=00, secondary=00, subordinate=00, sec-latency=0 I/O behind bridge: 00000000-00000fff [size=4K] Memory behind bridge: 00000000-000fffff [size=1M] Prefetchable memory behind bridge: 00000000-000fffff [size=1M] [virtual] Expansion ROM at 01100000 [disabled] [size=64K] Capabilities: [40] Power Management version 3 Capabilities: [50] MSI: Enable- Count=1/1 Maskable+ 64bit+ Capabilities: [70] Express Root Port (Slot-), MSI 00 Capabilities: [100] Advanced Error Reporting Capabilities: [140] Virtual Channel Kernel driver in use: pcieport ~ # uname -a Linux buildroot-2019.08-imx6 4.14.134-phy2 #1 SMP Thu Feb 20 12:13:33 UTC 2020 armv7l GNU/Linux ~ # I am really not sure what is going wrong here. Did I am missing something basic? Thanks in advance, -- Fawad Lateef