From patchwork Mon Feb 19 19:13:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 128841 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3801477ljc; Mon, 19 Feb 2018 10:23:26 -0800 (PST) X-Google-Smtp-Source: AH8x226TurHr9LMhOrQgPgScQIQh/Ol8up+mxQmBms8aIcjqF8C1IZbfUHr0uy3s/Ae/ouLsVff/ X-Received: by 10.99.96.73 with SMTP id u70mr12547348pgb.199.1519064606392; Mon, 19 Feb 2018 10:23:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519064606; cv=none; d=google.com; s=arc-20160816; b=nBxqe0TuAOBicwJSShmGtTZ5IeV8EnoG9jAAKJi/ftq7/sJ0cGLs5Bk/Bn+pBjWaal eBZWJ7TjHNiz3KwgZPpsSnmOo8/LRFppcAtX1TMY5aMpAEkZmE32in12Qv/MbWm/WUt0 WXusWaOLOK8EBF8HVQE8pGVUiWxIWFhaXP9rUvtfK6L89antrW8OzYM06GQCB9nvyEOa jNehJQXE4/dDvi2xHFSa+tWz5LaV6AHsYMNrrRPweO9oEsuYk0VzHrINQE9JPrZ25caf xtPR1Ftl+4seVWAW8W/jqDHLyvoDI2LAO8yENIe1omDy2CaEzqipALy/mTXQVGLqEXpD G8CA== 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:arc-authentication-results; bh=kwRZLtWXSDpiYnHARKX13AKFxUCttGhCKKOlWtFWGPY=; b=iBoXFlAxnWoGhtQxubf3yU9qdSycApnNDmCZI1lV2+770ePjYg3YZsiirGPi+T9umW XzgyGoQK5LFNo2avy/TnSf2orR19nEEcT600HxUqtvg339Zk/Nno2nfs9K1ASzPjqjoJ 62ju3QkVYcaX2sJMci5GNwfTu73RCVtIcRN54GjsfafK0LrX6YjxP/gdUsSCDbEm5IDG tNekGhkwdkVGxOHQDXLiIzu4a4hBkYa5EB3/D07z/yxTITeINXNHIfJVV/gLx5hsenri 1WObWuXPYPatdgPKHGbeEQSMjlYosV+f7eA4r24gGyhqTPlVcYlB2JzCFlWQsfJE2lr+ Ytbg== 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 91-v6si6015931plh.570.2018.02.19.10.23.26; Mon, 19 Feb 2018 10:23:26 -0800 (PST) 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 S1753512AbeBSSWS (ORCPT + 28 others); Mon, 19 Feb 2018 13:22:18 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5245 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753397AbeBSSWN (ORCPT ); Mon, 19 Feb 2018 13:22:13 -0500 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id A2FC1B919054; Tue, 20 Feb 2018 02:21:59 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.361.1; Tue, 20 Feb 2018 02:21:53 +0800 From: John Garry To: , , , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH 4/8] scsi: hisi_sas: fix the issue of setting linkrate register Date: Tue, 20 Feb 2018 03:13:27 +0800 Message-ID: <1519067611-206638-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1519067611-206638-1-git-send-email-john.garry@huawei.com> References: <1519067611-206638-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: Xiaofei Tan It is not right to set the register PROG_PHY_LINK_RATE while PHY is still enabled. So if we want to change PHY linkrate, we need to disable PHY before setting the register PROG_PHY_LINK_RATE, and then start-up PHY. This patch is to fix this issue. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas_v1_hw.c | 5 +++-- drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 5 +++-- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c index 38bbda9..2eb8980 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v1_hw.c @@ -881,10 +881,11 @@ static void phy_set_linkrate_v1_hw(struct hisi_hba *hisi_hba, int phy_no, prog_phy_link_rate &= ~0xff; prog_phy_link_rate |= rate_mask; + disable_phy_v1_hw(hisi_hba, phy_no); + msleep(100); hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE, prog_phy_link_rate); - - phy_hard_reset_v1_hw(hisi_hba, phy_no); + start_phy_v1_hw(hisi_hba, phy_no); } static int get_wideport_bitmap_v1_hw(struct hisi_hba *hisi_hba, int port_id) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index 662d259..357138f 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -1611,10 +1611,11 @@ static void phy_set_linkrate_v2_hw(struct hisi_hba *hisi_hba, int phy_no, prog_phy_link_rate &= ~0xff; prog_phy_link_rate |= rate_mask; + disable_phy_v2_hw(hisi_hba, phy_no); + msleep(100); hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE, prog_phy_link_rate); - - phy_hard_reset_v2_hw(hisi_hba, phy_no); + start_phy_v2_hw(hisi_hba, phy_no); } static int get_wideport_bitmap_v2_hw(struct hisi_hba *hisi_hba, int port_id) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 1ee95ab..8da9de7 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -1862,10 +1862,11 @@ static void phy_set_linkrate_v3_hw(struct hisi_hba *hisi_hba, int phy_no, prog_phy_link_rate &= ~0xff; prog_phy_link_rate |= rate_mask; + disable_phy_v3_hw(hisi_hba, phy_no); + msleep(100); hisi_sas_phy_write32(hisi_hba, phy_no, PROG_PHY_LINK_RATE, prog_phy_link_rate); - - phy_hard_reset_v3_hw(hisi_hba, phy_no); + start_phy_v3_hw(hisi_hba, phy_no); } static void interrupt_disable_v3_hw(struct hisi_hba *hisi_hba)