diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-02 13:56:31 -0500 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-02-02 13:56:31 -0500 |
commit | bfa14b42a3bd671f0287b3db42e703e86ef27b48 (patch) | |
tree | ad902a99aa59232832d8e663be8d86a615e24114 /drivers/ide/pci/slc90e66.c | |
parent | c413b9b94d9a8e7548cc4b2e04b7df0439ce76fd (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/slc90e66.c')
-rw-r--r-- | drivers/ide/pci/slc90e66.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c index a6cf810c4699..427f95b25fde 100644 --- a/drivers/ide/pci/slc90e66.c +++ b/drivers/ide/pci/slc90e66.c | |||
@@ -118,23 +118,23 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed) | |||
118 | } | 118 | } |
119 | } | 119 | } |
120 | 120 | ||
121 | static void __devinit init_hwif_slc90e66 (ide_hwif_t *hwif) | 121 | static u8 __devinit slc90e66_cable_detect(ide_hwif_t *hwif) |
122 | { | 122 | { |
123 | struct pci_dev *dev = to_pci_dev(hwif->dev); | 123 | struct pci_dev *dev = to_pci_dev(hwif->dev); |
124 | u8 reg47 = 0; | 124 | u8 reg47 = 0, mask = hwif->channel ? 0x01 : 0x02; |
125 | u8 mask = hwif->channel ? 0x01 : 0x02; /* bit0:Primary */ | ||
126 | |||
127 | hwif->set_pio_mode = &slc90e66_set_pio_mode; | ||
128 | hwif->set_dma_mode = &slc90e66_set_dma_mode; | ||
129 | 125 | ||
130 | pci_read_config_byte(dev, 0x47, ®47); | 126 | pci_read_config_byte(dev, 0x47, ®47); |
131 | 127 | ||
132 | if (hwif->dma_base == 0) | 128 | /* bit[0(1)]: 0:80, 1:40 */ |
133 | return; | 129 | return (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; |
130 | } | ||
131 | |||
132 | static void __devinit init_hwif_slc90e66(ide_hwif_t *hwif) | ||
133 | { | ||
134 | hwif->set_pio_mode = &slc90e66_set_pio_mode; | ||
135 | hwif->set_dma_mode = &slc90e66_set_dma_mode; | ||
134 | 136 | ||
135 | if (hwif->cbl != ATA_CBL_PATA40_SHORT) | 137 | hwif->cable_detect = slc90e66_cable_detect; |
136 | /* bit[0(1)]: 0:80, 1:40 */ | ||
137 | hwif->cbl = (reg47 & mask) ? ATA_CBL_PATA40 : ATA_CBL_PATA80; | ||
138 | } | 138 | } |
139 | 139 | ||
140 | static const struct ide_port_info slc90e66_chipset __devinitdata = { | 140 | static const struct ide_port_info slc90e66_chipset __devinitdata = { |