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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 218D6C433EF for ; Wed, 24 Nov 2021 09:03:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235121AbhKXJGX convert rfc822-to-8bit (ORCPT ); Wed, 24 Nov 2021 04:06:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:57638 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233817AbhKXJGK (ORCPT ); Wed, 24 Nov 2021 04:06:10 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (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 A545D60F50; Wed, 24 Nov 2021 09:03:00 +0000 (UTC) Received: from sofa.misterjones.org ([185.219.108.64] helo=why.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1mpoB8-007TDe-Bh; Wed, 24 Nov 2021 09:02:58 +0000 Date: Wed, 24 Nov 2021 09:02:57 +0000 Message-ID: <87fsrmc4e6.wl-maz@kernel.org> From: Marc Zyngier To: Luca Ceresoli Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Pali =?UTF-8?B?Um9ow6Fy?= , Alyssa Rosenzweig , Lorenzo Pieralisi , Bjorn Helgaas , Mark Kettenis , kernel-team@android.com Subject: Re: [PATCH v3 3/3] PCI: apple: Fix #PERST polarity In-Reply-To: <453389da-b041-94b3-009e-6c6323134936@lucaceresoli.net> References: <20211123180636.80558-1-maz@kernel.org> <20211123180636.80558-4-maz@kernel.org> <453389da-b041-94b3-009e-6c6323134936@lucaceresoli.net> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: luca@lucaceresoli.net, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, pali@kernel.org, alyssa@rosenzweig.io, lorenzo.pieralisi@arm.com, bhelgaas@google.com, mark.kettenis@xs4all.nl, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 Nov 2021 21:36:11 +0000, Luca Ceresoli wrote: > > Hi Mark, > > On 23/11/21 19:06, Marc Zyngier wrote: > > Now that #PERST is properly defined as active-low in the device tree, > > fix the driver to correctly drive the line indemendently of the > > implied polarity. > > > > Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up") > > Suggested-by: Pali Rohár > > Signed-off-by: Marc Zyngier > > Thanks for quickly addressing this! > > Do we need a transition path for backward compatibility with old DTs > already around? Something like this [0]. You said [1] the DT actually > used is not even the one in the kernel, thus how do we guarantee DT and > driver switch to the new polarity all at once? No. As it turns out, neither u-boot nor OpenBSD (the only two other payloads that can boot on M1) are upstreamed yet. So we're still in that stage where we don't need to maintain backward compatibility. If we don't get this patches merged by the end of this cycle, we will have to revisit this though. > > [0] https://lkml.org/lkml/2021/6/24/1049 > [1] https://lkml.org/lkml/2021/11/23/455 > > > --- > > drivers/pci/controller/pcie-apple.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c > > index 957960a733c4..03bc56f39be5 100644 > > --- a/drivers/pci/controller/pcie-apple.c > > +++ b/drivers/pci/controller/pcie-apple.c > > @@ -540,7 +540,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, > > rmw_set(PORT_APPCLK_EN, port->base + PORT_APPCLK); > > > > /* Engage #PERST before setting up the clock */ > > > > - gpiod_set_value(reset, 0); > > + gpiod_set_value(reset, 1); > > > > ret = apple_pcie_setup_refclk(pcie, port); > > if (ret < 0) > > @@ -551,7 +551,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie, > > > > /* Deassert #PERST */ > > rmw_set(PORT_PERST_OFF, port->base + PORT_PERST); > > - gpiod_set_value(reset, 1); > > + gpiod_set_value(reset, 0); > > Minor note: if it were me I would coalesce patches 1 and 3 together, > otherwise we are insisting on a wrong implementation (patch 1) to later > fix it all (this patch). The first patch is a clear bug fix that has a direct HW impact. The second patch is only sugar coating with zero material impact (absolutely nothing changes in the way the HW is driven). Squashing these two patches would be absolutely the wrong thing to do. M. -- Without deviation from the norm, progress is not possible.