From mboxrd@z Thu Jan 1 00:00:00 1970 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 D810A3624BF; Tue, 27 Jan 2026 17:04:56 +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=1769533496; cv=none; b=CAKElr4wbOIBP5AhLaHD0zTsIA4M+WyBnXRsmoSC5lOc2GY17HMhENsqTTWZjaZzaRNXPKWoCnBT8Qhci9Mg7eH6H0O8O1EDUMxUef3GaxnEctAAjX5ckwljC5CUJKBWX+AOpmQPGJe9QlrL3oW+cUXMM2aDDieWf/zmxJ5+QmQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769533496; c=relaxed/simple; bh=poCPnd4zFMjtSit8xD03/GV5rPSvHmcbMOzBQ9KlptE=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=bWpdOkedU60TU5nMGi/bolXWf59wRI0TRaHcKQ7Fj5Oy+5bJ2N2ck9gLHKw+oqhm8EZzIbjl58zzcXikQIFb+OZS2wgF1tOrG6YMd1H6OY8MYBiy4NguTLiSYkx0V5fi4wQKmaWATKMZTQJuVR8+mc4L0FZr/WoAk1BdglZ6pJ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EXj9+9tF; 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="EXj9+9tF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CD6BC116C6; Tue, 27 Jan 2026 17:04:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769533496; bh=poCPnd4zFMjtSit8xD03/GV5rPSvHmcbMOzBQ9KlptE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=EXj9+9tFbUrcdXOg/gNZ0xtF0AANmEMZn7gE9OmsDvKPWFilOXbzhgganOOqg0a5h QxlN29XF4sYATOJ+A72JrE4WEjRMG+yw01F0oZNDKW53UG86h7zKvwkJBiU7ezZ7+w NfjFs7sUmjmzJ4YJprHnkc3Q5Ktdj8tsQql5XfJKIMtRI0SywIyKabPZFe78+eWd5W DGSSoMZtSGXB7TPPZUoln5ulzw3FTd1anFe6dEDFiphujvDfDFq512lX4TDir6fsk8 myWqw96UvNR6VrKwSLL1zpJJH+3BkoXmA3i/l6GZwlyrb8d4zv9hHMnncTL43nb8BC gDheOQS+ka2UQ== Date: Tue, 27 Jan 2026 11:04:55 -0600 From: Bjorn Helgaas To: Neil Armstrong Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Jessica Zhang , Sean Paul , Marijn Suijten , David Airlie , Simona Vetter , Greg Kroah-Hartman , Geert Uytterhoeven , Magnus Damm , Bartosz Golaszewski , Manivannan Sadhasivam , Bjorn Helgaas , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-pci@vger.kernel.org Subject: Re: [PATCH v2 2/7] pci: pwrctrl: add PCI pwrctrl driver for the UPD720201/UPD720202 USB 3.0 xHCI Host Controller Message-ID: <20260127170455.GA364177@bhelgaas> Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260127-topic-sm8650-ayaneo-pocket-s2-base-v2-2-c55ec1b5d8bf@linaro.org> On Tue, Jan 27, 2026 at 10:57:29AM +0100, Neil Armstrong wrote: > Add support fo the Renesas UPD720201/UPD720202 USB 3.0 xHCI Host Controller > power control which connects over PCIe and requires specific power supplies > to start up. s/fo /for / In subject, "PCI/pwrctrl: Add ..." to match history (see "git log --oneline drivers/pci/pwrctrl/") > Signed-off-by: Neil Armstrong > --- > drivers/pci/pwrctrl/Kconfig | 10 ++++ > drivers/pci/pwrctrl/Makefile | 2 + > drivers/pci/pwrctrl/pci-pwrctrl-upd720201.c | 88 +++++++++++++++++++++++++++++ > 3 files changed, 100 insertions(+) > > diff --git a/drivers/pci/pwrctrl/Kconfig b/drivers/pci/pwrctrl/Kconfig > index e0f999f299bb..5a94e60d0d3e 100644 > --- a/drivers/pci/pwrctrl/Kconfig > +++ b/drivers/pci/pwrctrl/Kconfig > @@ -11,6 +11,16 @@ config PCI_PWRCTRL_PWRSEQ > select POWER_SEQUENCING > select PCI_PWRCTRL > > +config PCI_PWRCTRL_UPD720201 > + tristate "PCI Power Control driver for the UPD720201 USB3 Host Controller" > + select PCI_PWRCTRL > + help > + Say Y here to enable the PCI Power Control driver of the UPD720201 > + USB3 Host Controller. > + > + The voltage regulators powering the rails of the PCI slots > + are expected to be defined in the devicetree node of the PCI device. I assume this is a function of the platform design, not an intrinsic feature of UPD720201? I.e., my guess is that this driver is not required for every platform that includes a UPD720201 device? Maybe this is just another way of asking Mani's question about using pwrctrl-slot. *Every* device requires specific power supplies to start up (re patch 1/7), and this driver doesn't appear to depend on anything unique about UPD720201. > config PCI_PWRCTRL_SLOT > tristate "PCI Power Control driver for PCI slots" > select PCI_PWRCTRL > diff --git a/drivers/pci/pwrctrl/Makefile b/drivers/pci/pwrctrl/Makefile > index 13b02282106c..a99f85de8a3d 100644 > --- a/drivers/pci/pwrctrl/Makefile > +++ b/drivers/pci/pwrctrl/Makefile > @@ -5,6 +5,8 @@ pci-pwrctrl-core-y := core.o > > obj-$(CONFIG_PCI_PWRCTRL_PWRSEQ) += pci-pwrctrl-pwrseq.o > > +obj-$(CONFIG_PCI_PWRCTRL_UPD720201) += pci-pwrctrl-upd720201.o > + > obj-$(CONFIG_PCI_PWRCTRL_SLOT) += pci-pwrctrl-slot.o > pci-pwrctrl-slot-y := slot.o > > diff --git a/drivers/pci/pwrctrl/pci-pwrctrl-upd720201.c b/drivers/pci/pwrctrl/pci-pwrctrl-upd720201.c > new file mode 100644 > index 000000000000..db96bbb69c21 > --- /dev/null > +++ b/drivers/pci/pwrctrl/pci-pwrctrl-upd720201.c > @@ -0,0 +1,88 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * Based on upd720201.c: > + * Copyright (C) 2024 Linaro Ltd. > + * Author: Manivannan Sadhasivam > + */ > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +struct pci_pwrctrl_upd720201_data { > + struct pci_pwrctrl ctx; > + struct regulator_bulk_data *supplies; > + int num_supplies; > +}; To match recent rework of nearby drivers: s/pci_pwrctrl_upd720201_data/upd720201_pwrctrl/ s/ctx/pwrctrl/ > +static void devm_pci_pwrctrl_upd720201_power_off(void *data) and: s/devm_pci_pwrctrl_upd720201_power_off/devm_upd720201_release/ s/pci_pwrctrl_upd720201_probe/upd720201_pwrctrl_probe/ Might be more opportunities to be more similar to slot.c and pci-pwrctrl-tc9563.c, e.g., adding: upd720201->pwrctrl.power_on = ...; upd720201->pwrctrl.power_off = ...; (would have to be based on pci/pwrctrl branch, which is where this patch would be applied) > +{ > + struct pci_pwrctrl_upd720201_data *upd720201 = data; > + > + regulator_bulk_disable(upd720201->num_supplies, upd720201->supplies); > + regulator_bulk_free(upd720201->num_supplies, upd720201->supplies); > +} > + > +static int pci_pwrctrl_upd720201_probe(struct platform_device *pdev) > +{ > + struct pci_pwrctrl_upd720201_data *upd720201; > + struct device *dev = &pdev->dev; > + int ret; > + > + upd720201 = devm_kzalloc(dev, sizeof(*upd720201), GFP_KERNEL); > + if (!upd720201) > + return -ENOMEM; > + > + ret = of_regulator_bulk_get_all(dev, dev_of_node(dev), > + &upd720201->supplies); > + if (ret < 0) { > + dev_err_probe(dev, ret, "Failed to get upd720201 regulators\n"); > + return ret; > + } > + > + upd720201->num_supplies = ret; > + ret = regulator_bulk_enable(upd720201->num_supplies, upd720201->supplies); > + if (ret < 0) { > + dev_err_probe(dev, ret, "Failed to enable upd720201 regulators\n"); > + regulator_bulk_free(upd720201->num_supplies, upd720201->supplies); > + return ret; > + } > + > + ret = devm_add_action_or_reset(dev, devm_pci_pwrctrl_upd720201_power_off, > + upd720201); > + if (ret) > + return ret; > + > + pci_pwrctrl_init(&upd720201->ctx, dev); > + > + ret = devm_pci_pwrctrl_device_set_ready(dev, &upd720201->ctx); > + if (ret) > + return dev_err_probe(dev, ret, "Failed to register pwrctrl driver\n"); > + > + return 0; > +} > + > +static const struct of_device_id pci_pwrctrl_upd720201_of_match[] = { > + { > + .compatible = "pci1912,0014", > + }, > + { } > +}; > +MODULE_DEVICE_TABLE(of, pci_pwrctrl_upd720201_of_match); > + > +static struct platform_driver pci_pwrctrl_upd720201_driver = { > + .driver = { > + .name = "pci-pwrctrl-upd720201", > + .of_match_table = pci_pwrctrl_upd720201_of_match, > + }, > + .probe = pci_pwrctrl_upd720201_probe, > +}; > +module_platform_driver(pci_pwrctrl_upd720201_driver); > + > +MODULE_AUTHOR("Neil Armstrong "); > +MODULE_DESCRIPTION("PCI Power Control driver for UPD720201 USB3 Host Controller"); > +MODULE_LICENSE("GPL"); > > -- > 2.34.1 >