Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3959719rdb; Thu, 14 Sep 2023 07:52:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFEPK4astU3piDERZZx5+9ziZPoGLBMl4uS6tL5+qi1pTYEyg4Hl/pioDqXXl1dM1rmMj/5 X-Received: by 2002:a05:6a20:430d:b0:159:e1c8:61c2 with SMTP id h13-20020a056a20430d00b00159e1c861c2mr2107315pzk.3.1694703134092; Thu, 14 Sep 2023 07:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694703134; cv=none; d=google.com; s=arc-20160816; b=AgdL2+00Q7YjR7xBBnJucIAqpRBQWq63MHW5TwsQMbAV/ryht33V04rmNj3bvac8S/ nIWfT7L7QGHLUbgxRA0NJkhkSYpmVl0XmjhDq37of7PRveqiFvWtq+SWox7SlgCGRvVR PlZquCaFDEqg2JL4cC/Cq9AngdmJtNxquLz47/ebU4yAB8KMrpffyGhTgovF+hS+deiN BpczY/bYKL+HTal58ZcZZti+z9dU7fKUx3FOx2VMnDWW/1zJey+x4XmIUmX/91YOodvg DKWNLtbZ5PU1aABnF7mRqpIkgrgBAVzp/jTimtmglKGrY1lpMlsYY9AUtR1mDORxn89z zKNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4qtZmBwwjpiJ1Z7K5tiJyvsgnf0O0Obv1kjqllyr8Pc=; fh=xcz9cAxuyYR/IyV9fy6mljD4HaAS1WCX56MtzHHm86w=; b=0LDc3/hg3Ug18QxFzJCEnyQLrp4WEOP9I3VL+UkkYlfmXW7qAQvuFOTAlcp+5xTwd4 fr67kff+wvLTwzYGhhRvz+Rcodloj/fQsnBuTXgF+3Hcr3Fq56r/vhAlm5LfM5Bxmb6k T/3MZy3mC0lhHGqOjt76crS9IE7XSOpe8eqNQNzwrk+QomksNZOl8CJYUNmhVjjM5A6k UA8vvWyDFFi+fSD6F9UDcorDpjrDvZOcQjNlyYozJTMDxtZI+kg/TY6BoRvVap7RcBPO dzSCqcUc3GlwLJ99NCy6ltmRNNTN5CsQvzfYxwEVaijCWKAJIWKfdHybiHX0kdalj5gr aQ8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kpJdpyUL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id i11-20020a636d0b000000b005702257f332si1662119pgc.21.2023.09.14.07.52.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 07:52:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kpJdpyUL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id B67078038FBA; Thu, 14 Sep 2023 07:47:08 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240296AbjINOqf (ORCPT + 99 others); Thu, 14 Sep 2023 10:46:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240293AbjINOqe (ORCPT ); Thu, 14 Sep 2023 10:46:34 -0400 Received: from mail-yb1-xb2e.google.com (mail-yb1-xb2e.google.com [IPv6:2607:f8b0:4864:20::b2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 680361FC8 for ; Thu, 14 Sep 2023 07:46:30 -0700 (PDT) Received: by mail-yb1-xb2e.google.com with SMTP id 3f1490d57ef6-d7e741729a2so1116161276.2 for ; Thu, 14 Sep 2023 07:46:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694702789; x=1695307589; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=4qtZmBwwjpiJ1Z7K5tiJyvsgnf0O0Obv1kjqllyr8Pc=; b=kpJdpyULMiebQx8arQdUZrjCegUNeyZ3VjdNDHMSLx8MphuoQk7wSDuuW3otYilR5n /F/6LNGmvVDZ7cmfHRTXrwZdDF/aGCCefIbA1U8DBBf8ofMOvzbp3oZ2F0qaQCuYVFR1 qepD8+fA5Yd822ug0NfaxuaDVJlylAQvONKplwMjQ/0ia7aB4s0meWWROq1Ioxzo83f8 9HwCOMjzZViAACXA+MK3aU1PrYrRKUFOaUWFXN9fxXD/ekdkGy0n6xI5KRGdzSqE9/05 Z0xD0hrUkhW3EZFprsFX3uus7UxYSY0LygbYU67g7RxrxzLo+8zoxtrmeYL1jPoiO0M7 sfxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694702789; x=1695307589; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=4qtZmBwwjpiJ1Z7K5tiJyvsgnf0O0Obv1kjqllyr8Pc=; b=A8VEmgfNkC/NAkG3oWUlhNA4DoB7xY2ZQSNlX2EwMdj3Gqf1bfmLfAKnwzKmERZCE1 awZpfFZY2erEIz4rdUJPU5whMcxiclkni1mavQ86jV3/NZd2OQomhtDFUf+d3cncjOg8 IWLKCLLlarY5TBJBWBM0kq7ak10MeePE3maAo4QOPE8eRIO4hytWht7+gAZCEjjPrPjY 7fQ/2cMHLZDKlbw2e+Vrn/8XFhPf0CQsxWjID+cMtsc0sjr36UpmaEOQZs44Hqdpc49g TgIqYbzo+0sXweSUWuedSlGlgMzJ70d2CWOWhsU/d/ootjupYiMRc5urLLeEniCXviWf 6nZA== X-Gm-Message-State: AOJu0YwkVshArvRkwBPChFWCr8BaBH7HLqMwY+Xkmqf+vd4AGzHkFaap nr78lPM6HeaI80HqQlrTU3c6+3uGNX0C9krV/yPQGw== X-Received: by 2002:a25:760c:0:b0:d7b:9d44:76dc with SMTP id r12-20020a25760c000000b00d7b9d4476dcmr5924626ybc.38.1694702789586; Thu, 14 Sep 2023 07:46:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ulf Hansson Date: Thu, 14 Sep 2023 16:45:53 +0200 Message-ID: Subject: Re: [PATCH] mmc: meson-mx-sdhc: Fix initialization frozen issue To: Ziyang Huang , martin.blumenstingl@googlemail.com, Thorsten Leemhuis Cc: neil.armstrong@linaro.org, khilman@baylibre.com, jbrunet@baylibre.com, linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Thu, 14 Sep 2023 07:47:08 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email + Thorsten On Mon, 19 Jun 2023 at 19:36, Ziyang Huang wrote: > > Commit 4bc31edebde5 ("mmc: core: Set HS clock speed before sending > HS CMD13") set HS clock (52MHz) before switching to HS mode. For this > freq, FCLK_DIV5 will be selected and div value is 10 (reg value is 9). > Then we set rx_clk_phase to 11 or 15 which is out of range and make > hardware frozen. After we send command request, no irq will be > interrupted and the mmc driver will keep to wait for request finished, > even durning rebooting. > > So let's set a common value - 1 just for initialization. Then let > meson_mx_sdhc_execute_tuning() to find the accurate value for data > transfer. > > Fixes: e4bf1b0970ef ("mmc: host: meson-mx-sdhc: new driver for the Amlogic Meson SDHC host") > Signed-off-by: Ziyang Huang I don't quite understand if this patch is ok for everybody for me to apply? It seems like it solves at least some part of the problems that Martin/Thorsten were looking at too [1], right? Kind regards Uffe [1] https://lore.kernel.org/all/CAFBinCD0RT0p-jk86W0JuMT3ufohRh1RqWCcM35DKZJpuc10HQ@mail.gmail.com/#r > --- > drivers/mmc/host/meson-mx-sdhc-mmc.c | 26 +++----------------------- > 1 file changed, 3 insertions(+), 23 deletions(-) > > diff --git a/drivers/mmc/host/meson-mx-sdhc-mmc.c b/drivers/mmc/host/meson-mx-sdhc-mmc.c > index da85c2f2..a01090a2 100644 > --- a/drivers/mmc/host/meson-mx-sdhc-mmc.c > +++ b/drivers/mmc/host/meson-mx-sdhc-mmc.c > @@ -269,7 +269,6 @@ static int meson_mx_sdhc_enable_clks(struct mmc_host *mmc) > static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios) > { > struct meson_mx_sdhc_host *host = mmc_priv(mmc); > - u32 rx_clk_phase; > int ret; > > meson_mx_sdhc_disable_clks(mmc); > @@ -290,31 +289,12 @@ static int meson_mx_sdhc_set_clk(struct mmc_host *mmc, struct mmc_ios *ios) > mmc->actual_clock = clk_get_rate(host->sd_clk); > > /* > - * according to Amlogic the following latching points are > - * selected with empirical values, there is no (known) formula > - * to calculate these. > + * This value is just for initialization. For data transmission, > + * meson_mx_sdhc_execute_tuning() will find a accurate value > */ > - if (mmc->actual_clock > 100000000) { > - rx_clk_phase = 1; > - } else if (mmc->actual_clock > 45000000) { > - if (ios->signal_voltage == MMC_SIGNAL_VOLTAGE_330) > - rx_clk_phase = 15; > - else > - rx_clk_phase = 11; > - } else if (mmc->actual_clock >= 25000000) { > - rx_clk_phase = 15; > - } else if (mmc->actual_clock > 5000000) { > - rx_clk_phase = 23; > - } else if (mmc->actual_clock > 1000000) { > - rx_clk_phase = 55; > - } else { > - rx_clk_phase = 1061; > - } > - > regmap_update_bits(host->regmap, MESON_SDHC_CLK2, > MESON_SDHC_CLK2_RX_CLK_PHASE, > - FIELD_PREP(MESON_SDHC_CLK2_RX_CLK_PHASE, > - rx_clk_phase)); > + FIELD_PREP(MESON_SDHC_CLK2_RX_CLK_PHASE, 1)); > } else { > mmc->actual_clock = 0; > } > -- > 2.34.1 >