From patchwork Wed Jul 29 06:27:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas.G@pmcs.com X-Patchwork-Id: 6889341 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 41063C05AC for ; Wed, 29 Jul 2015 06:26:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DD0F207B1 for ; Wed, 29 Jul 2015 06:26:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6C392207AE for ; Wed, 29 Jul 2015 06:26:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752012AbbG2G0I (ORCPT ); Wed, 29 Jul 2015 02:26:08 -0400 Received: from bby1mta02.pmc-sierra.com ([216.241.235.117]:43870 "EHLO bby1mta02.pmc-sierra.bc.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790AbbG2G0H (ORCPT ); Wed, 29 Jul 2015 02:26:07 -0400 Received: from bby1mta02.pmc-sierra.bc.ca (localhost.pmc-sierra.bc.ca [127.0.0.1]) by localhost (Postfix) with SMTP id 902708E0322; Tue, 28 Jul 2015 23:26:07 -0700 (PDT) Received: from smtp.pmcs.com (bby1cas01.pmc-sierra.internal [216.241.227.142]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by bby1mta02.pmc-sierra.bc.ca (Postfix) with ESMTP id 7E8148E0321; Tue, 28 Jul 2015 23:26:07 -0700 (PDT) Received: from localhost (216.241.227.4) by bby1cas01.pmc-sierra.internal (216.241.227.142) with Microsoft SMTP Server (TLS) id 14.3.123.3; Tue, 28 Jul 2015 23:26:06 -0700 From: To: CC: , , Tomas Henzl , , Subject: [PATCH 2/8] pm80xx: Corrected device state changes in I_T_Nexus_Reset Date: Wed, 29 Jul 2015 11:57:14 +0530 Message-ID: <1438151240-4097-3-git-send-email-Viswas.G@pmcs.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1438151240-4097-1-git-send-email-Viswas.G@pmcs.com> References: <1438151240-4097-1-git-send-email-Viswas.G@pmcs.com> MIME-Version: 1.0 X-Originating-IP: [216.241.227.4] DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pmcs.com; h=from:to:cc:subject:date:message-id:in-reply-to:references:mime-version:content-type; s=default; bh=aXBGia75pJtHZ4nQwpdadJNBqOCmX446/tqsXojiWlU=; b=iw8DyT6ZWUgLZ4IL7S/I6OVc1x7NDz8GhJdus0KLP4zxysIBpaSEZKnhopQUYqs2+CYeR8XTSeG0fd9maDBruvZiHlEovRSXikwdUgRpfiyMR2rmxarOfbRIeh9DkkzUXoXobd2r/HxlBRk9MzaVFAT6eGtgeCI8c6mPantXNs0= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham 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: Viswas G In Nexus reset the device state set to DS_IN_RECOVERY before doing phy reset and internal cleanup. Once internal cleanup finishes, the device state will set to DS_OPERATIONAL. Signed-off-by: Viswas G Signed-off-by: Suresh Thiagarajan Reviewed-by: Hannes Reinecke --- drivers/scsi/pm8001/pm8001_sas.c | 14 +++++++++++--- drivers/scsi/pm8001/pm8001_sas.h | 8 ++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index b93f289..4e6955f 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -980,13 +980,21 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev) rc = 0; goto out; } + pm8001_dev->setds_completion = &completion_setstate; + PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha, + pm8001_dev, DS_IN_RECOVERY); + wait_for_completion(&completion_setstate); rc = sas_phy_reset(phy, 1); msleep(2000); + if (rc) { + PM8001_EH_DBG(pm8001_ha, + pm8001_printk("phy reset failed for device %x\n" + "with rc %d\n", pm8001_dev->device_id, rc)); + } rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev , dev, 1, 0); - pm8001_dev->setds_completion = &completion_setstate; - rc = PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha, - pm8001_dev, 0x01); + PM8001_CHIP_DISP->set_dev_state_req(pm8001_ha, + pm8001_dev, DS_OPERATIONAL); wait_for_completion(&completion_setstate); } else { rc = sas_phy_reset(phy, 1); diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h index 8dd8b78..c9736cc 100644 --- a/drivers/scsi/pm8001/pm8001_sas.h +++ b/drivers/scsi/pm8001/pm8001_sas.h @@ -569,6 +569,14 @@ struct pm8001_fw_image_header { #define NCQ_READ_LOG_FLAG 0x80000000 #define NCQ_ABORT_ALL_FLAG 0x40000000 #define NCQ_2ND_RLE_FLAG 0x20000000 + +/* Device states */ +#define DS_OPERATIONAL 0x01 +#define DS_PORT_IN_RESET 0x02 +#define DS_IN_RECOVERY 0x03 +#define DS_IN_ERROR 0x04 +#define DS_NON_OPERATIONAL 0x07 + /** * brief param structure for firmware flash update. */