Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2399775pxm; Fri, 25 Feb 2022 00:54:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRwyiOqnEBwsMQra9aMkdaLrqnDgDSRBEhkcAp1Pq8RGqGETbcuI6gbJKEcr9e0+0Qha+d X-Received: by 2002:a17:902:bd41:b0:14d:8ee9:32a5 with SMTP id b1-20020a170902bd4100b0014d8ee932a5mr6618449plx.132.1645779290686; Fri, 25 Feb 2022 00:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645779290; cv=none; d=google.com; s=arc-20160816; b=Sstq5vnc3CIoUcLF4wjCuiG8cqtqb/wYkHZxskJv1ATrNSdGKUIDir5jyz4NNMDTT2 uWm/mAtKNhZZ7Oa2k33Gz5yFDGRmY5aeScU1P1aV6LgqSHdJH0IhIXvQrOot9EYzhMZ8 /UAfjTxjtoa57CQOgjo8lWfcc9icxqQv8PAsCwDildnECkSNxEc3LG6fdOIgp/5efLCQ nVfYv1nHeCIg0y41aa6WdV5yfmiChw2Bl8K/N1kSnJrFfJyWPvMpTzZuMvBdzmszL5SK cdAPlLim3OjuzBbePu0PILJYd6PheIs4AG5dowmDpcOi7eteEK1RVL6kMN3ZXJG1UQmk JpAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=QyAIa5ACtc+kc/7wITA5ayrvz+Ae8kj7lrj91vHDmMU=; b=soQpJprRrC49CtbAE1WKkjoIC8nzLDclW+gzSHTBxjw/F4co+7UHuIa6sCvNxm94E6 2Hc8s4GZay4Y9nwC1QuT1mE18W3Y/XcXkCfzsR7jeZkDu2cMX2Eep5nxGvSxtssbry/2 Me7DV5GCBku+FJ7y/FwKHQ15MNlCoK1dknLJzpPJqEvzGztl7dooR7hY8S11n+86W9VR oTC/ADhPFlUV7w8vXrJBfkMXsxQ0G/qB+rjt7zMZ5N9XAbMITPRoRIjcZwsbkIOtD7qe /vmR3rjXlXAJxzw53ZOY7m1qK4kD64MFE9/YzX5vyEIonpS3GVaFYPutMA/Y+mYibh2K ss9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=egZaxVPg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 19-20020a17090a1a5300b001b9575eb172si1435340pjl.86.2022.02.25.00.54.36; Fri, 25 Feb 2022 00:54:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=egZaxVPg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232752AbiBYAIe (ORCPT + 99 others); Thu, 24 Feb 2022 19:08:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbiBYAIe (ORCPT ); Thu, 24 Feb 2022 19:08:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AF2512B765; Thu, 24 Feb 2022 16:08:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1136861CDA; Fri, 25 Feb 2022 00:08:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31DB4C340EF; Fri, 25 Feb 2022 00:08:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645747682; bh=YHKuaw/M4cyd4TxRY4j95nETLKiuypiRsUpqY9ivG3I=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=egZaxVPgwqFESEvkAeyzXsdfr+7xqa2eZET0pEnR0MXyaInHyw4HfGBJUV6gTzmRo kR2UNxxDPkEc77FvYLd77Yk6AzCARd979GaSPQzlekKRYBi84SFzozsDQXuV0j+s+S lpYH3GLt74DBnTOnWgrKKueP2jc7ZIugWqADViVculXdgOtcgDkD8fgT9gVC6LAWQ8 3vSD9ky9dXUEtLALNhNfvxvtUnX5JMEidu7KSS3JY6ShObjxhbF3cM67DsQTMN+yyv SX+X0VYkFh8AbtEVV6UE50+V+OKq82/1pzhm5D1nO8d7v8Zc8PeRWV2PsgGURXRUdy hqZjYGWX8REng== Date: Thu, 24 Feb 2022 18:08:00 -0600 From: Bjorn Helgaas To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Lorenzo Pieralisi , Bjorn Helgaas , Rob Herring , Thomas Petazzoni , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Marek =?iso-8859-1?Q?Beh=FAn?= , Russell King , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v4 05/12] PCI: mvebu: Correctly configure x1/x4 mode Message-ID: <20220225000800.GA304526@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220222155030.988-6-pali@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 22, 2022 at 04:50:23PM +0100, Pali Roh?r wrote: > If x1/x4 mode is not set correctly then link with endpoint card is not > established. > > Use DTS property 'num-lanes' to deteriminate x1/x4 mode. I know this is already merged, but if tweaking for any other reason, s/deteriminate/determine/ > + * Set Maximum Link Width to X1 or X4 in Root Port's PCIe Link > + * Capability register. This register is defined by PCIe specification > + * as read-only but this mvebu controller has it as read-write and must > + * be set to number of SerDes PCIe lanes (1 or 4). If this register is > + * not set correctly then link with endpoint card is not established. True, everything in Link Capability is RO or HwInit, but that's for the architected access via config space. I think a device-specific mechanism like this is fair game as long as you do it before anybody can read it via config space. > + */ > + lnkcap = mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_LNKCAP); > + lnkcap &= ~PCI_EXP_LNKCAP_MLW; > + lnkcap |= (port->is_x4 ? 4 : 1) << 4; > + mvebu_writel(port, lnkcap, PCIE_CAP_PCIEXP + PCI_EXP_LNKCAP);