Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933330Ab0HET5w (ORCPT ); Thu, 5 Aug 2010 15:57:52 -0400 Received: from na3sys009aog105.obsmtp.com ([74.125.149.75]:50514 "EHLO na3sys009aog105.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759273Ab0HET5t convert rfc822-to-8bit (ORCPT ); Thu, 5 Aug 2010 15:57:49 -0400 From: "Yang, Bo" To: "Yang, Bo" , "'James.Bottomley@HansenPartnership.com'" , "'James.Bottomley@suse.de'" CC: "'linux-scsi@vger.kernel.org'" , "'akpm@osdl.org'" , "'linux-kernel@vger.kernel.org'" , "Daftardar, Jayant" Date: Thu, 5 Aug 2010 13:57:25 -0600 Subject: [PATCH 3/12] scsi: megaraid_sas - Online Controller Reset - III: add the reset function for Gen2 related chip Thread-Topic: [PATCH 3/12] scsi: megaraid_sas - Online Controller Reset - III: add the reset function for Gen2 related chip Thread-Index: AcsISPnOZnFQYxn1TaKnA/NMZ/+H5gsjzrvA Message-ID: <4B6A08C587958942AA3002690DD4F8C3DBD67F7A@cosmail02.lsi.com> References: <4B6A08C587958942AA3002690DD4F8C3D0804546@cosmail02.lsi.com> In-Reply-To: <4B6A08C587958942AA3002690DD4F8C3D0804546@cosmail02.lsi.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1992 Lines: 66 Re-submitted requested by James Bottomley. Add the gen2 chip reset functions to the driver. Driver will write the gen2 chip register offset to force the controller to reset. Signed-off-by Bo Yang --- drivers/scsi/megaraid/megaraid_sas.c | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff -rupN old/drivers/scsi/megaraid/megaraid_sas.c new/drivers/scsi/megaraid/megaraid_sas.c --- old/drivers/scsi/megaraid/megaraid_sas.c 2010-06-08 14:38:29.000000000 -0400 +++ new/drivers/scsi/megaraid/megaraid_sas.c 2010-06-08 14:38:43.000000000 -0400 @@ -662,6 +662,47 @@ static int megasas_adp_reset_gen2(struct megasas_instance *instance, struct megasas_register_set __iomem *reg_set) { + u32 retry = 0 ; + u32 HostDiag; + + writel(0, ®_set->seq_offset); + writel(4, ®_set->seq_offset); + writel(0xb, ®_set->seq_offset); + writel(2, ®_set->seq_offset); + writel(7, ®_set->seq_offset); + writel(0xd, ®_set->seq_offset); + msleep(1000); + + HostDiag = (u32)readl(®_set->host_diag); + + while ( !( HostDiag & DIAG_WRITE_ENABLE) ) { + msleep(100); + HostDiag = (u32)readl(®_set->host_diag); + printk(KERN_NOTICE "RESETGEN2: retry=%x, hostdiag=%x\n", + retry, HostDiag); + + if (retry++ >= 100) + return 1; + + } + + printk(KERN_NOTICE "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag); + + writel((HostDiag | DIAG_RESET_ADAPTER), ®_set->host_diag); + + ssleep(10); + + HostDiag = (u32)readl(®_set->host_diag); + while ( ( HostDiag & DIAG_RESET_ADAPTER) ) { + msleep(100); + HostDiag = (u32)readl(®_set->host_diag); + printk(KERN_NOTICE "RESET_GEN2: retry=%x, hostdiag=%x\n", + retry, HostDiag); + + if (retry++ >= 1000) + return 1; + + } return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/