From patchwork Fri Oct 9 01:48:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 7358631 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 403E9BEEA4 for ; Fri, 9 Oct 2015 01:48:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A07A207AD for ; Fri, 9 Oct 2015 01:48:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F35B62079F for ; Fri, 9 Oct 2015 01:48:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754012AbbJIBsv (ORCPT ); Thu, 8 Oct 2015 21:48:51 -0400 Received: from mail-qk0-f170.google.com ([209.85.220.170]:33521 "EHLO mail-qk0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753361AbbJIBsu (ORCPT ); Thu, 8 Oct 2015 21:48:50 -0400 Received: by qkas79 with SMTP id s79so27098510qka.0 for ; Thu, 08 Oct 2015 18:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=8nG2rw5IRL3RGF3BAotHBDNGrit9mhatU8G38IvROmw=; b=vPB71m/Uxe7vIxkBGUvD8eWMqIh6jTxJtwEk7WtShvg5XkJFik895Hl8ZNBl2VZGOx IKiayPFPHh9Gf/mvGJne/lXhx7Ba9AJb4NhJLJ67TGnS77MZqI82OAtdlXgq33vslLBI sB+f64zMKbW/CaUQM66WS+gOL05PXlKYWD3XlW6BK4wmtF1/MWCqTOqzWYveChFwD+cR c1WcNOIhTaJJ/o6ZzTNW2acuQ/sCC+kbxZmxvdcHsEdvX5ZO00CEhhtBsqNvt9W9IMmT z4qWPr7rKOCFkKWhYgGzp3zi/Y22sRRuWATkwcCGgfUXTw1HnM0QNPMJ5WLVoRXgWPyl tGMw== X-Received: by 10.55.215.18 with SMTP id m18mr11658764qki.49.1444355329613; Thu, 08 Oct 2015 18:48:49 -0700 (PDT) Received: from localhost.localdomain ([189.5.18.107]) by smtp.gmail.com with ESMTPSA id j193sm19837745qhc.17.2015.10.08.18.48.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 08 Oct 2015 18:48:49 -0700 (PDT) From: Fabio Estevam To: bhelgaas@google.com Cc: pratyush.anand@gmail.com, m-karicheri2@ti.com, l.stach@pengutronix.de, linux-pci@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 1/2] PCI: designware: Move LTSSM state definitions to pcie-designware.h Date: Thu, 8 Oct 2015 22:48:25 -0300 Message-Id: <1444355306-21486-1-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fabio Estevam Move LTSSM state definitions to common pcie-designware.h so that other drivers can make use of them. Also, in order to avoid name collision define LTSSM_STATE_MASK_KS, as keystone uses a different LTSSM mask. Signed-off-by: Fabio Estevam Acked-by: Pratyush Anand --- Changes since v1: - Fix build warning noticed by kbuild robot drivers/pci/host/pci-keystone-dw.c | 4 ++-- drivers/pci/host/pci-layerscape.c | 1 - drivers/pci/host/pcie-designware.h | 34 ++++++++++++++++++++++++++++++++++ drivers/pci/host/pcie-spear13xx.c | 33 --------------------------------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/drivers/pci/host/pci-keystone-dw.c b/drivers/pci/host/pci-keystone-dw.c index 3cf55cd..004b677 100644 --- a/drivers/pci/host/pci-keystone-dw.c +++ b/drivers/pci/host/pci-keystone-dw.c @@ -25,7 +25,7 @@ /* Application register defines */ #define LTSSM_EN_VAL 1 -#define LTSSM_STATE_MASK 0x1f +#define LTSSM_STATE_MASK_KS 0x1f #define LTSSM_STATE_L0 0x11 #define DBI_CS2_EN_VAL 0x20 #define OB_XLAT_EN_VAL 2 @@ -445,7 +445,7 @@ int ks_dw_pcie_link_up(struct pcie_port *pp) { u32 val = readl(pp->dbi_base + DEBUG0); - return (val & LTSSM_STATE_MASK) == LTSSM_STATE_L0; + return (val & LTSSM_STATE_MASK_KS) == LTSSM_STATE_L0; } void ks_dw_pcie_initiate_link_train(struct keystone_pcie *ks_pcie) diff --git a/drivers/pci/host/pci-layerscape.c b/drivers/pci/host/pci-layerscape.c index b2328ea1..f02752e 100644 --- a/drivers/pci/host/pci-layerscape.c +++ b/drivers/pci/host/pci-layerscape.c @@ -29,7 +29,6 @@ /* PEX1/2 Misc Ports Status Register */ #define SCFG_PEXMSCPORTSR(pex_idx) (0x94 + (pex_idx) * 4) #define LTSSM_STATE_SHIFT 20 -#define LTSSM_STATE_MASK 0x3f #define LTSSM_PCIE_L0 0x11 /* L0 state */ /* Symbol Timer Register and Filter Mask Register 1 */ diff --git a/drivers/pci/host/pcie-designware.h b/drivers/pci/host/pcie-designware.h index 35123d9..97d6558 100644 --- a/drivers/pci/host/pcie-designware.h +++ b/drivers/pci/host/pcie-designware.h @@ -22,6 +22,40 @@ #define MAX_MSI_IRQS 32 #define MAX_MSI_CTRLS (MAX_MSI_IRQS / 32) +#define LTSSM_STATE_DETECT_QUIET 0x00 +#define LTSSM_STATE_DETECT_ACT 0x01 +#define LTSSM_STATE_POLL_ACTIVE 0x02 +#define LTSSM_STATE_POLL_COMPLIANCE 0x03 +#define LTSSM_STATE_POLL_CONFIG 0x04 +#define LTSSM_STATE_PRE_DETECT_QUIET 0x05 +#define LTSSM_STATE_DETECT_WAIT 0x06 +#define LTSSM_STATE_CFG_LINKWD_START 0x07 +#define LTSSM_STATE_CFG_LINKWD_ACEPT 0x08 +#define LTSSM_STATE_CFG_LANENUM_WAIT 0x09 +#define LTSSM_STATE_CFG_LANENUM_ACEPT 0x0A +#define LTSSM_STATE_CFG_COMPLETE 0x0B +#define LTSSM_STATE_CFG_IDLE 0x0C +#define LTSSM_STATE_RCVRY_LOCK 0x0D +#define LTSSM_STATE_RCVRY_SPEED 0x0E +#define LTSSM_STATE_RCVRY_RCVRCFG 0x0F +#define LTSSM_STATE_RCVRY_IDLE 0x10 +#define LTSSM_STATE_L0 0x11 +#define LTSSM_STATE_L0S 0x12 +#define LTSSM_STATE_L123_SEND_EIDLE 0x13 +#define LTSSM_STATE_L1_IDLE 0x14 +#define LTSSM_STATE_L2_IDLE 0x15 +#define LTSSM_STATE_L2_WAKE 0x16 +#define LTSSM_STATE_DISABLED_ENTRY 0x17 +#define LTSSM_STATE_DISABLED_IDLE 0x18 +#define LTSSM_STATE_DISABLED 0x19 +#define LTSSM_STATE_LPBK_ENTRY 0x1A +#define LTSSM_STATE_LPBK_ACTIVE 0x1B +#define LTSSM_STATE_LPBK_EXIT 0x1C +#define LTSSM_STATE_LPBK_EXIT_TIMEOUT 0x1D +#define LTSSM_STATE_HOT_RESET_ENTRY 0x1E +#define LTSSM_STATE_HOT_RESET 0x1F +#define LTSSM_STATE_MASK 0x3F + struct pcie_port { struct device *dev; u8 root_bus_nr; diff --git a/drivers/pci/host/pcie-spear13xx.c b/drivers/pci/host/pcie-spear13xx.c index 98d2683..920d399 100644 --- a/drivers/pci/host/pcie-spear13xx.c +++ b/drivers/pci/host/pcie-spear13xx.c @@ -84,39 +84,6 @@ struct pcie_app_reg { #define APPS_PM_XMT_PME_ID 5 /* CR3 ID */ -#define XMLH_LTSSM_STATE_DETECT_QUIET 0x00 -#define XMLH_LTSSM_STATE_DETECT_ACT 0x01 -#define XMLH_LTSSM_STATE_POLL_ACTIVE 0x02 -#define XMLH_LTSSM_STATE_POLL_COMPLIANCE 0x03 -#define XMLH_LTSSM_STATE_POLL_CONFIG 0x04 -#define XMLH_LTSSM_STATE_PRE_DETECT_QUIET 0x05 -#define XMLH_LTSSM_STATE_DETECT_WAIT 0x06 -#define XMLH_LTSSM_STATE_CFG_LINKWD_START 0x07 -#define XMLH_LTSSM_STATE_CFG_LINKWD_ACEPT 0x08 -#define XMLH_LTSSM_STATE_CFG_LANENUM_WAIT 0x09 -#define XMLH_LTSSM_STATE_CFG_LANENUM_ACEPT 0x0A -#define XMLH_LTSSM_STATE_CFG_COMPLETE 0x0B -#define XMLH_LTSSM_STATE_CFG_IDLE 0x0C -#define XMLH_LTSSM_STATE_RCVRY_LOCK 0x0D -#define XMLH_LTSSM_STATE_RCVRY_SPEED 0x0E -#define XMLH_LTSSM_STATE_RCVRY_RCVRCFG 0x0F -#define XMLH_LTSSM_STATE_RCVRY_IDLE 0x10 -#define XMLH_LTSSM_STATE_L0 0x11 -#define XMLH_LTSSM_STATE_L0S 0x12 -#define XMLH_LTSSM_STATE_L123_SEND_EIDLE 0x13 -#define XMLH_LTSSM_STATE_L1_IDLE 0x14 -#define XMLH_LTSSM_STATE_L2_IDLE 0x15 -#define XMLH_LTSSM_STATE_L2_WAKE 0x16 -#define XMLH_LTSSM_STATE_DISABLED_ENTRY 0x17 -#define XMLH_LTSSM_STATE_DISABLED_IDLE 0x18 -#define XMLH_LTSSM_STATE_DISABLED 0x19 -#define XMLH_LTSSM_STATE_LPBK_ENTRY 0x1A -#define XMLH_LTSSM_STATE_LPBK_ACTIVE 0x1B -#define XMLH_LTSSM_STATE_LPBK_EXIT 0x1C -#define XMLH_LTSSM_STATE_LPBK_EXIT_TIMEOUT 0x1D -#define XMLH_LTSSM_STATE_HOT_RESET_ENTRY 0x1E -#define XMLH_LTSSM_STATE_HOT_RESET 0x1F -#define XMLH_LTSSM_STATE_MASK 0x3F #define XMLH_LINK_UP (1 << 6) /* CR4 ID */