Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4151548ybg; Tue, 29 Oct 2019 02:58:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyO9IiaNduRDHD9iknqoWuRH7GuKPLRRuowQPLbahybuZs69U1VnRYLoraQ5ZgMdMxg7/wM X-Received: by 2002:a05:6402:696:: with SMTP id f22mr13314104edy.104.1572343094705; Tue, 29 Oct 2019 02:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572343094; cv=none; d=google.com; s=arc-20160816; b=KP37lezwyfMvR6OxrXQB2pc+a6Df380qxBm2NIZA9PLFIJuPFJo9No2fNqOa7KeFM9 tl0V40S+tTxzyL090beuMChA/UjbIhKQt6sQBod9MXqAS0RXaVNRz5gdBVBbYBPg7OQt 93kl4XEbqocWQvIIOkfWu7s+G8+2HCGMOgkJ3VAHWlB3aYRsvqTbF8/ImCKq4CKMpG4H l8ab50VDtj2xPYVn+t9Y9FBH/HpIEC5gxIPl2FsWLK883wb//RTdvlIrNV8iPxPZUbGs MbGxj38SODS/SfEq0vaVFKCZlwmSlLFsTP4jQ47Egoq2xSZKad7/Oltuqm3aT4ZEettG /qGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ZJRFJy6oM32oUrkRM+Me8iTNIC7xDPAV/oTXyQKO0SE=; b=dsHF2ggMDOlfIMRRu/+u0madbSxeE3HQwDX3zeKc+hedTV1Zc2C2/YJhT58csAuKu5 9qC9RUnb4u1CUKuIPv2MiYfwUtHFPWV4OrD7bnVTrFRnSupUAXnd6QvkF0/qtQ1WwcY2 23H4Q59lyTr7Fp1wAxYlDC1ONqyg/MbSHjtM3qjqtnzXRyxHisWbomOMrhqtnQIIKltp FuLdHzIR78lRcd6RKPtVDzN1ad0xEB6yYYgPNe9fMPvVlmEmCjp+ZPFycEbB0jlFwd3e 0FuvrshCJ8orXGwehD8RHolAwxpVNbGjFofKRobjg64I95Bgs6ig1fUKfDMURDCv6nNM Jksw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qc16si7937293ejb.12.2019.10.29.02.57.50; Tue, 29 Oct 2019 02:58:14 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727182AbfJ2HqD (ORCPT + 99 others); Tue, 29 Oct 2019 03:46:03 -0400 Received: from mga14.intel.com ([192.55.52.115]:37689 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726222AbfJ2HqD (ORCPT ); Tue, 29 Oct 2019 03:46:03 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 Oct 2019 00:46:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,243,1569308400"; d="scan'208";a="198851286" Received: from linux.intel.com ([10.54.29.200]) by fmsmga007.fm.intel.com with ESMTP; 29 Oct 2019 00:46:02 -0700 Received: from [10.226.39.46] (ekotax-MOBL.gar.corp.intel.com [10.226.39.46]) by linux.intel.com (Postfix) with ESMTP id C0779580372; Tue, 29 Oct 2019 00:45:58 -0700 (PDT) Subject: Re: [PATCH v4 2/3] dwc: PCI: intel: PCIe RC controller driver To: Bjorn Helgaas Cc: jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, lorenzo.pieralisi@arm.com, andrew.murray@arm.com, robh@kernel.org, martin.blumenstingl@googlemail.com, linux-pci@vger.kernel.org, hch@infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, andriy.shevchenko@intel.com, cheol.yong.kim@intel.com, chuanhua.lei@linux.intel.com, qi-ming.wu@intel.com References: <20191022130905.GA133961@google.com> From: Dilip Kota Message-ID: Date: Tue, 29 Oct 2019 15:45:56 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191022130905.GA133961@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/22/2019 9:09 PM, Bjorn Helgaas wrote: > On Tue, Oct 22, 2019 at 05:07:47PM +0800, Dilip Kota wrote: >> On 10/22/2019 1:17 AM, Bjorn Helgaas wrote: >>> On Mon, Oct 21, 2019 at 02:39:19PM +0800, Dilip Kota wrote: >>>> Add support to PCIe RC controller on Intel Gateway SoCs. >>>> PCIe controller is based of Synopsys DesignWare pci core. >>>> >>>> Intel PCIe driver requires Upconfig support, fast training >>>> sequence configuration and link speed change. So adding the >>>> respective helper functions in the pcie DesignWare framework. >>>> It also programs hardware autonomous speed during speed >>>> configuration so defining it in pci_regs.h. >>>> >>>> +static void intel_pcie_link_setup(struct intel_pcie_port *lpp) >>>> +{ >>>> + u32 val; >>>> + >>>> + val = pcie_rc_cfg_rd(lpp, PCIE_CAP_OFST + PCI_EXP_LNKCAP); >>>> + lpp->max_speed = FIELD_GET(PCI_EXP_LNKCAP_SLS, val); >>>> + lpp->max_width = FIELD_GET(PCI_EXP_LNKCAP_MLW, val); >>>> + >>>> + val = pcie_rc_cfg_rd(lpp, PCIE_CAP_OFST + PCI_EXP_LNKCTL); >>>> + >>>> + val &= ~(PCI_EXP_LNKCTL_LD | PCI_EXP_LNKCTL_ASPMC); >>>> + val |= (PCI_EXP_LNKSTA_SLC << 16) | PCI_EXP_LNKCTL_CCC | >>>> + PCI_EXP_LNKCTL_RCB; >>> PCI_EXP_LNKCTL_CCC is RW. But doesn't it depend on the components on >>> both ends of the link? Do you know what device is at the other end? >>> I would have assumed that you'd have to start with CCC==0, which >>> should be most conservative, then set CCC=1 only if you know both ends >>> have a common clock. >> PCIe RC and endpoint device are having the common clock so set the CCC=1. > How do you know what the endpoint device is? Is this driver only for > a specific embedded configuration where the endpoint is always > soldered down? There's no possibility of this RC being used with a > connector? > > Shouldn't this be either discoverable or configurable via DT or > something? pcie_aspm_configure_common_clock() seems to do something > similar, but I can't really vouch for its correctness. (sorry for the late reply, i am back today from sick leave) I see pcie_aspm_configure_common_clock() is getting called during pcie root bus bridge scanning and programming the CCC. So, CCC configuration can be removed here in intel_pcie_link_setup(). Regards, Dilip > > Bjorn