From patchwork Wed Sep 5 05:46:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viswas G X-Patchwork-Id: 10588269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF585679F for ; Wed, 5 Sep 2018 05:47:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BFF042997C for ; Wed, 5 Sep 2018 05:47:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B27CC29984; Wed, 5 Sep 2018 05:47:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02E292997C for ; Wed, 5 Sep 2018 05:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726340AbeIEKPn (ORCPT ); Wed, 5 Sep 2018 06:15:43 -0400 Received: from mail-eopbgr710050.outbound.protection.outlook.com ([40.107.71.50]:50839 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726273AbeIEKPn (ORCPT ); Wed, 5 Sep 2018 06:15:43 -0400 Received: from MWHPR0201CA0033.namprd02.prod.outlook.com (2603:10b6:301:74::46) by BN7PR02MB4034.namprd02.prod.outlook.com (2603:10b6:406:fe::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1080.17; Wed, 5 Sep 2018 05:47:12 +0000 Received: from BN1AFFO11FD024.protection.gbl (2a01:111:f400:7c10::164) by MWHPR0201CA0033.outlook.office365.com (2603:10b6:301:74::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.1101.17 via Frontend Transport; Wed, 5 Sep 2018 05:47:11 +0000 Authentication-Results: spf=pass (sender IP is 208.19.100.22) smtp.mailfrom=microsemi.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=microsemi.com; Received-SPF: Pass (protection.outlook.com: domain of microsemi.com designates 208.19.100.22 as permitted sender) receiver=protection.outlook.com; client-ip=208.19.100.22; helo=AVMBX2.microsemi.net; Received: from AVMBX2.microsemi.net (208.19.100.22) by BN1AFFO11FD024.mail.protection.outlook.com (10.58.52.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.1122.11 via Frontend Transport; Wed, 5 Sep 2018 05:47:11 +0000 Received: from AVMBX2.microsemi.net (10.100.34.32) by AVMBX2.microsemi.net (10.100.34.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1531.3; Tue, 4 Sep 2018 22:46:49 -0700 Received: from localhost (10.187.72.82) by avmbx2.microsemi.net (10.100.34.32) with Microsoft SMTP Server id 15.1.1531.3 via Frontend Transport; Tue, 4 Sep 2018 22:46:49 -0700 From: Viswas G To: CC: , , , , Subject: [PATCH 1/4] pm80xx : Fix for phy enable/disable functionality. Date: Wed, 5 Sep 2018 11:16:42 +0530 Message-ID: <20180905054645.19224-2-Viswas.G@microsemi.com> X-Mailer: git-send-email 2.19.0-rc1 In-Reply-To: <20180905054645.19224-1-Viswas.G@microsemi.com> References: <20180905054645.19224-1-Viswas.G@microsemi.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:208.19.100.22;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(39860400002)(396003)(346002)(376002)(136003)(2980300002)(438002)(199004)(189003)(316002)(69596002)(1076002)(6916009)(476003)(53936002)(68736007)(478600001)(76176011)(86362001)(6666003)(51416003)(4326008)(2906002)(81166006)(36756003)(48376002)(81156014)(97736004)(2870700001)(26005)(2616005)(5024004)(336012)(54906003)(106002)(446003)(76506005)(8676002)(57986006)(50466002)(126002)(356003)(5660300001)(50226002)(486006)(11346002)(305945005)(106466001)(186003)(8936002)(47776003)(77096007)(2351001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN7PR02MB4034;H:AVMBX2.microsemi.net;FPR:;SPF:Pass;LANG:en;PTR:InfoDomainNonexistent;A:1;MX:1; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD024;1:RQuNI9O3P6UzH0uvQY87E/oizno6L+CZO+loNDWw/IkLKN+5ga4MBAycCxnx/H1H/M46Q6sFb0TBx9mX6suU/MtXqaxzZrpddf3Z2OMHvpY1CdPkaRRE0JIBpLFxQw5h X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 67343ffe-1103-4f8c-9ff8-08d612f30672 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(5600074)(711020)(4608076)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060);SRVR:BN7PR02MB4034; X-Microsoft-Exchange-Diagnostics: 1;BN7PR02MB4034;3:1NTA7vEqBCVmtwFF1PZojUuYuUQ41kA0g7aB5rTGvz3OMoLhkqh3/Hjm7NiZFDTOAN/Z3DIkIexRpLce6MNMCbhEwK3BA5FPyWCqvsKFZqfWmqazAlhsJZhkgLQxKrjUhP2Dm0/804CepVsGIEDA4jaUP2a6CbvfRLUN7EXMvB2Sc/rSJBSL4qEAEfrGRpaUt3jWh4wdylLxwYiYOuXApxNzxmHRtv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mexQ2JnM14AZ+mCMS/1+jJ6wSYZW8TD3QlvIggqOIdOwe77G6LFoSP874b0Iyi4sPSdJQY1LYn7lv3St/c+mr2Rn5keT91/RtHjOljOUvChL5e3rNIu4Sj08g+tQmOSh3bzu9YHmm+mqsv5gmZ8plfl8TTn2Tp1xBmur/fNAKuFUSVFhhsTltBiyS+J9MKXoYDjYIjGQvzUypEAB7sMo6ekQ46I7CUilHk92YMDFiz2bWE70SwAY2GdgmFwnTquTEY0xHw2yivoe960mzJf52S3E1dLrjgpyB2ExoztoPvHOq7aMpq9U7EAYwDoKPz5O9FILoBpFzi83bOk= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93004095)(3002001)(3231311)(944501410)(52105095)(10201501046)(6055026)(149027)(150027)(6041310)(20161123558120)(20161123562045)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(201708071742011)(7699016);SRVR:BN7PR02MB4034;BCL:0;PCL:0;RULEID:;SRVR:BN7PR02MB4034; X-Microsoft-Exchange-Diagnostics: 1;BN7PR02MB4034;4:EBEOnPV8QQha8TgFhe9WqaCuUCI6gST6PmxyhRwhxmxTJlhw3Rfdw17DmiYC/+yy8sN0ykAyD93v+lRfG5/JaMcUNFbuVSyH2MzK6bEzmEfB7c42g0U86B+ISb5G1gIWfrWLcHgszZZ8On2aI8HwA4b8QsS5yXzQKX9tUxumE6HUNsm8COJVjEw1CmB8ewVaxnxgRs0sTrDX1hMIKN3hSpy2R3bvVl86FYGk0c3F+m6gJAFoqIabiNycy0l7bVmrTWHp5ThhbYTmVvVuvuNavQ== X-Forefront-PRVS: 078693968A X-Microsoft-Exchange-Diagnostics: 1;BN7PR02MB4034;23:2KaYNFZXrKL3Iy9MSwdAonid0NA1pryRv5tJ+hEsSUN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zpzKthzU1lbRubxAbNKANvUCsXCBBvOsp3ef5OCIRqjjSH9wlkF7uS1kgiabai4KUFYKs6rkfKZWS5UQ=;7:NzwfPjRXO8CyvCEvPkOCrctqmRcr1jT2irmgHTzTq4sJ71prRWSZ6QmH7tchBSpLdnpI7EEEwAl0VEaUzNsKtsFRR54hjNATf+yNxlvqx036RVZ1nbUIePdoUBs5+yqr+sJ8zaKlnIlTYBOA2ywUrv9UGG+mVVaxjrKhsuHhMr8tEd7pxk/1Pw+RAZYzDhwHaqZOU37qGsDHHsCrFePTSpWYVDVur6X1hi6YeOPyxT+n6a58cC2GSS2+8O9Z+WLf SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: microsemi.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2018 05:47:11.1844 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67343ffe-1103-4f8c-9ff8-08d612f30672 X-MS-Exchange-CrossTenant-Id: f267a5c8-86d8-4cc9-af71-1fd2c67c8fad X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f267a5c8-86d8-4cc9-af71-1fd2c67c8fad;Ip=[208.19.100.22];Helo=[AVMBX2.microsemi.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7PR02MB4034 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Deepak Ukey Added proper mask for phy id in mpi_phy_stop_resp(). Signed-off-by: Deepak Ukey Signed-off-by: Viswas G --- drivers/scsi/pm8001/pm8001_defs.h | 7 +++++++ drivers/scsi/pm8001/pm8001_hwi.c | 4 ++-- drivers/scsi/pm8001/pm8001_init.c | 2 +- drivers/scsi/pm8001/pm8001_sas.c | 16 +++++++++++++--- drivers/scsi/pm8001/pm80xx_hwi.c | 7 ++++--- drivers/scsi/pm8001/pm80xx_hwi.h | 4 ++++ 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/pm8001/pm8001_defs.h b/drivers/scsi/pm8001/pm8001_defs.h index 199527d..6b8bc66 100644 --- a/drivers/scsi/pm8001/pm8001_defs.h +++ b/drivers/scsi/pm8001/pm8001_defs.h @@ -132,4 +132,11 @@ enum pm8001_hba_info_flags { PM8001F_RUN_TIME = (1U << 1), }; +/** + * Phy Status + */ +#define PHY_LINK_DISABLE 0x00 +#define PHY_LINK_DOWN 0x01 +#define PHY_LINK_UP 0x02 + #endif diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c index 4dd6cad..fcfb4f7 100644 --- a/drivers/scsi/pm8001/pm8001_hwi.c +++ b/drivers/scsi/pm8001/pm8001_hwi.c @@ -3829,7 +3829,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) pm8001_printk("HW_EVENT_PHY_STOP_STATUS " "status = %x\n", status)); if (status == 0) - phy->phy_state = 0; + phy->phy_state = PHY_LINK_DISABLE; break; case HW_EVENT_SATA_SPINUP_HOLD: PM8001_MSG_DBG(pm8001_ha, @@ -3841,7 +3841,7 @@ static int mpi_hw_event(struct pm8001_hba_info *pm8001_ha, void* piomb) pm8001_printk("HW_EVENT_PHY_DOWN\n")); sas_ha->notify_phy_event(&phy->sas_phy, PHYE_LOSS_OF_SIGNAL); phy->phy_attached = 0; - phy->phy_state = 0; + phy->phy_state = PHY_LINK_DISABLE; hw_event_phy_down(pm8001_ha, piomb); break; case HW_EVENT_PORT_INVALID: diff --git a/drivers/scsi/pm8001/pm8001_init.c b/drivers/scsi/pm8001/pm8001_init.c index 7a697ca..3dca1dc 100644 --- a/drivers/scsi/pm8001/pm8001_init.c +++ b/drivers/scsi/pm8001/pm8001_init.c @@ -121,7 +121,7 @@ static void pm8001_phy_init(struct pm8001_hba_info *pm8001_ha, int phy_id) { struct pm8001_phy *phy = &pm8001_ha->phy[phy_id]; struct asd_sas_phy *sas_phy = &phy->sas_phy; - phy->phy_state = 0; + phy->phy_state = PHY_LINK_DISABLE; phy->pm8001_ha = pm8001_ha; sas_phy->enabled = (phy_id < pm8001_ha->chip->n_phy) ? 1 : 0; sas_phy->class = SAS; diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c index 947d601..96b173f 100644 --- a/drivers/scsi/pm8001/pm8001_sas.c +++ b/drivers/scsi/pm8001/pm8001_sas.c @@ -157,9 +157,12 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, int rc = 0, phy_id = sas_phy->id; struct pm8001_hba_info *pm8001_ha = NULL; struct sas_phy_linkrates *rates; + struct sas_ha_struct *sas_ha; + struct pm8001_phy *phy; DECLARE_COMPLETION_ONSTACK(completion); unsigned long flags; pm8001_ha = sas_phy->ha->lldd_ha; + phy = &pm8001_ha->phy[phy_id]; pm8001_ha->phy[phy_id].enable_completion = &completion; switch (func) { case PHY_FUNC_SET_LINK_RATE: @@ -172,7 +175,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, pm8001_ha->phy[phy_id].maximum_linkrate = rates->maximum_linkrate; } - if (pm8001_ha->phy[phy_id].phy_state == 0) { + if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); wait_for_completion(&completion); } @@ -180,7 +183,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, PHY_LINK_RESET); break; case PHY_FUNC_HARD_RESET: - if (pm8001_ha->phy[phy_id].phy_state == 0) { + if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); wait_for_completion(&completion); } @@ -188,7 +191,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, PHY_HARD_RESET); break; case PHY_FUNC_LINK_RESET: - if (pm8001_ha->phy[phy_id].phy_state == 0) { + if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_DISABLE) { PM8001_CHIP_DISP->phy_start_req(pm8001_ha, phy_id); wait_for_completion(&completion); } @@ -200,6 +203,13 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func, PHY_LINK_RESET); break; case PHY_FUNC_DISABLE: + if (pm8001_ha->phy[phy_id].phy_state == PHY_LINK_UP) { + sas_ha = pm8001_ha->sas; + sas_phy_disconnected(&phy->sas_phy); + sas_ha->notify_phy_event(&phy->sas_phy, + PHYE_LOSS_OF_SIGNAL); + phy->phy_attached = 0; + } PM8001_CHIP_DISP->phy_stop_req(pm8001_ha, phy_id); break; case PHY_FUNC_GET_EVENTS: diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_hwi.c index 42f0405..17e74a3 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -3384,13 +3384,14 @@ static int mpi_phy_stop_resp(struct pm8001_hba_info *pm8001_ha, void *piomb) u32 status = le32_to_cpu(pPayload->status); u32 phyid = - le32_to_cpu(pPayload->phyid); + le32_to_cpu(pPayload->phyid) & 0xFF; struct pm8001_phy *phy = &pm8001_ha->phy[phyid]; PM8001_MSG_DBG(pm8001_ha, pm8001_printk("phy:0x%x status:0x%x\n", phyid, status)); - if (status == 0) - phy->phy_state = 0; + if (status == PHY_STOP_SUCCESS || + status == PHY_STOP_ERR_DEVICE_ATTACHED) + phy->phy_state = PHY_LINK_DISABLE; return 0; } diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_hwi.h index 889e69c..49fb769 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.h +++ b/drivers/scsi/pm8001/pm80xx_hwi.h @@ -170,6 +170,10 @@ #define LINKRATE_60 (0x04 << 8) #define LINKRATE_120 (0x08 << 8) +/*phy_stop*/ +#define PHY_STOP_SUCCESS 0x00 +#define PHY_STOP_ERR_DEVICE_ATTACHED 0x1046 + /* phy_profile */ #define SAS_PHY_ANALOG_SETTINGS_PAGE 0x04 #define PHY_DWORD_LENGTH 0xC