Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2025258imu; Fri, 14 Dec 2018 04:42:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/VaKaV3MN5mhlzp0HcuDApbF67CFW5k521uf8Ro/cR6FScMPKAc6dDNuuM7yHMj4duyef3W X-Received: by 2002:a63:8f45:: with SMTP id r5mr2579356pgn.222.1544791330881; Fri, 14 Dec 2018 04:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544791330; cv=none; d=google.com; s=arc-20160816; b=YBygObxs/KBZAvqMNAqpmcjNHqIXQMqItOX7DrrbiSl1PPGRTw5hst+T7eg2WCMVjA 2sEs0/0x++CtzhHPJQdnWvgYhs+ByLbr3ro1B1PqFC+sweqajYMrLz3ys+IpFl0qtCYy qtrvSVM3k6d5ZyONWRzfBteQiuFXwyDUZnAcT00p5V2M64G6wATPdw2aMT2sraXY268M AgyD7DS9rQ9llWLAhya1LxaCIL2kWqNeunF24dUEEd2lTb7/CuorA9iWVqboeTqJkJGp cHaTCMqdhhcmQ+Fkn4GZt89JkyZeeCYtiHuXJM3O+FQEhAMpwYG2Vnhj6Bk/2fofZCg/ hYtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yQ5NY4zNR3iag4L44GzQ72MXjmnRPKG6RiL/kHrGRwE=; b=bSYBsp2IrZ8+K+WKR6+yoctGZDCtHfHDzWCX64FkfWr8JN5X0cDDs+mbOzcGWa6mph k8vYIsVaU7jJ6vavjLehFgiGpYkpx4FDZv8vaNVnIB6G37mt4g6mcwmAGRDYN9cDlXdp 5i3/8cShYxqAmBzklgmVPsTm6V0BTrNb3zhkDn1ITmCy6dKhUE2QPmkkv4xGbcoTQGKA ae/az4ak8RbuSgSifO3NzCNf6neqX45ymSuwbn1h7WxoEn7CcymY3UUvKl2WZ19KnAb9 YPxSmGiBjm3DyoF6NiS+9qvY8OVCsn1iw6POKDvh1XqCE3lhEeFYy8ixLL1f7dHzgunI fnWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=AmyPjEEM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si3956630pfo.189.2018.12.14.04.41.56; Fri, 14 Dec 2018 04:42:10 -0800 (PST) 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=@kernel.org header.s=default header.b=AmyPjEEM; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730678AbeLNMlE (ORCPT + 99 others); Fri, 14 Dec 2018 07:41:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:47748 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730355AbeLNMDn (ORCPT ); Fri, 14 Dec 2018 07:03:43 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E45C2146F; Fri, 14 Dec 2018 12:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1544789022; bh=d0x+1oHL8jhwiHI9V4R+hCRqT1XnxUrq9weang+X6UQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AmyPjEEMFmZroJDSTw6WYvpEdKDyuZQLBy1EEH/FKWqqVlz0HPtkla6Em6wHm0ke2 3LT9TnLDtHgzbDFl/Bl3iq6hm428sEtkm+aDk/03WNoCjv0fHPGlAW2dZkEgByJo+f Ya6zSjkCgkks6iOzVSndjCdPD7wsK5CEK3QwfswM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trent Piepho , Lorenzo Pieralisi , Lucas Stach , Bjorn Helgaas , Joao Pinto , Richard Zhu , Sasha Levin Subject: [PATCH 4.19 063/142] PCI: imx6: Fix link training status detection in link up check Date: Fri, 14 Dec 2018 12:59:08 +0100 Message-Id: <20181214115749.575494452@linuxfoundation.org> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20181214115747.053633987@linuxfoundation.org> References: <20181214115747.053633987@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 68bc10bf992180f269816ff3d22eb30383138577 ] This bug was introduced in the interaction for two commits on either branch of the merge commit 562df5c8521e ("Merge branch 'pci/host-designware' into next"). Commit 4d107d3b5a68 ("PCI: imx6: Move link up check into imx6_pcie_wait_for_link()"), changed imx6_pcie_wait_for_link() to poll the link status register directly, checking for link up and not training, and made imx6_pcie_link_up() only check the link up bit (once, not a polling loop). While commit 886bc5ceb5cc ("PCI: designware: Add generic dw_pcie_wait_for_link()"), replaced the loop in imx6_pcie_wait_for_link() with a call to a new dwc core function, which polled imx6_pcie_link_up(), which still checked both link up and not training in a loop. When these two commits were merged, the version of imx6_pcie_wait_for_link() from 886bc5ceb5cc was kept, which eliminated the link training check placed there by 4d107d3b5a68. However, the version of imx6_pcie_link_up() from 4d107d3b5a68 was kept, which eliminated the link training check that had been there and was moved to imx6_pcie_wait_for_link(). The result was the link training check got lost for the imx6 driver. Eliminate imx6_pcie_link_up() so that the default handler, dw_pcie_link_up(), is used instead. The default handler has the correct code, which checks for link up and also that it still is not training, fixing the regression. Fixes: 562df5c8521e ("Merge branch 'pci/host-designware' into next") Signed-off-by: Trent Piepho [lorenzo.pieralisi@arm.com: rewrote the commit log] Signed-off-by: Lorenzo Pieralisi Reviewed-by: Lucas Stach Cc: Bjorn Helgaas Cc: Joao Pinto Cc: Lorenzo Pieralisi Cc: Richard Zhu Signed-off-by: Sasha Levin --- drivers/pci/controller/dwc/pci-imx6.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c index 4a9a673b4777..975050a69494 100644 --- a/drivers/pci/controller/dwc/pci-imx6.c +++ b/drivers/pci/controller/dwc/pci-imx6.c @@ -80,8 +80,6 @@ struct imx6_pcie { #define PCIE_PL_PFLR_FORCE_LINK (1 << 15) #define PCIE_PHY_DEBUG_R0 (PL_OFFSET + 0x28) #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) #define PCIE_PHY_CTRL (PL_OFFSET + 0x114) #define PCIE_PHY_CTRL_DATA_LOC 0 @@ -641,12 +639,6 @@ static int imx6_pcie_host_init(struct pcie_port *pp) return 0; } -static int imx6_pcie_link_up(struct dw_pcie *pci) -{ - return dw_pcie_readl_dbi(pci, PCIE_PHY_DEBUG_R1) & - PCIE_PHY_DEBUG_R1_XMLH_LINK_UP; -} - static const struct dw_pcie_host_ops imx6_pcie_host_ops = { .host_init = imx6_pcie_host_init, }; @@ -679,7 +671,7 @@ static int imx6_add_pcie_port(struct imx6_pcie *imx6_pcie, } static const struct dw_pcie_ops dw_pcie_ops = { - .link_up = imx6_pcie_link_up, + /* No special ops needed, but pcie-designware still expects this struct */ }; static int imx6_pcie_probe(struct platform_device *pdev) -- 2.19.1