Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3254305rwb; Mon, 15 Aug 2022 22:24:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR76ffWPSwhu5qF8HhkCnrAXBD6qjDhrnQ39tm2BcshQ018TSHw1Nhw7vac5oqfBv501qjIX X-Received: by 2002:a65:6d14:0:b0:41d:5f95:179d with SMTP id bf20-20020a656d14000000b0041d5f95179dmr16204455pgb.580.1660627492593; Mon, 15 Aug 2022 22:24:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660627492; cv=none; d=google.com; s=arc-20160816; b=Ie/WS8CaYrKlB9s15AqhJohlBYSDnI6VkssAHx5w3kQ5fUu6bTBkPKkA0N0NKMyx3X roEeC6vP1b0zKC1au+6oplHQ+IT+yAQoCBPnom9yy0r93PEuI+sBSTiYosjR2lIT/QBi dXN/f/3OzJsusKOIykQMgYaUPfVaj0aSQ7EfBvplkWKCOpVsJ5XBiVRXrIS1zDHlE2Q8 LxNVtcgGWeH/LJAmUVzh6hDzxzeyobPj2buo2gRFNMUltw3HMQ+pworOZQf1m65A46dg OvLgbIgChpto1a/+QhVc6deL+CI4KjeW458T19fb0jqQU24pwxPDnMRUvMVFuqaH86K1 PW1w== 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=2JOToeTKwC9rZ8DV2Pj7WOg6ecSC4Jj5wvknJCFiKk4=; b=qzqcBg2QMZgWikhmUTaFNh59QRBdWIPc76TvzRqYGUErChP4frJcseePGUCbwbaw+d G9jyJzdVM9uQHTLjCfcCpCi+6w7aD88xNyoHOCQiz3tCnjYXWAQTMOiV4wgLQYOfOvcr YOQTLyf6/XSB48JeAsskFBmZlYbFW3CeLbSPackH4nvRoKS+baD7KDULxzk5/lpb+Vo5 QPVWyz1X2LBoPDMI1Jigye37s3NgLpZvdxR9WtyDajC6DwuUtXg80lVlO5YN8FAPJUmy y1A00qaoBeZWsPNNI3mKxwz6biG9ZJ0sXSGH0BVWTVJ672Yv8CWp6NgJPZzJpMmb/toi LGpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=iJcDQ++1; 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 66-20020a630245000000b0041bf0a54ad0si12959744pgc.729.2022.08.15.22.24.41; Mon, 15 Aug 2022 22:24:52 -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=iJcDQ++1; 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 S230470AbiHPEl6 (ORCPT + 99 others); Tue, 16 Aug 2022 00:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231332AbiHPEjo (ORCPT ); Tue, 16 Aug 2022 00:39:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79871CE311; Mon, 15 Aug 2022 13:31:16 -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 ams.source.kernel.org (Postfix) with ESMTPS id B1D9EB80EA8; Mon, 15 Aug 2022 20:31:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08612C433C1; Mon, 15 Aug 2022 20:31:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595473; bh=Eu2Too71nkRvOCWXDlOSR3/DmXmFVsTh3FCCzEj3Lqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJcDQ++1d0cYRHi0NpYcRWPAue1ExVgw6dFGE8r5GBAvSvxXu2SQrh14bQQ30Zk0G Wy6sJMkWMIrVmPX2gnPb4VmLlVY8X9UbI3vw31FS0xKvCq0oUgZ2jxhdnSrjW8asjj 9o/5BvXecvdj9booiJTmeN7EvrHOxd+813IgR7sU= 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.19 0776/1157] PCI: dwc: Always enable CDM check if "snps,enable-cdm-check" exists Date: Mon, 15 Aug 2022 20:02:12 +0200 Message-Id: <20220815180510.533971847@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@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 347251bf87d0..5848cc520b52 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -740,6 +740,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"); @@ -786,11 +793,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