From patchwork Fri Aug 21 09:27:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alim Akhtar X-Patchwork-Id: 7050781 Return-Path: X-Original-To: patchwork-linux-scsi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 23D19C05AC for ; Fri, 21 Aug 2015 09:38:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68D66205F4 for ; Fri, 21 Aug 2015 09:38:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E266202FE for ; Fri, 21 Aug 2015 09:38:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753893AbbHUJiv (ORCPT ); Fri, 21 Aug 2015 05:38:51 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:57182 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753762AbbHUJit (ORCPT ); Fri, 21 Aug 2015 05:38:49 -0400 Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NTF02HM1ES7GQ50@mailout3.samsung.com>; Fri, 21 Aug 2015 18:38:31 +0900 (KST) Received: from epcpsbgm1new.samsung.com ( [172.20.52.122]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 5B.BF.17770.791F6D55; Fri, 21 Aug 2015 18:38:31 +0900 (KST) X-AuditID: cbfee691-f79ca6d00000456a-da-55d6f1973242 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 0D.08.23663.791F6D55; Fri, 21 Aug 2015 18:38:31 +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 <0NTF008WKEOTM680@mmp1.samsung.com>; Fri, 21 Aug 2015 18:38:31 +0900 (KST) From: Alim Akhtar To: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: vinholikatti@gmail.com, JBottomley@odin.com, Seungwon Jeon Subject: [PATCH 07/10] scsi: ufs: add add specific callback for hibern8 Date: Fri, 21 Aug 2015 14:57:58 +0530 Message-id: <1440149281-26336-8-git-send-email-alim.akhtar@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1440149281-26336-1-git-send-email-alim.akhtar@samsung.com> References: <1440149281-26336-1-git-send-email-alim.akhtar@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFjrNLMWRmVeSWpSXmKPExsWyRsSkSnf6x2uhBt++y1v8X3+bxeLyrjls Ft3Xd7BZfLh/kdlix8IqB1aPnbPusnsc/vGD2aNvyypGj8+b5AJYorhsUlJzMstSi/TtErgy Zrz6y1KwQq5i8cmpTA2M8yS7GDk5JARMJNpuPWGBsMUkLtxbz9bFyMUhJLCCUWLfhM9MMEU/ jz1ggkgsZZR4sPMyVNVPRombO9+yg1SxCWhL3J2+BaxDRMBG4vzNB2A2s0C4xLUNs8FqhAXc Jf6vv8cMYrMIqEp8u3cSqIaDgxco/ul5JcQyRYnuZxPYQGxOAQ+Ju03zwK4TAiq5fPkYK8he CYFmdonl92azQcwRkPg2+RALyBwJAVmJTQeYIeZIShxccYNlAqPwAkaGVYyiqQXJBcVJ6UWm esWJucWleel6yfm5mxiBYXz637OJOxjvH7A+xCjAwajEwzsj8lqoEGtiWXFl7iFGU6ANE5ml RJPzgdGSVxJvaGxmZGFqYmpsZG5ppiTOqyP9M1hIID2xJDU7NbUgtSi+qDQntfgQIxMHp1QD 43ymU0dbH/N5qRgrGn5evUblw69vJVc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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=-7.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 bc27f5e..d425ea1 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 0b7dde0..045968e 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 *); + int (*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);