From patchwork Thu Dec 29 11:31:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhang, Sonic" X-Patchwork-Id: 133539 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id ECF69B6F9A for ; Thu, 29 Dec 2011 22:31:01 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753437Ab1L2LbA (ORCPT ); Thu, 29 Dec 2011 06:31:00 -0500 Received: from ch1ehsobe006.messaging.microsoft.com ([216.32.181.186]:8304 "EHLO ch1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753422Ab1L2La7 convert rfc822-to-8bit (ORCPT ); Thu, 29 Dec 2011 06:30:59 -0500 Received: from mail107-ch1-R.bigfish.com (10.43.68.245) by CH1EHSOBE013.bigfish.com (10.43.70.63) with Microsoft SMTP Server id 14.1.225.23; Thu, 29 Dec 2011 11:30:36 +0000 Received: from mail107-ch1 (localhost [127.0.0.1]) by mail107-ch1-R.bigfish.com (Postfix) with ESMTP id DB673A01C4; Thu, 29 Dec 2011 11:31:21 +0000 (UTC) X-SpamScore: -6 X-BigFish: VPS-6(zz9371I542Mzz1202hzz8275bhz2dh2a8h668h839h944h) X-Forefront-Antispam-Report: CIP:137.71.25.57; KIP:(null); UIP:(null); IPV:NLI; H:nwd2mta2.analog.com; RD:nwd2mail11.analog.com; EFVD:NLI X-FB-SS: 13, Received: from mail107-ch1 (localhost.localdomain [127.0.0.1]) by mail107-ch1 (MessageSwitch) id 1325158281684908_19077; Thu, 29 Dec 2011 11:31:21 +0000 (UTC) Received: from CH1EHSMHS011.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.245]) by mail107-ch1.bigfish.com (Postfix) with ESMTP id 97DF86C0047; Thu, 29 Dec 2011 11:31:21 +0000 (UTC) Received: from nwd2mta2.analog.com (137.71.25.57) by CH1EHSMHS011.bigfish.com (10.43.70.11) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 29 Dec 2011 11:30:35 +0000 Received: from NWD2HUBCAS2.ad.analog.com (nwd2hubcas2.ad.analog.com [10.64.73.30]) by nwd2mta2.analog.com (8.13.8/8.13.8) with ESMTP id pBTBt7dx011937 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 29 Dec 2011 06:55:08 -0500 Received: from NWD2CMBX1.ad.analog.com ([169.254.1.106]) by NWD2HUBCAS2.ad.analog.com ([10.64.73.30]) with mapi; Thu, 29 Dec 2011 06:31:06 -0500 From: "Zhang, Sonic" To: Sergei Shtylyov , "linux-ide@vger.kernel.org" , "jgarzik@pobox.com" Date: Thu, 29 Dec 2011 06:31:04 -0500 Subject: RE: [PATCH] pata_bf54x: fix BMIDE status register emulation Thread-Topic: [PATCH] pata_bf54x: fix BMIDE status register emulation Thread-Index: AczFbk/bRXC0zW8zTbqSD3M+G0Yj1QAraFYw Message-ID: References: <201112281836.45834.sshtylyov@ru.mvista.com> In-Reply-To: <201112281836.45834.sshtylyov@ru.mvista.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: zh-CN, en-US MIME-Version: 1.0 X-OriginatorOrg: analog.com Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org Acked-by: Sonic Zhang SG list was not implemented in pata_bf54x driver from the beginning, because ATAPI controller on BF54x support maximum 131070 bytes in one BMDMA transfer. The size in sg list buffers may exceeds this limitation easily. Do you know a way to set the maximum total buffer size in a sg list? Static struct scsi_host_template bfin_sht = { ATA_BASE_SHT(DRV_NAME), .sg_tablesize = SG_NONE, .dma_boundary = ATA_DMA_BOUNDARY, }; Sonic -----Original Message----- From: Sergei Shtylyov [mailto:sshtylyov@ru.mvista.com] Sent: Wednesday, December 28, 2011 11:37 PM To: linux-ide@vger.kernel.org; jgarzik@pobox.com; Zhang, Sonic Subject: [PATCH] pata_bf54x: fix BMIDE status register emulation The author of this driver clearly wasn't familiar with the BMIDE specification (also known as SFF-8038i) when he implemented the bmdma_status() method: first, the interrupt bit of the BMIDE status register corresponds to nothing else but INTRQ signal (ATAPI_DEV_INT here); second, the error bit is only set if the controller encounters issue doing the bus master transfers, not on the DMA burst termination interrupts like here (moreover, setting the error bit doesn't cause an interrupt). (The only thing I couldn't figure out is how to flush the FIFO to memory once the interrupt happens as required by the mentioned spec.) Signed-off-by: Sergei Shtylyov --- The patch is against the current Linus' tree. Sonic, if you still work in Analog Devices, please give this a try. I looked over the driver, and it left pretty bad impression. In particular, I highly doubt that the transfers with more than one S/G item can work. And this is after the driver has been in the kernel for 4 years already... Unfortunately, I have neither hardware nor much time to work on improving it... drivers/ata/pata_bf54x.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/drivers/ata/pata_bf54x.c =================================================================== --- linux-2.6.orig/drivers/ata/pata_bf54x.c +++ linux-2.6/drivers/ata/pata_bf54x.c @@ -1153,15 +1153,11 @@ static unsigned char bfin_bmdma_status(s { unsigned char host_stat = 0; void __iomem *base = (void __iomem *)ap->ioaddr.ctl_addr; - unsigned short int_status = ATAPI_GET_INT_STATUS(base); - if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) + if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON | ULTRA_XFER_ON)) host_stat |= ATA_DMA_ACTIVE; - if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT| - ATAPI_DEV_INT)) + if (ATAPI_GET_INT_STATUS(base) & ATAPI_DEV_INT) host_stat |= ATA_DMA_INTR; - if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) - host_stat |= ATA_DMA_ERR|ATA_DMA_INTR; dev_dbg(ap->dev, "ATAPI: host_stat=0x%x\n", host_stat);