Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp384269rwb; Fri, 18 Nov 2022 02:58:22 -0800 (PST) X-Google-Smtp-Source: AA0mqf5YGN90dSyM5S7tTGhZ2gr997I6Gozkp7MP/PoRFw8N1sP5UDPdPo8BZv5fFtUwaNkId/Xd X-Received: by 2002:a63:165d:0:b0:473:f7cd:6603 with SMTP id 29-20020a63165d000000b00473f7cd6603mr6272808pgw.336.1668769102071; Fri, 18 Nov 2022 02:58:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668769102; cv=none; d=google.com; s=arc-20160816; b=Q/YMW/gsU9yAb6pZwOfOdrFQADcegcz8hKW55AY/bBk5OdgKm9Ze3GCaxPeRQuyMMs ilEFlbjgcnlP3xz7f7Hce0FybaT4UBGhlrVDP9tTrJQ3IzRpckw1769HFsP4N6nZzlbZ sMzc2XGH99Uyxbo2Hfqm5WHx37EmjtJyAN5lecuc2i85MHYglMx69Q40g7AOr7sXeqQZ XWSVWlPYBcDmduqbmSdQr6L9mpcaxmqwEc5vZ8fSN3pa+2Hq7gQ0zw1wv2OaJGeGqv1S pAP4FWzB8bkbCyk+EuHKAws+7zYBmi6IHeDAoQBGnQUjOSn0eTMMUb+G6EatLHuKvxIH JsYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3uh3YxDgspkB68SJoIPbAc50d6XGVfp5931wp78ekCo=; b=GWqSye+cf0z+hucb/a0e+CaOEiCN/NN5PZGDJcLGiwGjv7qGYlVRIx5FryHtW0qj++ bPsjSd6TBCzNIHF+ifynCNfl1fLbgAeZ0cdrUN8BSgp6kTYhNBzYOuP5fbAcoYAMgTPV LLbPB8v3+ob+taGx6nUJ1Oqe0wpNe26SClxIVBEt+ixHguYkc2WHODRqMEYFz3PHtNNm 0hnZ1T8Z9VliuMFJMfCcOWkZ39SZC5g4ht3DKCMO9hmV7NZzymsfI7GlgCfMvuAAFnfB azB9jFcNaJ+dtIY/muqJAYyJPzcAGtkUBfTFKXqMcVwDQyFmJmYXuW1DzapXNI4pNzyn 7GTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hs2eonUz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mi12-20020a17090b4b4c00b0021409ca96c2si3471239pjb.23.2022.11.18.02.58.09; Fri, 18 Nov 2022 02:58:22 -0800 (PST) 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=@linaro.org header.s=google header.b=hs2eonUz; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241936AbiKRKHO (ORCPT + 91 others); Fri, 18 Nov 2022 05:07:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39000 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241709AbiKRKG6 (ORCPT ); Fri, 18 Nov 2022 05:06:58 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E358FB1E for ; Fri, 18 Nov 2022 02:06:57 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id w23so4117270ply.12 for ; Fri, 18 Nov 2022 02:06:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3uh3YxDgspkB68SJoIPbAc50d6XGVfp5931wp78ekCo=; b=hs2eonUzH3U51NbUg0vNsd5tQ0Z1HqnyDlCfH1qE2oZqGApg8MIgzun6Ze88oUOO/J ewfn0OyHrsF1os3fvp7YGC8JJ1uA2Tm4oVxe7VmZPu4u2Z/2jzgbXpwHhKnfKNi6PTtH xDsl5Hy5omYexkgisVxzwjIjvNdCwPRbcjI9IZA18WnC6VgBVo6XM9a4jWJzFePT4z4J cAuMJ2KMk2I+tlNpkmr7eLUIZaEgi//zFzKchwN+H3insIS+AWPiXIxQ0IB1MRYkPah+ LJahjP8cnuCmkW9s1TX+6iZd1TC49N0+EMAl5NwX7WXgsvg4ypBGLikFouVUct2V0y5x LAiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=3uh3YxDgspkB68SJoIPbAc50d6XGVfp5931wp78ekCo=; b=NysI7CeYca3BdTYmO0EEhR04vmSFpZ504s2o96B+eDwmMKQu1v9482gb0Cwyle3GTN 0y3CpT3vyaaDmf7SdSqsZh0UxucjNhxKMoqk24UiOCxA6neff9ToL/zvzfIPJSy17tEH 9C2CuNDb7jptEVRMrlLeExVqmtktcSZlavyTZj41BpvqICOFKxQ/VVemG4cZTWkQrOO5 6eA592VSkcGCXlfko2eOSOncZKwXZ2TPioHEcv7BVU1JKrcOwatPBNPiHGuVWiSSdTtn UFw3irxBctVvnXPvPRZlJhMa54ZI57TlWYpnl6URxOQGpA3kgOusaP9KalXirAjFPIPD N6Cg== X-Gm-Message-State: ANoB5pkoVWnp7Mexdwr6CwmtdXYte1MzRFMs3htMLnGSKRr4p/wM0Uif 0dU4YoKMTkCQNKRYwYuzFOMQtPJ8sjBrgnyl/bC6Pg== X-Received: by 2002:a17:902:bcc9:b0:186:be05:798e with SMTP id o9-20020a170902bcc900b00186be05798emr6832336pls.37.1668766016568; Fri, 18 Nov 2022 02:06:56 -0800 (PST) MIME-Version: 1.0 References: <20221108045300.2084671-1-lis8215@gmail.com> <20221108045300.2084671-2-lis8215@gmail.com> <59EJLR.DQ7KHQEAEUSG2@crapouillou.net> In-Reply-To: From: Ulf Hansson Date: Fri, 18 Nov 2022 11:06:19 +0100 Message-ID: Subject: Re: [PATCH 1/2] mmc: jz4740: Don't change parent clock rate for some SoCs To: Siarhei Volkau Cc: Paul Cercueil , Rob Herring , Krzysztof Kozlowski , Thomas Bogendoerfer , linux-mips@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 18 Nov 2022 at 10:52, Siarhei Volkau wrote: > > =D0=BF=D1=82, 18 =D0=BD=D0=BE=D1=8F=D0=B1. 2022 =D0=B3. =D0=B2 12:27, Pau= l Cercueil : > > > > Hi, > > > > (Ingenic SoCs maintainer here) > > > > Le ven. 18 nov. 2022 =C3=A0 09:45:48 +0100, Ulf Hansson > > a =C3=A9crit : > > > On Tue, 8 Nov 2022 at 05:53, Siarhei Volkau wrote= : > > >> > > >> Some SoCs have one clock divider for all MMC units, thus changing > > >> one > > >> affects others as well. This leads to random hangs and memory > > >> corruptions, observed on the JZ4755 based device with two MMC slots > > >> used at the same time. > > > > > > Urgh, that sounds like broken HW to me. > > > > > > The MMC blocks could share a parent clock (that would need a fixed > > > rate for it to be applied), assuming there is a separate gate/divider > > > available per block. But there isn't'? > > > > They do share a parent clock and have separate gates, and each MMC IP > > block has an internal divider for the bus frequency derived from that > > shared clock. > > > > >> > > >> List of SoCs affected includes: JZ4725b, JZ4755, JZ4760 and JZ4760b= . > > >> However, the MMC driver doesn't distinguish JZ4760 and JZ4770 > > >> which shall remain its behavior. For the JZ4755 is sufficient to > > >> use JZ4725b's binding. JZ4750 is outside of the patch. > > >> > > >> The MMC core has its own clock divisor, rather coarse but suitable > > >> well, > > >> and it shall keep the role of tuning clock for the MMC host in that > > >> case. > > > > > > The mmc core doesn't have a clock divisor, but it does control the bu= s > > > clock frequency through the ->set_ios() host ops. It needs to do that= , > > > to be able to conform to the (e)MMC, SD and SDIO specifications. > > > > > > Can you please try to elaborate on the above, so I can better > > > understand your point? > > > > Yes, I don't really understand the patch, TBH. > > > > The "clk_set_rate" call will only set the shared clock to the *maximum* > > clock frequency (host->mmc->f_max) which should be the exact same > > across all MMC IPs. > > That's the case I need different "f_max" for my HW, for some reason > internal slot can't do a full rate (48MHz) but the external can, the same > card used for checking. So I want to set 24M for mmc0, and 48M for mmc1 > with respect to hardware limitation. This sounds like a board specific problem, right? The simple solution would be to use 24M for both hosts, but that would unnecessarily degrade the speed for the host for the internal slot. It sounds like we need a new DT binding to describe a capped max-frequency for the "broken slot". And in case that is available in the DTS, the mmc->f_max value should be overridden with it, while also respecting the original f_max value while calling clk_set_rate(). Br Uffe