From patchwork Tue Nov 8 08:03:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kiwoong Kim X-Patchwork-Id: 9416847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D025260585 for ; Tue, 8 Nov 2016 08:14:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C169228867 for ; Tue, 8 Nov 2016 08:14:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B683528881; Tue, 8 Nov 2016 08:14:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2847028867 for ; Tue, 8 Nov 2016 08:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753284AbcKHIOz convert rfc822-to-8bit (ORCPT ); Tue, 8 Nov 2016 03:14:55 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:35117 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbcKHIOw (ORCPT ); Tue, 8 Nov 2016 03:14:52 -0500 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGB007Z4D25T240@mailout2.samsung.com> for linux-scsi@vger.kernel.org; Tue, 08 Nov 2016 17:03:41 +0900 (KST) X-AuditID: cbfee61b-f796f6d000004092-4f-582186dd611a Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 8A.A6.16530.DD681285; Tue, 8 Nov 2016 17:03:41 +0900 (KST) Received: from DOKWMADKIM02 ([12.36.166.218]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OGB008N8D250L30@mmp1.samsung.com>; Tue, 08 Nov 2016 17:03:41 +0900 (KST) From: Kiwoong Kim To: linux-scsi@vger.kernel.org Cc: =?UTF-8?B?7LaU7ZeM6rSR?= Subject: [RESEND][PATCH v1] ufs: introduce setup_task_mgmt Date: Tue, 08 Nov 2016 17:03:41 +0900 Message-id: <002601d23996$9e5872c0$db095840$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 8BIT X-Mailer: Microsoft Outlook 15.0 Thread-index: AdI5lpdlrmjKPDlgT8mM000BFJDlcQ== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRmVeSWpSXmKPExsVy+t9jAd27bYoRBs9fCFrMvtDEaNF9fQeb A5NH35ZVjB6fN8kFMEW52WSkJqakFimk5iXnp2TmpdsqhYa46VooKeQl5qbaKkXo+oYEKSmU JeaUAnlGBmjAwTnAPVhJ3y7BLWPHAr+Cz0IVCzoNGhj38XcxcnJICJhIbL62hhnCFpO4cG89 WxcjF4eQwFJGif5n26Gc94wSLx7vZwSpYhPQlHh6cyoTiC0iICexeflXFhCbWcBQYsP9yWA1 wgJWEj9ebGAFsVkEVCWal68Cq+EVsJTYNek7G4QtKPFj8j2oXnWJSfMWMUPY2hJP3l1ghbhI QWL3p6OsELv0JNYu+ABVIyKx78U7xgmMArOQjJqFZNQsJKNmIWlZwMiyilEitSC5oDgpPdco L7Vcrzgxt7g0L10vOT93EyM4Up5J72A8vMv9EKMAB6MSD6/DXYUIIdbEsuLK3EOMEhzMSiK8 3NWKEUK8KYmVValF+fFFpTmpxYcYTYGencgsJZqcD4zivJJ4QxNzE3NjAwtzS0sTIyVx3sbZ z8KFBNITS1KzU1MLUotg+pg4OKUaGOef9J47o7nDeWZRUaeeutbtCqc37I0VBb94brR1cK/a wN8RdVOB/23WdbFPgXs/VvtN95YqXZl9JWW/h8RUFqkO2bBUEz72hJ+yBhmuvw+mx/WaVtt2 7j/I/TvnUd43+5nb7767oryPIV/orNuWQptJ/HMidC0MchfrfpZoDSvu3CVepZyuxFKckWio xVxUnAgA+fn0JKoCAAA= X-MTR: 20000000000000000@CPGS Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some UFS host controller may need to configure some things before any task management request is issued. Signed-off-by: Kiwoong Kim --- drivers/scsi/ufs/ufshcd.c | 1 + drivers/scsi/ufs/ufshcd.h | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index bf78321..fdb0502 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -4358,6 +4358,7 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id, task_req_upiup->input_param2 = cpu_to_be32(task_id); /* send command to the controller */ + ufshcd_vops_setup_task_mgmt(hba, free_slot, tm_function); __set_bit(free_slot, &hba->outstanding_tasks); /* Make sure descriptors are ready before ringing the task doorbell */ diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h index f2a69c0..b084d89 100644 --- a/drivers/scsi/ufs/ufshcd.h +++ b/drivers/scsi/ufs/ufshcd.h @@ -263,6 +263,8 @@ struct ufs_pwr_mode_info { * to be set. * @setup_xfer_req: called before any transfer request is issued * to set some things + * @setup_task_mgmt: called before any task management request is issued + * to set some things * @suspend: called during host controller PM callback * @resume: called during host controller PM callback * @dbg_register_dump: used to dump controller debug information @@ -287,6 +289,7 @@ struct ufs_hba_variant_ops { struct ufs_pa_layer_attr *, struct ufs_pa_layer_attr *); void (*setup_xfer_req)(struct ufs_hba *, int, bool); + void (*setup_task_mgmt)(struct ufs_hba *, int, u8); int (*suspend)(struct ufs_hba *, enum ufs_pm_op); int (*resume)(struct ufs_hba *, enum ufs_pm_op); void (*dbg_register_dump)(struct ufs_hba *hba); @@ -811,6 +814,13 @@ static inline void ufshcd_vops_setup_xfer_req(struct ufs_hba *hba, int tag, return hba->vops->setup_xfer_req(hba, tag, is_cmd_not_null); } +static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba, + int tag, u8 tm_function) +{ + if (hba->vops && hba->vops->setup_task_mgmt) + return hba->vops->setup_task_mgmt(hba, tag, tm_function); +} + static inline int ufshcd_vops_suspend(struct ufs_hba *hba, enum ufs_pm_op op) { if (hba->vops && hba->vops->suspend)