From patchwork Wed Jun 7 15:20:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 103284 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1798153obh; Wed, 7 Jun 2017 07:55:21 -0700 (PDT) X-Received: by 10.98.67.138 with SMTP id l10mr31769820pfi.73.1496847320942; Wed, 07 Jun 2017 07:55:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496847320; cv=none; d=google.com; s=arc-20160816; b=rKiPhoJdgbsP0uClHUVvBxTdOu/dnoZW9XRRiAdlfYgLhoyajeb4PrEnfXJVowYTLw 4wV7U6aiaSI05XC0wAh7zk9sJCvdL+tDN/qjTnNUQWUsIF8fjy/zONn/yVyLiZrZ9EHE Y5GvKgrhEp4eADZIHbdSykqjHkwwoR31bgF4dcHJS/RQSUpBn2qq34KajiAnqoSIYjbQ uqhxPUCggL3skK5j8DYVZxkt/5L+r6ZP9dD+kA6r4DiEsG9J36xtIoMcUuy8ox8WW0qe a8qJIPk/2DD2TzosYD23N4vjlJMCDg/EbQ6Z+YmJkDGb78t5ELeyZi+J6pdM59grPBh7 Ndlg== 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=JExo3zsjhNxQtCPqyYd2q1kzE0Ab+uV1uNMK3FYXnWQ=; b=lFmS1WvFcinRXzZswHPCQbhynoh3m4TyEAdtxy4L7MR5a2oCvLe/Df/Iv81SginbDy 8UpuHTeun68HMoF84/yHLbzWkNaDlWPIIzV2bYfd5KfPyGy0ivX84vxEZigaEFrIcXNZ e/2Sw6e2k/QIgwImo+yemiDEKSDQwjD/4SWT3Lf9p8AoggjJnfS5hVV5smcsrYymeajC bl64cjezDIMnZKvUPAchCyJUUCYLmPtuuqGR4A7SaM2oxoPW5DuFclVlF9uAZNPedFVb 2/8vlTGbrW/YEbt82+3lq06Y5o6X1M3TlPFuDlAyduj7cSb8ocujJv0gJ+RMX1rmw996 J2yw== 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 k13si2007080pln.48.2017.06.07.07.55.20; Wed, 07 Jun 2017 07:55:20 -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 S1751637AbdFGOzJ (ORCPT + 1 other); Wed, 7 Jun 2017 10:55:09 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7776 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751665AbdFGOwF (ORCPT ); Wed, 7 Jun 2017 10:52:05 -0400 Received: from 172.30.72.57 (EHLO DGGEML403-HUB.china.huawei.com) ([172.30.72.57]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id APX46296; Wed, 07 Jun 2017 22:50:59 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEML403-HUB.china.huawei.com (10.3.17.33) with Microsoft SMTP Server id 14.3.301.0; Wed, 7 Jun 2017 22:50:49 +0800 From: John Garry To: , CC: , , , , , Xiang Chen , John Garry Subject: [PATCH v4 20/23] scsi: hisi_sas: add get_wideport_bitmap_v3_hw() Date: Wed, 7 Jun 2017 23:20:23 +0800 Message-ID: <1496848826-20534-21-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496848826-20534-1-git-send-email-john.garry@huawei.com> References: <1496848826-20534-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.593812D3.029C, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: c8f2fa5fb67f41b39bb24386176a2de7 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiang Chen Add code for interface get_wideport_bitmap. Signed-off-by: John Garry Signed-off-by: Xiang Chen --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index 2fb2455..84305c9 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -629,6 +629,18 @@ static void sl_notify_v3_hw(struct hisi_hba *hisi_hba, int phy_no) hisi_sas_phy_write32(hisi_hba, phy_no, SL_CONTROL, sl_control); } +static int get_wideport_bitmap_v3_hw(struct hisi_hba *hisi_hba, int port_id) +{ + int i, bitmap = 0; + u32 phy_port_num_ma = hisi_sas_read32(hisi_hba, PHY_PORT_NUM_MA); + + for (i = 0; i < hisi_hba->n_phy; i++) + if (((phy_port_num_ma >> (i * 4)) & 0xf) == port_id) + bitmap |= 1 << i; + + return bitmap; +} + /** * The callpath to this function and upto writing the write * queue pointer should be safe from interruption. @@ -1575,6 +1587,7 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) .hw_init = hisi_sas_v3_init, .setup_itct = setup_itct_v3_hw, .max_command_entries = HISI_SAS_COMMAND_ENTRIES_V3_HW, + .get_wideport_bitmap = get_wideport_bitmap_v3_hw, .complete_hdr_size = sizeof(struct hisi_sas_complete_v3_hdr), .free_device = free_device_v3_hw, .sl_notify = sl_notify_v3_hw, From patchwork Wed Jun 7 15:20:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 103290 Delivered-To: patch@linaro.org Received: by 10.182.29.35 with SMTP id g3csp1799177obh; Wed, 7 Jun 2017 07:57:39 -0700 (PDT) X-Received: by 10.99.184.25 with SMTP id p25mr28613780pge.22.1496847458941; Wed, 07 Jun 2017 07:57:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496847458; cv=none; d=google.com; s=arc-20160816; b=zs1jrIPGluHMY22ns//2U4DvHyX0I0oofuNjZqBtjbxGmJGWHDL2C1Id44pwX/LOUZ qjHxMQjh2tu6yCss7Upt8h/XF3XhpalCxIQ0kjgDYTuAsl9IKlNMihbbX5I5X7lzLoSY IayYUUPP1pIDWeVQlg7ISQjwgYvcZsCkeSxUG+gk5xmrtMI5f5wfLg55cEzSJJAQ91di FBE4iDh9+39Ry7LZdRw63ZlBsEdisFWL/rNsboFO0S1MWbuiuvPlC9u+U/iFFKerEEYh xbR6SF4sJ4LMH8gpnwKTSMx40bbtCzbRVnUbvfi672d7/q/sr8sE7Rl8dAH6U/I2wV46 fNqw== 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=7adma1T33LHX8raOeLe+HZIOrVFQ2Sl4SGPSPFsagE0=; b=dmsA7IO6ej3nfIJEBBL1u1w37F4ZlAQDy5SWO4iup8WPIRbzU88rXpxX5R595wqCOj Fpn/Ak5M0/JnxPbUf9ONmLM+d7B7K7eDW96bqC7JiQdek0127YJjA5mZ0O1bryxKcqyV TXaPyit9OprhMYE6JD3PwjgKFPR6phPXE+iWqx7kBWwuU7myVmyWcgD0Z+76+Q/C+rj/ fk9PL/GWz9QHhQHarAImc6v0v3+gaMIh5/1l41JF5zeyZJR89BcVjSlX35GWs5tXD33I xSMc8LSD1xY4/8dtDTROAzAAExAsI2BUP4Xz8jKc24kkkpoyCg+k61IHhp1HmgNDopKM 361Q== 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 x5si1989016pfx.75.2017.06.07.07.57.38; Wed, 07 Jun 2017 07:57:38 -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 S1751728AbdFGO5i (ORCPT + 1 other); Wed, 7 Jun 2017 10:57:38 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:7770 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751072AbdFGOvh (ORCPT ); Wed, 7 Jun 2017 10:51:37 -0400 Received: from 172.30.72.57 (EHLO DGGEML403-HUB.china.huawei.com) ([172.30.72.57]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id APX46301; Wed, 07 Jun 2017 22:51:00 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEML403-HUB.china.huawei.com (10.3.17.33) with Microsoft SMTP Server id 14.3.301.0; Wed, 7 Jun 2017 22:50:50 +0800 From: John Garry To: , CC: , , , , , Xiang Chen , John Garry Subject: [PATCH v4 22/23] scsi: hisi_sas: add v3 code to fill some more hw function pointers Date: Wed, 7 Jun 2017 23:20:25 +0800 Message-ID: <1496848826-20534-23-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1496848826-20534-1-git-send-email-john.garry@huawei.com> References: <1496848826-20534-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.593812D5.005F, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 5551985266b58621884c9a4e84468938 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Xiang Chen Add code to fill the interface of phy_hard_reset, phy_get_max_linkrate, and phy enable/disable. Signed-off-by: John Garry Signed-off-by: Xiang Chen --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) -- 1.9.1 diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c index a5816cb..52251ee 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -195,6 +195,8 @@ #define TXID_AUTO (PORT_BASE + 0xb8) #define CT3_OFF 1 #define CT3_MSK (0x1 << CT3_OFF) +#define TX_HARDRST_OFF 2 +#define TX_HARDRST_MSK (0x1 << TX_HARDRST_OFF) #define RX_IDAF_DWORD0 (PORT_BASE + 0xc4) #define RXOP_CHECK_CFG_H (PORT_BASE + 0xfc) #define SAS_SSP_CON_TIMER_CFG (PORT_BASE + 0x134) @@ -664,6 +666,14 @@ static void enable_phy_v3_hw(struct hisi_hba *hisi_hba, int phy_no) hisi_sas_phy_write32(hisi_hba, phy_no, PHY_CFG, cfg); } +static void disable_phy_v3_hw(struct hisi_hba *hisi_hba, int phy_no) +{ + u32 cfg = hisi_sas_phy_read32(hisi_hba, phy_no, PHY_CFG); + + cfg &= ~PHY_CFG_ENA_MSK; + hisi_sas_phy_write32(hisi_hba, phy_no, PHY_CFG, cfg); +} + static void start_phy_v3_hw(struct hisi_hba *hisi_hba, int phy_no) { config_id_frame_v3_hw(hisi_hba, phy_no); @@ -671,6 +681,11 @@ static void start_phy_v3_hw(struct hisi_hba *hisi_hba, int phy_no) enable_phy_v3_hw(hisi_hba, phy_no); } +static void stop_phy_v3_hw(struct hisi_hba *hisi_hba, int phy_no) +{ + disable_phy_v3_hw(hisi_hba, phy_no); +} + static void start_phys_v3_hw(struct hisi_hba *hisi_hba) { int i; @@ -679,6 +694,26 @@ static void start_phys_v3_hw(struct hisi_hba *hisi_hba) start_phy_v3_hw(hisi_hba, i); } +static void phy_hard_reset_v3_hw(struct hisi_hba *hisi_hba, int phy_no) +{ + struct hisi_sas_phy *phy = &hisi_hba->phy[phy_no]; + u32 txid_auto; + + stop_phy_v3_hw(hisi_hba, phy_no); + if (phy->identify.device_type == SAS_END_DEVICE) { + txid_auto = hisi_sas_phy_read32(hisi_hba, phy_no, TXID_AUTO); + hisi_sas_phy_write32(hisi_hba, phy_no, TXID_AUTO, + txid_auto | TX_HARDRST_MSK); + } + msleep(100); + start_phy_v3_hw(hisi_hba, phy_no); +} + +enum sas_linkrate phy_get_max_linkrate_v3_hw(void) +{ + return SAS_LINK_RATE_12_0_GBPS; +} + static void phys_init_v3_hw(struct hisi_hba *hisi_hba) { start_phys_v3_hw(hisi_hba); @@ -1992,6 +2027,10 @@ static int hisi_sas_v3_init(struct hisi_hba *hisi_hba) .start_delivery = start_delivery_v3_hw, .slot_complete = slot_complete_v3_hw, .phys_init = phys_init_v3_hw, + .phy_enable = enable_phy_v3_hw, + .phy_disable = disable_phy_v3_hw, + .phy_hard_reset = phy_hard_reset_v3_hw, + .phy_get_max_linkrate = phy_get_max_linkrate_v3_hw, }; static struct Scsi_Host *