Patchwork [02/15] ATA : vortex86 : fix vortex86dx/sx hardware CRC bug.

login
register
mail settings
Submitter Paul Schilling
Date Oct. 23, 2011, 5:05 a.m.
Message ID <1319346300-18151-1-git-send-email-paul.s.schilling@gmail.com>
Download mbox | patch
Permalink /patch/121209/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Paul Schilling - Oct. 23, 2011, 5:05 a.m.
This fixes a DMA issue related to a CRC bug on
the RDC pata peripherial found on the vortex86sx and vortex86dx.

Signed-off-by: Paul Schilling <paul.s.schilling@gmail.com>
---
 drivers/ata/pata_it821x.c |   22 ++++++++++++++++++----
 drivers/ata/pata_rdc.c    |   29 ++++++++++++++++++++++++-----
 drivers/ide/it821x.c      |    9 +++++++--
 include/linux/pci_ids.h   |    2 ++
 4 files changed, 51 insertions(+), 11 deletions(-)
Rolf Eike Beer - Oct. 23, 2011, 8:20 a.m.
Paul Schilling wrote:
> This fixes a DMA issue related to a CRC bug on
> the RDC pata peripherial found on the vortex86sx and vortex86dx.
> 
> Signed-off-by: Paul Schilling <paul.s.schilling@gmail.com>
> ---
>  drivers/ata/pata_it821x.c |   22 ++++++++++++++++++----
>  drivers/ata/pata_rdc.c    |   29 ++++++++++++++++++++++++-----
>  drivers/ide/it821x.c      |    9 +++++++--
>  include/linux/pci_ids.h   |    2 ++
>  4 files changed, 51 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
> index c5532b9..5f8a54a 100644
> --- a/drivers/ata/pata_it821x.c
> +++ b/drivers/ata/pata_it821x.c
> @@ -897,7 +897,16 @@ static int it821x_init_one(struct pci_dev *pdev, const
> struct pci_device_id *id) static const struct ata_port_info info_rdc_11 = {
>  		.flags = ATA_FLAG_SLAVE_POSS,
>  		.pio_mask = ATA_PIO4,
> -		.mwdma_mask = ATA_MWDMA2,
> +		.mwdma_mask = 0,
> +		.udma_mask = 0,
> +		/* No UDMA */
> +		.port_ops = &it821x_rdc_port_ops
> +	};
> +	static const struct ata_port_info info_rdc_01 = {
> +		.flags = ATA_FLAG_SLAVE_POSS,
> +		.pio_mask = ATA_PIO4,
> +		.mwdma_mask = 0,
> +		.udma_mask = 0,
>  		/* No UDMA */
>  		.port_ops = &it821x_rdc_port_ops
>  	};

Why do you define this if it is never used?

Eike
Paul Schilling - Oct. 23, 2011, 4:26 p.m.
Thanks, That was a good catch.  I had that extra struct for another
revision of the RDC peripheral integrated into the
Vortex86DX.  I removed it when I moved it to the pata_rdc.c driver but
forgot the struct.  The it821x driver works
for the RDC drivers when DMA is turned off.  But the RDC driver is the
more logical choice.

I will make the fix and send out the new patch.

I accidentally sent this through the gmail interface with html on,
Some of you may get this email twice.

Thanks,
Paul Schilling

On Sun, Oct 23, 2011 at 3:20 AM, Rolf Eike Beer <eike-kernel@sf-tec.de> wrote:
>
> Paul Schilling wrote:
> > This fixes a DMA issue related to a CRC bug on
> > the RDC pata peripherial found on the vortex86sx and vortex86dx.
> >
> > Signed-off-by: Paul Schilling <paul.s.schilling@gmail.com>
> > ---
> >  drivers/ata/pata_it821x.c |   22 ++++++++++++++++++----
> >  drivers/ata/pata_rdc.c    |   29 ++++++++++++++++++++++++-----
> >  drivers/ide/it821x.c      |    9 +++++++--
> >  include/linux/pci_ids.h   |    2 ++
> >  4 files changed, 51 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
> > index c5532b9..5f8a54a 100644
> > --- a/drivers/ata/pata_it821x.c
> > +++ b/drivers/ata/pata_it821x.c
> > @@ -897,7 +897,16 @@ static int it821x_init_one(struct pci_dev *pdev, const
> > struct pci_device_id *id) static const struct ata_port_info info_rdc_11 = {
> >               .flags = ATA_FLAG_SLAVE_POSS,
> >               .pio_mask = ATA_PIO4,
> > -             .mwdma_mask = ATA_MWDMA2,
> > +             .mwdma_mask = 0,
> > +             .udma_mask = 0,
> > +             /* No UDMA */
> > +             .port_ops = &it821x_rdc_port_ops
> > +     };
> > +     static const struct ata_port_info info_rdc_01 = {
> > +             .flags = ATA_FLAG_SLAVE_POSS,
> > +             .pio_mask = ATA_PIO4,
> > +             .mwdma_mask = 0,
> > +             .udma_mask = 0,
> >               /* No UDMA */
> >               .port_ops = &it821x_rdc_port_ops
> >       };
>
> Why do you define this if it is never used?
>
> Eike
--
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

Patch

diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index c5532b9..5f8a54a 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -897,7 +897,16 @@  static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	static const struct ata_port_info info_rdc_11 = {
 		.flags = ATA_FLAG_SLAVE_POSS,
 		.pio_mask = ATA_PIO4,
-		.mwdma_mask = ATA_MWDMA2,
+		.mwdma_mask = 0,
+		.udma_mask = 0,
+		/* No UDMA */
+		.port_ops = &it821x_rdc_port_ops
+	};
+	static const struct ata_port_info info_rdc_01 = {
+		.flags = ATA_FLAG_SLAVE_POSS,
+		.pio_mask = ATA_PIO4,
+		.mwdma_mask = 0,
+		.udma_mask = 0,
 		/* No UDMA */
 		.port_ops = &it821x_rdc_port_ops
 	};
@@ -911,11 +920,16 @@  static int it821x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		return rc;
 
 	if (pdev->vendor == PCI_VENDOR_ID_RDC) {
-		/* Deal with Vortex86SX */
-		if (pdev->revision == 0x11)
+		if (((pdev->revision == 0x11) || (pdev->revision == 0x13)) &&
+		    (pdev->device == PCI_DEVICE_ID_RDC_D1010)) {
+			/* Deal with Vortex86SX */
 			ppi[0] = &info_rdc_11;
-		else
+			printk(KERN_INFO DRV_NAME
+			       ": Detected Vortex86SX/DX Bug.\n");
+			printk(KERN_INFO DRV_NAME ": Disabling UDMA.\n");
+		} else {
 			ppi[0] = &info_rdc;
+		}
 	} else {
 		/* Force the card into bypass mode if so requested */
 		if (it8212_noraid) {
diff --git a/drivers/ata/pata_rdc.c b/drivers/ata/pata_rdc.c
index 2b38127..441521c 100644
--- a/drivers/ata/pata_rdc.c
+++ b/drivers/ata/pata_rdc.c
@@ -290,6 +290,16 @@  static struct ata_port_info rdc_port_info = {
 	.port_ops	= &rdc_pata_ops,
 };
 
+static struct ata_port_info vortex_port_info = {
+	.flags = ATA_FLAG_SLAVE_POSS,
+	.pio_mask = ATA_PIO4,
+	.mwdma_mask = 0,
+	.udma_mask = 0,
+	/* No UDMA */
+	.port_ops	= &rdc_pata_ops,
+};
+
+
 static struct scsi_host_template rdc_sht = {
 	ATA_BMDMA_SHT(DRV_NAME),
 };
@@ -322,16 +332,25 @@  static int __devinit rdc_init_one(struct pci_dev *pdev,
 
 	ata_print_version_once(&pdev->dev, DRV_VERSION);
 
-	port_info[0] = rdc_port_info;
-	port_info[1] = rdc_port_info;
-
-	port_flags = port_info[0].flags;
-
 	/* enable device and prepare host */
 	rc = pcim_enable_device(pdev);
 	if (rc)
 		return rc;
 
+	if ((pdev->revision == 0x01) &&
+			(pdev->device ==  PCI_DEVICE_ID_RDC_D1011)) {
+		/* Deal with Vortex86DX */
+		port_info[0] = vortex_port_info;
+		port_info[1] = vortex_port_info;
+		printk(KERN_INFO DRV_NAME ": Detected Vortex86DX Bug.\n");
+		printk(KERN_INFO DRV_NAME ": Disabling UDMA.\n");
+	} else {
+		port_info[0] = rdc_port_info;
+		port_info[1] = rdc_port_info;
+	}
+
+	port_flags = port_info[0].flags;
+
 	hpriv = devm_kzalloc(dev, sizeof(*hpriv), GFP_KERNEL);
 	if (!hpriv)
 		return -ENOMEM;
diff --git a/drivers/ide/it821x.c b/drivers/ide/it821x.c
index 2e3169f..82c6bc7 100644
--- a/drivers/ide/it821x.c
+++ b/drivers/ide/it821x.c
@@ -581,10 +581,14 @@  static void __devinit init_hwif_it821x(ide_hwif_t *hwif)
 	hwif->ultra_mask = ATA_UDMA6;
 	hwif->mwdma_mask = ATA_MWDMA2;
 
-	/* Vortex86SX quirk: prevent Ultra-DMA mode to fix BadCRC issue */
+	/* Vortex86SX and Vortex86DX quirk: prevent
+	 * Ultra-DMA mode to fix BadCRC issue when
+	 * using DMA mode */
 	if (idev->quirks & QUIRK_VORTEX86) {
-		if (dev->revision == 0x11)
+		if (((dev->revision == 0x11) || (dev->revision == 0x13))
+				|| (dev->revision == 0x01)) {
 			hwif->ultra_mask = 0;
+		}
 	}
 }
 
@@ -680,6 +684,7 @@  static const struct pci_device_id it821x_pci_tbl[] = {
 	{ PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8211), 0 },
 	{ PCI_VDEVICE(ITE, PCI_DEVICE_ID_ITE_8212), 0 },
 	{ PCI_VDEVICE(RDC, PCI_DEVICE_ID_RDC_D1010), QUIRK_VORTEX86 },
+	{ PCI_VDEVICE(RDC, PCI_DEVICE_ID_RDC_D1011), QUIRK_VORTEX86 },
 	{ 0, },
 };
 
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index ae96bbe..237da92 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -2259,6 +2259,8 @@ 
 #define PCI_DEVICE_ID_RDC_R6060		0x6060
 #define PCI_DEVICE_ID_RDC_R6061		0x6061
 #define PCI_DEVICE_ID_RDC_D1010		0x1010
+#define PCI_DEVICE_ID_RDC_D1011		0x1011
+#define PCI_DEVICE_ID_RDC_D1012		0x1012
 
 #define PCI_VENDOR_ID_LENOVO		0x17aa