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 C8E31C43461 for ; Thu, 10 Sep 2020 16:05:55 +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 6DAF3206A1 for ; Thu, 10 Sep 2020 16:05:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="I2DUDkPH" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DAF3206A1 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=+AQQyFG8IW2blC/YQ4hAcmH7GGCMsyUSE/KZhpcjK6Q=; b=I2DUDkPHZLWAnhW/JnsuJSAei /B4JVDlXTdbPekPars2FmuRbAaBS89u14smHqDaAA/9omw1GmceJt9pyIMrOECRjchX2QyKtgSlXF vj6GqVmN2kNYkxPJKwS9tz4SJYL2+TisLQkDxMzL/7zEXmyZ1cRgVjSOSTRW9Xhisa84wufbGl8+O I22OY1YWbpRODRrDqG8AABdOXV2YjB4KUdlM/q3TEdDwtC5XMB514P+5iR//WOpf9jtgPjoi7pshp gLb1YjgRgiqEzq9HoN7Zxjn/7wbOSWU7ybuAqhWbwXAPN8/zyYY+UpkIIN6TE6yOsvwn6LWWSlehK sECoY7AsQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGP3Z-00081g-Fz; Thu, 10 Sep 2020 16:04:17 +0000 Received: from mail-il1-f193.google.com ([209.85.166.193]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kGP3W-000817-E0; Thu, 10 Sep 2020 16:04:15 +0000 Received: by mail-il1-f193.google.com with SMTP id y2so6158830ilp.7; Thu, 10 Sep 2020 09:04:14 -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=ebp5z+46rHgEspLwslVPrPQpZSFjnRSho3Me2D+xH8o=; b=N6VGHNnA9zI70imGQp5CEWXpmTVVRzRZZI5AgDHYp1Ncrx6T+YYMSqZAQzpPNPvkSt 9g0Kh5F5aQgek1vYVv8JzWHisYScJUIVK4atfaWtMXmEY2i5+ENkJkuKnqna0iez3/X6 v4vMPxQn/oG+59irkdx622TLjbb5TJuCNaATb+uupU+qxzO+v6DEBzXdsLRLguZKZWFD cHJGzhHkf/OLqcYjCoADGxx5lceSd4rB2twNzS+xsoo/1A0EAZDoqvpOk+Ja06WxYxof VkXrr4N+YxQmQdMW4801HcwvGe1CLALyx69sPd4e6VG++xymcyfVqLFRBqP+9dx2+mxt Xjzg== X-Gm-Message-State: AOAM532K2BKtNW8uje0untX+I3hcvVFtXGDEYDXXW1gMyzkIqx1OcTZ5 rGNKFs97KGi052v11sR0KQ== X-Google-Smtp-Source: ABdhPJwEriHzybxiHldBLmDpi2mvi2cZg5tHwCiO7MmmEqZLF4YSjxhJdd6BIxqEmm2n29ddo/Nobg== X-Received: by 2002:a92:906:: with SMTP id y6mr8750650ilg.106.1599753852523; Thu, 10 Sep 2020 09:04:12 -0700 (PDT) Received: from xps15 ([64.188.179.251]) by smtp.gmail.com with ESMTPSA id e22sm3035082ioc.43.2020.09.10.09.04.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Sep 2020 09:04:12 -0700 (PDT) Received: (nullmailer pid 449332 invoked by uid 1000); Thu, 10 Sep 2020 16:04:11 -0000 Date: Thu, 10 Sep 2020 10:04:11 -0600 From: Rob Herring To: Jim Quinlan Subject: Re: [PATCH v11 05/11] PCI: brcmstb: Add bcm7278 PERST# support Message-ID: <20200910160411.GA439527@bogus> References: <20200824193036.6033-1-james.quinlan@broadcom.com> <20200824193036.6033-6-james.quinlan@broadcom.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200824193036.6033-6-james.quinlan@broadcom.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200910_120414_519843_715AB1F6 X-CRM114-Status: GOOD ( 22.93 ) 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:18PM -0400, Jim Quinlan wrote: > From: Jim Quinlan > > The PERST# bit was moved to a different register in 7278-type STB chips. > In addition, the polarity of the bit was also changed; for other chips > writing a 1 specified assert; for 7278-type chips, writing a 0 specifies > assert. > > Of course, PERST# is a PCIe asserted-low signal. > > Signed-off-by: Jim Quinlan > Acked-by: Florian Fainelli > --- > drivers/pci/controller/pcie-brcmstb.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/controller/pcie-brcmstb.c b/drivers/pci/controller/pcie-brcmstb.c > index 3d588ab7a6dd..acf2239b0251 100644 > --- a/drivers/pci/controller/pcie-brcmstb.c > +++ b/drivers/pci/controller/pcie-brcmstb.c > @@ -83,6 +83,7 @@ > > #define PCIE_MISC_PCIE_CTRL 0x4064 > #define PCIE_MISC_PCIE_CTRL_PCIE_L23_REQUEST_MASK 0x1 > +#define PCIE_MISC_PCIE_CTRL_PCIE_PERSTB_MASK 0x4 > > #define PCIE_MISC_PCIE_STATUS 0x4068 > #define PCIE_MISC_PCIE_STATUS_PCIE_PORT_MASK 0x80 > @@ -684,9 +685,16 @@ static inline void brcm_pcie_perst_set(struct brcm_pcie *pcie, u32 val) > { > u32 tmp; > > - tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); > - u32p_replace_bits(&tmp, val, PCIE_RGR1_SW_INIT_1_PERST_MASK); > - writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); > + if (pcie->type == BCM7278) { > + /* Perst bit has moved and assert value is 0 */ > + tmp = readl(pcie->base + PCIE_MISC_PCIE_CTRL); > + u32p_replace_bits(&tmp, !val, PCIE_MISC_PCIE_CTRL_PCIE_PERSTB_MASK); > + writel(tmp, pcie->base + PCIE_MISC_PCIE_CTRL); > + } else { > + tmp = readl(pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); > + u32p_replace_bits(&tmp, val, PCIE_RGR1_SW_INIT_1_PERST_MASK); > + writel(tmp, pcie->base + PCIE_RGR1_SW_INIT_1(pcie)); Humm, now we have a mixture of a code path based on the chip and variables to abstract the register details. Just do a function per chip. I have some notion to abstract out the PERST# handling from the host bridges. We have several cases of GPIO based handling and random assertion times. So having an ops function here will move in that direction. > + } > } > > static inline int brcm_pcie_get_rc_bar2_size_and_offset(struct brcm_pcie *pcie, > @@ -771,7 +779,10 @@ static int brcm_pcie_setup(struct brcm_pcie *pcie) > > /* Reset the bridge */ > brcm_pcie_bridge_sw_init_set(pcie, 1); > - brcm_pcie_perst_set(pcie, 1); If these 2 functions are always called together, then you just need 1 per chip function. > + > + /* BCM7278 fails when PERST# is set here */ > + if (pcie->type != BCM7278) > + brcm_pcie_perst_set(pcie, 1); > > usleep_range(100, 200); > > -- > 2.17.1 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel