From patchwork Fri Mar 1 14:41:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sean Nyekjaer X-Patchwork-Id: 13578550 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE1C3C5475B for ; Fri, 1 Mar 2024 14:41:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Cc:Date:Message-Id:Subject: Mime-Version:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=XlCOwVnOZMuLn6d7cXNmATL9hfIi0lcc1c/lErhmEnU=; b=4+F t+6edEsVQix/W86yV8H6Y1sZ0canweN8Mj3oZfymIWZ7HlfvATt/4nF/q+Myb14oXydrZzprsDs3o MhaWAN/KpZgRkU90NKOjESRZTluqadvs+gh4hIxZFDDU9brbcClOY33nVWOqj58n5qEy5pPQQNL+9 0jaCXugMA1Xp7r24jPhgfx0jGYt6W5zSPchfpQpWb2QDVxyYcIYfqVX2AszwUf0Ios/shSU1sT7DH V6WTWWj9nhfL3cq+HREob3tN3yuRT8UIQdoqgl3wim8Ao2l7dtbQTD7wIwfe33Ia63qpaWme3m0x1 EOFyKUz502Vv1xF5Dsp/CYlqSkgPlQA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rg44t-00000000kcq-3QGt; Fri, 01 Mar 2024 14:41:35 +0000 Received: from www530.your-server.de ([188.40.30.78]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rg44q-00000000kaO-12Ag; Fri, 01 Mar 2024 14:41:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=To:Cc:Date:Message-Id:Subject:Mime-Version: Content-Transfer-Encoding:Content-Type:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=LdN5qTEFtlumZuRQEi4VHY/eZtcQU0zxLhU2JW1rtWQ=; b=Z53nd8cp13KDoUb8MDu2wu0L3p ZHreIzI1KovhrJL5FOdTlhslLv9ItsqOnoJ2goAUQiKczxpIRBiOJ0E0wKKxP4zkpnAfng9SgYP7D DesdtktdS58DMSV5GIOiDXe8fFHuQFWGrlXxtXsTJh9UwcjcY5ypR9GygteBKJQWZBu6LUShnybxG RZVvG9aIfpCGbozljZ4065QpSPYgcSye6TvFg5O/Ovs6VY2OLWekVus2iV9wvK3PaZo2f7nZ3x5/1 aqHZ1Y2hZ8mob3fdHVcABytT8OToh0avzTUBFuVp05A2KJuAOvhvpyZ+C/QpkzXk3nlll4xGiHc8X Y1ind1hQ==; Received: from sslproxy07.your-server.de ([78.47.199.104]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rg44e-00065E-Hy; Fri, 01 Mar 2024 15:41:20 +0100 Received: from [2a06:4004:10df:0:d47e:f3fd:21dc:d516] (helo=smtpclient.apple) by sslproxy07.your-server.de with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rg44d-000Kce-1a; Fri, 01 Mar 2024 15:41:19 +0100 From: Sean Nyekjaer Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.400.31\)) Subject: stm32mp1xx: use of reg11, reg18 and vdd_usb rails Message-Id: <4807FD7F-FEB5-4460-B1EB-3E2330864C8B@geanix.com> Date: Fri, 1 Mar 2024 15:41:08 +0100 Cc: =?utf-8?q?Martin_Hundeb=C3=B8ll?= To: vkoul@kernel.org, kishon@kernel.org, Maxime Coquelin , Alexandre Torgue , lgirdwood@gmail.com, broonie@kernel.org, u.kleine-koenig@pengutronix.de, Marc Kleine-Budde , m.grzeschik@pengutronix.de, linux-phy@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, marex@denx.de, p.paillet@st.com, Olivier Moysan , l.goehrs@pengutronix.de, Ahmad Fatoum X-Mailer: Apple Mail (2.3774.400.31) X-Authenticated-Sender: sean@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27201/Fri Mar 1 10:25:20 2024) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240301_064132_607163_4D7B8BA1 X-CRM114-Status: GOOD ( 13.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi all, We are using the osd32mp1 SIP module [0]. We are seeing some hardware get’s fried inside the SIP module. It’s somewhat traced down to the usb controller/phy/regulator. With this device tree[1]. We have noticed during boot the reg18 is toggled on and off without vdd_usb being turned off before reg18 as required in the data sheet[2], section 3.8.1: VDD3V3_USBHS must not be present unless VDDA1V8_REG is present, otherwise permanent STM32MP157C/F damage could occur. Must be ensured by PMIC ranking order or with external component in case of discrete component power supply implementation. It’s happens because the something is already uses the vdd_usb, it’s both the drivers/phy/st/phy-stm32-usbphyc.c and drivers/regulator/stm32-pwr.c that consumes it. I can fix it by removing the vdd_usb from the usb33 supply[3]: The stm32-pwr.c is (to me) rather weird, as it exposes the usb33 as a regulator when in fact it’s a detection pin. Is that done on purpose? I would like introduce a error in the stm32-pwr.c if something is trying to power off reg18 with usb33 present? Would it be okay to return -EBUSY? Or even -ESMOKE? :) Or is it better to do it in phy-stm32-usbphyc.c[4]? /Sean [0]: https://octavosystems.com/octavo_products/osd32mp15x/ [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/st/stm32mp157c-osd32mp1-red.dts [2]: https://www.st.com/resource/en/datasheet/stm32mp157c.pdf [3]: diff --git a/arch/arm/boot/dts/st/stm32mp157c-osd32mp1-red.dts b/arch/arm/boot/dts/st/stm32mp157c-osd32mp1-red.dts index 527c33be66cc..0d67006806c4 100644 --- a/arch/arm/boot/dts/st/stm32mp157c-osd32mp1-red.dts +++ b/arch/arm/boot/dts/st/stm32mp157c-osd32mp1-red.dts @@ -149,7 +149,6 @@ &m_can1 { &pwr_regulators { vdd-supply = <&vdd>; - vdd_3v3_usbfs-supply = <&vdd_usb>; }; &rtc { [4]: diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-usbphyc.c index d5e7e44000b5..58fcc3099803 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -188,8 +188,18 @@ static int stm32_usbphyc_regulators_enable(struct stm32_usbphyc *usbphyc) static int stm32_usbphyc_regulators_disable(struct stm32_usbphyc *usbphyc) { + struct stm32_usbphyc_phy *usbphyc_phy; int ret; + for (port = 0; port < usbphyc->nphys; port++) { + usbphyc_phy = usbphyc->phys[port]; + + if(regulator_is_enabled(usbphyc_phy->phy->pwr)) { + pr_err("%s: phy is powered not allowed to switch off regulator\n", __func__); + return -EBUSY; + } + } + ret = regulator_disable(usbphyc->vdda1v8); if (ret) return ret;