Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10091134pxu; Tue, 29 Dec 2020 13:34:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJyZee/4LeAPyG805BmIAddX9hDzSO0kPQo8L6hjCarAOqRxa+LajQWoV8H+RzK/isBHWWzb X-Received: by 2002:aa7:c355:: with SMTP id j21mr46477720edr.338.1609277685983; Tue, 29 Dec 2020 13:34:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609277685; cv=none; d=google.com; s=arc-20160816; b=wqMqf5xa7BXEgH1Pzww7UlCzKeKw0O3grMKQxEG7szlkRwxNqlU9JzpzhLXjhOMmOX +ffNKl7NLtj0arPliMmSxokYk1WBGXdoml9WoL1PROv+og2uzPPGbz4som3MISetoFtN BR0UJQEXkZamWbUaXT/d/NW6CxtDuP5Z1MeyApkEsjYHP3JhjvEp4lGi1pDq2rfdC3nj zEhTZdKn1YNfUJYvj36JvjZ/mclXUf37hmhqEedDm880LJbRBbmIXH0Lua62F/5oV/Fl KmMzqi5pa6iliBjme+ecBp8wUKvjHnoLocT3gLB1E5gq7Ty+dg7p+9bCwzroenq+b3hg C3fg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=nlJQIXqwcj1D2dFMU3Z5VOij1CnhXxqNLzRBECRVK1Y=; b=qyIEGJUVFtmtJYXzHQjoSa66yoO+axDSbzQyNpbcpNfqthVuf6knkZqtvJZTS7Z+1O YVfZwooDBn4YVyLMVvWm5ECok1cGDj2prymMeF9YFfQuWVT8R//7tocGChXSH+ONQik2 fg6TMzsZvsa+1Rk7OsxL/mnLD64h/A+9EZeRO/zHGwu0g2gcQP1BGP1vqleGC8ZzGQwW 2UCIgtUEbyZmv1zjSvP85C3xZHGwJF5kMIySzKiSKxvMM4hd3Z4YIukxmeSUN0C7MWPx llFy0zk0dhyUMDj6ftoQIKRE84VLptdrdRsaX7YI+5hVBKZtaw/xCdG9T+JSi8CtTau8 Xjgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gn22si19759975ejc.749.2020.12.29.13.34.22; Tue, 29 Dec 2020 13:34:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726190AbgL2Vcc (ORCPT + 99 others); Tue, 29 Dec 2020 16:32:32 -0500 Received: from relay1-d.mail.gandi.net ([217.70.183.193]:52571 "EHLO relay1-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726126AbgL2Vcc (ORCPT ); Tue, 29 Dec 2020 16:32:32 -0500 X-Originating-IP: 91.174.235.35 Received: from windsurf (unknown [91.174.235.35]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay1-d.mail.gandi.net (Postfix) with ESMTPSA id C8144240005; Tue, 29 Dec 2020 21:31:47 +0000 (UTC) Date: Tue, 29 Dec 2020 22:31:46 +0100 From: Thomas Petazzoni To: Nadeem Athani Cc: , , , , , , , , , mparab@cadence.com, pthombar@cadence.com, sjakhade@cadence.com Subject: Re: [PATCH v6 2/2] PCI: cadence: Retrain Link to work around Gen2 training defect. Message-ID: <20201229223146.3081aa50@windsurf> In-Reply-To: <20201228140510.14641-3-nadeem@cadence.com> References: <20201228140510.14641-1-nadeem@cadence.com> <20201228140510.14641-3-nadeem@cadence.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 28 Dec 2020 15:05:10 +0100 Nadeem Athani wrote: > +static void cdns_pcie_retrain(struct cdns_pcie *pcie) Shouldn't this propagate a return value ? > +{ > + u32 lnk_cap_sls, pcie_cap_off = CDNS_PCIE_RP_CAP_OFFSET; > + u16 lnk_stat, lnk_ctl; > + > + /* > + * Set retrain bit if current speed is 2.5 GB/s, > + * but the PCIe root port support is > 2.5 GB/s. > + */ > + > + lnk_cap_sls = cdns_pcie_readl(pcie, (CDNS_PCIE_RP_BASE + pcie_cap_off + > + PCI_EXP_LNKCAP)); > + if ((lnk_cap_sls & PCI_EXP_LNKCAP_SLS) <= PCI_EXP_LNKCAP_SLS_2_5GB) > + return; > + > + lnk_stat = cdns_pcie_rp_readw(pcie, pcie_cap_off + PCI_EXP_LNKSTA); > + if ((lnk_stat & PCI_EXP_LNKSTA_CLS) == PCI_EXP_LNKSTA_CLS_2_5GB) { > + lnk_ctl = cdns_pcie_rp_readw(pcie, > + pcie_cap_off + PCI_EXP_LNKCTL); > + lnk_ctl |= PCI_EXP_LNKCTL_RL; > + cdns_pcie_rp_writew(pcie, pcie_cap_off + PCI_EXP_LNKCTL, > + lnk_ctl); > + > + if (cdns_pcie_host_wait_for_link(pcie)) > + return; Here, shouldn't you return the status of cdns_pcie_host_wait_for_link(), to propagate whether the PCIe link indeed came up after the retrain ? Thomas -- Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com