Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp585754imm; Fri, 13 Jul 2018 02:52:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc1PFjb5KXSPipk0WoyJQVlrNNRm6aPg/lTk9ze6zrleUaAAWa0se5KKFu9H6UE6crcGjWt X-Received: by 2002:a62:cd3:: with SMTP id 80-v6mr6389748pfm.184.1531475532007; Fri, 13 Jul 2018 02:52:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531475531; cv=none; d=google.com; s=arc-20160816; b=G5k7ygwcZU46dHRvb9ZHH0HDK4MsjZr3vhpyqwezFr3cPmBZ+uxIRfebNo4sj7SsPP 49mn6fhHAm0Q+TFyHEkK9b0EXIS4Kin5EXJxLT1NSCsQ8CPvQIODiy4AMePGZ51Gpala IdsI2D6aZQuqL7sdkXzeXzAkBIKeBcw21kb0SAxaa9j+fYFx1HbVY329qSHRCiYstzrB 1UWT9kS2y4Z1AaICw7i2JUmUORS+P7ECEwuLmsREEZvtIk9QS+DXQUoPMKhdhak7fPDT 79VJnnJGoFQMdxkmGF71mcSjWTKBnKhhqOE0n3Y+1FkZWIM8MHwVAuIZXftKtOn1PUzy A8Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=kF/Y0Up3carybFDXfZNTaZ1cnC7YdTQ8zaVvH0js7oI=; b=XKxs1nFa/9hx6+og1d/6CuTOXLe2Yv4X0dZRugJkwbwGL6VfKKMQDPHaPhkA/i0D3w S7nIdFlEUIB/EpG17KdArmms5l7xJd1nhwUPbQrjc32Dz8B7ZG4Hb9i/V5/XytAj7gUX 2Gb5RcdMm4UaLZ4cHZUUflLbxsV0fR7y7aybz0vBnRpnazKZGAon0L6ilKxR+bSey7+Q BgWU4bLPVTZBsW/U0dQC3HtlPYgR7WwjWDKEHd8GJKvCMe779dh4/9849N77VznWZURB q5UsmbzAgfIp5u18CWnyC3Bpsi7Au8CdP4gnGxK2BItff4aA2SYZlxI9cRvk+oalJIoI aMWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j1-v6si4139977pll.493.2018.07.13.02.51.57; Fri, 13 Jul 2018 02:52:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbeGMKEK (ORCPT + 99 others); Fri, 13 Jul 2018 06:04:10 -0400 Received: from hqemgate16.nvidia.com ([216.228.121.65]:4701 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726789AbeGMKEJ (ORCPT ); Fri, 13 Jul 2018 06:04:09 -0400 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1, AES128-SHA) id ; Fri, 13 Jul 2018 02:50:08 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Fri, 13 Jul 2018 02:50:13 -0700 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Fri, 13 Jul 2018 02:50:13 -0700 Received: from dhcp-10-21-25-168 (10.21.25.201) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 13 Jul 2018 09:50:11 +0000 Date: Fri, 13 Jul 2018 12:50:05 +0300 From: Aapo Vienamo To: Marcel Ziswiler CC: "ulf.hansson@linaro.org" , Stefan Agner , "jonathanh@nvidia.com" , "linux-mmc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-tegra@vger.kernel.org" , "thierry.reding@gmail.com" , "adrian.hunter@intel.com" Subject: Re: REGRESSION: [PATCH] mmc: tegra: Use sdhci_pltfm_clk_get_max_clock Message-ID: <20180713125005.69895f06@dhcp-10-21-25-168> In-Reply-To: <1531446183.5479.14.camel@toradex.com> References: <1528126540-27004-1-git-send-email-avienamo@nvidia.com> <1531446183.5479.14.camel@toradex.com> X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.21.25.201] X-ClientProxiedBy: UKMAIL102.nvidia.com (10.26.138.15) To HQMAIL101.nvidia.com (172.20.187.10) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 13 Jul 2018 01:43:05 +0000 Marcel Ziswiler wrote: > On Mon, 2018-07-02 at 15:16 +0200, Ulf Hansson wrote: > > On 4 June 2018 at 17:35, Aapo Vienamo wrote: > > > The sdhci get_max_clock callback is set to > > > sdhci_pltfm_clk_get_max_clock > > > and tegra_sdhci_get_max_clock is removed. It appears that the > > > shdci-tegra specific callback was originally introduced due to the > > > requirement that the host clock has to be twice the bus clock on > > > DDR50 > > > mode. As far as I can tell the only effect the removal has on DDR50 > > > mode > > > is in cases where the parent clock is unable to supply the > > > requested > > > clock rate, causing the DDR50 mode to run at a lower frequency. > > > Currently the DDR50 mode isn't enabled on any of the SoCs and would > > > also > > > require configuring the SDHCI clock divider register to function > > > properly. > > > > > > The problem with tegra_sdhci_get_max_clock is that it divides the > > > clock > > > rate by two and thus artificially limits the maximum frequency of > > > faster > > > signaling modes which don't have the host-bus frequency ratio > > > requirement > > > of DDR50 such as SDR104 and HS200. Furthermore, the call to > > > clk_round_rate() may return an error which isn't handled by > > > tegra_sdhci_get_max_clock. > > > > > > Signed-off-by: Aapo Vienamo > > > > Thanks, applied for next! > > > > Kind regards > > Uffe > > > > > --- > > > drivers/mmc/host/sdhci-tegra.c | 15 ++------------- > > > 1 file changed, 2 insertions(+), 13 deletions(-) > > > > > > diff --git a/drivers/mmc/host/sdhci-tegra.c > > > b/drivers/mmc/host/sdhci-tegra.c > > > index 970d38f6..c8745b5 100644 > > > --- a/drivers/mmc/host/sdhci-tegra.c > > > +++ b/drivers/mmc/host/sdhci-tegra.c > > > @@ -234,17 +234,6 @@ static void > > > tegra_sdhci_set_uhs_signaling(struct sdhci_host *host, > > > sdhci_set_uhs_signaling(host, timing); > > > } > > > > > > -static unsigned int tegra_sdhci_get_max_clock(struct sdhci_host > > > *host) > > > -{ > > > - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > > - > > > - /* > > > - * DDR modes require the host to run at double the card > > > frequency, so > > > - * the maximum rate we can support is half of the module > > > input clock. > > > - */ > > > - return clk_round_rate(pltfm_host->clk, UINT_MAX) / 2; > > > -} > > > - > > > static void tegra_sdhci_set_tap(struct sdhci_host *host, unsigned > > > int tap) > > > { > > > u32 reg; > > > @@ -309,7 +298,7 @@ static const struct sdhci_ops tegra_sdhci_ops = > > > { > > > .platform_execute_tuning = tegra_sdhci_execute_tuning, > > > .set_uhs_signaling = tegra_sdhci_set_uhs_signaling, > > > .voltage_switch = tegra_sdhci_voltage_switch, > > > - .get_max_clock = tegra_sdhci_get_max_clock, > > > + .get_max_clock = sdhci_pltfm_clk_get_max_clock, > > > }; > > > > > > static const struct sdhci_pltfm_data sdhci_tegra20_pdata = { > > > @@ -357,7 +346,7 @@ static const struct sdhci_ops > > > tegra114_sdhci_ops = { > > > .platform_execute_tuning = tegra_sdhci_execute_tuning, > > > .set_uhs_signaling = tegra_sdhci_set_uhs_signaling, > > > .voltage_switch = tegra_sdhci_voltage_switch, > > > - .get_max_clock = tegra_sdhci_get_max_clock, > > > + .get_max_clock = sdhci_pltfm_clk_get_max_clock, > > > }; > > > > > > static const struct sdhci_pltfm_data sdhci_tegra114_pdata = { > > > -- > > > 2.7.4 > > Hm, for us this definitely breaks stuff. While using Stefan's patch set > [1] we may not only run eMMC at DDR52 even SD cards run stable at > SDR104. With this patch however the clock gets crippled to 45.33 resp. > 48 MHz always. This is observed both on Apalis/Colibri T30 as well as > Apalis TK1. Well, strictly speaking this isn't a regression as DDR52/50 modes were not enable at the time when the patch was applied. However, these issues should be addressed properly none the less. The patch was written in preparation of implementing support for higher speed modes like HS200 and HS400, where limiting the max_clock like that isn't an option. Some other solution than reverting the patch has to be found. > Current next-20180712 just with Stefan's 3 patches: > > root@apalis-t30:~# cat /sys/kernel/debug/mmc1/ios > clock: 48000000 Hz > actual clock: 45333333 Hz > vdd: 21 (3.3 ~ 3.4 V) > bus mode: 2 (push-pull) > chip select: 0 (don't care) > power mode: 2 (on) > bus width: 3 (8 bits) > timing spec: 8 (mmc DDR52) > signal voltage: 1 (1.80 V) > driver type: 0 (driver type B) > root@apalis-t30:~# hdparm -t /dev/mmcblk1 > > /dev/mmcblk1: > Timing buffered disk reads: 218 MB in 3.03 seconds = 71.95 MB/sec > > root@apalis-t30:~# cat /sys/kernel/debug/mmc2/ios > clock: 48000000 Hz > actual clock: 48000000 Hz > vdd: 21 (3.3 ~ 3.4 V) > bus mode: 2 (push-pull) > chip select: 0 (don't care) > power mode: 2 (on) > bus width: 2 (4 bits) > timing spec: 6 (sd uhs SDR104) > signal voltage: 1 (1.80 V) > driver type: 0 (driver type B) > root@apalis-t30:~# hdparm -t /dev/mmcblk2 > > /dev/mmcblk2: > Timing buffered disk reads: 66 MB in 3.06 seconds = 21.60 MB/sec > > And with this patch reverted it works as expected again: > > root@apalis-t30:~# cat /sys/kernel/debug/mmc1/ios > clock: 52000000 Hz > actual clock: 51000000 Hz > vdd: 21 (3.3 ~ 3.4 V) > bus mode: 2 (push-pull) > chip select: 0 (don't care) > power mode: 2 (on) > bus width: 3 (8 bits) > timing spec: 8 (mmc DDR52) > signal voltage: 1 (1.80 V) > driver type: 0 (driver type B) > root@apalis-t30:~# hdparm -t /dev/mmcblk1 > > /dev/mmcblk1: > Timing buffered disk reads: 240 MB in 3.02 seconds = 79.50 MB/sec > > root@apalis-t30:~# cat /sys/kernel/debug/mmc2/ios > clock: 204000000 Hz > actual clock: 204000000 Hz > vdd: 21 (3.3 ~ 3.4 V) > bus mode: 2 (push-pull) > chip select: 0 (don't care) > power mode: 2 (on) > bus width: 2 (4 bits) > timing spec: 6 (sd uhs SDR104) > signal voltage: 1 (1.80 V) > driver type: 0 (driver type B) > root@apalis-t30:~# hdparm -t /dev/mmcblk2 > > /dev/mmcblk2: > Timing buffered disk reads: 258 MB in 3.01 seconds = 85.58 MB/sec > > [1] https://lore.kernel.org/lkml/20180712073904.4705-1-stefan@agner.ch The fact that you're getting totally different clocks, especially on SDR104, doesn't make much sense. I'll try to reproduce this and track down what's going on. -Aapo