Linux-ide Archive mirror
 help / color / mirror / Atom feed
* [RFC] [Patch] pata_cs5536: add quirk for broken udma
@ 2012-07-26 13:40 Christian Gmeiner
  2012-08-17 17:34 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Gmeiner @ 2012-07-26 13:40 UTC (permalink / raw
  To: linux-ide; +Cc: mkp

Hi all.

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. I am
looking for a way now to get
this quirk upstream. On older versions with an embedded BIOS and 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 so a good idea.

I came up with this patch. I am not sure if it would be better to
patch libata-core.c

Thanks,
---
Christian Gmeiner, MSc


--- linux-3.2.24___OK/drivers/ata/pata_cs5536.c	2012-07-25
05:11:50.000000000 +0200
+++ linux-3.2.24/drivers/ata/pata_cs5536.c	2012-07-26 15:38:27.674909884 +0200
@@ -37,6 +37,7 @@
 #include <linux/delay.h>
 #include <linux/libata.h>
 #include <scsi/scsi_host.h>
+#include <linux/dmi.h>

 #ifdef CONFIG_X86_32
 #include <asm/msr.h>
@@ -95,6 +96,21 @@
 	PCI_IDE_CFG, PCI_IDE_DTC, PCI_IDE_CAST, PCI_IDE_ETC,
 };

+/* 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 inline int cs5536_read(struct pci_dev *pdev, int reg, u32 *val)
 {
 	if (unlikely(use_msr)) {
@@ -257,9 +273,22 @@
 		.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");

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] [Patch] pata_cs5536: add quirk for broken udma
  2012-07-26 13:40 [RFC] [Patch] pata_cs5536: add quirk for broken udma Christian Gmeiner
@ 2012-08-17 17:34 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2012-08-17 17:34 UTC (permalink / raw
  To: Christian Gmeiner; +Cc: linux-ide, mkp

On 07/26/2012 09:40 AM, Christian Gmeiner wrote:
> Hi all.
>
> 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. I am
> looking for a way now to get
> this quirk upstream. On older versions with an embedded BIOS and 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 so a good idea.
>
> I came up with this patch. I am not sure if it would be better to
> patch libata-core.c
>
> Thanks,
> ---
> Christian Gmeiner, MSc
>
>
> --- linux-3.2.24___OK/drivers/ata/pata_cs5536.c	2012-07-25
> 05:11:50.000000000 +0200
> +++ linux-3.2.24/drivers/ata/pata_cs5536.c	2012-07-26 15:38:27.674909884 +0200
> @@ -37,6 +37,7 @@
>   #include <linux/delay.h>
>   #include <linux/libata.h>
>   #include <scsi/scsi_host.h>
> +#include <linux/dmi.h>
>
>   #ifdef CONFIG_X86_32
>   #include <asm/msr.h>
> @@ -95,6 +96,21 @@
>   	PCI_IDE_CFG, PCI_IDE_DTC, PCI_IDE_CAST, PCI_IDE_ETC,
>   };
>
> +/* 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 inline int cs5536_read(struct pci_dev *pdev, int reg, u32 *val)
>   {
>   	if (unlikely(use_msr)) {
> @@ -257,9 +273,22 @@
>   		.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;

ACK patch content, but it did not apply




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-08-17 17:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-26 13:40 [RFC] [Patch] pata_cs5536: add quirk for broken udma Christian Gmeiner
2012-08-17 17:34 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).