Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5295846pxv; Wed, 21 Jul 2021 01:56:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyp7FBbbm8/YAZW6yrLkdH4MpRXTnOe3/E+eOnzW2w9liwck8groboxl7nSZF2e0QvFPckA X-Received: by 2002:a05:6808:490:: with SMTP id z16mr1784804oid.89.1626857804881; Wed, 21 Jul 2021 01:56:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626857804; cv=none; d=google.com; s=arc-20160816; b=dBXEFNa03hKHAbGUZ03jBmaJ0+gnhdw1D20tcitT3GyBf+rGbXw0LjEgy2TUMr1CUA QrZcVSQdYhNnmd4TOuejPrK8hhhcM/tMUIbzblMTJjeE3K667GSYIMTXiXuyITvyqOlE jQXj8sBUZYs9/Gy1Joi3yX/IgH3Ly3c87wLKYRqCIvblMdjZuOfSDfUhBXcijiPxbud8 NiYSa1qUOD9eTfpI49Sa4WxI3IshU/A0IGVLdbZsQry/hhOOoo6moeKB7nCGVvbz5I8I sRty7gBQ83bJUwWdG8p9zgqkxDrLc7bdFRGar9Zr7yhh6DGwP1igaiR3rxoqcsUBAZXc jYuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=lyPOcGI5j4RgwNaCRWZsq748Hyi+tkdVzj9igMgtvHE=; b=Wmzip+R0Du4trRhsRZb/0u3WgnXkYDRnW98fehYtwAYlKyPXjJg1XgVRW2i2vKDA+D 9kpV3EtmXI28Eq4CGkQh7K6ssQtiuRGx6kHURI8zi9O4OIsnxzThG58a2+C51hcoFI+q ms/Dwc9BPBzjkRv2225/x4f6YBg2MR0nDIZYINlXCySGk1s4kD49bnEN7GPZ1Zx6VufW Pr3tLNrHrFWAq9uQitwQRp32KA5UtVWvewoVD8Pa5TImvcbYkkKr/YmJxYv8n762W3ji LnwHKPHMwL7ewmP+Z3cLxLo+p9E8HHsjRohHVYOzUpu7RKgEH5rvLh1qHa+XqiiyOsMa pVFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hU4hNYT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j2si21499866ilo.119.2021.07.21.01.56.33; Wed, 21 Jul 2021 01:56:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hU4hNYT+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235986AbhGUINi (ORCPT + 99 others); Wed, 21 Jul 2021 04:13:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:50204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237042AbhGUH77 (ORCPT ); Wed, 21 Jul 2021 03:59:59 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7008660D07; Wed, 21 Jul 2021 08:39:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626856759; bh=Qq1imSQJcW+JM2nPOv5o8/qLfHa/MxqP6bvtnPhpMCo=; h=From:To:Cc:Subject:Date:From; b=hU4hNYT+8MFbXA+BTSuShi3SLjQNCMAiHF31H+H9FPuocqkjhSoCZMfN8Uo0c/6mp hKMNBQ7iCGlHjdGzJL+FyNh0AtQQdtbgaIAYfOGVTO0+1sLp6YFfv1XbUMgz5ncgoX sKOMKvi+DHZsVu5dcFa0I7X36275ujGS6CGhucRskdnkdD3M3wfXtv4o6Ihn0fqI/y pjuzUmqWEoG4zvLYp3+8P91X9rmaul476JUlWzjEr8zkfEz1UFQIOPWQ5BB91mQgiS VXe/bPKTr9cJp/Puq4kGg4EIpHReGWA4YgeQseQM5d01uCnOnB8eeGMaV2wejNSs7I nkUhMQW0QsaqA== Received: by mail.kernel.org with local (Exim 4.94.2) (envelope-from ) id 1m67l5-0022dG-66; Wed, 21 Jul 2021 10:39:15 +0200 From: Mauro Carvalho Chehab To: Vinod Koul , Bjorn Helgaas , Rob Herring Cc: linuxarm@huawei.com, mauro.chehab@huawei.com, Mauro Carvalho Chehab , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Binghui Wang , Gustavo Pimentel , Jingoo Han , Rob Herring , Xiaowei Song , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-phy@lists.infradead.org Subject: [PATCH v7 00/10] Add support for Hikey 970 PCIe Date: Wed, 21 Jul 2021 10:39:02 +0200 Message-Id: X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Mauro Carvalho Chehab Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This series depends on this one: https://lore.kernel.org/lkml/cover.1626515862.git.mchehab+huawei@kernel.org/ It is available, with its patch dependencies against v5.14-rc1 at: https://github.com/mchehab/linux/commits/pcie-alternate This series add support at the pcie-kirin dirver for it to use a separate PHY driver. Yet, in order to preserve the existing DT schema for Kirin 960, it keeps the Kirin 960 PHY inside the pci driver. I tried to find a way to split it while keeping the DT schema backward-compatible, but currently the PHY core doesn't allow that, as it relies on a "phy" property at the pcie node in order to recognize the PHY driver. Once the pci-kiring is modified to support an external PHY driver, add a Kirin 970 PHY and add the needed properties for the HiKey 970 board to detect the PCIe. It should be noticed that the HiKey 970 design uses 4 different GPIO pins, one for each PERST# signal for each PCIe bus device: - GPIO 56 has a pullup logic from 1V8 to 2V5 connected to a PCIe bridge chip (PEX 8606); - GPIO 25 has a pullup logic from 1V8 to 3V3 connected to the PERST# pin at the M.2 slot; - GPIO 220 has a pullup logic from 1V8 to 3V3 connected to the PERST# pin at the PCIe mini slot; - GPIO 203 has a pullup logic from 1V8 to 3V3 connected to the PERST# pin at the Ethernet chipset. At the first versions, those were mapped as part of the pci-bus, but the pci-bus.yaml schema only allows a single PERST# GPIO. So, on v5, those were moved to the PHY DT schema. However, as Rob complained, on this version, I opted to add a separate patch (the last one) that moves those back to the PCIe of-node. If such patch 09/09 is accepted, then this patch for the DT schema should also be accepted: https://github.com/devicetree-org/dt-schema/pull/56 Tested on Hikey970: $ lspci 00:00.0 PCI bridge: Huawei Technologies Co., Ltd. Device 3670 (rev 01) 01:00.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 02:01.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 02:04.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 02:05.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 02:07.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 02:09.0 PCI bridge: PLX Technology, Inc. PEX 8606 6 Lane, 6 Port PCI Express Gen 2 (5.0 GT/s) Switch (rev ba) 06:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 07) $ ethtool enp6s0 Settings for enp6s0: Supported ports: [ TP MII ] Supported link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Supported pause frame use: Symmetric Receive-only Supports auto-negotiation: Yes Supported FEC modes: Not reported Advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full 1000baseT/Half 1000baseT/Full Advertised pause frame use: Symmetric Receive-only Advertised auto-negotiation: Yes Advertised FEC modes: Not reported Link partner advertised link modes: 10baseT/Half 10baseT/Full 100baseT/Half 100baseT/Full Link partner advertised pause frame use: Symmetric Receive-only Link partner advertised auto-negotiation: Yes Link partner advertised FEC modes: Not reported Speed: 100Mb/s Duplex: Full Auto-negotiation: on master-slave cfg: preferred slave master-slave status: slave Port: Twisted Pair PHYAD: 0 Transceiver: external MDI-X: Unknown netlink error: Operation not permitted Link detected: yes Also tested that Hikey 960 keeps being supported: $ lspci 00:00.0 PCI bridge: Huawei Technologies Co., Ltd. Device 3660 (rev 01) --- v7: - Moved kirin_pcie_match to be closer to the probe function; - Improved patch description for: "PCI: kirin: add support for a PHY layer" - Added missing MODULE_*() macros on both PCI and PHY drivers; - Fixed a warning at hisilicon,phy-hi3670-pcie.yaml reported by Rob Herring's bot. v6: - Use an alternative approach, in order to keep the Kirin 960 PHY internal to the driver, in order to not break the DT schema. The PHY-specific code were made self-contained at pcie-kirin, in order to make easier to split it in the future, if needed. v5: - added "static" to hi3670_pcie_get_eyeparam() declaration on patch 6/8 v4: - dropped the DTS patch, as it depends on a PMIC-related patch series; - minor changes at the patch description; - HiKey and HiSilicon are now using the preferred CamelCase format. Manivannan Sadhasivam (1): arm64: dts: HiSilicon: Add support for HiKey 970 PCIe controller hardware Mauro Carvalho Chehab (9): PCI: kirin: Reorganize the PHY logic inside the driver PCI: kirin: Add support for a PHY layer PCI: kirin: Use regmap for APB registers PCI: kirin: Add MODULE_* macros dt-bindings: PCI: kirin: Fix compatible string dt-bindings: phy: Add bindings for HiKey 970 PCIe PHY phy: HiSilicon: Add driver for Kirin 970 PCIe PHY dt-bindings: PCI: kirin-pcie.txt: Convert it to yaml phy-hi3670-pcie: Move reset-gpios to the PCIe DT schema .../bindings/pci/hisilicon,kirin-pcie.yaml | 87 ++ .../devicetree/bindings/pci/kirin-pcie.txt | 50 - .../devicetree/bindings/pci/snps,dw-pcie.yaml | 2 +- .../phy/hisilicon,phy-hi3670-pcie.yaml | 88 ++ MAINTAINERS | 2 +- arch/arm64/boot/dts/hisilicon/hi3670.dtsi | 70 ++ .../boot/dts/hisilicon/hikey970-pmic.dtsi | 1 - drivers/pci/controller/dwc/pcie-kirin.c | 413 +++++--- drivers/phy/hisilicon/Kconfig | 10 + drivers/phy/hisilicon/Makefile | 1 + drivers/phy/hisilicon/phy-hi3670-pcie.c | 902 ++++++++++++++++++ 11 files changed, 1429 insertions(+), 197 deletions(-) create mode 100644 Documentation/devicetree/bindings/pci/hisilicon,kirin-pcie.yaml delete mode 100644 Documentation/devicetree/bindings/pci/kirin-pcie.txt create mode 100644 Documentation/devicetree/bindings/phy/hisilicon,phy-hi3670-pcie.yaml create mode 100644 drivers/phy/hisilicon/phy-hi3670-pcie.c -- 2.31.1