From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D1456D64064 for ; Fri, 8 Nov 2024 16:36:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=5y71AULIWipzOUve2Y05XFsuP7Ru4OVeHPR1RL+xc70=; b=msA6nM6boAyEDkUE27JR58bS2v J3AzRPWmeacA7XQGxgj3t/eKe+bY37Tr+WlPuoQnxX4nQtKaI1rAJStPqbhGWzRm2ZLd6yik8uQ9o J+gOiQkfa/V7v9lyBtLt5dvcumbqoKFQZGyP7LCgUijOsJcF+5Xbl4Yrh8RAj9pqYHyD5PkuijqZS OZ2l0ISLSJ/SrDuv0CyZzwXrH1UEz8uwpAwLvcZ9DXkb4xa/1CDGrN3NZhk6wo9iFQGBqtZtEzdbL bYQPfUDxhR7fXvAgXaulVX0LM+lP7ZpBuF7tDskwQ76R89ZYPs3wAt20QpuV0hcj89Xp2F3b0dIt/ MB0D7A/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1t9Ryb-0000000BG2B-42I1; Fri, 08 Nov 2024 16:36:49 +0000 Received: from nyc.source.kernel.org ([147.75.193.91]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1t9RvZ-0000000BEcE-0jiI; Fri, 08 Nov 2024 16:33:46 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 2C61FA43F7B; Fri, 8 Nov 2024 16:31:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87664C4CED3; Fri, 8 Nov 2024 16:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1731083619; bh=Xy9SXkJxDKG4wi0f9Sva0OdceC+je7kXOaR1Fvhuk4Q=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=lv9ltHn0wFgSpHXb8kslpVm8PArdkSIuQuJE5snpS1yI2IVOWksdVjn8nUo7aykjq VF3j8ToVG0p5CUcoMmdui72l9m+UABLLU+2fviSDfOQwzw5La16QIau1UGD1TpY+4m Wpgfwsi2SUAzEOunb8IhHZWjJIgl9vK6FWbxUZVcMGXhWZOD2FFiNqROABA2M8BsdU J/bByy2pPBtM+wRvtPfQkEjUNJ9VdOlrD/PdgKJiBhCPEc1AJnHa9yeTVQbni7lfhR BWx5efRqQx6QPf/CAKmr07g17TCcFAyzUDRXIa7NPlqjO3g5NUbd9/6zcb01tNejWM nV2w2n4JvRklQ== Date: Fri, 8 Nov 2024 10:33:38 -0600 From: Bjorn Helgaas To: Hui Ma =?utf-8?B?KOmprOaFpyk=?= Cc: Lorenzo Bianconi , "linux-pci@vger.kernel.org" , Ryder Lee , Jianjun Wang =?utf-8?B?KOeOi+W7uuWGmyk=?= , "lpieralisi@kernel.org" , "kw@linux.com" , "robh@kernel.org" , "bhelgaas@google.com" , "linux-mediatek@lists.infradead.org" , "lorenzo.bianconi83@gmail.com" , "linux-arm-kernel@lists.infradead.org" , "krzysztof.kozlowski+dt@linaro.org" , "devicetree@vger.kernel.org" , "nbd@nbd.name" , "dd@embedd.com" , upstream , AngeloGioacchino Del Regno Subject: Re: =?utf-8?B?5Zue5aSNOiBbUEFUQw==?= =?utf-8?Q?H?= v4 4/4] PCI: mediatek-gen3: Add Airoha EN7581 support Message-ID: <20241108163338.GA1663274@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241108_083341_902197_B9FEBE79 X-CRM114-Status: GOOD ( 46.57 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Nov 08, 2024 at 01:23:35AM +0000, Hui Ma (马慧) wrote: > > On Thu, Nov 07, 2024 at 05:21:45PM +0100, Lorenzo Bianconi wrote: > > > On Nov 07, Bjorn Helgaas wrote: > > > > On Thu, Nov 07, 2024 at 08:39:43AM +0100, Lorenzo Bianconi wrote: > > > > > > On Wed, Nov 06, 2024 at 11:40:28PM +0100, Lorenzo Bianconi wrote: > > > > > > > > On Wed, Jul 03, 2024 at 06:12:44PM +0200, Lorenzo Bianconi wrote: > > > > > > > > > Introduce support for Airoha EN7581 PCIe controller to > > > > > > > > > mediatek-gen3 PCIe controller driver. > > > > > > > > > ... > > > > > > > > > > > > Is this where PERST# is asserted? If so, a comment to > > > > > > > > that effect would be helpful. Where is PERST# deasserted? > > > > > > > > Where are the required delays before deassert done? > > > > > > > > > > > > > > I can add a comment in en7581_pci_enable() describing the > > > > > > > PERST issue for EN7581. Please note we have a 250ms delay in > > > > > > > en7581_pci_enable() after configuring REG_PCI_CONTROL register. > > > > > > > > > > > > > > https://github.com/torvalds/linux/blob/master/drivers/clk/cl > > > > > > > k-en7523.c#L396 > > > > > > > > > > > > Does that 250ms delay correspond to a PCIe mandatory delay, > > > > > > e.g., something like PCIE_T_PVPERL_MS? I think it would be > > > > > > nice to have the required PCI delays in this driver if > > > > > > possible so it's easy to verify that they are all covered. > > > > > > > > > > IIRC I just used the delay value used in the vendor sdk. I > > > > > do not have a strong opinion about it but I guess if we move > > > > > it in the pcie-mediatek-gen3 driver, we will need to add it > > > > > in each driver where this clock is used. What do you think? > > > > > > > > I don't know what the 250ms delay is for. If it is for a required > > > > PCI delay, we should use the relevant standard #define for it, and > > > > it should be in the PCI controller driver. Otherwise it's > > > > impossible to verify that all the drivers are doing the correct delays. > > > > > > ack, fine to me. Do you prefer to keep 250ms after > > > clk_bulk_prepare_enable() in mtk_pcie_en7581_power_up() or just use PCIE_T_PVPERL_MS (100)? > > > I can check if 100ms works properly. > > > > It's not clear to me where the relevant events are for these chips. > > > > Do you have access to the PCIe CEM spec? The diagram in r6.0, sec > > 2.2.1, is helpful. It shows the required timings for Power Stable, > > REFCLK Stable, PERST# deassert, etc. > > > > Per sec 2.11.2, PERST# must be asserted for at least 100us (T_PERST), > > PERST# must be asserted for at least 100ms after Power Stable > > (T_PVPERL), and PERST# must be asserted for at least 100us after > > REFCLK Stable. > > > > It would be helpful if we could tell by reading the source where some > > of these critical events happen, and that the relevant delays are > > there. For example, if PERST# is asserted/deasserted by > > "clk_enable()" or similar, it's not at all obvious from the code, so > > we should have a comment to that effect. > > >I reviewed the vendor sdk and it just do something like in clk_enable(): > > > > ... > > val = readl(0x88); > > writel(val | BIT(16) | BIT(29) | BIT(26), 0x88); > > /*wait link up*/ > > mdelay(1000); > > ... > > > >@Hui.Ma: is it fine use msleep(100) (so PCIE_T_PVPERL_MS) instead > >of msleep(1000) (so PCIE_LINK_RETRAIN_TIMEOUT_MS)? > > I think msleep(1000) will be safer, because some device won't > link up with msleep(100). Do you have details about this? I guess it only hurts mediatek, but increasing the minimum time to bring up a PCI hierarchy by almost an entire second is a pretty big deal. If this delay corresponds to the required T_PVPERL delay and 100ms isn't enough for some endpoints, those endpoints should fail with many host controllers, not just mediatek, so I would suspect the mediatek controller or a certain platform, not the endpoint itself. If this corresponds to T_PVPERL and mediatek needs longer, I would document that by using "PCIE_T_PVPERL_MS * 10" and adding a comment about why (affected platform/device, hardware erratum, etc). Bottom line, I don't really care what the value is, but I *would* like to be able to read pcie-mediatek-gen3.c and see the point where PCI power is stable, a delay of at least T_PVPERL, and where PERST# is deasserted because that's the main timing requirement on software. Bjorn