linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan McGee <dpmcgee@gmail.com>
To: linux-ide@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Jeff Garzik <jgarzik@pobox.com>
Subject: [PATCH 2/2] pata_sis: add mode_filter method for certain sis5513 chipsets
Date: Tue,  6 Sep 2011 14:21:59 -0500	[thread overview]
Message-ID: <1315336919-2737-2-git-send-email-dpmcgee@gmail.com> (raw)
In-Reply-To: <1315336919-2737-1-git-send-email-dpmcgee@gmail.com>

This mirrors a very old commit (3160d5416f39da9d9) to the old sis5513
IDE driver that prevents certain setups from working. UDMA6, aka
ATA/133, is not supported on some chipsets and we need to ensure this
mode is not chosen even if a connected drive supports it. Port this old
patch forward to the new PATA driver to ensure UDMA5 is the highest mode
used if that is what is supported.

Kernel bugzilla #41582.

Reviewed-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Dan McGee <dpmcgee@gmail.com>
---
 drivers/ata/pata_sis.c |   27 ++++++++++++++++++++++++++-
 1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c
index 9374400..54c41c7 100644
--- a/drivers/ata/pata_sis.c
+++ b/drivers/ata/pata_sis.c
@@ -509,6 +509,27 @@ static void sis_133_set_dmamode (struct ata_port *ap, struct ata_device *adev)
 	pci_write_config_dword(pdev, port, t1);
 }
 
+/**
+ *	sis_133_mode_filter - mode selection filter
+ *	@adev: ATA device
+ *
+ *	Block UDMA6 on devices that do not support it.
+ */
+
+static unsigned long sis_133_mode_filter(struct ata_device *adev, unsigned long mask)
+{
+	struct ata_port *ap = adev->link->ap;
+	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	int port = sis_port_base(adev);
+	u32 t1;
+
+	pci_read_config_dword(pdev, port, &t1);
+	/* if ATA133 is disabled, mask it out */
+	if (!(t1 & 0x08))
+		mask &= ~(0xE0 << ATA_SHIFT_UDMA);
+	return mask;
+}
+
 static struct scsi_host_template sis_sht = {
 	ATA_BMDMA_SHT(DRV_NAME),
 };
@@ -530,6 +551,7 @@ static struct ata_port_operations sis_133_ops = {
 	.set_piomode		= sis_133_set_piomode,
 	.set_dmamode		= sis_133_set_dmamode,
 	.cable_detect		= sis_133_cable_detect,
+	.mode_filter		= sis_133_mode_filter,
 };
 
 static struct ata_port_operations sis_133_early_ops = {
@@ -779,10 +801,13 @@ static int sis_init_one (struct pci_dev *pdev, const struct pci_device_id *ent)
 
 		switch(trueid) {
 		case 0x5518:	/* SIS 962/963 */
+			printk(KERN_INFO DRV_NAME " %s: SiS 962/963 MuTIOL IDE UDMA133 controller\n",
+				pci_name(pdev));
 			chipset = &sis133;
 			if ((idemisc & 0x40000000) == 0) {
 				pci_write_config_dword(pdev, 0x54, idemisc | 0x40000000);
-				printk(KERN_INFO "SIS5513: Switching to 5513 register mapping\n");
+				printk(KERN_INFO DRV_NAME " %s: Switching to 5513 register mapping\n",
+					pci_name(pdev));
 			}
 			break;
 		case 0x0180:	/* SIS 965/965L */
-- 
1.7.6.1


  reply	other threads:[~2011-09-06 19:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-06 19:21 [PATCH 1/2] pata_sis: extract a sis_port_base() method Dan McGee
2011-09-06 19:21 ` Dan McGee [this message]
2011-09-06 19:30   ` [PATCH 2/2] pata_sis: add mode_filter method for certain sis5513 chipsets Jeff Garzik
2011-09-06 20:45     ` [PATCH] Ensure we actually allow UDMA/100 Dan McGee
     [not found] ` <4E67402D.2030302@ru.mvista.com>
2011-09-07 16:02   ` [PATCH 1/2] pata_sis: extract a sis_port_base() method Dan McGee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1315336919-2737-2-git-send-email-dpmcgee@gmail.com \
    --to=dpmcgee@gmail.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).