11 #include <linux/types.h>
12 #include <linux/module.h>
13 #include <linux/kernel.h>
16 #include <linux/pci.h>
22 #define DRV_NAME "pdc202xx_old"
27 u8 drive_pci = 0x60 + (drive->
dn << 2);
33 pci_read_config_byte(dev, drive_pci, &AP);
34 pci_read_config_byte(dev, drive_pci + 1, &
BP);
35 pci_read_config_byte(dev, drive_pci + 2, &
CP);
52 default: TA = 0x09;
TB = 0x13;
break;
67 pci_write_config_byte(dev, drive_pci, AP | TA);
68 pci_write_config_byte(dev, drive_pci + 1,
BP |
TB);
74 pci_write_config_byte(dev, drive_pci + 1,
BP |
TB);
75 pci_write_config_byte(dev, drive_pci + 2,
CP |
TC);
82 pdc202xx_set_mode(hwif, drive);
89 u8 sc1d =
inb(high_16 + 0x1d);
96 return (sc1d & 0x40) ? 1 : 0;
102 return (sc1d & 0x04) ? 1 : 0;
111 pci_read_config_word(dev, 0x50, &CIS);
125 static void pdc_old_enable_66MHz_clock(
ide_hwif_t *hwif)
130 outb(clock | (hwif->
channel ? 0x08 : 0x02), clock_reg);
133 static void pdc_old_disable_66MHz_clock(
ide_hwif_t *hwif)
135 unsigned long clock_reg = hwif->
extra_base + 0x01;
136 u8 clock =
inb(clock_reg);
138 outb(clock & ~(hwif->
channel ? 0x08 : 0x02), clock_reg);
141 static void pdc2026x_init_hwif(
ide_hwif_t *hwif)
143 pdc_old_disable_66MHz_clock(hwif);
149 pdc_old_enable_66MHz_clock(drive->
hwif);
153 unsigned long high_16 = hwif->
extra_base - 16;
154 unsigned long atapi_reg = high_16 + (hwif->
channel ? 0x24 : 0x20);
156 u8 clock =
inb(high_16 + 0x11);
158 outb(clock | (hwif->
channel ? 0x08 : 0x02), high_16 + 0x11);
159 word_count = (blk_rq_sectors(rq) << 8);
160 word_count = (rq_data_dir(rq) ==
READ) ?
161 word_count | 0x05000000 :
162 word_count | 0x06000000;
163 outl(word_count, atapi_reg);
172 unsigned long high_16 = hwif->
extra_base - 16;
173 unsigned long atapi_reg = high_16 + (hwif->
channel ? 0x24 : 0x20);
177 clock =
inb(high_16 + 0x11);
178 outb(clock & ~(hwif->
channel ? 0x08:0x02), high_16 + 0x11);
181 pdc_old_disable_66MHz_clock(drive->
hwif);
185 static int init_chipset_pdc202xx(
struct pci_dev *dev)
188 u8 udma_speed_flag = 0, primary_mode = 0, secondary_mode = 0;
193 udma_speed_flag =
inb(dmabase | 0x1f);
194 primary_mode =
inb(dmabase | 0x1a);
195 secondary_mode =
inb(dmabase | 0x1b);
198 "Secondary %s Mode.\n", pci_name(dev),
199 (udma_speed_flag & 1) ?
"EN" :
"DIS",
200 (primary_mode & 1) ?
"MASTER" :
"PCI",
201 (secondary_mode & 1) ?
"MASTER" :
"PCI" );
203 if (!(udma_speed_flag & 1)) {
205 pci_name(dev), udma_speed_flag,
206 (udma_speed_flag|1));
207 outb(udma_speed_flag | 1, dmabase | 0x1f);
208 printk(
"%sACTIVE\n", (
inb(dmabase | 0x1f) & 1) ?
"" :
"IN");
218 u8 irq = 0, irq2 = 0;
223 pci_write_config_byte(dev,
226 "mirror fixed\n", name, pci_name(dev));
231 #define IDE_HFLAGS_PDC202XX \
232 (IDE_HFLAG_ERROR_STOPS_FIFO | \
236 .set_pio_mode = pdc202xx_set_pio_mode,
237 .set_dma_mode = pdc202xx_set_mode,
238 .test_irq = pdc202xx_test_irq,
242 .set_pio_mode = pdc202xx_set_pio_mode,
243 .set_dma_mode = pdc202xx_set_mode,
244 .test_irq = pdc202xx_test_irq,
245 .cable_detect = pdc2026x_cable_detect,
248 static const struct ide_dma_ops pdc2026x_dma_ops = {
251 .dma_start = pdc202xx_dma_start,
252 .dma_end = pdc202xx_dma_end,
259 #define DECLARE_PDC2026X_DEV(udma, sectors) \
262 .init_chipset = init_chipset_pdc202xx, \
263 .init_hwif = pdc2026x_init_hwif, \
264 .port_ops = &pdc2026x_port_ops, \
265 .dma_ops = &pdc2026x_dma_ops, \
266 .host_flags = IDE_HFLAGS_PDC202XX, \
267 .pio_mask = ATA_PIO4, \
268 .mwdma_mask = ATA_MWDMA2, \
270 .max_sectors = sectors, \
276 .init_chipset = init_chipset_pdc202xx,
277 .port_ops = &pdc20246_port_ops,
303 u8 idx =
id->driver_data;
305 d = &pdc202xx_chipsets[
idx];
308 pdc202ata4_fixup_irq(dev, d->
name);
318 "PDC20265 attached to I2O RAID controller\n",
337 static struct pci_driver pdc202xx_pci_driver = {
338 .name =
"Promise_Old_IDE",
339 .id_table = pdc202xx_pci_tbl,
340 .probe = pdc202xx_init_one,
346 static int __init pdc202xx_ide_init(
void)
351 static void __exit pdc202xx_ide_exit(
void)
359 MODULE_AUTHOR(
"Andre Hedrick, Frank Tiernan, Bartlomiej Zolnierkiewicz");