From patchwork Sat Jun 24 11:44:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zang Leigang X-Patchwork-Id: 9807763 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 74C2660329 for ; Sat, 24 Jun 2017 11:44:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59983286BF for ; Sat, 24 Jun 2017 11:44:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 377DA2878B; Sat, 24 Jun 2017 11:44:55 +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 49939286BF for ; Sat, 24 Jun 2017 11:44:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751305AbdFXLow (ORCPT ); Sat, 24 Jun 2017 07:44:52 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:8794 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751272AbdFXLov (ORCPT ); Sat, 24 Jun 2017 07:44:51 -0400 Received: from 172.30.72.54 (EHLO DGGEML403-HUB.china.huawei.com) ([172.30.72.54]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id AQW97970; Sat, 24 Jun 2017 19:44:44 +0800 (CST) Received: from kirin.host.huawei.com (10.184.169.118) by DGGEML403-HUB.china.huawei.com (10.3.17.33) with Microsoft SMTP Server id 14.3.301.0; Sat, 24 Jun 2017 19:44:40 +0800 From: Zang Leigang To: , , CC: Subject: [PATCH] scsi: ufs: check link active or not after switch to HS mode Date: Sat, 24 Jun 2017 19:44:05 +0800 Message-ID: <20170624114405.18475-1-zangleigang@hisilicon.com> X-Mailer: git-send-email 2.13.0 MIME-Version: 1.0 X-Originating-IP: [10.184.169.118] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.594E50AD.011D, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 3f154293ad7a5734553037d27b774fba 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 device can successfully link and switch to HS mode. But failed to do more. ufshcd_verify_dev_init can help to find this earlier. Signed-off-by: Zang Leigang diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index ffe8d8608818..eb03388fc4bd 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -6373,6 +6373,14 @@ static int ufshcd_probe_hba(struct ufs_hba *hba) __func__, ret); goto out; } + + /* + * Some device lost link after switch to HS mode. Check if + * connect is established here. + */ + ret = ufshcd_verify_dev_init(hba); + if (ret) + goto out; } /* set the state as operational after switching to desired gear */