From patchwork Fri Sep 11 12:08:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 7160371 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1C2299F314 for ; Fri, 11 Sep 2015 12:09:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3A7262085F for ; Fri, 11 Sep 2015 12:09:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A2B0207E9 for ; Fri, 11 Sep 2015 12:09:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752930AbbIKMJK (ORCPT ); Fri, 11 Sep 2015 08:09:10 -0400 Received: from mail-yk0-f169.google.com ([209.85.160.169]:35725 "EHLO mail-yk0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752835AbbIKMJJ (ORCPT ); Fri, 11 Sep 2015 08:09:09 -0400 Received: by ykdu9 with SMTP id u9so89216296ykd.2 for ; Fri, 11 Sep 2015 05:09:09 -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:in-reply-to:references; bh=W9RBy0lNmUadTMueOmvurIyP6j0MmG9Q05mC0GIn6Nw=; b=UW+5g+swTx5knLeSrk/LwPjKCp2wFfjCy7/UpGky41ZNdU6dZS8Nvs6FfwkylT7LhW lCV/lqXrsckgvpUCbTRTe5tuvpXtbeO4t4QAAt7FPv0tD5BYFLHWb2feMdjz3TxOfMF9 iclVpRC4y3O0Px0zsIn0K2Coj4/nuPqY9eCFN/+gUuZC8+u69kliWE3GnEhwoDVaonI+ A3fsRK+DeFhODTrkg7HgELHtjViGMdPooVNUxnPOzVIzCirmMeLpnKYTSKb9BFPA3xlc 5mbful41spTTOiyPgMvSW/vqoh4GZbfLniD38dRCTCc/Q0fNaVs2INxLZYWEzy7l0Qa9 aCpw== X-Received: by 10.129.88.68 with SMTP id m65mr54809674ywb.22.1441973349393; Fri, 11 Sep 2015 05:09:09 -0700 (PDT) Received: from localhost.localdomain ([179.159.191.85]) by smtp.gmail.com with ESMTPSA id d204sm12818ywe.56.2015.09.11.05.09.07 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Sep 2015 05:09:08 -0700 (PDT) From: Fabio Estevam To: bhelgaas@google.com Cc: l.stach@pengutronix.de, linux-pci@vger.kernel.org, Fabio Estevam Subject: [PATCH v2 2/2] PCI: imx6: Add some defines for improving code readability Date: Fri, 11 Sep 2015 09:08:53 -0300 Message-Id: <1441973333-3346-2-git-send-email-festevam@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1441973333-3346-1-git-send-email-festevam@gmail.com> References: <1441973333-3346-1-git-send-email-festevam@gmail.com> 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 Instead of having some hardcoded values, it is preferred to use defines when possible. Signed-off-by: Fabio Estevam Reviewed-by: Lucas Stach --- Changes since v1: - Make clear that the defines represent bitfields (Lucas) drivers/pci/host/pci-imx6.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c index 2d0d0fe..6f43086 100644 --- a/drivers/pci/host/pci-imx6.c +++ b/drivers/pci/host/pci-imx6.c @@ -55,6 +55,7 @@ struct imx6_pcie { #define PCIE_PL_PFLR_LINK_STATE_MASK (0x3f << 16) #define PCIE_PL_PFLR_FORCE_LINK (1 << 15) #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) +#define PCIE_PHY_DEBUG_R0_LTSSM_MASK (0x3f << 0) #define PCIE_PHY_DEBUG_R1 (PL_OFFSET + 0x2c) #define PCIE_PHY_DEBUG_R1_XMLH_LINK_IN_TRAINING (1 << 29) #define PCIE_PHY_DEBUG_R1_XMLH_LINK_UP (1 << 4) @@ -74,6 +75,7 @@ struct imx6_pcie { /* PHY registers (not memory-mapped) */ #define PCIE_PHY_RX_ASIC_OUT 0x100D +#define PCIE_PHY_RX_ASIC_OUT_VALID (1 << 0) #define PHY_RX_OVRD_IN_LO 0x1005 #define PHY_RX_OVRD_IN_LO_RX_DATA_EN (1 << 5) @@ -503,10 +505,10 @@ static int imx6_pcie_link_up(struct pcie_port *pp) pcie_phy_read(pp->dbi_base, PCIE_PHY_RX_ASIC_OUT, &rx_valid); debug_r0 = readl(pp->dbi_base + PCIE_PHY_DEBUG_R0); - if (rx_valid & 0x01) + if (rx_valid & PCIE_PHY_RX_ASIC_OUT_VALID) return 0; - if ((debug_r0 & 0x3f) != 0x0d) + if ((debug_r0 & PCIE_PHY_DEBUG_R0_LTSSM_MASK) != 0x0d) return 0; dev_err(pp->dev, "transition to gen2 is stuck, reset PHY!\n");