Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp493499imw; Thu, 14 Jul 2022 05:29:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vLvgEDzTkVYkRQq7eTASvUS7y+Tr/HdontXUxL61K+R6xRydNoAsawifp3l3FJg1gZokDR X-Received: by 2002:a05:6402:268e:b0:43a:8f91:582 with SMTP id w14-20020a056402268e00b0043a8f910582mr11903903edd.419.1657801788252; Thu, 14 Jul 2022 05:29:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657801788; cv=none; d=google.com; s=arc-20160816; b=nT1CgmPtgccw5+duJdcdfEu0WIzaJplG/Q8EN9NKeou6snbYx7xkr8dk4VpoZup+G3 mRFjThEMekX6y4iXVWWYM4GMjBSkZnL3IdrvCodtU6+mLUUZE6O+PflJEirBSnMYX1p4 zt7zsKVUkaAcWU9iZsuf1Iyo5IKhptueny1GNcGkmA6bNX4YZCxvFr0bgR609yU2hwjC NExFmz+ya2OcLSWcGs84vwnUpWH5HJhjpURNOGbBD60XO8kUxv9DGPxdBg4zuBHsRbzX nIlg5plTGGcOto8FmOuz6iW0gVfBRjfQ67Wufy8AOBOSAt3o5D4fsCPr4MzXgfLu/+rr nYeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=io1aLTKdTpdVFlnqujmNPlo4oYNZZxJeBCS9meVocL0=; b=OTqiEloIVi6XwJG1opOh01/jZKO75E3MQnVO6MVj7qRCLyp1YS7tjAlthRUIMQfMwC qo0xrIMi8bgahoLILIHkUKmXKmmFFM9u3XbYUF95AxDFMe/PARQSUJn2bAa1Nr6NUO86 GM47aiKcFxZVDe9QPOerxg54fcyBZisf7wclenzM/OXRUZ/SZhoOwenvZ1PRKUgKhFd1 NeACRx0dCMkoclMfPySvxIUn5HJtAOnqjE8d7fpCzfFIoNsaUj2FVbexG5+XfXU9NOI6 cKeg0bUjkobd9+IdMNH6FryHrD4aU8KCnOZLJ1tSK7BLBDwzSjr+rN96iPdvi7BZIOCa 8qJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kohlschutter-com.20210112.gappssmtp.com header.s=20210112 header.b=CeWiNxlZ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020a170906975600b0072b4ad3252dsi732686ejy.83.2022.07.14.05.29.22; Thu, 14 Jul 2022 05:29:48 -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; dkim=pass header.i=@kohlschutter-com.20210112.gappssmtp.com header.s=20210112 header.b=CeWiNxlZ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238644AbiGNMOj (ORCPT + 99 others); Thu, 14 Jul 2022 08:14:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238731AbiGNMOJ (ORCPT ); Thu, 14 Jul 2022 08:14:09 -0400 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFD004330F for ; Thu, 14 Jul 2022 05:14:07 -0700 (PDT) Received: by mail-ej1-x630.google.com with SMTP id sz17so3040694ejc.9 for ; Thu, 14 Jul 2022 05:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kohlschutter-com.20210112.gappssmtp.com; s=20210112; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=io1aLTKdTpdVFlnqujmNPlo4oYNZZxJeBCS9meVocL0=; b=CeWiNxlZAbcouK3RkNKwezaE1z81eze3WW4P/p51909MqdufYLlp/sIXTsxGUwMNW8 VQsB3+LoA+f2yzGTReV67D4y1XN47QyrRxLbl7qsHqt027P9Dpd7ryLXcuDpWI8Ow+OZ u9Ywst8kFKNn6prBNoll5cP+FIKXVcJQs8rFTst7bYrdKtEbK//N4Mhq54FgtmnZD0pa mXstZDB/KdmMdJj/MEZHvzr2NVdI+p2ZpIUgQWcpaQB3vO7kGxIgqyxWdclIriS2Djph SYR9hlPSbDHx7tDWBRZ+0AfwR7dmOpW2azZwAJG/qS+pDIyTWMN2XUAIUEJ/DAUjud9L SXdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=io1aLTKdTpdVFlnqujmNPlo4oYNZZxJeBCS9meVocL0=; b=bFlyr1mtvnqWScUZ/qajasLsKtlys7G+LVN40IWyJqfZZuemibI7touScvhl4nmj+s 1lwPmjWbzormZBPk3IVo0PC7v8UoSJwYT4DSAsXRted6y0mtNXZIZKaEZ7QtAGY3IRlP 4DvmeCdmzDKaJZSigmy9Qy9i6Dsb7doCDEXTDpUWc0xdQR1ErLNccxngOn4H9pKJOzKO gfnxqeloXL3FKs3MsZZsTl5KnFodu9vt4GOzly7WtKCl/aQj8jlLHqUlvYvnT+njkMzY ADcVSY6MW68tiDZwB7oUnwzrmDe8Znmx1lqN7iwu1aO8ys2XIQaq8HvHASBxjQYwx474 ZmIw== X-Gm-Message-State: AJIora+jeCE2uxhUHNOWPPwnTJ8VtFmTPrAfu3djGI4REOn55G7niSUO ZgXR2TC8HUc7Uc46+Tw4KSEtBeDmOaHOzsP9 X-Received: by 2002:a17:906:9c82:b0:6e1:2c94:1616 with SMTP id fj2-20020a1709069c8200b006e12c941616mr8567049ejc.64.1657800846315; Thu, 14 Jul 2022 05:14:06 -0700 (PDT) Received: from smtpclient.apple (ip5b434222.dynamic.kabel-deutschland.de. [91.67.66.34]) by smtp.gmail.com with ESMTPSA id u2-20020aa7db82000000b0043a253973aasm934973edt.10.2022.07.14.05.14.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jul 2022 05:14:05 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: [PATCH] arm64: dts: rockchip: Fix SD card init on rk3399-nanopi4 From: =?utf-8?Q?Christian_Kohlsch=C3=BCtter?= In-Reply-To: <103b714c-b07c-f016-1062-84bd94786b22@arm.com> Date: Thu, 14 Jul 2022 14:14:04 +0200 Cc: =?utf-8?Q?Heiko_St=C3=BCbner?= , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <9AF1E75F-5947-49B0-887D-82C426527B99@kohlschutter.com> References: <12878108.O9o76ZdvQC@diego> <103b714c-b07c-f016-1062-84bd94786b22@arm.com> To: Robin Murphy X-Mailer: Apple Mail (2.3696.100.31) X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 > Am 14.07.2022 um 13:41 schrieb Robin Murphy : >=20 > On 2022-07-14 00:41, Heiko St=C3=BCbner wrote: >> Hi Christian, >> Am Donnerstag, 14. Juli 2022, 00:22:23 CEST schrieb Christian = Kohlsch=C3=BCtter: >>> mmc/SD-card initialization may sometimes fail on NanoPi r4s with >>> "mmc1: problem reading SD Status register" / >>> "mmc1: error -110 whilst initialising SD card" >>>=20 >>> Moreover, rebooting would also sometimes hang. >>>=20 >> Nit: here the commit message should continue with something like: >> ----- >> This is caused by the vcc3v0-sd regulator referencing the wrong gpio. >> Fix the regulator to use the correct pin and drop the always-on = property. >> ----- >>> Signed-off-by: Christian Kohlsch=C3=BCtter = >>> --- >>> arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi | 6 +++--- >>> 1 file changed, 3 insertions(+), 3 deletions(-) >>>=20 >>> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi = b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi >>> index 8c0ff6c96e03..91789801ab03 100644 >>> --- a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi >>> +++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi >>> @@ -67,10 +67,10 @@ vcc1v8_s3: vcc1v8-s3 { >>> vcc3v0_sd: vcc3v0-sd { >>> compatible =3D "regulator-fixed"; >>> enable-active-high; >>> - gpio =3D <&gpio0 RK_PA1 GPIO_ACTIVE_HIGH>; >>> + gpio =3D <&gpio0 RK_PD6 GPIO_ACTIVE_HIGH>; >> The interesting question would be how nano-pi-specific that gpio is. >> I.e. this is the rk3399-nanopi4.dtsi that is shared by multiple board = types, >> so can you check in schematics if gpio0-d6 is always used on all of = them? >=20 > On the R4S schematic, this is GPIO0_A1 same as the others. GPIO0 = doesn't even have a bank D on RK3399, it only goes up to B5 :/ >=20 >> Thanks >> Heiko >>> pinctrl-names =3D "default"; >>> pinctrl-0 =3D <&sdmmc0_pwr_h>; >>> - regulator-always-on; >>> + regulator-boot-on; >>> regulator-min-microvolt =3D <3000000>; >>> regulator-max-microvolt =3D <3000000>; >>> regulator-name =3D "vcc3v0_sd"; >>> @@ -580,7 +580,7 @@ wifi_reg_on_h: wifi-reg_on-h { >>> sdmmc { >>> sdmmc0_det_l: sdmmc0-det-l { >>> - rockchip,pins =3D <0 RK_PA7 RK_FUNC_GPIO = &pcfg_pull_up>; >>> + rockchip,pins =3D <0 RK_PD6 RK_FUNC_GPIO = &pcfg_pull_up>; >=20 > ...and claiming the card detect is on the same non-existent pin as the = regulator enable is clearly even more wrong. >=20 > Is this another case where a UHS card is involved, such that VCC_SDIO = gets left at 1.8V after a reboot, so subsequent attempts to do the = initial handshake where the card is expecting 3V logic levels fail? (AKA = the Tinkerboard problem). Hobbling the regulator such that Linux can = never actually turn VCC3V0_SD off, thus the card never gets reset, might = appear to "work", but isn't the right thing to do. >=20 > Robin. Right, this is all very strange.=20 Indeed, I have a UHS card and the problem you describe. I've actually looked into the other RK3399 dts files to come up with = that patch (e.g. rk3399-roc-pc.dtsi, which does this; also see [1]) I understand that we should do the right thing, but I am by no means = sure what the "right" thing for this problem is. That said, I wished someone with expertise and authority in the = mmc/rockchip community would fix this for good. There are several patches around this 1.8V/3V voltage dance that do = work, get used by several distributions but didn't get merged to = mainline because, well, there could be a better right thing to do (like = [2], which is also still needed when using mainline u-boot). Given the state of this issue, at least aligning the code to match = another board's fix =E2=80=94 which already is in the mainline kernel = =E2=80=94 seems a sensible approach to me. It unblocks users like me who = would perhaps otherwise just give up on using these devices. [1] = https://lore.kernel.org/linux-mmc/3364813.APbW32NlgJ@phil/T/#m1b23cd2c43b6= 00b5a6f084461ae53e482ad65316 [2] = https://patchwork.kernel.org/project/linux-mmc/patch/AM3PR03MB09664161A7FA= 2BD68B2800A7AC620@AM3PR03MB0966.eurprd03.prod.outlook.com/