aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:29 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:29 -0500
commitb4d1c73dcd2b3575921df06f42217bc281b83a9b (patch)
tree11121631fa44292c6bae4b66c06c1f583ce5f8f5 /drivers/ide
parentbd38dd3c13c143c60d6284d145bf1273a0f64004 (diff)
atiixp/cs5535/scc_pata: fix "idex=ata66" parameter handling
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>
Diffstat (limited to 'drivers/ide')
-rw-r--r--drivers/ide/pci/atiixp.c24
-rw-r--r--drivers/ide/pci/cs5535.c8
-rw-r--r--drivers/ide/pci/scc_pata.c9
3 files changed, 26 insertions, 15 deletions
diff --git a/drivers/ide/pci/atiixp.c b/drivers/ide/pci/atiixp.c
index b56274af1782..648fdf30cdf4 100644
--- a/drivers/ide/pci/atiixp.c
+++ b/drivers/ide/pci/atiixp.c
@@ -121,6 +121,19 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
121 spin_unlock_irqrestore(&atiixp_lock, flags); 121 spin_unlock_irqrestore(&atiixp_lock, flags);
122} 122}
123 123
124static u8 __devinit atiixp_cable_detect(ide_hwif_t *hwif)
125{
126 struct pci_dev *pdev = to_pci_dev(hwif->dev);
127 u8 udma_mode = 0, ch = hwif->channel;
128
129 pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode);
130
131 if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
132 return ATA_CBL_PATA80;
133 else
134 return ATA_CBL_PATA40;
135}
136
124/** 137/**
125 * init_hwif_atiixp - fill in the hwif for the ATIIXP 138 * init_hwif_atiixp - fill in the hwif for the ATIIXP
126 * @hwif: IDE interface 139 * @hwif: IDE interface
@@ -131,21 +144,14 @@ static void atiixp_set_dma_mode(ide_drive_t *drive, const u8 speed)
131 144
132static void __devinit init_hwif_atiixp(ide_hwif_t *hwif) 145static void __devinit init_hwif_atiixp(ide_hwif_t *hwif)
133{ 146{
134 struct pci_dev *pdev = to_pci_dev(hwif->dev);
135 u8 udma_mode = 0, ch = hwif->channel;
136
137 hwif->set_pio_mode = &atiixp_set_pio_mode; 147 hwif->set_pio_mode = &atiixp_set_pio_mode;
138 hwif->set_dma_mode = &atiixp_set_dma_mode; 148 hwif->set_dma_mode = &atiixp_set_dma_mode;
139 149
140 if (!hwif->dma_base) 150 if (!hwif->dma_base)
141 return; 151 return;
142 152
143 pci_read_config_byte(pdev, ATIIXP_IDE_UDMA_MODE + ch, &udma_mode); 153 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
144 154 hwif->cbl = atiixp_cable_detect(hwif);
145 if ((udma_mode & 0x07) >= 0x04 || (udma_mode & 0x70) >= 0x40)
146 hwif->cbl = ATA_CBL_PATA80;
147 else
148 hwif->cbl = ATA_CBL_PATA40;
149} 155}
150 156
151static const struct ide_port_info atiixp_pci_info[] __devinitdata = { 157static const struct ide_port_info atiixp_pci_info[] __devinitdata = {
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index 66433aa53f59..50046436a565 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -155,8 +155,9 @@ static void cs5535_set_pio_mode(ide_drive_t *drive, const u8 pio)
155 cs5535_set_speed(drive, XFER_PIO_0 + pio); 155 cs5535_set_speed(drive, XFER_PIO_0 + pio);
156} 156}
157 157
158static u8 __devinit cs5535_cable_detect(struct pci_dev *dev) 158static u8 __devinit cs5535_cable_detect(ide_hwif_t *hwif)
159{ 159{
160 struct pci_dev *dev = to_pci_dev(hwif->dev);
160 u8 bit; 161 u8 bit;
161 162
162 /* if a 80 wire cable was detected */ 163 /* if a 80 wire cable was detected */
@@ -175,15 +176,14 @@ static u8 __devinit cs5535_cable_detect(struct pci_dev *dev)
175 */ 176 */
176static void __devinit init_hwif_cs5535(ide_hwif_t *hwif) 177static void __devinit init_hwif_cs5535(ide_hwif_t *hwif)
177{ 178{
178 struct pci_dev *dev = to_pci_dev(hwif->dev);
179
180 hwif->set_pio_mode = &cs5535_set_pio_mode; 179 hwif->set_pio_mode = &cs5535_set_pio_mode;
181 hwif->set_dma_mode = &cs5535_set_dma_mode; 180 hwif->set_dma_mode = &cs5535_set_dma_mode;
182 181
183 if (hwif->dma_base == 0) 182 if (hwif->dma_base == 0)
184 return; 183 return;
185 184
186 hwif->cbl = cs5535_cable_detect(dev); 185 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
186 hwif->cbl = cs5535_cable_detect(hwif);
187} 187}
188 188
189static const struct ide_port_info cs5535_chipset __devinitdata = { 189static const struct ide_port_info cs5535_chipset __devinitdata = {
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index 7694969b02ce..dcd44d7c0846 100644
--- 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_hwif_t *hwif)
644 init_mmio_iops_scc(hwif); 644 init_mmio_iops_scc(hwif);
645} 645}
646 646
647static u8 __devinit scc_cable_detect(ide_hwif_t *hwif)
648{
649 return ATA_CBL_PATA80;
650}
651
647/** 652/**
648 * init_hwif_scc - set up hwif 653 * init_hwif_scc - set up hwif
649 * @hwif: interface to set up 654 * @hwif: interface to set up
@@ -678,8 +683,8 @@ static void __devinit init_hwif_scc(ide_hwif_t *hwif)
678 else 683 else
679 hwif->ultra_mask = ATA_UDMA5; /* 100MHz */ 684 hwif->ultra_mask = ATA_UDMA5; /* 100MHz */
680 685
681 /* we support 80c cable only. */ 686 if (hwif->cbl != ATA_CBL_PATA40_SHORT)
682 hwif->cbl = ATA_CBL_PATA80; 687 hwif->cbl = scc_cable_detect(hwif);
683} 688}
684 689
685#define DECLARE_SCC_DEV(name_str) \ 690#define DECLARE_SCC_DEV(name_str) \