From patchwork Fri Jun 3 12:13:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charles Chiou X-Patchwork-Id: 9152973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 50A5760221 for ; Fri, 3 Jun 2016 12:13:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4068E2804C for ; Fri, 3 Jun 2016 12:13:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3532228309; Fri, 3 Jun 2016 12:13:36 +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=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 255482804C for ; Fri, 3 Jun 2016 12:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161096AbcFCMNd (ORCPT ); Fri, 3 Jun 2016 08:13:33 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:36829 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161094AbcFCMNc (ORCPT ); Fri, 3 Jun 2016 08:13:32 -0400 Received: by mail-pf0-f196.google.com with SMTP id 62so11387595pfd.3; Fri, 03 Jun 2016 05:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=HfK+dCPFGdNgE3vAcYEJnpLRQBpTTGZz8awcJg8puEk=; b=l/jig6qNr8WfEyc8TGlk6r+m7SyMRW9zZ8Jo5xgk2JgcarqDR0Kxg0KezAqz7fUqmp 7J97Z7R1j/5bXiJBfxzSEt0TKmvEN7i57RMSE0puAClDej5vv+l2u6uc6wnn06bW/Dza M4h1BDhpqhp+oU1BJSDtDJ40/4Ln4h1hC7YsXPwlXScR8F9P0k8Q1Y+KovuZgzdXzDom zuE/DIF0HL8dn7gHxnK4VkcTiD+s3nDwsp0aTYO6T/zapjMSLDY2jSSSjvXT2Tfw3e+r keRbl7a0zQ69Ikx62xIAPmq8qZ+ldsv2Jls7zms7TZZN2FN7Py5SFyBsvaJpzFmzAmyv sGKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HfK+dCPFGdNgE3vAcYEJnpLRQBpTTGZz8awcJg8puEk=; b=bP5hUOR73R7qX9YMHZ16EUphOt4Wu4oQVnvd120AR2OywLn8vDJDLFZprdHlEgOgPH t1lVeDztHh6j8m88mch6rKyZPkDPFq6PizdX86Vtnn5SFo2wyP0YJNnu4p2ywdJ5bu2p euq1X2wOem9dkwY4mVHJln2QuNmx5Lmq4a5j0p9/avxe51JZY31yGGwmAUtbxDJ1nEee vWgUDACoDaVLSKZ7n7Y0VSa+lI6CLndtdOZsL7I+QCZxOPvFj2PE2udaL2QLhD6azGyh WDp11AKhcC3Q5MOdCpw0YJ4rzNFXe50ou9azZSGW99vOPBQr6YVdit+vcytws/KwmfqA udog== X-Gm-Message-State: ALyK8tLL4IeXho0IFsK0n1Nt4/YxaLUakARcZ7f/SVQRoEp68iHqv6LNdm8Q0reSk0LdZw== X-Received: by 10.98.71.135 with SMTP id p7mr5773233pfi.165.1464956008907; Fri, 03 Jun 2016 05:13:28 -0700 (PDT) Received: from charles-desktop.promise.com.tw (vpn.promise.com.tw. [61.222.81.253]) by smtp.gmail.com with ESMTPSA id q188sm8083794pfq.66.2016.06.03.05.13.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Jun 2016 05:13:28 -0700 (PDT) From: Charles Chiou To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, linus.chen@tw.promise.com, grace.chang@tw.promise.com, victor.p@promise.com, eva.cheng@tw.promise.com, charles.chiou@tw.promise.com Cc: Paul Subject: [PATCH 3/5] Add P3 support, modify IO & reset Date: Fri, 3 Jun 2016 20:13:24 +0800 Message-Id: <1464956004-16836-1-git-send-email-ch1102chiou@gmail.com> X-Mailer: git-send-email 1.9.1 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: Paul 1.Send command add P3 write reg 2.In get intr, read P3 reg & clear interrupt reg 3.Abort read & clear reg same as getting intr 4.Reset flow add P3 reset function because P3 don't need read back reg Signed-off-by: Paul --- drivers/scsi/stex.c | 68 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c index 921f4e3..4d74905 100644 --- a/drivers/scsi/stex.c +++ b/drivers/scsi/stex.c @@ -548,11 +548,15 @@ stex_ss_send_cmd(struct st_hba *hba, struct req_msg *req, u16 tag) ++hba->req_head; hba->req_head %= hba->rq_count+1; - - writel((addr >> 16) >> 16, hba->mmio_base + YH2I_REQ_HI); - readl(hba->mmio_base + YH2I_REQ_HI); /* flush */ - writel(addr, hba->mmio_base + YH2I_REQ); - readl(hba->mmio_base + YH2I_REQ); /* flush */ + if (hba->cardtype == st_P3) { + writel((addr >> 16) >> 16, hba->mmio_base + YH2I_REQ_HI); + writel(addr, hba->mmio_base + YH2I_REQ); + } else { + writel((addr >> 16) >> 16, hba->mmio_base + YH2I_REQ_HI); + readl(hba->mmio_base + YH2I_REQ_HI); /* flush */ + writel(addr, hba->mmio_base + YH2I_REQ); + readl(hba->mmio_base + YH2I_REQ); /* flush */ + } } static void return_abnormal_state(struct st_hba *hba, int status) @@ -982,15 +986,31 @@ static irqreturn_t stex_ss_intr(int irq, void *__hba) spin_lock_irqsave(hba->host->host_lock, flags); - data = readl(base + YI2H_INT); - if (data && data != 0xffffffff) { - /* clear the interrupt */ - writel(data, base + YI2H_INT_C); - stex_ss_mu_intr(hba); - spin_unlock_irqrestore(hba->host->host_lock, flags); - if (unlikely(data & SS_I2H_REQUEST_RESET)) - queue_work(hba->work_q, &hba->reset_work); - return IRQ_HANDLED; + if (hba->cardtype == st_yel) { + data = readl(base + YI2H_INT); + if (data && data != 0xffffffff) { + /* clear the interrupt */ + writel(data, base + YI2H_INT_C); + stex_ss_mu_intr(hba); + spin_unlock_irqrestore(hba->host->host_lock, flags); + if (unlikely(data & SS_I2H_REQUEST_RESET)) + queue_work(hba->work_q, &hba->reset_work); + return IRQ_HANDLED; + } + } else { + data = readl(base + PSCRATCH4); + if (data != 0xffffffff) { + if (data != 0) { + /* clear the interrupt */ + writel(data, base + PSCRATCH1); + writel((1 << 22), base + YH2I_INT); + } + stex_ss_mu_intr(hba); + spin_unlock_irqrestore(hba->host->host_lock, flags); + if (unlikely(data & SS_I2H_REQUEST_RESET)) + queue_work(hba->work_q, &hba->reset_work); + return IRQ_HANDLED; + } } spin_unlock_irqrestore(hba->host->host_lock, flags); @@ -1240,6 +1260,15 @@ static int stex_abort(struct scsi_cmnd *cmd) writel(data, base + YI2H_INT_C); stex_ss_mu_intr(hba); + } else if (hba->cardtype == st_P3) { + data = readl(base + PSCRATCH4); + if (data == 0xffffffff) + goto fail_out; + if (data != 0) { + writel(data, base + PSCRATCH1); + writel((1 << 22), base + YH2I_INT); + } + stex_ss_mu_intr(hba); } else { data = readl(base + ODBL); if (data == 0 || data == 0xffffffff) @@ -1247,9 +1276,9 @@ static int stex_abort(struct scsi_cmnd *cmd) writel(data, base + ODBL); readl(base + ODBL); /* flush */ - stex_mu_intr(hba, data); } + if (hba->wait_ccb == NULL) { printk(KERN_WARNING DRV_NAME "(%s): lost interrupt\n", pci_name(hba->pdev)); @@ -1343,6 +1372,12 @@ static void stex_ss_reset(struct st_hba *hba) ssleep(5); } +static void stex_p3_reset(struct st_hba *hba) +{ + writel(SS_H2I_INT_RESET, hba->mmio_base + YH2I_INT); + ssleep(5); +} + static int stex_do_reset(struct st_hba *hba) { unsigned long flags; @@ -1379,7 +1414,8 @@ static int stex_do_reset(struct st_hba *hba) stex_hard_reset(hba); else if (hba->cardtype == st_yel) stex_ss_reset(hba); - + else if (hba->cardtype == st_P3) + stex_p3_reset(hba); return_abnormal_state(hba, DID_RESET);