From patchwork Thu Sep 17 09:45:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alim Akhtar X-Patchwork-Id: 7205171 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AE9289F39B for ; Thu, 17 Sep 2015 09:58:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C3608207EF for ; Thu, 17 Sep 2015 09:58:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B49A8206F4 for ; Thu, 17 Sep 2015 09:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754016AbbIQJ6W (ORCPT ); Thu, 17 Sep 2015 05:58:22 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:55923 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753497AbbIQJyy (ORCPT ); Thu, 17 Sep 2015 05:54:54 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NUT02UKWFJEGIA0@mailout1.samsung.com>; Thu, 17 Sep 2015 18:54:50 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.125]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id CE.3C.29324.AED8AF55; Thu, 17 Sep 2015 18:54:50 +0900 (KST) X-AuditID: cbfee68d-f79106d00000728c-eb-55fa8dea251f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 26.3C.23663.AED8AF55; Thu, 17 Sep 2015 18:54:50 +0900 (KST) Received: from exypnos.sisodomain.com ([107.108.73.28]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NUT000DPFIZ1D40@mmp1.samsung.com>; Thu, 17 Sep 2015 18:54:50 +0900 (KST) From: Alim Akhtar To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: JBottomley@odin.com, vinholikatti@gmail.com, amit.daniel@samsung.com, essuuj@gmail.com, devicetree@vger.kernel.org Subject: [PATCH v2 07/11] scsi: ufs: add add specific callback for hibern8 Date: Thu, 17 Sep 2015 15:15:33 +0530 Message-id: <1442483137-32376-8-git-send-email-alim.akhtar@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1442483137-32376-1-git-send-email-alim.akhtar@samsung.com> References: <1442483137-32376-1-git-send-email-alim.akhtar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsWyRsSkVvdV769Qg1tXpCwaroZYzD9yjtVi +YUlTBb/199msbi8aw6bRff1HWwWOxZWObB77Jx1l93j8I8fzB59W1YxenzeJBfAEsVlk5Ka k1mWWqRvl8CVsej4c9aChXIV54+dYmpgnC7ZxcjJISFgIvF+711GCFtM4sK99WwgtpDACkaJ A/sM4Wr6XjJ3MXIBxZcCxXtuM0E4Pxklrn1YBNbNJqAtcXf6FiYQW0TARuL8zQdgNrNAhcSt MxNYuhg5OIQFvCTOdKmBhFkEVCXOvn/GCmLzCrhL/F9wnxlimaJE97MJYEdwCnhIvPq/iBWk VQio5vyGWpC1EgKT2SU23X7MAjFHQOLb5ENg4yUEZCU2HYAaIylxcMUNlgmMwgsYGVYxiqYW JBcUJ6UXGeoVJ+YWl+al6yXn525iBAb16X/Pencw3j5gfYhRgINRiYdXweVXqBBrYllxZe4h RlOgDROZpUST84Gxk1cSb2hsZmRhamJqbGRuaaYkzqso9TNYSCA9sSQ1OzW1ILUovqg0J7X4 ECM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XNswIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Seungwon Jeon Some host controller needs specific handling before/after (un)hibernation, This change adds specific callback function to support vendor's implementation. Signed-off-by: Seungwon Jeon Signed-off-by: Alim Akhtar --- drivers/scsi/ufs/ufshcd.c | 36 ++++++++++++++++++++++++++++++++---- drivers/scsi/ufs/ufshcd.h | 3 +++ 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 2f0de4b..ccf7c83 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -181,8 +181,7 @@ 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_uic_hibern8_exit(struct ufs_hba *hba); -static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba); +static int ufshcd_uic_hibern8_ctrl(struct ufs_hba *hba, bool en); static inline void ufshcd_add_delay_before_dme_cmd(struct ufs_hba *hba); static int ufshcd_host_reset_and_restore(struct ufs_hba *hba); static irqreturn_t ufshcd_intr(int irq, void *__hba); @@ -215,6 +214,16 @@ static inline void ufshcd_disable_irq(struct ufs_hba *hba) } } +static inline int ufshcd_uic_hibern8_enter(struct ufs_hba *hba) +{ + return ufshcd_uic_hibern8_ctrl(hba, true); +} + +static inline int ufshcd_uic_hibern8_exit(struct ufs_hba *hba) +{ + return ufshcd_uic_hibern8_ctrl(hba, false); +} + /* * ufshcd_wait_for_register - wait for register value to change * @hba - per-adapter interface @@ -2395,7 +2404,7 @@ out: return ret; } -static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba) +static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba) { struct uic_command uic_cmd = {0}; @@ -2404,7 +2413,7 @@ static int ufshcd_uic_hibern8_enter(struct ufs_hba *hba) return ufshcd_uic_pwr_ctrl(hba, &uic_cmd); } -static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba) +static int __ufshcd_uic_hibern8_exit(struct ufs_hba *hba) { struct uic_command uic_cmd = {0}; int ret; @@ -2419,6 +2428,25 @@ static int ufshcd_uic_hibern8_exit(struct ufs_hba *hba) return ret; } +static int ufshcd_uic_hibern8_ctrl(struct ufs_hba *hba, bool en) +{ + int ret; + + if (hba->vops && hba->vops->hibern8_notify) + hba->vops->hibern8_notify(hba, en, PRE_CHANGE); + + ret = en ? __ufshcd_uic_hibern8_enter(hba) : + __ufshcd_uic_hibern8_exit(hba); + if (ret) + goto out; + + if (hba->vops && hba->vops->hibern8_notify) + hba->vops->hibern8_notify(hba, en, POST_CHANGE); + +out: + return ret; +} + /** * ufshcd_init_pwr_info - setting the POR (power on reset) * values in hba power info diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index 149d74e..2fd0c3c 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -260,6 +260,8 @@ struct ufs_pwr_mode_info { * @specify_nexus_t_xfer_req: * @specify_nexus_t_tm_req: called before command is issued to allow vendor * specific handling to be set for nexus type. + * @hibern8_notify: called before and after hibernate/unhibernate is carried out + * to allow vendor spesific implementation. * @suspend: called during host controller PM callback * @resume: called during host controller PM callback */ @@ -276,6 +278,7 @@ struct ufs_hba_variant_ops { int (*pwr_change_notify)(struct ufs_hba *, bool, struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); + void (*hibern8_notify)(struct ufs_hba *, bool, bool); void (*specify_nexus_t_xfer_req)(struct ufs_hba *, int, struct scsi_cmnd *); void (*specify_nexus_t_tm_req)(struct ufs_hba *, int, u8);