Message ID | 20221110150035.2824580-1-adeep@lexina.in |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp204052wru; Thu, 10 Nov 2022 07:13:51 -0800 (PST) X-Google-Smtp-Source: AMsMyM7j9ITm+cZwpSpuF7RANLwx8x2dGXuCYQuILF1LgCM9aRTRm4jgrthhbUIe+9EEbCOtqM6E X-Received: by 2002:a50:aad7:0:b0:461:d726:438f with SMTP id r23-20020a50aad7000000b00461d726438fmr2492137edc.333.1668093230969; Thu, 10 Nov 2022 07:13:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668093230; cv=none; d=google.com; s=arc-20160816; b=ujctchNnMO+1gV8J3mv85ah6cczT8nWcsif2p1sEQMWj4jgQ+bxZq3RB6EV60dH/QI LFB6sK76w1klbya61YBqzfZl/qiuumS3DwOSlupNBkRqnpemf4N3Bk/RJc6SyAw3V8WZ Fc5ouiHb6YKFOSWxhBfbY1U3Zus0yrN2x1/hpkgbbUACMy200KDVKBTzPXnrwrIpGdsP vBWpFH8Jmd3xxecAfAZCgUhyeibiDnKYIuHxda+EPS7m7JgKuYYf0XOIt81e/B/NPvRX 2TL8/OTUGsgE5ekVnD4W7AbfRXO7qAL5PYsJyGSCmaCKgxOMDAapOV7QXPFXRJq0uHsF 3HHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:to:from:dkim-signature; bh=OTEcSrKbeEwGEfVJ7rDTBCJPtPYB3owKDL9ENQiVtws=; b=uU7RhR8mbTuucJjz/9sJ7JjtneKIzH5M8QA1VsCRN17P8UtAGcnvhBVfdNu6wERtE0 /Gs4Hw6rna+3JlO4j/vIztRCjSGDBm9bjZKO6JVmQsJGaglQD9PvgxJIiwQy4tX+f+Zf aUJ+MO/TjT+1jESdkN1ndAHOXB0h6RagP8mVOnXhD6qIF9qvG8aniV0M6JuBraildn/Q ftCTQURowY0i9S2iGLjj6wGlFEzN43+PUft+859Gv4ijM5MRnhcDvpW8OIAmhVTo9+To CabldmFVeQriVIq7t7NjdxjYp/l35STYaRSUeVF0XV2AU/zBitoS49hEI3UBGgRZ6H/n pp9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lexina.in header.s=dkim header.b="r/vrCUS6"; 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=QUARANTINE sp=REJECT dis=NONE) header.from=lexina.in Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc29-20020a1709071c1d00b007ae0211844dsi19430647ejc.937.2022.11.10.07.13.27; Thu, 10 Nov 2022 07:13:50 -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=@lexina.in header.s=dkim header.b="r/vrCUS6"; 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=QUARANTINE sp=REJECT dis=NONE) header.from=lexina.in Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbiKJPIt (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Thu, 10 Nov 2022 10:08:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbiKJPIm (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 10 Nov 2022 10:08:42 -0500 X-Greylist: delayed 450 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 10 Nov 2022 07:08:39 PST Received: from mx.msync.work (mx.msync.work [185.250.0.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F02122B35; Thu, 10 Nov 2022 07:08:38 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 990931231BE; Thu, 10 Nov 2022 15:01:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lexina.in; s=dkim; t=1668092467; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding; bh=OTEcSrKbeEwGEfVJ7rDTBCJPtPYB3owKDL9ENQiVtws=; b=r/vrCUS6kd2GZejTmbFjVRuqxeY+xmENmIllYtzTlrrpwlYS+FSTKH4+ZDcETN4KgJdwg5 pX47Cb4mQ4XvzAd8lmVJWw9xHd/sFGRZ/OBmS5aTUxPPpbIp3/JryjxXB5dEcKTLeyRseG rqL/FX0NUI6ZGxSoezA17RxFnHI5AoYMqtr+5s8/w/FpVdb9ECdFP63lwBn6VbhKFPQoX5 iMBLrmPJLpr/L1S0ZnEHaLF/fcpHfHGpn3HlVf203H4rv8O/BEIQzDoIWjlcB3XWi30EgP 34m027fzMNaEIyZVWDROYiUS9ZvfJZEEzwIZHCkke6EIB/MPxzOD9dhKabUmeA== From: Vyacheslav Bocharov <adeep@lexina.in> To: linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] arm64: amlogic: mmc: meson-gx: Add core, tx, rx Date: Thu, 10 Nov 2022 18:00:31 +0300 Message-Id: <20221110150035.2824580-1-adeep@lexina.in> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749122527600087548?= X-GMAIL-MSGID: =?utf-8?q?1749122527600087548?= |
Series |
arm64: amlogic: mmc: meson-gx: Add core, tx, rx
|
|
Message
Viacheslav
Nov. 10, 2022, 3 p.m. UTC
The mmc driver use the same phase values (core - 180, tx/rx - 0) for all meson64 platforms. However, some platforms (and even some boards) require different values (axg for example use 270 degree for core clock). This patch transfers the values from the code to the variables in the device-tree files. If not set in dts, use old default values. Vyacheslav Bocharov (4): arm64: amlogic: mmc: meson-gx: Add core, tx, rx eMMC/SD/SDIO phase clock settings from devicetree data arm64: amlogic: mmc: meson-gx: Add dts binding include for core, tx, rx eMMC/SD/SDIO phase clock settings from devicetree data arm64: amlogic: dts: meson: update meson-axg device-tree for new core, tx, rx phase clock settings. arm64: dts: docs: Update mmc meson-gx documentation for new config option amlogic,mmc-phase .../bindings/mmc/amlogic,meson-gx.txt | 7 ++++ arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 3 ++ drivers/mmc/host/meson-gx-mmc.c | 18 +++++++--- include/dt-bindings/mmc/meson-gx-mmc.h | 35 +++++++++++++++++++ 4 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 include/dt-bindings/mmc/meson-gx-mmc.h
Comments
On Thu 10 Nov 2022 at 18:00, Vyacheslav Bocharov <adeep@lexina.in> wrote: > The mmc driver use the same phase values (core - 180, tx/rx - 0) for all > meson64 platforms. However, some platforms (and even some boards) require > different values Where does it stops ? Trying to solve the instabilities of this IP/driver by tweaking the phase has proven to be dead-end. Soon, you'll end up tweaking these settings depending on the on particular version of the device because it ships with a different eMMC manufacturer. Then comes multi sourcing, sdio modules, sdcards ... > (axg for example use 270 degree for core clock). Where ? Upstream linux does not u-boot does something of the sort for sm1 and I'm not entirely sure this appropriate either. IMO, this setting has more to do with the mode the mmc device is operating at - not the platform or board. We had some discussions with the HW designers at AML and they recommended to keep a phase shift of 180 between the Core and Tx. They also recommended to leave Rx alone (actually, starting from the v3, the Rx field has no effect. It is not even wired to actual HW) Funnily, that is not what the vendor driver does. It also does A LOT of extremely complex and 'debatable' things, which mostly mask how much the driver is unstable. With the upstream drivers, modes up to SDR50 and HS200 have been stable lately. SDR104 and DDR modes (DDR52 or HS400) remains problematic. Changing the settings further would require more discussion with AML. Blindly poking these value until you get something stablish for 1 particular use case is a recipe for disaster. > This patch > transfers the values from the code to the variables in the device-tree files. > If not set in dts, use old default values. I think going that way is opening a big can of worms. I don't think this should be applied > > Vyacheslav Bocharov (4): > arm64: amlogic: mmc: meson-gx: Add core, tx, rx eMMC/SD/SDIO phase > clock settings from devicetree data > arm64: amlogic: mmc: meson-gx: Add dts binding include for core, tx, > rx eMMC/SD/SDIO phase clock settings from devicetree data > arm64: amlogic: dts: meson: update meson-axg device-tree for new core, > tx, rx phase clock settings. > arm64: dts: docs: Update mmc meson-gx documentation for new config > option amlogic,mmc-phase > > .../bindings/mmc/amlogic,meson-gx.txt | 7 ++++ > arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 3 ++ > drivers/mmc/host/meson-gx-mmc.c | 18 +++++++--- > include/dt-bindings/mmc/meson-gx-mmc.h | 35 +++++++++++++++++++ > 4 files changed, 58 insertions(+), 5 deletions(-) > create mode 100644 include/dt-bindings/mmc/meson-gx-mmc.h
Hi! Thanks for reply. Sorry for delay. 13.11.2022 23:06, Jerome Brunet wrote: > > On Thu 10 Nov 2022 at 18:00, Vyacheslav Bocharov <adeep@lexina.in> wrote: > >> The mmc driver use the same phase values (core - 180, tx/rx - 0) for all >> meson64 platforms. However, some platforms (and even some boards) require >> different values > > Where does it stops ? Trying to solve the instabilities of this > IP/driver by tweaking the phase has proven to be dead-end. As a result, there is now a stalemate and various real-world operating system projects use patches to change clock phases. > > Soon, you'll end up tweaking these settings depending on the on > particular version of the device because it ships with a different eMMC > manufacturer. Then comes multi sourcing, sdio modules, sdcards ... > >> (axg for example use 270 degree for core clock). > > Where ? Upstream linux does not Armbian/Home Assistant OS use core phase 270 for axg/g12/sm1 boards (patches by Neil). On JetHub devices phase 270 is need with eMMC more than 16Gb size. > > u-boot does something of the sort for sm1 and I'm not entirely sure this > appropriate either. U-boot in Armbian/HAOS use same phase 270 or/and force low speed mode for eMMC (limit clock freq). > > IMO, this setting has more to do with the mode the mmc device is > operating at - not the platform or board. > > We had some discussions with the HW designers at AML and they recommended > to keep a phase shift of 180 between the Core and Tx. They also > recommended to leave Rx alone (actually, starting from the v3, the Rx > field has no effect. It is not even wired to actual HW) I do not have access to AML engineers :) I can only test settings on several different boards. And it seems that the phase settings depend not only on the board layout, but also on the eMMC chip used. What to do about this (if not to use the magic of the driver from AML) other than providing the ability to change the value in devicetree for each board I can't think of yet. > > Funnily, that is not what the vendor driver does. It also does A LOT of > extremely complex and 'debatable' things, which mostly mask how much the > driver is unstable. As far as I understand they just go through all possible values until the first successful attempt to initialize the device. What do you think of the idea to implement such a variant for the meson-gx driver? > > With the upstream drivers, modes up to SDR50 and HS200 have been stable > lately. SDR104 and DDR modes (DDR52 or HS400) remains problematic. I have troubles with HS200, for example: Card Type [CARD_TYPE: 0x57] HS200 Single Data Rate eMMC @200MHz 1.8VI/O HS Dual Data Rate eMMC @52MHz 1.8V or 3VI/O HS eMMC @52MHz - at rated device voltage(s) HS eMMC @26MHz - at rated device voltage(s) > > Changing the settings further would require more discussion with AML. > Blindly poking these value until you get something stablish for 1 > particular use case is a recipe for disaster. I assumed the idea that the dts are edited by the maintainers or the board developers and will be able to choose the values themselves. > >> This patch >> transfers the values from the code to the variables in the device-tree files. >> If not set in dts, use old default values. > > I think going that way is opening a big can of worms. > I don't think this should be applied > >> >> Vyacheslav Bocharov (4): >> arm64: amlogic: mmc: meson-gx: Add core, tx, rx eMMC/SD/SDIO phase >> clock settings from devicetree data >> arm64: amlogic: mmc: meson-gx: Add dts binding include for core, tx, >> rx eMMC/SD/SDIO phase clock settings from devicetree data >> arm64: amlogic: dts: meson: update meson-axg device-tree for new core, >> tx, rx phase clock settings. >> arm64: dts: docs: Update mmc meson-gx documentation for new config >> option amlogic,mmc-phase >> >> .../bindings/mmc/amlogic,meson-gx.txt | 7 ++++ >> arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 3 ++ >> drivers/mmc/host/meson-gx-mmc.c | 18 +++++++--- >> include/dt-bindings/mmc/meson-gx-mmc.h | 35 +++++++++++++++++++ >> 4 files changed, 58 insertions(+), 5 deletions(-) >> create mode 100644 include/dt-bindings/mmc/meson-gx-mmc.h > > > _______________________________________________ > linux-amlogic mailing list > linux-amlogic@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-amlogic
On Thu 24 Nov 2022 at 09:22, Vyacheslav <adeep@lexina.in> wrote: > Hi! > Thanks for reply. Sorry for delay. > > > 13.11.2022 23:06, Jerome Brunet wrote: >> On Thu 10 Nov 2022 at 18:00, Vyacheslav Bocharov <adeep@lexina.in> wrote: >> >>> The mmc driver use the same phase values (core - 180, tx/rx - 0) for all >>> meson64 platforms. However, some platforms (and even some boards) require >>> different values >> Where does it stops ? Trying to solve the instabilities of this >> IP/driver by tweaking the phase has proven to be dead-end. > > As a result, there is now a stalemate and various real-world operating > system projects use patches to change clock phases. > The current setting has seen its fair share of "real world" testing too, before being applied. It does need more work, sure. It does not make what is proposed here appropriate. > >> Soon, you'll end up tweaking these settings depending on the on >> particular version of the device because it ships with a different eMMC >> manufacturer. Then comes multi sourcing, sdio modules, sdcards ... >> >>> (axg for example use 270 degree for core clock). >> Where ? Upstream linux does not > > Armbian/Home Assistant OS use core phase 270 for axg/g12/sm1 boards > (patches by Neil). On JetHub devices phase 270 is need with eMMC more than > 16Gb size. Size has nothing to do with this. Few boards electing to do something else does justify making this a DT config. It just shows the controller still need work. > >> u-boot does something of the sort for sm1 and I'm not entirely sure this >> appropriate either. > > U-boot in Armbian/HAOS use same phase 270 or/and force low speed mode for > eMMC (limit clock freq). > >> IMO, this setting has more to do with the mode the mmc device is >> operating at - not the platform or board. >> We had some discussions with the HW designers at AML and they recommended >> to keep a phase shift of 180 between the Core and Tx. They also >> recommended to leave Rx alone (actually, starting from the v3, the Rx >> field has no effect. It is not even wired to actual HW) > > I do not have access to AML engineers :) > I can only test settings on several different boards. And it seems that the > phase settings depend not only on the board layout, but also on the eMMC > chip used. What are you going to do when a manufacturer does multi-sourcing then ? Make one DT per PCB/eMMC chip combination ? It is wrong and does not scale. > What to do about this (if not to use the magic of the driver > from AML) other than providing the ability to change the value in > devicetree for each board I can't think of yet. > >> Funnily, that is not what the vendor driver does. It also does A LOT of >> extremely complex and 'debatable' things, which mostly mask how much the >> driver is unstable. > > As far as I understand they just go through all possible values until the > first successful attempt to initialize the device. > What do you think of the idea to implement such a variant for the meson-gx > driver? What the amlogic driver does are overly complex computation to get a tuning value, which is then contiously cycled (in the IRQ handler!!) while silently retrying failed transaction behind MMC core's back That's far from being desirable. > >> With the upstream drivers, modes up to SDR50 and HS200 have been stable >> lately. SDR104 and DDR modes (DDR52 or HS400) remains problematic. > > I have troubles with HS200, for example: > Card Type [CARD_TYPE: 0x57] > HS200 Single Data Rate eMMC @200MHz 1.8VI/O > HS Dual Data Rate eMMC @52MHz 1.8V or 3VI/O > HS eMMC @52MHz - at rated device voltage(s) > HS eMMC @26MHz - at rated device voltage(s) > That does not says with which mode or at which stage the problem occurs >> Changing the settings further would require more discussion with AML. >> Blindly poking these value until you get something stablish for 1 >> particular use case is a recipe for disaster. > > I assumed the idea that the dts are edited by the maintainers or the board > developers and will be able to choose the values themselves. > And eventually, we'll end-up telling people to adjust the phases depending of the sdcard they insert ... This does not work for me. I understand the will to get this working at full speed. I've spent A LOT more time than would have wanted in this driver, trying to do exactly that. There is quite an history about that on this list detailing why changes have been made. It was stable(ish) for while. Now we are getting more reports of problems. This (again) shows this need more work. It also shows there are still things we don't know about this controller and this where it gets tricky because there is high risk of causing regressions with each change. Let's leave Rx (which has no effect) and Tx out for now. My guess is the core phase might need to be adapted depending on * Mode: It seems the DDR modes are done by making the controller run faster then diving the output clock by 2. This divider might mess up the phase shift needed. * Speed: Maybe there is delay contraint between the input clock and the core and we need at adapting the phase shift depending on the rate ? I think what could be tried - with a LOOONG RFT giving a chance people to report regressions - is: * Defaulting the Core phase to 270: Despite AML HW engineer recommendation, this is what the vendor code does. Maybe this will help with board that seems to require 270 to start. I know if stays for all modes, it will cause problems 1) Set 180 when switching to DDR modes 2) Wether switching to 180 for high speed SDR modes (UHS, HS200) is required, or not, is a bit unclear. If the problem is the internal divider, it should not be required. If the problem is the delay, maybe it is. > >> >>> This patch >>> transfers the values from the code to the variables in the device-tree files. >>> If not set in dts, use old default values. >> I think going that way is opening a big can of worms. >> I don't think this should be applied >> >>> >>> Vyacheslav Bocharov (4): >>> arm64: amlogic: mmc: meson-gx: Add core, tx, rx eMMC/SD/SDIO phase >>> clock settings from devicetree data >>> arm64: amlogic: mmc: meson-gx: Add dts binding include for core, tx, >>> rx eMMC/SD/SDIO phase clock settings from devicetree data >>> arm64: amlogic: dts: meson: update meson-axg device-tree for new core, >>> tx, rx phase clock settings. >>> arm64: dts: docs: Update mmc meson-gx documentation for new config >>> option amlogic,mmc-phase >>> >>> .../bindings/mmc/amlogic,meson-gx.txt | 7 ++++ >>> arch/arm64/boot/dts/amlogic/meson-axg.dtsi | 3 ++ >>> drivers/mmc/host/meson-gx-mmc.c | 18 +++++++--- >>> include/dt-bindings/mmc/meson-gx-mmc.h | 35 +++++++++++++++++++ >>> 4 files changed, 58 insertions(+), 5 deletions(-) >>> create mode 100644 include/dt-bindings/mmc/meson-gx-mmc.h >> _______________________________________________ >> linux-amlogic mailing list >> linux-amlogic@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-amlogic