From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 52B36477291 for ; Mon, 7 Sep 2026 11:26:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788780404; cv=none; b=I+EB2VZikM4KyejeXO2njbe+nJFOx2sErrNIVsLmFxIfW3jz8NamYip4QRxerFuYHJ/S1FBlr9y0F8sV19qr+oWOYFC5G+9R5ZdEbici8BG11xWkLp/D8q8Bxo5YTlJRkErf24R09XoLkL1bGO4ZOg0eBcDc6gWFq8RwZ1/VIHA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788780404; c=relaxed/simple; bh=RyM/haTxWa/nYIBLao3nZXKdo96GACCECSjiTCRDRkk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QbKxms+EtAopI+q+/4zN1+tbrIFXMjMsAZCMFszLLHJiXlGCpCE/ZvaLbSwN2Ba687/DSUnbBgGye1d6EV49au136kC44S98VLyZxr9TVrZElqnpcu92LUekv8Ml08m0NOsS4Z+Kdu/xjc4n6jZ23VuyeT5FtZjQM8P8BHVns/8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J00smpDq; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J00smpDq" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2d9b60c652aso40837135ad.1 for ; Mon, 07 Sep 2026 04:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788780402; x=1789385202; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Rc3uyG1Btuax47jaWosPyczOcgqdfqJHPv/7lDCZEAM=; b=J00smpDqERzGTq8/L89wsUQ/Ubiu+2dHCZqo4Vm4t3hAhpV210Hnu7AF8fKg7D2ndZ 6JyXTPurcv/bBgROQxUoYMjxS13tsPSTMMFlJxglwDQ+GF+qB+zGeDdEbqk3X9g1wuXo MkZJjvjhcacnLW3IXk5mrEUKi9F6P87u9XhOrSvH/1jnQojpe51/DHW+kNpn0twgDloc r1oqCbx+EnnjEUMS5lHTBQtDRvsMLQVy4JNfN8iQ1u3IzDAP4u7w5qRH+uh7FZ0Q3cWs Ed70x/lJ13kCsSCEiKaBUu7JWJXP8QKBQunyi80w08ZkEws04gfI62fQ+LvN8+BecNDP GIRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788780402; x=1789385202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Rc3uyG1Btuax47jaWosPyczOcgqdfqJHPv/7lDCZEAM=; b=DLi++1WVhsugoQCw1yw/faqmfYleqqEKrWVy7Zl976ljyDAkXHh+UeVTr9fYTxJCf+ ecTneqZjsk31PypLf2weuep47fjR2QCYFXvp//4E1h9FhiUl0Y296DYWfhRvisExIU8/ oq+O3Rn1YSjSMoPNjIFQsIRbzqX/U/+i1H0H+VIP33tIL/zTeVp7xlUHtL51zgdNfVDv qSuo6i5qEavvcBJ694har8pVSeZ08KoLz9aC7oviCxXxDCfXzOKkuJlTUkJFi95CfLSw nBR5fap17pRljN+yNZSfDaKTnz8lkHGbYc7SKwkfNlDF256E4jJeX3RsRn3M1i8tKYOv sZ3A== X-Gm-Message-State: AFuF++kixnbUMnaxtLuslt4qJQbPnbQSO3hucyMCI4KRo68xszezjEc6 jReZvN19uT0IS0x3e32rFHEplAkCKE4nYplf+XlYI3vqMhkkJ/zBJQj6 X-Gm-Gg: AYBFou3fWu6lXqfrA+ikMIUf0JTNJtZcaNkq5Ni4tDvXx9H+R2foaSPEnT8gAUqvNhf +ysk2iAcOY67yolY/fHwAZsPX8WARHt7tMdPHzvjd+FzL5/3Z9HY+NW+luysaMIkbNHoU7iXOLw 1FV5SE/JWBJPoMJwQlOQaa5guh0I5ZVL87N3vqSkZzgslxCCWcsGYg14EFOmGms2cTLH2lR0Uf3 zarC7uqVrYPuTcNAhwi/bG9/flQH59vhk4yKBYBh5vWvApSWgBcMKuO239aSb6bt39d4te42Q0P MYQFPrg5iKFkZiSk13lmh96+K+YYp5Ew8tYyX5063etgFnl23ilwxoR8Y5pHp3CmRCz5ijH0fhg 47IwkypKvfqDKQUUzo47zs2O7z5TRCaO+yqOJv5tHIhg3Rt89/ED0anlzm2bQ9sTfBER8+vsKZS qimtxwtVF+YG5TnZgThTGzZNUaENA+RVaNzvW+cKrstiMCOGo= X-Received: by 2002:a17:90b:17cf:b0:398:9be8:ea6a with SMTP id 98e67ed59e1d1-39b26216cf7mr33136274a91.23.1788780401528; Mon, 07 Sep 2026 04:26:41 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b08cacba5sm27707027a91.12.2026.09.07.04.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 04:26:41 -0700 (PDT) From: Inochi Amaoto To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Yixun Lan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Frank Li , Niklas Cassel , Sherry Sun , Arnd Bergmann , Christian Bruel , Krishna Chaitanya Chundru , Senchuan Zhang , Inochi Amaoto , Alex Elder , Xincheng Zhang , Randolph Lin , Siddharth Vadapalli , Andy Shevchenko , Vidya Sagar , Neil Armstrong , Danilo Krummrich , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= , Pengpeng Hou , Anirudh Srinivasan , Gustavo Pimentel Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, Yixun Lan , Longbin Li Subject: [PATCH v5 2/6] PCI: spacemit-k1: Add multiple PHY handles support Date: Mon, 7 Sep 2026 19:26:01 +0800 Message-ID: <20260907112606.465778-3-inochiama@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260907112606.465778-1-inochiama@gmail.com> References: <20260907112606.465778-1-inochiama@gmail.com> Precedence: bulk X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The PCIe controller on Spacemit K3 may use multiple PHYs at the same time. The feature is not supported by the current driver. So extend the PHY definition to support multiple PHY handles. Signed-off-by: Inochi Amaoto --- drivers/pci/controller/dwc/pcie-spacemit-k1.c | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-spacemit-k1.c b/drivers/pci/controller/dwc/pcie-spacemit-k1.c index 9512556d4539..1049391beee8 100644 --- a/drivers/pci/controller/dwc/pcie-spacemit-k1.c +++ b/drivers/pci/controller/dwc/pcie-spacemit-k1.c @@ -51,12 +51,14 @@ struct k1_pcie_device_data { const struct dw_pcie_host_ops *host_ops; const struct dw_pcie_ops *ops; int (*parse_port)(struct k1_pcie *k1); + unsigned int max_phy_count; }; struct k1_pcie { struct dw_pcie pci; const struct k1_pcie_device_data *data; - struct phy *phy; + struct phy_bulk_data *phys; + unsigned int phy_count; void __iomem *link; struct regmap *pmu; /* Errors ignored; MMIO-backed regmap */ u32 pmu_off; @@ -115,6 +117,23 @@ static void k1_pcie_disable_resources(struct k1_pcie *k1) clk_bulk_disable_unprepare(ARRAY_SIZE(pci->app_clks), pci->app_clks); } +static int k1_pcie_get_phy_handle(struct k1_pcie *k1, struct device_node *node) +{ + const struct k1_pcie_device_data *data = k1->data; + struct device *dev = k1->pci.dev; + int count; + + count = devm_of_phy_bulk_get_all(dev, node, &k1->phys); + if (count < 0) + return count; + if (count == 0 || count > data->max_phy_count) + return -EINVAL; + + k1->phy_count = count; + + return 0; +} + /* FIXME: Disable ASPM L1 to avoid errors reported on some NVMe drives */ static void k1_pcie_disable_aspm_l1(struct k1_pcie *k1) { @@ -170,7 +189,7 @@ static int k1_pcie_init(struct dw_pcie_rp *pp) */ regmap_set_bits(k1->pmu, reset_ctrl, DEVICE_TYPE_RC | PCIE_AUX_PWR_DET); - ret = phy_init(k1->phy); + ret = phy_bulk_init(k1->phy_count, k1->phys); if (ret) { k1_pcie_disable_resources(k1); @@ -195,7 +214,7 @@ static void k1_pcie_deinit(struct dw_pcie_rp *pp) regmap_set_bits(k1->pmu, k1->pmu_off + PCIE_CLK_RESET_CONTROL, PCIE_RC_PERST); - phy_exit(k1->phy); + phy_bulk_exit(k1->phy_count, k1->phys); k1_pcie_disable_resources(k1); } @@ -262,23 +281,18 @@ static int k1_pcie_parse_port(struct k1_pcie *k1) { struct device *dev = k1->pci.dev; struct device_node *root_port; - struct phy *phy; + int ret; /* We assume only one root port */ root_port = of_get_next_available_child(dev_of_node(dev), NULL); if (!root_port) return -EINVAL; - phy = devm_of_phy_get(dev, root_port, NULL); + ret = k1_pcie_get_phy_handle(k1, root_port); of_node_put(root_port); - if (IS_ERR(phy)) - return PTR_ERR(phy); - - k1->phy = phy; - - return 0; + return ret; } static int k1_pcie_probe(struct platform_device *pdev) @@ -354,6 +368,7 @@ static const struct k1_pcie_device_data k1_pcie_device_data = { .host_ops = &k1_pcie_host_ops, .ops = &k1_pcie_ops, .parse_port = k1_pcie_parse_port, + .max_phy_count = 1, }; static const struct of_device_id k1_pcie_of_match_table[] = { -- 2.55.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 63D9DC79F89 for ; Mon, 7 Sep 2026 11:26:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KW6w/PNN3qMHH33acBZEP3uKLxFqRkHHILf3aC3+ytA=; b=EigrqJTOSFCVZQ ZrryyahCPBQsJxj7MDTZZIjxUsClxhN/bypNkX895g4Sn9g6wRy4h4dqBnpCE1QdaohfQtPqaclWL qNHLMVh3Zc6grz4/7ikYIaV5j1Mxais6v9oguHM3sdoIW6S8+lOfyDheZvC1ysbqXbqDS9WOna+PB tVd1/e427rfq0XyCp4LKf9sEKAUEBDJ2Ll9LM9/0mS5pCfbHFzzS/g+fxRKtyqufa8abCszMHTBRl Bz5NftcFGyeOgKM6yq0E3z56Cj9N0aYZ41M7aH340ivjHlNihWz+bzg9vIbiSQRBIKzHXoWVlbLQy /FteTj/Vg26Gq1zTxMag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x3XUr-00000006e7r-0YMd; Mon, 07 Sep 2026 11:26:45 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x3XUo-00000006e6K-2DMx for linux-riscv@lists.infradead.org; Mon, 07 Sep 2026 11:26:43 +0000 Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-398a4dcf289so4130362a91.2 for ; Mon, 07 Sep 2026 04:26:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1788780402; x=1789385202; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=Rc3uyG1Btuax47jaWosPyczOcgqdfqJHPv/7lDCZEAM=; b=ThCRu5g6RXg+RPjKrPrOXRMkk1DJB8BwWQkCoDn+xdgJqsvNKnL2evJGD1HJqmGw4N L5Oso2c1JkIefn916SysxZBzCZNpd5gTTYvqJjEm9uq2e+MLGIQzi07e2h5aorcIB8em IKSAc9e7pqs+uvXdCcRANAh2WdXdP2DzCAgCJ426GXK036G4OZpVYKOUEI+tEWi8xaOi vi/nwvv6CfdQWC9uG9LSl2/XGaCkFi9gaVqcoKGIAHh7+tx/W15EaaUzt82Jeknf/dW2 bc2VtyfyNp9DMN7fpwdCt0L3n5Pbts9QpinJEpR0rtK/Cd0LlRU/50axrAT2kzU1enK4 ZYgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1788780402; x=1789385202; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=Rc3uyG1Btuax47jaWosPyczOcgqdfqJHPv/7lDCZEAM=; b=ADe4fYuffw89mjmnJdoJ8J0FT8g8Sp05/+Nqyg9yDzU7dB8Zum4keTr/kBX856YIn8 M0iJV/RlMi6WcjC81EhhU4CBYEJtGQGM8TUB+w91rCgBGBN2MQecpNCxAuu/9eWwzLF6 CUZ1O/aVj02435OH42m82ThlTr+0cN/Dl1LmBpJb5wfQhaDElnQZeA/82KM0bg9L8nnY ocKOwtFTXt1YdiRybgKsH1dDsLBQA8/IztOtbuZu035vALyQ9od3QgYw3GC95h2o/pyA uGK3gMrGaZmgbEyLaZKjRky3FTFdQF8ReOejwJR6DQhgJidl3IGCTCzlHS/w0F2gM6iC /8mA== X-Forwarded-Encrypted: i=1; AKwUvBwgJS12GeTAbkKRdzg55EA2/Gi1wR99OpHxDw62jNkBVNX+fGcU9ClQQznNDeSkEqAQnxbpZR4XluSrjw==@lists.infradead.org X-Gm-Message-State: AFuF++myVn9PXnGz3BT3gRMTvRdSem8syb5/g9+03jNNQwgFjdx1sVnx 6WFICMLbmxbk1seSEI4Tjk2Em9ho0QaXhSIuTv3z09HXUwDqD/hHsmxY X-Gm-Gg: AYBFou2JPtGThfz/ogdgI10X46qX9zji2NfviAeXBxujTmMIb5kNiT/4oUonccAHSO2 1/6sToCtGvxyAXm8f2mZF56czZiKC0IQgOoDCbzYukpBqr//hXShr/7a92TVjYuo7GXSpaeMB+Y Gkr5ew8mfi/yvRzIIY65jnsZp9xQHtA3GJqmFEjSn8Xy0i+9Snnq/+jWnY2J1iuG8JwJ1TtwQ4R Gbytjmx92ekfnDBKf8DkKK5wBNt6/yJMbt18reCIsN5ZLrqz7v4pXF3mEKmi1Th92jaUgPeBEF5 3RATPeKN4v/YoJrbgb0M0Ir1iPZ5aKHhen7rj6o0tsHf+euM9fq+jPGTP1gZ96ZNJ6SLTejfKOG dsdeJTQYngcYZDT4a+WbT/MoX2+avngdoIx8cq0+fUB3GhxM+BS0b8D+8l7/Y8FHl1m1YMK62LM tyyntiuMhklYZzxwk1HDCuZBRA8XboRfP8FGePjW29rvzv94g= X-Received: by 2002:a17:90b:17cf:b0:398:9be8:ea6a with SMTP id 98e67ed59e1d1-39b26216cf7mr33136274a91.23.1788780401528; Mon, 07 Sep 2026 04:26:41 -0700 (PDT) Received: from localhost ([2001:da8:7001:11::cb]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-39b08cacba5sm27707027a91.12.2026.09.07.04.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Sep 2026 04:26:41 -0700 (PDT) From: Inochi Amaoto To: Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Krzysztof Kozlowski , Conor Dooley , Yixun Lan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Frank Li , Niklas Cassel , Sherry Sun , Arnd Bergmann , Christian Bruel , Krishna Chaitanya Chundru , Senchuan Zhang , Inochi Amaoto , Alex Elder , Xincheng Zhang , Randolph Lin , Siddharth Vadapalli , Andy Shevchenko , Vidya Sagar , Neil Armstrong , Danilo Krummrich , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig=20=28The=20Capable=20Hub=29?= , Pengpeng Hou , Anirudh Srinivasan , Gustavo Pimentel Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, spacemit@lists.linux.dev, Yixun Lan , Longbin Li Subject: [PATCH v5 2/6] PCI: spacemit-k1: Add multiple PHY handles support Date: Mon, 7 Sep 2026 19:26:01 +0800 Message-ID: <20260907112606.465778-3-inochiama@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260907112606.465778-1-inochiama@gmail.com> References: <20260907112606.465778-1-inochiama@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260907_042642_583958_76F3E1DC X-CRM114-Status: GOOD ( 19.61 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The PCIe controller on Spacemit K3 may use multiple PHYs at the same time. The feature is not supported by the current driver. So extend the PHY definition to support multiple PHY handles. Signed-off-by: Inochi Amaoto --- drivers/pci/controller/dwc/pcie-spacemit-k1.c | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-spacemit-k1.c b/drivers/pci/controller/dwc/pcie-spacemit-k1.c index 9512556d4539..1049391beee8 100644 --- a/drivers/pci/controller/dwc/pcie-spacemit-k1.c +++ b/drivers/pci/controller/dwc/pcie-spacemit-k1.c @@ -51,12 +51,14 @@ struct k1_pcie_device_data { const struct dw_pcie_host_ops *host_ops; const struct dw_pcie_ops *ops; int (*parse_port)(struct k1_pcie *k1); + unsigned int max_phy_count; }; struct k1_pcie { struct dw_pcie pci; const struct k1_pcie_device_data *data; - struct phy *phy; + struct phy_bulk_data *phys; + unsigned int phy_count; void __iomem *link; struct regmap *pmu; /* Errors ignored; MMIO-backed regmap */ u32 pmu_off; @@ -115,6 +117,23 @@ static void k1_pcie_disable_resources(struct k1_pcie *k1) clk_bulk_disable_unprepare(ARRAY_SIZE(pci->app_clks), pci->app_clks); } +static int k1_pcie_get_phy_handle(struct k1_pcie *k1, struct device_node *node) +{ + const struct k1_pcie_device_data *data = k1->data; + struct device *dev = k1->pci.dev; + int count; + + count = devm_of_phy_bulk_get_all(dev, node, &k1->phys); + if (count < 0) + return count; + if (count == 0 || count > data->max_phy_count) + return -EINVAL; + + k1->phy_count = count; + + return 0; +} + /* FIXME: Disable ASPM L1 to avoid errors reported on some NVMe drives */ static void k1_pcie_disable_aspm_l1(struct k1_pcie *k1) { @@ -170,7 +189,7 @@ static int k1_pcie_init(struct dw_pcie_rp *pp) */ regmap_set_bits(k1->pmu, reset_ctrl, DEVICE_TYPE_RC | PCIE_AUX_PWR_DET); - ret = phy_init(k1->phy); + ret = phy_bulk_init(k1->phy_count, k1->phys); if (ret) { k1_pcie_disable_resources(k1); @@ -195,7 +214,7 @@ static void k1_pcie_deinit(struct dw_pcie_rp *pp) regmap_set_bits(k1->pmu, k1->pmu_off + PCIE_CLK_RESET_CONTROL, PCIE_RC_PERST); - phy_exit(k1->phy); + phy_bulk_exit(k1->phy_count, k1->phys); k1_pcie_disable_resources(k1); } @@ -262,23 +281,18 @@ static int k1_pcie_parse_port(struct k1_pcie *k1) { struct device *dev = k1->pci.dev; struct device_node *root_port; - struct phy *phy; + int ret; /* We assume only one root port */ root_port = of_get_next_available_child(dev_of_node(dev), NULL); if (!root_port) return -EINVAL; - phy = devm_of_phy_get(dev, root_port, NULL); + ret = k1_pcie_get_phy_handle(k1, root_port); of_node_put(root_port); - if (IS_ERR(phy)) - return PTR_ERR(phy); - - k1->phy = phy; - - return 0; + return ret; } static int k1_pcie_probe(struct platform_device *pdev) @@ -354,6 +368,7 @@ static const struct k1_pcie_device_data k1_pcie_device_data = { .host_ops = &k1_pcie_host_ops, .ops = &k1_pcie_ops, .parse_port = k1_pcie_parse_port, + .max_phy_count = 1, }; static const struct of_device_id k1_pcie_of_match_table[] = { -- 2.55.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv