Received: by 10.223.185.116 with SMTP id b49csp8792248wrg; Fri, 2 Mar 2018 08:03:08 -0800 (PST) X-Google-Smtp-Source: AG47ELv54HR0jw9bQi8jD1g2jgUN46CuOZ8fqtjqIZ6DWBqdLcR1Xm15bKc1ocfxuNgbuyHlzUMF X-Received: by 2002:a17:902:aa87:: with SMTP id d7-v6mr5618147plr.237.1520006588055; Fri, 02 Mar 2018 08:03:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520006588; cv=none; d=google.com; s=arc-20160816; b=Zl8yUgY2wVOtf6wgPOyscoa3iYoTdH11cWfOO1U0ShJ+5lr735k2e64lBz1k/Gl+i0 k8x65m/HJ5cbuNLoPpU3VKTqdz+JvckClOZNzj/ALpAvTzyVubxp/mjveUr2GVXLubjY kUuNzJ3X1/vGreSh2x4h9GHliU8w26ID0+WFvLR9xDduP4E3Xl8E6flqNfo7iedKa7uT DdQl7UV8/U52dfEbH8w5JE4zCaSdv+kZOJk+s0gJdyWXcgJHus4w7eOoEpg36Vz242iN vJ9R3O7bDIcuAaJ7q6B6PmFzHChAB4Zj7V5GbJQB0YKe6iyQinv28Tf+E69P0jiQbWml trVg== 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=N8ML33DnilT1ugPYAQtrJPnftYNidopYSc69Jy6ZpYA=; b=NfYtcDdQM9OjC2tuiiu+ui47aSfB/a/8PVK1Cm1P018KnoNX/mGtakOwVcmCS3Vtjo OPgaDNje/NRO9498NmjU2y6J7OWrQp+O0s5s5hRjgRHPOGnM5lpiUWITPbsCk32twmWr eLSD3kiwANvTWVoVbuhjRnQK7fM51irl/QTSVJ3bcRK4QK+HlXGIzXoY9BbJp19Gg3pN PwOQAmnHQ1Dtdje0BsxzF6k5dY1gcpaDDrlh3KRvEqgSHtWRJlbFjXJZWeo/5+922z43 jj1lDgjyX2pAWQ9+WuzCfM92o6hGHvrBawogLEX2qpTlbnfvWgilljCSZ0v+M8Q3GVpg Wl0A== 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 h132si5035034pfe.12.2018.03.02.08.02.52; Fri, 02 Mar 2018 08:03:08 -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 S1429090AbeCBPIi (ORCPT + 99 others); Fri, 2 Mar 2018 10:08:38 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:5732 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1429002AbeCBPIE (ORCPT ); Fri, 2 Mar 2018 10:08:04 -0500 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 470A32B1ED5; Fri, 2 Mar 2018 23:07:33 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.361.1; Fri, 2 Mar 2018 23:07:28 +0800 From: John Garry To: , , , CC: , , , , Xiaofei Tan , John Garry Subject: [PATCH v2 4/8] scsi: hisi_sas: fix the issue of setting linkrate register Date: Fri, 2 Mar 2018 23:06:18 +0800 Message-ID: <1520003182-26277-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1520003182-26277-1-git-send-email-john.garry@huawei.com> References: <1520003182-26277-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 Content-Type: text/plain 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(-) 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 edd0c89..80fd4f4 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) -- 1.9.1