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.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 72E48C433E2 for ; Thu, 10 Sep 2020 18:51:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2CC4321582 for ; Thu, 10 Sep 2020 18:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599763869; bh=8/FN2pGrV2e6oHJ4XPt99FQ76GAY46jbQGsYN15injo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:List-ID:From; b=YqW/G77xbbKl5KzoLRa7M61u699QUIWgCWZjSF1cIqC49K9Fa3g0wyZuZpom+/k39 aGSti9FXAxd/fUzSmwGqJ63SVMuEmmrV4VU89R2RuDhs0vudMPPm6SOLr5GCdgOpiV 9RU/bi+tikIPGi8sWybKGBSI44mq7Q4xp9EWg6Gk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727119AbgIJSvF (ORCPT ); Thu, 10 Sep 2020 14:51:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:57964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726728AbgIJSuq (ORCPT ); Thu, 10 Sep 2020 14:50:46 -0400 Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F369720855; Thu, 10 Sep 2020 18:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599763846; bh=8/FN2pGrV2e6oHJ4XPt99FQ76GAY46jbQGsYN15injo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=c9rA0ACnX9KBuHVDn0E0CuwtvCHjuD9ZzW5VyN6mV1QkoX34R0JctiRzqAAVZ+Gmc PvNdTEoxeGC5w/b5qmGhDSqKkj/hyJfmjOVuj9vjhq34djOA7cjH7W7fMtkwNPV7u7 Tg0wt9KtvgYZ7ZN2QKZJ8pniNAg+rRoEVTuOUXvI= Received: by mail-ot1-f47.google.com with SMTP id g10so6234718otq.9; Thu, 10 Sep 2020 11:50:45 -0700 (PDT) X-Gm-Message-State: AOAM533UAVMdWhEgkaezVmC2zdlvVkVEi8b0SZvQrd74hXURTg+EWtEE UIr0tYxOwmnd4gQeaM+esJLZqMbctQdarqHa0g== X-Google-Smtp-Source: ABdhPJxId/3nNZbBGqZxSbJuxtyRdyh2ZW5+MJHU0lYZCDw8GvbX0pkcX7nJAy2HYsIcmimVL93DTH8UyT5yVJErc2E= X-Received: by 2002:a9d:411:: with SMTP id 17mr4977165otc.192.1599763845337; Thu, 10 Sep 2020 11:50:45 -0700 (PDT) MIME-Version: 1.0 References: <20200824193036.6033-1-james.quinlan@broadcom.com> <20200824193036.6033-5-james.quinlan@broadcom.com> <20200910155637.GA423872@bogus> In-Reply-To: From: Rob Herring Date: Thu, 10 Sep 2020 12:50:34 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v11 04/11] PCI: brcmstb: Add suspend and resume pm_ops To: Jim Quinlan Cc: "open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS" , Nicolas Saenz Julienne , Christoph Hellwig , Robin Murphy , "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" , Lorenzo Pieralisi , Bjorn Helgaas , Florian Fainelli , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , open list Content-Type: text/plain; charset="UTF-8" Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Thu, Sep 10, 2020 at 10:42 AM Jim Quinlan wrote: > > On Thu, Sep 10, 2020 at 11:56 AM Rob Herring wrote: > > > > 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. > > I will test switching this to suspend_late/resume_early. Why not just the 'regular' flavor suspend/resume? Rob