Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2443643ybh; Mon, 5 Aug 2019 01:02:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXC51qcAYq40egZ40BQmXa0QwPegqQbk9BBq/5/wSIHSJw5pQq9q8QTX+R411QpxpVp+ha X-Received: by 2002:a63:5c7:: with SMTP id 190mr132726907pgf.67.1564992164551; Mon, 05 Aug 2019 01:02:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564992164; cv=none; d=google.com; s=arc-20160816; b=pDWcBdSB4uyulZeD1YCsMma1ph72WECETP8WR7CGNeRXOyWDQJeHkEbEXm+zrPkxFn HhHDrDZxgkrSOKpiy2UhlgO2DHKtoqEOH3ZVhsnuFg8mOPa0AiHW6882cou1y7b3rYEy BAV0bzY95LmiS0HxolrEut/M+nVVv7UVgCDUd8MH2vUY7AK5u+30PpFvKjZIWnP4xyxs di5s2CUqXoKMnx1QwPRlXJWy1bS+YniBua+k+upchyk29DAZHpEFSq0pZ27Z+wb9xNF6 YwPjZkBX/S9YkfizVozQBv01JEoLEcHEfim7I3mZHpmC0fQ+IwYErBnsLwNlVJ1uLssJ vY0A== 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=7sv9PjcFwV9v+UJTNk3jI9UE2QxN5A6jgKLgQowNCpA=; b=AXAhW0beL+zink3M7PSl27n4CfWnj/f/hUlOmlZkegx7Dzba1tJWM/JV8p/PSyVRgr 3pYV1euLQpYJ5nW6FMZjV8QXkzeoYdW7onTQ4UXEvi3Nh5TZKqd/49ocH5IL8YxxEXK+ jZ2rLROgvDCdTxucFT3uN4K2xetL67SCdxb5oc0hhdZmiNaxIwchPgUbL/lqMcRoaHTn e5fEVOjSMOT+URskRbKflgWGI2zbLfp2NxjafjGbqYU7/J+9w1MUpcPX9KpQE/t2cCDk 54Pz/nZ/iLkZ5ixbYvFSnK4/sGH4zq3eDYJJyTfu5us/j42UEV6czfTm/WvVgm25gdiI r5Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=SiF6CtKi; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q26si23395254pgt.233.2019.08.05.01.02.29; Mon, 05 Aug 2019 01:02:44 -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; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=SiF6CtKi; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727651AbfHEIBy (ORCPT + 99 others); Mon, 5 Aug 2019 04:01:54 -0400 Received: from fllv0016.ext.ti.com ([198.47.19.142]:41184 "EHLO fllv0016.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726423AbfHEIBy (ORCPT ); Mon, 5 Aug 2019 04:01:54 -0400 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id x7581as8080687; Mon, 5 Aug 2019 03:01:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1564992096; bh=7sv9PjcFwV9v+UJTNk3jI9UE2QxN5A6jgKLgQowNCpA=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=SiF6CtKiRta8wjwuDh6WKaoLpEknj8qZReXU80pe5XITEbLAgQB1fZ5DI1OOqCb8h gQavyEiEzJ38lDba9+y0Q67tuDu0ZME1wMXXpCUzo3Dmq8VrcPhC+joI4mPtiNAjIO VJZ5w29F/ZYK13NaeL1JEE9uHWFUD+DcQ5BZjsbQ= Received: from DFLE114.ent.ti.com (dfle114.ent.ti.com [10.64.6.35]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x7581ZWM112160 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 5 Aug 2019 03:01:36 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Mon, 5 Aug 2019 03:01:35 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Mon, 5 Aug 2019 03:01:35 -0500 Received: from [172.24.145.136] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x7581VBW040191; Mon, 5 Aug 2019 03:01:31 -0500 Subject: Re: [PATCH v2] scsi: ufs: Configure clock in .hce_enable_notify() in Cadence UFS To: Anil Varughese , , , CC: , , , , , , , , References: <20190802112112.18714-1-aniljoy@cadence.com> From: Vignesh Raghavendra Message-ID: <86985e8d-2aa8-5583-f899-925191f2041d@ti.com> Date: Mon, 5 Aug 2019 13:32:14 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190802112112.18714-1-aniljoy@cadence.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 02/08/19 4:51 PM, Anil Varughese wrote: > Configure CDNS_UFS_REG_HCLKDIV in .hce_enable_notify() instead of > .setup_clock() because if UFSHCD resets the controller ip because > of phy or device related errors then CDNS_UFS_REG_HCLKDIV is > reset to default value and .setup_clock() is not called later > in the sequence whereas .hce_enable_notify will be called everytime > controller is reenabled. > > Signed-off-by: Anil Varughese > --- Reviewed-by: Vignesh Raghavendra > drivers/scsi/ufs/cdns-pltfrm.c | 13 ++++++------- > 1 file changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/scsi/ufs/cdns-pltfrm.c b/drivers/scsi/ufs/cdns-pltfrm.c > index 86dbb723f..993519080 100644 > --- a/drivers/scsi/ufs/cdns-pltfrm.c > +++ b/drivers/scsi/ufs/cdns-pltfrm.c > @@ -62,17 +62,16 @@ static int cdns_ufs_set_hclkdiv(struct ufs_hba *hba) > } > > /** > - * Sets clocks used by the controller > + * Called before and after HCE enable bit is set. > * @hba: host controller instance > - * @on: if true, enable clocks, otherwise disable > * @status: notify stage (pre, post change) > * > * Return zero for success and non-zero for failure > */ > -static int cdns_ufs_setup_clocks(struct ufs_hba *hba, bool on, > - enum ufs_notify_change_status status) > +static int cdns_ufs_hce_enable_notify(struct ufs_hba *hba, > + enum ufs_notify_change_status status) > { > - if ((!on) || (status == PRE_CHANGE)) > + if (status != PRE_CHANGE) > return 0; > > return cdns_ufs_set_hclkdiv(hba); > @@ -114,13 +113,13 @@ static int cdns_ufs_m31_16nm_phy_initialization(struct ufs_hba *hba) > > static const struct ufs_hba_variant_ops cdns_ufs_pltfm_hba_vops = { > .name = "cdns-ufs-pltfm", > - .setup_clocks = cdns_ufs_setup_clocks, > + .hce_enable_notify = cdns_ufs_hce_enable_notify, > }; > > static const struct ufs_hba_variant_ops cdns_ufs_m31_16nm_pltfm_hba_vops = { > .name = "cdns-ufs-pltfm", > .init = cdns_ufs_init, > - .setup_clocks = cdns_ufs_setup_clocks, > + .hce_enable_notify = cdns_ufs_hce_enable_notify, > .phy_initialization = cdns_ufs_m31_16nm_phy_initialization, > }; > > -- Regards Vignesh