From patchwork Tue Oct 9 15:53:12 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Gmeiner X-Patchwork-Id: 190352 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 5E8592C037C for ; Wed, 10 Oct 2012 02:40:30 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932096Ab2JIPk1 (ORCPT ); Tue, 9 Oct 2012 11:40:27 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:39817 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932094Ab2JIPkZ (ORCPT ); Tue, 9 Oct 2012 11:40:25 -0400 Received: by mail-wg0-f44.google.com with SMTP id dr13so4844324wgb.1 for ; Tue, 09 Oct 2012 08:40:23 -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:x-mailer; bh=L6OOnW0/J/nN1F2OOu24ILZuJSA7oEiEXjpyIyG5mtw=; b=B5KIY6yQkMZJ7U1viXKYDWaT+4S2f6ZBBmPizqfZIMRxfoaYj9bmnj76+tFipgyrCu sfNMfTzAHWxcBROIarxmIaOaUmjDWkKoTZnbP5TLFS2LUPJCOepD7qrt9UAv8cmrnVkq Z6czBBXWtgLMKY/xl9pSp6+fD74lk39GZAzNipxZp6UC7h5c+Q6ESyNKHcghl8UnuAVd NXdIM/9wG4s2ELSExCz6Xs5QEu0OpkXeGSaSHBVfAzRs3c2hliG3/7IyYrRJxsc2E6NR 16YnBCyAe8aZxTyccTRm9AgpVZk3xh3XFEMP7TMkCRa4ZvQS/xymtt+D8qghx39AOjEW TEPA== Received: by 10.180.8.41 with SMTP id o9mr5622392wia.3.1349797223582; Tue, 09 Oct 2012 08:40:23 -0700 (PDT) Received: from localhost.localdomain (089144206089.atnat0015.highway.a1.net. [89.144.206.89]) by mx.google.com with ESMTPS id hv8sm26159793wib.0.2012.10.09.08.40.21 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 09 Oct 2012 08:40:22 -0700 (PDT) From: Christian Gmeiner To: linux-ide@vger.kernel.org, mkp@mkp.net, jgarzik@pobox.com Cc: Christian Gmeiner Subject: [PATCH] pata_cs5536: add quirk for broken udma Date: Tue, 9 Oct 2012 17:53:12 +0200 Message-Id: <1349797992-32611-1-git-send-email-christian.gmeiner@gmail.com> X-Mailer: git-send-email 1.7.12.2.421.g261b511 Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org I am working on a device which uses the cs5536 pata driver. There are some broken hardware revisions out in the field, which can be detected via DMI. On older versions with an embedded BIOS I used libata.dma=0 to disable dma completely. Now we are switching to a coreboot/seabios based BIOS where we have DMI support and so I think its a good idea to get rid of all those hacky kernel parameters as the same image is used other devices where libata.dma=0 is not a good idea. Signed-off-by: Christian Gmeiner --- drivers/ata/pata_cs5536.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/ata/pata_cs5536.c b/drivers/ata/pata_cs5536.c index dec1b6c..0448860 100644 --- a/drivers/ata/pata_cs5536.c +++ b/drivers/ata/pata_cs5536.c @@ -38,6 +38,7 @@ #include #include #include +#include #ifdef CONFIG_X86_32 #include @@ -80,6 +81,21 @@ enum { IDE_ETC_UDMA_MASK = 0xc0, }; +/* Some Bachmann OT200 devices have a non working UDMA support due a + * missing resistor. + */ +static const struct dmi_system_id udma_quirk_dmi_table[] = { + { + .ident = "Bachmann electronic OT200", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Bachmann electronic"), + DMI_MATCH(DMI_PRODUCT_NAME, "OT200"), + DMI_MATCH(DMI_PRODUCT_VERSION, "1") + }, + }, + { } +}; + static int cs5536_read(struct pci_dev *pdev, int reg, u32 *val) { if (unlikely(use_msr)) { @@ -242,9 +258,23 @@ static int cs5536_init_one(struct pci_dev *dev, const struct pci_device_id *id) .port_ops = &cs5536_port_ops, }; - const struct ata_port_info *ppi[] = { &info, &ata_dummy_port_info }; + static const struct ata_port_info no_udma_info = { + .flags = ATA_FLAG_SLAVE_POSS, + .pio_mask = ATA_PIO4, + .port_ops = &cs5536_port_ops, + }; + + + const struct ata_port_info *ppi[2]; u32 cfg; + if (dmi_check_system(udma_quirk_dmi_table)) + ppi[0] = &no_udma_info; + else + ppi[0] = &info; + + ppi[1] = &ata_dummy_port_info; + if (use_msr) printk(KERN_ERR DRV_NAME ": Using MSR regs instead of PCI\n");