Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp740651imw; Fri, 15 Jul 2022 11:59:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1scxzUxrMk8lAbGcBH+08vgD9vszQqf6yaedRKRAno6gsev2l0TUZwPU8YHd9EPHcD1izAd X-Received: by 2002:a17:902:988a:b0:16a:7f1b:552 with SMTP id s10-20020a170902988a00b0016a7f1b0552mr14966873plp.60.1657911560027; Fri, 15 Jul 2022 11:59:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657911560; cv=none; d=google.com; s=arc-20160816; b=eTkm79Swf3mJ0Gpcvf5my7i4Fxg0nVvJ5Q4BJ+J2ph9KtZ+D5uEI3mLW8zTMkq8Q3P JMpfk7Cs2M2c/IatSMV5Ab9nupYE1FU0HauETAy2620qElwfLKhWf+k2EetuMW6XM1bA KXEHz4ZEK4fQhjXuyUhRgmHQsH+Y5rcv+Q1SvS+FCm9oDdSGvdW/1po6RKSFbOhKmCwD wqxxGq2y6ruchvcZoICWak1qVQbV04e7RM4Lqf6JyL7pq6yVycP6nm4AH3lS+e4mff7f DR3wSJh3UD84Ch+EUZi719kJ5Xt86Zw3LSzS28bAVQ+t9vJZ3a2nnPIlzO3N+AQER9/n wv7A== 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=cGwhK/ZtvSr9wwZc7/rNFgjUf04Hq4lw/c5RyLtXhv4=; b=TGjTCx6U+nxdGAgL0xQf3MB/E7uGbuJgRFye504+Lm4hc2KF07VksQO4xHF21Tj8LE f+89ygBh3nNdFbXlQ7Czd2yWGwNNVQQ9cwaCTEYMsCypr4sGDICPJHRYglqqU03vFqjs UUpl2lNQfRGDssSMNvUKdx98aRY/zwhfoIYN1EvsJvbkfvKA78oj8pa9IT9Jq8Rimteh eUZGbBBsHQi49jSp6TzLY7fIU844M+08DPaWcTAOj1b1Nl0vAvj+9WUH7CvNlspBVipf nvkfDMcTJnRB0eoH/mbhHpcNO1zKnQayiEEmV640dtXm9XrVatiCOMzWD/B4AHGEWFkB OVsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kohlschutter-com.20210112.gappssmtp.com header.s=20210112 header.b=n30FiJMd; 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 c5-20020a170902d48500b0016a573b9b45si7326991plg.447.2022.07.15.11.59.04; Fri, 15 Jul 2022 11:59:20 -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=n30FiJMd; 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 S230325AbiGOS5b (ORCPT + 99 others); Fri, 15 Jul 2022 14:57:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229538AbiGOS5a (ORCPT ); Fri, 15 Jul 2022 14:57:30 -0400 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79DB33B969 for ; Fri, 15 Jul 2022 11:57:28 -0700 (PDT) Received: by mail-ed1-x52f.google.com with SMTP id fd6so7440044edb.5 for ; Fri, 15 Jul 2022 11:57:28 -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=cGwhK/ZtvSr9wwZc7/rNFgjUf04Hq4lw/c5RyLtXhv4=; b=n30FiJMdCmOAUiVxpAmFVASHuizhc6AX2acGIQrmGWi2ITlMu7dy5tY3GAusQZCwUX mClk0//XWWNtoKOlVDp3bevjwUCPlPu6qT58ckogGwW3fiPwV3AnX1JH80Tcv/qvJxbD dd2hnpWUh+kbDnSUzqOnXj71sddyRZYkIlR5uwqBsXNmW8E86IjtsWgCOCj96w7UTJh1 ekclrrbo31eDkn55oa2xD7ZY8kZCRduEeNmKBSZ3yK6cNK/PRrM+v1/yUUWmbSW8KzBk 1G3I9oE8dPOml71Mav31UBLpfptw3Ree6F9LzjmopmoauGHoWKXK8zG7iMIjoX2r53ev BDow== 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=cGwhK/ZtvSr9wwZc7/rNFgjUf04Hq4lw/c5RyLtXhv4=; b=P3i1lad+Yz7Ln4Ex/IkC+bi1/c7C377rFboLbXDijFu++4EzpxDLEGgFf2f1vkvoex nSt9cTYXPzBeKQPlIWr6CNA/bGzkP2/LAkWfOegURMrDG7QgOmB2+om800ejnanQpFUd 0QVxm88j5mG1DTAknMcGRlTmUXWPkZAECUrv6pTy6P0AVFViS1sltAuJ0vc2ABcnpJWr EfgV+kzW0QkRWLiwp3OONn028dEcSOck/lkiwLTMMGML/nX9SlJATiG+pAv4Bubii8bD LhUmlWW5nyfdALomCb4WSBKCEHZaEvkrbylpyal2tMQiqfSP0doOcBVwW0ajQpH2NwDt QvBQ== X-Gm-Message-State: AJIora/xMhmU00Tz2mgr8Od0AsA8xeuOnB9mi0dNMb8bOe+17eo4kYON u/nlwNOM/Rer8F0ue2wfVBkErA== X-Received: by 2002:a05:6402:40d6:b0:43a:cc69:1db9 with SMTP id z22-20020a05640240d600b0043acc691db9mr20997614edb.380.1657911447021; Fri, 15 Jul 2022 11:57:27 -0700 (PDT) Received: from smtpclient.apple (ip5b434222.dynamic.kabel-deutschland.de. [91.67.66.34]) by smtp.gmail.com with ESMTPSA id o18-20020a170906769200b00726abf9a32bsm2329648ejm.138.2022.07.15.11.57.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Jul 2022 11:57:25 -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 v4] arm64: dts: rockchip: Fix SD card init on rk3399-nanopi4 From: =?utf-8?Q?Christian_Kohlsch=C3=BCtter?= In-Reply-To: <17a4c6f6-d79c-a7b2-860f-e5944b778f9f@arm.com> Date: Fri, 15 Jul 2022 20:57:24 +0200 Cc: wens@kernel.org, =?utf-8?Q?Heiko_St=C3=BCbner?= , Markus Reichl , linux-arm-kernel , "open list:ARM/Rockchip SoC..." , linux-kernel , Linux MMC List Content-Transfer-Encoding: quoted-printable Message-Id: 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> <5ca9bd94-54d9-04f8-0098-a56ffb6f5fe1@arm.com> <502b3fbe-3077-407e-6010-a8cb3ffce7d6@arm.com> <449292CA-CE60-4B90-90F7-295FBFEAB3F8@kohlschutter.com> <73F9AED0-D2A8-4294-B6E1-1B92D2A36529@kohlschutter.com> <115AD6A4-021B-4879-BFB5-BC7689A0203E@kohlschutter.com> <17a4c6f6-d79c-a7b2-860f-e5944b778f9f@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 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 15.07.2022 um 20:11 schrieb Robin Murphy : >=20 > On 2022-07-15 18:16, Christian Kohlsch=C3=BCtter wrote: >> OK, this took me a while to figure out. >> When no undervoltage limit is configured, I can reliably trigger the = initialization bug upon boot. >> When the limit is set to 3.0V, it rarely occurs, but just after I = send the v3 patch, I was able to reproduce... >=20 > Well this has to be in the running for "weirdest placebo ever"... :/ >=20 > All it actually seems to achieve is printing an error[1] (this is = after all a tiny 5-pin fixed-voltage LDO regulator, not an intelligent = PMIC), and if that makes an appreciable difference then there has to be = some kind of weird timing condition at play. Maybe regulator_register() = ends up turning it off and on again rapidly enough that the card sees a = voltage brownout and glitches, and adding more delay by printing to the = console somewhere in the middle gives it enough time to act as a proper = power cycle with no ill effect? That's definitely something between placebo and homeopathy :-) I can confirm that setting a limit higher than 3.0V still works, which = means that the one time incident where it still crashed means that = there's indeed a timing issue at play, and adding that undervoltage = statement (unlike the ramp-delay configs that I also tried) added just = enough of a delay that made it work 99 out of 100 times. > If you just whack something like an mdelay(500) at around that point = in set_machine_constraints(), without the DT property, does it have the = same effect? Adding a delay for vcc3v0_sd works, which is great! (patch below) Is there an existing path from device-tree parser to regular/core.c that = we can use to specify this delay specifically for this regulator? Also, what delay should we choose to make sure it works all the time and = not just 99 out of 100 times? Best, Christian diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index c4d844ffad7a..0e15ec2548f4 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1483,6 +1483,11 @@ static int set_machine_constraints(struct = regulator_dev *rdev) "IC does not support requested over voltage = limits\n"); } =20 +if(!strncmp(rdev_get_name(rdev),"vcc3v0_sd",sizeof("vcc3v0_sd"))) { + rdev_err(rdev, "DELAY: %s\n", rdev_get_name(rdev)); + mdelay(500); +} + if (rdev->constraints->under_voltage_detection) ret =3D handle_notify_limits(rdev, = ops->set_under_voltage_protection,