From nobody Sun Feb 8 12:32:43 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1C19E27A107; Mon, 29 Dec 2025 17:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; cv=none; b=gH3YbPzhTbReW8l26R1f2J8oyStGhEIjqmKYFogkSQAFXnTjwDMCCL+rmSEYxR2ynTpXu8cz6v4RCOJT25145979ivj1wzslElPt2JK2z/hLK4Cf25eYZ304aCrhrv4Slci33fz7XdmFJMa7696ouJo+Cdqf7T/TFGCFJr0G5as= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; c=relaxed/simple; bh=qTc5SaA61ig61zVNW7D9hWn6aBTF/l4gXSKl4hc/NQI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lDd2+r0QIzrh61R1Yi9hVtL2eAJfn4X2LJj2mIJ+bYh7TuQgOZ3WyK8Uert7UIYvV16oucsEOCq5eez7vtnsOEQKF86IyLyhrf6aAeqg+wTNFaYiuIl3/z6ex2ioBSqUfRqpQPJK1RDSd4X1J0dxSwTA0hfRkiMSg2RdJXXzoss= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JlUFPEML; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="JlUFPEML" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9E36CC19423; Mon, 29 Dec 2025 17:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767029225; bh=qTc5SaA61ig61zVNW7D9hWn6aBTF/l4gXSKl4hc/NQI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=JlUFPEMLzZ3hOunB4Z00NwTj5v317h1eCOay870n//tZnG3SQRnpHbuhsVZpt5lIz 8JxS759MXAc9EqIWsEaUyRrG44R/e6FXeeIBYT5y3WFrwRxiwisQNKPREjwS6lAHie dl/rj8jIiW2QAtk9z1TxpxrKh0DuGKo91IaGgvb+ncdGta4X8dDw+IeN+yIMLHeHHW 1etGXsGh2K8Jt0rYecY+I+ePz4lWW5Ad1lzXc3X4Id7xqAfRrwaLhPLfR5Zf5rKVr/ gZF297l3AfEY0lCwZ/mVWKwDCKlN4mB7TaCEAsMLtuVVmaywGTODiv4WFrtfOze6r4 9nvJNo3s3KEaw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B506E92733; Mon, 29 Dec 2025 17:27:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 29 Dec 2025 22:56:52 +0530 Subject: [PATCH v3 1/7] PCI/pwrctrl: tc9563: Use put_device() instead of i2c_put_adapter() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251229-pci-pwrctrl-rework-v3-1-c7d5918cd0db@oss.qualcomm.com> References: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> In-Reply-To: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=1625; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=8t2SQeMKMKhDKWeUnGaK47mbYO4MIS6FUHdrtMxCfJY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpUrnlpVI8Wey3qog7gIOmuF4I8KZkiamm+aBDW BztCf8ui8aJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVK55QAKCRBVnxHm/pHO 9dYgB/0e4FpTYWfOGHu+fNjssaPt0KVbNbLGRbttlkDnUVrDoR7U0xXUFIkFATalU3TdOKcOwHX nBis7bJhHpwl7nLtR3pvN7J9zO7VMFfgRhsnBDXFrc/kmUYzoUGxAnjQYmzwM8bQ65CPzure6YF ygLEg5K+eFKqxfeQoKoAkEYwlyG3domxX5RQVUmdfsaFfk4n6inayhdhtctI3pRlPNoiOeLwnmN GEZvbMmfKX1cRSojXcRZl4mqlJ7Ml8IR3rmVfsMRH2bQuekzCWdHgdqi8+3JQk4KY8KYMVP/teP gQ4lAycGXTdWoUP79H97XIO7TJHIz5/4Qrj6q/RAQbi6Bs2e X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam The API comment for of_find_i2c_adapter_by_node() recommends using put_device() to drop the reference count of I2C adapter instead of using i2c_put_adapter(). So replace i2c_put_adapter() with put_device(). Fixes: 4c9c7be47310 ("PCI: pwrctrl: Add power control driver for TC9563") Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bartosz Golaszewski --- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl= /pci-pwrctrl-tc9563.c index ec423432ac65..0a63add84d09 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c @@ -533,7 +533,7 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) ctx->client =3D i2c_new_dummy_device(ctx->adapter, addr); if (IS_ERR(ctx->client)) { dev_err(dev, "Failed to create I2C client\n"); - i2c_put_adapter(ctx->adapter); + put_device(&ctx->adapter->dev); return PTR_ERR(ctx->client); } =20 @@ -613,7 +613,7 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) tc9563_pwrctrl_power_off(ctx); remove_i2c: i2c_unregister_device(ctx->client); - i2c_put_adapter(ctx->adapter); + put_device(&ctx->adapter->dev); return ret; } =20 @@ -623,7 +623,7 @@ static void tc9563_pwrctrl_remove(struct platform_devic= e *pdev) =20 tc9563_pwrctrl_power_off(ctx); i2c_unregister_device(ctx->client); - i2c_put_adapter(ctx->adapter); + put_device(&ctx->adapter->dev); } =20 static const struct of_device_id tc9563_pwrctrl_of_match[] =3D { --=20 2.48.1 From nobody Sun Feb 8 12:32:43 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E617330B0E; Mon, 29 Dec 2025 17:27:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; cv=none; b=Ek/nnHWOijGMCuJOyeXauaEtV5b3d973mRRLpLnoSVWOZekb71dI9lTgOkxQ4NrlqY8tvu39QnI9Q++sGKSR+RDS29X1BkpuvGA18VTGz1JJC1DSGAW2tXX7KpMNrngsB8reTjfLazMR5YILOQqWMKDwtmL7geOMv507Nt53WjE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; c=relaxed/simple; bh=9S+RZBSNtqwSmExPJ4wF61RXfqhy1HEeKgaDciozegU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ww81RzR/FkrBqFbFRPT60g8JxfGd5FqzIWLupJ+AfP3mjihk/7ts3kKft3V2J815CLotCUfkLwnq8uyZPFYZktI8JOV6vPKvLt6+CyzAEreSc1DvGnrGQT1QG4pkx6kNCAef+qy2A+r1El3KDEYzuDzY2x4msmXBteADuOHNsbk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jRC1m9uZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jRC1m9uZ" Received: by smtp.kernel.org (Postfix) with ESMTPS id C7B70C19424; Mon, 29 Dec 2025 17:27:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767029225; bh=9S+RZBSNtqwSmExPJ4wF61RXfqhy1HEeKgaDciozegU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=jRC1m9uZwl6vgfLubClXaRnLd3qbtqUinwRlrzSWkcdhKfz25a+FPgiBm+QTB/fLV fsA6KEV6JPmA6flmH4iOJdRxaTc9hLSWjsWmCim9DqdS7CX4cZJ4iwaQVtcMKiQro9 SE215VtZsbzUSDGgwui+4oiGXtlpIUNqpq1NI+LebefTGqMSie+vugWenrnznr21qP z2VYpfSul/qU4dqhCoXYeV9M/eaC9RS3bARshqcsq5RUjMRQB9O0BSeGSTWtxtRRMw oKERWeZOQYEY1RQrNyZrSS1Ft4N9MFm5Vqtzh/BO7uJsi32BD+Z7A8QxcepoyL7yW8 YNHjxD/vBDJ1A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5F28E92FC0; Mon, 29 Dec 2025 17:27:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 29 Dec 2025 22:56:53 +0530 Subject: [PATCH v3 2/7] PCI/pwrctrl: Add 'struct pci_pwrctrl::power_{on/off}' callbacks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251229-pci-pwrctrl-rework-v3-2-c7d5918cd0db@oss.qualcomm.com> References: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> In-Reply-To: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam , Chen-Yu Tsai X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=8783; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=UdCn1zba1rF1OMh25/oYKhGrsiwFp0kZZRxKXfxiHDM=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpUrnlzKLgl/0L1YcPaazxV0SskpD8bG/J6ikF5 hRZF0jbX7+JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVK55QAKCRBVnxHm/pHO 9ddyB/0bsi4lTpfG/fKos5Ub8ZSw6Y358J+4tYc8mxdwO3omJHxhQLY9lSQeDEONuZ1tTWvoaOg P1XZ6Z6Xe3VNCIqHPHj69fRPUMfltbfhpgO6IrAUydAgG7WXay99veGLbJKVvLM3gei9FjMLiK/ ciwlbY1xVblhnCo0eSYK/MPprV55jmgNROECCpTfjsznzpwwIZE/8oGtZxTpU/YDCFrJgvwaQFH HWp9tjUeRpsJc3HD45l7LkfPB1QpF+wEc+5Uj55GN2xDANLd0xiWKEkj4gXHvdYLSEorlrmr5VT Bz20KIry0ihrh5Dolm/bqbw6yIB7ba7ccOsH5UvikbPysAIG X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam To allow the pwrctrl core to control the power on/off sequences of the pwrctrl drivers, add the 'struct pci_pwrctrl::power_{on/off}' callbacks and populate them in the respective pwrctrl drivers. The pwrctrl drivers still power on the resources on their own now. So there is no functional change. Co-developed-by: Krishna Chaitanya Chundru Signed-off-by: Krishna Chaitanya Chundru Tested-by: Chen-Yu Tsai Signed-off-by: Manivannan Sadhasivam --- drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 27 +++++++++++++++--- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 20 +++++++++---- drivers/pci/pwrctrl/slot.c | 48 ++++++++++++++++++++++------= ---- include/linux/pci-pwrctrl.h | 4 +++ 4 files changed, 75 insertions(+), 24 deletions(-) diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl= /pci-pwrctrl-pwrseq.c index 4e664e7b8dd2..0fb9038a1d18 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c @@ -52,11 +52,27 @@ static const struct pci_pwrctrl_pwrseq_pdata pci_pwrctr= l_pwrseq_qcom_wcn_pdata =3D .validate_device =3D pci_pwrctrl_pwrseq_qcm_wcn_validate_device, }; =20 +static int pci_pwrctrl_pwrseq_power_on(struct pci_pwrctrl *ctx) +{ + struct pci_pwrctrl_pwrseq_data *data =3D container_of(ctx, struct pci_pwr= ctrl_pwrseq_data, + ctx); + + return pwrseq_power_on(data->pwrseq); +} + +static void pci_pwrctrl_pwrseq_power_off(struct pci_pwrctrl *ctx) +{ + struct pci_pwrctrl_pwrseq_data *data =3D container_of(ctx, struct pci_pwr= ctrl_pwrseq_data, + ctx); + + pwrseq_power_off(data->pwrseq); +} + static void devm_pci_pwrctrl_pwrseq_power_off(void *data) { - struct pwrseq_desc *pwrseq =3D data; + struct pci_pwrctrl_pwrseq_data *pwrseq_data =3D data; =20 - pwrseq_power_off(pwrseq); + pci_pwrctrl_pwrseq_power_off(&pwrseq_data->ctx); } =20 static int pci_pwrctrl_pwrseq_probe(struct platform_device *pdev) @@ -85,16 +101,19 @@ static int pci_pwrctrl_pwrseq_probe(struct platform_de= vice *pdev) return dev_err_probe(dev, PTR_ERR(data->pwrseq), "Failed to get the power sequencer\n"); =20 - ret =3D pwrseq_power_on(data->pwrseq); + ret =3D pci_pwrctrl_pwrseq_power_on(&data->ctx); if (ret) return dev_err_probe(dev, ret, "Failed to power-on the device\n"); =20 ret =3D devm_add_action_or_reset(dev, devm_pci_pwrctrl_pwrseq_power_off, - data->pwrseq); + data); if (ret) return ret; =20 + data->ctx.power_on =3D pci_pwrctrl_pwrseq_power_on; + data->ctx.power_off =3D pci_pwrctrl_pwrseq_power_off; + pci_pwrctrl_init(&data->ctx, dev); =20 ret =3D devm_pci_pwrctrl_device_set_ready(dev, &data->ctx); diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl= /pci-pwrctrl-tc9563.c index 0a63add84d09..0393af2a099c 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c @@ -434,15 +434,20 @@ static int tc9563_pwrctrl_parse_device_dt(struct tc95= 63_pwrctrl_ctx *ctx, struct return 0; } =20 -static void tc9563_pwrctrl_power_off(struct tc9563_pwrctrl_ctx *ctx) +static void tc9563_pwrctrl_power_off(struct pci_pwrctrl *pwrctrl) { + struct tc9563_pwrctrl_ctx *ctx =3D container_of(pwrctrl, + struct tc9563_pwrctrl_ctx, pwrctrl); + gpiod_set_value(ctx->reset_gpio, 1); =20 regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); } =20 -static int tc9563_pwrctrl_bring_up(struct tc9563_pwrctrl_ctx *ctx) +static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl) { + struct tc9563_pwrctrl_ctx *ctx =3D container_of(pwrctrl, + struct tc9563_pwrctrl_ctx, pwrctrl); struct tc9563_pwrctrl_cfg *cfg; int ret, i; =20 @@ -502,7 +507,7 @@ static int tc9563_pwrctrl_bring_up(struct tc9563_pwrctr= l_ctx *ctx) return 0; =20 power_off: - tc9563_pwrctrl_power_off(ctx); + tc9563_pwrctrl_power_off(&ctx->pwrctrl); return ret; } =20 @@ -591,7 +596,7 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) goto remove_i2c; } =20 - ret =3D tc9563_pwrctrl_bring_up(ctx); + ret =3D tc9563_pwrctrl_power_on(&ctx->pwrctrl); if (ret) goto remove_i2c; =20 @@ -601,6 +606,9 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) goto power_off; } =20 + ctx->pwrctrl.power_on =3D tc9563_pwrctrl_power_on; + ctx->pwrctrl.power_off =3D tc9563_pwrctrl_power_off; + ret =3D devm_pci_pwrctrl_device_set_ready(dev, &ctx->pwrctrl); if (ret) goto power_off; @@ -610,7 +618,7 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) return 0; =20 power_off: - tc9563_pwrctrl_power_off(ctx); + tc9563_pwrctrl_power_off(&ctx->pwrctrl); remove_i2c: i2c_unregister_device(ctx->client); put_device(&ctx->adapter->dev); @@ -621,7 +629,7 @@ static void tc9563_pwrctrl_remove(struct platform_devic= e *pdev) { struct tc9563_pwrctrl_ctx *ctx =3D platform_get_drvdata(pdev); =20 - tc9563_pwrctrl_power_off(ctx); + tc9563_pwrctrl_power_off(&ctx->pwrctrl); i2c_unregister_device(ctx->client); put_device(&ctx->adapter->dev); } diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c index 3320494b62d8..14701f65f1f2 100644 --- a/drivers/pci/pwrctrl/slot.c +++ b/drivers/pci/pwrctrl/slot.c @@ -17,13 +17,36 @@ struct pci_pwrctrl_slot_data { struct pci_pwrctrl ctx; struct regulator_bulk_data *supplies; int num_supplies; + struct clk *clk; }; =20 -static void devm_pci_pwrctrl_slot_power_off(void *data) +static int pci_pwrctrl_slot_power_on(struct pci_pwrctrl *ctx) { - struct pci_pwrctrl_slot_data *slot =3D data; + struct pci_pwrctrl_slot_data *slot =3D container_of(ctx, struct pci_pwrct= rl_slot_data, ctx); + int ret; + + ret =3D regulator_bulk_enable(slot->num_supplies, slot->supplies); + if (ret < 0) { + dev_err(slot->ctx.dev, "Failed to enable slot regulators\n"); + return ret; + } + + return clk_prepare_enable(slot->clk); +} + +static void pci_pwrctrl_slot_power_off(struct pci_pwrctrl *ctx) +{ + struct pci_pwrctrl_slot_data *slot =3D container_of(ctx, struct pci_pwrct= rl_slot_data, ctx); =20 regulator_bulk_disable(slot->num_supplies, slot->supplies); + clk_disable_unprepare(slot->clk); +} + +static void devm_pci_pwrctrl_slot_release(void *data) +{ + struct pci_pwrctrl_slot_data *slot =3D data; + + pci_pwrctrl_slot_power_off(&slot->ctx); regulator_bulk_free(slot->num_supplies, slot->supplies); } =20 @@ -31,7 +54,6 @@ static int pci_pwrctrl_slot_probe(struct platform_device = *pdev) { struct pci_pwrctrl_slot_data *slot; struct device *dev =3D &pdev->dev; - struct clk *clk; int ret; =20 slot =3D devm_kzalloc(dev, sizeof(*slot), GFP_KERNEL); @@ -46,23 +68,21 @@ static int pci_pwrctrl_slot_probe(struct platform_devic= e *pdev) } =20 slot->num_supplies =3D ret; - ret =3D regulator_bulk_enable(slot->num_supplies, slot->supplies); - if (ret < 0) { - dev_err_probe(dev, ret, "Failed to enable slot regulators\n"); - regulator_bulk_free(slot->num_supplies, slot->supplies); - return ret; - } =20 - ret =3D devm_add_action_or_reset(dev, devm_pci_pwrctrl_slot_power_off, + ret =3D devm_add_action_or_reset(dev, devm_pci_pwrctrl_slot_release, slot); if (ret) return ret; =20 - clk =3D devm_clk_get_optional_enabled(dev, NULL); - if (IS_ERR(clk)) { - return dev_err_probe(dev, PTR_ERR(clk), + slot->clk =3D devm_clk_get_optional(dev, NULL); + if (IS_ERR(slot->clk)) + return dev_err_probe(dev, PTR_ERR(slot->clk), "Failed to enable slot clock\n"); - } + + pci_pwrctrl_slot_power_on(&slot->ctx); + + slot->ctx.power_on =3D pci_pwrctrl_slot_power_on; + slot->ctx.power_off =3D pci_pwrctrl_slot_power_off; =20 pci_pwrctrl_init(&slot->ctx, dev); =20 diff --git a/include/linux/pci-pwrctrl.h b/include/linux/pci-pwrctrl.h index 4aefc7901cd1..bd0ee9998125 100644 --- a/include/linux/pci-pwrctrl.h +++ b/include/linux/pci-pwrctrl.h @@ -31,6 +31,8 @@ struct device_link; /** * struct pci_pwrctrl - PCI device power control context. * @dev: Address of the power controlling device. + * @power_on: Callback to power on the power controlling device. + * @power_off: Callback to power off the power controlling device. * * An object of this type must be allocated by the PCI power control devic= e and * passed to the pwrctrl subsystem to trigger a bus rescan and setup a dev= ice @@ -38,6 +40,8 @@ struct device_link; */ struct pci_pwrctrl { struct device *dev; + int (*power_on)(struct pci_pwrctrl *pwrctrl); + void (*power_off)(struct pci_pwrctrl *pwrctrl); =20 /* private: internal use only */ struct notifier_block nb; --=20 2.48.1 From nobody Sun Feb 8 12:32:43 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 61C6D330B37; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; cv=none; b=VXbyR+/rUCNQENwwEXHWNzMpitdcfBikgUmpWU3txXsKr1HYBDrsxuFNfwgEEDdWjdSRST7Svja3sgvzFRn5k3cRqodOfzbs0lNM0HXBkGNFp0gAyLvCWpKN22AaKPtmqelOI925GmzdB0saHUPAgcmQavURactMNZiu27ulUpA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; c=relaxed/simple; bh=4C3MWBrp1NAgpv00HIer7LkmbznN1nABu5eQ8ATVuzk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=OwjcA777oBnUSz41jIgxa/rVYT2Y4Z+J38PAgWGI/Tcw+wu/HQgvRxEoisnH5KtZxJMocBeSQkrYA3eDK/djGBOtrigmBMo+dUXLXg7cUZTSJww0KJ2hCHX4NcRsLrdbrWjR8+opc9Oy1rUfkPpfOKpamrZ3Izh+C+PxTeDQM3Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mZrepUjG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mZrepUjG" Received: by smtp.kernel.org (Postfix) with ESMTPS id 02097C19421; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767029226; bh=4C3MWBrp1NAgpv00HIer7LkmbznN1nABu5eQ8ATVuzk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=mZrepUjGVKruwA069MbFSQ+H2sntDNyyxSL4mES4VxSdUBVmavMc57+HFB/a5douL SB6VFDCukhe57vY30FqdAu5EToSyWrZOo9w12W7plbEcd9MQjWo06mF4zVxbTh6gFQ QtTw82dBKrhj0G1T4bqzJM0LSUNf7ptdWGeQDU90YcDXFxUv1dWApqn8ZJEUNHX+ot EXQfJ4RjFjfVb0yxbDRmmtUcWR/UU5jL40RPNqWdAndG2LowRqsc9iq6C9OvoBiF8J dy2he4gMWfhCc0ZxEL0pDXoKHMcPvj/3qmju+mkbwaelIvBa0qmCaBSiWqwPcnaOIK I2HaevX/TkteA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0C39E92FC4; Mon, 29 Dec 2025 17:27:05 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 29 Dec 2025 22:56:54 +0530 Subject: [PATCH v3 3/7] PCI/pwrctrl: Add APIs for explicitly creating and destroying pwrctrl devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251229-pci-pwrctrl-rework-v3-3-c7d5918cd0db@oss.qualcomm.com> References: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> In-Reply-To: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam , Chen-Yu Tsai X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=7390; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=FhWYfEqaBG50cN6COgy1sseIAFEg1RKECjuWPCA8w/g=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpUrnm6sWiVXj1wraiubfv1/NICOxJuAebZYrmh 9xWBxcSxl+JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVK55gAKCRBVnxHm/pHO 9XECB/9grPLddqqRaLg6M5h85Cske23YGoDQZWrec8LGsVRalPFJIGuw7Zf/M1dgrL7bXuaBqij kAOmBXVbkFjO+a5a6OKcBWVDxiv6CZGdSZ8PYoXe/aWDj0Ov92PfjpmC325aRb/J3FfP0qCviSU vm7zkfkYDs2IdzjZE751pTYONb6ZKd68kOEja9dyh969An0XjcPIrQ0jb2GEq0MjCQzwF/DUUVl 4MX6nNFnRhPr7/eVRce0Pc4ZyVdNtdMnPCUu7e0IodTg8vZMaxJc80TiGeRtgOWo0QjbmCIapFk hHmWzQXwQpcIoz0Cw7kogfQd5O9LHm4b+RS1N1Wf8mcDyxqU X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Krishna Chaitanya Chundru Previously, the PCI core created pwrctrl devices during pci_scan_device() on its own and then skipped enumeration of those devices, hoping the pwrctrl driver would power them on and trigger a bus rescan. This approach works for endpoint devices directly connected to Root Ports, but it fails for PCIe switches acting as bus extenders. When the switch requires pwrctrl support, and the pwrctrl driver is not available during the pwrctrl device creation, it's enumeration will be skipped during the initial PCI bus scan. This premature scan leads the PCI core to allocate resources (bridge windows, bus numbers) for the upstream bridge based on available downstream buses at scan time. For non-hotplug capable bridges, PCI core typically allocates resources based on the number of buses available during the initial bus scan, which happens to be just one if the switch is not powered on and enumerated at that time. When the switch gets enumerated later on, it will fail due to the lack of upstream resources. As a result, a PCIe switch powered on by the pwrctrl driver cannot be reliably enumerated currently. Either the switch has to be enabled in the bootloader or the switch pwrctrl driver has to be loaded during the pwrctrl device creation time to workaround these issues. This commit introduces new APIs to explicitly create and destroy pwrctrl devices from controller drivers by recursively scanning the PCI child nodes of the controller. These APIs allow creating pwrctrl devices based on the original criteria and are intended to be called during controller probe and removal. These APIs, together with the upcoming APIs for power on/off will allow the controller drivers to power on all the devices before starting the initial bus scan, thereby solving the resource allocation issue. Signed-off-by: Krishna Chaitanya Chundru [mani: splitted the patch, cleaned up the code, and rewrote description] Tested-by: Chen-Yu Tsai Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bartosz Golaszewski --- drivers/pci/of.c | 1 + drivers/pci/pwrctrl/core.c | 113 ++++++++++++++++++++++++++++++++++++++++= ++++ include/linux/pci-pwrctrl.h | 8 +++- 3 files changed, 121 insertions(+), 1 deletion(-) diff --git a/drivers/pci/of.c b/drivers/pci/of.c index 3579265f1198..9bb5f258759b 100644 --- a/drivers/pci/of.c +++ b/drivers/pci/of.c @@ -867,6 +867,7 @@ bool of_pci_supply_present(struct device_node *np) =20 return false; } +EXPORT_SYMBOL_GPL(of_pci_supply_present); =20 #endif /* CONFIG_PCI */ =20 diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c index 6bdbfed584d6..844b5649b663 100644 --- a/drivers/pci/pwrctrl/core.c +++ b/drivers/pci/pwrctrl/core.c @@ -3,14 +3,21 @@ * Copyright (C) 2024 Linaro Ltd. */ =20 +#define dev_fmt(fmt) "Pwrctrl: " fmt + #include #include #include +#include +#include #include #include +#include #include #include =20 +#include "../pci.h" + static int pci_pwrctrl_notify(struct notifier_block *nb, unsigned long act= ion, void *data) { @@ -145,6 +152,112 @@ int devm_pci_pwrctrl_device_set_ready(struct device *= dev, } EXPORT_SYMBOL_GPL(devm_pci_pwrctrl_device_set_ready); =20 +static int pci_pwrctrl_create_device(struct device_node *np, struct device= *parent) +{ + struct platform_device *pdev; + int ret; + + for_each_available_child_of_node_scoped(np, child) { + ret =3D pci_pwrctrl_create_device(child, parent); + if (ret) + return ret; + } + + /* Bail out if the platform device is already available for the node */ + pdev =3D of_find_device_by_node(np); + if (pdev) { + put_device(&pdev->dev); + return 0; + } + + /* + * Sanity check to make sure that the node has the compatible property + * to allow driver binding. + */ + if (!of_property_present(np, "compatible")) + return 0; + + /* + * Check whether the pwrctrl device really needs to be created or not. + * This is decided based on at least one of the power supplies being + * defined in the devicetree node of the device. + */ + if (!of_pci_supply_present(np)) { + dev_dbg(parent, "Skipping OF node: %s\n", np->name); + return 0; + } + + /* Now create the pwrctrl device */ + pdev =3D of_platform_device_create(np, NULL, parent); + if (!pdev) { + dev_err(parent, "Failed to create pwrctrl device for node: %s\n", np->na= me); + return -EINVAL; + } + + return 0; +} + +/** + * pci_pwrctrl_create_devices - Create pwrctrl devices + * + * @parent: Parent PCI device for which the pwrctrl devices need to be cre= ated. + * + * This function recursively creates pwrctrl devices for the child nodes + * of the specified PCI parent device in a depth first manner. On error, a= ll + * created devices will be destroyed. + * + * Returns: 0 on success, negative error number on error. + */ +int pci_pwrctrl_create_devices(struct device *parent) +{ + int ret; + + for_each_available_child_of_node_scoped(parent->of_node, child) { + ret =3D pci_pwrctrl_create_device(child, parent); + if (ret) { + pci_pwrctrl_destroy_devices(parent); + return ret; + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(pci_pwrctrl_create_devices); + +static void pci_pwrctrl_destroy_device(struct device_node *np) +{ + struct platform_device *pdev; + + for_each_available_child_of_node_scoped(np, child) + pci_pwrctrl_destroy_device(child); + + pdev =3D of_find_device_by_node(np); + if (!pdev) + return; + + of_device_unregister(pdev); + put_device(&pdev->dev); + + of_node_clear_flag(np, OF_POPULATED); +} + +/** + * pci_pwrctrl_destroy_devices - Destroy pwrctrl devices + * + * @parent: Parent PCI device for which the pwrctrl devices need to be des= troyed. + * + * This function recursively destroys pwrctrl devices for the child nodes + * of the specified PCI parent device in a depth first manner. + */ +void pci_pwrctrl_destroy_devices(struct device *parent) +{ + struct device_node *np =3D parent->of_node; + + for_each_available_child_of_node_scoped(np, child) + pci_pwrctrl_destroy_device(child); +} +EXPORT_SYMBOL_GPL(pci_pwrctrl_destroy_devices); + MODULE_AUTHOR("Bartosz Golaszewski "); MODULE_DESCRIPTION("PCI Device Power Control core driver"); MODULE_LICENSE("GPL"); diff --git a/include/linux/pci-pwrctrl.h b/include/linux/pci-pwrctrl.h index bd0ee9998125..5590ffec0bea 100644 --- a/include/linux/pci-pwrctrl.h +++ b/include/linux/pci-pwrctrl.h @@ -54,5 +54,11 @@ int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwr= ctrl); void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl); int devm_pci_pwrctrl_device_set_ready(struct device *dev, struct pci_pwrctrl *pwrctrl); - +#if IS_ENABLED(CONFIG_PCI_PWRCTRL) +int pci_pwrctrl_create_devices(struct device *parent); +void pci_pwrctrl_destroy_devices(struct device *parent); +#else +static inline int pci_pwrctrl_create_devices(struct device *parent) { retu= rn 0; } +static void pci_pwrctrl_destroy_devices(struct device *parent) { } +#endif #endif /* __PCI_PWRCTRL_H__ */ --=20 2.48.1 From nobody Sun Feb 8 12:32:43 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C14D330D3B; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; cv=none; b=B+/MydM3tRT7vk5s3ljZF/xQn7hcM0eHtn6qK/SoEtLR5T1ZsN6YQ7X5/WntvC0Xip0PRWQgU0gt7KBK5iRRdTLMl/AkphA4oaZTby6/1k+XYa3Dq88Bj4t8vT6OQNOEHsSnMOEYSfk7fqi2cMtRgYL0K+RRCQSj5jqX8T/NCn0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; c=relaxed/simple; bh=5/h43OsYlYToibLfBMsPAsTuCNyQCq3jdJHWbhBcKCY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BZlAgpEFVNIWKsWX8yCcbEvegUf1XYNoA7qEtAqdGvxFMULJXTJU3so30E/vHcuWZewARNWy05qNXifvb2vliPaJrZEFmNqqS0J5PtwFyHmAjWL/Tsq5cvx1WrswExToT7QvKEUP5qmRLr+DZ0wJDXRsgJhZusEz2IATQpVKi0U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CfMxe89K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CfMxe89K" Received: by smtp.kernel.org (Postfix) with ESMTPS id 2A827C2BC86; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767029226; bh=5/h43OsYlYToibLfBMsPAsTuCNyQCq3jdJHWbhBcKCY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=CfMxe89KdZ1KN0V/flpwkgBym1+vHI5nyga43Zjw7vlPl0bru/gFZqfe3Rc2ghyfE cw/USONOFd0I3nOhtsa4lB/5ODT5CRFUXaGYnZk0Fvy83I0OVsYmyax2h6lYxqtuBp drgZMmAIjdcFPWMSY4BclKZxb5jkNHOLZYbYxKaiE1rTZYISW6d7WyccuOzfyBDLlV z1gfmjWViD9rUuHff7hjaGqRiAsFoQ7YPtlmUyW8qvo98XjwUoFjxOb7uZQjChHvmK NVXeWSNGowvTP8s49GHTvoC+ZJF4XXKmVZnY4CN/8acPfy3jhtuARm83843X0H04te E5KrFv1ZTwXYQ== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B12AE92FC5; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 29 Dec 2025 22:56:55 +0530 Subject: [PATCH v3 4/7] PCI/pwrctrl: Add APIs to power on/off the pwrctrl devices Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251229-pci-pwrctrl-rework-v3-4-c7d5918cd0db@oss.qualcomm.com> References: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> In-Reply-To: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam , Chen-Yu Tsai X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=6552; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=ZfyoHV3eBTTTy49+8YJN4CFzzABZZKIHkD1PNtfqSlk=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpUrnmt1eOywy+gleGJ0XStLhkaCTq699IqQGgr P7cuc5ZIwSJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVK55gAKCRBVnxHm/pHO 9XgWB/45/gzgEsxVkRl085YygQuCGMQlEr+GbHHt6O9AQU9aUBxj42aqJmoh0T4Nmy1n9dzNM+h ibS8m0jRHMVI+8WOJ+Vz3gpkuXymlw71cmlRTJMqPxc6tF83fxoHXvusqpNU0hEJY2GCxry9XpS co5lQfAUxEzrWQMiskBCSujpfDYyY5ZPAlJyzydCdOxHpdXaBXCCXFXFLAErkVWY0LO7iwSRWqx 7WSU/97VDrHopjFBlagvsRH03BHUg1MlmcyC60xKUAeLlQ0oZ9vvNLdHfEzG/2xQ11Mcwjb8tgg 3oag2eoc7U4RlqONpD9VybHd6W7I891M30YxkpXgTmQRXfBp X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam To fix PCIe bridge resource allocation issues when powering PCIe switches with the pwrctrl driver, introduce APIs to explicitly power on and off all related devices simultaneously. Previously, the individual pwrctrl drivers powered on/off the PCIe devices autonomously, without any control from the controller drivers. But to enforce ordering w.r.t powering on the devices, these APIs will power on/off all the devices at the same time. The pci_pwrctrl_power_on_devices() API recursively scans the PCI child nodes, makes sure that pwrctrl drivers are bind to devices, and calls their power_on() callbacks. If any of the pwrctrl driver is not bound, it will return -EPROBE_DEFER. Similarly, pci_pwrctrl_power_off_devices() API powers off devices recursively via their power_off() callbacks. These APIs are expected to be called during the controller probe and suspend/resume time to power on/off the devices. But before calling these APIs, the pwrctrl devices should've been created beforehand using the pci_pwrctrl_{create/destroy}_devices() APIs. Co-developed-by: Krishna Chaitanya Chundru Signed-off-by: Krishna Chaitanya Chundru Tested-by: Chen-Yu Tsai Reviewed-by: Bartosz Golaszewski Signed-off-by: Manivannan Sadhasivam --- drivers/pci/pwrctrl/core.c | 132 ++++++++++++++++++++++++++++++++++++++++= ++++ include/linux/pci-pwrctrl.h | 4 ++ 2 files changed, 136 insertions(+) diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c index 844b5649b663..0ca448f3bea8 100644 --- a/drivers/pci/pwrctrl/core.c +++ b/drivers/pci/pwrctrl/core.c @@ -65,6 +65,7 @@ void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct= device *dev) { pwrctrl->dev =3D dev; INIT_WORK(&pwrctrl->work, rescan_work_func); + dev_set_drvdata(dev, pwrctrl); } EXPORT_SYMBOL_GPL(pci_pwrctrl_init); =20 @@ -152,6 +153,137 @@ int devm_pci_pwrctrl_device_set_ready(struct device *= dev, } EXPORT_SYMBOL_GPL(devm_pci_pwrctrl_device_set_ready); =20 +static void __pci_pwrctrl_power_off_device(struct device *dev) +{ + struct pci_pwrctrl *pwrctrl =3D dev_get_drvdata(dev); + + if (!pwrctrl) + return; + + return pwrctrl->power_off(pwrctrl); +} + +static int pci_pwrctrl_power_off_device(struct device_node *np) +{ + struct platform_device *pdev; + + for_each_available_child_of_node_scoped(np, child) + pci_pwrctrl_power_off_device(child); + + pdev =3D of_find_device_by_node(np); + if (pdev) { + if (device_is_bound(&pdev->dev)) + __pci_pwrctrl_power_off_device(&pdev->dev); + + put_device(&pdev->dev); + } + + return 0; +} + +/** + * pci_pwrctrl_power_off_devices - Power off the pwrctrl devices + * + * @parent: Parent PCI device for which the pwrctrl devices need to be pow= ered + * off. + * + * This function recursively traverses all pwrctrl devices for the child n= odes + * of the specified PCI parent device, and powers them off in a depth first + * manner. + * + * Returns: 0 on success, negative error number on error. + */ +void pci_pwrctrl_power_off_devices(struct device *parent) +{ + struct device_node *np =3D parent->of_node; + + for_each_available_child_of_node_scoped(np, child) + pci_pwrctrl_power_off_device(child); +} +EXPORT_SYMBOL_GPL(pci_pwrctrl_power_off_devices); + +static int __pci_pwrctrl_power_on_device(struct device *dev) +{ + struct pci_pwrctrl *pwrctrl =3D dev_get_drvdata(dev); + + if (!pwrctrl) + return 0; + + return pwrctrl->power_on(pwrctrl); +} + +/* + * Power on the devices in a depth first manner. Before powering on the de= vice, + * make sure its driver is bound. + */ +static int pci_pwrctrl_power_on_device(struct device_node *np) +{ + struct platform_device *pdev; + int ret; + + for_each_available_child_of_node_scoped(np, child) { + ret =3D pci_pwrctrl_power_on_device(child); + if (ret) + return ret; + } + + pdev =3D of_find_device_by_node(np); + if (pdev) { + if (!device_is_bound(&pdev->dev)) { + /* FIXME: Use blocking wait instead of probe deferral */ + dev_dbg(&pdev->dev, "driver is not bound\n"); + ret =3D -EPROBE_DEFER; + } else { + ret =3D __pci_pwrctrl_power_on_device(&pdev->dev); + } + put_device(&pdev->dev); + + if (ret) + return ret; + } + + return 0; +} + +/** + * pci_pwrctrl_power_on_devices - Power on the pwrctrl devices + * + * @parent: Parent PCI device for which the pwrctrl devices need to be pow= ered + * on. + * + * This function recursively traverses all pwrctrl devices for the child n= odes + * of the specified PCI parent device, and powers them on in a depth first + * manner. On error, all powered on devices will be powered off. + * + * Returns: 0 on success, -EPROBE_DEFER if any pwrctrl driver is not bound= , an + * appropriate error code otherwise. + */ +int pci_pwrctrl_power_on_devices(struct device *parent) +{ + struct device_node *np =3D parent->of_node; + struct device_node *child =3D NULL; + int ret; + + for_each_available_child_of_node(np, child) { + ret =3D pci_pwrctrl_power_on_device(child); + if (ret) + goto err_power_off; + } + + return 0; + +err_power_off: + for_each_available_child_of_node_scoped(np, tmp) { + if (tmp =3D=3D child) + break; + pci_pwrctrl_power_off_device(tmp); + } + of_node_put(child); + + return ret; +} +EXPORT_SYMBOL_GPL(pci_pwrctrl_power_on_devices); + static int pci_pwrctrl_create_device(struct device_node *np, struct device= *parent) { struct platform_device *pdev; diff --git a/include/linux/pci-pwrctrl.h b/include/linux/pci-pwrctrl.h index 5590ffec0bea..1b77769eebbe 100644 --- a/include/linux/pci-pwrctrl.h +++ b/include/linux/pci-pwrctrl.h @@ -57,8 +57,12 @@ int devm_pci_pwrctrl_device_set_ready(struct device *dev, #if IS_ENABLED(CONFIG_PCI_PWRCTRL) int pci_pwrctrl_create_devices(struct device *parent); void pci_pwrctrl_destroy_devices(struct device *parent); +int pci_pwrctrl_power_on_devices(struct device *parent); +void pci_pwrctrl_power_off_devices(struct device *parent); #else static inline int pci_pwrctrl_create_devices(struct device *parent) { retu= rn 0; } static void pci_pwrctrl_destroy_devices(struct device *parent) { } +static inline int pci_pwrctrl_power_on_devices(struct device *parent) { re= turn 0; } +static void pci_pwrctrl_power_off_devices(struct device *parent) { } #endif #endif /* __PCI_PWRCTRL_H__ */ --=20 2.48.1 From nobody Sun Feb 8 12:32:43 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 75AE2330D2F; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; cv=none; b=GA8tD8GTRRX4kteXA0y2/cpbg92NJl7ztX0r1I94VaDF927YtcXxrrZcfOcoOKCqet0yJWORdxP6dK1d+zy5nQv6iAp1e0FQx6VXd1ht1c11nbQR6Wdof8rMMACSyMIJkUqcOPw6BXSrzsgb3SkrrxMEK+5D/M1XI3L4DUyjgSY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; c=relaxed/simple; bh=tXkhfi5utMbRMIYrOaStMkNlZrNtFfn+DaYP/sSGipk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JP5ieYvgwqR4f0p7DfoVZNCm2rnxdWufA970FMnJo1MtsNhemdqCVWqID8M9vOEfxXufKbLjOt/TZiCk5THMa9D9qOzUYDstABQ3kHiuSW7+0JkKrLU8ayV/6/ptg6KfyXwDbxdTkuLs2/LzHCp4ne5EivsHZss25EJvixuMKBk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=eHjj0yUp; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="eHjj0yUp" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4E7D3C19423; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767029226; bh=tXkhfi5utMbRMIYrOaStMkNlZrNtFfn+DaYP/sSGipk=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=eHjj0yUpIGot2sOAK3vvVEqKm1jktNeAR81JOjxhyqVRFgyJkdOUc/XhliZ+YcfUi izS9oMLp5Dv1Y80kto1S2BkzMvBgrO9QQVwSSGhAqMMWX1hEu9UB9XiXEO+NBPBGx8 lXpE3/fd67iyx0RWtTTU7rIkFf2+9dsxBrKDzEX5qf/r9kyr32Rvf+glOsAOe4lKm+ q3+JvK5gIs8SAAq4GrJe9As/ygQEgUdM9yWuwOPU8I8CY0ZqfBdzimkX0kqeMz7lx7 sIs3GNQa1e/dKm1IWQ3rdpprAIaGaeQUNBeE1xIPUorz0BAxOu7/itLBKzLAhLvDpg i8t+mid+MorVA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CA9FE92FC0; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 29 Dec 2025 22:56:56 +0530 Subject: [PATCH v3 5/7] PCI/pwrctrl: Switch to the new pwrctrl APIs Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251229-pci-pwrctrl-rework-v3-5-c7d5918cd0db@oss.qualcomm.com> References: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> In-Reply-To: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam , Chen-Yu Tsai X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=12709; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=xJGlMr8jzfUCOPi0L0xjpmgJlix2wx+41gIV2bS/OwY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpUrnmU+JnoiTTQCJyWOufX4yMnDcPjC7QMXeWJ 23+y207uzOJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVK55gAKCRBVnxHm/pHO 9bb4B/4+2qFrd7XgCZ1TlvEZuGip+KIJ9IbhNg40JiggzHGTIYPHXwgQJHmcDo6sm364mP89fbC +W3MMrAJ+csVbHW+gy1zKvoHFnMrwGvZ/8jSWwq5Ne6lcDr67ybyYwaisGN/pj9FXr9bVVXc6hH 08D+g3hAAd3MgeDx69nT1tPGiYO4lbmkHCwlmlm2XyXLfj4EBqrVYFoF1V0oM1dfX5lzJvh0aur dCojZqoWBduIKwy9SuujNzMtaUWMYIh7K+TZrpy7gpEcYjXBpT5PCXE+G19tD5nbjez7jnNQsDs 7MW4bxc0DKiC4fZ8+h7eYPgplC6BhHdDt1aMXMUegZjZamqo X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Adopt the recently introduced pwrctrl APIs to create, power on, destroy, and power off pwrctrl devices. In qcom_pcie_host_init(), call pci_pwrctrl_create_devices() to create devices, then pci_pwrctrl_power_on_devices() to power them on, both after controller resource initialization. Once successful, deassert PERST# for all devices. In qcom_pcie_host_deinit(), call pci_pwrctrl_power_off_devices() after asserting PERST#. Note that pci_pwrctrl_destroy_devices() is not called here, as deinit is only invoked during system suspend where device destruction is unnecessary. If the driver becomes removable in future, pci_pwrctrl_destroy_devices() should be called in the remove() handler. At last, remove the old pwrctrl framework code from the PCI core (including devlinks) as the new APIs are now the sole consumer of pwrctrl functionality. And also do not power on the pwrctrl drivers during probe() as this is now handled by the APIs. Co-developed-by: Krishna Chaitanya Chundru Signed-off-by: Krishna Chaitanya Chundru Tested-by: Chen-Yu Tsai Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bartosz Golaszewski --- drivers/pci/bus.c | 19 ---------- drivers/pci/controller/dwc/pcie-qcom.c | 23 +++++++++++-- drivers/pci/probe.c | 59 ----------------------------= ---- drivers/pci/pwrctrl/core.c | 15 -------- drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c | 5 --- drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c | 24 ++----------- drivers/pci/pwrctrl/slot.c | 2 -- drivers/pci/remove.c | 20 ----------- 8 files changed, 24 insertions(+), 143 deletions(-) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 4383a36fd6ca..d60d5f108212 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -344,7 +344,6 @@ void __weak pcibios_bus_add_device(struct pci_dev *pdev= ) { } void pci_bus_add_device(struct pci_dev *dev) { struct device_node *dn =3D dev->dev.of_node; - struct platform_device *pdev; =20 /* * Can not put in pci_device_add yet because resources @@ -361,24 +360,6 @@ void pci_bus_add_device(struct pci_dev *dev) /* Save config space for error recoverability */ pci_save_state(dev); =20 - /* - * If the PCI device is associated with a pwrctrl device with a - * power supply, create a device link between the PCI device and - * pwrctrl device. This ensures that pwrctrl drivers are probed - * before PCI client drivers. - */ - pdev =3D of_find_device_by_node(dn); - if (pdev) { - if (of_pci_supply_present(dn)) { - if (!device_link_add(&dev->dev, &pdev->dev, - DL_FLAG_AUTOREMOVE_CONSUMER)) { - pci_err(dev, "failed to add device link to power control device %s\n", - pdev->name); - } - } - put_device(&pdev->dev); - } - if (!dn || of_device_is_available(dn)) pci_dev_allow_binding(dev); =20 diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 1ca58d0264e3..198befb5be2c 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1317,10 +1318,18 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *p= p) if (ret) goto err_deinit; =20 + ret =3D pci_pwrctrl_create_devices(pci->dev); + if (ret) + goto err_disable_phy; + + ret =3D pci_pwrctrl_power_on_devices(pci->dev); + if (ret) + goto err_pwrctrl_destroy; + if (pcie->cfg->ops->post_init) { ret =3D pcie->cfg->ops->post_init(pcie); if (ret) - goto err_disable_phy; + goto err_pwrctrl_power_off; } =20 qcom_pcie_clear_aspm_l0s(pcie->pci); @@ -1337,6 +1346,11 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) =20 err_assert_reset: qcom_ep_reset_assert(pcie); +err_pwrctrl_power_off: + pci_pwrctrl_power_off_devices(pci->dev); +err_pwrctrl_destroy: + if (ret !=3D -EPROBE_DEFER) + pci_pwrctrl_destroy_devices(pci->dev); err_disable_phy: qcom_pcie_phy_power_off(pcie); err_deinit: @@ -1351,6 +1365,11 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp = *pp) struct qcom_pcie *pcie =3D to_qcom_pcie(pci); =20 qcom_ep_reset_assert(pcie); + /* + * No need to destroy pwrctrl devices as this function only gets called + * during system suspend as of now. + */ + pci_pwrctrl_power_off_devices(pci->dev); qcom_pcie_phy_power_off(pcie); pcie->cfg->ops->deinit(pcie); } @@ -2029,7 +2048,7 @@ static int qcom_pcie_probe(struct platform_device *pd= ev) =20 ret =3D dw_pcie_host_init(pp); if (ret) { - dev_err(dev, "cannot initialize host\n"); + dev_err_probe(dev, ret, "cannot initialize host\n"); goto err_phy_exit; } =20 diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 41183aed8f5d..6e7252404b58 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2563,56 +2563,6 @@ bool pci_bus_read_dev_vendor_id(struct pci_bus *bus,= int devfn, u32 *l, } EXPORT_SYMBOL(pci_bus_read_dev_vendor_id); =20 -#if IS_ENABLED(CONFIG_PCI_PWRCTRL) -static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *b= us, int devfn) -{ - struct pci_host_bridge *host =3D pci_find_host_bridge(bus); - struct platform_device *pdev; - struct device_node *np; - - np =3D of_pci_find_child_device(dev_of_node(&bus->dev), devfn); - if (!np) - return NULL; - - pdev =3D of_find_device_by_node(np); - if (pdev) { - put_device(&pdev->dev); - goto err_put_of_node; - } - - /* - * First check whether the pwrctrl device really needs to be created or - * not. This is decided based on at least one of the power supplies - * being defined in the devicetree node of the device. - */ - if (!of_pci_supply_present(np)) { - pr_debug("PCI/pwrctrl: Skipping OF node: %s\n", np->name); - goto err_put_of_node; - } - - /* Now create the pwrctrl device */ - pdev =3D of_platform_device_create(np, NULL, &host->dev); - if (!pdev) { - pr_err("PCI/pwrctrl: Failed to create pwrctrl device for node: %s\n", np= ->name); - goto err_put_of_node; - } - - of_node_put(np); - - return pdev; - -err_put_of_node: - of_node_put(np); - - return NULL; -} -#else -static struct platform_device *pci_pwrctrl_create_device(struct pci_bus *b= us, int devfn) -{ - return NULL; -} -#endif - /* * Read the config data for a PCI device, sanity-check it, * and fill in the dev structure. @@ -2622,15 +2572,6 @@ static struct pci_dev *pci_scan_device(struct pci_bu= s *bus, int devfn) struct pci_dev *dev; u32 l; =20 - /* - * Create pwrctrl device (if required) for the PCI device to handle the - * power state. If the pwrctrl device is created, then skip scanning - * further as the pwrctrl core will rescan the bus after powering on - * the device. - */ - if (pci_pwrctrl_create_device(bus, devfn)) - return NULL; - if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000)) return NULL; =20 diff --git a/drivers/pci/pwrctrl/core.c b/drivers/pci/pwrctrl/core.c index 0ca448f3bea8..4044edc472b9 100644 --- a/drivers/pci/pwrctrl/core.c +++ b/drivers/pci/pwrctrl/core.c @@ -45,16 +45,6 @@ static int pci_pwrctrl_notify(struct notifier_block *nb,= unsigned long action, return NOTIFY_DONE; } =20 -static void rescan_work_func(struct work_struct *work) -{ - struct pci_pwrctrl *pwrctrl =3D container_of(work, - struct pci_pwrctrl, work); - - pci_lock_rescan_remove(); - pci_rescan_bus(to_pci_host_bridge(pwrctrl->dev->parent)->bus); - pci_unlock_rescan_remove(); -} - /** * pci_pwrctrl_init() - Initialize the PCI power control context struct * @@ -64,7 +54,6 @@ static void rescan_work_func(struct work_struct *work) void pci_pwrctrl_init(struct pci_pwrctrl *pwrctrl, struct device *dev) { pwrctrl->dev =3D dev; - INIT_WORK(&pwrctrl->work, rescan_work_func); dev_set_drvdata(dev, pwrctrl); } EXPORT_SYMBOL_GPL(pci_pwrctrl_init); @@ -95,8 +84,6 @@ int pci_pwrctrl_device_set_ready(struct pci_pwrctrl *pwrc= trl) if (ret) return ret; =20 - schedule_work(&pwrctrl->work); - return 0; } EXPORT_SYMBOL_GPL(pci_pwrctrl_device_set_ready); @@ -109,8 +96,6 @@ EXPORT_SYMBOL_GPL(pci_pwrctrl_device_set_ready); */ void pci_pwrctrl_device_unset_ready(struct pci_pwrctrl *pwrctrl) { - cancel_work_sync(&pwrctrl->work); - /* * We don't have to delete the link here. Typically, this function * is only called when the power control device is being detached. If diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c b/drivers/pci/pwrctrl= /pci-pwrctrl-pwrseq.c index 0fb9038a1d18..7697a8a5cdde 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-pwrseq.c @@ -101,11 +101,6 @@ static int pci_pwrctrl_pwrseq_probe(struct platform_de= vice *pdev) return dev_err_probe(dev, PTR_ERR(data->pwrseq), "Failed to get the power sequencer\n"); =20 - ret =3D pci_pwrctrl_pwrseq_power_on(&data->ctx); - if (ret) - return dev_err_probe(dev, ret, - "Failed to power-on the device\n"); - ret =3D devm_add_action_or_reset(dev, devm_pci_pwrctrl_pwrseq_power_off, data); if (ret) diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c b/drivers/pci/pwrctrl= /pci-pwrctrl-tc9563.c index 0393af2a099c..df77d408adfa 100644 --- a/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c +++ b/drivers/pci/pwrctrl/pci-pwrctrl-tc9563.c @@ -513,8 +513,6 @@ static int tc9563_pwrctrl_power_on(struct pci_pwrctrl *= pwrctrl) =20 static int tc9563_pwrctrl_probe(struct platform_device *pdev) { - struct pci_host_bridge *bridge =3D to_pci_host_bridge(pdev->dev.parent); - struct pci_bus *bus =3D bridge->bus; struct device *dev =3D &pdev->dev; enum tc9563_pwrctrl_ports port; struct tc9563_pwrctrl_ctx *ctx; @@ -590,22 +588,6 @@ static int tc9563_pwrctrl_probe(struct platform_device= *pdev) goto remove_i2c; } =20 - if (bridge->ops->assert_perst) { - ret =3D bridge->ops->assert_perst(bus, true); - if (ret) - goto remove_i2c; - } - - ret =3D tc9563_pwrctrl_power_on(&ctx->pwrctrl); - if (ret) - goto remove_i2c; - - if (bridge->ops->assert_perst) { - ret =3D bridge->ops->assert_perst(bus, false); - if (ret) - goto power_off; - } - ctx->pwrctrl.power_on =3D tc9563_pwrctrl_power_on; ctx->pwrctrl.power_off =3D tc9563_pwrctrl_power_off; =20 @@ -613,8 +595,6 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) if (ret) goto power_off; =20 - platform_set_drvdata(pdev, ctx); - return 0; =20 power_off: @@ -627,7 +607,9 @@ static int tc9563_pwrctrl_probe(struct platform_device = *pdev) =20 static void tc9563_pwrctrl_remove(struct platform_device *pdev) { - struct tc9563_pwrctrl_ctx *ctx =3D platform_get_drvdata(pdev); + struct pci_pwrctrl *pwrctrl =3D dev_get_drvdata(&pdev->dev); + struct tc9563_pwrctrl_ctx *ctx =3D container_of(pwrctrl, + struct tc9563_pwrctrl_ctx, pwrctrl); =20 tc9563_pwrctrl_power_off(&ctx->pwrctrl); i2c_unregister_device(ctx->client); diff --git a/drivers/pci/pwrctrl/slot.c b/drivers/pci/pwrctrl/slot.c index 14701f65f1f2..888300aeefec 100644 --- a/drivers/pci/pwrctrl/slot.c +++ b/drivers/pci/pwrctrl/slot.c @@ -79,8 +79,6 @@ static int pci_pwrctrl_slot_probe(struct platform_device = *pdev) return dev_err_probe(dev, PTR_ERR(slot->clk), "Failed to enable slot clock\n"); =20 - pci_pwrctrl_slot_power_on(&slot->ctx); - slot->ctx.power_on =3D pci_pwrctrl_slot_power_on; slot->ctx.power_off =3D pci_pwrctrl_slot_power_off; =20 diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index 417a9ea59117..e9d519993853 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -17,25 +17,6 @@ static void pci_free_resources(struct pci_dev *dev) } } =20 -static void pci_pwrctrl_unregister(struct device *dev) -{ - struct device_node *np; - struct platform_device *pdev; - - np =3D dev_of_node(dev); - if (!np) - return; - - pdev =3D of_find_device_by_node(np); - if (!pdev) - return; - - of_device_unregister(pdev); - put_device(&pdev->dev); - - of_node_clear_flag(np, OF_POPULATED); -} - static void pci_stop_dev(struct pci_dev *dev) { pci_pme_active(dev, false); @@ -73,7 +54,6 @@ static void pci_destroy_dev(struct pci_dev *dev) pci_ide_destroy(dev); pcie_aspm_exit_link_state(dev); pci_bridge_d3_update(dev); - pci_pwrctrl_unregister(&dev->dev); pci_free_resources(dev); put_device(&dev->dev); } --=20 2.48.1 From nobody Sun Feb 8 12:32:43 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF4E7331229; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; cv=none; b=Lp/JDYLEFqf4RMbhA3CRCycLFTCVJi4FIaSxJeJwXUVyiU1Df6XWkH94LxzoJ8J4bus3VsqJkL1ezqruRc6rgR9jhnHnw+ceb2geoF14aaFXj0H/Yh4e3hWHaRx9YvnCOMDaKQ+a0+7NqnyD9YFhWM8sxnDldA5V3ZwYVjF5CYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; c=relaxed/simple; bh=TfI9cF+i19rjT6swT8jDbAqZ8xwCcYe+DskRWJClOio=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kU5YQW1BRi4/7ffqAjxwYcdsQ4no744SZEiUCPiro+25sYB9vhL/ZS6Iu6iKhE95vozEc2IP7XA0RCedV8xMZMKy8QmoNNr643YCwd8TqcVz6iJozJ+vovMke6UFxxzfciqi7OCf5dryusM6GT+o20rV32ISeYs13mLgw5YjDFU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bQgRpWjF; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bQgRpWjF" Received: by smtp.kernel.org (Postfix) with ESMTPS id 6E2E1C2BCB2; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767029226; bh=TfI9cF+i19rjT6swT8jDbAqZ8xwCcYe+DskRWJClOio=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=bQgRpWjF/AWIuumSYQUf1tQcCxdzrH5v19Oo7P0z71KPTLA0OHRzKxl1TIH5zklX1 MgjYSsyWr3VCeMPCi1E0GnrSNbSC4Yjpj3g8i/CUKhsdk64VVKYXZeC4cIc/F60Sbe yApxF7b47IqMe+nJL7k21ZsxgcnDu4IqVA0GWcnyvEYdRY+U9s/GlyHSvKMci+cGyA p6Wi7T546naoXGNZmeLeKC9LP4zsa4YEinzBT8j6BbY+FUaHt7LqgcAwriIMUPU6YI pzPFLrn6xs9/ZKdVC8S25euxrDBtgHJOsSQVHvlihYK0ykNf94XEXIzji/L9TuhfXc rXSYD7G8iVMQg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5DB44E9273E; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 29 Dec 2025 22:56:57 +0530 Subject: [PATCH v3 6/7] PCI: qcom: Drop the assert_perst() callbacks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251229-pci-pwrctrl-rework-v3-6-c7d5918cd0db@oss.qualcomm.com> References: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> In-Reply-To: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=3712; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=OxqbBaot5sb3RNdkBfSCmREAquDem1+SJOzo41RQjOs=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpUrnmP+nu1ihn6rmt7HAaYQo8uKEdf/ZEG2DSc Z4I0D6eg42JATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVK55gAKCRBVnxHm/pHO 9Um0CACKWr2CxTV/7MzzNxY/3V6I/yfE5K3/Od/TTsExLfnl2cOhNRv/bhrp5QQQ6IWNCBZAuuB on8vEc9IMG3e9O776iWj5xGYf3VDF/vrxJCHZlkWCmr718w5LLmP7pKFIPIZ9vEMCo76zzeoAA8 x0sP39XJeT48rkonT+wJcv/fXKWjBcYHz/+Z90rbtooT7B8xApU0DZnan1wdAR86+bbOMO904E4 6afJAAQnU2yqn2H13kmQOn/a2HYdlk5p+UcVl5VQ40eTo5WR2tICFB+Pacog1ZpsOE+S46ylBP2 TcktPxFAuoX8W2yyu/quLlBxuN56yrkDf5NQCYAXmyp1vmD7 X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Now that the TC9563 Pwrctrl driver is converted to use the new Pwrctrl design, there is no need for these assert_perst() callbacks. With the new design, TC9563 will be powered on before PERST# deassert. So explicit PERST# handling from the TC9563 driver is not needed. Hence, drop the callbacks. Signed-off-by: Manivannan Sadhasivam --- drivers/pci/controller/dwc/pcie-designware-host.c | 9 --------- drivers/pci/controller/dwc/pcie-designware.h | 8 -------- drivers/pci/controller/dwc/pcie-qcom.c | 13 ------------- include/linux/pci.h | 1 - 4 files changed, 31 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 372207c33a85..4862a3a059c7 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -857,19 +857,10 @@ static void __iomem *dw_pcie_ecam_conf_map_bus(struct= pci_bus *bus, unsigned int return pci->dbi_base + where; } =20 -static int dw_pcie_op_assert_perst(struct pci_bus *bus, bool assert) -{ - struct dw_pcie_rp *pp =3D bus->sysdata; - struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); - - return dw_pcie_assert_perst(pci, assert); -} - static struct pci_ops dw_pcie_ops =3D { .map_bus =3D dw_pcie_own_conf_map_bus, .read =3D pci_generic_config_read, .write =3D pci_generic_config_write, - .assert_perst =3D dw_pcie_op_assert_perst, }; =20 static struct pci_ops dw_pcie_ecam_ops =3D { diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/con= troller/dwc/pcie-designware.h index 31685951a080..d24abdb9edaa 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -798,14 +798,6 @@ static inline void dw_pcie_stop_link(struct dw_pcie *p= ci) pci->ops->stop_link(pci); } =20 -static inline int dw_pcie_assert_perst(struct dw_pcie *pci, bool assert) -{ - if (pci->ops && pci->ops->assert_perst) - return pci->ops->assert_perst(pci, assert); - - return 0; -} - static inline enum dw_pcie_ltssm dw_pcie_get_ltssm(struct dw_pcie *pci) { u32 val; diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 198befb5be2c..6de3ff555b9d 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -650,18 +650,6 @@ static int qcom_pcie_post_init_1_0_0(struct qcom_pcie = *pcie) return 0; } =20 -static int qcom_pcie_assert_perst(struct dw_pcie *pci, bool assert) -{ - struct qcom_pcie *pcie =3D to_qcom_pcie(pci); - - if (assert) - qcom_ep_reset_assert(pcie); - else - qcom_ep_reset_deassert(pcie); - - return 0; -} - static void qcom_pcie_2_3_2_ltssm_enable(struct qcom_pcie *pcie) { u32 val; @@ -1523,7 +1511,6 @@ static const struct qcom_pcie_cfg cfg_fw_managed =3D { static const struct dw_pcie_ops dw_pcie_ops =3D { .link_up =3D qcom_pcie_link_up, .start_link =3D qcom_pcie_start_link, - .assert_perst =3D qcom_pcie_assert_perst, }; =20 static int qcom_pcie_icc_init(struct qcom_pcie *pcie) diff --git a/include/linux/pci.h b/include/linux/pci.h index 864775651c6f..3eb8fd975ad9 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -854,7 +854,6 @@ struct pci_ops { void __iomem *(*map_bus)(struct pci_bus *bus, unsigned int devfn, int whe= re); int (*read)(struct pci_bus *bus, unsigned int devfn, int where, int size,= u32 *val); int (*write)(struct pci_bus *bus, unsigned int devfn, int where, int size= , u32 val); - int (*assert_perst)(struct pci_bus *bus, bool assert); }; =20 /* --=20 2.48.1 From nobody Sun Feb 8 12:32:43 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0AFB331219; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; cv=none; b=TraxIEKP0kvvgydD2JOQuWBInF8/1J/tZltcORCyvcG11G8oelbpSwVTpatHfk8u0GS2yjM+UpIY+Rm9ZMUakDTwRSZi43FyIeo8OD79aVx2gTqI0FrwJ1xiJ847x4Za0viJaHfBIvihqfpr9idR+IVH4dq709Zswb3GbWGUPNQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767029226; c=relaxed/simple; bh=TXzF435WU9VYp7LjFqBeYRn1UNuJt21HFOqXY6px3dE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KfEGsh0A/GcLg5lC0IBNIa6wLWCdk16DWZXadRrBveQAD0eP6EENHF3q0KA/DQ5nYi/ItOTUHhhr99xjipGL/pEs2crbObCYPO43Nccf8GFtul2aD9b5JKrypEZhukbm3i6Gc8oPkPcxD/q2PztBlz/UX/CXFUZgJ1msLuwi1/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=M1PVNPus; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="M1PVNPus" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8AB66C2BCB0; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1767029226; bh=TXzF435WU9VYp7LjFqBeYRn1UNuJt21HFOqXY6px3dE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=M1PVNPusH2ZCgl1552zA0L+BCDMUTzHiGAARAFMjsJQQXUzt04VoZoLYSv1y39KqB yJqG+6IlQjzVi55MdgEg8MgPKSBm/G2cTyx+AkQlbo6lVXifesNWkYJWYx0RD2ZMhF cEYjStfnStKk8Mu9GbWSysRmUHDCHjPiUgaTABKEvm8e/R3eJrU4eBBjKzf7qzDC/C 6v8+T01c6mgBzT5WyLTn+/EV6U29ct7koEjdNQvez+HWTvTqPNVtO8EJYZjkTtBsSL H8EDSktys4tNbF//J7/4Yr9ZT2QVTdo0OFDGrBjZM9xH+Wfk4qo4gGfEXNG3XT7+x/ KebW3MkqA07Tg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78DFBE92FC5; Mon, 29 Dec 2025 17:27:06 +0000 (UTC) From: Manivannan Sadhasivam via B4 Relay Date: Mon, 29 Dec 2025 22:56:58 +0530 Subject: [PATCH v3 7/7] PCI: qcom: Rename PERST# assert/deassert helpers for uniformity Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251229-pci-pwrctrl-rework-v3-7-c7d5918cd0db@oss.qualcomm.com> References: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> In-Reply-To: <20251229-pci-pwrctrl-rework-v3-0-c7d5918cd0db@oss.qualcomm.com> To: Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Bartosz Golaszewski Cc: linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai , Brian Norris , Krishna Chaitanya Chundru , Niklas Cassel , Alex Elder , Bartosz Golaszewski , Manivannan Sadhasivam X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openpgp-sha256; l=2787; i=manivannan.sadhasivam@oss.qualcomm.com; h=from:subject:message-id; bh=ncgLgkMFVujyqBgktgUh6eUIgflyWGjZ+0g78z7CeOY=; b=owEBbQGS/pANAwAKAVWfEeb+kc71AcsmYgBpUrnmxi6KB+fRNxWX9kzeLNU/o+gpdx3ATVtCN E8mnmZRMHuJATMEAAEKAB0WIQRnpUMqgUjL2KRYJ5dVnxHm/pHO9QUCaVK55gAKCRBVnxHm/pHO 9SGVB/9qNDupQXRtd6KkRvL/8ZQmLIK8PPOxYnAv+XWBcVDtUJZsvKBpuAr2T63C2b7nwKt5yYK ji7HpnUOUCVvMgp1GbAOQSDltv848Cq+i7DYOuuydEmPGYjdYKPCHQ128NZa1V+yq3bBY1WLQUE JnKLLsMXtIsGO5b9mI/Iih5bXpBb9o5LW+RIdvGvHdtOtfRRWvqXqD4e1whoLUkyZNgpTVnrVQU zjz7Vu8uDWRmjYpCtHvsgoMBz42lYY3LukkEZXksVDH5h0bs9gc5If1hC6Jl/isCB0Xei31lKYx Iz+zt+K3GT7jKPflQyGdOH/3o8yWbsbDnU2BIUeuNq6WBVKd X-Developer-Key: i=manivannan.sadhasivam@oss.qualcomm.com; a=openpgp; fpr=C668AEC3C3188E4C611465E7488550E901166008 X-Endpoint-Received: by B4 Relay for manivannan.sadhasivam@oss.qualcomm.com/default with auth_id=461 X-Original-From: Manivannan Sadhasivam Reply-To: manivannan.sadhasivam@oss.qualcomm.com From: Manivannan Sadhasivam Rename the PERST# assert/deassert helpers from qcom_ep_reset_{assert/deassert}() to qcom_pcie_perst_{assert/deassert}() to maintain uniformity. Signed-off-by: Manivannan Sadhasivam Reviewed-by: Bartosz Golaszewski --- drivers/pci/controller/dwc/pcie-qcom.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 6de3ff555b9d..a9293502e565 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -295,7 +295,7 @@ struct qcom_pcie { =20 #define to_qcom_pcie(x) dev_get_drvdata((x)->dev) =20 -static void qcom_perst_assert(struct qcom_pcie *pcie, bool assert) +static void __qcom_pcie_perst_assert(struct qcom_pcie *pcie, bool assert) { struct qcom_pcie_perst *perst; struct qcom_pcie_port *port; @@ -309,16 +309,16 @@ static void qcom_perst_assert(struct qcom_pcie *pcie,= bool assert) usleep_range(PERST_DELAY_US, PERST_DELAY_US + 500); } =20 -static void qcom_ep_reset_assert(struct qcom_pcie *pcie) +static void qcom_pcie_perst_assert(struct qcom_pcie *pcie) { - qcom_perst_assert(pcie, true); + __qcom_pcie_perst_assert(pcie, true); } =20 -static void qcom_ep_reset_deassert(struct qcom_pcie *pcie) +static void qcom_pcie_perst_deassert(struct qcom_pcie *pcie) { /* Ensure that PERST has been asserted for at least 100 ms */ msleep(PCIE_T_PVPERL_MS); - qcom_perst_assert(pcie, false); + __qcom_pcie_perst_assert(pcie, false); } =20 static int qcom_pcie_start_link(struct dw_pcie *pci) @@ -1296,7 +1296,7 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) struct qcom_pcie *pcie =3D to_qcom_pcie(pci); int ret; =20 - qcom_ep_reset_assert(pcie); + qcom_pcie_perst_assert(pcie); =20 ret =3D pcie->cfg->ops->init(pcie); if (ret) @@ -1322,7 +1322,7 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) =20 qcom_pcie_clear_aspm_l0s(pcie->pci); =20 - qcom_ep_reset_deassert(pcie); + qcom_pcie_perst_deassert(pcie); =20 if (pcie->cfg->ops->config_sid) { ret =3D pcie->cfg->ops->config_sid(pcie); @@ -1333,7 +1333,7 @@ static int qcom_pcie_host_init(struct dw_pcie_rp *pp) return 0; =20 err_assert_reset: - qcom_ep_reset_assert(pcie); + qcom_pcie_perst_assert(pcie); err_pwrctrl_power_off: pci_pwrctrl_power_off_devices(pci->dev); err_pwrctrl_destroy: @@ -1352,7 +1352,7 @@ static void qcom_pcie_host_deinit(struct dw_pcie_rp *= pp) struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); struct qcom_pcie *pcie =3D to_qcom_pcie(pci); =20 - qcom_ep_reset_assert(pcie); + qcom_pcie_perst_assert(pcie); /* * No need to destroy pwrctrl devices as this function only gets called * during system suspend as of now. --=20 2.48.1