From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89F0423F42D for ; Thu, 13 Nov 2025 21:45:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.196 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763070348; cv=none; b=cmwR2rJlW6ztJ2IOcnCS/PbLyOuNxicgOYQ+sc+4p+SkeoF1NEcv5hivLDlnRzUxAGsYsEajsF6ll6zYyauuIRJyIqGJWjsNqWVkIlDMkEnARpRQhsqoq6nbm5Ag6fxYDtIRQ6DvyvA6a6lnXgHjEDbdAhUryJzSIbP950QsfRk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763070348; c=relaxed/simple; bh=9BK/aY1DJKiNGs1q0x6hPPgaG4Z4qLB/Bh+9MtSYO0Y=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=bte4QZyoiX2tIzt/n9KTNhkaTS0aCbzOjTV2fydbgjzohT8WNrO6sD11YnnyAGTBR3AcFNeR1C54hnJefFXPNxnajtl7qyFyHMSR0CXC0/p+MmqrXzxnpVlRRU5+sRA8SLyf1/ioBTHiV/ZfpMwo7+PyL0ZzeewwiDm6Z7uwTDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=ki4yGI65; arc=none smtp.client-ip=209.85.166.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="ki4yGI65" Received: by mail-il1-f196.google.com with SMTP id e9e14a558f8ab-433100c59dcso6228745ab.0 for ; Thu, 13 Nov 2025 13:45:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1763070346; x=1763675146; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=B379bUTcQAQWYz6DwkV1TzQYdhegW4cKAiyXnES8aOg=; b=ki4yGI65FMb2mCyi952WbyfyIlsuNy2mH3FYis46NNjAXey8GY6axepk0GZXQmvnmn wXHtKNHRX+t7MQlwX6IvSVF9/oUPiVl5pzI/9SJ4Gqjy1TUZ5ERx3sgJitRhVmOJusSl /HsPwUAeKgBX1FUMGYcR9KsQXlEOuNCNXneMdidoUzkyq4khmVQs3tNFxrya6VLs+IA7 A3wpKu/N5fPJsC4o7IE+jen8iiSa2vXLpLsU4OaayzSH0rhvZgaxfca51FuK9LnzQvw6 pfBZiNEp2FPachyFDeAtbSqyj820lurOdV60DLzuir3VXmyLXFAqqHLM2BfMhXlVt6gL 0KFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763070346; x=1763675146; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=B379bUTcQAQWYz6DwkV1TzQYdhegW4cKAiyXnES8aOg=; b=F5Epyb3GuQkdsNNQ5DKXWUfODR1bOraouRESoZ/Gb5OH15dCKCY/L3K+dYRPgOqgGV KsoqYh4K7X+iVU/y9G7McbwmtGJwotuQu/g4mKdPujugS6N4iMNfB7ux/PqnWgyYQSg8 hAwOeNAFHmy1+QUOQs+BgsaGMoWuRIQmjRnoaARHhe/kglsTjv9Rg8d17VKWR3+BEh3K t1cmhk9IbXofBXFNw9Fos1ahHU2mbdPVppt123a9QnHrfe7DDIqgD+W1cycHqVFE7NFZ jn/FcVXwiGKcCBMqoGy0sy42lb/r1pxWzzR7OxhcabUYWADIat43rf9jqbx4eF+aVXvE OIkA== X-Forwarded-Encrypted: i=1; AJvYcCVN6FbiaKEmOzd2cId09c9RLGHkMFEWe3SLVPf8B6VzZoa8y7oK2cPUAKvlduCmAhojqVF6L68X2BEPu7U=@vger.kernel.org X-Gm-Message-State: AOJu0YyPubn48QxLkHZ3TAutyhdSkvLuQI9/+dHUXfBvdIFWS2ObOY35 3srEOp0dqmEiz0Ncqqq9vNlpOWDdQHJVSo7+bzO+wi4mFu7xubx9XaJ8f8rfGPumgEc= X-Gm-Gg: ASbGnctEmDifFpHH8qnuo8SfLOvqCARwISt7eyz+Q5C0SFs1LmMJhAVvkAfa/lIDYQw /Xg9B1Cp9sewXnSvZZoUpQN3wFwIW9e8RMHiv2LgiZNIdRM3DNHoIxGCKLiOa+/QGx77VCluImy jIe30XLyl9sxqZ6Gu+s9SzMME/IwY7aSHNzKpfDNqYd/q23EmuSRtImoSgBFkgXWixfubFqQ9L8 WY1TjRkuVAGCQVP0DIhDjaPK5NiH755U6Y0ZVeXqLv5yN9CbJVfLT/N8UMAKHmdlYybKFm5Eaec grKBZxTD8BLjEBDTOLIbzDhTxzC4Su7fH2ejpMgrJMVMa5kqSsD1jLXn8ardNCujR41JU06GHm6 3pXUnwOLpRTbTNmHxq8ujbnq/fnpJmWZb9CfFXD2qoOjOSIj6E7v/qDhTUHlM5mKQJbYY94BkHX fmUoRUkJA9ivcIFoCHHn/tweZfAKD5XlSCmDhooY/VsXshAAfIvwXR3w== X-Google-Smtp-Source: AGHT+IGJ0MUov99smegICrZ4kiST3drjyP8OcDyErpcAaWnTogYM2QvmzGI/vYXhzw3nIp4B4JWV4A== X-Received: by 2002:a05:6e02:3813:b0:433:3316:17db with SMTP id e9e14a558f8ab-4348c863a78mr17011835ab.4.1763070345478; Thu, 13 Nov 2025 13:45:45 -0800 (PST) Received: from zippy.localdomain (c-75-72-117-212.hsd1.mn.comcast.net. [75.72.117.212]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-434839a4ac7sm10877115ab.25.2025.11.13.13.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Nov 2025 13:45:44 -0800 (PST) From: Alex Elder To: dlan@gentoo.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, vkoul@kernel.org, kishon@kernel.org, bhelgaas@google.com, lpieralisi@kernel.org, kwilczynski@kernel.org, mani@kernel.org Cc: ziyao@disroot.org, aurelien@aurel32.net, johannes@erdfelt.com, mayank.rana@oss.qualcomm.com, qiang.yu@oss.qualcomm.com, shradha.t@samsung.com, inochiama@gmail.com, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, p.zabel@pengutronix.de, christian.bruel@foss.st.com, thippeswamy.havalige@amd.com, krishna.chundru@oss.qualcomm.com, guodong@riscstar.com, devicetree@vger.kernel.org, linux-pci@vger.kernel.org, linux-phy@lists.infradead.org, spacemit@lists.linux.dev, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 0/7] Introduce SpacemiT K1 PCIe phy and host controller Date: Thu, 13 Nov 2025 15:45:32 -0600 Message-ID: <20251113214540.2623070-1-elder@riscstar.com> X-Mailer: git-send-email 2.48.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series introduces a PHY driver and a PCIe driver to support PCIe on the SpacemiT K1 SoC. The PCIe implementation is derived from a Synopsys DesignWare PCIe IP. The PHY driver supports one combination PCIe/USB PHY as well as two PCIe-only PHYs. The combo PHY port uses one PCIe lane, and the other two ports each have two lanes. All PCIe ports operate at 5 GT/second. The PCIe PHYs must be configured using a value that can only be determined using the combo PHY, operating in PCIe mode. To allow that PHY to be used for USB, the needed calibration step is performed by the PHY driver automatically at probe time. Once this step is done, the PHY can be used for either PCIe or USB. The driver supports 256 MSIs, and initially does not support PCI INTx interrupts. The hardware does not support MSI-X. Version 6 of this series addresses a few comments from Christophe Jaillet, and improves a workaround that disables ASPM L1. The two people who had reported errors on earlier versions of this code have confirmed their NVMe devices now work when configured with the default RISC-V kernel configuration. -Alex This series is available here: https://github.com/riscstar/linux/tree/outgoing/pcie-v6 Between version 5 and version 6: - Aurelien Jarno and Johannes Erdfelt tested this code and found they no longer saw the errors they observed previously - Disabling ASPM L1 is now done earlier, at the end of the dw_pcie_host_ops->init callback rather than ->post_init - The function that disables ASPM L1 has been moved and renamed - The return value from devm_platform_ioremap_resource_byname() is now checked with IS_ERR() - The number of MSI vectors implemented is back to 256, after confirming with SpacemiT that they are all in fact supported - The sentinel entry in the OF match table no longer includes a trailing comma - MODULE_LICENSE() and MODULE_DESCRIPTION() macros are now included Here is version 5 of this series: https://lore.kernel.org/lkml/20251107191557.1827677-1-elder@riscstar.com/ Between version 4 and version 5: - Clarify that INTx interrupts are not currently supported - Add Rob Herring's Reviewed-by on patch 3 - The name of the PCIe root port will always begin with "pcie" - Lines in the bindings are now wrapped at 80 columns - Subject lines are all captialized (after subsystem tags) - Place the PCIe Kconfig option in the proper location based on vendor name (not Kconfig symbol); expand its description - Drop two PCIe controller Kconfig dependencies - Use dw_pcie_readl_dbi() and dw_pcie_writel_dbi() when turning off ASPM L1 - The dw_pcie_host_ops->init callback has been rearranged a bit: - The vendor and device IDs are now set early - PERST# is asserted separate from putting the controller in RC mode and indicating power is detected - phy_init() is now called later, just before deasserting PERST# - Because of timing issues involved in having the root port enable power, getting and enabling the regulator is back to being done in the PCIe controller probe function - The regulator definition is moved back to the PCIe controller DT node, out of the root port sub-node (in "k1-bananapi-f3.dts") Here is version 4 of this series: https://lore.kernel.org/lkml/20251030220259.1063792-1-elder@riscstar.com/ Additional history is available at that link. Alex Elder (7): dt-bindings: phy: spacemit: Add SpacemiT PCIe/combo PHY dt-bindings: phy: spacemit: Introduce PCIe PHY dt-bindings: pci: spacemit: Introduce PCIe host controller phy: spacemit: Introduce PCIe/combo PHY PCI: spacemit: Add SpacemiT PCIe host driver riscv: dts: spacemit: Add a PCIe regulator riscv: dts: spacemit: PCIe and PHY-related updates .../bindings/pci/spacemit,k1-pcie-host.yaml | 157 ++++ .../bindings/phy/spacemit,k1-combo-phy.yaml | 114 +++ .../bindings/phy/spacemit,k1-pcie-phy.yaml | 71 ++ .../boot/dts/spacemit/k1-bananapi-f3.dts | 44 ++ arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 33 + arch/riscv/boot/dts/spacemit/k1.dtsi | 176 +++++ drivers/pci/controller/dwc/Kconfig | 13 + drivers/pci/controller/dwc/Makefile | 1 + drivers/pci/controller/dwc/pcie-spacemit-k1.c | 358 ++++++++++ drivers/phy/Kconfig | 11 + drivers/phy/Makefile | 1 + drivers/phy/phy-spacemit-k1-pcie.c | 670 ++++++++++++++++++ 12 files changed, 1649 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/spacemit,k1-pcie-host.yaml create mode 100644 Documentation/devicetree/bindings/phy/spacemit,k1-combo-phy.yaml create mode 100644 Documentation/devicetree/bindings/phy/spacemit,k1-pcie-phy.yaml create mode 100644 drivers/pci/controller/dwc/pcie-spacemit-k1.c create mode 100644 drivers/phy/phy-spacemit-k1-pcie.c base-commit: 6d7e7251d03f98f26f2ee0dfd21bb0a0480a2178 -- 2.48.1