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 633EFC27C76 for ; Wed, 25 Jan 2023 13:41:57 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B561085480; Wed, 25 Jan 2023 14:41:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=fris.de 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=fris.de header.i=@fris.de header.b="JNGoXYzk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 485DF851A8; Wed, 25 Jan 2023 14:41:51 +0100 (CET) Received: from mail.fris.de (mail.fris.de [IPv6:2a01:4f8:c2c:390b::1]) (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 85899856A1 for ; Wed, 25 Jan 2023 14:41:48 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=fris.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=frieder@fris.de Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 4B1F6BFAEE; Wed, 25 Jan 2023 14:41:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fris.de; s=dkim; t=1674654107; h=from:subject:date:message-id:to:cc:mime-version: content-transfer-encoding; bh=9qRY1MywweceXjDeO/HWe+4AY4GA7CSdMQbq3OiXTe0=; b=JNGoXYzksIojqs3aA4DoZh9/BPlpE1FyBQGSLhLlbcp/rjlil6/0zNACpl3N0TR1odS3pP fqZNAs2DyStPZYQALqVbgcVeH+YoH+fdwFdl9x2zyCNUqcE/xYyvVSWP30HYEHIlE2qtC8 a23BQ5t69uh/Z1sF4k98WMwP4374ghJ0nYaMG16utTupxM/U/lS/ZoCGE8XJStgpiUyiM+ KoRVS0RXLxShzjacaqH6JRjnUN3siaLDvcKW8xST6zt37JzCAp3+kUT9+PxHba8+hqOFT3 SJVHI9wl5cydtrrjuJThU6yiaKSaYoxNtPDcM+TMjjY5VRSIuMMVTRIJzIsmlQ== From: Frieder Schrempf To: Fabio Estevam , Frieder Schrempf , Stefano Babic , u-boot@lists.denx.de Cc: Marek Vasut , Fabio Estevam , Heiko Thiery , "NXP i.MX U-Boot Team" Subject: [PATCH] imx: kontron-sl-mx8mm: Fix SD card IO voltage level Date: Wed, 25 Jan 2023 14:41:39 +0100 Message-Id: <20230125134139.50791-1-frieder@fris.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 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.6 at phobos.denx.de X-Virus-Status: Clean From: Frieder Schrempf The LDO5 of the PCA9450 PMIC can be switched between two different voltage settings (defaulting to 1.8V and 3.3V) using an external signal SD_VSEL that is connected to the VSELECT signal of the SD card interface. As the regulator driver can't deal with both LDO registers (LDO5CTRL_H and LDO5CTRL_L) it only uses one of them, which means reading the voltage from the regulator can potentially return a value that does not reflect the actual state of the LDO5 output. In our case, after booting U-Boot we read 1.8V from the regulator while in fact as the VSELECT signal is still low the regulator outputs 3.3V. This confusion causes the MMC driver to think it is dealing with a 1.8V-only device. This in turn leads to SD cards being addressed with 1.8V IO levels even if UHS support is not available or disabled. Some cards with UHS support still work even if they are addressed with 1.8V levels in non-UHS modes, but a lot of cards also fail with timeout errors like: Card did not respond to voltage select! : -110 As a workaorund we disable the vqmmc regulator for now so we can make sure no wrong values are read from the regulator. The switching between 1.8V and 3.3V still works as the ESDHC driver sets the VSELECT signal accordingly. Signed-off-by: Frieder Schrempf --- By the way: I suspect that other boards using the PCA9450 might also be affected by this. I didn't find a nice generic solution so far. It would be possible to patch the pca9450 driver to use the PCA9450_LDO5CTRL_L instead of the PCA9450_LDO5CTRL_H register for LDO5. This would fix this particular case, but still not the root problem of the regulator driver returning wrong values. So if anyone got some idea how to properly handle this, let me know. The same issue is also present in Linux. While I didn't notice any problems with the SD card being addressed with incorrect voltage levels so far, reading the regulator doesn't return the correct value if VSELECT is low. --- --- arch/arm/dts/imx8mm-kontron-bl-common-u-boot.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/dts/imx8mm-kontron-bl-common-u-boot.dtsi b/arch/arm/dts/imx8mm-kontron-bl-common-u-boot.dtsi index 5b8b472159..8321424649 100644 --- a/arch/arm/dts/imx8mm-kontron-bl-common-u-boot.dtsi +++ b/arch/arm/dts/imx8mm-kontron-bl-common-u-boot.dtsi @@ -137,6 +137,12 @@ &usdhc2 { u-boot,dm-spl; + /* + * Delete the reference to the IO voltage regulator in order to prevent + * wrong information being passed to the MMC driver by reading the current + * voltage of the PCA9450 LDO5. + */ + /delete-property/ vqmmc-supply; }; &wdog1 { -- 2.39.1