Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5753200pxb; Thu, 20 Jan 2022 04:01:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJwuiiRCyQG3fahdmqKni/lxnm3xCIseGVt1peJtJ1h0JKibYeWC9aQV8YDdJ8/FNZ3Wffui X-Received: by 2002:a17:90b:3884:: with SMTP id mu4mr10397542pjb.82.1642680079948; Thu, 20 Jan 2022 04:01:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642680079; cv=none; d=google.com; s=arc-20160816; b=SKQ9FPuA3TIs+uq0dVnf6GD5bneDO7c30FKmDurSWixPMfd1xuHW7pQnFCoqZ36gC5 H8VTkcMT6oKOdUFKYM4nt4WusAR2eCe4Px+0paTTbBb5DJRsLKjOeDpqhZQftvSB+D+f U3cFf3hSgDhYrwHQ7E8H5WApFeX+puCgprOewNaDEdzcjcRv+KxLc3hm5MB7ysalDakC NUK2BNLx4g8a1tyY+HmsMRYhqlN8xIqWZnlCTDZ+oaz40F8bC87VbsMp4xvNkpOyZ6qZ tFcdd5KrIBxTap2UvQxJ8HS6UK9I2q/WXBMCg8HVKVov6PxvcCx8iMwOO8VehPUyYJTo Z1LA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=lPDDjKxr+K1Du5VJaP/zPCc0j51dLibtpBxemUejHfU=; b=P2OUG+myHoglYiCCIXvNyRpIHBJx02qIGlIfQoFYH/r7pz7nqHMWrM1twLPGdzmD4q lTnEPutLEyxiBN0sU/RGkc0WjoZ3UQFKcCRsrqm8EAmjzskM9kIxphNfZl+WoFCU5o/h 9sq8SKgW+jrvJPmvfs54KVwcdJA3xAg/EkGsnzmZWp8ip2BO4VH8gHpntxVxhQ6zJoHP HzQebRpJlF9UlMZWKI2AcXFag1pqa9FS8mDsEOTvgcQMuZHJFEkHk8yOnoNVZCyjaEaf zQYzH7mnpv2PLpPzpBu0JrHpuaA3YhQV03IN8CfW3f4aZAdvKlwfGERUex3T8OVanzlD dOaw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m5si2163017plt.311.2022.01.20.04.01.07; Thu, 20 Jan 2022 04:01:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243778AbiARONZ (ORCPT + 99 others); Tue, 18 Jan 2022 09:13:25 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:37714 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233774AbiARONY (ORCPT ); Tue, 18 Jan 2022 09:13:24 -0500 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 21B6E614BC; Tue, 18 Jan 2022 14:13:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2CBEC00446; Tue, 18 Jan 2022 14:13:21 +0000 (UTC) Message-ID: <2f82dbe8-50d6-d905-9065-d3869948aa06@xs4all.nl> Date: Tue, 18 Jan 2022 15:13:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [BUG] pinctrl: reg-fixed-voltage usb0-vbus: error -EINVAL: can't get GPIO Content-Language: en-US To: Corentin Labbe , linus.walleij@linaro.org, mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com Cc: linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org, zhangn1985@gmail.com References: From: Hans Verkuil In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/18/22 13:50, Corentin Labbe wrote: > Hello > > As reported on old googlegroup sunxi mainling list, on linux-next-20220118, USB storage fail to bring up on orangepiPC. > We can see some error logs in dmesg: > reg-fixed-voltage usb0-vbus: error -EINVAL: can't get GPIO > reg-fixed-voltage: probe of usb0-vbus failed with error -22 > > This is bisected to: 8df89a7cbc63c7598c00611ad17b67e8d5b4fad3 pinctrl-sunxi: don't call pinctrl_gpio_direction() > > Reverting this commit lead to a working USB storage being setuped. Hmm, I'll bet it's EPROBE_DEFER related. The original call (pre that commit) of pinctrl_gpio_direction_output() checks if the pin controller could find the pin (pinctrl_get_device_gpio_range()). That doesn't happen in the new code. The sunxi appears to have two pincontrollers in the device tree (&pio and &r_pio), that might be part of the reason this is an issue here. Linus, should there be a check somewhere for a missing pincontroller in gpiod_get_index()? I suspect that before my commit it was the gpiod_configure_flags call in that function that returned -EPROBE_DEFER, but I'm not completely certain. If someone can give me a hint about what should be done, then I can make a patch. The alternative is to revert this sunxi patch, but perhaps this is a deeper problem with these pincontroller drivers that set the direction directly instead of going through pinctrl_gpio_direction_output(). Corentin, it would help me if you can figure out where the EPROBE_DEFER is returned (pre-commit) in drivers/pinctrl/core.c. Probably pinctrl_get_device_gpio_range(). And I'd love to have the WARN_ON(1) output from just before the 'return -EPROBE_DEFER'. Regards, Hans > > Regards