Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1517685rwb; Thu, 8 Dec 2022 11:39:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf7PkId6XFOOGQUmc3KpCs9oXlrd4qfQybV8zA0xcO9wMI5eLjIM7CexOrggsY+kF5MesoZe X-Received: by 2002:a17:906:2619:b0:7c1:1cb:8c54 with SMTP id h25-20020a170906261900b007c101cb8c54mr11113793ejc.300.1670528383268; Thu, 08 Dec 2022 11:39:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670528383; cv=none; d=google.com; s=arc-20160816; b=O0hEhUdB3woPcGI4Q0+V7zAkWhScZfQ94ssF5GnL6vItxpvMDroJHFzK43OoyePe96 7huP+XDfPz30X4t5JULcGzSh72vpbJKiDNLmHW8smSUKRw0SFPQTihCmvqqgHRJ+76zA n+v+lPG1JHkFpQsBPAWPUGK6p/3vf1q0VWE794/bKvXIhnn58nPan99dvon99K+HMO+g Oz6thPLrdMVV/nh7cu64ES668a4vnmYW+x/lbYGNqMz4mcvVULqEKNzsnXDDwsokiFUM Fm3l3AJdm21rfhQyejpA/72g9G6e0ASNkDSMAN102szLMtvFikN2YnvzoCAIY50NnnOb FyfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=M5qgR9z9/aXhE8FCQ+Y9Qm2E2s4Im7J0TM9pUn+fh4w=; b=fwJ7JqyU8keRee/zBgWRifiRkNoeV588czp2k/W0Nvh5axjPRzLERUO1nf3mD4kpHu n1La226060KB4AZN/50sewOafJcIAoujVYmWQ+XDVKjLe2sHoIfGINVDm+T+AOrhb/rH 8QJV/bAP3PjrijZKsX/Y6XsdD0UsGs3Aj0D5LBDRGUmJwC0KeQJGOtdA0GGoCgNDzu6O uTAFlEUYOFnszPS4OANo6NgjUemWZ4D8nlS1lyEh8wreY670SoZ5kJLfdOG2LFoiM+Ly 8zoCreGtnv7/X+GJ6C31nWJaqi5tvnm3TU+aogTAQJsXQkYA+j70fOcXIaNusbuIZMAh SNxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=vjcmJ050; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mp8-20020a1709071b0800b007c0bc7057d7si15713525ejc.202.2022.12.08.11.39.21; Thu, 08 Dec 2022 11:39:43 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=vjcmJ050; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229892AbiLHTKo (ORCPT + 72 others); Thu, 8 Dec 2022 14:10:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230028AbiLHTKl (ORCPT ); Thu, 8 Dec 2022 14:10:41 -0500 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 082CF862CD for ; Thu, 8 Dec 2022 11:10:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References: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:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=M5qgR9z9/aXhE8FCQ+Y9Qm2E2s4Im7J0TM9pUn+fh4w=; b=vjcmJ050Ll5ZcSccJLh3sQNpBu kujr75KWtMx7xLA1Ruef/jXzEoR3apHSfRRzK+q64Ou3LbibVCXuppmZ/3jQXSy8xF+BbFCBOWPR1 TZM0S8nZ/ZeroPDe0tpa0mUL6XFubqqSMcgem5lwBaslBqtXOqWS2JRhMX9jLsmCk65gswAjM0+d9 E7EqojeUqFhgtFFEH+5Y3cZIFOnd9Yl7RpkHJ3rtKSxNjdV6K4p+8m5hCyADq8BJj86L57Sb3lN4u hoj0f+rxEljSm2ZW54zzQbaATJJoVsioFTbkAPPT3SxB3B0/GbUvBZYku3PysCxIRk+cWaS+5yl6f Vtm4ipzg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:35634) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1p3MHu-00028F-6h; Thu, 08 Dec 2022 19:10:31 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1p3MHp-0001v9-Ni; Thu, 08 Dec 2022 19:10:25 +0000 Date: Thu, 8 Dec 2022 19:10:25 +0000 From: "Russell King (Oracle)" To: Robert Jarzmik Cc: Jonathan =?iso-8859-1?Q?Neusch=E4fer?= , Andrew Lunn , linux-arm-kernel@lists.infradead.org, Haojian Zhuang , Daniel Mack , linux-kernel@vger.kernel.org Subject: Re: PXA25x: GPIO driver fails probe due to resource conflict with pinctrl driver Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE 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 Thu, Dec 08, 2022 at 07:46:26PM +0100, Robert Jarzmik wrote: > > Jonathan Neusch?fer writes: > > > Without further code changes this wouldn't be sufficient, because the > > pinctrl driver also touches the GPIO direction registers at offset > > 0x0c-0x14. > > Historically, this problem was adressed by a "hack" if I remember correctly, > as the > registers do overlap (on pxa27x at least, but I think on pxa25x as well) : > - GAFR (alternate functions) and GPDR (input or output) are "pinctrl" > - GPSR, GPCR, GPLR are "gpio" registers > - the memory map (physical) at 0x40e0 0000 is as Jonathan wrote : > - 3 u32 GPLR (gpio) > - 3 u32 GPDR (pinctrl) > - 3 u32 GPSR (gpio) > - 3 u32 GPCR (gpio) > > The "hack" was that one driver was mapping the area _without_ claiming it > (this > is part from memory, I didn't check in the code today). The gpio was > probably > the claiming one, while the pinctrl was the "only using one". > > As of today, I should have a look what was changed, but I'm pretty sure in > all > pxa2xx architecture there is an overlap, as for these ancient platforms the > pinctrl wasn't yet separated from the gpio IC. > > The only was out so far I can see from my head would be to declare multiple > very small IO ranges : > - pinctrl pxa25x : 0x40e0 000c (12 bytes), 0x40e0 0054 (32 bytes) > - pinctrl pxa25x : 0x40e0 000c (12 bytes), 0x40e0 0054 (32 bytes), 0x40e0 > 010c (4 bytes) > - gpio : from 0x40e0 0000 to 0x40e0 0070 included, without the pinctrl ones > > As a general guide, in gpio-pxa.c, you have the table in [1]. Think GPDR and > GAFR as > pinctrl, and all the other ones as gpio. Ah and yes, the GAFR ones are > missing in this > table. > > One last think : in a pre device-tree world, when we didn't had yet the pxa > pinctrl > driver, the gpio driver was directly playing with the GPDR registers, fun > old times. From a quick look, I think this commit is to blame: 542c25b7a209 drivers: gpio: pxa: use devm_platform_ioremap_resource() Someone "helpfully" making this change: - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!res) - return -EINVAL; - gpio_reg_base = devm_ioremap(&pdev->dev, res->start, - resource_size(res)); + + gpio_reg_base = devm_platform_ioremap_resource(pdev, 0); which introduces request_mem_region() to the PXA GPIO driver, resulting in this resource clash. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!