Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2207386iof; Tue, 7 Jun 2022 23:13:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/3jmysB1MFvGNpt4MJO0ZqRJI2wbP1swZOzIpx3U7wcvnofrS96/NqhaP9RAGnhJF/zJj X-Received: by 2002:a17:90b:1c10:b0:1e8:90bd:d912 with SMTP id oc16-20020a17090b1c1000b001e890bdd912mr12300615pjb.233.1654668791126; Tue, 07 Jun 2022 23:13:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668791; cv=none; d=google.com; s=arc-20160816; b=JaK39rHCFLoIMdi4ctQvdty051JPI6PKMTmlsG+CrqWQHfe3PrArQAh5ZB+07/gSeN ThIeHIDxnYAE+shTNoEACUEY9yLJYX7ox+/g/wdDH6EeH/dk8VUaMe/QD+KEN6dLvvU/ LUH8PDwHL9+4nBoS/w4cwYLqoW+CYXjtWaPmIYMppZDZYkhK5X8VQ9BJNmO1nLhxeM2M dUFdkVlAkAiOD+gzY7XvDspnx9RoOoNRrLmZksJcCPF0W+/xqW5etdUVuwVRAE7Xg7ok vmAH19R6gEIKyVIyd0Sc9pJB7bldIIMpmUG0/eXV9GgReVQusVDYPvUouGy9wM5KToya sOvw== 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=WwQCEfvm8JvNpHZzW5dhNp8sSFGXcg0u4XEnSsi4xmE=; b=DuGot9+YsyKSY3ZnxS6MzzHNyQPRr37YYBqQy78LPTQGldIu4QDKCNVJcE4fCEPbut mE23V2A52x+skITfllmeVoVxiJ8XguOwjhGjZBwM1wMnrm0Ebpk+ULmIanQ7qJc2MdDI ggP5fVObuMeSrDeOa4FX2q9iAF2Q1IlBu8sBbFhZem/0nV5EF8ju5P/LddKwlLmPWAwN xt+pe7TZyzpsulXc3UrP9QuvCYlzPhbdRFpoyvRYcqpooDmZrfNTV+Opj+8ccKf6D+Rl jpFPWPh+whfWiZL2KpK81VhnPoORV8UP38Hke4Gk/zwjKGYVpAuPU9ghQ8gpUvz1XKSz bCmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oVHmiAsl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m4-20020a637104000000b003fc97d5f8besi26539934pgc.248.2022.06.07.23.13.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:13:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oVHmiAsl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 50CEE356398; Tue, 7 Jun 2022 22:35:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239637AbiFHBIu (ORCPT + 99 others); Tue, 7 Jun 2022 21:08:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383706AbiFGVxb (ORCPT ); Tue, 7 Jun 2022 17:53:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21348216286; Tue, 7 Jun 2022 12:12:14 -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 dfw.source.kernel.org (Postfix) with ESMTPS id ECED6618DF; Tue, 7 Jun 2022 19:11:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 014F9C385A2; Tue, 7 Jun 2022 19:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629119; bh=wppAPTYZacra8jvjOGCwiUf7y78jF2kYF71m4qcN1Bo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oVHmiAslLOAMyzxxzVpLkJLg8JOIVQZie4M3Jro7ANVT3ZupzYfMQDCL3w4ccZYOu bmm266/dHLrf3y9uS8Q8DLbXaki8j5LNK1M9YY4jF696kR2M2Zx1IKHYRI1pNJwWB6 aU5cNk64M3Q19lm1iiW9CKxkD4+qvKMJ5jo+4daQ= 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.18 575/879] pinctrl: bcm2835: implement hook for missing gpio-ranges Date: Tue, 7 Jun 2022 19:01:33 +0200 Message-Id: <20220607165019.545531859@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@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 47e433e09c5c..dad453054776 100644 --- a/drivers/pinctrl/bcm/pinctrl-bcm2835.c +++ b/drivers/pinctrl/bcm/pinctrl-bcm2835.c @@ -358,6 +358,22 @@ static int bcm2835_gpio_direction_output(struct gpio_chip *chip, return 0; } +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, @@ -372,6 +388,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 = { @@ -388,6 +405,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