From patchwork Tue Oct 6 22:27:19 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 35159 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.176.167]) by ozlabs.org (Postfix) with ESMTP id B3F0FB7BC3 for ; Wed, 7 Oct 2009 09:45:37 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933219AbZJFW1n (ORCPT ); Tue, 6 Oct 2009 18:27:43 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S933391AbZJFW1n (ORCPT ); Tue, 6 Oct 2009 18:27:43 -0400 Received: from mail-bw0-f210.google.com ([209.85.218.210]:60902 "EHLO mail-bw0-f210.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933219AbZJFW1l (ORCPT ); Tue, 6 Oct 2009 18:27:41 -0400 Received: by mail-bw0-f210.google.com with SMTP id 6so3689389bwz.37 for ; Tue, 06 Oct 2009 15:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:subject:date :user-agent:cc:mime-version:message-id:content-type :content-transfer-encoding; bh=Aq9Oq3hRbH2AnbwsUjFOZ6VkNnReGCb1DYHGgmkV9ZI=; b=B+ngSKXCFtVsQFg3i90ZLzrKlwzruRZyNxJcKu0k6zCAC8aWbuStVWgfn2qDjIo5gz n6YehLpCSd+T70TFYrboDAq6wo2YS2Qk5SqxbU06nvhXx8lv+pTmIB7gQNJPnsNna21i FL5NOvCanws+e234uD3gdLbs/Lx5/J23uKwe4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:date:user-agent:cc:mime-version:message-id :content-type:content-transfer-encoding; b=UZ/hJrfYxCPxv3C3PKjRVaTv+JRjcSXn9N+yvTuyd0JUJF71m5Y113AsKiByB0VIvD z/cuzsmVbptTfI+Zl4IPb+akw3995Tdd8XLtDEToMQiGwgJfBlByBAFGClEELhFqEdMb X3qSgio7CrVIMxNOx3vGI1sISs5+Xm3+1fz7I= Received: by 10.103.125.38 with SMTP id c38mr952695mun.119.1254868049795; Tue, 06 Oct 2009 15:27:29 -0700 (PDT) Received: from szaki.localnet (chello089077034197.chello.pl [89.77.34.197]) by mx.google.com with ESMTPS id 14sm990769muo.15.2009.10.06.15.27.27 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 06 Oct 2009 15:27:29 -0700 (PDT) From: Bartlomiej Zolnierkiewicz To: Jeff Garzik Subject: [PATCH 3/4] pata_atp867x: PIO support fixes Date: Wed, 7 Oct 2009 00:27:19 +0200 User-Agent: KMail/1.12.1 (Linux/2.6.31.1-56.fc12.x86_64; KDE/4.3.1; x86_64; ; ) Cc: Jung-Ik Lee (John) , linux-ide@vger.kernel.org MIME-Version: 1.0 Message-Id: <200910070027.19753.bzolnier@gmail.com> Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org From: Bartlomiej Zolnierkiewicz Subject: [PATCH] pata_atp867x: PIO support fixes * use 8 clk setting for active clocks == 7 (was 12 clk) * use 12 clk setting for active clocks > 12 (was 8 clk) * do 66MHz bus fixup before mapping active clocks * fix setup of PIO command timings Acked-by: Jung-Ik (John) Lee Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ata/pata_atp867x.c | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 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: b/drivers/ata/pata_atp867x.c =================================================================== --- a/drivers/ata/pata_atp867x.c +++ b/drivers/ata/pata_atp867x.c @@ -155,30 +155,31 @@ static int atp867x_get_active_clocks_shi struct atp867x_priv *dp = ap->private_data; unsigned char clocks = clk; + /* + * Doc 6.6.9: increase the clock value by 1 for safer PIO speed + * on 66MHz bus + */ + if (dp->pci66mhz) + clocks++; + switch (clocks) { case 0: clocks = 1; break; - case 1 ... 7: - break; - case 9 ... 12: - clocks = 7; + case 1 ... 6: break; default: printk(KERN_WARNING "ATP867X: active %dclk is invalid. " - "Using default 8clk.\n", clk); + "Using 12clk.\n", clk); + case 9 ... 12: + clocks = 7; /* 12 clk */ + break; + case 7: case 8: /* default 8 clk */ clocks = 0; goto active_clock_shift_done; } - /* - * Doc 6.6.9: increase the clock value by 1 for safer PIO speed - * on 66MHz bus - */ - if (dp->pci66mhz && clocks < 7) - clocks++; - active_clock_shift_done: return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT; } @@ -193,7 +194,8 @@ static int atp867x_get_recover_clocks_sh break; case 1 ... 11: break; - case 13: case 14: + case 13: + case 14: --clocks; /* by the spec */ break; case 15: @@ -235,16 +237,16 @@ static void atp867x_set_piomode(struct a iowrite8(b, dp->dma_mode); b = atp867x_get_active_clocks_shifted(ap, t.active) | - atp867x_get_recover_clocks_shifted(t.recover); + atp867x_get_recover_clocks_shifted(t.recover); if (adev->devno & 1) iowrite8(b, dp->slave_piospd); else iowrite8(b, dp->mstr_piospd); - /* - * use the same value for comand timing as for PIO timimg - */ + b = atp867x_get_active_clocks_shifted(ap, t.act8b) | + atp867x_get_recover_clocks_shifted(t.rec8b); + iowrite8(b, dp->eightb_piospd); }