From patchwork Fri Sep 6 12:55:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 173230 Delivered-To: patch@linaro.org Received: by 2002:ac9:19ad:0:0:0:0:0 with SMTP id d45csp600335oce; Fri, 6 Sep 2019 05:58:30 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsZ6olchs/ssCjyXU+qq+S/7513h9iCi16hriq5GA1lM/un8ESxvWsV8Eg+L4WHqm/6+8H X-Received: by 2002:a17:902:6a8c:: with SMTP id n12mr8937972plk.159.1567774710417; Fri, 06 Sep 2019 05:58:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567774710; cv=none; d=google.com; s=arc-20160816; b=KBk+XlDpIPW959mYqtozRFi5sXrL4a9RV7HkJ87qH0uBOwy2WaZ1sZBLb/G3YlFhvW l/lIKyqUlIuVWFz5Lcb4YJWvmCd6CDuEYv8rCHxPDaIFEOgwQT8ZHxiSoOTTs+lVg/uc eDrGvS/NnzQkXvAL8V+bJVt1/ARtb/SO5sJEk63rsZQfpsfPkRzxB/EQtax5uw7hF/tC vetmnhYtvuFRLaGZkvE9WW9PZJC82UamttjInqmPcFUhbJzWdLE+KEHkItrnfX1MT2Bw 64RV1/pKelHDxc81vUbUDcJKYLOpdgjsrLggC5RH1egHVmNYlrZuSvIfdtnST85XAPK+ QgZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=IdPBJG2qB3w0InA68TKnfwJYnQQyYumICE2+M8H9vOk=; b=PVZ29WihBd4qOc3sNJrZlY8pZUFlKfBHSZhYApa4GXYFP9RzyVRDRUYxuXbTGwCpl2 RpAvQanTqOV0b/XpmRLLkA3x64XNDmhEuZEgs5S0z+Sj6Lg4UEgLdfJfrtJhmE1wFLcy 2dqx9b0Ew4pXJX3+Klo813QM7UPHdl0O72MRVjnbqjzW4jzS49itUVMLKPutNyNE393o IAmNm57v8Cd8dL6a40AkAcyHpMuZSid+qhxC6eGhtSBI0h10rkMFLPUxqbgzOBebMBSY 658oFZ1aH2sdxm7uDhE2jY68clvmfkqHiIVZWvMs+WQDkTSFxRSY8Ox2APud5nzqZYYd 4yAw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 76si4555379pgh.564.2019.09.06.05.58.30; Fri, 06 Sep 2019 05:58:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404966AbfIFM62 (ORCPT + 28 others); Fri, 6 Sep 2019 08:58:28 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7138 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2404920AbfIFM6R (ORCPT ); Fri, 6 Sep 2019 08:58:17 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id E81A1300CF5314035A46; Fri, 6 Sep 2019 20:58:10 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.439.0; Fri, 6 Sep 2019 20:58:02 +0800 From: John Garry To: , CC: , , , Xiang Chen , "John Garry" Subject: [PATCH 06/13] scsi: hisi_sas: Update all the registers after suspend and resume Date: Fri, 6 Sep 2019 20:55:30 +0800 Message-ID: <1567774537-20003-7-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1567774537-20003-1-git-send-email-john.garry@huawei.com> References: <1567774537-20003-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xiang Chen After suspend and resume, the HW registers will be set back to their initial value. We use init_reg_v3_hw() to set some registers, but some registers are set via firmware in ACPI "_RST" method, so add reset handler before init_reg_v3_hw(). Signed-off-by: Xiang Chen Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 2adb5c93bd81..4c32088b9199 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -3283,15 +3283,21 @@ static int hisi_sas_v3_resume(struct pci_dev *pdev) pci_enable_wake(pdev, PCI_D0, 0); pci_restore_state(pdev); rc = pci_enable_device(pdev); - if (rc) + if (rc) { dev_err(dev, "enable device failed during resume (%d)\n", rc); + return rc; + } pci_set_master(pdev); scsi_unblock_requests(shost); clear_bit(HISI_SAS_REJECT_CMD_BIT, &hisi_hba->flags); sas_prep_resume_ha(sha); - init_reg_v3_hw(hisi_hba); + rc = hw_init_v3_hw(hisi_hba); + if (rc) { + scsi_remove_host(shost); + pci_disable_device(pdev); + } hisi_hba->hw->phys_init(hisi_hba); sas_resume_ha(sha); clear_bit(HISI_SAS_RESET_BIT, &hisi_hba->flags);