Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp910070ybl; Tue, 13 Aug 2019 04:38:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyz9VnaMStREX8J+ecjCN1L2EqeVqzgqLMGEWmkreYU03S7CM+cssV0KByzWhEEWeGNw7t+ X-Received: by 2002:a17:90a:3651:: with SMTP id s75mr1780032pjb.13.1565696333022; Tue, 13 Aug 2019 04:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565696333; cv=none; d=google.com; s=arc-20160816; b=YOEUB0TjHe1bKdDjmjiFFDIs/paDW5AEp32SPxPrcwMn86L9i8IjO04EUkyagPNSx5 jdOwAEGfnxUsLmTfCjGHqEvxJVyNseUXEHQj0E2iov8gVVlCRzhnbZZ85ya+aQrsvkoB FXw2pz6fpMl9tr2sR9XPOGWfjBCZGNffKRCuGwVOV1mNcLwJ7H+Pkpo+8SE9+ltOoHAF kLCNesGzncshiGYubwilExVTtLHhXtwqV8B5Xjn1ByVNWWyKATMTR5dzGIeuqfnE6Q3D VAA3Jwsh6a0qA9zLfcKYwssP4ydnDU+ZNV1GvNfe/PaHDUY2KxI4+0WBv2GEWY1SspCf QPzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=4Psg/r41ksVGb4emWtCZ1+f7Eyf11lPMtQtCZgjNc9A=; b=DxKC3HcgKTp01oLeAIUZo8TMwSk6TiZ6Iug9TbwyUhRuzGcnqmt9nTEAGZI/xX7lxX gl/OO88IYaH2CD02AW5qoOl+W8/OklRnC/MhfD0lNGirV/Sax9oP8QhOGhUvS4L0lXhh 1EdNaIUgqszGx7V6J+m4davTNGQkPl27O3bX7ive2EEq2lvnYTaaqzBdMwr5vs+hDyuW MmfWQv0AIS9YwzW2WX8U04QbPVlBZAeRBSS7S75UXMSedulUb8mFwVNfx1ai+/XIRRBG CC2aEDC5UTM88GXbY0IPi3HVEYzwTpBIHP4yzQ24/FUrAB6F8dLRFhseTmiJoUrkkDll qVPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=AN7D3Low; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9si65555613pgv.577.2019.08.13.04.38.37; Tue, 13 Aug 2019 04:38:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=AN7D3Low; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727890AbfHMLhh (ORCPT + 99 others); Tue, 13 Aug 2019 07:37:37 -0400 Received: from hqemgate15.nvidia.com ([216.228.121.64]:13667 "EHLO hqemgate15.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726600AbfHMLhg (ORCPT ); Tue, 13 Aug 2019 07:37:36 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate15.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 13 Aug 2019 04:37:46 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Tue, 13 Aug 2019 04:37:35 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Tue, 13 Aug 2019 04:37:35 -0700 Received: from HQMAIL110.nvidia.com (172.18.146.15) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 13 Aug 2019 11:37:35 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by hqmail110.nvidia.com (172.18.146.15) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 13 Aug 2019 11:37:35 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Tue, 13 Aug 2019 11:37:35 +0000 Received: from vidyas-desktop.nvidia.com (Not Verified[10.24.37.38]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Tue, 13 Aug 2019 04:37:34 -0700 From: Vidya Sagar To: , , , , , , , , , , CC: , , , , , , , , , , Subject: [PATCH V16 08/13] PCI: dwc: Add support to enable CDM register check Date: Tue, 13 Aug 2019 17:06:22 +0530 Message-ID: <20190813113627.27251-9-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190813113627.27251-1-vidyas@nvidia.com> References: <20190813113627.27251-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1565696266; bh=4Psg/r41ksVGb4emWtCZ1+f7Eyf11lPMtQtCZgjNc9A=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:X-NVConfidentiality:MIME-Version: Content-Type; b=AN7D3LowzjbVCYwG/z59jnJFx7RIEqu1PLivBEmTAVray9wl8O3jJCM4BV6otC6xN K1decizaQMvWjzSRS+YDY513wddBNvt7fR98N1ZHa6hUjlvJ0OOU5Ak4ogEagPzyEY esungXn6iVOD8NuHn3gsGRuZEZlE/8nURseDChrVGhJpB/KHIsn0sd0M/nNUmN//AA JS0QrGa6+IulwJ1a/vvKUEbJTFI1/wlrekAzrxwUYrjYhpq8rMgputgDY7c7SKC4fW 2/KsO44fmZe3YSVzpnePaoOdv5ZnoovUn2LtWZ/b0VuimyXwOO/GiMuZJwEIvXo5s9 H31ibIAyA9U6g== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to enable CDM (Configuration Dependent Module) register check for any data corruption based on the device-tree flag 'snps,enable-cdm-check'. Signed-off-by: Vidya Sagar Acked-by: Gustavo Pimentel Reviewed-by: Thierry Reding --- V16: * None V15: * None V14: * None V13: * None V12: * None V11: * None V10: * None V9: * None V8: * None V7: * Changed "enable-cdm-check" to "snps,enable-cdm-check" V6: * None V5: * None V4: * None V3: * Changed code and commit description to reflect change in flag from 'cdm-check' to 'enable-cdm-check' V2: * This is a new patch in v2 series drivers/pci/controller/dwc/pcie-designware.c | 7 +++++++ drivers/pci/controller/dwc/pcie-designware.h | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/controller/dwc/pcie-designware.c index 1d87e823de21..59eaeeb21dbe 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -547,4 +547,11 @@ 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); + } } diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 11c223471416..5a18e94e52c8 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -86,6 +86,15 @@ #define PCIE_MISC_CONTROL_1_OFF 0x8BC #define PCIE_DBI_RO_WR_EN BIT(0) +#define PCIE_PL_CHK_REG_CONTROL_STATUS 0xB20 +#define PCIE_PL_CHK_REG_CHK_REG_START BIT(0) +#define PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS BIT(1) +#define PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR BIT(16) +#define PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR BIT(17) +#define PCIE_PL_CHK_REG_CHK_REG_COMPLETE BIT(18) + +#define PCIE_PL_CHK_REG_ERR_ADDR 0xB28 + /* * iATU Unroll-specific register definitions * From 4.80 core version the address translation will be made by unroll -- 2.17.1