From patchwork Wed Dec 18 15:27:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frieder Schrempf X-Patchwork-Id: 13913869 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 2E8F9E77187 for ; Wed, 18 Dec 2024 15:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=fZ799AujDvtHo1AcXdC1mifOZNGSfZzq30OtsIXAG1U=; b=s1P9wrh6W1iDomiHOk5kREusJ2 PcXIo1l4jVf5NfTBba+zPawZwg4plk/FQ9g27N2sNT4Q45ZCoSdZp/A1nrCMrR1PIGQbebCUTfo53 5fVi+jtRGHVoe7yzFMdT4TYmVPP7QTY3501Ow9MEvMtviTsN8Qei4+mVmfbX7JUmEizXZY9YhBLGS UuAdZV62XM2LRNN2UO+aZvwNZSHPGb0nU1jdDftv4fWz8uS9GypLmxr3xkBHryED2IQZdQHE0V4QM Dr5QTItFJqSTKiQvl//nZIZts8ZW3fLW7Tasy0exmItmcgNG+506AlYO0YIviCwUEAHCv957ILCC+ Eo5HeiLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tNw1y-0000000H1lW-1LPZ; Wed, 18 Dec 2024 15:32:10 +0000 Received: from mail.fris.de ([116.203.77.234]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tNvzi-0000000H1HM-3jpV for linux-arm-kernel@lists.infradead.org; Wed, 18 Dec 2024 15:29:52 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id B09E4BFB25; Wed, 18 Dec 2024 16:29:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1734535782; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding; bh=fZ799AujDvtHo1AcXdC1mifOZNGSfZzq30OtsIXAG1U=; b=BwINfTHUHw0yknjCNyH11gosF6cTLF5S52H/bsiZPizbQ6lFiRAdVf5lOlTTGHW9LS9OqO IB3FQCUE6tu5CVMH8S1BMvUnrhRXvQSLEfMU8wA86tpirVpEzNMrjNa5aFhbdzMgfu43PJ aYQEAVwsIIuNC98oRlGvhBNOmNGFkCe0jyLanvzVC8rp8lzcEHbSzxryKkxzeFobTwUuUD 3k46oI967WYscyUjctXxXHVdIYqqXcsDfT2TH6ulJN88/vf9L3JK9RJP+5DzUw2tcSqlaz G2i3ZKl/SdOlNMTM5rJW5MXt7DHyt0FzJt9SddoJxsPg0uhiG86vtWDunbMgOg== From: Frieder Schrempf To: linux-arm-kernel@lists.infradead.org, Marek Vasut , Conor Dooley , Conor Dooley , devicetree@vger.kernel.org, Frieder Schrempf , imx@lists.linux.dev, Krzysztof Kozlowski , Liam Girdwood , linux-kernel@vger.kernel.org, Mark Brown , Rob Herring , Robin Gong , Sascha Hauer , Shawn Guo Cc: Bo Liu , Conor Dooley , Fabio Estevam , Frank Li , Joy Zou , Krzysztof Kozlowski , Pengutronix Kernel Team Subject: [PATCH v3 0/9] Use correct LDO5 control registers for PCA9450 Date: Wed, 18 Dec 2024 16:27:23 +0100 Message-ID: <20241218152842.97483-1-frieder@fris.de> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241218_072951_362896_3648FA58 X-CRM114-Status: GOOD ( 17.77 ) 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 From: Frieder Schrempf This is a follow-up of [1]. The main objective of this is to fix the PCA9450 driver to use the correct control register for the LDO5 regulator. Currently the control register to use for LDO5 is hardcoded to LDO5CTRL_H. This is wrong for two reasons: 1. LDO5CTRL_H doesn't contain the bits for enabling/disabling the regulator. Only LDO5CTRL_L does. 2. The actual output voltage of the regulator is determined by the LDO5CTRL_H only if the SD_VSEL input is HIGH. If it is low, then LDO5CTRL_L is used. The driver does not take this into account. This can cause several problems: 1. LDO5 can not be turned on/off and we rely on the bootloader to leave it turned on. On the other hand we can't save power if LDO5 is unused. 2. There is a potential for corner-cases where switching SD_VSEL via USDHC_VSELECT and writing to the (wrong) control register can cause wrong output voltage and therfore SD card failures (not observed yet). 3. Reading the current voltage of the LDO5 regulator (e. g. via sysfs can yield the wrong value as the voltage is read from the wrong control register. At the same time there is now hardware that hardwires SD_VSEL to a fixed LOW level and therefore relies on switching the voltage only via a single control register. We add support for this through an additional property "nxp,sd-vsel-fixed-low" in the LDO5 node. Summary of binding changes (patch 1): 1. Adjust the bindings to remove the old and abandoned use of sd-vsel-gpios property. 2. Adjust the bindings to use sd-vsel-gpios in the LDO5 node to retrieve an input that can be used to sample the SD_VSEL status. 3. Adjust bindings to allow "nxp,sd-vsel-fixed-low" to be used for boards that have SD_VSEL hardwired to low level. Summary of driver changes (patch 2-6): 1. Remove the old sd-vsel-gpios handling. 2. Use the new sd-vsel-gpios property to determine the correct control register for LDO5. 3. Fix the enable register for LDO5. 4. Support hardware with fixed low level of SD_VSEL. Summary of devicetree changes (patch 7-9): Implement the changes in the devicetrees for Kontron hardware (i.MX8MM, i.MX8MP and i.MX93). Changelog: v2 -> v3: * Merge binding patches into one and extend commit message * Rebase to next-20241218 v1 -> v2: * Split binding patch * Add solution for hardwired SD_VSEL * Leave regulator core untouched as requested by Mark * Add devicetree changes for i.MX8MP and i.MX93 [1] https://lore.kernel.org/lkml/20230213155833.1644366-1-frieder@fris.de/ Frieder Schrempf (9): dt-bindings: regulator: pca9450: Add properties for handling LDO5 arm64: dts: imx8mp-skov-reva: Use hardware signal for SD card VSELECT Revert "regulator: pca9450: Add SD_VSEL GPIO for LDO5" regulator: pca9450: Fix control register for LDO5 regulator: pca9450: Fix enable register for LDO5 regulator: pca9450: Handle hardware with fixed SD_VSEL for LDO5 arm64: dts: imx8mm-kontron: Add support for reading SD_VSEL signal arm64: dts: imx93-kontron: Fix SD card IO voltage control arm64: dts: imx8mp-kontron: Add support for reading SD_VSEL signal .../regulator/nxp,pca9450-regulator.yaml | 29 ++++- .../boot/dts/freescale/imx8mm-kontron-bl.dts | 10 +- .../dts/freescale/imx8mm-kontron-osm-s.dtsi | 7 +- .../dts/freescale/imx8mp-kontron-osm-s.dtsi | 7 +- .../boot/dts/freescale/imx8mp-skov-reva.dtsi | 5 +- .../dts/freescale/imx93-kontron-osm-s.dtsi | 5 +- drivers/regulator/pca9450-regulator.c | 103 +++++++++++++++--- 7 files changed, 133 insertions(+), 33 deletions(-)