Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2878931rwb; Mon, 15 Aug 2022 13:10:02 -0700 (PDT) X-Google-Smtp-Source: AA6agR5BfqPuye6Dhsn/QsP8k/gAUpA+nGor1/GLnuHJa6E8f0u1odMN0eJ6J5owx74kjR5E1LSk X-Received: by 2002:a17:907:9710:b0:731:67b1:dc3b with SMTP id jg16-20020a170907971000b0073167b1dc3bmr11538360ejc.709.1660594201780; Mon, 15 Aug 2022 13:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594201; cv=none; d=google.com; s=arc-20160816; b=o3vKo2Y/YxV2IUqwufIL7FX91EbwBsCrVzM7acBvmckudQsQ/4QPYCytEuU0ya4HGh 7bVLvN2A+i4si6TD9heboVcxhH1Aky5rBOmrq5udKN1q28xN12up6RBsfA+tTTOX1wFU o33/AslyUO6YZyveCQF4VoeStDZkVyDWyWCrgkDmPUdsryHfOEGG2xuHbl5o5HOd96dx iTutnCc6Fmh4MJzRErMYnSvbEw3qu/AsPLsrm8BSJcSBeYAYn7zUrG3h1+MWD1Jq7tZ9 TrT2I+jaN0Pvc34vuvOI4ATg8KndXxDOO4GFQNkZMQKv9vrUbWOEVAvIkY4FpBt1bwlu jhFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9aiek90pSR0hkfFuJSCigiVG4Z/j2D5SY1Eh5vKBkfo=; b=Zvh//Ja3lZgw3MnD48r8cMkfVdYQZo9uInjIdfIXA+mAw4CWfANxgnNzpb1Y7UQJpa XrzDps1JM05GmiToOQEBCuzCNoc0gc9ZNl4eOTYgbsEQnDOCeojavPaDCSvNOkSHtzAJ AgXpTorrTpau2p/AuE321/pywEO3oXryFb6nskx+5dwOv+39SpKSDgeKdPz6g67jArRx el9jWsPOGCwCo/7sx6he6B4DcLgTevlrHjNH+qJUzfo6KQafFkMTWtN/s9CINXD69ACf REA7IL6Sn92FH2sI23C/6wRI1PMnQs2wHOEqWkhb5wLxyIGrZP9yjKol0c+pFupsv1lQ +khA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MRbrj+9I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y14-20020a170906448e00b007309e910729si6969976ejo.580.2022.08.15.13.09.35; Mon, 15 Aug 2022 13:10:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MRbrj+9I; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240447AbiHOTU1 (ORCPT + 99 others); Mon, 15 Aug 2022 15:20:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344730AbiHOTRX (ORCPT ); Mon, 15 Aug 2022 15:17:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7164E3C8ED; Mon, 15 Aug 2022 11:38:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FE4860FBA; Mon, 15 Aug 2022 18:38:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FF1BC433C1; Mon, 15 Aug 2022 18:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588722; bh=hQuQPiWue9/Tz9DD8DLI6oIL8XseOvRSRPmKO4kuJvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRbrj+9IF8usyO/N7AigyVHd5g6vTOXg+cs1oZPje5jrz0qWYps1Q5MgpmSg+jhzx eCpnP/EyAg4l8Zmv8tnAgFhV2XPw4UNz4C0nvwLqhDZVx3vEyqn8bglVjVTAnCuUO0 Gqap1WRmny4w4JwlLtRtnqMtQLsU0V8k5XLmmD7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Bjorn Helgaas , Vidya Sagar , Rob Herring , Manivannan Sadhasivam , Sasha Levin Subject: [PATCH 5.15 464/779] PCI: dwc: Always enable CDM check if "snps,enable-cdm-check" exists Date: Mon, 15 Aug 2022 20:01:48 +0200 Message-Id: <20220815180357.130710783@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Serge Semin [ Upstream commit ec7b952f453ce7eabe7e1bea584626934d44f668 ] If the "snps,enable-cdm-check" property exists, we should enable the CDM check. But previously dw_pcie_setup() could exit before doing so if the "num-lanes" property was absent or invalid. Move the CDM enable earlier so we do it regardless of whether "num-lanes" is present. [bhelgaas: commit log] Fixes: 07f123def73e ("PCI: dwc: Add support to enable CDM register check") Link: https://lore.kernel.org/r/20220624143428.8334-7-Sergey.Semin@baikalelectronics.ru Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Vidya Sagar Reviewed-by: Rob Herring Reviewed-by: Manivannan Sadhasivam Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pcie-designware.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index e863cc2f1e1d..e408ebf5bd73 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -739,6 +739,13 @@ void dw_pcie_setup(struct dw_pcie *pci) val |= PORT_LINK_DLL_LINK_EN; dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, val); + if (of_property_read_bool(np, "snps,enable-cdm-check")) { + val = dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); + val |= PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS | + PCIE_PL_CHK_REG_CHK_REG_START; + dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val); + } + of_property_read_u32(np, "num-lanes", &pci->num_lanes); if (!pci->num_lanes) { dev_dbg(pci->dev, "Using h/w default number of lanes\n"); @@ -785,11 +792,4 @@ void dw_pcie_setup(struct dw_pcie *pci) break; } dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, val); - - if (of_property_read_bool(np, "snps,enable-cdm-check")) { - val = dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); - val |= PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS | - PCIE_PL_CHK_REG_CHK_REG_START; - dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val); - } } -- 2.35.1