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 X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9613BC433E2 for ; Thu, 10 Sep 2020 15:58:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3189C2087C for ; Thu, 10 Sep 2020 15:58:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="rVHERud0" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3189C2087C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Z/NQHFVbv+u52zQmb0EJnoZtBYC6WlBp3BBugJ/QVRg=; b=rVHERud0h0VGIossQC/OTViTa hoT4TB3touzoxHZeGHJZ7OnQaaGZAcF3jDsoQdyyk7VgKVjTkWOx40gRtO17vlfuepPc93yQCb+Pf ozcCRD7ENtPMf79ox/OOFxQQdnl2nbv8aElk0ArSsBGg5PbSFsI059dPJUR5CdhpFpu6LXBeTAMSp piCCDLoIk8pk44rtI+3BDjcXCDg9qaCsdZlYvmxYBKg5kBX15bZ/J4lRpprZUlDiEJWz9zST6WHI9 bZH5iWS6uST2kAuH8/XufmoJXN/HY99k7zzDMI6KqkoYBCM4E6WXRF7dIkN//TXY/2CSeI2e0SCYC Ma0wWpDFQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGOwI-00074w-5r; Thu, 10 Sep 2020 15:56:46 +0000 Received: from mail-il1-f195.google.com ([209.85.166.195]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGOwF-00074R-EY; Thu, 10 Sep 2020 15:56:44 +0000 Received: by mail-il1-f195.google.com with SMTP id a19so1547314ilq.10; Thu, 10 Sep 2020 08:56:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=75EPNsIBYVup6AIGiJwzSdSJw0NGHqRELWm5o6mzFMs=; b=SlLIWIIXzQjazDqkJlhRQ9WY1CYCTdXrVnbES2Aja2OjCnebqPJvQK3EllFhnRZxC2 yRDxP8LonBImQQDnfTuYCGPqfhe7OISRp5qDAmk7VSbQLfLfkYgJLtdNF+Nk5xs8btzX yfXyd45VOzzDwE5Q7YvCv2JFSaKl7vz/b6GzY7ck4TPW/I/7G7ZUUa8uiRqJa3/WCjTw Emy6EFiS5+O3F5HZ9Ekd8IA57AYfxPSWLVyt0oMRBwME0yCBHditEhFASu/wJOmsPar6 vEZzuqgBF/cm9O2qncHt4IZSRFIe3p64l57AgQmROS7hYHEUWWgh/c7xp68tNq/pK0Kt Xmew== X-Gm-Message-State: AOAM530FWtPzIGBs6gVoAx5QEI4PrZsW3HoMNpiEtcVRju74kwDsWisl dvFB7QJXjnNyHcxWa84npg== X-Google-Smtp-Source: ABdhPJy4YBC4Og5nCPNZgXln9mIj11eNmiP8UC9Zd2pwLdDntsNRTIUnoo41piAt35aUn1jJdSewgA== X-Received: by 2002:a92:7984:: with SMTP id u126mr7266050ilc.139.1599753398667; Thu, 10 Sep 2020 08:56:38 -0700 (PDT) Received: from xps15 ([64.188.179.251]) by smtp.gmail.com with ESMTPSA id s17sm1301374ilb.24.2020.09.10.08.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 08:56:38 -0700 (PDT) Received: (nullmailer pid 439332 invoked by uid 1000); Thu, 10 Sep 2020 15:56:37 -0000 Date: Thu, 10 Sep 2020 09:56:37 -0600 From: Rob Herring To: Jim Quinlan Subject: Re: [PATCH v11 04/11] PCI: brcmstb: Add suspend and resume pm_ops Message-ID: <20200910155637.GA423872@bogus> References: <20200824193036.6033-1-james.quinlan@broadcom.com> <20200824193036.6033-5-james.quinlan@broadcom.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200824193036.6033-5-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_115643_509021_2C566C1A X-CRM114-Status: GOOD ( 22.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Lorenzo Pieralisi , linux-pci@vger.kernel.org, open list , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , Bjorn Helgaas , Robin Murphy , Christoph Hellwig , Nicolas Saenz Julienne Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Aug 24, 2020 at 03:30:17PM -0400, Jim Quinlan wrote: > From: Jim Quinlan > > Broadcom Set-top (BrcmSTB) boards typically support S2, S3, and S5 suspend > and resume. Now the PCIe driver may do so as well. > > Signed-off-by: Jim Quinlan > Acked-by: Florian Fainelli > --- > drivers/pci/controller/pcie-brcmstb.c | 47 +++++++++++++++++++++++++++ > 1 file changed, 47 insertions(+) > > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c > index c2b3d2946a36..3d588ab7a6dd 100644 > --- a/drivers/pci/controller/pcie-brcmstb.c > +++ b/drivers/pci/controller/pcie-brcmstb.c > @@ -978,6 +978,47 @@ static void brcm_pcie_turn_off(struct brcm_pcie *pcie) > brcm_pcie_bridge_sw_init_set(pcie, 1); > } > > +static int brcm_pcie_suspend(struct device *dev) > +{ > + struct brcm_pcie *pcie = dev_get_drvdata(dev); > + > + brcm_pcie_turn_off(pcie); > + clk_disable_unprepare(pcie->clk); > + > + return 0; > +} > + > +static int brcm_pcie_resume(struct device *dev) > +{ > + struct brcm_pcie *pcie = dev_get_drvdata(dev); > + void __iomem *base; > + u32 tmp; > + int ret; > + > + base = pcie->base; > + clk_prepare_enable(pcie->clk); > + > + /* Take bridge out of reset so we can access the SERDES reg */ > + brcm_pcie_bridge_sw_init_set(pcie, 0); > + > + /* SERDES_IDDQ = 0 */ > + tmp = readl(base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); > + u32p_replace_bits(&tmp, 0, PCIE_MISC_HARD_PCIE_HARD_DEBUG_SERDES_IDDQ_MASK); > + writel(tmp, base + PCIE_MISC_HARD_PCIE_HARD_DEBUG); > + > + /* wait for serdes to be stable */ > + udelay(100); Really needs to be a spinloop? > + > + ret = brcm_pcie_setup(pcie); > + if (ret) > + return ret; > + > + if (pcie->msi) > + brcm_msi_set_regs(pcie->msi); > + > + return 0; > +} > + > static void __brcm_pcie_remove(struct brcm_pcie *pcie) > { > brcm_msi_remove(pcie); > @@ -1087,12 +1128,18 @@ static int brcm_pcie_probe(struct platform_device *pdev) > > MODULE_DEVICE_TABLE(of, brcm_pcie_match); > > +static const struct dev_pm_ops brcm_pcie_pm_ops = { > + .suspend_noirq = brcm_pcie_suspend, > + .resume_noirq = brcm_pcie_resume, Why do you need interrupts disabled? There's 39 cases of .suspend_noirq and 1352 of .suspend in the tree. Is doing a clk unprepare even safe in .suspend_noirq? IIRC, prepare/unprepare can sleep. > +}; > + > static struct platform_driver brcm_pcie_driver = { > .probe = brcm_pcie_probe, > .remove = brcm_pcie_remove, > .driver = { > .name = "brcm-pcie", > .of_match_table = brcm_pcie_match, > + .pm = &brcm_pcie_pm_ops, > }, > }; > module_platform_driver(brcm_pcie_driver); > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel