LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 3/8] atiixp/cs5535/scc_pata: fix "idex=ata66" parameter handling
Date: Sun, 06 Jan 2008 18:02:41 +0100	[thread overview]
Message-ID: <20080106170241.6861.69546.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20080106170220.6861.4814.sendpatchset@localhost.localdomain>

Don't override the cable type if the "idex=ata66" parameter was used.

While at it:

* atiixp.c: factor out cable detection to atiixp_cable_detect() from
  init_hwif_atiixp().

* cs5535.c: pass 'ide_hwif_t *hwif' instead of 'struct pci_dev *dev' to
  cs5535_cable_detect().

* scc_pata.c: factor out cable detection to scc_cable_detect() from
  init_hwif_scc() and remove incorrect comment.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
---
+16 bytes
 drivers/ide/pci/atiixp.c   |   24 +++++++++++++++---------
 drivers/ide/pci/cs5535.c   |    8 ++++----
 drivers/ide/pci/scc_pata.c |    9 +++++++--
 3 files changed, 26 insertions(+), 15 deletions(-)

Index: b/drivers/ide/pci/atiixp.c
===================================================================
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -121,6 +121,19 @@ static void atiixp_set_dma_mode(ide_driv
 	spin_unlock_irqrestore(&atiixp_lock, flags);
 }
 
+static u8 __devinit atiixp_cable_detect(ide_hwif_t *hwif)
+{
+	struct pci_dev *pdev = to_pci_dev(hwif->dev);
+	u8 udma_mode = 0, ch = hwif->channel;
+
+	pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);
+
+	if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
+		return ATA_CBL_PATA80;
+	else
+		return ATA_CBL_PATA40;
+}
+
 /**
  *	init_hwif_atiixp		-	fill in the hwif for the ATIIXP
  *	@hwif: IDE interface
@@ -131,21 +144,14 @@ static void atiixp_set_dma_mode(ide_driv
 
 static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
 {
-	struct pci_dev *pdev = to_pci_dev(hwif->dev);
-	u8 udma_mode = 0, ch = hwif->channel;
-
 	hwif->set_pio_mode = &atiixp_set_pio_mode;
 	hwif->set_dma_mode = &atiixp_set_dma_mode;
 
 	if (!hwif->dma_base)
 		return;
 
-	pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);
-
-	if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
-		hwif->cbl = ATA_CBL_PATA80;
-	else
-		hwif->cbl = ATA_CBL_PATA40;
+	if (hwif->cbl != ATA_CBL_PATA40_SHORT)
+		hwif->cbl = atiixp_cable_detect(hwif);
 }
 
 static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
Index: b/drivers/ide/pci/cs5535.c
===================================================================
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -155,8 +155,9 @@ static void cs5535_set_pio_mode(ide_driv
 	cs5535_set_speed(drive, XFER_PIO_0 + pio);
 }
 
-static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
+static u8 __devinit cs5535_cable_detect(ide_hwif_t *hwif)
 {
+	struct pci_dev *dev = to_pci_dev(hwif->dev);
 	u8 bit;
 
 	/* if a 80 wire cable was detected */
@@ -175,15 +176,14 @@ static u8 __devinit cs5535_cable_detect(
  */
 static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
 {
-	struct pci_dev *dev = to_pci_dev(hwif->dev);
-
 	hwif->set_pio_mode = &cs5535_set_pio_mode;
 	hwif->set_dma_mode = &cs5535_set_dma_mode;
 
 	if (hwif->dma_base == 0)
 		return;
 
-	hwif->cbl = cs5535_cable_detect(dev);
+	if (hwif->cbl != ATA_CBL_PATA40_SHORT)
+		hwif->cbl = cs5535_cable_detect(hwif);
 }
 
 static const struct ide_port_info cs5535_chipset __devinitdata = {
Index: b/drivers/ide/pci/scc_pata.c
===================================================================
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -644,6 +644,11 @@ static void __devinit init_iops_scc(ide_
 	init_mmio_iops_scc(hwif);
 }
 
+static u8 __devinit scc_cable_detect(ide_hwif_t *hwif)
+{
+	return ATA_CBL_PATA80;
+}
+
 /**
  *	init_hwif_scc	-	set up hwif
  *	@hwif: interface to set up
@@ -678,8 +683,8 @@ static void __devinit init_hwif_scc(ide_
 	else
 		hwif->ultra_mask = ATA_UDMA5; /* 100MHz */
 
-	/* we support 80c cable only. */
-	hwif->cbl = ATA_CBL_PATA80;
+	if (hwif->cbl != ATA_CBL_PATA40_SHORT)
+		hwif->cbl = scc_cable_detect(hwif);
 }
 
 #define DECLARE_SCC_DEV(name_str)			\

  parent reply	other threads:[~2008-01-06 16:52 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-06 17:02 [PATCH 0/8] ide: more IDE probing code rework Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` [PATCH 1/8] dtc2278: fix ->io_32bit handling Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` [PATCH 2/8] au1xxx-ide: " Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` Bartlomiej Zolnierkiewicz [this message]
2008-01-06 17:02 ` [PATCH 4/8] macide: remove drive->capacity64 quirk Bartlomiej Zolnierkiewicz
2008-01-06 17:02 ` [PATCH 5/8] ide: always set DMA masks in ide_pci_setup_ports() Bartlomiej Zolnierkiewicz
2008-01-29 20:02   ` Sergei Shtylyov
2008-01-06 17:03 ` [PATCH 6/8] ide: separate PCI specific init from generic init " Bartlomiej Zolnierkiewicz
2008-01-06 17:03 ` [PATCH 7/8] ide: add struct ide_port_info instances to legacy host drivers Bartlomiej Zolnierkiewicz
2008-01-28 20:28   ` Sergei Shtylyov
2008-02-01 23:35     ` Bartlomiej Zolnierkiewicz
2008-02-11 18:36       ` Russell King
2008-02-10 16:07   ` Atsushi Nemoto
2008-02-10 17:04     ` Bartlomiej Zolnierkiewicz
2008-02-10 23:16       ` Bartlomiej Zolnierkiewicz
2008-02-11 12:01         ` Atsushi Nemoto
2008-01-06 17:03 ` [PATCH 8/8] ide: add ->cable_detect method to ide_hwif_t Bartlomiej Zolnierkiewicz
2008-01-12 20:05   ` Sergei Shtylyov

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=20080106170241.6861.69546.sendpatchset@localhost.localdomain \
    --to=bzolnier@gmail.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --subject='Re: [PATCH 3/8] atiixp/cs5535/scc_pata: fix "idex=ata66" parameter handling' \
    /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

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).