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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E92EE49A0 for ; Wed, 23 Aug 2023 08:03:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233409AbjHWIC3 (ORCPT ); Wed, 23 Aug 2023 04:02:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233273AbjHWICN (ORCPT ); Wed, 23 Aug 2023 04:02:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37165CD0; Wed, 23 Aug 2023 01:02:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9870E616CF; Wed, 23 Aug 2023 08:02:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7D2FC433C8; Wed, 23 Aug 2023 08:02:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692777728; bh=5wXBowWi/z5rX1b22zzh2tsRtXiSEcMH1JeaAg4xXBE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KdIHGVGipE/SD8BcM3OhOE9pSHYblDozh2QqSPBLFYuiEvc3hBpFgK15u2CewKKzt FDR1MVWz0U9PqC7T5VqRNIaJ7l7JGwXA1kA+szvS6B7BbaDDhRbaTSGsE1SvYs8KIJ blG5XlSbZo0QEeoeLrzdzA0XYFvRauz2B6r6LJVDsKJMX170QwCxdzWM3/TVkSXzzR sET8MWO1Po972tNYAq8acyWzJVGUlJUypUeaC7M2UynnyadoArO6irj8osYvcyQRpg KnQmDla1SkZYFmLIAkUDacxNtcvjawEUe0tfvDu6htO5qJovGePrJqogw41wS6MTDC LcoFAjiZ1LFuA== Date: Wed, 23 Aug 2023 13:31:52 +0530 From: Manivannan Sadhasivam To: Wolfram Sang Cc: linux-renesas-soc@vger.kernel.org, Geert Uytterhoeven , Marek Vasut , Yoshihiro Shimoda , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 2/2] PCI: rcar-host: add support for optional regulators Message-ID: <20230823080152.GI3737@thinkpad> References: <20230816104251.19744-1-wsa+renesas@sang-engineering.com> <20230816104251.19744-3-wsa+renesas@sang-engineering.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230816104251.19744-3-wsa+renesas@sang-engineering.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 16, 2023 at 12:42:50PM +0200, Wolfram Sang wrote: > The KingFisher board has regulators for miniPCIe, so enable these > optional regulators using devm. devm will automatically disable them > when the driver releases the device. Order variables in reverse-xmas > while we are here. > > Signed-off-by: Wolfram Sang Acked-by: Manivannan Sadhasivam - Mani > Reviewed-by: Geert Uytterhoeven > --- > drivers/pci/controller/pcie-rcar-host.c | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > > diff --git a/drivers/pci/controller/pcie-rcar-host.c b/drivers/pci/controller/pcie-rcar-host.c > index 88975e40ee2f..7aecc114af4f 100644 > --- a/drivers/pci/controller/pcie-rcar-host.c > +++ b/drivers/pci/controller/pcie-rcar-host.c > @@ -29,6 +29,7 @@ > #include > #include > #include > +#include > > #include "pcie-rcar.h" > > @@ -953,14 +954,20 @@ static const struct of_device_id rcar_pcie_of_match[] = { > {}, > }; > > +/* Design note 346 from Linear Technology says order is not important */ > +static const char * const rcar_pcie_supplies[] = { > + "vpcie12v", "vpcie3v3", "vpcie1v5" > +}; > + > static int rcar_pcie_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > + struct pci_host_bridge *bridge; > struct rcar_pcie_host *host; > struct rcar_pcie *pcie; > + unsigned int i; > u32 data; > int err; > - struct pci_host_bridge *bridge; > > bridge = devm_pci_alloc_host_bridge(dev, sizeof(*host)); > if (!bridge) > @@ -971,6 +978,13 @@ static int rcar_pcie_probe(struct platform_device *pdev) > pcie->dev = dev; > platform_set_drvdata(pdev, host); > > + for (i = 0; i < ARRAY_SIZE(rcar_pcie_supplies); i++) { > + err = devm_regulator_get_enable_optional(dev, rcar_pcie_supplies[i]); > + if (err < 0 && err != -ENODEV) > + return dev_err_probe(dev, err, "can't enable regulator %s\n", > + rcar_pcie_supplies[i]); > + } > + > pm_runtime_enable(pcie->dev); > err = pm_runtime_get_sync(pcie->dev); > if (err < 0) { > -- > 2.35.1 > -- மணிவண்ணன் சதாசிவம்