Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp821745imw; Thu, 14 Jul 2022 11:22:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t2YSc2oICJ7TvpUM5qDEADAGw77+/JPg4i+u3M96pCey3auaOK/1x9UJsTnbN4fo2H4eu9 X-Received: by 2002:a17:907:2ceb:b0:72e:dd6c:1b96 with SMTP id hz11-20020a1709072ceb00b0072edd6c1b96mr4367117ejc.503.1657822958468; Thu, 14 Jul 2022 11:22:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657822958; cv=none; d=google.com; s=arc-20160816; b=hKy2/97T7PnYysJqrWymFy3c7+E9mpHyEnTXWALW6bjT9t14pKhUozCnNFhYNSgcEC DHjnvi//iqAfFR5iUTpunN+jOMruePkfxbCzTRLzueY+6TB3fS/sn5C3RKaSS4HWjepy A381l4koLlCncmgi20+n4c4qchMoz54ckDN81Qrpj612x80+EVYPr628mrebQES66BmS 5rKPArllTS3dZq4P50EiSkFMrdNVKzfsfVJz5hzcK9HE0ITjdkpL1G29gICOsS1Pl6qG r6zX9FfYQjN7Y9dX7pkFvN89c2+XB2O480pKWIeS+tXUbd9Y2WEsvEBAMwRpYyiTN853 EI4g== 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=NRFTymP5mwSV8GKZ+VBtHVEY9I91q473oDw0U0fbYj0=; b=t0RuNrikyAa+PMkFMwHiRef4HkG2YhKmYaKPbk+XKGplkbaDamUA3DOfkgZarUETUv Faj+IeSx7e9RogOeXyZlW31fu9fEhZnS8zv5qjOfvrjf+8uq7e+tP0WuW13K2lZo+oUY YUR3e8na7E0kbRRPx+TAMwwOC3KUfky3bHfFQ8BAlWC//cwZcdMp8eBVXTjdFixd/QK3 g/UplOZwi5zqnplI3N4eEfXTeKY4Gd2LQv1yD9ruGG/ZUYqkGhGw3aAE/SdncnUS368k tJBReV+6MdpL52JDSIwKnLILQFKnqFNlZDgSJTIibloW/horHPQenj/MaCeNFt34/hxP HucA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r6-20020aa7d146000000b0043aa16402f7si2493546edo.333.2022.07.14.11.22.12; Thu, 14 Jul 2022 11:22:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238458AbiGNRfp (ORCPT + 99 others); Thu, 14 Jul 2022 13:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232478AbiGNRfn (ORCPT ); Thu, 14 Jul 2022 13:35:43 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 16FD45F10C; Thu, 14 Jul 2022 10:35:42 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 27AFF1D13; Thu, 14 Jul 2022 10:35:42 -0700 (PDT) Received: from [10.1.196.40] (e121345-lin.cambridge.arm.com [10.1.196.40]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AA56E3F70D; Thu, 14 Jul 2022 10:35:40 -0700 (PDT) Message-ID: <5ca9bd94-54d9-04f8-0098-a56ffb6f5fe1@arm.com> Date: Thu, 14 Jul 2022 18:35:34 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v2] arm64: dts: rockchip: Fix SD card init on rk3399-nanopi4 Content-Language: en-GB To: wens@kernel.org, =?UTF-8?Q?Christian_Kohlsch=c3=bctter?= Cc: Markus Reichl , =?UTF-8?Q?Heiko_St=c3=bcbner?= , linux-arm-kernel , "open list:ARM/Rockchip SoC..." , linux-kernel , Linux MMC List References: <12878108.O9o76ZdvQC@diego> <103b714c-b07c-f016-1062-84bd94786b22@arm.com> <9AF1E75F-5947-49B0-887D-82C426527B99@kohlschutter.com> <590f7a08-a6ca-be54-4254-363343642a52@arm.com> From: Robin Murphy In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/07/2022 6:02 pm, Chen-Yu Tsai wrote: > On Fri, Jul 15, 2022 at 12:27 AM Christian Kohlschütter > wrote: >> >> mmc/SD-card initialization may fail on NanoPi r4s with >> "mmc1: problem reading SD Status register" / >> "mmc1: error -110 whilst initialising SD card" >> >> Moreover, rebooting would also sometimes hang. >> >> This is caused by the gpio entry for the vcc3v0-sd regulator; >> even though it appears to be the correct GPIO pin, the presence >> of the binding causes these errors. >> >> Fix the regulator to drop the gpio binding and add a comment >> to prevent accidental reintroduction of that entry. >> >> Signed-off-by: Christian Kohlschütter >> --- >> arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi >> index 8c0ff6c96e03..d5f8a62e01be 100644 >> --- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi >> +++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi >> @@ -67,7 +67,7 @@ vcc1v8_s3: vcc1v8-s3 { >> vcc3v0_sd: vcc3v0-sd { >> compatible = "regulator-fixed"; >> enable-active-high; >> - gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; >> + // gpio = <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; // breaks SDHC card support > > This change only means that the regulator no longer gets cycled when > it probes. It's not a proper fix. You're leaving the kernel without > any control over SD card power, and with whatever state the bootloader > left the GPIO in. If the bootloader left the GPIO low, then you don't > get to use the SD card, ever. > > It cycles because of the lack of regulator-boot-on, so the driver > requests the GPIO with initial low state, and then drives it > high to enable the regulator. Hmm, that's a good point - by the time we get to Linux, we should have control over the VCC_SDIO regulator and the I/O domain as well, so a full clean reset should really be no problem :/ The "Tinkerboard problem" I was thinking of is when the SD card is the boot medium, VCC_SDIO stays at 1.8V over a reboot but the I/O domain gets reset back to 3.3V mode, thus cannot see a logic high on any of the I/O lines, thus the boot ROM gives up after failing to detect the card. If we're still able to boot as far as Linux, it's probably a different thing. Apologies for the confusion. >> pinctrl-names = "default"; >> pinctrl-0 = <&sdmmc0_pwr_h>; >> regulator-always-on; > > I think dropping "regulator-always-on" so that Linux can cycle power > and properly reset the SD card is the proper fix to the card being > stuck in UHS and not responding. > > Also, the regulator used is RT9193, according to the schematics. That > chip has an enable delay under 50 micro-seconds. If that needs to be > modeled, then add regulator-enable-ramp-delay. Indeed, if it's a slow regulator and we're simply trying to probe the card too soon before its supply voltage has actually stabilised, that sounds entirely plausible, particularly if the failure is only intermittent. Thanks, Robin.