Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp757904ima; Wed, 6 Feb 2019 07:55:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IbxjTfQMw7lM9YQq4LxMJ3gLgnmWCVEpl6an5e0Ce/hcmLrVwatj9DHx+y8mi1eb+nO0VmV X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr11553435plp.180.1549468534969; Wed, 06 Feb 2019 07:55:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549468534; cv=none; d=google.com; s=arc-20160816; b=s8zu8a/Dz1wi2BXlXzEZw3r9IZo19NzFSd/8vispC8DRlhLlFJNc0aUW8uprqkQT7R NGdUhXY/7VKxIvRzkiBD7j4224oQu0irbezyjjAYpXuwtr6xqGDOS6D0CWt8SvmF5d3W XNi/sX+uR/8FZ0DB6FQU64p4eQIOq0r35fwVWAI2b/CbekLkMwb/mlv3TC74IVXHLMZf i202xhuoXGJvWVV9aeXSoDChQy3xGg79J+XbaUo+UBfwesF22wvDBR72q3esdVPP6Lcx En9yx2TgmEnaGkvG8RCOPV3WLwxvyLCjQug/tKgjG3Vb3UTwQVUIl3KtHL3cBDTtWHuX xj2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:cc:to:subject:dkim-signature :dkim-filter; bh=0Jck/3w7jJbPg7bdH//gM6dKMHh23tgrPpTn0jkACfg=; b=nTQMf/YdG0QRZEL+nIb2CeT80nUvSoumppaCJAxxal13jdtTOe5LZJpxxIOLd6E8LI x1e+BVxgqvb6ZhSK/SNU5S2PAg9foUW2byaVQKXCf5Z5i6g9DBT8nKnkL/OohNe7ozeO 4cTogh+G6W+1V7FCL8avZvbJ2zLqb3XRGNjQb76W9/Wnlg2mY5BlIRchuEXFsTelJqyn 012jugwXiT3+Ho2jpz0db2IsimuMi0c/J2+60QjhdSZC0n9kvjBv9z8KY70QmmzL1912 dWedHjSlxFVrelUtb2Sx3PsAG6LalW3Xmj6uOnqUXe74xiG7v53v4Ytpxbrn4+PbQT34 YlHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=U87xh9g7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v69si2307735pgd.284.2019.02.06.07.55.17; Wed, 06 Feb 2019 07:55:34 -0800 (PST) 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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=U87xh9g7; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730568AbfBFPkl (ORCPT + 99 others); Wed, 6 Feb 2019 10:40:41 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:57982 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730540AbfBFPkl (ORCPT ); Wed, 6 Feb 2019 10:40:41 -0500 Received: from epcas5p3.samsung.com (unknown [182.195.41.41]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20190206154038epoutp04bb32264f23c515ff389e2f9f54cb33d5~A0JuerpNj1458414584epoutp04O for ; Wed, 6 Feb 2019 15:40:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20190206154038epoutp04bb32264f23c515ff389e2f9f54cb33d5~A0JuerpNj1458414584epoutp04O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1549467638; bh=0Jck/3w7jJbPg7bdH//gM6dKMHh23tgrPpTn0jkACfg=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=U87xh9g7hjr2MjqhvM6GleuEmiaGe3ZhTn0//O4qy1h6RNGIctVpXp1BZcaDhvWI8 A7oxyS2BLS+MMTuN6jQMtzZYN0//2COxj4C+Qx2+qJ1cnTNfiiXAkLMR66u5IApUXA S2UbRRGE9Zwn8UUo7nZAjnIN7DwoYqhcBVdK17z0= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20190206154037epcas5p300e703361103e333805e317e1007733a~A0JtytwUF0140801408epcas5p3c; Wed, 6 Feb 2019 15:40:37 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id B7.E3.04135.5FFFA5C5; Thu, 7 Feb 2019 00:40:37 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p3.samsung.com (KnoxPortal) with ESMTPA id 20190206154037epcas5p3e2f6d586bd0423ab2fb8b37861627884~A0JtEMMaj0125901259epcas5p3f; Wed, 6 Feb 2019 15:40:37 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190206154037epsmtrp23f425a2ae0494f0a183c0960b41db661~A0JtC420L1292812928epsmtrp2F; Wed, 6 Feb 2019 15:40:37 +0000 (GMT) X-AuditID: b6c32a49-bc7ff70000001027-ba-5c5afff567a0 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id EC.1E.03971.4FFFA5C5; Thu, 7 Feb 2019 00:40:36 +0900 (KST) Received: from [107.108.73.28] (unknown [107.108.73.28]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190206154034epsmtip1468718c430a23f8fc2a6a4144c2c770c~A0JrF07HJ1207012070epsmtip16; Wed, 6 Feb 2019 15:40:34 +0000 (GMT) Subject: Re: [PATCH v3 5/5] Revert "scsi: ufs: disable vccq if it's not needed by UFS device" To: Bjorn Andersson Cc: Marc Gonzalez , MSM , LKML , Jeffrey Hugo , Andy Gross , David Brown , Evan Green , Douglas Anderson , Avri Altman , Pedro Sousa , Subhash Jadavani , Bart Van Assche , SCSI From: Alim Akhtar Message-ID: <64b97f5b-fac3-5348-7118-b5edc72901df@samsung.com> Date: Wed, 6 Feb 2019 20:53:33 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20190205194607.GH31919@minitux> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUhTYRTGee+9u15Hk9tUPGlfjKRU/EqDC4aJFFwx0P4JNUmHXlR0Uze1 DwwMs/IzTXA5P9M0WlQoupY2/NaGGsnUxCxhWmmxFU0L0TC3W+R/v3Oe5+G85/BSuHhe4E6l yXM4hVyaISGFhHbI66jv+nZcfMDsSCCzbQhiVjdmSGa8z0IwNd83cOZrczliJtsHSKZoUYUx 00spTFXfpANj7KknmdK3OpLRWidx5sboOsHMtb4gw5xY43QkW1cwRbDGinKMvfPUKmAXZl+S bFefFbHWzoPsrf5SLJqKE55M5jLS8jiFf2iiMFVjGXPIKgu5rKt5hAqQ0a8EURTQwTBtuFqC hJSY7kUwN16BSpDjTvEDwaIpnxd+ItC0PrELtsDSSjfGC3oEay0fSb4wIzCv6giby5lOgErN DGZjFzoARiaMhM2E0wUEmIof2k0k7QPvVV12k4gOhaVXbwQ2Jugj0L31nbSxKx0DQ+UWxHv2 gqF22Z51pH2hUaWy93HaDeaXmzCeD8Fzcz3OP1XjANpf13g+DYWTOoxn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G3omKEWBPLiitzDzFKcDArifC+fQYU4k1JrKxKLcqPLyrNSS0+xCjNwaIkzvs071ikkEB6 YklqdmpqQWoRTJaJg1OqgXHytr1TDzs9+aQd22ysxHJ2wR4Bnu2dexU/FHsriZj+npy7qr66 8q2Yv+LTWk2mS64GgbISHyY2rC3QSv/qbr0n1Nde/F8D1/b4QOEKmfrHDcmblE4a3tQLu7g8 NPpy/c5L/VW/9qR6LZed83+C41OH3QZFwh8XN9+cGHGvQvPK5J/L5xWYSyqxFGckGmoxFxUn AgCd11HjyAIAAA== X-CMS-MailID: 20190206154037epcas5p3e2f6d586bd0423ab2fb8b37861627884 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" CMS-TYPE: 105P X-CMS-RootMailID: 20190204174549epcas4p4682667176f55101f69cc24cc455c9f3c References: <70618c25-83f0-b9db-51a3-c1d74b605a45@free.fr> <5f2a8378-1f22-6a52-356d-56d3b393ab1d@samsung.com> <20190205062720.GF31919@minitux> <20190205194607.GH31919@minitux> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/02/19 1:16 AM, Bjorn Andersson wrote: > On Tue 05 Feb 02:52 PST 2019, Alim Akhtar wrote: > >> Hi Bjorn, >> >> On 05/02/19 11:57 AM, Bjorn Andersson wrote: >>> On Mon 04 Feb 20:58 PST 2019, Alim Akhtar wrote: >>> >>>> Hi Marc, >>>> >>>> On 04/02/19 11:12 PM, Marc Gonzalez wrote: >>>>> This reverts commit 60f0187031c05e04cbadffb62f557d0ff3564490. >>>>> >>>>> Calling ufshcd_set_vccq_rail_unused hangs my system. >>>>> It seems vccq is not *not* needed. >>>>> >>>>> Signed-off-by: Marc Gonzalez >>>>> --- >>>> >>>> AFAIK Samsung and Toshiba UFS devices does not use VCCQ (this pin is >>>> either floating or connected to Ground, at least on the devices that I >>>> have worked on). >>> >>> But why does such system define a vccq-supply? If the system doesn't >>> have a regulator connected to VCCQ, then the UFS driver shouldn't be >>> told that there is one. And if VCCQ is optional the UFS driver should >>> support the fact that this regulator might not be supplied (i.e. call >>> regulator_get_optional() and handle the error indicating that the supply >>> isn't specified). >>> >> As per JESD220C, chapter 6.1, it does says "VCCQ - Supply voltage used >> typically for the memory controller and optionally for the PHY >> interface, the memory IO, and any other internal very low voltage block" >> And we have VCCQ2 - which serve the pretty much same purpose. The >> voltage range for VCCQ and VCCQ2 are different, VCCQ has a lower voltage >> suitable to some low voltage block inside UFS device. I think this is >> design consideration which allow some vendor to use one less physical >> pin may be. And also depends on the voltage requirements of some of the >> internal circuit. >> > > This looks to me that you are required to have a VCCQ. But you said that > you do not have a regulator supplying VCCQ on your board, and if that > really is the case then you should not specify vccq-supply. > > The patch Marc is reverting states that for devices that does not have > VCCQ connected, some unrelated regulator should be assigned to the UFS > driver so that it can turn it off. > > > If you have a regulator connected to VCCQ then it should go in > vccq-supply, if you have a regulator connected to VCCQ2 the is should go > in vccq2-supply. If you don't have these pins connected then there > shouldn't be any regulators specified here! > Yes, that's correct, it should be like what you are suggesting, DT entries should match the board schematic. > Regards, > Bjorn > >> >>> Regards, >>> Bjorn >>> >>>> You said your system hanged, I believe you have set UFS_DEVICE_NO_VCCQ >>>> quirks, in that case VCCQ regulator should having been disabled. >>>> So you mean your system hanged because vccq regulator got disabled? >>>> >>>>> drivers/scsi/ufs/ufs.h | 1 - >>>>> drivers/scsi/ufs/ufshcd.c | 59 +++------------------------------------ >>>>> 2 files changed, 4 insertions(+), 56 deletions(-) >>>>> >>>>> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h >>>>> index dd65fea07687..7da7318eb6a6 100644 >>>>> --- a/drivers/scsi/ufs/ufs.h >>>>> +++ b/drivers/scsi/ufs/ufs.h >>>>> @@ -514,7 +514,6 @@ struct ufs_vreg { >>>>> struct regulator *reg; >>>>> const char *name; >>>>> bool enabled; >>>>> - bool unused; >>>>> int min_uV; >>>>> int max_uV; >>>>> int min_uA; >>>>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c >>>>> index 9ba7671b84f8..8b9a01073d62 100644 >>>>> --- a/drivers/scsi/ufs/ufshcd.c >>>>> +++ b/drivers/scsi/ufs/ufshcd.c >>>>> @@ -245,7 +245,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba); >>>>> static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, >>>>> bool skip_ref_clk); >>>>> static int ufshcd_setup_clocks(struct ufs_hba *hba, bool on); >>>>> -static int ufshcd_set_vccq_rail_unused(struct ufs_hba *hba, bool unused); >>>>> static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba); >>>>> static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba); >>>>> static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba); >>>>> @@ -6819,11 +6818,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) >>>>> ufs_fixup_device_setup(hba, &card); >>>>> ufshcd_tune_unipro_params(hba); >>>>> >>>>> - ret = ufshcd_set_vccq_rail_unused(hba, >>>>> - (hba->dev_quirks & UFS_DEVICE_NO_VCCQ) ? true : false); >>>>> - if (ret) >>>>> - goto out; >>>>> - >>>>> /* UFS device is also active now */ >>>>> ufshcd_set_ufs_dev_active(hba); >>>>> ufshcd_force_reset_auto_bkops(hba); >>>>> @@ -7007,24 +7001,13 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg, >>>>> static inline int ufshcd_config_vreg_lpm(struct ufs_hba *hba, >>>>> struct ufs_vreg *vreg) >>>>> { >>>>> - if (!vreg) >>>>> - return 0; >>>>> - else if (vreg->unused) >>>>> - return 0; >>>>> - else >>>>> - return ufshcd_config_vreg_load(hba->dev, vreg, >>>>> - UFS_VREG_LPM_LOAD_UA); >>>>> + return ufshcd_config_vreg_load(hba->dev, vreg, UFS_VREG_LPM_LOAD_UA); >>>>> } >>>>> >>>>> static inline int ufshcd_config_vreg_hpm(struct ufs_hba *hba, >>>>> struct ufs_vreg *vreg) >>>>> { >>>>> - if (!vreg) >>>>> - return 0; >>>>> - else if (vreg->unused) >>>>> - return 0; >>>>> - else >>>>> - return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); >>>>> + return ufshcd_config_vreg_load(hba->dev, vreg, vreg->max_uA); >>>>> } >>>>> >>>>> static int ufshcd_config_vreg(struct device *dev, >>>>> @@ -7062,9 +7045,7 @@ static int ufshcd_enable_vreg(struct device *dev, struct ufs_vreg *vreg) >>>>> { >>>>> int ret = 0; >>>>> >>>>> - if (!vreg) >>>>> - goto out; >>>>> - else if (vreg->enabled || vreg->unused) >>>>> + if (!vreg || vreg->enabled) >>>>> goto out; >>>>> >>>>> ret = ufshcd_config_vreg(dev, vreg, true); >>>>> @@ -7084,9 +7065,7 @@ static int ufshcd_disable_vreg(struct device *dev, struct ufs_vreg *vreg) >>>>> { >>>>> int ret = 0; >>>>> >>>>> - if (!vreg) >>>>> - goto out; >>>>> - else if (!vreg->enabled || vreg->unused) >>>>> + if (!vreg || !vreg->enabled) >>>>> goto out; >>>>> >>>>> ret = regulator_disable(vreg->reg); >>>>> @@ -7192,36 +7171,6 @@ static int ufshcd_init_hba_vreg(struct ufs_hba *hba) >>>>> return 0; >>>>> } >>>>> >>>>> -static int ufshcd_set_vccq_rail_unused(struct ufs_hba *hba, bool unused) >>>>> -{ >>>>> - int ret = 0; >>>>> - struct ufs_vreg_info *info = &hba->vreg_info; >>>>> - >>>>> - if (!info) >>>>> - goto out; >>>>> - else if (!info->vccq) >>>>> - goto out; >>>>> - >>>>> - if (unused) { >>>>> - /* shut off the rail here */ >>>>> - ret = ufshcd_toggle_vreg(hba->dev, info->vccq, false); >>>>> - /* >>>>> - * Mark this rail as no longer used, so it doesn't get enabled >>>>> - * later by mistake >>>>> - */ >>>>> - if (!ret) >>>>> - info->vccq->unused = true; >>>>> - } else { >>>>> - /* >>>>> - * rail should have been already enabled hence just make sure >>>>> - * that unused flag is cleared. >>>>> - */ >>>>> - info->vccq->unused = false; >>>>> - } >>>>> -out: >>>>> - return ret; >>>>> -} >>>>> - >>>>> static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on, >>>>> bool skip_ref_clk) >>>>> { >>>>> >>> >>> > >