Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3022484rwb; Mon, 15 Aug 2022 16:19:59 -0700 (PDT) X-Google-Smtp-Source: AA6agR7LxPpiFrUW+mTCfFKfnWo/sGmEUQdgzjV9hKUfxG4md5x8tX7YiV3EJkC8F+N8t4VDA/wK X-Received: by 2002:a17:907:2cd1:b0:730:65c9:4c18 with SMTP id hg17-20020a1709072cd100b0073065c94c18mr11742124ejc.324.1660605599368; Mon, 15 Aug 2022 16:19:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660605599; cv=none; d=google.com; s=arc-20160816; b=n73PBwUgCQlB+yWcDTAYclRd6oYFIfBavcTuUJwaLxqZRSn1VdjDhCS4w3/r86yniS PG24vniG8b1zv5kB6Xu1vAZFl4Da9tDCk1k9RRfXobcIGq57/oxSyQv1jWbDp/CKReBL mlvJbGTiOBEK2qp9VH4LPsxdXQZW1ggASl75NrNZR8ZjWMENAEdIXIjQI+76DSr7ZBod CtortO1fLa7PvwdLJ6EAISFUyc8mnLcfNIvjMcn+S6ATlQFCQRqJlQUmOZNnpg7l7t0I CE0CgOsxal+iAqspm6fyx86QAwg2KHT3R1PlLULnoWkc8Wu9eQYjCRGyO2T9/ATsIxbe qnAA== 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=iaMOB71kdCpk8jWU2T48JWpT4XStZd9znQpxhDnj8MEry44HV32TMAxK+UDBwUxEr6 TPo+r/bZXB7ds0VV7P9VUZ1ALzJvtY4E7awdtnWSUYg4z2RtWvinFsKna0jh6ZF2Rocs HdYjU+D2KBvSwsyQ4JvNQ+wCMl7iS9gp9aS933xvFtk+kRELfRqJC+F/wSEW2XrMf5+Y 61rME2t+7ZMyhh9J7/mYZwQswAiwnFHU4Qfwy++1nQZY+jLCCnRMrdoN1/obGoYYP/JR N4PO41WI+6SnSUyG5CBJHJeAindTVjLLFGwWuo3JjNaVbLpU/DoQUfZPGj2/ZCsy4voN FwuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xpAfMpjX; 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 e11-20020a1709062c0b00b0073159d94151si6959762ejh.499.2022.08.15.16.19.34; Mon, 15 Aug 2022 16:19:59 -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=xpAfMpjX; 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 S1343667AbiHOWKP (ORCPT + 99 others); Mon, 15 Aug 2022 18:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345798AbiHOWIt (ORCPT ); Mon, 15 Aug 2022 18:08:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BCA430F66; Mon, 15 Aug 2022 12:38:05 -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 1B72BB81136; Mon, 15 Aug 2022 19:38:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DB49C433C1; Mon, 15 Aug 2022 19:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660592281; bh=Eu2Too71nkRvOCWXDlOSR3/DmXmFVsTh3FCCzEj3Lqo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xpAfMpjXOcEOryS5oSqyddKpa2DMx+6RUEBoMUa5XDNB3flVbIriK8batxx/kC7Q5 GRnyggE0txKIZuiiqdAy4EBHHUp8fmvOq63G7TePuNP+oRplUWIy8VB+XomX+5Qfgi DpT9GO1GM6pN4YKcM12XRnTNuscMCTArk2BjfvjM= 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.18 0726/1095] PCI: dwc: Always enable CDM check if "snps,enable-cdm-check" exists Date: Mon, 15 Aug 2022 20:02:05 +0200 Message-Id: <20220815180459.405688322@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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