Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2175953iof; Tue, 7 Jun 2022 22:14:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHbTb0Rulxotqir4wb1dvggEd7nqxjgUPmQOd7FnU4Y0IxAholjXRXIU6SXnseZn0dSAaN X-Received: by 2002:a17:90a:5d04:b0:1e0:83d7:413c with SMTP id s4-20020a17090a5d0400b001e083d7413cmr36266334pji.201.1654665260712; Tue, 07 Jun 2022 22:14:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654665260; cv=none; d=google.com; s=arc-20160816; b=QpqdJXmaNUGYdUkHaMhLIXUkK23ORYdpJMvizZ6Oua8XLNvzWR8krmm/n7NUthnr6H aznt97SEvbIdWp+QARRaGI+sF7zrf4b87PAi7ntDQyh6sPIBQbmuUPpEmO9JogUW8s1s 3rCVS4hBPnUkq5SHYUr+EY8HdX4JomEIlQsHlx+Vn3jWFZvFA/dzBdcwWBHI4ANZbOQQ wu+op2mivZut2CRdsZNV7Xfz7sr5KAF633fUCVmEiY77Np89I5+ne19L067nIE8SWC74 pxSFCx55czAuXuUAQgbXq8xZKT9l/qvhSnTQjFn0ZbBB3cK/TWpE8ZWUOB1EslxBx1f0 ptWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L9l9MBWKJ/4ycDdGz3EA8nt7ikfW26Pa4f8NEHDUGc8=; b=ujidDBnGBVIO4IGQb1xeVRMYLeYFVNLkfVgiZ3ittrvIlf6e+bY+WeENzrzNcL1CnY qwiE+RRQHAL/Rswh3jvKzfXj0YSClT24PRwI9ECc9OiG8+Z5A5MpIiKU6CPD9kFMZcD0 3O8bVYtcqpLtJHgPz7sCxjJcBnIo8Gq/E6dawrvXIK+v8D6BP7J/br9eXD1jQGiSvjui t5VCokIIIaDxcjS6ApZp8NSZG/6AqqQa4VEzn2Tg1Tt1lsPVJD2ByELmfEZqvSuy928f Yd1on8vs6z5LM/7y7Op8oRujPesKXozC8JKSfBEgSHT9bbFD0WYpyla2I7M4PU+PA2o8 l6Tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rNEPhAw2; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id kb12-20020a17090ae7cc00b001e893b0bd67si8369866pjb.182.2022.06.07.22.14.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:14:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rNEPhAw2; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0EA64447F03; Tue, 7 Jun 2022 21:44:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347701AbiFGR5L (ORCPT + 99 others); Tue, 7 Jun 2022 13:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347741AbiFGRfq (ORCPT ); Tue, 7 Jun 2022 13:35:46 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C940E1078A1; Tue, 7 Jun 2022 10:31:15 -0700 (PDT) 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 sin.source.kernel.org (Postfix) with ESMTPS id 1B132CE23CF; Tue, 7 Jun 2022 17:31:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00B67C385A5; Tue, 7 Jun 2022 17:31:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623066; bh=Ut+bZrRoeLbuyeDLyw/oRKMIW9n1SnNA9eXj6UzrNTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNEPhAw2UO9o8PVW/G4Wk2fwykygn3hmdUfWbQ/nFONRGG9CbEt8Jv03L6LN1VdOz QZ9OT9tXCJjf2YheHJJ8wUiKNuvBrwXZ9eh0khkRoR/wvK318XZ3uWT6tykQpvA8Rd Hlts6bcMrqoqsaL/NVYtkXkwUvBzkt5v8hj1zPFw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Wahren , Florian Fainelli , Linus Walleij , Sasha Levin Subject: [PATCH 5.10 282/452] pinctrl: bcm2835: implement hook for missing gpio-ranges Date: Tue, 7 Jun 2022 19:02:19 +0200 Message-Id: <20220607164916.953420462@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Stefan Wahren [ Upstream commit d2b67744fd99b06555b7e4d67302ede6c7c6a638 ] The commit c8013355ead6 ("ARM: dts: gpio-ranges property is now required") fixed the GPIO probing issues caused by "pinctrl: bcm2835: Change init order for gpio hogs". This changed only the kernel DTS files. Unfortunately it isn't guaranteed that these files are shipped to all users. So implement the necessary backward compatibility for BCM2835 and BCM2711 platform. Fixes: 266423e60ea1 ("pinctrl: bcm2835: Change init order for gpio hogs") Signed-off-by: Stefan Wahren Reviewed-by: Florian Fainelli Tested-by: Florian Fainelli Link: https://lore.kernel.org/r/20220409095129.45786-3-stefan.wahren@i2se.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/pinctrl/bcm/pinctrl-bcm2835.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/pinctrl/bcm/pinctrl-bcm2835.c b/drivers/pinctrl/bcm/pinctrl-bcm2835.c index 6768b2f03d68..39d2024dc2ee 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -351,6 +351,22 @@ static int bcm2835_gpio_direction_output(struct gpio_chip *chip, return pinctrl_gpio_direction_output(chip->base + offset); } +static int bcm2835_of_gpio_ranges_fallback(struct gpio_chip *gc, + struct device_node *np) +{ + struct pinctrl_dev *pctldev = of_pinctrl_get(np); + + of_node_put(np); + + if (!pctldev) + return 0; + + gpiochip_add_pin_range(gc, pinctrl_dev_get_devname(pctldev), 0, 0, + gc->ngpio); + + return 0; +} + static const struct gpio_chip bcm2835_gpio_chip = { .label = MODULE_NAME, .owner = THIS_MODULE, @@ -365,6 +381,7 @@ static const struct gpio_chip bcm2835_gpio_chip = { .base = -1, .ngpio = BCM2835_NUM_GPIOS, .can_sleep = false, + .of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback, }; static const struct gpio_chip bcm2711_gpio_chip = { @@ -381,6 +398,7 @@ static const struct gpio_chip bcm2711_gpio_chip = { .base = -1, .ngpio = BCM2711_NUM_GPIOS, .can_sleep = false, + .of_gpio_ranges_fallback = bcm2835_of_gpio_ranges_fallback, }; static void bcm2835_gpio_irq_handle_bank(struct bcm2835_pinctrl *pc, -- 2.35.1