From patchwork Mon May 21 10:09:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 136439 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp119564lji; Mon, 21 May 2018 03:12:15 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoZ1dD+Ejb9wNLAoh3G83ZK0lqt/aihEH/DMQIGlWqp+xur1wdYPn3FNZNTl5PFMQDaLB+i X-Received: by 2002:a17:902:1347:: with SMTP id r7-v6mr19596659ple.62.1526897535812; Mon, 21 May 2018 03:12:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526897535; cv=none; d=google.com; s=arc-20160816; b=rQerXxX2D7jfJP5g1hah/lgIsH8QOARjJagKTd9/58dxLtmG3LhZ6Axo1fBttmBCdy i5PtrjVM2dm6tghpza/8AZZ2yZ4lJutSkTTsx+2ma3H7S9U0An5OLmq/KN0A76wPPLcW dE9nWNU2tGOd/b0W94REca5FdP81wIUOIjY7JpLcMjYq93Z9LFD17+6OhrAL4qyu9QND 5Wy0vJRGBAWTZmAsvF55GKctcc6TS1WOuD5BbuvEHw0vSj4yxbv+I4Cq4n+oUZkRHIxH /KIt9CA3jHJ2O/HwdoUVImz0L321xSvDpqZiqB9PMq0ChkQfpGJo6SzfosWDfyGVxdWT od/g== 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=bMb2Pb3CQmLK6GerWH30uNExaGqBwduk1QUZz0PrDxQ=; b=ZFWZFwCGRbbrFe1Ah9Wa0+4ImaDcloQsmlL3XXkJxQdzskpywDszxYLQqRtIqY0OBc Wa3pKGcu1JW5Yb5OkLFhbefyLDx7hSw9m2tGIlFATZf6QW5h2jRfq7Yg9sQ/3uowDrWw J1AvDZ3WI48DbjLC4jlJKUkz4p8+iLDPdVKtPr9fXDEotX8XXSCsDWj8pv2+5kzapsXi YqpPu6OuHk2E455g9ura7sRLX20U/y2mxWbPCJA/ub24kWClzzvk7RFdQfB27QrgTxgg EqGEM8ULGLGsuV8MDtCco5rALBqSezSqhIK7gaNHlPXBxOdCD31vQDjkG0wk4lsFVJpt S+Jg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 v24-v6si14404829pfj.292.2018.05.21.03.12.15; Mon, 21 May 2018 03:12:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751537AbeEUKMO (ORCPT + 1 other); Mon, 21 May 2018 06:12:14 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:55809 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1752668AbeEUKLr (ORCPT ); Mon, 21 May 2018 06:11:47 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 6A38A2A25E120; Mon, 21 May 2018 18:11:40 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.382.0; Mon, 21 May 2018 18:11:32 +0800 From: John Garry To: , CC: , , , Xiaofei Tan , "John Garry" Subject: [PATCH 10/13] scsi: hisi_sas: Add v2 hw force PHY function for internal ATA command Date: Mon, 21 May 2018 18:09:22 +0800 Message-ID: <1526897365-228549-11-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1526897365-228549-1-git-send-email-john.garry@huawei.com> References: <1526897365-228549-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-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiaofei Tan This patch adds an force PHY function for internal ATA command for v2 hw. Because there is an SoC bug of v2 hw, and need send an IO through each PHY of a port to workaround a bug which occurs after a controller reset. This force PHY function will be used in the later patch. Signed-off-by: Xiaofei Tan Signed-off-by: John Garry --- drivers/scsi/hisi_sas/hisi_sas.h | 2 ++ drivers/scsi/hisi_sas/hisi_sas_v2_hw.c | 11 +++++++++++ 2 files changed, 13 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas.h b/drivers/scsi/hisi_sas/hisi_sas.h index 60bd652..9400824 100644 --- a/drivers/scsi/hisi_sas/hisi_sas.h +++ b/drivers/scsi/hisi_sas/hisi_sas.h @@ -180,6 +180,8 @@ struct hisi_sas_device { }; struct hisi_sas_tmf_task { + int force_phy; + int phy_id; u8 tmf; u16 tag_of_task_to_be_managed; }; diff --git a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c index fafb3f1..369ef7e 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v2_hw.c @@ -296,6 +296,10 @@ #define CMD_HDR_RESP_REPORT_MSK (0x1 << CMD_HDR_RESP_REPORT_OFF) #define CMD_HDR_TLR_CTRL_OFF 6 #define CMD_HDR_TLR_CTRL_MSK (0x3 << CMD_HDR_TLR_CTRL_OFF) +#define CMD_HDR_PHY_ID_OFF 8 +#define CMD_HDR_PHY_ID_MSK (0x1ff << CMD_HDR_PHY_ID_OFF) +#define CMD_HDR_FORCE_PHY_OFF 17 +#define CMD_HDR_FORCE_PHY_MSK (0x1 << CMD_HDR_FORCE_PHY_OFF) #define CMD_HDR_PORT_OFF 18 #define CMD_HDR_PORT_MSK (0xf << CMD_HDR_PORT_OFF) #define CMD_HDR_PRIORITY_OFF 27 @@ -2512,6 +2516,7 @@ static void prep_ata_v2_hw(struct hisi_hba *hisi_hba, struct hisi_sas_cmd_hdr *hdr = slot->cmd_hdr; struct asd_sas_port *sas_port = device->port; struct hisi_sas_port *port = to_hisi_sas_port(sas_port); + struct hisi_sas_tmf_task *tmf = slot->tmf; u8 *buf_cmd; int has_data = 0, hdr_tag = 0; u32 dw1 = 0, dw2 = 0; @@ -2524,6 +2529,12 @@ static void prep_ata_v2_hw(struct hisi_hba *hisi_hba, else hdr->dw0 |= cpu_to_le32(4 << CMD_HDR_CMD_OFF); + if (tmf && tmf->force_phy) { + hdr->dw0 |= CMD_HDR_FORCE_PHY_MSK; + hdr->dw0 |= cpu_to_le32((1 << tmf->phy_id) + << CMD_HDR_PHY_ID_OFF); + } + /* dw1 */ switch (task->data_dir) { case DMA_TO_DEVICE: