From patchwork Mon Mar 5 14:48:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 130643 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp2773883lja; Mon, 5 Mar 2018 06:52:15 -0800 (PST) X-Google-Smtp-Source: AG47ELvxmpV10mUooic+z9V565oPVfUJhzJvEKxrFf8Ks9w/461xKCMnFibP6BnwzP1pv1076q7s X-Received: by 2002:a17:902:b58e:: with SMTP id a14-v6mr12955930pls.76.1520261535292; Mon, 05 Mar 2018 06:52:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520261535; cv=none; d=google.com; s=arc-20160816; b=Jxpl4H/AFTgjx2m0yXrIlx+nzbtE7ZDcrDfa8lpdWpL1stkSokPnX7CAnDtN7vojBJ +HEbc3qTGiX1/Xzk+ymle8Ag2JP3kRMEKEmWEEYdSApMEeMEFMOzPzpYw9SQplED24Un PUHyRrzRxYYYktchQRlEgKT4TGUJSYQ8aRYAUJw+SqRvkKKfAwTO2Cs0dpnBXhV7K33b Jv/aumzqxGb8shGmT9H+oZMZUzzXJVUlCJ/MeKMRS3TqzFQ2PB64ZTbyKNCY1e47/pxp q8nmzjQbb5WqHjU5uZHwAGliTSkcl8eP84e8KzqYlZ4VwVzSaTBFYeFF6Mn3KcE6oxxu 2Ujw== 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=FqriQ140nkxo59hIdG8aEpcq6yKA/ljZVY5d9PN5vyo=; b=C4tmHOonh4fg0YmQ/WQeFSzt0P71MDektcum7zuajzQ+JlAxnoXzaI/B4bGkG/kI4F 2u7CBzDwM2399oI2Wj4BWdIlh2SMtK0SKgL3wowx41VE7BXytVJX5CeUg/K/uY/xJnZ/ c7+xrHzE8kv5PJRW2Ycu4/Kc1lY9bUQqR+NNfmPVlaGTS1D/bi286xfDtcnpB1b34Ej4 mUFBijIiqbo/UC+CIXPEkGjmChncQW/Ix/1SWM01NJ53Sl/13mWww7ch3fak3cOjIVze 2NeeAlDIfHG288dB3FA3/NawINp74Fh18J0QhokGIL8lhj3avHrbpH/4LE6arsjae+sA xUQA== 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 s21si8391673pgo.418.2018.03.05.06.52.14; Mon, 05 Mar 2018 06:52:15 -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 S1752546AbeCEOwL (ORCPT + 28 others); Mon, 5 Mar 2018 09:52:11 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:6147 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752474AbeCEOtx (ORCPT ); Mon, 5 Mar 2018 09:49:53 -0500 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 70C1D4E6D7DA8; Mon, 5 Mar 2018 22:49:34 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.361.1; Mon, 5 Mar 2018 22:49:27 +0800 From: John Garry To: , , , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH v3 4/8] scsi: hisi_sas: fix the issue of setting linkrate register Date: Mon, 5 Mar 2018 22:48:46 +0800 Message-ID: <1520261330-204596-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520261330-204596-1-git-send-email-john.garry@huawei.com> References: <1520261330-204596-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 67be346..bd1a48a 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)