aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/pci/tc86c001.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:31 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:31 -0500
commitbfa14b42a3bd671f0287b3db42e703e86ef27b48 (patch)
treead902a99aa59232832d8e663be8d86a615e24114 /drivers/ide/pci/tc86c001.c
parentc413b9b94d9a8e7548cc4b2e04b7df0439ce76fd (diff)
ide: add ->cable_detect method to ide_hwif_t
* Add ->cable_detect method to ide_hwif_t. * Call the new method in ide_init_port() if: - the host supports UDMA modes > UDMA2 ('hwif->ultra_mask & 78') - DMA initialization was successful (if hwif->dma_base is not set ide_init_port() sets hwif->ultra_mask to zero) - "idex=ata66" is not used ('hwif->cbl != ATA_CBL_PATA40_SHORT') * Convert PCI host drivers to use ->cable_detect method. While at it: * Factor out cable detection to separate functions (if not already done). * hpt366.c/it8213.c/slc90e66.c: - don't check cable type if "idex=ata66" is used * pdc202xx_new.c: - add __devinit tag to pdcnew_cable_detect() * pdc202xx_old.c: - rename pdc202xx_old_cable_detect() to pdc2026x_old_cable_detect() - add __devinit tag to pdc2026x_old_cable_detect() Reviewed-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/pci/tc86c001.c')
-rw-r--r--drivers/ide/pci/tc86c001.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/ide/pci/tc86c001.c b/drivers/ide/pci/tc86c001.c
index 9fbbb4f2dd54..2ef2ed2f2b32 100644
--- a/drivers/ide/pci/tc86c001.c
+++ b/drivers/ide/pci/tc86c001.c
@@ -160,6 +160,19 @@ static int tc86c001_busproc(ide_drive_t *drive, int state)
160 return 0; 160 return 0;
161} 161}
162 162
163static u8 __devinit tc86c001_cable_detect(ide_hwif_t *hwif)
164{
165 struct pci_dev *dev = to_pci_dev(hwif->dev);
166 unsigned long sc_base = pci_resource_start(dev, 5);
167 u16 scr1 = inw(sc_base + 0x00);
168
169 /*
170 * System Control 1 Register bit 13 (PDIAGN):
171 * 0=80-pin cable, 1=40-pin cable
172 */
173 return (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
174}
175
163static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif) 176static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
164{ 177{
165 struct pci_dev *dev = to_pci_dev(hwif->dev); 178 struct pci_dev *dev = to_pci_dev(hwif->dev);
@@ -183,6 +196,8 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
183 196
184 hwif->busproc = &tc86c001_busproc; 197 hwif->busproc = &tc86c001_busproc;
185 198
199 hwif->cable_detect = tc86c001_cable_detect;
200
186 if (!hwif->dma_base) 201 if (!hwif->dma_base)
187 return; 202 return;
188 203
@@ -196,15 +211,6 @@ static void __devinit init_hwif_tc86c001(ide_hwif_t *hwif)
196 hwif->rqsize = 0xffff; 211 hwif->rqsize = 0xffff;
197 212
198 hwif->dma_start = &tc86c001_dma_start; 213 hwif->dma_start = &tc86c001_dma_start;
199
200 if (hwif->cbl != ATA_CBL_PATA40_SHORT) {
201 /*
202 * System Control 1 Register bit 13 (PDIAGN):
203 * 0=80-pin cable, 1=40-pin cable
204 */
205 scr1 = inw(sc_base + 0x00);
206 hwif->cbl = (scr1 & 0x2000) ? ATA_CBL_PATA40 : ATA_CBL_PATA80;
207 }
208} 214}
209 215
210static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev, 216static unsigned int __devinit init_chipset_tc86c001(struct pci_dev *dev,