From patchwork Wed Nov 25 17:11:15 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 39379 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 4CBE7B7067 for ; Thu, 26 Nov 2009 04:22:30 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753414AbZKYRQD (ORCPT ); Wed, 25 Nov 2009 12:16:03 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754144AbZKYRQC (ORCPT ); Wed, 25 Nov 2009 12:16:02 -0500 Received: from mail-ew0-f219.google.com ([209.85.219.219]:52976 "EHLO mail-ew0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755075AbZKYRL4 (ORCPT ); Wed, 25 Nov 2009 12:11:56 -0500 Received: by mail-ew0-f219.google.com with SMTP id 19so602015ewy.21 for ; Wed, 25 Nov 2009 09:12:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :in-reply-to:references:subject; bh=yI+COR3cPPmYlnHBXqGSYJqPSLJBtQ05VTfBv4eIFlQ=; b=tbZek/Pi/aHF+1MsB9B5+wGIsau0q4RgLOf1O8P9kZFaBrJLuaWVGoYGEm1gu0hiM3 IowOCFWxM0zWjk3GqYYisQtro0xK97yA4UdwGfiV+HOOOOoSYUMB0Boeyzot8r2aTtZj W2N0PQd/QxycvOAgfePF+Wb4Jg0/dsZmviako= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:in-reply-to:references:subject; b=hU5LJTKQQfP/ySYRjpIYto0IiTC+qRVP0ORaomN2bYUMY/uz2bgPREdXb8myknV0CE dpKc1G3U7LFsfE48BP9Wfu0CNJ9R77wDElxGCivRZSiLT4+1Lgu+VNPV3DDFTeuTjLVP ld/TwLxRVQmfJW3WoSxD65fY3nI0fTqGqQwvA= Received: by 10.216.90.131 with SMTP id e3mr2566031wef.69.1259169121207; Wed, 25 Nov 2009 09:12:01 -0800 (PST) Received: from ?127.0.0.1? (chello089079027028.chello.pl [89.79.27.28]) by mx.google.com with ESMTPS id t2sm14645507gve.9.2009.11.25.09.11.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 25 Nov 2009 09:11:59 -0800 (PST) From: Bartlomiej Zolnierkiewicz To: linux-ide@vger.kernel.org Cc: Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org Date: Wed, 25 Nov 2009 18:11:15 +0100 Message-Id: <20091125171115.5446.23518.sendpatchset@localhost> In-Reply-To: <20091125170218.5446.13513.sendpatchset@localhost> References: <20091125170218.5446.13513.sendpatchset@localhost> Subject: [PATCH 74/86] pata_serverworks: add serverworks_fixup() 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_serverworks: add serverworks_fixup() Factor out common code from serverworks_[re]init_one() to serverworks_fixup(). Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ata/pata_serverworks.c | 57 ++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 28 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_serverworks.c =================================================================== --- a/drivers/ata/pata_serverworks.c +++ b/drivers/ata/pata_serverworks.c @@ -371,6 +371,31 @@ static void serverworks_fixup_ht1000(str pci_write_config_byte(pdev, 0x5A, btr); } +static int serverworks_fixup(struct pci_dev *pdev) +{ + int rc = 0; + + /* Force master latency timer to 64 PCI clocks */ + pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); + + switch (pdev->device) { + case PCI_DEVICE_ID_SERVERWORKS_OSB4IDE: + rc = serverworks_fixup_osb4(pdev); + break; + case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE: + ata_pci_bmdma_clear_simplex(pdev); + /* fall through */ + case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE: + case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2: + rc = serverworks_fixup_csb(pdev); + break; + case PCI_DEVICE_ID_SERVERWORKS_HT1000IDE: + serverworks_fixup_ht1000(pdev); + break; + } + + return rc; +} static int serverworks_init_one(struct pci_dev *pdev, const struct pci_device_id *id) { @@ -408,13 +433,12 @@ static int serverworks_init_one(struct p if (rc) return rc; - /* Force master latency timer to 64 PCI clocks */ - pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); + rc = serverworks_fixup(pdev); /* OSB4 : South Bridge and IDE */ if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { /* Select non UDMA capable OSB4 if we can't do fixups */ - if ( serverworks_fixup_osb4(pdev) < 0) + if (rc < 0) ppi[0] = &info[1]; } /* setup CSB5/CSB6 : South Bridge and IDE option RAID */ @@ -424,19 +448,13 @@ static int serverworks_init_one(struct p /* If the returned btr is the newer revision then select the right info block */ - if (serverworks_fixup_csb(pdev) == 3) + if (rc == 3) ppi[0] = &info[3]; /* Is this the 3rd channel CSB6 IDE ? */ if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) ppi[1] = &ata_dummy_port_info; } - /* setup HT1000E */ - else if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_HT1000IDE) - serverworks_fixup_ht1000(pdev); - - if (pdev->device == PCI_DEVICE_ID_SERVERWORKS_CSB5IDE) - ata_pci_bmdma_clear_simplex(pdev); return ata_pci_sff_init_one(pdev, ppi, &serverworks_sht, NULL); } @@ -451,24 +469,7 @@ static int serverworks_reinit_one(struct if (rc) return rc; - /* Force master latency timer to 64 PCI clocks */ - pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0x40); - - switch (pdev->device) { - case PCI_DEVICE_ID_SERVERWORKS_OSB4IDE: - serverworks_fixup_osb4(pdev); - break; - case PCI_DEVICE_ID_SERVERWORKS_CSB5IDE: - ata_pci_bmdma_clear_simplex(pdev); - /* fall through */ - case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE: - case PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2: - serverworks_fixup_csb(pdev); - break; - case PCI_DEVICE_ID_SERVERWORKS_HT1000IDE: - serverworks_fixup_ht1000(pdev); - break; - } + (void)serverworks_fixup(pdev); ata_host_resume(host); return 0;