Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp176910ybk; Tue, 19 May 2020 19:04:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3OIhwzvC9kD/yCcMameV5ydgcces0OXzDnIFhlxmASMcRI7vJd5CmwnvORa00l2/34epo X-Received: by 2002:aa7:c80f:: with SMTP id a15mr1409012edt.246.1589940243890; Tue, 19 May 2020 19:04:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589940243; cv=none; d=google.com; s=arc-20160816; b=Y9mWDsAQGp4LF/QCM/msYLhKTHig5X25QE1RGt+IAlkaL+fqjnqZFKoWFOiYSXbai0 jA/ArAF1Y1dsgVJdyLXNmT1EBVJTcD4ws5HdontDuJrw5ZOk5nC7F8TRsQ2vkosXuSYN ZI7orP8A6AH/Nqnf4hFWp04U/pZH1J5AcWx5jnXE4yROixbrLFH6hdgsa2+VQSqUP8fH cuexgeK3vnnXXo4MdcD6+2hagdSmkXOnodyT2H0VXV/Jl50Ra5q9iWipg83XQI41eaMr h5Ey9RfvHmbsdewPUPM0l+fyGUueRWW210lVsDyb4X0EfY+a6kSwMo6pJoLMsZ69fWcr nvjw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=KPB7soD7J+2rNZ3gvE3KrtrvN/sBjcrn52aDdw8Pjws=; b=FQQ5lWflptaFtvA/i0pt4iTxugqS7SMY5DNUSNjQGYTPejv2VBbWNIQu4hoj8XBzyi zRNfHXIPCa2XiABCUNLg6XG075sMCQTRrGjEMBaCFX+Y9U6nn5chzef7dbWQ2htovfF8 n7gU/6pIzqnMKpArDtTJlDlh9s5YlOjlLhC1ftHpmUSka5rikGJ5k48WdpD7PJ8uW6iU /YokA1Rz66g8RsS4O7EhK3hI7sogB/bViEs6BefN6sbGG4A+SOMSO/4le8FxGyJbTtl7 fjVaRWHjOBfRj4TuAytlJTbjEYpH37gTQBf5eVyqZHwN5BeJisLu7gGZewwRgjgZTYY9 W5sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mBsT1tZJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g23si909184ejh.337.2020.05.19.19.03.40; Tue, 19 May 2020 19:04:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=mBsT1tZJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728315AbgETCAI (ORCPT + 99 others); Tue, 19 May 2020 22:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbgETCAH (ORCPT ); Tue, 19 May 2020 22:00:07 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6923C061A0E; Tue, 19 May 2020 19:00:06 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id u15so1840642ljd.3; Tue, 19 May 2020 19:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=KPB7soD7J+2rNZ3gvE3KrtrvN/sBjcrn52aDdw8Pjws=; b=mBsT1tZJhSt6vxQPZ/BCYzbAhB+3oWe2JwUCennisBBIbqrlaZ5XUgD7VmNKsfjFL6 iAAsnPE3CCCBAsIPtkmndKDAe0wJ2Do0xGaPN4iz8jgdHAy56BEBNXoz2Mh2eeVUKQOv l9P8w7AcVftN31qUGAcugNhQW+zlE8gtIsKtvZvG/k0zh3lDOO29AYp52JOsPafRtquR fozygQI3iGh2anWhANFCYNu6C2upG+oAP+Sq2eC4acj7wrEM7Fu6kBSIAF5NdUOYlqhb 3B/bWuLfAEo1tdWBl/IJ1dAe9wXEziG/b0Gz111YQzTKK9++PeAupf43VMRCgbW+tCxT neAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=KPB7soD7J+2rNZ3gvE3KrtrvN/sBjcrn52aDdw8Pjws=; b=WPyNjZctdFhLpR5hzls9460pt7gDC8njcK5t3yfezWJbaXFv/4Usbt+eApnMBWIahC beuIW0oM83yFBYw6GmdU9dHv99r23y0rmwSMC7z6FAZrP7TpDhn+YuHbtvJ2inOrCpUl Fp51LdaQCfaew88HDCdzXNS+SSXTy3bWhV4QzKUgiG4LzL3BUHESVVW+CuyMsBI5s2G8 m2NMR37cgPJw4CSJpXq4H9AsnfVUZt7GBn0l1bvidNaNNLNRGLdHlGEo2V/Cxqk0rMMU 2gJ9o4SSfnaCYG5CvpBck4V8Jlmio2ehu2zV7M7AXK1Q9lxdaeaj/Yy3tRLOW8I9jZoN kZdQ== X-Gm-Message-State: AOAM533f3mF6lcv1LQP+/bNWrS/Ae6pXiB24ZoIIZ1pWgqNFq2z/B9Bp 8cEFNvYq9v+MUoSz/l0pYiP983vA X-Received: by 2002:a2e:9586:: with SMTP id w6mr1317046ljh.274.1589940004655; Tue, 19 May 2020 19:00:04 -0700 (PDT) Received: from [192.168.2.145] (ppp91-78-208-152.pppoe.mtu-net.ru. [91.78.208.152]) by smtp.googlemail.com with ESMTPSA id i26sm573755lfc.21.2020.05.19.19.00.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 May 2020 19:00:03 -0700 (PDT) Subject: Re: [PATCH v1] sdhci: tegra: Remove warnings about missing device-tree properties To: Sowjanya Komatineni , Thierry Reding Cc: Ulf Hansson , Jonathan Hunter , Adrian Hunter , "linux-mmc@vger.kernel.org" , linux-tegra , Linux Kernel Mailing List References: <20200516154314.14769-1-digetx@gmail.com> <20200519162444.GD2113674@ulmo> <11c93dac-f5ba-2193-6f44-63af27fdce09@nvidia.com> From: Dmitry Osipenko Message-ID: Date: Wed, 20 May 2020 05:00:02 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 19.05.2020 23:44, Sowjanya Komatineni пишет: > > On 5/19/20 12:07 PM, Sowjanya Komatineni wrote: >> >> On 5/19/20 11:41 AM, Sowjanya Komatineni wrote: >>> >>> On 5/19/20 11:34 AM, Sowjanya Komatineni wrote: >>>> >>>> On 5/19/20 9:33 AM, Dmitry Osipenko wrote: >>>>> 19.05.2020 19:24, Thierry Reding пишет: >>>>>> On Tue, May 19, 2020 at 05:05:27PM +0300, Dmitry Osipenko wrote: >>>>>>> 19.05.2020 10:28, Ulf Hansson пишет: >>>>>>>> On Sat, 16 May 2020 at 17:44, Dmitry Osipenko >>>>>>>> wrote: >>>>>>>>> Several people asked me about the MMC warnings in the KMSG log and >>>>>>>>> I had to tell to ignore them because these warning are >>>>>>>>> irrelevant to >>>>>>>>> pre-Tegra210 SoCs. >>>>>>>> Why are the warnings irrelevant? >>>>>>> That's what the DT binding doc says [1]. >>>>>>> >>>>>>> [1] >>>>>>> https://www.kernel.org/doc/Documentation/devicetree/bindings/mmc/nvidia%2Ctegra20-sdhci.txt >>>>>>> >>>>>>> >>>>>>> Although, looking at the driver's code and TRM docs, it seems >>>>>>> that all >>>>>>> those properties are really irrelevant only to the older Terga20 >>>>>>> SoC. So >>>>>>> the binding doc is a bit misleading. >>>>>>> >>>>>>> Nevertheless, the binding explicitly says that the properties are >>>>>>> optional, which is correct. >>>>>> Optional only means that drivers must not fail if these properties >>>>>> aren't found, it doesn't mean that the driver can't warn that they >>>>>> are missing. >>>>>> >>>>>> Quite possibly the only reason why they were made optional is because >>>>>> they weren't part of the bindings since the beginning. Anything added >>>>>> to a binding after the first public release has to be optional by >>>>>> definition, otherwise DT ABI wouldn't be stable. >>>>>> >>>>>> I think these warnings were added on purpose, though I also see that >>>>>> there are only values for these in device tree for Tegra186 and >>>>>> Tegra194 >>>>>> but not Tegra210 where these should also be necessary. >>>> >>>> dt binding doc we have is common for MMC, SD and SDIO of all Tegras. >>>> Its not mandatory to have both 3v3 and 1v8 in device tree as based >>>> on signal mode. >>>> >>>> As these driver strengths are SoC specific, they are part of Tegra >>>> SoC specific device tree where same values will be applicable to all >>>> Tegra SoC specific platforms. >>>> >>>> Based on interface usage on platform, we use one or both of them >>>> like sdcard supports dual voltage and we use both 3V3 and 1V8 but if >>>> same interface is used for WIFI SD we use 1V8 only. >>>> >>>> So made these dt properties as optional. >>>> >>>> Other reason they are optional is, Tegra210 and prior has drive >>>> strength settings part of apb_misc and Tegra186 and later has driver >>>> strengths part of SDMMC controller. So, >>>> >>>> - Pinctrls "sdmmc-3v3-drv" and "sdmmc-1v8-drv" for driver strengths >>>> are applicable for Tegra210 and prior. >>>> - dt properties pad-autocal-pull-up/down-offset-1v8/3v3-timeout are >>>> for T186 onwards for driver strengths >>>> >>>> Looks like dt binding doc need fix to clearly document these based >>>> on SoC or agree with Yaml we can conditionally specify pinctrl or dt >>>> properties based on SoC dependent. >>>> >>>> >>>>>> Adding Sowjanya who wrote this code. Perhaps she can clarify why the >>>>>> warnings were added. If these values /should/ be there on a subset of >>>>>> Tegra, then I think we should keep them, or add them again, but >>>>>> perhaps >>>>>> add a better way of identifying when they are necessary and when >>>>>> it is >>>>>> safe to work without them. >>>>>> >>>>>> That said, looking at those checks I wonder if they are perhaps just >>>>>> wrong. Or at the very least they seem redundant. It looks to me like >>>>>> they can just be: >>>>>> >>>>>>     if (tegra_host->pinctrl_state_XYZ == NULL) { >>>>>>         ... >>>>>>     } >>>>>> >>>>>> That !IS_ERR(...) doesn't seem to do anything. But in that case, it's >>>>>> also obvious why we're warning about them on platforms where these >>>>>> properties don't exist in DT. >>>> >>>> As drive strengths are through dt properties for T186 and later and >>>> thru pinctrl for T210 and prior, driver first checks for dt autocal >>>> timeout pull-up/down properties and if they are not found, it then >>>> checks for presence of pinctrl_state_xyx_drv only when valid >>>> pinctrl_state_xyz is present. >>>> >>>> Driver expects either pinctrl or dt properties and shows warning >>>> when neither of them are present as its mandatory to use fixed >>>> driver strengths when auto calibration fails. >>>> >>>>     err = device_property_read_u32(host->mmc->parent, >>>>             "nvidia,pad-autocal-pull-down-offset-3v3-timeout", >>>>             &autocal->pull_down_3v3_timeout); >>>>     if (err) { >>>>         if (!IS_ERR(tegra_host->pinctrl_state_3v3) && >>>>             (tegra_host->pinctrl_state_3v3_drv == NULL)) >>>>             pr_warn("%s: Missing autocal timeout 3v3-pad drvs\n", >>>>                 mmc_hostname(host->mmc)); >>>>         autocal->pull_down_3v3_timeout = 0; >>>>     } >>>> >>>>>> >>>>>> So I think we either need to add those values where appropriate so >>>>>> that >>>>>> the warning doesn't show, or we need to narrow down where they are >>>>>> really needed and add a corresponding condition. >>>>>> >>>>>> But again, perhaps Sowjanya can help clarify if these really are only >>>>>> needed on Tegra210 and later or if these also apply to older chips. >>>>> Either way will be cleaner to convert the DT binding to YAML rather >>>>> than >>>>> clutter the driver, IMO. >>>>> >>>> >>>> >>>> >>> Auto calibration is present from Tegra30 onward and looking into >>> change where autocalibration was added to sdhci driver somehow it was >>> enabled only for T30/T210/T186/T194. >>> >>> tegra_sdhci_parse_pad_autocal_dt() was added when auto-calibration >>> was added to driver and I see this dt parse is being done >>> irrespective of NVQUIRK_HAS_PADCALIB quirk so even on platforms >>> without auto cal enabled in driver, these messages shows up. >>> >>> This should be fixed in driver to allow >>> tegra_sdhci_parse_pad_autocal_dt() only when NVQUIRK_HAS_PADCALIB is >>> set to avoid dt parsing to happen on platforms that don't have auto >>> cal enabled. >> >> Warning on missing drive strengths when auto cal is enabled should be >> present as we should switch to fixed recommended drive strengths when >> auto cal fails. >> >> So probably proper fix should be >> >> - allow tegra_sdhci_parse_pad_autocal_dt() only when >> NVQUIRK_HAS_PADCALIB is set >> >> - current driver sets NVQUIRK_HAS_PADCALIB for T30 as well so need to >> add pinctrls "sdmmc-3v3-drv" and "sdmmc-1v8-drv" to Tegra30 device tree. > [Correction] T30 has same drive strengths to use irrespective of signal > voltage and it doesn't have pad control. So for T3- we can update device > tree to specify "default" pinctrl with drvup/dn settings. >> >> - Keep warning message of missing auto cal timeouts as its mandatory >> to use fixed recommended driver strengths when auto cal fails. >> > Regarding warnings, I guess simpler and easy fix is to remove warning > message on missing 3v3/1v8 drive strengths as pinctrl/dt properties were > already added for T210/186/194 where we need and old device tree don't > have them but the case where auto cal can fail is very rare. > > Otherwise should update driver to allow > tegra_sdhci_parse_pad_autocal_dt() only when NVQUIRK_HAS_PADCALIB is set > and also within tegra_sdhci_parse_pad_autocal_dt() show warning of > missing 3v3/1v8 settings only when NVQUIRK_NEEDS_PAD_CONTROL is set. > > Thierry, please suggest if you prefer to removing warnings or fix driver > to show warning based on PADCALIB and PAD_CONTROL quirks. The SDIO PINCTRL drive-strengths are usually a part of the board's default PINCTRL state, which is either preset by bootloader or by PINCTRL driver early at a boot time. The SDIO drive-strengths values should be board-specific and not SoC-specific because they should depend on the electrical properties of the board, IIUC. If the SDIO PINCTRL states are mandatory for the SDHCI nodes in the device-trees, then the DT binding is wrong since it says that all properties are optional. But I think that the current binding is okay, since today SDHCI PINCTRL drive-strengths are specified implicitly in the device-trees, and thus, there is no real need to emit the noisy warnings in this case.