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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2BCB3C77B7E for ; Tue, 2 May 2023 10:41:22 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 02251846E6; Tue, 2 May 2023 12:41:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="Yl8+TIHu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 343B6846D5; Tue, 2 May 2023 12:41:18 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B4FED846E6 for ; Tue, 2 May 2023 12:41:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eugen.hristev@collabora.com Received: from [192.168.0.125] (unknown [82.76.24.202]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madras.collabora.co.uk (Postfix) with ESMTPSA id DB34C6605636; Tue, 2 May 2023 11:41:14 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683024075; bh=53J2lZrODxEtpU+jRy6brDM7OrXrrkunP2GqN1ijRWM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Yl8+TIHu15PuarM8A/6Z0XeO18DH3wQyPmS3VdoJPudjL0Wd6lR3r1UPbhRgq1dPn bDVrRRVUybgi9ESyUb4CLkvGQDkW2wsO429W3B2koxqsP089hjL3hoM69bU7NrwQbz hla0XpWF9xvWpVVrpRqzThf8EQW5C0QyPat5vPDAjJ+hGFEN/EW0UUdfcHCKSPi5td 2rI7O6v+vLJa0/JSr1oFXfMYsyvzrqosdl8F7/bVygBIVo08qV94RR4agCJkf3fnn3 ghTSTMqYL46eyMTyxebT3box/OAhna6FMfRLjffrn6uwZHO70jJ3Gi4RpNKfIppqmm YO9eHtSFZ4JTA== Message-ID: <76acce9d-e61c-814a-5dd4-1c54c1417cf1@collabora.com> Date: Tue, 2 May 2023 13:41:11 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] usb: ehci-mx6: replace regulator_set_enable with *_if_allowed Content-Language: en-US To: Marek Vasut , u-boot@lists.denx.de, tharvey@gateworks.com Cc: sjg@chromium.org References: <20230502065104.32242-1-eugen.hristev@collabora.com> From: Eugen Hristev In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On 5/2/23 12:18, Marek Vasut wrote: > On 5/2/23 08:51, Eugen Hristev wrote: >> regulator_set_enable_if_allowed already handles cases when the >> regulator is already enabled, or already disabled, and does not >> treat these as errors. >> With this change, the driver can work correctly even if the regulator >> is already taken or already disabled by another consumer. > > Can that ever happen for Vbus supply (the 5V coming out of USB port) ? > Can you elaborate how ? Hi Marek, Recently I developed a series of patches to add a reference counter for regulators : https://marc.info/?l=u-boot&m=168191189309879&w=2 But with this series, having a regulator already enabled or already disabled results in an error returned by regulator_set_enable Hence, one option is to replace calls with regulator_set_enable_if_allowed There is a discussion ongoing here: https://marc.info/?l=u-boot&m=168295920316621&w=2 Eugen