Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6: (23 commits)
ide: add support for SCSI ioctls to ide-floppy
ide: remove stale changelog from setup-pci.c
ide: remove stale changelog/comments/TODO from ide.c
ide-cris: handle PIO auto-tuning in tune_cris_ide()
ide: add PIO masks
ide: remove ide_find_best_pio_mode()
ide: drop "PIO data" argument from ide_get_best_pio_mode()
ide: ide_find_best_pio_mode() fixes (take 2)
ide: add ide_pio_cycle_time() helper (take 2)
sc1200: remove stale Power Management code
ide: ide_start_power_step() fix WRT disabling DMA
serverworks: fix DMA
serverworks: always tune PIO
ide: add ide_pci_device_t.host_flags (take 2)
ide: add ide_dev_has_iordy() helper (take 4)
ide: make ide_get_best_pio_mode() print info if overriding PIO mode
siimage: PIO mode setup fixes (take 2)
atiixp: PIO mode setup fixes
ide: Stop mapping ROMs
IDE: Remove references to dead ETRAX-related variables.
...

+473 -599
+1
drivers/ata/pata_pcmcia.c
··· 382 PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), 383 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 384 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 385 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 386 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 387 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),
··· 382 PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), 383 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 384 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 385 + PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), 386 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 387 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 388 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),
+3 -6
drivers/ide/cris/ide-cris.c
··· 414 #ifdef CONFIG_ETRAX_IDE_G27_RESET 415 REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, val); 416 #endif 417 - #ifdef CONFIG_ETRAX_IDE_CSE1_16_RESET 418 - REG_SHADOW_SET(port_cse1_addr, port_cse1_shadow, 16, val); 419 - #endif 420 - #ifdef CONFIG_ETRAX_IDE_CSP0_8_RESET 421 - REG_SHADOW_SET(port_csp0_addr, port_csp0_shadow, 8, val); 422 - #endif 423 #ifdef CONFIG_ETRAX_IDE_PB7_RESET 424 port_pb_dir_shadow = port_pb_dir_shadow | 425 IO_STATE(R_PORT_PB_DIR, dir7, output); ··· 684 { 685 int setup, strobe, hold; 686 687 switch(pio) 688 { 689 case 0: ··· 816 hwif->dma_host_on = &cris_dma_on; 817 hwif->dma_off_quietly = &cris_dma_off; 818 hwif->cbl = ATA_CBL_PATA40; 819 hwif->ultra_mask = cris_ultra_mask; 820 hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */ 821 hwif->autodma = 1;
··· 414 #ifdef CONFIG_ETRAX_IDE_G27_RESET 415 REG_SHADOW_SET(R_PORT_G_DATA, port_g_data_shadow, 27, val); 416 #endif 417 #ifdef CONFIG_ETRAX_IDE_PB7_RESET 418 port_pb_dir_shadow = port_pb_dir_shadow | 419 IO_STATE(R_PORT_PB_DIR, dir7, output); ··· 690 { 691 int setup, strobe, hold; 692 693 + pio = ide_get_best_pio_mode(drive, pio, 4); 694 + 695 switch(pio) 696 { 697 case 0: ··· 820 hwif->dma_host_on = &cris_dma_on; 821 hwif->dma_off_quietly = &cris_dma_off; 822 hwif->cbl = ATA_CBL_PATA40; 823 + hwif->pio_mask = ATA_PIO4, 824 hwif->ultra_mask = cris_ultra_mask; 825 hwif->mwdma_mask = 0x07; /* Multiword DMA 0-2 */ 826 hwif->autodma = 1;
+17 -1
drivers/ide/ide-floppy.c
··· 99 #include <linux/bitops.h> 100 #include <linux/mutex.h> 101 102 #include <asm/byteorder.h> 103 #include <asm/irq.h> 104 #include <asm/uaccess.h> ··· 2101 case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: 2102 return idefloppy_get_format_progress(drive, argp); 2103 } 2104 - return generic_ide_ioctl(drive, file, bdev, cmd, arg); 2105 } 2106 2107 static int idefloppy_media_changed(struct gendisk *disk)
··· 99 #include <linux/bitops.h> 100 #include <linux/mutex.h> 101 102 + #include <scsi/scsi_ioctl.h> 103 + 104 #include <asm/byteorder.h> 105 #include <asm/irq.h> 106 #include <asm/uaccess.h> ··· 2099 case IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS: 2100 return idefloppy_get_format_progress(drive, argp); 2101 } 2102 + 2103 + /* 2104 + * skip SCSI_IOCTL_SEND_COMMAND (deprecated) 2105 + * and CDROM_SEND_PACKET (legacy) ioctls 2106 + */ 2107 + if (cmd != CDROM_SEND_PACKET && cmd != SCSI_IOCTL_SEND_COMMAND) 2108 + err = scsi_cmd_ioctl(file, bdev->bd_disk->queue, 2109 + bdev->bd_disk, cmd, argp); 2110 + else 2111 + err = -ENOTTY; 2112 + 2113 + if (err == -ENOTTY) 2114 + err = generic_ide_ioctl(drive, file, bdev, cmd, arg); 2115 + 2116 + return err; 2117 } 2118 2119 static int idefloppy_media_changed(struct gendisk *disk)
+3 -2
drivers/ide/ide-io.c
··· 224 * we could be smarter and check for current xfer_speed 225 * in struct drive etc... 226 */ 227 - if ((drive->id->capability & 1) == 0) 228 - break; 229 if (drive->hwif->ide_dma_check == NULL) 230 break; 231 drive->hwif->dma_off_quietly(drive); 232 ide_set_dma(drive); 233 break; 234 }
··· 224 * we could be smarter and check for current xfer_speed 225 * in struct drive etc... 226 */ 227 if (drive->hwif->ide_dma_check == NULL) 228 break; 229 drive->hwif->dma_off_quietly(drive); 230 + /* 231 + * TODO: respect ->using_dma setting 232 + */ 233 ide_set_dma(drive); 234 break; 235 }
+42 -30
drivers/ide/ide-lib.c
··· 249 return -1; 250 } 251 252 /** 253 * ide_get_best_pio_mode - get PIO mode from drive 254 * @drive: drive to consider 255 * @mode_wanted: preferred mode 256 * @max_mode: highest allowed mode 257 - * @d: PIO data 258 * 259 * This routine returns the recommended PIO settings for a given drive, 260 * based on the drive->id information and the ide_pio_blacklist[]. ··· 285 * This is used by most chipset support modules when "auto-tuning". 286 */ 287 288 - u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d) 289 { 290 int pio_mode; 291 - int cycle_time = 0; 292 - int use_iordy = 0; 293 struct hd_driveid* id = drive->id; 294 int overridden = 0; 295 296 - if (mode_wanted != 255) { 297 - pio_mode = mode_wanted; 298 - use_iordy = (pio_mode > 2); 299 - } else if (!drive->id) { 300 - pio_mode = 0; 301 - } else if ((pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { 302 - overridden = 1; 303 - use_iordy = (pio_mode > 2); 304 } else { 305 pio_mode = id->tPIO; 306 if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ ··· 304 overridden = 1; 305 } 306 if (id->field_valid & 2) { /* drive implements ATA2? */ 307 - if (id->capability & 8) { /* drive supports use_iordy? */ 308 - use_iordy = 1; 309 - cycle_time = id->eide_pio_iordy; 310 if (id->eide_pio_modes & 7) { 311 overridden = 0; 312 if (id->eide_pio_modes & 4) ··· 314 else 315 pio_mode = 3; 316 } 317 - } else { 318 - cycle_time = id->eide_pio; 319 } 320 } 321 322 /* 323 * Conservative "downgrade" for all pre-ATA2 drives 324 */ 325 - if (pio_mode && pio_mode < 4) { 326 pio_mode--; 327 - overridden = 1; 328 - if (cycle_time && cycle_time < ide_pio_timings[pio_mode].cycle_time) 329 - cycle_time = 0; /* use standard timing */ 330 } 331 } 332 - if (pio_mode > max_mode) { 333 pio_mode = max_mode; 334 - cycle_time = 0; 335 - } 336 - if (d) { 337 - d->pio_mode = pio_mode; 338 - d->cycle_time = cycle_time ? cycle_time : ide_pio_timings[pio_mode].cycle_time; 339 - d->use_iordy = use_iordy; 340 - d->overridden = overridden; 341 - } 342 return pio_mode; 343 } 344
··· 249 return -1; 250 } 251 252 + unsigned int ide_pio_cycle_time(ide_drive_t *drive, u8 pio) 253 + { 254 + struct hd_driveid *id = drive->id; 255 + int cycle_time = 0; 256 + 257 + if (id->field_valid & 2) { 258 + if (id->capability & 8) 259 + cycle_time = id->eide_pio_iordy; 260 + else 261 + cycle_time = id->eide_pio; 262 + } 263 + 264 + /* conservative "downgrade" for all pre-ATA2 drives */ 265 + if (pio < 3) { 266 + if (cycle_time && cycle_time < ide_pio_timings[pio].cycle_time) 267 + cycle_time = 0; /* use standard timing */ 268 + } 269 + 270 + return cycle_time ? cycle_time : ide_pio_timings[pio].cycle_time; 271 + } 272 + 273 + EXPORT_SYMBOL_GPL(ide_pio_cycle_time); 274 + 275 /** 276 * ide_get_best_pio_mode - get PIO mode from drive 277 * @drive: drive to consider 278 * @mode_wanted: preferred mode 279 * @max_mode: highest allowed mode 280 * 281 * This routine returns the recommended PIO settings for a given drive, 282 * based on the drive->id information and the ide_pio_blacklist[]. ··· 263 * This is used by most chipset support modules when "auto-tuning". 264 */ 265 266 + u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode) 267 { 268 int pio_mode; 269 struct hd_driveid* id = drive->id; 270 int overridden = 0; 271 272 + if (mode_wanted != 255) 273 + return min_t(u8, mode_wanted, max_mode); 274 + 275 + if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_BLACKLIST) == 0 && 276 + (pio_mode = ide_scan_pio_blacklist(id->model)) != -1) { 277 + printk(KERN_INFO "%s: is on PIO blacklist\n", drive->name); 278 } else { 279 pio_mode = id->tPIO; 280 if (pio_mode > 2) { /* 2 is maximum allowed tPIO value */ ··· 286 overridden = 1; 287 } 288 if (id->field_valid & 2) { /* drive implements ATA2? */ 289 + if (id->capability & 8) { /* IORDY supported? */ 290 if (id->eide_pio_modes & 7) { 291 overridden = 0; 292 if (id->eide_pio_modes & 4) ··· 298 else 299 pio_mode = 3; 300 } 301 } 302 } 303 + 304 + if (overridden) 305 + printk(KERN_INFO "%s: tPIO > 2, assuming tPIO = 2\n", 306 + drive->name); 307 308 /* 309 * Conservative "downgrade" for all pre-ATA2 drives 310 */ 311 + if ((drive->hwif->host_flags & IDE_HFLAG_PIO_NO_DOWNGRADE) == 0 && 312 + pio_mode && pio_mode < 4) { 313 pio_mode--; 314 + printk(KERN_INFO "%s: applying conservative " 315 + "PIO \"downgrade\"\n", drive->name); 316 } 317 } 318 + 319 + if (pio_mode > max_mode) 320 pio_mode = max_mode; 321 + 322 return pio_mode; 323 } 324
+2 -18
drivers/ide/ide-timing.h
··· 106 #define XFER_EPIO 0x01 107 #define XFER_PIO 0x00 108 109 - static short ide_find_best_pio_mode(ide_drive_t *drive) 110 - { 111 - struct hd_driveid *id = drive->id; 112 - short best = 0; 113 - 114 - if (id->field_valid & 2) { /* EIDE PIO modes */ 115 - 116 - if ((best = (drive->id->eide_pio_modes & 4) ? XFER_PIO_5 : 117 - (drive->id->eide_pio_modes & 2) ? XFER_PIO_4 : 118 - (drive->id->eide_pio_modes & 1) ? XFER_PIO_3 : 0)) return best; 119 - } 120 - 121 - return (drive->id->tPIO == 2) ? XFER_PIO_2 : 122 - (drive->id->tPIO == 1) ? XFER_PIO_1 : 123 - (drive->id->tPIO == 0) ? XFER_PIO_0 : XFER_PIO_SLOW; 124 - } 125 - 126 static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT) 127 { 128 q->setup = EZ(t->setup * 1000, T); ··· 195 */ 196 197 if ((speed & XFER_MODE) != XFER_PIO) { 198 - ide_timing_compute(drive, ide_find_best_pio_mode(drive), &p, T, UT); 199 ide_timing_merge(&p, t, t, IDE_TIMING_ALL); 200 } 201
··· 106 #define XFER_EPIO 0x01 107 #define XFER_PIO 0x00 108 109 static void ide_timing_quantize(struct ide_timing *t, struct ide_timing *q, int T, int UT) 110 { 111 q->setup = EZ(t->setup * 1000, T); ··· 212 */ 213 214 if ((speed & XFER_MODE) != XFER_PIO) { 215 + u8 pio = ide_get_best_pio_mode(drive, 255, 5); 216 + ide_timing_compute(drive, XFER_PIO_0 + pio, &p, T, UT); 217 ide_timing_merge(&p, t, t, IDE_TIMING_ALL); 218 } 219
+4 -82
drivers/ide/ide.c
··· 16 * (usually 14 & 15). 17 * There can be up to two drives per interface, as per the ATA-2 spec. 18 * 19 - * Primary: ide0, port 0x1f0; major=3; hda is minor=0; hdb is minor=64 20 - * Secondary: ide1, port 0x170; major=22; hdc is minor=0; hdd is minor=64 21 - * Tertiary: ide2, port 0x???; major=33; hde is minor=0; hdf is minor=64 22 - * Quaternary: ide3, port 0x???; major=34; hdg is minor=0; hdh is minor=64 23 * ... 24 * 25 * From hd.c: ··· 43 * This was a rewrite of just about everything from hd.c, though some original 44 * code is still sprinkled about. Think of it as a major evolution, with 45 * inspiration from lots of linux users, esp. hamish@zot.apana.org.au 46 - * 47 - * Version 1.0 ALPHA initial code, primary i/f working okay 48 - * Version 1.3 BETA dual i/f on shared irq tested & working! 49 - * Version 1.4 BETA added auto probing for irq(s) 50 - * Version 1.5 BETA added ALPHA (untested) support for IDE cd-roms, 51 - * ... 52 - * Version 5.50 allow values as small as 20 for idebus= 53 - * Version 5.51 force non io_32bit in drive_cmd_intr() 54 - * change delay_10ms() to delay_50ms() to fix problems 55 - * Version 5.52 fix incorrect invalidation of removable devices 56 - * add "hdx=slow" command line option 57 - * Version 5.60 start to modularize the driver; the disk and ATAPI 58 - * drivers can be compiled as loadable modules. 59 - * move IDE probe code to ide-probe.c 60 - * move IDE disk code to ide-disk.c 61 - * add support for generic IDE device subdrivers 62 - * add m68k code from Geert Uytterhoeven 63 - * probe all interfaces by default 64 - * add ioctl to (re)probe an interface 65 - * Version 6.00 use per device request queues 66 - * attempt to optimize shared hwgroup performance 67 - * add ioctl to manually adjust bandwidth algorithms 68 - * add kerneld support for the probe module 69 - * fix bug in ide_error() 70 - * fix bug in the first ide_get_lock() call for Atari 71 - * don't flush leftover data for ATAPI devices 72 - * Version 6.01 clear hwgroup->active while the hwgroup sleeps 73 - * support HDIO_GETGEO for floppies 74 - * Version 6.02 fix ide_ack_intr() call 75 - * check partition table on floppies 76 - * Version 6.03 handle bad status bit sequencing in ide_wait_stat() 77 - * Version 6.10 deleted old entries from this list of updates 78 - * replaced triton.c with ide-dma.c generic PCI DMA 79 - * added support for BIOS-enabled UltraDMA 80 - * rename all "promise" things to "pdc4030" 81 - * fix EZ-DRIVE handling on small disks 82 - * Version 6.11 fix probe error in ide_scan_devices() 83 - * fix ancient "jiffies" polling bugs 84 - * mask all hwgroup interrupts on each irq entry 85 - * Version 6.12 integrate ioctl and proc interfaces 86 - * fix parsing of "idex=" command line parameter 87 - * Version 6.13 add support for ide4/ide5 courtesy rjones@orchestream.com 88 - * Version 6.14 fixed IRQ sharing among PCI devices 89 - * Version 6.15 added SMP awareness to IDE drivers 90 - * Version 6.16 fixed various bugs; even more SMP friendly 91 - * Version 6.17 fix for newest EZ-Drive problem 92 - * Version 6.18 default unpartitioned-disk translation now "BIOS LBA" 93 - * Version 6.19 Re-design for a UNIFORM driver for all platforms, 94 - * model based on suggestions from Russell King and 95 - * Geert Uytterhoeven 96 - * Promise DC4030VL now supported. 97 - * add support for ide6/ide7 98 - * delay_50ms() changed to ide_delay_50ms() and exported. 99 - * Version 6.20 Added/Fixed Generic ATA-66 support and hwif detection. 100 - * Added hdx=flash to allow for second flash disk 101 - * detection w/o the hang loop. 102 - * Added support for ide8/ide9 103 - * Added idex=ata66 for the quirky chipsets that are 104 - * ATA-66 compliant, but have yet to determine a method 105 - * of verification of the 80c cable presence. 106 - * Specifically Promise's PDC20262 chipset. 107 - * Version 6.21 Fixing/Fixed SMP spinlock issue with insight from an old 108 - * hat that clarified original low level driver design. 109 - * Version 6.30 Added SMP support; fixed multmode issues. -ml 110 - * Version 6.31 Debug Share INTR's and request queue streaming 111 - * Native ATA-100 support 112 - * Prep for Cascades Project 113 - * Version 7.00alpha First named revision of ide rearrange 114 - * 115 - * Some additional driver compile-time options are in ./include/linux/ide.h 116 - * 117 - * To do, in likely order of completion: 118 - * - modify kernel to obtain BIOS geometry for drives on 2nd/3rd/4th i/f 119 - * 120 */ 121 122 #define REVISION "Revision: 7.00alpha2" ··· 376 hwif->major = tmp_hwif->major; 377 hwif->straight8 = tmp_hwif->straight8; 378 hwif->bus_state = tmp_hwif->bus_state; 379 380 hwif->atapi_dma = tmp_hwif->atapi_dma; 381 hwif->ultra_mask = tmp_hwif->ultra_mask; ··· 1096 1097 return 0; 1098 } 1099 - 1100 - case CDROMEJECT: 1101 - case CDROMCLOSETRAY: 1102 - return scsi_cmd_ioctl(file, bdev->bd_disk->queue, bdev->bd_disk, cmd, p); 1103 1104 case HDIO_GET_BUSSTATE: 1105 if (!capable(CAP_SYS_ADMIN))
··· 16 * (usually 14 & 15). 17 * There can be up to two drives per interface, as per the ATA-2 spec. 18 * 19 * ... 20 * 21 * From hd.c: ··· 47 * This was a rewrite of just about everything from hd.c, though some original 48 * code is still sprinkled about. Think of it as a major evolution, with 49 * inspiration from lots of linux users, esp. hamish@zot.apana.org.au 50 */ 51 52 #define REVISION "Revision: 7.00alpha2" ··· 454 hwif->major = tmp_hwif->major; 455 hwif->straight8 = tmp_hwif->straight8; 456 hwif->bus_state = tmp_hwif->bus_state; 457 + 458 + hwif->host_flags = tmp_hwif->host_flags; 459 + 460 + hwif->pio_mask = tmp_hwif->pio_mask; 461 462 hwif->atapi_dma = tmp_hwif->atapi_dma; 463 hwif->ultra_mask = tmp_hwif->ultra_mask; ··· 1170 1171 return 0; 1172 } 1173 1174 case HDIO_GET_BUSSTATE: 1175 if (!capable(CAP_SYS_ADMIN))
+4 -3
drivers/ide/legacy/ali14xx.c
··· 115 int time1, time2; 116 u8 param1, param2, param3, param4; 117 unsigned long flags; 118 - ide_pio_data_t d; 119 int bus_speed = system_bus_clock(); 120 121 - pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO, &d); 122 123 /* calculate timing, according to PIO mode */ 124 - time1 = d.cycle_time; 125 time2 = ide_pio_timings[pio].active_time; 126 param3 = param1 = (time2 * bus_speed + 999) / 1000; 127 param4 = param2 = (time1 * bus_speed + 999) / 1000 - param1; ··· 211 mate = &ide_hwifs[1]; 212 213 hwif->chipset = ide_ali14xx; 214 hwif->tuneproc = &ali14xx_tune_drive; 215 hwif->mate = mate; 216 217 mate->chipset = ide_ali14xx; 218 mate->tuneproc = &ali14xx_tune_drive; 219 mate->mate = hwif; 220 mate->channel = 1;
··· 115 int time1, time2; 116 u8 param1, param2, param3, param4; 117 unsigned long flags; 118 int bus_speed = system_bus_clock(); 119 120 + pio = ide_get_best_pio_mode(drive, pio, ALI_MAX_PIO); 121 122 /* calculate timing, according to PIO mode */ 123 + time1 = ide_pio_cycle_time(drive, pio); 124 time2 = ide_pio_timings[pio].active_time; 125 param3 = param1 = (time2 * bus_speed + 999) / 1000; 126 param4 = param2 = (time1 * bus_speed + 999) / 1000 - param1; ··· 212 mate = &ide_hwifs[1]; 213 214 hwif->chipset = ide_ali14xx; 215 + hwif->pio_mask = ATA_PIO4; 216 hwif->tuneproc = &ali14xx_tune_drive; 217 hwif->mate = mate; 218 219 mate->chipset = ide_ali14xx; 220 + mate->pio_mask = ATA_PIO4; 221 mate->tuneproc = &ali14xx_tune_drive; 222 mate->mate = hwif; 223 mate->channel = 1;
+2 -1
drivers/ide/legacy/dtc2278.c
··· 71 { 72 unsigned long flags; 73 74 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 75 76 if (pio >= 3) { 77 spin_lock_irqsave(&ide_lock, flags); ··· 123 124 hwif->serialized = 1; 125 hwif->chipset = ide_dtc2278; 126 hwif->tuneproc = &tune_dtc2278; 127 hwif->drives[0].no_unmask = 1; 128 hwif->drives[1].no_unmask = 1;
··· 71 { 72 unsigned long flags; 73 74 + pio = ide_get_best_pio_mode(drive, pio, 4); 75 76 if (pio >= 3) { 77 spin_lock_irqsave(&ide_lock, flags); ··· 123 124 hwif->serialized = 1; 125 hwif->chipset = ide_dtc2278; 126 + hwif->pio_mask = ATA_PIO4; 127 hwif->tuneproc = &tune_dtc2278; 128 hwif->drives[0].no_unmask = 1; 129 hwif->drives[1].no_unmask = 1;
+8 -4
drivers/ide/legacy/ht6560b.c
··· 203 { 204 int active_time, recovery_time; 205 int active_cycles, recovery_cycles; 206 - ide_pio_data_t d; 207 int bus_speed = system_bus_clock(); 208 209 if (pio) { 210 - pio = ide_get_best_pio_mode(drive, pio, 5, &d); 211 - 212 /* 213 * Just like opti621.c we try to calculate the 214 * actual cycle time for recovery and activity 215 * according system bus speed. 216 */ 217 active_time = ide_pio_timings[pio].active_time; 218 - recovery_time = d.cycle_time 219 - active_time 220 - ide_pio_timings[pio].setup_time; 221 /* ··· 333 334 hwif->chipset = ide_ht6560b; 335 hwif->selectproc = &ht6560b_selectproc; 336 hwif->tuneproc = &tune_ht6560b; 337 hwif->serialized = 1; /* is this needed? */ 338 hwif->mate = mate; 339 340 mate->chipset = ide_ht6560b; 341 mate->selectproc = &ht6560b_selectproc; 342 mate->tuneproc = &tune_ht6560b; 343 mate->serialized = 1; /* is this needed? */ 344 mate->mate = hwif;
··· 203 { 204 int active_time, recovery_time; 205 int active_cycles, recovery_cycles; 206 int bus_speed = system_bus_clock(); 207 208 if (pio) { 209 + unsigned int cycle_time; 210 + 211 + pio = ide_get_best_pio_mode(drive, pio, 5); 212 + cycle_time = ide_pio_cycle_time(drive, pio); 213 + 214 /* 215 * Just like opti621.c we try to calculate the 216 * actual cycle time for recovery and activity 217 * according system bus speed. 218 */ 219 active_time = ide_pio_timings[pio].active_time; 220 + recovery_time = cycle_time 221 - active_time 222 - ide_pio_timings[pio].setup_time; 223 /* ··· 331 332 hwif->chipset = ide_ht6560b; 333 hwif->selectproc = &ht6560b_selectproc; 334 + hwif->pio_mask = ATA_PIO5; 335 hwif->tuneproc = &tune_ht6560b; 336 hwif->serialized = 1; /* is this needed? */ 337 hwif->mate = mate; 338 339 mate->chipset = ide_ht6560b; 340 mate->selectproc = &ht6560b_selectproc; 341 + mate->pio_mask = ATA_PIO5; 342 mate->tuneproc = &tune_ht6560b; 343 mate->serialized = 1; /* is this needed? */ 344 mate->mate = hwif;
+1
drivers/ide/legacy/ide-cs.c
··· 386 PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), 387 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 388 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 389 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 390 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 391 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),
··· 386 PCMCIA_DEVICE_PROD_ID12("HITACHI", "microdrive", 0xf4f43949, 0xa6d76178), 387 PCMCIA_DEVICE_PROD_ID12("IBM", "microdrive", 0xb569a6e5, 0xa6d76178), 388 PCMCIA_DEVICE_PROD_ID12("IBM", "IBM17JSSFP20", 0xb569a6e5, 0xf2508753), 389 + PCMCIA_DEVICE_PROD_ID12("KINGSTON", "CF8GB", 0x2e6d1829, 0xacbe682e), 390 PCMCIA_DEVICE_PROD_ID12("IO DATA", "CBIDE2 ", 0x547e66dc, 0x8671043b), 391 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDE", 0x547e66dc, 0x5c5ab149), 392 PCMCIA_DEVICE_PROD_ID12("IO DATA", "PCIDEII", 0x547e66dc, 0xb3662674),
+11 -10
drivers/ide/legacy/qd65xx.c
··· 252 253 static void qd6580_tune_drive (ide_drive_t *drive, u8 pio) 254 { 255 - ide_pio_data_t d; 256 int base = HWIF(drive)->select_data; 257 int active_time = 175; 258 int recovery_time = 415; /* worst case values from the dos driver */ 259 260 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { 261 - pio = ide_get_best_pio_mode(drive, pio, 4, &d); 262 263 switch (pio) { 264 case 0: break; 265 case 3: 266 - if (d.cycle_time >= 110) { 267 active_time = 86; 268 - recovery_time = d.cycle_time - 102; 269 } else 270 printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); 271 break; 272 case 4: 273 - if (d.cycle_time >= 69) { 274 active_time = 70; 275 - recovery_time = d.cycle_time - 61; 276 } else 277 printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); 278 break; 279 default: 280 - if (d.cycle_time >= 180) { 281 active_time = 110; 282 - recovery_time = d.cycle_time - 120; 283 } else { 284 active_time = ide_pio_timings[pio].active_time; 285 - recovery_time = d.cycle_time 286 - -active_time; 287 } 288 } 289 printk(KERN_INFO "%s: PIO mode%d\n", drive->name,pio); ··· 346 hwif->drives[1].drive_data = data1; 347 hwif->drives[0].io_32bit = 348 hwif->drives[1].io_32bit = 1; 349 hwif->tuneproc = tuneproc; 350 probe_hwif_init(hwif); 351 }
··· 252 253 static void qd6580_tune_drive (ide_drive_t *drive, u8 pio) 254 { 255 int base = HWIF(drive)->select_data; 256 + unsigned int cycle_time; 257 int active_time = 175; 258 int recovery_time = 415; /* worst case values from the dos driver */ 259 260 if (drive->id && !qd_find_disk_type(drive, &active_time, &recovery_time)) { 261 + pio = ide_get_best_pio_mode(drive, pio, 4); 262 + cycle_time = ide_pio_cycle_time(drive, pio); 263 264 switch (pio) { 265 case 0: break; 266 case 3: 267 + if (cycle_time >= 110) { 268 active_time = 86; 269 + recovery_time = cycle_time - 102; 270 } else 271 printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); 272 break; 273 case 4: 274 + if (cycle_time >= 69) { 275 active_time = 70; 276 + recovery_time = cycle_time - 61; 277 } else 278 printk(KERN_WARNING "%s: Strange recovery time !\n",drive->name); 279 break; 280 default: 281 + if (cycle_time >= 180) { 282 active_time = 110; 283 + recovery_time = cycle_time - 120; 284 } else { 285 active_time = ide_pio_timings[pio].active_time; 286 + recovery_time = cycle_time - active_time; 287 } 288 } 289 printk(KERN_INFO "%s: PIO mode%d\n", drive->name,pio); ··· 346 hwif->drives[1].drive_data = data1; 347 hwif->drives[0].io_32bit = 348 hwif->drives[1].io_32bit = 1; 349 + hwif->pio_mask = ATA_PIO4; 350 hwif->tuneproc = tuneproc; 351 probe_hwif_init(hwif); 352 }
+3 -1
drivers/ide/legacy/umc8672.c
··· 110 unsigned long flags; 111 ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup; 112 113 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 114 printk("%s: setting umc8672 to PIO mode%d (speed %d)\n", 115 drive->name, pio, pio_to_umc[pio]); 116 spin_lock_irqsave(&ide_lock, flags); ··· 149 mate = &ide_hwifs[1]; 150 151 hwif->chipset = ide_umc8672; 152 hwif->tuneproc = &tune_umc; 153 hwif->mate = mate; 154 155 mate->chipset = ide_umc8672; 156 mate->tuneproc = &tune_umc; 157 mate->mate = hwif; 158 mate->channel = 1;
··· 110 unsigned long flags; 111 ide_hwgroup_t *hwgroup = ide_hwifs[HWIF(drive)->index^1].hwgroup; 112 113 + pio = ide_get_best_pio_mode(drive, pio, 4); 114 printk("%s: setting umc8672 to PIO mode%d (speed %d)\n", 115 drive->name, pio, pio_to_umc[pio]); 116 spin_lock_irqsave(&ide_lock, flags); ··· 149 mate = &ide_hwifs[1]; 150 151 hwif->chipset = ide_umc8672; 152 + hwif->pio_mask = ATA_PIO4; 153 hwif->tuneproc = &tune_umc; 154 hwif->mate = mate; 155 156 mate->chipset = ide_umc8672; 157 + mate->pio_mask = ATA_PIO4; 158 mate->tuneproc = &tune_umc; 159 mate->mate = hwif; 160 mate->channel = 1;
+3 -1
drivers/ide/mips/au1xxx-ide.c
··· 106 u8 speed; 107 108 /* get the best pio mode for the drive */ 109 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 110 111 printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n", 112 drive->name, pio); ··· 691 hwif->mwdma_mask = 0x0; 692 hwif->swdma_mask = 0x0; 693 #endif 694 695 hwif->noprobe = 0; 696 hwif->drives[0].unmask = 1;
··· 106 u8 speed; 107 108 /* get the best pio mode for the drive */ 109 + pio = ide_get_best_pio_mode(drive, pio, 4); 110 111 printk(KERN_INFO "%s: setting Au1XXX IDE to PIO mode%d\n", 112 drive->name, pio); ··· 691 hwif->mwdma_mask = 0x0; 692 hwif->swdma_mask = 0x0; 693 #endif 694 + 695 + hwif->pio_mask = ATA_PIO4; 696 697 hwif->noprobe = 0; 698 hwif->drives[0].unmask = 1;
+6 -12
drivers/ide/pci/aec62xx.c
··· 142 143 static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) 144 { 145 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 146 (void) HWIF(drive)->speedproc(drive, pio + XFER_PIO_0); 147 } 148 ··· 173 static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) 174 { 175 int bus_speed = system_bus_clock(); 176 - 177 - if (dev->resource[PCI_ROM_RESOURCE].start) { 178 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 179 - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, 180 - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); 181 - } 182 183 if (bus_speed <= 33) 184 pci_set_drvdata(dev, (void *) aec6xxx_33_base); ··· 265 .init_setup = init_setup_aec62xx, 266 .init_chipset = init_chipset_aec62xx, 267 .init_hwif = init_hwif_aec62xx, 268 - .channels = 2, 269 .autodma = AUTODMA, 270 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 271 .bootable = OFF_BOARD, 272 .udma_mask = 0x07, /* udma0-2 */ 273 },{ /* 1 */ 274 .name = "AEC6260", 275 .init_setup = init_setup_aec62xx, 276 .init_chipset = init_chipset_aec62xx, 277 .init_hwif = init_hwif_aec62xx, 278 - .channels = 2, 279 .autodma = NOAUTODMA, 280 .bootable = OFF_BOARD, 281 .udma_mask = 0x1f, /* udma0-4 */ 282 },{ /* 2 */ 283 .name = "AEC6260R", 284 .init_setup = init_setup_aec62xx, 285 .init_chipset = init_chipset_aec62xx, 286 .init_hwif = init_hwif_aec62xx, 287 - .channels = 2, 288 .autodma = AUTODMA, 289 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 290 .bootable = NEVER_BOARD, 291 .udma_mask = 0x1f, /* udma0-4 */ 292 },{ /* 3 */ 293 .name = "AEC6280", 294 .init_setup = init_setup_aec6x80, 295 .init_chipset = init_chipset_aec62xx, 296 .init_hwif = init_hwif_aec62xx, 297 - .channels = 2, 298 .autodma = AUTODMA, 299 .bootable = OFF_BOARD, 300 .udma_mask = 0x3f, /* udma0-5 */ 301 },{ /* 4 */ 302 .name = "AEC6280R", 303 .init_setup = init_setup_aec6x80, 304 .init_chipset = init_chipset_aec62xx, 305 .init_hwif = init_hwif_aec62xx, 306 - .channels = 2, 307 .autodma = AUTODMA, 308 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 309 .bootable = OFF_BOARD, 310 .udma_mask = 0x3f, /* udma0-5 */ 311 } 312 };
··· 142 143 static void aec62xx_tune_drive (ide_drive_t *drive, u8 pio) 144 { 145 + pio = ide_get_best_pio_mode(drive, pio, 4); 146 (void) HWIF(drive)->speedproc(drive, pio + XFER_PIO_0); 147 } 148 ··· 173 static unsigned int __devinit init_chipset_aec62xx(struct pci_dev *dev, const char *name) 174 { 175 int bus_speed = system_bus_clock(); 176 177 if (bus_speed <= 33) 178 pci_set_drvdata(dev, (void *) aec6xxx_33_base); ··· 271 .init_setup = init_setup_aec62xx, 272 .init_chipset = init_chipset_aec62xx, 273 .init_hwif = init_hwif_aec62xx, 274 .autodma = AUTODMA, 275 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 276 .bootable = OFF_BOARD, 277 + .pio_mask = ATA_PIO4, 278 .udma_mask = 0x07, /* udma0-2 */ 279 },{ /* 1 */ 280 .name = "AEC6260", 281 .init_setup = init_setup_aec62xx, 282 .init_chipset = init_chipset_aec62xx, 283 .init_hwif = init_hwif_aec62xx, 284 .autodma = NOAUTODMA, 285 .bootable = OFF_BOARD, 286 + .pio_mask = ATA_PIO4, 287 .udma_mask = 0x1f, /* udma0-4 */ 288 },{ /* 2 */ 289 .name = "AEC6260R", 290 .init_setup = init_setup_aec62xx, 291 .init_chipset = init_chipset_aec62xx, 292 .init_hwif = init_hwif_aec62xx, 293 .autodma = AUTODMA, 294 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 295 .bootable = NEVER_BOARD, 296 + .pio_mask = ATA_PIO4, 297 .udma_mask = 0x1f, /* udma0-4 */ 298 },{ /* 3 */ 299 .name = "AEC6280", 300 .init_setup = init_setup_aec6x80, 301 .init_chipset = init_chipset_aec62xx, 302 .init_hwif = init_hwif_aec62xx, 303 .autodma = AUTODMA, 304 .bootable = OFF_BOARD, 305 + .pio_mask = ATA_PIO4, 306 .udma_mask = 0x3f, /* udma0-5 */ 307 },{ /* 4 */ 308 .name = "AEC6280R", 309 .init_setup = init_setup_aec6x80, 310 .init_chipset = init_chipset_aec62xx, 311 .init_hwif = init_hwif_aec62xx, 312 .autodma = AUTODMA, 313 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 314 .bootable = OFF_BOARD, 315 + .pio_mask = ATA_PIO4, 316 .udma_mask = 0x3f, /* udma0-5 */ 317 } 318 };
+2 -3
drivers/ide/pci/alim15x3.c
··· 295 296 static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) 297 { 298 - ide_pio_data_t d; 299 ide_hwif_t *hwif = HWIF(drive); 300 struct pci_dev *dev = hwif->pci_dev; 301 int s_time, a_time, c_time; ··· 306 u8 cd_dma_fifo = 0; 307 int unit = drive->select.b.unit & 1; 308 309 - pio = ide_get_best_pio_mode(drive, pio, 5, &d); 310 s_time = ide_pio_timings[pio].setup_time; 311 a_time = ide_pio_timings[pio].active_time; 312 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) ··· 816 .init_chipset = init_chipset_ali15x3, 817 .init_hwif = init_hwif_ali15x3, 818 .init_dma = init_dma_ali15x3, 819 - .channels = 2, 820 .autodma = AUTODMA, 821 .bootable = ON_BOARD, 822 }; 823 824 /**
··· 295 296 static u8 ali15x3_tune_pio (ide_drive_t *drive, u8 pio) 297 { 298 ide_hwif_t *hwif = HWIF(drive); 299 struct pci_dev *dev = hwif->pci_dev; 300 int s_time, a_time, c_time; ··· 307 u8 cd_dma_fifo = 0; 308 int unit = drive->select.b.unit & 1; 309 310 + pio = ide_get_best_pio_mode(drive, pio, 5); 311 s_time = ide_pio_timings[pio].setup_time; 312 a_time = ide_pio_timings[pio].active_time; 313 if ((s_clc = (s_time * bus_speed + 999) / 1000) >= 8) ··· 817 .init_chipset = init_chipset_ali15x3, 818 .init_hwif = init_hwif_ali15x3, 819 .init_dma = init_dma_ali15x3, 820 .autodma = AUTODMA, 821 .bootable = ON_BOARD, 822 + .pio_mask = ATA_PIO5, 823 }; 824 825 /**
+14 -10
drivers/ide/pci/amd74xx.c
··· 1 /* 2 - * Version 2.20 3 * 4 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 5 * IDE driver for Linux. ··· 272 273 static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio) 274 { 275 - if (pio == 255) { 276 - amd_set_drive(drive, ide_find_best_pio_mode(drive)); 277 - return; 278 - } 279 280 amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5)); 281 } ··· 282 { 283 u8 speed = ide_max_dma_mode(drive); 284 285 - if (speed == 0) 286 - speed = ide_find_best_pio_mode(drive); 287 288 amd_set_drive(drive, speed); 289 290 - if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) 291 return 0; 292 293 return -1; ··· 448 .name = name_str, \ 449 .init_chipset = init_chipset_amd74xx, \ 450 .init_hwif = init_hwif_amd74xx, \ 451 - .channels = 2, \ 452 .autodma = AUTODMA, \ 453 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ 454 .bootable = ON_BOARD, \ 455 } 456 457 #define DECLARE_NV_DEV(name_str) \ ··· 461 .name = name_str, \ 462 .init_chipset = init_chipset_amd74xx, \ 463 .init_hwif = init_hwif_amd74xx, \ 464 - .channels = 2, \ 465 .autodma = AUTODMA, \ 466 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ 467 .bootable = ON_BOARD, \ 468 } 469 470 static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
··· 1 /* 2 + * Version 2.21 3 * 4 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 5 * IDE driver for Linux. ··· 272 273 static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio) 274 { 275 + if (pio == 255) 276 + pio = ide_get_best_pio_mode(drive, 255, 5); 277 278 amd_set_drive(drive, XFER_PIO_0 + min_t(byte, pio, 5)); 279 } ··· 284 { 285 u8 speed = ide_max_dma_mode(drive); 286 287 + if (speed == 0) { 288 + amd74xx_tune_drive(drive, 255); 289 + return -1; 290 + } 291 292 amd_set_drive(drive, speed); 293 294 + if (drive->autodma) 295 return 0; 296 297 return -1; ··· 448 .name = name_str, \ 449 .init_chipset = init_chipset_amd74xx, \ 450 .init_hwif = init_hwif_amd74xx, \ 451 .autodma = AUTODMA, \ 452 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, \ 453 .bootable = ON_BOARD, \ 454 + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ 455 + | IDE_HFLAG_PIO_NO_DOWNGRADE, \ 456 + .pio_mask = ATA_PIO5, \ 457 } 458 459 #define DECLARE_NV_DEV(name_str) \ ··· 459 .name = name_str, \ 460 .init_chipset = init_chipset_amd74xx, \ 461 .init_hwif = init_hwif_amd74xx, \ 462 .autodma = AUTODMA, \ 463 .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, \ 464 .bootable = ON_BOARD, \ 465 + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST \ 466 + | IDE_HFLAG_PIO_NO_DOWNGRADE, \ 467 + .pio_mask = ATA_PIO5, \ 468 } 469 470 static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
+22 -15
drivers/ide/pci/atiixp.c
··· 1 /* 2 - * linux/drivers/ide/pci/atiixp.c Version 0.01-bart2 Feb. 26, 2004 3 * 4 * Copyright (C) 2003 ATI Inc. <hyu@ati.com> 5 - * Copyright (C) 2004 Bartlomiej Zolnierkiewicz 6 - * 7 */ 8 9 #include <linux/types.h> ··· 122 } 123 124 /** 125 - * atiixp_tune_drive - tune a drive attached to a ATIIXP 126 * @drive: drive to tune 127 * @pio: desired PIO mode 128 * 129 * Set the interface PIO mode. 130 */ 131 132 - static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) 133 { 134 struct pci_dev *dev = drive->hwif->pci_dev; 135 unsigned long flags; ··· 153 spin_unlock_irqrestore(&atiixp_lock, flags); 154 } 155 156 /** 157 * atiixp_tune_chipset - tune a ATIIXP interface 158 * @drive: IDE drive to tune ··· 180 u8 speed, pio; 181 182 speed = ide_rate_filter(drive, xferspeed); 183 184 spin_lock_irqsave(&atiixp_lock, flags); 185 ··· 212 else 213 pio = speed - XFER_PIO_0; 214 215 - atiixp_tuneproc(drive, pio); 216 217 return ide_config_drive_speed(drive, speed); 218 } ··· 227 228 static int atiixp_dma_check(ide_drive_t *drive) 229 { 230 - u8 tspeed, speed; 231 - 232 drive->init_speed = 0; 233 234 if (ide_tune_dma(drive)) 235 return 0; 236 237 - if (ide_use_fast_pio(drive)) { 238 - tspeed = ide_get_best_pio_mode(drive, 255, 5, NULL); 239 - speed = atiixp_dma_2_pio(XFER_PIO_0 + tspeed) + XFER_PIO_0; 240 - atiixp_speedproc(drive, speed); 241 - } 242 243 return -1; 244 } ··· 291 { /* 0 */ 292 .name = "ATIIXP", 293 .init_hwif = init_hwif_atiixp, 294 - .channels = 2, 295 .autodma = AUTODMA, 296 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, 297 .bootable = ON_BOARD, 298 },{ /* 1 */ 299 .name = "SB600_PATA", 300 .init_hwif = init_hwif_atiixp, 301 - .channels = 1, 302 .autodma = AUTODMA, 303 .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, 304 .bootable = ON_BOARD, 305 }, 306 }; 307
··· 1 /* 2 + * linux/drivers/ide/pci/atiixp.c Version 0.02 Jun 16 2007 3 * 4 * Copyright (C) 2003 ATI Inc. <hyu@ati.com> 5 + * Copyright (C) 2004,2007 Bartlomiej Zolnierkiewicz 6 */ 7 8 #include <linux/types.h> ··· 123 } 124 125 /** 126 + * atiixp_tune_pio - tune a drive attached to a ATIIXP 127 * @drive: drive to tune 128 * @pio: desired PIO mode 129 * 130 * Set the interface PIO mode. 131 */ 132 133 + static void atiixp_tune_pio(ide_drive_t *drive, u8 pio) 134 { 135 struct pci_dev *dev = drive->hwif->pci_dev; 136 unsigned long flags; ··· 154 spin_unlock_irqrestore(&atiixp_lock, flags); 155 } 156 157 + static void atiixp_tuneproc(ide_drive_t *drive, u8 pio) 158 + { 159 + pio = ide_get_best_pio_mode(drive, pio, 4); 160 + atiixp_tune_pio(drive, pio); 161 + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 162 + } 163 + 164 /** 165 * atiixp_tune_chipset - tune a ATIIXP interface 166 * @drive: IDE drive to tune ··· 174 u8 speed, pio; 175 176 speed = ide_rate_filter(drive, xferspeed); 177 + 178 + if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { 179 + atiixp_tune_pio(drive, speed - XFER_PIO_0); 180 + return ide_config_drive_speed(drive, speed); 181 + } 182 183 spin_lock_irqsave(&atiixp_lock, flags); 184 ··· 201 else 202 pio = speed - XFER_PIO_0; 203 204 + atiixp_tune_pio(drive, pio); 205 206 return ide_config_drive_speed(drive, speed); 207 } ··· 216 217 static int atiixp_dma_check(ide_drive_t *drive) 218 { 219 drive->init_speed = 0; 220 221 if (ide_tune_dma(drive)) 222 return 0; 223 224 + if (ide_use_fast_pio(drive)) 225 + atiixp_tuneproc(drive, 255); 226 227 return -1; 228 } ··· 285 { /* 0 */ 286 .name = "ATIIXP", 287 .init_hwif = init_hwif_atiixp, 288 .autodma = AUTODMA, 289 .enablebits = {{0x48,0x01,0x00}, {0x48,0x08,0x00}}, 290 .bootable = ON_BOARD, 291 + .pio_mask = ATA_PIO4, 292 },{ /* 1 */ 293 .name = "SB600_PATA", 294 .init_hwif = init_hwif_atiixp, 295 .autodma = AUTODMA, 296 .enablebits = {{0x48,0x01,0x00}, {0x00,0x00,0x00}}, 297 .bootable = ON_BOARD, 298 + .host_flags = IDE_HFLAG_SINGLE, 299 + .pio_mask = ATA_PIO4, 300 }, 301 }; 302
+9 -10
drivers/ide/pci/cmd640.c
··· 633 */ 634 static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) 635 { 636 u8 b; 637 - ide_pio_data_t d; 638 - unsigned int index = 0; 639 640 while (drive != cmd_drives[index]) { 641 if (++index > 3) { ··· 661 return; 662 } 663 664 - (void) ide_get_best_pio_mode (drive, mode_wanted, 5, &d); 665 - cmd640_set_mode (index, d.pio_mode, d.cycle_time); 666 667 - printk ("%s: selected cmd640 PIO mode%d (%dns)%s", 668 - drive->name, 669 - d.pio_mode, 670 - d.cycle_time, 671 - d.overridden ? " (overriding vendor mode)" : ""); 672 display_clocks(index); 673 - return; 674 } 675 676 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ ··· 766 cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); 767 cmd_hwif0->chipset = ide_cmd640; 768 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 769 cmd_hwif0->tuneproc = &cmd640_tune_drive; 770 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 771 ··· 822 cmd_hwif1->mate = cmd_hwif0; 823 cmd_hwif1->channel = 1; 824 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 825 cmd_hwif1->tuneproc = &cmd640_tune_drive; 826 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 827 }
··· 633 */ 634 static void cmd640_tune_drive (ide_drive_t *drive, u8 mode_wanted) 635 { 636 + unsigned int index = 0, cycle_time; 637 u8 b; 638 639 while (drive != cmd_drives[index]) { 640 if (++index > 3) { ··· 662 return; 663 } 664 665 + mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 5); 666 + cycle_time = ide_pio_cycle_time(drive, mode_wanted); 667 + cmd640_set_mode(index, mode_wanted, cycle_time); 668 669 + printk("%s: selected cmd640 PIO mode%d (%dns)", 670 + drive->name, mode_wanted, cycle_time); 671 + 672 display_clocks(index); 673 } 674 675 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ ··· 769 cmd_hwif0->name, 'a' + cmd640_chip_version - 1, bus_type, cfr); 770 cmd_hwif0->chipset = ide_cmd640; 771 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 772 + cmd_hwif0->pio_mask = ATA_PIO5; 773 cmd_hwif0->tuneproc = &cmd640_tune_drive; 774 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 775 ··· 824 cmd_hwif1->mate = cmd_hwif0; 825 cmd_hwif1->channel = 1; 826 #ifdef CONFIG_BLK_DEV_CMD640_ENHANCED 827 + cmd_hwif1->pio_mask = ATA_PIO5; 828 cmd_hwif1->tuneproc = &cmd640_tune_drive; 829 #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ 830 }
+11 -10
drivers/ide/pci/cmd64x.c
··· 221 { 222 ide_hwif_t *hwif = HWIF(drive); 223 struct pci_dev *dev = hwif->pci_dev; 224 - ide_pio_data_t pio; 225 u8 pio_mode, setup_count, arttim = 0; 226 static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0}; 227 static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; 228 - pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5, &pio); 229 230 - cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)%s\n", 231 - drive->name, mode_wanted, pio_mode, pio.cycle_time, 232 - pio.overridden ? " (overriding vendor mode)" : ""); 233 234 - program_cycle_times(drive, pio.cycle_time, 235 ide_pio_timings[pio_mode].active_time); 236 237 setup_count = quantize_timing(ide_pio_timings[pio_mode].setup_time, ··· 619 .init_setup = init_setup_cmd64x, 620 .init_chipset = init_chipset_cmd64x, 621 .init_hwif = init_hwif_cmd64x, 622 - .channels = 2, 623 .autodma = AUTODMA, 624 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 625 .bootable = ON_BOARD, 626 .udma_mask = 0x00, /* no udma */ 627 },{ /* 1 */ 628 .name = "CMD646", 629 .init_setup = init_setup_cmd646, 630 .init_chipset = init_chipset_cmd64x, 631 .init_hwif = init_hwif_cmd64x, 632 - .channels = 2, 633 .autodma = AUTODMA, 634 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 635 .bootable = ON_BOARD, 636 .udma_mask = 0x07, /* udma0-2 */ 637 },{ /* 2 */ 638 .name = "CMD648", 639 .init_setup = init_setup_cmd64x, 640 .init_chipset = init_chipset_cmd64x, 641 .init_hwif = init_hwif_cmd64x, 642 - .channels = 2, 643 .autodma = AUTODMA, 644 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 645 .bootable = ON_BOARD, 646 .udma_mask = 0x1f, /* udma0-4 */ 647 },{ /* 3 */ 648 .name = "CMD649", 649 .init_setup = init_setup_cmd64x, 650 .init_chipset = init_chipset_cmd64x, 651 .init_hwif = init_hwif_cmd64x, 652 - .channels = 2, 653 .autodma = AUTODMA, 654 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 655 .bootable = ON_BOARD, 656 .udma_mask = 0x3f, /* udma0-5 */ 657 } 658 };
··· 221 { 222 ide_hwif_t *hwif = HWIF(drive); 223 struct pci_dev *dev = hwif->pci_dev; 224 + unsigned int cycle_time; 225 u8 pio_mode, setup_count, arttim = 0; 226 static const u8 setup_values[] = {0x40, 0x40, 0x40, 0x80, 0, 0xc0}; 227 static const u8 arttim_regs[4] = {ARTTIM0, ARTTIM1, ARTTIM23, ARTTIM23}; 228 229 + pio_mode = ide_get_best_pio_mode(drive, mode_wanted, 5); 230 + cycle_time = ide_pio_cycle_time(drive, pio_mode); 231 232 + cmdprintk("%s: PIO mode wanted %d, selected %d (%d ns)\n", 233 + drive->name, mode_wanted, pio_mode, cycle_time); 234 + 235 + program_cycle_times(drive, cycle_time, 236 ide_pio_timings[pio_mode].active_time); 237 238 setup_count = quantize_timing(ide_pio_timings[pio_mode].setup_time, ··· 618 .init_setup = init_setup_cmd64x, 619 .init_chipset = init_chipset_cmd64x, 620 .init_hwif = init_hwif_cmd64x, 621 .autodma = AUTODMA, 622 .enablebits = {{0x00,0x00,0x00}, {0x51,0x08,0x08}}, 623 .bootable = ON_BOARD, 624 + .pio_mask = ATA_PIO5, 625 .udma_mask = 0x00, /* no udma */ 626 },{ /* 1 */ 627 .name = "CMD646", 628 .init_setup = init_setup_cmd646, 629 .init_chipset = init_chipset_cmd64x, 630 .init_hwif = init_hwif_cmd64x, 631 .autodma = AUTODMA, 632 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 633 .bootable = ON_BOARD, 634 + .pio_mask = ATA_PIO5, 635 .udma_mask = 0x07, /* udma0-2 */ 636 },{ /* 2 */ 637 .name = "CMD648", 638 .init_setup = init_setup_cmd64x, 639 .init_chipset = init_chipset_cmd64x, 640 .init_hwif = init_hwif_cmd64x, 641 .autodma = AUTODMA, 642 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 643 .bootable = ON_BOARD, 644 + .pio_mask = ATA_PIO5, 645 .udma_mask = 0x1f, /* udma0-4 */ 646 },{ /* 3 */ 647 .name = "CMD649", 648 .init_setup = init_setup_cmd64x, 649 .init_chipset = init_chipset_cmd64x, 650 .init_hwif = init_hwif_cmd64x, 651 .autodma = AUTODMA, 652 .enablebits = {{0x51,0x04,0x04}, {0x51,0x08,0x08}}, 653 .bootable = ON_BOARD, 654 + .pio_mask = ATA_PIO5, 655 .udma_mask = 0x3f, /* udma0-5 */ 656 } 657 };
+3 -3
drivers/ide/pci/cs5520.c
··· 126 127 static void cs5520_tune_drive(ide_drive_t *drive, u8 pio) 128 { 129 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 130 cs5520_tune_chipset(drive, (XFER_PIO_0 + pio)); 131 } 132 ··· 194 .name = name_str, \ 195 .init_setup_dma = cs5520_init_setup_dma, \ 196 .init_hwif = init_hwif_cs5520, \ 197 - .channels = 2, \ 198 .autodma = AUTODMA, \ 199 .bootable = ON_BOARD, \ 200 - .flags = IDEPCI_FLAG_ISA_PORTS, \ 201 } 202 203 static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
··· 126 127 static void cs5520_tune_drive(ide_drive_t *drive, u8 pio) 128 { 129 + pio = ide_get_best_pio_mode(drive, pio, 4); 130 cs5520_tune_chipset(drive, (XFER_PIO_0 + pio)); 131 } 132 ··· 194 .name = name_str, \ 195 .init_setup_dma = cs5520_init_setup_dma, \ 196 .init_hwif = init_hwif_cs5520, \ 197 .autodma = AUTODMA, \ 198 .bootable = ON_BOARD, \ 199 + .host_flags = IDE_HFLAG_ISA_PORTS, \ 200 + .pio_mask = ATA_PIO4, \ 201 } 202 203 static ide_pci_device_t cyrix_chipsets[] __devinitdata = {
+2 -2
drivers/ide/pci/cs5530.c
··· 82 83 static void cs5530_tuneproc (ide_drive_t *drive, u8 pio) /* pio=255 means "autotune" */ 84 { 85 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 86 87 if (cs5530_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) 88 cs5530_tunepio(drive, pio); ··· 341 .name = "CS5530", 342 .init_chipset = init_chipset_cs5530, 343 .init_hwif = init_hwif_cs5530, 344 - .channels = 2, 345 .autodma = AUTODMA, 346 .bootable = ON_BOARD, 347 }; 348 349 static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
··· 82 83 static void cs5530_tuneproc (ide_drive_t *drive, u8 pio) /* pio=255 means "autotune" */ 84 { 85 + pio = ide_get_best_pio_mode(drive, pio, 4); 86 87 if (cs5530_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) 88 cs5530_tunepio(drive, pio); ··· 341 .name = "CS5530", 342 .init_chipset = init_chipset_cs5530, 343 .init_hwif = init_hwif_cs5530, 344 .autodma = AUTODMA, 345 .bootable = ON_BOARD, 346 + .pio_mask = ATA_PIO4, 347 }; 348 349 static int __devinit cs5530_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+5 -4
drivers/ide/pci/cs5535.c
··· 89 90 pioa = speed - XFER_PIO_0; 91 piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]), 92 - 255, 4, NULL); 93 cmd = pioa < piob ? pioa : piob; 94 95 /* Write the speed of the current drive */ ··· 159 /* cs5535 max pio is pio 4, best_pio will check the blacklist. 160 i think we don't need to rate_filter the incoming xferspeed 161 since we know we're only going to choose pio */ 162 - xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4, NULL); 163 ide_config_drive_speed(drive, modes[xferspeed]); 164 cs5535_set_speed(drive, xferspeed); 165 } ··· 174 return 0; 175 176 if (ide_use_fast_pio(drive)) { 177 - speed = ide_get_best_pio_mode(drive, 255, 4, NULL); 178 cs5535_set_drive(drive, speed); 179 } 180 ··· 228 static ide_pci_device_t cs5535_chipset __devinitdata = { 229 .name = "CS5535", 230 .init_hwif = init_hwif_cs5535, 231 - .channels = 1, 232 .autodma = AUTODMA, 233 .bootable = ON_BOARD, 234 }; 235 236 static int __devinit cs5535_init_one(struct pci_dev *dev,
··· 89 90 pioa = speed - XFER_PIO_0; 91 piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]), 92 + 255, 4); 93 cmd = pioa < piob ? pioa : piob; 94 95 /* Write the speed of the current drive */ ··· 159 /* cs5535 max pio is pio 4, best_pio will check the blacklist. 160 i think we don't need to rate_filter the incoming xferspeed 161 since we know we're only going to choose pio */ 162 + xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4); 163 ide_config_drive_speed(drive, modes[xferspeed]); 164 cs5535_set_speed(drive, xferspeed); 165 } ··· 174 return 0; 175 176 if (ide_use_fast_pio(drive)) { 177 + speed = ide_get_best_pio_mode(drive, 255, 4); 178 cs5535_set_drive(drive, speed); 179 } 180 ··· 228 static ide_pci_device_t cs5535_chipset __devinitdata = { 229 .name = "CS5535", 230 .init_hwif = init_hwif_cs5535, 231 .autodma = AUTODMA, 232 .bootable = ON_BOARD, 233 + .host_flags = IDE_HFLAG_SINGLE, 234 + .pio_mask = ATA_PIO4, 235 }; 236 237 static int __devinit cs5535_init_one(struct pci_dev *dev,
+3 -2
drivers/ide/pci/cy82c693.c
··· 330 #endif /* CY82C693_DEBUG_LOGS */ 331 332 /* first let's calc the pio modes */ 333 - pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO, NULL); 334 335 #if CY82C693_DEBUG_INFO 336 printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio); ··· 483 .init_chipset = init_chipset_cy82c693, 484 .init_iops = init_iops_cy82c693, 485 .init_hwif = init_hwif_cy82c693, 486 - .channels = 1, 487 .autodma = AUTODMA, 488 .bootable = ON_BOARD, 489 }; 490 491 static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id)
··· 330 #endif /* CY82C693_DEBUG_LOGS */ 331 332 /* first let's calc the pio modes */ 333 + pio = ide_get_best_pio_mode(drive, pio, CY82C693_MAX_PIO); 334 335 #if CY82C693_DEBUG_INFO 336 printk (KERN_INFO "%s: Selected PIO mode %d\n", drive->name, pio); ··· 483 .init_chipset = init_chipset_cy82c693, 484 .init_iops = init_iops_cy82c693, 485 .init_hwif = init_hwif_cy82c693, 486 .autodma = AUTODMA, 487 .bootable = ON_BOARD, 488 + .host_flags = IDE_HFLAG_SINGLE, 489 + .pio_mask = ATA_PIO4, 490 }; 491 492 static int __devinit cy82c693_init_one(struct pci_dev *dev, const struct pci_device_id *id)
-15
drivers/ide/pci/generic.c
··· 95 { /* 0 */ 96 .name = "Unknown", 97 .init_hwif = init_hwif_generic, 98 - .channels = 2, 99 .autodma = AUTODMA, 100 .bootable = ON_BOARD, 101 },{ /* 1 */ 102 .name = "NS87410", 103 .init_hwif = init_hwif_generic, 104 - .channels = 2, 105 .autodma = AUTODMA, 106 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, 107 .bootable = ON_BOARD, 108 },{ /* 2 */ 109 .name = "SAMURAI", 110 .init_hwif = init_hwif_generic, 111 - .channels = 2, 112 .autodma = AUTODMA, 113 .bootable = ON_BOARD, 114 },{ /* 3 */ 115 .name = "HT6565", 116 .init_hwif = init_hwif_generic, 117 - .channels = 2, 118 .autodma = AUTODMA, 119 .bootable = ON_BOARD, 120 },{ /* 4 */ 121 .name = "UM8673F", 122 .init_hwif = init_hwif_generic, 123 - .channels = 2, 124 .autodma = NODMA, 125 .bootable = ON_BOARD, 126 },{ /* 5 */ 127 .name = "UM8886A", 128 .init_hwif = init_hwif_generic, 129 - .channels = 2, 130 .autodma = NODMA, 131 .bootable = ON_BOARD, 132 },{ /* 6 */ 133 .name = "UM8886BF", 134 .init_hwif = init_hwif_generic, 135 - .channels = 2, 136 .autodma = NODMA, 137 .bootable = ON_BOARD, 138 },{ /* 7 */ 139 .name = "HINT_IDE", 140 .init_hwif = init_hwif_generic, 141 - .channels = 2, 142 .autodma = AUTODMA, 143 .bootable = ON_BOARD, 144 },{ /* 8 */ 145 .name = "VIA_IDE", 146 .init_hwif = init_hwif_generic, 147 - .channels = 2, 148 .autodma = NOAUTODMA, 149 .bootable = ON_BOARD, 150 },{ /* 9 */ 151 .name = "OPTI621V", 152 .init_hwif = init_hwif_generic, 153 - .channels = 2, 154 .autodma = NOAUTODMA, 155 .bootable = ON_BOARD, 156 },{ /* 10 */ 157 .name = "VIA8237SATA", 158 .init_hwif = init_hwif_generic, 159 - .channels = 2, 160 .autodma = AUTODMA, 161 .bootable = OFF_BOARD, 162 },{ /* 11 */ 163 .name = "Piccolo0102", 164 .init_hwif = init_hwif_generic, 165 - .channels = 2, 166 .autodma = NOAUTODMA, 167 .bootable = ON_BOARD, 168 },{ /* 12 */ 169 .name = "Piccolo0103", 170 .init_hwif = init_hwif_generic, 171 - .channels = 2, 172 .autodma = NOAUTODMA, 173 .bootable = ON_BOARD, 174 },{ /* 13 */ 175 .name = "Piccolo0105", 176 .init_hwif = init_hwif_generic, 177 - .channels = 2, 178 .autodma = NOAUTODMA, 179 .bootable = ON_BOARD, 180 },{ /* 14 */ 181 .name = "Revolution", 182 .init_hwif = init_hwif_generic, 183 - .channels = 2, 184 .autodma = AUTODMA, 185 .bootable = OFF_BOARD, 186 }
··· 95 { /* 0 */ 96 .name = "Unknown", 97 .init_hwif = init_hwif_generic, 98 .autodma = AUTODMA, 99 .bootable = ON_BOARD, 100 },{ /* 1 */ 101 .name = "NS87410", 102 .init_hwif = init_hwif_generic, 103 .autodma = AUTODMA, 104 .enablebits = {{0x43,0x08,0x08}, {0x47,0x08,0x08}}, 105 .bootable = ON_BOARD, 106 },{ /* 2 */ 107 .name = "SAMURAI", 108 .init_hwif = init_hwif_generic, 109 .autodma = AUTODMA, 110 .bootable = ON_BOARD, 111 },{ /* 3 */ 112 .name = "HT6565", 113 .init_hwif = init_hwif_generic, 114 .autodma = AUTODMA, 115 .bootable = ON_BOARD, 116 },{ /* 4 */ 117 .name = "UM8673F", 118 .init_hwif = init_hwif_generic, 119 .autodma = NODMA, 120 .bootable = ON_BOARD, 121 },{ /* 5 */ 122 .name = "UM8886A", 123 .init_hwif = init_hwif_generic, 124 .autodma = NODMA, 125 .bootable = ON_BOARD, 126 },{ /* 6 */ 127 .name = "UM8886BF", 128 .init_hwif = init_hwif_generic, 129 .autodma = NODMA, 130 .bootable = ON_BOARD, 131 },{ /* 7 */ 132 .name = "HINT_IDE", 133 .init_hwif = init_hwif_generic, 134 .autodma = AUTODMA, 135 .bootable = ON_BOARD, 136 },{ /* 8 */ 137 .name = "VIA_IDE", 138 .init_hwif = init_hwif_generic, 139 .autodma = NOAUTODMA, 140 .bootable = ON_BOARD, 141 },{ /* 9 */ 142 .name = "OPTI621V", 143 .init_hwif = init_hwif_generic, 144 .autodma = NOAUTODMA, 145 .bootable = ON_BOARD, 146 },{ /* 10 */ 147 .name = "VIA8237SATA", 148 .init_hwif = init_hwif_generic, 149 .autodma = AUTODMA, 150 .bootable = OFF_BOARD, 151 },{ /* 11 */ 152 .name = "Piccolo0102", 153 .init_hwif = init_hwif_generic, 154 .autodma = NOAUTODMA, 155 .bootable = ON_BOARD, 156 },{ /* 12 */ 157 .name = "Piccolo0103", 158 .init_hwif = init_hwif_generic, 159 .autodma = NOAUTODMA, 160 .bootable = ON_BOARD, 161 },{ /* 13 */ 162 .name = "Piccolo0105", 163 .init_hwif = init_hwif_generic, 164 .autodma = NOAUTODMA, 165 .bootable = ON_BOARD, 166 },{ /* 14 */ 167 .name = "Revolution", 168 .init_hwif = init_hwif_generic, 169 .autodma = AUTODMA, 170 .bootable = OFF_BOARD, 171 }
+5 -12
drivers/ide/pci/hpt34x.c
··· 80 81 static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio) 82 { 83 - pio = ide_get_best_pio_mode(drive, pio, 5, NULL); 84 (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio)); 85 } 86 ··· 120 pci_write_config_byte(dev, HPT34X_PCI_INIT_REG, 0x00); 121 pci_read_config_word(dev, PCI_COMMAND, &cmd); 122 123 - if (cmd & PCI_COMMAND_MEMORY) { 124 - if (pci_resource_start(dev, PCI_ROM_RESOURCE)) { 125 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, 126 - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 127 - printk(KERN_INFO "HPT345: ROM enabled at 0x%08lx\n", 128 - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); 129 - } 130 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0); 131 - } else { 132 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); 133 - } 134 135 /* 136 * Since 20-23 can be assigned and are R/W, we correct them. ··· 175 .name = "HPT34X", 176 .init_chipset = init_chipset_hpt34x, 177 .init_hwif = init_hwif_hpt34x, 178 - .channels = 2, 179 .autodma = NOAUTODMA, 180 .bootable = NEVER_BOARD, 181 - .extra = 16 182 }; 183 184 static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
··· 80 81 static void hpt34x_tune_drive (ide_drive_t *drive, u8 pio) 82 { 83 + pio = ide_get_best_pio_mode(drive, pio, 5); 84 (void) hpt34x_tune_chipset(drive, (XFER_PIO_0 + pio)); 85 } 86 ··· 120 pci_write_config_byte(dev, HPT34X_PCI_INIT_REG, 0x00); 121 pci_read_config_word(dev, PCI_COMMAND, &cmd); 122 123 + if (cmd & PCI_COMMAND_MEMORY) 124 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0xF0); 125 + else 126 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x20); 127 128 /* 129 * Since 20-23 can be assigned and are R/W, we correct them. ··· 182 .name = "HPT34X", 183 .init_chipset = init_chipset_hpt34x, 184 .init_hwif = init_hwif_hpt34x, 185 .autodma = NOAUTODMA, 186 .bootable = NEVER_BOARD, 187 + .extra = 16, 188 + .pio_mask = ATA_PIO5, 189 }; 190 191 static int __devinit hpt34x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+14 -22
drivers/ide/pci/hpt366.c
··· 652 653 static void hpt3xx_tune_drive(ide_drive_t *drive, u8 pio) 654 { 655 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 656 (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio); 657 } 658 ··· 993 * to just allocated per-chip hpt_info structure. 994 */ 995 *info = *(struct hpt_info *)pci_get_drvdata(dev); 996 - 997 - /* 998 - * FIXME: Not portable. Also, why do we enable the ROM in the first place? 999 - * We don't seem to be using it. 1000 - */ 1001 - if (dev->resource[PCI_ROM_RESOURCE].start) 1002 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, 1003 - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 1004 1005 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); 1006 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78); ··· 1483 * to both functions -- really stupid design decision... :-( 1484 * Bit 4 is for the primary channel, bit 5 for the secondary. 1485 */ 1486 - d->channels = 1; 1487 d->enablebits[0].mask = d->enablebits[0].val = 0x10; 1488 1489 d->udma_mask = HPT366_ALLOW_ATA66_3 ? ··· 1546 .init_chipset = init_chipset_hpt366, 1547 .init_hwif = init_hwif_hpt366, 1548 .init_dma = init_dma_hpt366, 1549 - .channels = 2, 1550 .autodma = AUTODMA, 1551 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1552 .bootable = OFF_BOARD, 1553 - .extra = 240 1554 },{ /* 1 */ 1555 .name = "HPT372A", 1556 .init_setup = init_setup_hpt372a, 1557 .init_chipset = init_chipset_hpt366, 1558 .init_hwif = init_hwif_hpt366, 1559 .init_dma = init_dma_hpt366, 1560 - .channels = 2, 1561 .autodma = AUTODMA, 1562 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1563 .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1564 .bootable = OFF_BOARD, 1565 - .extra = 240 1566 },{ /* 2 */ 1567 .name = "HPT302", 1568 .init_setup = init_setup_hpt302, 1569 .init_chipset = init_chipset_hpt366, 1570 .init_hwif = init_hwif_hpt366, 1571 .init_dma = init_dma_hpt366, 1572 - .channels = 2, 1573 .autodma = AUTODMA, 1574 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1575 .udma_mask = HPT302_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1576 .bootable = OFF_BOARD, 1577 - .extra = 240 1578 },{ /* 3 */ 1579 .name = "HPT371", 1580 .init_setup = init_setup_hpt371, 1581 .init_chipset = init_chipset_hpt366, 1582 .init_hwif = init_hwif_hpt366, 1583 .init_dma = init_dma_hpt366, 1584 - .channels = 2, 1585 .autodma = AUTODMA, 1586 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1587 .udma_mask = HPT371_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1588 .bootable = OFF_BOARD, 1589 - .extra = 240 1590 },{ /* 4 */ 1591 .name = "HPT374", 1592 .init_setup = init_setup_hpt374, 1593 .init_chipset = init_chipset_hpt366, 1594 .init_hwif = init_hwif_hpt366, 1595 .init_dma = init_dma_hpt366, 1596 - .channels = 2, /* 4 */ 1597 .autodma = AUTODMA, 1598 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1599 .udma_mask = 0x3f, 1600 .bootable = OFF_BOARD, 1601 - .extra = 240 1602 },{ /* 5 */ 1603 .name = "HPT372N", 1604 .init_setup = init_setup_hpt372n, 1605 .init_chipset = init_chipset_hpt366, 1606 .init_hwif = init_hwif_hpt366, 1607 .init_dma = init_dma_hpt366, 1608 - .channels = 2, /* 4 */ 1609 .autodma = AUTODMA, 1610 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1611 .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1612 .bootable = OFF_BOARD, 1613 - .extra = 240 1614 } 1615 }; 1616
··· 652 653 static void hpt3xx_tune_drive(ide_drive_t *drive, u8 pio) 654 { 655 + pio = ide_get_best_pio_mode(drive, pio, 4); 656 (void) hpt3xx_tune_chipset (drive, XFER_PIO_0 + pio); 657 } 658 ··· 993 * to just allocated per-chip hpt_info structure. 994 */ 995 *info = *(struct hpt_info *)pci_get_drvdata(dev); 996 997 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, (L1_CACHE_BYTES / 4)); 998 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 0x78); ··· 1491 * to both functions -- really stupid design decision... :-( 1492 * Bit 4 is for the primary channel, bit 5 for the secondary. 1493 */ 1494 + d->host_flags |= IDE_HFLAG_SINGLE; 1495 d->enablebits[0].mask = d->enablebits[0].val = 0x10; 1496 1497 d->udma_mask = HPT366_ALLOW_ATA66_3 ? ··· 1554 .init_chipset = init_chipset_hpt366, 1555 .init_hwif = init_hwif_hpt366, 1556 .init_dma = init_dma_hpt366, 1557 .autodma = AUTODMA, 1558 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1559 .bootable = OFF_BOARD, 1560 + .extra = 240, 1561 + .pio_mask = ATA_PIO4, 1562 },{ /* 1 */ 1563 .name = "HPT372A", 1564 .init_setup = init_setup_hpt372a, 1565 .init_chipset = init_chipset_hpt366, 1566 .init_hwif = init_hwif_hpt366, 1567 .init_dma = init_dma_hpt366, 1568 .autodma = AUTODMA, 1569 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1570 .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1571 .bootable = OFF_BOARD, 1572 + .extra = 240, 1573 + .pio_mask = ATA_PIO4, 1574 },{ /* 2 */ 1575 .name = "HPT302", 1576 .init_setup = init_setup_hpt302, 1577 .init_chipset = init_chipset_hpt366, 1578 .init_hwif = init_hwif_hpt366, 1579 .init_dma = init_dma_hpt366, 1580 .autodma = AUTODMA, 1581 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1582 .udma_mask = HPT302_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1583 .bootable = OFF_BOARD, 1584 + .extra = 240, 1585 + .pio_mask = ATA_PIO4, 1586 },{ /* 3 */ 1587 .name = "HPT371", 1588 .init_setup = init_setup_hpt371, 1589 .init_chipset = init_chipset_hpt366, 1590 .init_hwif = init_hwif_hpt366, 1591 .init_dma = init_dma_hpt366, 1592 .autodma = AUTODMA, 1593 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1594 .udma_mask = HPT371_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1595 .bootable = OFF_BOARD, 1596 + .extra = 240, 1597 + .pio_mask = ATA_PIO4, 1598 },{ /* 4 */ 1599 .name = "HPT374", 1600 .init_setup = init_setup_hpt374, 1601 .init_chipset = init_chipset_hpt366, 1602 .init_hwif = init_hwif_hpt366, 1603 .init_dma = init_dma_hpt366, 1604 .autodma = AUTODMA, 1605 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1606 .udma_mask = 0x3f, 1607 .bootable = OFF_BOARD, 1608 + .extra = 240, 1609 + .pio_mask = ATA_PIO4, 1610 },{ /* 5 */ 1611 .name = "HPT372N", 1612 .init_setup = init_setup_hpt372n, 1613 .init_chipset = init_chipset_hpt366, 1614 .init_hwif = init_hwif_hpt366, 1615 .init_dma = init_dma_hpt366, 1616 .autodma = AUTODMA, 1617 .enablebits = {{0x50,0x04,0x04}, {0x54,0x04,0x04}}, 1618 .udma_mask = HPT372_ALLOW_ATA133_6 ? 0x7f : 0x3f, 1619 .bootable = OFF_BOARD, 1620 + .extra = 240, 1621 + .pio_mask = ATA_PIO4, 1622 } 1623 }; 1624
+4 -3
drivers/ide/pci/it8213.c
··· 82 { 2, 1 }, 83 { 2, 3 }, }; 84 85 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 86 87 spin_lock_irqsave(&tune_lock, flags); 88 pci_read_config_word(dev, master_port, &master_data); ··· 214 if (ide_tune_dma(drive)) 215 return 0; 216 217 - pio = ide_get_best_pio_mode(drive, 255, 4, NULL); 218 it8213_tune_chipset(drive, XFER_PIO_0 + pio); 219 220 return -1; ··· 272 { \ 273 .name = name_str, \ 274 .init_hwif = init_hwif_it8213, \ 275 - .channels = 1, \ 276 .autodma = AUTODMA, \ 277 .enablebits = {{0x41,0x80,0x80}}, \ 278 .bootable = ON_BOARD, \ 279 } 280 281 static ide_pci_device_t it8213_chipsets[] __devinitdata = {
··· 82 { 2, 1 }, 83 { 2, 3 }, }; 84 85 + pio = ide_get_best_pio_mode(drive, pio, 4); 86 87 spin_lock_irqsave(&tune_lock, flags); 88 pci_read_config_word(dev, master_port, &master_data); ··· 214 if (ide_tune_dma(drive)) 215 return 0; 216 217 + pio = ide_get_best_pio_mode(drive, 255, 4); 218 it8213_tune_chipset(drive, XFER_PIO_0 + pio); 219 220 return -1; ··· 272 { \ 273 .name = name_str, \ 274 .init_hwif = init_hwif_it8213, \ 275 .autodma = AUTODMA, \ 276 .enablebits = {{0x41,0x80,0x80}}, \ 277 .bootable = ON_BOARD, \ 278 + .host_flags = IDE_HFLAG_SINGLE, \ 279 + .pio_mask = ATA_PIO4, \ 280 } 281 282 static ide_pci_device_t it8213_chipsets[] __devinitdata = {
+4 -4
drivers/ide/pci/it821x.c
··· 255 * on the cable. 256 */ 257 if (pair) { 258 - u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4, NULL); 259 /* trim PIO to the slowest of the master/slave */ 260 if (pair_pio < set_pio) 261 set_pio = pair_pio; ··· 276 277 static void it821x_tuneproc(ide_drive_t *drive, u8 pio) 278 { 279 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 280 (void)it821x_tunepio(drive, pio); 281 } 282 ··· 718 .name = name_str, \ 719 .init_chipset = init_chipset_it821x, \ 720 .init_hwif = init_hwif_it821x, \ 721 - .channels = 2, \ 722 .autodma = AUTODMA, \ 723 .bootable = ON_BOARD, \ 724 - .fixup = it821x_fixups \ 725 } 726 727 static ide_pci_device_t it821x_chipsets[] __devinitdata = {
··· 255 * on the cable. 256 */ 257 if (pair) { 258 + u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); 259 /* trim PIO to the slowest of the master/slave */ 260 if (pair_pio < set_pio) 261 set_pio = pair_pio; ··· 276 277 static void it821x_tuneproc(ide_drive_t *drive, u8 pio) 278 { 279 + pio = ide_get_best_pio_mode(drive, pio, 4); 280 (void)it821x_tunepio(drive, pio); 281 } 282 ··· 718 .name = name_str, \ 719 .init_chipset = init_chipset_it821x, \ 720 .init_hwif = init_hwif_it821x, \ 721 .autodma = AUTODMA, \ 722 .bootable = ON_BOARD, \ 723 + .fixup = it821x_fixups, \ 724 + .pio_mask = ATA_PIO4, \ 725 } 726 727 static ide_pci_device_t it821x_chipsets[] __devinitdata = {
+2 -2
drivers/ide/pci/jmicron.c
··· 97 98 static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed) 99 { 100 - u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5, NULL); 101 if (set_speed) 102 (void) ide_config_drive_speed(drive, speed); 103 } ··· 177 { \ 178 .name = name_str, \ 179 .init_hwif = init_hwif_jmicron, \ 180 - .channels = 2, \ 181 .autodma = AUTODMA, \ 182 .bootable = ON_BOARD, \ 183 .enablebits = { {0x40, 1, 1}, {0x40, 0x10, 0x10} }, \ 184 } 185 186 static ide_pci_device_t jmicron_chipsets[] __devinitdata = {
··· 97 98 static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed) 99 { 100 + u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5); 101 if (set_speed) 102 (void) ide_config_drive_speed(drive, speed); 103 } ··· 177 { \ 178 .name = name_str, \ 179 .init_hwif = init_hwif_jmicron, \ 180 .autodma = AUTODMA, \ 181 .bootable = ON_BOARD, \ 182 .enablebits = { {0x40, 1, 1}, {0x40, 0x10, 0x10} }, \ 183 + .pio_mask = ATA_PIO5, \ 184 } 185 186 static ide_pci_device_t jmicron_chipsets[] __devinitdata = {
-1
drivers/ide/pci/ns87415.c
··· 281 .init_iops = init_iops_ns87415, 282 #endif 283 .init_hwif = init_hwif_ns87415, 284 - .channels = 2, 285 .autodma = AUTODMA, 286 .bootable = ON_BOARD, 287 };
··· 281 .init_iops = init_iops_ns87415, 282 #endif 283 .init_hwif = init_hwif_ns87415, 284 .autodma = AUTODMA, 285 .bootable = ON_BOARD, 286 };
+4 -4
drivers/ide/pci/opti621.c
··· 147 int d; 148 ide_hwif_t *hwif = HWIF(drive); 149 150 - drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO, NULL); 151 for (d = 0; d < 2; ++d) { 152 drive = &hwif->drives[d]; 153 if (drive->present) { 154 if (drive->drive_data == PIO_DONT_KNOW) 155 - drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO, NULL); 156 #ifdef OPTI621_DEBUG 157 printk("%s: Selected PIO mode %d\n", 158 drive->name, drive->drive_data); ··· 350 { /* 0 */ 351 .name = "OPTI621", 352 .init_hwif = init_hwif_opti621, 353 - .channels = 2, 354 .autodma = AUTODMA, 355 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 356 .bootable = ON_BOARD, 357 },{ /* 1 */ 358 .name = "OPTI621X", 359 .init_hwif = init_hwif_opti621, 360 - .channels = 2, 361 .autodma = AUTODMA, 362 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 363 .bootable = ON_BOARD, 364 } 365 }; 366
··· 147 int d; 148 ide_hwif_t *hwif = HWIF(drive); 149 150 + drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO); 151 for (d = 0; d < 2; ++d) { 152 drive = &hwif->drives[d]; 153 if (drive->present) { 154 if (drive->drive_data == PIO_DONT_KNOW) 155 + drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO); 156 #ifdef OPTI621_DEBUG 157 printk("%s: Selected PIO mode %d\n", 158 drive->name, drive->drive_data); ··· 350 { /* 0 */ 351 .name = "OPTI621", 352 .init_hwif = init_hwif_opti621, 353 .autodma = AUTODMA, 354 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 355 .bootable = ON_BOARD, 356 + .pio_mask = ATA_PIO3, 357 },{ /* 1 */ 358 .name = "OPTI621X", 359 .init_hwif = init_hwif_opti621, 360 .autodma = AUTODMA, 361 .enablebits = {{0x45,0x80,0x00}, {0x40,0x08,0x00}}, 362 .bootable = ON_BOARD, 363 + .pio_mask = ATA_PIO3, 364 } 365 }; 366
+8 -15
drivers/ide/pci/pdc202xx_new.c
··· 219 220 static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio) 221 { 222 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 223 (void)pdcnew_tune_chipset(drive, XFER_PIO_0 + pio); 224 } 225 ··· 377 long pll_input, pll_output, ratio; 378 int f, r; 379 u8 pll_ctl0, pll_ctl1; 380 - 381 - if (dev->resource[PCI_ROM_RESOURCE].start) { 382 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, 383 - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 384 - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, 385 - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); 386 - } 387 388 #ifdef CONFIG_PPC_PMAC 389 apple_kiwi_init(dev); ··· 566 .init_setup = init_setup_pdcnew, 567 .init_chipset = init_chipset_pdcnew, 568 .init_hwif = init_hwif_pdc202new, 569 - .channels = 2, 570 .autodma = AUTODMA, 571 .bootable = OFF_BOARD, 572 .udma_mask = 0x3f, /* udma0-5 */ 573 },{ /* 1 */ 574 .name = "PDC20269", 575 .init_setup = init_setup_pdcnew, 576 .init_chipset = init_chipset_pdcnew, 577 .init_hwif = init_hwif_pdc202new, 578 - .channels = 2, 579 .autodma = AUTODMA, 580 .bootable = OFF_BOARD, 581 .udma_mask = 0x7f, /* udma0-6*/ 582 },{ /* 2 */ 583 .name = "PDC20270", 584 .init_setup = init_setup_pdc20270, 585 .init_chipset = init_chipset_pdcnew, 586 .init_hwif = init_hwif_pdc202new, 587 - .channels = 2, 588 .autodma = AUTODMA, 589 .bootable = OFF_BOARD, 590 .udma_mask = 0x3f, /* udma0-5 */ 591 },{ /* 3 */ 592 .name = "PDC20271", 593 .init_setup = init_setup_pdcnew, 594 .init_chipset = init_chipset_pdcnew, 595 .init_hwif = init_hwif_pdc202new, 596 - .channels = 2, 597 .autodma = AUTODMA, 598 .bootable = OFF_BOARD, 599 .udma_mask = 0x7f, /* udma0-6*/ 600 },{ /* 4 */ 601 .name = "PDC20275", 602 .init_setup = init_setup_pdcnew, 603 .init_chipset = init_chipset_pdcnew, 604 .init_hwif = init_hwif_pdc202new, 605 - .channels = 2, 606 .autodma = AUTODMA, 607 .bootable = OFF_BOARD, 608 .udma_mask = 0x7f, /* udma0-6*/ 609 },{ /* 5 */ 610 .name = "PDC20276", 611 .init_setup = init_setup_pdc20276, 612 .init_chipset = init_chipset_pdcnew, 613 .init_hwif = init_hwif_pdc202new, 614 - .channels = 2, 615 .autodma = AUTODMA, 616 .bootable = OFF_BOARD, 617 .udma_mask = 0x7f, /* udma0-6*/ 618 },{ /* 6 */ 619 .name = "PDC20277", 620 .init_setup = init_setup_pdcnew, 621 .init_chipset = init_chipset_pdcnew, 622 .init_hwif = init_hwif_pdc202new, 623 - .channels = 2, 624 .autodma = AUTODMA, 625 .bootable = OFF_BOARD, 626 .udma_mask = 0x7f, /* udma0-6*/ 627 } 628 };
··· 219 220 static void pdcnew_tune_drive(ide_drive_t *drive, u8 pio) 221 { 222 + pio = ide_get_best_pio_mode(drive, pio, 4); 223 (void)pdcnew_tune_chipset(drive, XFER_PIO_0 + pio); 224 } 225 ··· 377 long pll_input, pll_output, ratio; 378 int f, r; 379 u8 pll_ctl0, pll_ctl1; 380 381 #ifdef CONFIG_PPC_PMAC 382 apple_kiwi_init(dev); ··· 573 .init_setup = init_setup_pdcnew, 574 .init_chipset = init_chipset_pdcnew, 575 .init_hwif = init_hwif_pdc202new, 576 .autodma = AUTODMA, 577 .bootable = OFF_BOARD, 578 + .pio_mask = ATA_PIO4, 579 .udma_mask = 0x3f, /* udma0-5 */ 580 },{ /* 1 */ 581 .name = "PDC20269", 582 .init_setup = init_setup_pdcnew, 583 .init_chipset = init_chipset_pdcnew, 584 .init_hwif = init_hwif_pdc202new, 585 .autodma = AUTODMA, 586 .bootable = OFF_BOARD, 587 + .pio_mask = ATA_PIO4, 588 .udma_mask = 0x7f, /* udma0-6*/ 589 },{ /* 2 */ 590 .name = "PDC20270", 591 .init_setup = init_setup_pdc20270, 592 .init_chipset = init_chipset_pdcnew, 593 .init_hwif = init_hwif_pdc202new, 594 .autodma = AUTODMA, 595 .bootable = OFF_BOARD, 596 + .pio_mask = ATA_PIO4, 597 .udma_mask = 0x3f, /* udma0-5 */ 598 },{ /* 3 */ 599 .name = "PDC20271", 600 .init_setup = init_setup_pdcnew, 601 .init_chipset = init_chipset_pdcnew, 602 .init_hwif = init_hwif_pdc202new, 603 .autodma = AUTODMA, 604 .bootable = OFF_BOARD, 605 + .pio_mask = ATA_PIO4, 606 .udma_mask = 0x7f, /* udma0-6*/ 607 },{ /* 4 */ 608 .name = "PDC20275", 609 .init_setup = init_setup_pdcnew, 610 .init_chipset = init_chipset_pdcnew, 611 .init_hwif = init_hwif_pdc202new, 612 .autodma = AUTODMA, 613 .bootable = OFF_BOARD, 614 + .pio_mask = ATA_PIO4, 615 .udma_mask = 0x7f, /* udma0-6*/ 616 },{ /* 5 */ 617 .name = "PDC20276", 618 .init_setup = init_setup_pdc20276, 619 .init_chipset = init_chipset_pdcnew, 620 .init_hwif = init_hwif_pdc202new, 621 .autodma = AUTODMA, 622 .bootable = OFF_BOARD, 623 + .pio_mask = ATA_PIO4, 624 .udma_mask = 0x7f, /* udma0-6*/ 625 },{ /* 6 */ 626 .name = "PDC20277", 627 .init_setup = init_setup_pdcnew, 628 .init_chipset = init_chipset_pdcnew, 629 .init_hwif = init_hwif_pdc202new, 630 .autodma = AUTODMA, 631 .bootable = OFF_BOARD, 632 + .pio_mask = ATA_PIO4, 633 .udma_mask = 0x7f, /* udma0-6*/ 634 } 635 };
+6 -14
drivers/ide/pci/pdc202xx_old.c
··· 145 146 static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio) 147 { 148 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 149 pdc202xx_tune_chipset(drive, XFER_PIO_0 + pio); 150 } 151 ··· 316 static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, 317 const char *name) 318 { 319 - /* This doesn't appear needed */ 320 - if (dev->resource[PCI_ROM_RESOURCE].start) { 321 - pci_write_config_dword(dev, PCI_ROM_ADDRESS, 322 - dev->resource[PCI_ROM_RESOURCE].start | PCI_ROM_ADDRESS_ENABLE); 323 - printk(KERN_INFO "%s: ROM enabled at 0x%08lx\n", name, 324 - (unsigned long)dev->resource[PCI_ROM_RESOURCE].start); 325 - } 326 - 327 return dev->irq; 328 } 329 ··· 441 .init_chipset = init_chipset_pdc202xx, 442 .init_hwif = init_hwif_pdc202xx, 443 .init_dma = init_dma_pdc202xx, 444 - .channels = 2, 445 .autodma = AUTODMA, 446 .bootable = OFF_BOARD, 447 .extra = 16, 448 .udma_mask = 0x07, /* udma0-2 */ 449 },{ /* 1 */ 450 .name = "PDC20262", ··· 452 .init_chipset = init_chipset_pdc202xx, 453 .init_hwif = init_hwif_pdc202xx, 454 .init_dma = init_dma_pdc202xx, 455 - .channels = 2, 456 .autodma = AUTODMA, 457 .bootable = OFF_BOARD, 458 .extra = 48, 459 .udma_mask = 0x1f, /* udma0-4 */ 460 },{ /* 2 */ 461 .name = "PDC20263", ··· 463 .init_chipset = init_chipset_pdc202xx, 464 .init_hwif = init_hwif_pdc202xx, 465 .init_dma = init_dma_pdc202xx, 466 - .channels = 2, 467 .autodma = AUTODMA, 468 .bootable = OFF_BOARD, 469 .extra = 48, 470 .udma_mask = 0x1f, /* udma0-4 */ 471 },{ /* 3 */ 472 .name = "PDC20265", ··· 474 .init_chipset = init_chipset_pdc202xx, 475 .init_hwif = init_hwif_pdc202xx, 476 .init_dma = init_dma_pdc202xx, 477 - .channels = 2, 478 .autodma = AUTODMA, 479 .bootable = OFF_BOARD, 480 .extra = 48, 481 .udma_mask = 0x3f, /* udma0-5 */ 482 },{ /* 4 */ 483 .name = "PDC20267", ··· 485 .init_chipset = init_chipset_pdc202xx, 486 .init_hwif = init_hwif_pdc202xx, 487 .init_dma = init_dma_pdc202xx, 488 - .channels = 2, 489 .autodma = AUTODMA, 490 .bootable = OFF_BOARD, 491 .extra = 48, 492 .udma_mask = 0x3f, /* udma0-5 */ 493 } 494 };
··· 145 146 static void pdc202xx_tune_drive(ide_drive_t *drive, u8 pio) 147 { 148 + pio = ide_get_best_pio_mode(drive, pio, 4); 149 pdc202xx_tune_chipset(drive, XFER_PIO_0 + pio); 150 } 151 ··· 316 static unsigned int __devinit init_chipset_pdc202xx(struct pci_dev *dev, 317 const char *name) 318 { 319 return dev->irq; 320 } 321 ··· 449 .init_chipset = init_chipset_pdc202xx, 450 .init_hwif = init_hwif_pdc202xx, 451 .init_dma = init_dma_pdc202xx, 452 .autodma = AUTODMA, 453 .bootable = OFF_BOARD, 454 .extra = 16, 455 + .pio_mask = ATA_PIO4, 456 .udma_mask = 0x07, /* udma0-2 */ 457 },{ /* 1 */ 458 .name = "PDC20262", ··· 460 .init_chipset = init_chipset_pdc202xx, 461 .init_hwif = init_hwif_pdc202xx, 462 .init_dma = init_dma_pdc202xx, 463 .autodma = AUTODMA, 464 .bootable = OFF_BOARD, 465 .extra = 48, 466 + .pio_mask = ATA_PIO4, 467 .udma_mask = 0x1f, /* udma0-4 */ 468 },{ /* 2 */ 469 .name = "PDC20263", ··· 471 .init_chipset = init_chipset_pdc202xx, 472 .init_hwif = init_hwif_pdc202xx, 473 .init_dma = init_dma_pdc202xx, 474 .autodma = AUTODMA, 475 .bootable = OFF_BOARD, 476 .extra = 48, 477 + .pio_mask = ATA_PIO4, 478 .udma_mask = 0x1f, /* udma0-4 */ 479 },{ /* 3 */ 480 .name = "PDC20265", ··· 482 .init_chipset = init_chipset_pdc202xx, 483 .init_hwif = init_hwif_pdc202xx, 484 .init_dma = init_dma_pdc202xx, 485 .autodma = AUTODMA, 486 .bootable = OFF_BOARD, 487 .extra = 48, 488 + .pio_mask = ATA_PIO4, 489 .udma_mask = 0x3f, /* udma0-5 */ 490 },{ /* 4 */ 491 .name = "PDC20267", ··· 493 .init_chipset = init_chipset_pdc202xx, 494 .init_hwif = init_hwif_pdc202xx, 495 .init_dma = init_dma_pdc202xx, 496 .autodma = AUTODMA, 497 .bootable = OFF_BOARD, 498 .extra = 48, 499 + .pio_mask = ATA_PIO4, 500 .udma_mask = 0x3f, /* udma0-5 */ 501 } 502 };
+4 -4
drivers/ide/pci/piix.c
··· 219 */ 220 static void piix_tune_drive (ide_drive_t *drive, u8 pio) 221 { 222 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 223 piix_tune_pio(drive, pio); 224 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 225 } ··· 495 .name = name_str, \ 496 .init_chipset = init_chipset_piix, \ 497 .init_hwif = init_hwif_piix, \ 498 - .channels = 2, \ 499 .autodma = AUTODMA, \ 500 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ 501 .bootable = ON_BOARD, \ 502 .udma_mask = udma, \ 503 } 504 ··· 514 */ 515 .name = "MPIIX", 516 .init_hwif = init_hwif_piix, 517 - .channels = 2, 518 .autodma = NODMA, 519 .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, 520 .bootable = ON_BOARD, 521 - .flags = IDEPCI_FLAG_ISA_PORTS 522 }, 523 524 /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */
··· 219 */ 220 static void piix_tune_drive (ide_drive_t *drive, u8 pio) 221 { 222 + pio = ide_get_best_pio_mode(drive, pio, 4); 223 piix_tune_pio(drive, pio); 224 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 225 } ··· 495 .name = name_str, \ 496 .init_chipset = init_chipset_piix, \ 497 .init_hwif = init_hwif_piix, \ 498 .autodma = AUTODMA, \ 499 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, \ 500 .bootable = ON_BOARD, \ 501 + .pio_mask = ATA_PIO4, \ 502 .udma_mask = udma, \ 503 } 504 ··· 514 */ 515 .name = "MPIIX", 516 .init_hwif = init_hwif_piix, 517 .autodma = NODMA, 518 .enablebits = {{0x6d,0xc0,0x80}, {0x6d,0xc0,0xc0}}, 519 .bootable = ON_BOARD, 520 + .host_flags = IDE_HFLAG_ISA_PORTS, 521 + .pio_mask = ATA_PIO4, 522 }, 523 524 /* 3 */ DECLARE_PIIX_DEV("PIIX3", 0x00), /* no udma */
-1
drivers/ide/pci/rz1000.c
··· 52 static ide_pci_device_t rz1000_chipset __devinitdata = { 53 .name = "RZ100x", 54 .init_hwif = init_hwif_rz1000, 55 - .channels = 2, 56 .autodma = NODMA, 57 .bootable = ON_BOARD, 58 };
··· 52 static ide_pci_device_t rz1000_chipset __devinitdata = { 53 .name = "RZ100x", 54 .init_hwif = init_hwif_rz1000, 55 .autodma = NODMA, 56 .bootable = ON_BOARD, 57 };
+4 -39
drivers/ide/pci/sc1200.c
··· 1 /* 2 - * linux/drivers/ide/pci/sc1200.c Version 0.94 Mar 10 2007 3 * 4 * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com> 5 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz ··· 304 return; 305 } 306 307 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 308 printk("SC1200: %s: setting PIO mode%d\n", drive->name, pio); 309 310 if (sc1200_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) ··· 390 // loop over all interfaces that are part of this pci device: 391 // 392 while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { 393 - unsigned int basereg, r, d, format; 394 sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data; 395 396 // ··· 400 if (ss != NULL) { 401 for (r = 0; r < 4; ++r) { 402 pci_write_config_dword(hwif->pci_dev, basereg + (r<<2), ss->regs[r]); 403 - } 404 - } 405 - // 406 - // Re-program drive PIO modes 407 - // 408 - pci_read_config_dword(hwif->pci_dev, basereg+4, &format); 409 - format = (format >> 31) & 1; 410 - if (format) 411 - format += sc1200_get_pci_clock(); 412 - for (d = 0; d < 2; ++d) { 413 - ide_drive_t *drive = &(hwif->drives[d]); 414 - if (drive->present) { 415 - unsigned int pio, timings; 416 - pci_read_config_dword(hwif->pci_dev, basereg+(drive->select.b.unit << 3), &timings); 417 - for (pio = 0; pio <= 4; ++pio) { 418 - if (sc1200_pio_timings[format][pio] == timings) 419 - break; 420 - } 421 - if (pio > 4) 422 - pio = 255; /* autotune */ 423 - (void)sc1200_tuneproc(drive, pio); 424 - } 425 - } 426 - // 427 - // Re-program drive DMA modes 428 - // 429 - for (d = 0; d < MAX_DRIVES; ++d) { 430 - ide_drive_t *drive = &(hwif->drives[d]); 431 - if (drive->present && !__ide_dma_bad_drive(drive)) { 432 - int enable_dma = drive->using_dma; 433 - hwif->dma_off_quietly(drive); 434 - if (sc1200_config_dma(drive)) 435 - enable_dma = 0; 436 - if (enable_dma) 437 - hwif->dma_host_on(drive); 438 } 439 } 440 } ··· 436 static ide_pci_device_t sc1200_chipset __devinitdata = { 437 .name = "SC1200", 438 .init_hwif = init_hwif_sc1200, 439 - .channels = 2, 440 .autodma = AUTODMA, 441 .bootable = ON_BOARD, 442 }; 443 444 static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
··· 1 /* 2 + * linux/drivers/ide/pci/sc1200.c Version 0.95 Jun 16 2007 3 * 4 * Copyright (C) 2000-2002 Mark Lord <mlord@pobox.com> 5 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz ··· 304 return; 305 } 306 307 + pio = ide_get_best_pio_mode(drive, pio, 4); 308 printk("SC1200: %s: setting PIO mode%d\n", drive->name, pio); 309 310 if (sc1200_set_xfer_mode(drive, XFER_PIO_0 + pio) == 0) ··· 390 // loop over all interfaces that are part of this pci device: 391 // 392 while ((hwif = lookup_pci_dev(hwif, dev)) != NULL) { 393 + unsigned int basereg, r; 394 sc1200_saved_state_t *ss = (sc1200_saved_state_t *)hwif->config_data; 395 396 // ··· 400 if (ss != NULL) { 401 for (r = 0; r < 4; ++r) { 402 pci_write_config_dword(hwif->pci_dev, basereg + (r<<2), ss->regs[r]); 403 } 404 } 405 } ··· 471 static ide_pci_device_t sc1200_chipset __devinitdata = { 472 .name = "SC1200", 473 .init_hwif = init_hwif_sc1200, 474 .autodma = AUTODMA, 475 .bootable = ON_BOARD, 476 + .pio_mask = ATA_PIO4, 477 }; 478 479 static int __devinit sc1200_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+59 -17
drivers/ide/pci/scc_pata.c
··· 165 ide_hwif_t *hwif = HWIF(drive); 166 167 out_be32((void*)port, addr); 168 - __asm__ __volatile__("eieio":::"memory"); 169 in_be32((void*)(hwif->dma_base + 0x01c)); 170 - __asm__ __volatile__("eieio":::"memory"); 171 } 172 173 static void ··· 210 unsigned char speed = XFER_PIO_0; 211 int offset; 212 213 - mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4, NULL); 214 switch (mode_wanted) { 215 case 4: 216 speed = XFER_PIO_4; ··· 401 ide_hwif_t *hwif = HWIF(drive); 402 unsigned long intsts_port = hwif->dma_base + 0x014; 403 u32 reg; 404 405 while (1) { 406 reg = in_be32((void __iomem *)intsts_port); ··· 496 break; 497 } 498 499 - return __ide_dma_end(drive); 500 } 501 502 /* returns 1 if dma irq issued, 0 otherwise */ 503 static int scc_dma_test_irq(ide_drive_t *drive) 504 { 505 - ide_hwif_t *hwif = HWIF(drive); 506 - u8 dma_stat = hwif->INB(hwif->dma_status); 507 508 - /* return 1 if INTR asserted */ 509 - if ((dma_stat & 4) == 4) 510 return 1; 511 512 - /* Workaround for PTERADD: emulate DMA_INTR when 513 - * - IDE_STATUS[ERR] = 1 514 - * - INT_STATUS[INTRQ] = 1 515 - * - DMA_STATUS[IORACTA] = 1 516 - */ 517 - if (in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT && 518 - in_be32((void __iomem *)(hwif->dma_base + 0x014)) & INTSTS_INTRQ && 519 - dma_stat & 1) 520 return 1; 521 522 if (!drive->waiting_for_dma) 523 printk(KERN_WARNING "%s: (%s) called while not waiting\n", 524 drive->name, __FUNCTION__); 525 return 0; 526 } 527 528 /** ··· 742 hwif->tuneproc = scc_tuneproc; 743 hwif->ide_dma_check = scc_config_drive_for_dma; 744 hwif->ide_dma_test_irq = scc_dma_test_irq; 745 746 hwif->drives[0].autotune = IDE_TUNE_AUTO; 747 hwif->drives[1].autotune = IDE_TUNE_AUTO; ··· 772 .init_setup = init_setup_scc, \ 773 .init_iops = init_iops_scc, \ 774 .init_hwif = init_hwif_scc, \ 775 - .channels = 1, \ 776 .autodma = AUTODMA, \ 777 .bootable = ON_BOARD, \ 778 } 779 780 static ide_pci_device_t scc_chipsets[] __devinitdata = {
··· 165 ide_hwif_t *hwif = HWIF(drive); 166 167 out_be32((void*)port, addr); 168 + eieio(); 169 in_be32((void*)(hwif->dma_base + 0x01c)); 170 + eieio(); 171 } 172 173 static void ··· 210 unsigned char speed = XFER_PIO_0; 211 int offset; 212 213 + mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4); 214 switch (mode_wanted) { 215 case 4: 216 speed = XFER_PIO_4; ··· 401 ide_hwif_t *hwif = HWIF(drive); 402 unsigned long intsts_port = hwif->dma_base + 0x014; 403 u32 reg; 404 + int dma_stat, data_loss = 0; 405 + static int retry = 0; 406 + 407 + /* errata A308 workaround: Step5 (check data loss) */ 408 + /* We don't check non ide_disk because it is limited to UDMA4 */ 409 + if (!(in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT) && 410 + drive->media == ide_disk && drive->current_speed > XFER_UDMA_4) { 411 + reg = in_be32((void __iomem *)intsts_port); 412 + if (!(reg & INTSTS_ACTEINT)) { 413 + printk(KERN_WARNING "%s: operation failed (transfer data loss)\n", 414 + drive->name); 415 + data_loss = 1; 416 + if (retry++) { 417 + struct request *rq = HWGROUP(drive)->rq; 418 + int unit; 419 + /* ERROR_RESET and drive->crc_count are needed 420 + * to reduce DMA transfer mode in retry process. 421 + */ 422 + if (rq) 423 + rq->errors |= ERROR_RESET; 424 + for (unit = 0; unit < MAX_DRIVES; unit++) { 425 + ide_drive_t *drive = &hwif->drives[unit]; 426 + drive->crc_count++; 427 + } 428 + } 429 + } 430 + } 431 432 while (1) { 433 reg = in_be32((void __iomem *)intsts_port); ··· 469 break; 470 } 471 472 + dma_stat = __ide_dma_end(drive); 473 + if (data_loss) 474 + dma_stat |= 2; /* emulate DMA error (to retry command) */ 475 + return dma_stat; 476 } 477 478 /* returns 1 if dma irq issued, 0 otherwise */ 479 static int scc_dma_test_irq(ide_drive_t *drive) 480 { 481 + ide_hwif_t *hwif = HWIF(drive); 482 + u32 int_stat = in_be32((void __iomem *)hwif->dma_base + 0x014); 483 484 + /* SCC errata A252,A308 workaround: Step4 */ 485 + if ((in_be32((void __iomem *)IDE_ALTSTATUS_REG) & ERR_STAT) && 486 + (int_stat & INTSTS_INTRQ)) 487 return 1; 488 489 + /* SCC errata A308 workaround: Step5 (polling IOIRQS) */ 490 + if (int_stat & INTSTS_IOIRQS) 491 return 1; 492 493 if (!drive->waiting_for_dma) 494 printk(KERN_WARNING "%s: (%s) called while not waiting\n", 495 drive->name, __FUNCTION__); 496 return 0; 497 + } 498 + 499 + static u8 scc_udma_filter(ide_drive_t *drive) 500 + { 501 + ide_hwif_t *hwif = drive->hwif; 502 + u8 mask = hwif->ultra_mask; 503 + 504 + /* errata A308 workaround: limit non ide_disk drive to UDMA4 */ 505 + if ((drive->media != ide_disk) && (mask & 0xE0)) { 506 + printk(KERN_INFO "%s: limit %s to UDMA4\n", 507 + SCC_PATA_NAME, drive->name); 508 + mask = 0x1F; 509 + } 510 + 511 + return mask; 512 } 513 514 /** ··· 702 hwif->tuneproc = scc_tuneproc; 703 hwif->ide_dma_check = scc_config_drive_for_dma; 704 hwif->ide_dma_test_irq = scc_dma_test_irq; 705 + hwif->udma_filter = scc_udma_filter; 706 707 hwif->drives[0].autotune = IDE_TUNE_AUTO; 708 hwif->drives[1].autotune = IDE_TUNE_AUTO; ··· 731 .init_setup = init_setup_scc, \ 732 .init_iops = init_iops_scc, \ 733 .init_hwif = init_hwif_scc, \ 734 .autodma = AUTODMA, \ 735 .bootable = ON_BOARD, \ 736 + .host_flags = IDE_HFLAG_SINGLE, \ 737 + .pio_mask = ATA_PIO4, \ 738 } 739 740 static ide_pci_device_t scc_chipsets[] __devinitdata = {
+51 -54
drivers/ide/pci/serverworks.c
··· 1 /* 2 - * linux/drivers/ide/pci/serverworks.c Version 0.20 Jun 3 2007 3 * 4 * Copyright (C) 1998-2000 Michel Aubry 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz ··· 123 } 124 return 0; 125 } 126 static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) 127 { 128 static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; 129 static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; 130 - static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; 131 - static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; 132 static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; 133 134 ide_hwif_t *hwif = HWIF(drive); 135 struct pci_dev *dev = hwif->pci_dev; 136 u8 speed = ide_rate_filter(drive, xferspeed); 137 - u8 pio = ide_get_best_pio_mode(drive, 255, 4, NULL); 138 u8 unit = (drive->select.b.unit & 0x01); 139 - u8 csb5 = svwks_csb_check(dev); 140 - u8 ultra_enable = 0, ultra_timing = 0; 141 - u8 dma_timing = 0, pio_timing = 0; 142 - u16 csb5_pio = 0; 143 144 /* If we are about to put a disk into UDMA mode we screwed up. 145 Our code assumes we never _ever_ do this on an OSB4 */ ··· 171 BUG(); 172 173 pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); 174 - pci_read_config_word(dev, 0x4A, &csb5_pio); 175 pci_read_config_byte(dev, 0x54, &ultra_enable); 176 177 ultra_timing &= ~(0x0F << (4*unit)); 178 ultra_enable &= ~(0x01 << drive->dn); 179 - csb5_pio &= ~(0x0F << (4*drive->dn)); 180 181 switch(speed) { 182 - case XFER_PIO_4: 183 - case XFER_PIO_3: 184 - case XFER_PIO_2: 185 - case XFER_PIO_1: 186 - case XFER_PIO_0: 187 - pio_timing |= pio_modes[speed - XFER_PIO_0]; 188 - csb5_pio |= ((speed - XFER_PIO_0) << (4*drive->dn)); 189 - break; 190 - 191 case XFER_MW_DMA_2: 192 case XFER_MW_DMA_1: 193 case XFER_MW_DMA_0: 194 - /* 195 - * TODO: always setup PIO mode so this won't be needed 196 - */ 197 - pio_timing |= pio_modes[pio]; 198 - csb5_pio |= (pio << (4*drive->dn)); 199 dma_timing |= dma_modes[speed - XFER_MW_DMA_0]; 200 break; 201 ··· 189 case XFER_UDMA_2: 190 case XFER_UDMA_1: 191 case XFER_UDMA_0: 192 - /* 193 - * TODO: always setup PIO mode so this won't be needed 194 - */ 195 - pio_timing |= pio_modes[pio]; 196 - csb5_pio |= (pio << (4*drive->dn)); 197 dma_timing |= dma_modes[2]; 198 ultra_timing |= ((udma_modes[speed - XFER_UDMA_0]) << (4*unit)); 199 ultra_enable |= (0x01 << drive->dn); 200 default: 201 break; 202 } 203 - 204 - pci_write_config_byte(dev, drive_pci[drive->dn], pio_timing); 205 - if (csb5) 206 - pci_write_config_word(dev, 0x4A, csb5_pio); 207 208 pci_write_config_byte(dev, drive_pci2[drive->dn], dma_timing); 209 pci_write_config_byte(dev, (0x56|hwif->channel), ultra_timing); ··· 205 206 static void svwks_tune_drive (ide_drive_t *drive, u8 pio) 207 { 208 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 209 - (void)svwks_tune_chipset(drive, XFER_PIO_0 + pio); 210 } 211 212 static int svwks_config_drive_xfer_rate (ide_drive_t *drive) ··· 387 388 static void __devinit init_hwif_svwks (ide_hwif_t *hwif) 389 { 390 - u8 dma_stat = 0; 391 - 392 if (!hwif->irq) 393 hwif->irq = hwif->channel ? 15 : 14; 394 ··· 403 404 hwif->autodma = 0; 405 406 - if (!hwif->dma_base) { 407 - hwif->drives[0].autotune = 1; 408 - hwif->drives[1].autotune = 1; 409 return; 410 - } 411 412 hwif->ide_dma_check = &svwks_config_drive_xfer_rate; 413 if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { ··· 417 if (!noautodma) 418 hwif->autodma = 1; 419 420 - dma_stat = inb(hwif->dma_status); 421 - hwif->drives[0].autodma = (dma_stat & 0x20); 422 - hwif->drives[1].autodma = (dma_stat & 0x40); 423 - hwif->drives[0].autotune = (!(dma_stat & 0x20)); 424 - hwif->drives[1].autotune = (!(dma_stat & 0x40)); 425 } 426 427 static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) ··· 433 d->bootable = ON_BOARD; 434 } 435 436 - d->channels = ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || 437 - dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && 438 - (!(PCI_FUNC(dev->devfn) & 1))) ? 1 : 2; 439 440 return ide_setup_pci_device(dev, d); 441 } ··· 449 .init_setup = init_setup_svwks, 450 .init_chipset = init_chipset_svwks, 451 .init_hwif = init_hwif_svwks, 452 - .channels = 2, 453 .autodma = AUTODMA, 454 .bootable = ON_BOARD, 455 },{ /* 1 */ 456 .name = "SvrWks CSB5", 457 .init_setup = init_setup_svwks, 458 .init_chipset = init_chipset_svwks, 459 .init_hwif = init_hwif_svwks, 460 - .channels = 2, 461 .autodma = AUTODMA, 462 .bootable = ON_BOARD, 463 },{ /* 2 */ 464 .name = "SvrWks CSB6", 465 .init_setup = init_setup_csb6, 466 .init_chipset = init_chipset_svwks, 467 .init_hwif = init_hwif_svwks, 468 - .channels = 2, 469 .autodma = AUTODMA, 470 .bootable = ON_BOARD, 471 },{ /* 3 */ 472 .name = "SvrWks CSB6", 473 .init_setup = init_setup_csb6, 474 .init_chipset = init_chipset_svwks, 475 .init_hwif = init_hwif_svwks, 476 - .channels = 1, /* 2 */ 477 .autodma = AUTODMA, 478 .bootable = ON_BOARD, 479 },{ /* 4 */ 480 .name = "SvrWks HT1000", 481 .init_setup = init_setup_svwks, 482 .init_chipset = init_chipset_svwks, 483 .init_hwif = init_hwif_svwks, 484 - .channels = 1, /* 2 */ 485 .autodma = AUTODMA, 486 .bootable = ON_BOARD, 487 } 488 }; 489
··· 1 /* 2 + * linux/drivers/ide/pci/serverworks.c Version 0.22 Jun 27 2007 3 * 4 * Copyright (C) 1998-2000 Michel Aubry 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz ··· 123 } 124 return 0; 125 } 126 + 127 + static void svwks_tune_pio(ide_drive_t *drive, const u8 pio) 128 + { 129 + static const u8 pio_modes[] = { 0x5d, 0x47, 0x34, 0x22, 0x20 }; 130 + static const u8 drive_pci[] = { 0x41, 0x40, 0x43, 0x42 }; 131 + 132 + struct pci_dev *dev = drive->hwif->pci_dev; 133 + 134 + pci_write_config_byte(dev, drive_pci[drive->dn], pio_modes[pio]); 135 + 136 + if (svwks_csb_check(dev)) { 137 + u16 csb_pio = 0; 138 + 139 + pci_read_config_word(dev, 0x4a, &csb_pio); 140 + 141 + csb_pio &= ~(0x0f << (4 * drive->dn)); 142 + csb_pio |= (pio << (4 * drive->dn)); 143 + 144 + pci_write_config_word(dev, 0x4a, csb_pio); 145 + } 146 + } 147 + 148 static int svwks_tune_chipset (ide_drive_t *drive, u8 xferspeed) 149 { 150 static const u8 udma_modes[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05 }; 151 static const u8 dma_modes[] = { 0x77, 0x21, 0x20 }; 152 static const u8 drive_pci2[] = { 0x45, 0x44, 0x47, 0x46 }; 153 154 ide_hwif_t *hwif = HWIF(drive); 155 struct pci_dev *dev = hwif->pci_dev; 156 u8 speed = ide_rate_filter(drive, xferspeed); 157 u8 unit = (drive->select.b.unit & 0x01); 158 + 159 + u8 ultra_enable = 0, ultra_timing = 0, dma_timing = 0; 160 + 161 + if (speed >= XFER_PIO_0 && speed <= XFER_PIO_4) { 162 + svwks_tune_pio(drive, speed - XFER_PIO_0); 163 + return ide_config_drive_speed(drive, speed); 164 + } 165 166 /* If we are about to put a disk into UDMA mode we screwed up. 167 Our code assumes we never _ever_ do this on an OSB4 */ ··· 149 BUG(); 150 151 pci_read_config_byte(dev, (0x56|hwif->channel), &ultra_timing); 152 pci_read_config_byte(dev, 0x54, &ultra_enable); 153 154 ultra_timing &= ~(0x0F << (4*unit)); 155 ultra_enable &= ~(0x01 << drive->dn); 156 157 switch(speed) { 158 case XFER_MW_DMA_2: 159 case XFER_MW_DMA_1: 160 case XFER_MW_DMA_0: 161 dma_timing |= dma_modes[speed - XFER_MW_DMA_0]; 162 break; 163 ··· 183 case XFER_UDMA_2: 184 case XFER_UDMA_1: 185 case XFER_UDMA_0: 186 dma_timing |= dma_modes[2]; 187 ultra_timing |= ((udma_modes[speed - XFER_UDMA_0]) << (4*unit)); 188 ultra_enable |= (0x01 << drive->dn); 189 default: 190 break; 191 } 192 193 pci_write_config_byte(dev, drive_pci2[drive->dn], dma_timing); 194 pci_write_config_byte(dev, (0x56|hwif->channel), ultra_timing); ··· 208 209 static void svwks_tune_drive (ide_drive_t *drive, u8 pio) 210 { 211 + pio = ide_get_best_pio_mode(drive, pio, 4); 212 + svwks_tune_pio(drive, pio); 213 + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 214 } 215 216 static int svwks_config_drive_xfer_rate (ide_drive_t *drive) ··· 389 390 static void __devinit init_hwif_svwks (ide_hwif_t *hwif) 391 { 392 if (!hwif->irq) 393 hwif->irq = hwif->channel ? 15 : 14; 394 ··· 407 408 hwif->autodma = 0; 409 410 + hwif->drives[0].autotune = 1; 411 + hwif->drives[1].autotune = 1; 412 + 413 + if (!hwif->dma_base) 414 return; 415 416 hwif->ide_dma_check = &svwks_config_drive_xfer_rate; 417 if (hwif->pci_dev->device != PCI_DEVICE_ID_SERVERWORKS_OSB4IDE) { ··· 421 if (!noautodma) 422 hwif->autodma = 1; 423 424 + hwif->drives[0].autodma = hwif->drives[1].autodma = 1; 425 } 426 427 static int __devinit init_setup_svwks (struct pci_dev *dev, ide_pci_device_t *d) ··· 441 d->bootable = ON_BOARD; 442 } 443 444 + if ((dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE || 445 + dev->device == PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2) && 446 + (!(PCI_FUNC(dev->devfn) & 1))) 447 + d->host_flags |= IDE_HFLAG_SINGLE; 448 + else 449 + d->host_flags &= ~IDE_HFLAG_SINGLE; 450 451 return ide_setup_pci_device(dev, d); 452 } ··· 454 .init_setup = init_setup_svwks, 455 .init_chipset = init_chipset_svwks, 456 .init_hwif = init_hwif_svwks, 457 .autodma = AUTODMA, 458 .bootable = ON_BOARD, 459 + .pio_mask = ATA_PIO4, 460 },{ /* 1 */ 461 .name = "SvrWks CSB5", 462 .init_setup = init_setup_svwks, 463 .init_chipset = init_chipset_svwks, 464 .init_hwif = init_hwif_svwks, 465 .autodma = AUTODMA, 466 .bootable = ON_BOARD, 467 + .pio_mask = ATA_PIO4, 468 },{ /* 2 */ 469 .name = "SvrWks CSB6", 470 .init_setup = init_setup_csb6, 471 .init_chipset = init_chipset_svwks, 472 .init_hwif = init_hwif_svwks, 473 .autodma = AUTODMA, 474 .bootable = ON_BOARD, 475 + .pio_mask = ATA_PIO4, 476 },{ /* 3 */ 477 .name = "SvrWks CSB6", 478 .init_setup = init_setup_csb6, 479 .init_chipset = init_chipset_svwks, 480 .init_hwif = init_hwif_svwks, 481 .autodma = AUTODMA, 482 .bootable = ON_BOARD, 483 + .host_flags = IDE_HFLAG_SINGLE, 484 + .pio_mask = ATA_PIO4, 485 },{ /* 4 */ 486 .name = "SvrWks HT1000", 487 .init_setup = init_setup_svwks, 488 .init_chipset = init_chipset_svwks, 489 .init_hwif = init_hwif_svwks, 490 .autodma = AUTODMA, 491 .bootable = ON_BOARD, 492 + .host_flags = IDE_HFLAG_SINGLE, 493 + .pio_mask = ATA_PIO4, 494 } 495 }; 496
+2 -1
drivers/ide/pci/sgiioc4.c
··· 586 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ 587 hwif->mwdma_mask = 0x2; /* Multimode-2 DMA */ 588 hwif->swdma_mask = 0x2; 589 hwif->tuneproc = NULL; /* Sets timing for PIO mode */ 590 hwif->speedproc = NULL; /* Sets timing for DMA &/or PIO modes */ 591 hwif->selectproc = NULL;/* Use the default routine to select drive */ ··· 725 .name = "SGIIOC4", 726 .init_hwif = ide_init_sgiioc4, 727 .init_dma = ide_dma_sgiioc4, 728 - .channels = 1, 729 .autodma = AUTODMA, 730 /* SGI IOC4 doesn't have enablebits. */ 731 .bootable = ON_BOARD, 732 }; 733 734 int
··· 586 hwif->ultra_mask = 0x0; /* Disable Ultra DMA */ 587 hwif->mwdma_mask = 0x2; /* Multimode-2 DMA */ 588 hwif->swdma_mask = 0x2; 589 + hwif->pio_mask = 0x00; 590 hwif->tuneproc = NULL; /* Sets timing for PIO mode */ 591 hwif->speedproc = NULL; /* Sets timing for DMA &/or PIO modes */ 592 hwif->selectproc = NULL;/* Use the default routine to select drive */ ··· 724 .name = "SGIIOC4", 725 .init_hwif = ide_init_sgiioc4, 726 .init_dma = ide_dma_sgiioc4, 727 .autodma = AUTODMA, 728 /* SGI IOC4 doesn't have enablebits. */ 729 .bootable = ON_BOARD, 730 + .host_flags = IDE_HFLAG_SINGLE, 731 }; 732 733 int
+40 -99
drivers/ide/pci/siimage.c
··· 1 /* 2 - * linux/drivers/ide/pci/siimage.c Version 1.12 Mar 10 2007 3 * 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 6 * Copyright (C) 2007 MontaVista Software, Inc. 7 * 8 * May be copied or modified under the terms of the GNU General Public License 9 * ··· 32 * unplugging/replugging the virtual CD interface when the DRAC is reset. 33 * This often causes drivers/ide/siimage to panic but is ok with the rather 34 * smarter code in libata. 35 */ 36 37 #include <linux/types.h> ··· 165 } 166 167 /** 168 - * siimage_taskfile_timing - turn timing data to a mode 169 - * @hwif: interface to query 170 - * 171 - * Read the timing data for the interface and return the 172 - * mode that is being used. 173 - */ 174 - 175 - static byte siimage_taskfile_timing (ide_hwif_t *hwif) 176 - { 177 - u16 timing = 0x328a; 178 - unsigned long addr = siimage_selreg(hwif, 2); 179 - 180 - if (hwif->mmio) 181 - timing = hwif->INW(addr); 182 - else 183 - pci_read_config_word(hwif->pci_dev, addr, &timing); 184 - 185 - switch (timing) { 186 - case 0x10c1: return 4; 187 - case 0x10c3: return 3; 188 - case 0x1104: 189 - case 0x1281: return 2; 190 - case 0x2283: return 1; 191 - case 0x328a: 192 - default: return 0; 193 - } 194 - } 195 - 196 - /** 197 - * simmage_tuneproc - tune a drive 198 * @drive: drive to tune 199 - * @mode_wanted: the target operating mode 200 * 201 * Load the timing settings for this device mode into the 202 * controller. If we are in PIO mode 3 or 4 turn on IORDY 203 * monitoring (bit 9). The TF timing is bits 31:16 204 */ 205 - 206 - static void siimage_tuneproc (ide_drive_t *drive, byte mode_wanted) 207 { 208 ide_hwif_t *hwif = HWIF(drive); 209 u32 speedt = 0; 210 u16 speedp = 0; 211 unsigned long addr = siimage_seldev(drive, 0x04); 212 unsigned long tfaddr = siimage_selreg(hwif, 0x02); 213 - 214 - /* cheat for now and use the docs */ 215 - switch (mode_wanted) { 216 - case 4: 217 - speedp = 0x10c1; 218 - speedt = 0x10c1; 219 - break; 220 - case 3: 221 - speedp = 0x10c3; 222 - speedt = 0x10c3; 223 - break; 224 - case 2: 225 - speedp = 0x1104; 226 - speedt = 0x1281; 227 - break; 228 - case 1: 229 - speedp = 0x2283; 230 - speedt = 0x2283; 231 - break; 232 - case 0: 233 - default: 234 - speedp = 0x328a; 235 - speedt = 0x328a; 236 - break; 237 } 238 239 if (hwif->mmio) { 240 hwif->OUTW(speedp, addr); 241 hwif->OUTW(speedt, tfaddr); 242 /* Now set up IORDY */ 243 - if(mode_wanted == 3 || mode_wanted == 4) 244 hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2); 245 else 246 hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2); ··· 213 pci_read_config_word(hwif->pci_dev, tfaddr-2, &speedp); 214 speedp &= ~0x200; 215 /* Set IORDY for mode 3 or 4 */ 216 - if(mode_wanted == 3 || mode_wanted == 4) 217 speedp |= 0x200; 218 pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp); 219 } 220 } 221 222 - /** 223 - * config_siimage_chipset_for_pio - set drive timings 224 - * @drive: drive to tune 225 - * @speed we want 226 - * 227 - * Compute the best pio mode we can for a given device. Also honour 228 - * the timings for the driver when dealing with mixed devices. Some 229 - * of this is ugly but its all wrapped up here 230 - * 231 - * The SI680 can also do VDMA - we need to start using that 232 - * 233 - * FIXME: we use the BIOS channel timings to avoid driving the task 234 - * files too fast at the disk. We need to compute the master/slave 235 - * drive PIO mode properly so that we can up the speed on a hotplug 236 - * system. 237 - */ 238 - 239 - static void config_siimage_chipset_for_pio (ide_drive_t *drive, byte set_speed) 240 { 241 - u8 channel_timings = siimage_taskfile_timing(HWIF(drive)); 242 - u8 speed = 0, set_pio = ide_get_best_pio_mode(drive, 4, 5, NULL); 243 - 244 - /* WARNING PIO timing mess is going to happen b/w devices, argh */ 245 - if ((channel_timings != set_pio) && (set_pio > channel_timings)) 246 - set_pio = channel_timings; 247 - 248 - siimage_tuneproc(drive, set_pio); 249 - speed = XFER_PIO_0 + set_pio; 250 - if (set_speed) 251 - (void) ide_config_drive_speed(drive, speed); 252 } 253 254 /** ··· 278 case XFER_PIO_2: 279 case XFER_PIO_1: 280 case XFER_PIO_0: 281 - siimage_tuneproc(drive, (speed - XFER_PIO_0)); 282 mode |= ((unit) ? 0x10 : 0x01); 283 break; 284 case XFER_MW_DMA_2: ··· 286 case XFER_MW_DMA_0: 287 multi = dma[speed - XFER_MW_DMA_0]; 288 mode |= ((unit) ? 0x20 : 0x02); 289 - config_siimage_chipset_for_pio(drive, 0); 290 break; 291 case XFER_UDMA_6: 292 case XFER_UDMA_5: ··· 298 ultra |= ((scsc) ? (ultra6[speed - XFER_UDMA_0]) : 299 (ultra5[speed - XFER_UDMA_0])); 300 mode |= ((unit) ? 0x30 : 0x03); 301 - config_siimage_chipset_for_pio(drive, 0); 302 break; 303 default: 304 return 1; ··· 331 return 0; 332 333 if (ide_use_fast_pio(drive)) 334 - config_siimage_chipset_for_pio(drive, 1); 335 336 return -1; 337 } ··· 902 903 hwif->resetproc = &siimage_reset; 904 hwif->speedproc = &siimage_tune_chipset; 905 - hwif->tuneproc = &siimage_tuneproc; 906 hwif->reset_poll = &siimage_reset_poll; 907 hwif->pre_reset = &siimage_pre_reset; 908 hwif->udma_filter = &sil_udma_filter; ··· 917 first = 0; 918 } 919 } 920 - if (!hwif->dma_base) { 921 - hwif->drives[0].autotune = 1; 922 - hwif->drives[1].autotune = 1; 923 return; 924 - } 925 926 hwif->ultra_mask = 0x7f; 927 hwif->mwdma_mask = 0x07; ··· 957 .init_iops = init_iops_siimage, \ 958 .init_hwif = init_hwif_siimage, \ 959 .fixup = siimage_fixup, \ 960 - .channels = 2, \ 961 .autodma = AUTODMA, \ 962 .bootable = ON_BOARD, \ 963 } 964 965 static ide_pci_device_t siimage_chipsets[] __devinitdata = {
··· 1 /* 2 + * linux/drivers/ide/pci/siimage.c Version 1.15 Jun 29 2007 3 * 4 * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> 5 * Copyright (C) 2003 Red Hat <alan@redhat.com> 6 * Copyright (C) 2007 MontaVista Software, Inc. 7 + * Copyright (C) 2007 Bartlomiej Zolnierkiewicz 8 * 9 * May be copied or modified under the terms of the GNU General Public License 10 * ··· 31 * unplugging/replugging the virtual CD interface when the DRAC is reset. 32 * This often causes drivers/ide/siimage to panic but is ok with the rather 33 * smarter code in libata. 34 + * 35 + * TODO: 36 + * - IORDY fixes 37 + * - VDMA support 38 */ 39 40 #include <linux/types.h> ··· 160 } 161 162 /** 163 + * sil_tune_pio - tune a drive 164 * @drive: drive to tune 165 + * @pio: the desired PIO mode 166 * 167 * Load the timing settings for this device mode into the 168 * controller. If we are in PIO mode 3 or 4 turn on IORDY 169 * monitoring (bit 9). The TF timing is bits 31:16 170 */ 171 + 172 + static void sil_tune_pio(ide_drive_t *drive, u8 pio) 173 { 174 + const u16 tf_speed[] = { 0x328a, 0x2283, 0x1281, 0x10c3, 0x10c1 }; 175 + const u16 data_speed[] = { 0x328a, 0x2283, 0x1104, 0x10c3, 0x10c1 }; 176 + 177 ide_hwif_t *hwif = HWIF(drive); 178 + ide_drive_t *pair = &hwif->drives[drive->dn ^ 1]; 179 u32 speedt = 0; 180 u16 speedp = 0; 181 unsigned long addr = siimage_seldev(drive, 0x04); 182 unsigned long tfaddr = siimage_selreg(hwif, 0x02); 183 + u8 tf_pio = pio; 184 + 185 + /* trim *taskfile* PIO to the slowest of the master/slave */ 186 + if (pair->present) { 187 + u8 pair_pio = ide_get_best_pio_mode(pair, 255, 4); 188 + 189 + if (pair_pio < tf_pio) 190 + tf_pio = pair_pio; 191 } 192 + 193 + /* cheat for now and use the docs */ 194 + speedp = data_speed[pio]; 195 + speedt = tf_speed[tf_pio]; 196 197 if (hwif->mmio) { 198 hwif->OUTW(speedp, addr); 199 hwif->OUTW(speedt, tfaddr); 200 /* Now set up IORDY */ 201 + if (pio > 2) 202 hwif->OUTW(hwif->INW(tfaddr-2)|0x200, tfaddr-2); 203 else 204 hwif->OUTW(hwif->INW(tfaddr-2)&~0x200, tfaddr-2); ··· 245 pci_read_config_word(hwif->pci_dev, tfaddr-2, &speedp); 246 speedp &= ~0x200; 247 /* Set IORDY for mode 3 or 4 */ 248 + if (pio > 2) 249 speedp |= 0x200; 250 pci_write_config_word(hwif->pci_dev, tfaddr-2, speedp); 251 } 252 } 253 254 + static void sil_tuneproc(ide_drive_t *drive, u8 pio) 255 { 256 + pio = ide_get_best_pio_mode(drive, pio, 4); 257 + sil_tune_pio(drive, pio); 258 + (void)ide_config_drive_speed(drive, XFER_PIO_0 + pio); 259 } 260 261 /** ··· 335 case XFER_PIO_2: 336 case XFER_PIO_1: 337 case XFER_PIO_0: 338 + sil_tune_pio(drive, speed - XFER_PIO_0); 339 mode |= ((unit) ? 0x10 : 0x01); 340 break; 341 case XFER_MW_DMA_2: ··· 343 case XFER_MW_DMA_0: 344 multi = dma[speed - XFER_MW_DMA_0]; 345 mode |= ((unit) ? 0x20 : 0x02); 346 break; 347 case XFER_UDMA_6: 348 case XFER_UDMA_5: ··· 356 ultra |= ((scsc) ? (ultra6[speed - XFER_UDMA_0]) : 357 (ultra5[speed - XFER_UDMA_0])); 358 mode |= ((unit) ? 0x30 : 0x03); 359 break; 360 default: 361 return 1; ··· 390 return 0; 391 392 if (ide_use_fast_pio(drive)) 393 + sil_tuneproc(drive, 255); 394 395 return -1; 396 } ··· 961 962 hwif->resetproc = &siimage_reset; 963 hwif->speedproc = &siimage_tune_chipset; 964 + hwif->tuneproc = &sil_tuneproc; 965 hwif->reset_poll = &siimage_reset_poll; 966 hwif->pre_reset = &siimage_pre_reset; 967 hwif->udma_filter = &sil_udma_filter; ··· 976 first = 0; 977 } 978 } 979 + 980 + hwif->drives[0].autotune = hwif->drives[1].autotune = 1; 981 + 982 + if (hwif->dma_base == 0) 983 return; 984 985 hwif->ultra_mask = 0x7f; 986 hwif->mwdma_mask = 0x07; ··· 1016 .init_iops = init_iops_siimage, \ 1017 .init_hwif = init_hwif_siimage, \ 1018 .fixup = siimage_fixup, \ 1019 .autodma = AUTODMA, \ 1020 .bootable = ON_BOARD, \ 1021 + .pio_mask = ATA_PIO4, \ 1022 } 1023 1024 static ide_pci_device_t siimage_chipsets[] __devinitdata = {
+2 -2
drivers/ide/pci/sis5513.c
··· 521 522 static int sis5513_tune_drive(ide_drive_t *drive, u8 pio) 523 { 524 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 525 config_art_rwp_pio(drive, pio); 526 return ide_config_drive_speed(drive, XFER_PIO_0 + pio); 527 } ··· 878 .name = "SIS5513", 879 .init_chipset = init_chipset_sis5513, 880 .init_hwif = init_hwif_sis5513, 881 - .channels = 2, 882 .autodma = NOAUTODMA, 883 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 884 .bootable = ON_BOARD, 885 }; 886 887 static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id)
··· 521 522 static int sis5513_tune_drive(ide_drive_t *drive, u8 pio) 523 { 524 + pio = ide_get_best_pio_mode(drive, pio, 4); 525 config_art_rwp_pio(drive, pio); 526 return ide_config_drive_speed(drive, XFER_PIO_0 + pio); 527 } ··· 878 .name = "SIS5513", 879 .init_chipset = init_chipset_sis5513, 880 .init_hwif = init_hwif_sis5513, 881 .autodma = NOAUTODMA, 882 .enablebits = {{0x4a,0x02,0x02}, {0x4a,0x04,0x04}}, 883 .bootable = ON_BOARD, 884 + .pio_mask = ATA_PIO4, 885 }; 886 887 static int __devinit sis5513_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+13 -9
drivers/ide/pci/sl82c105.c
··· 52 * Convert a PIO mode and cycle time to the required on/off times 53 * for the interface. This has protection against runaway timings. 54 */ 55 - static unsigned int get_pio_timings(ide_pio_data_t *p) 56 { 57 unsigned int cmd_on, cmd_off; 58 59 - cmd_on = (ide_pio_timings[p->pio_mode].active_time + 29) / 30; 60 - cmd_off = (p->cycle_time - 30 * cmd_on + 29) / 30; 61 62 if (cmd_on == 0) 63 cmd_on = 1; ··· 66 if (cmd_off == 0) 67 cmd_off = 1; 68 69 - return (cmd_on - 1) << 8 | (cmd_off - 1) | (p->use_iordy ? 0x40 : 0x00); 70 } 71 72 /* ··· 79 { 80 struct pci_dev *dev = HWIF(drive)->pci_dev; 81 int reg = 0x44 + drive->dn * 4; 82 - ide_pio_data_t p; 83 u16 drv_ctrl; 84 85 DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); 86 87 - pio = ide_get_best_pio_mode(drive, pio, 5, &p); 88 89 - drv_ctrl = get_pio_timings(&p); 90 91 /* 92 * Store the PIO timings so that we can restore them ··· 104 } 105 106 printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, 107 - ide_xfer_verbose(pio + XFER_PIO_0), p.cycle_time, drv_ctrl); 108 109 return pio; 110 } ··· 453 .name = "W82C105", 454 .init_chipset = init_chipset_sl82c105, 455 .init_hwif = init_hwif_sl82c105, 456 - .channels = 2, 457 .autodma = NOAUTODMA, 458 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 459 .bootable = ON_BOARD, 460 }; 461 462 static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
··· 52 * Convert a PIO mode and cycle time to the required on/off times 53 * for the interface. This has protection against runaway timings. 54 */ 55 + static unsigned int get_pio_timings(ide_drive_t *drive, u8 pio) 56 { 57 unsigned int cmd_on, cmd_off; 58 + u8 iordy = 0; 59 60 + cmd_on = (ide_pio_timings[pio].active_time + 29) / 30; 61 + cmd_off = (ide_pio_cycle_time(drive, pio) - 30 * cmd_on + 29) / 30; 62 63 if (cmd_on == 0) 64 cmd_on = 1; ··· 65 if (cmd_off == 0) 66 cmd_off = 1; 67 68 + if (pio > 2 || ide_dev_has_iordy(drive->id)) 69 + iordy = 0x40; 70 + 71 + return (cmd_on - 1) << 8 | (cmd_off - 1) | iordy; 72 } 73 74 /* ··· 75 { 76 struct pci_dev *dev = HWIF(drive)->pci_dev; 77 int reg = 0x44 + drive->dn * 4; 78 u16 drv_ctrl; 79 80 DBG(("sl82c105_tune_pio(drive:%s, pio:%u)\n", drive->name, pio)); 81 82 + pio = ide_get_best_pio_mode(drive, pio, 5); 83 84 + drv_ctrl = get_pio_timings(drive, pio); 85 86 /* 87 * Store the PIO timings so that we can restore them ··· 101 } 102 103 printk(KERN_DEBUG "%s: selected %s (%dns) (%04X)\n", drive->name, 104 + ide_xfer_verbose(pio + XFER_PIO_0), 105 + ide_pio_cycle_time(drive, pio), drv_ctrl); 106 107 return pio; 108 } ··· 449 .name = "W82C105", 450 .init_chipset = init_chipset_sl82c105, 451 .init_hwif = init_hwif_sl82c105, 452 .autodma = NOAUTODMA, 453 .enablebits = {{0x40,0x01,0x01}, {0x40,0x10,0x10}}, 454 .bootable = ON_BOARD, 455 + .pio_mask = ATA_PIO5, 456 }; 457 458 static int __devinit sl82c105_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+2 -2
drivers/ide/pci/slc90e66.c
··· 103 104 static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) 105 { 106 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 107 slc90e66_tune_pio(drive, pio); 108 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 109 } ··· 214 static ide_pci_device_t slc90e66_chipset __devinitdata = { 215 .name = "SLC90E66", 216 .init_hwif = init_hwif_slc90e66, 217 - .channels = 2, 218 .autodma = AUTODMA, 219 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, 220 .bootable = ON_BOARD, 221 }; 222 223 static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id)
··· 103 104 static void slc90e66_tune_drive (ide_drive_t *drive, u8 pio) 105 { 106 + pio = ide_get_best_pio_mode(drive, pio, 4); 107 slc90e66_tune_pio(drive, pio); 108 (void) ide_config_drive_speed(drive, XFER_PIO_0 + pio); 109 } ··· 214 static ide_pci_device_t slc90e66_chipset __devinitdata = { 215 .name = "SLC90E66", 216 .init_hwif = init_hwif_slc90e66, 217 .autodma = AUTODMA, 218 .enablebits = {{0x41,0x80,0x80}, {0x43,0x80,0x80}}, 219 .bootable = ON_BOARD, 220 + .pio_mask = ATA_PIO4, 221 }; 222 223 static int __devinit slc90e66_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+4 -3
drivers/ide/pci/tc86c001.c
··· 47 48 static void tc86c001_tune_drive(ide_drive_t *drive, u8 pio) 49 { 50 - pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 51 (void) tc86c001_tune_chipset(drive, XFER_PIO_0 + pio); 52 } 53 ··· 248 .name = "TC86C001", 249 .init_chipset = init_chipset_tc86c001, 250 .init_hwif = init_hwif_tc86c001, 251 - .channels = 1, 252 .autodma = AUTODMA, 253 - .bootable = OFF_BOARD 254 }; 255 256 static int __devinit tc86c001_init_one(struct pci_dev *dev,
··· 47 48 static void tc86c001_tune_drive(ide_drive_t *drive, u8 pio) 49 { 50 + pio = ide_get_best_pio_mode(drive, pio, 4); 51 (void) tc86c001_tune_chipset(drive, XFER_PIO_0 + pio); 52 } 53 ··· 248 .name = "TC86C001", 249 .init_chipset = init_chipset_tc86c001, 250 .init_hwif = init_hwif_tc86c001, 251 .autodma = AUTODMA, 252 + .bootable = OFF_BOARD, 253 + .host_flags = IDE_HFLAG_SINGLE, 254 + .pio_mask = ATA_PIO4, 255 }; 256 257 static int __devinit tc86c001_init_one(struct pci_dev *dev,
+2 -2
drivers/ide/pci/triflex.c
··· 96 97 static void triflex_tune_drive(ide_drive_t *drive, u8 pio) 98 { 99 - int use_pio = ide_get_best_pio_mode(drive, pio, 4, NULL); 100 (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio)); 101 } 102 ··· 129 static ide_pci_device_t triflex_device __devinitdata = { 130 .name = "TRIFLEX", 131 .init_hwif = init_hwif_triflex, 132 - .channels = 2, 133 .autodma = AUTODMA, 134 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, 135 .bootable = ON_BOARD, 136 }; 137 138 static int __devinit triflex_init_one(struct pci_dev *dev,
··· 96 97 static void triflex_tune_drive(ide_drive_t *drive, u8 pio) 98 { 99 + int use_pio = ide_get_best_pio_mode(drive, pio, 4); 100 (void) triflex_tune_chipset(drive, (XFER_PIO_0 + use_pio)); 101 } 102 ··· 129 static ide_pci_device_t triflex_device __devinitdata = { 130 .name = "TRIFLEX", 131 .init_hwif = init_hwif_triflex, 132 .autodma = AUTODMA, 133 .enablebits = {{0x80, 0x01, 0x01}, {0x80, 0x02, 0x02}}, 134 .bootable = ON_BOARD, 135 + .pio_mask = ATA_PIO4, 136 }; 137 138 static int __devinit triflex_init_one(struct pci_dev *dev,
-1
drivers/ide/pci/trm290.c
··· 327 static ide_pci_device_t trm290_chipset __devinitdata = { 328 .name = "TRM290", 329 .init_hwif = init_hwif_trm290, 330 - .channels = 2, 331 .autodma = NOAUTODMA, 332 .bootable = ON_BOARD, 333 };
··· 327 static ide_pci_device_t trm290_chipset __devinitdata = { 328 .name = "TRM290", 329 .init_hwif = init_hwif_trm290, 330 .autodma = NOAUTODMA, 331 .bootable = ON_BOARD, 332 };
+15 -11
drivers/ide/pci/via82cxxx.c
··· 1 /* 2 * 3 - * Version 3.45 4 * 5 * VIA IDE driver for Linux. Supported southbridges: 6 * ··· 203 204 static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) 205 { 206 - if (pio == 255) { 207 - via_set_drive(drive, ide_find_best_pio_mode(drive)); 208 - return; 209 - } 210 211 via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5)); 212 } ··· 221 { 222 u8 speed = ide_max_dma_mode(drive); 223 224 - if (speed == 0) 225 - speed = ide_find_best_pio_mode(drive); 226 227 via_set_drive(drive, speed); 228 229 - if (drive->autodma && (speed & XFER_MODE) != XFER_PIO) 230 return 0; 231 232 return -1; ··· 498 .name = "VP_IDE", 499 .init_chipset = init_chipset_via82cxxx, 500 .init_hwif = init_hwif_via82cxxx, 501 - .channels = 2, 502 .autodma = NOAUTODMA, 503 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, 504 - .bootable = ON_BOARD 505 },{ /* 1 */ 506 .name = "VP_IDE", 507 .init_chipset = init_chipset_via82cxxx, 508 .init_hwif = init_hwif_via82cxxx, 509 - .channels = 2, 510 .autodma = AUTODMA, 511 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 512 .bootable = ON_BOARD, 513 } 514 }; 515
··· 1 /* 2 * 3 + * Version 3.46 4 * 5 * VIA IDE driver for Linux. Supported southbridges: 6 * ··· 203 204 static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) 205 { 206 + if (pio == 255) 207 + pio = ide_get_best_pio_mode(drive, 255, 5); 208 209 via_set_drive(drive, XFER_PIO_0 + min_t(u8, pio, 5)); 210 } ··· 223 { 224 u8 speed = ide_max_dma_mode(drive); 225 226 + if (speed == 0) { 227 + via82cxxx_tune_drive(drive, 255); 228 + return -1; 229 + } 230 231 via_set_drive(drive, speed); 232 233 + if (drive->autodma) 234 return 0; 235 236 return -1; ··· 498 .name = "VP_IDE", 499 .init_chipset = init_chipset_via82cxxx, 500 .init_hwif = init_hwif_via82cxxx, 501 .autodma = NOAUTODMA, 502 .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, 503 + .bootable = ON_BOARD, 504 + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST 505 + | IDE_HFLAG_PIO_NO_DOWNGRADE, 506 + .pio_mask = ATA_PIO5, 507 },{ /* 1 */ 508 .name = "VP_IDE", 509 .init_chipset = init_chipset_via82cxxx, 510 .init_hwif = init_hwif_via82cxxx, 511 .autodma = AUTODMA, 512 .enablebits = {{0x00,0x00,0x00}, {0x00,0x00,0x00}}, 513 .bootable = ON_BOARD, 514 + .host_flags = IDE_HFLAG_PIO_NO_BLACKLIST 515 + | IDE_HFLAG_PIO_NO_DOWNGRADE, 516 + .pio_mask = ATA_PIO5, 517 } 518 }; 519
+3 -2
drivers/ide/ppc/mpc8xx.c
··· 316 } 317 318 /* register routine to tune PIO mode */ 319 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; 320 321 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; ··· 403 } 404 405 /* register routine to tune PIO mode */ 406 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; 407 408 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; ··· 433 static void 434 m8xx_ide_tuneproc(ide_drive_t *drive, u8 pio) 435 { 436 - ide_pio_data_t d; 437 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 438 volatile pcmconf8xx_t *pcmp; 439 ulong timing, mask, reg; 440 #endif 441 442 - pio = ide_get_best_pio_mode(drive, pio, 4, &d); 443 444 #if 1 445 printk("%s[%d] %s: best PIO mode: %d\n",
··· 316 } 317 318 /* register routine to tune PIO mode */ 319 + ide_hwifs[data_port].pio_mask = ATA_PIO4; 320 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; 321 322 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; ··· 402 } 403 404 /* register routine to tune PIO mode */ 405 + ide_hwifs[data_port].pio_mask = ATA_PIO4; 406 ide_hwifs[data_port].tuneproc = m8xx_ide_tuneproc; 407 408 hw->ack_intr = (ide_ack_intr_t *) ide_interrupt_ack; ··· 431 static void 432 m8xx_ide_tuneproc(ide_drive_t *drive, u8 pio) 433 { 434 #if defined(CONFIG_IDE_8xx_PCCARD) || defined(CONFIG_IDE_8xx_DIRECT) 435 volatile pcmconf8xx_t *pcmp; 436 ulong timing, mask, reg; 437 #endif 438 439 + pio = ide_get_best_pio_mode(drive, pio, 4); 440 441 #if 1 442 printk("%s[%d] %s: best PIO mode: %d\n",
+9 -7
drivers/ide/ppc/pmac.c
··· 615 static void 616 pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) 617 { 618 - ide_pio_data_t d; 619 u32 *timings; 620 unsigned accessTicks, recTicks; 621 unsigned accessTime, recTime; 622 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 623 - 624 if (pmif == NULL) 625 return; 626 627 /* which drive is it ? */ 628 timings = &pmif->timings[drive->select.b.unit & 0x01]; 629 630 - pio = ide_get_best_pio_mode(drive, pio, 4, &d); 631 632 switch (pmif->kind) { 633 case controller_sh_ata6: { 634 /* 133Mhz cell */ 635 - u32 tr = kauai_lookup_timing(shasta_pio_timings, d.cycle_time); 636 if (tr == 0) 637 return; 638 *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr; ··· 642 case controller_un_ata6: 643 case controller_k2_ata6: { 644 /* 100Mhz cell */ 645 - u32 tr = kauai_lookup_timing(kauai_pio_timings, d.cycle_time); 646 if (tr == 0) 647 return; 648 *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr; ··· 650 } 651 case controller_kl_ata4: 652 /* 66Mhz cell */ 653 - recTime = d.cycle_time - ide_pio_timings[pio].active_time 654 - ide_pio_timings[pio].setup_time; 655 recTime = max(recTime, 150U); 656 accessTime = ide_pio_timings[pio].active_time; ··· 666 default: { 667 /* 33Mhz cell */ 668 int ebit = 0; 669 - recTime = d.cycle_time - ide_pio_timings[pio].active_time 670 - ide_pio_timings[pio].setup_time; 671 recTime = max(recTime, 150U); 672 accessTime = ide_pio_timings[pio].active_time; ··· 1248 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 1249 hwif->drives[0].unmask = 1; 1250 hwif->drives[1].unmask = 1; 1251 hwif->tuneproc = pmac_ide_tuneproc; 1252 if (pmif->kind == controller_un_ata6 1253 || pmif->kind == controller_k2_ata6
··· 615 static void 616 pmac_ide_tuneproc(ide_drive_t *drive, u8 pio) 617 { 618 u32 *timings; 619 unsigned accessTicks, recTicks; 620 unsigned accessTime, recTime; 621 pmac_ide_hwif_t* pmif = (pmac_ide_hwif_t *)HWIF(drive)->hwif_data; 622 + unsigned int cycle_time; 623 + 624 if (pmif == NULL) 625 return; 626 627 /* which drive is it ? */ 628 timings = &pmif->timings[drive->select.b.unit & 0x01]; 629 630 + pio = ide_get_best_pio_mode(drive, pio, 4); 631 + cycle_time = ide_pio_cycle_time(drive, pio); 632 633 switch (pmif->kind) { 634 case controller_sh_ata6: { 635 /* 133Mhz cell */ 636 + u32 tr = kauai_lookup_timing(shasta_pio_timings, cycle_time); 637 if (tr == 0) 638 return; 639 *timings = ((*timings) & ~TR_133_PIOREG_PIO_MASK) | tr; ··· 641 case controller_un_ata6: 642 case controller_k2_ata6: { 643 /* 100Mhz cell */ 644 + u32 tr = kauai_lookup_timing(kauai_pio_timings, cycle_time); 645 if (tr == 0) 646 return; 647 *timings = ((*timings) & ~TR_100_PIOREG_PIO_MASK) | tr; ··· 649 } 650 case controller_kl_ata4: 651 /* 66Mhz cell */ 652 + recTime = cycle_time - ide_pio_timings[pio].active_time 653 - ide_pio_timings[pio].setup_time; 654 recTime = max(recTime, 150U); 655 accessTime = ide_pio_timings[pio].active_time; ··· 665 default: { 666 /* 33Mhz cell */ 667 int ebit = 0; 668 + recTime = cycle_time - ide_pio_timings[pio].active_time 669 - ide_pio_timings[pio].setup_time; 670 recTime = max(recTime, 150U); 671 accessTime = ide_pio_timings[pio].active_time; ··· 1247 hwif->cbl = pmif->cable_80 ? ATA_CBL_PATA80 : ATA_CBL_PATA40; 1248 hwif->drives[0].unmask = 1; 1249 hwif->drives[1].unmask = 1; 1250 + hwif->pio_mask = ATA_PIO4; 1251 hwif->tuneproc = pmac_ide_tuneproc; 1252 if (pmif->kind == controller_un_ata6 1253 || pmif->kind == controller_k2_ata6
+6 -12
drivers/ide/setup-pci.c
··· 5 * 6 * Copyright (c) 1995-1998 Mark Lord 7 * May be copied or modified under the terms of the GNU General Public License 8 - * 9 - * Recent Changes 10 - * Split the set up function into multiple functions 11 - * Use pci_set_master 12 - * Fix misreporting of I/O v MMIO problems 13 - * Initial fixups for simplex devices 14 */ 15 16 /* ··· 401 unsigned long ctl = 0, base = 0; 402 ide_hwif_t *hwif; 403 404 - if ((d->flags & IDEPCI_FLAG_ISA_PORTS) == 0) { 405 /* Possibly we should fail if these checks report true */ 406 ide_pci_check_iomem(dev, d, 2*port); 407 ide_pci_check_iomem(dev, d, 2*port+1); ··· 565 566 void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) 567 { 568 - int port; 569 int at_least_one_hwif_enabled = 0; 570 ide_hwif_t *hwif, *mate = NULL; 571 u8 tmp; ··· 576 * Set up the IDE ports 577 */ 578 579 - for (port = 0; port <= 1; ++port) { 580 ide_pci_enablebit_t *e = &(d->enablebits[port]); 581 582 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 583 (tmp & e->mask) != e->val)) 584 continue; /* port not enabled */ 585 586 - if (d->channels <= port) 587 - break; 588 - 589 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) 590 continue; 591 ··· 607 else 608 ide_hwif_setup_dma(dev, d, hwif); 609 bypass_legacy_dma: 610 if (d->init_hwif) 611 /* Call chipset-specific routine 612 * for each enabled hwif
··· 5 * 6 * Copyright (c) 1995-1998 Mark Lord 7 * May be copied or modified under the terms of the GNU General Public License 8 */ 9 10 /* ··· 407 unsigned long ctl = 0, base = 0; 408 ide_hwif_t *hwif; 409 410 + if ((d->host_flags & IDE_HFLAG_ISA_PORTS) == 0) { 411 /* Possibly we should fail if these checks report true */ 412 ide_pci_check_iomem(dev, d, 2*port); 413 ide_pci_check_iomem(dev, d, 2*port+1); ··· 571 572 void ide_pci_setup_ports(struct pci_dev *dev, ide_pci_device_t *d, int pciirq, ata_index_t *index) 573 { 574 + int channels = (d->host_flags & IDE_HFLAG_SINGLE) ? 1 : 2, port; 575 int at_least_one_hwif_enabled = 0; 576 ide_hwif_t *hwif, *mate = NULL; 577 u8 tmp; ··· 582 * Set up the IDE ports 583 */ 584 585 + for (port = 0; port < channels; ++port) { 586 ide_pci_enablebit_t *e = &(d->enablebits[port]); 587 588 if (e->reg && (pci_read_config_byte(dev, e->reg, &tmp) || 589 (tmp & e->mask) != e->val)) 590 continue; /* port not enabled */ 591 592 if ((hwif = ide_hwif_configure(dev, d, mate, port, pciirq)) == NULL) 593 continue; 594 ··· 616 else 617 ide_hwif_setup_dma(dev, d, hwif); 618 bypass_legacy_dma: 619 + hwif->host_flags = d->host_flags; 620 + hwif->pio_mask = d->pio_mask; 621 + 622 if (d->init_hwif) 623 /* Call chipset-specific routine 624 * for each enabled hwif
+9
include/linux/ata.h
··· 64 ATA_ID_PROD_LEN = 40, 65 66 ATA_PCI_CTL_OFS = 2, 67 ATA_UDMA0 = (1 << 0), 68 ATA_UDMA1 = ATA_UDMA0 | (1 << 1), 69 ATA_UDMA2 = ATA_UDMA1 | (1 << 2),
··· 64 ATA_ID_PROD_LEN = 40, 65 66 ATA_PCI_CTL_OFS = 2, 67 + 68 + ATA_PIO0 = (1 << 0), 69 + ATA_PIO1 = ATA_PIO0 | (1 << 1), 70 + ATA_PIO2 = ATA_PIO1 | (1 << 2), 71 + ATA_PIO3 = ATA_PIO2 | (1 << 3), 72 + ATA_PIO4 = ATA_PIO3 | (1 << 4), 73 + ATA_PIO5 = ATA_PIO4 | (1 << 5), 74 + ATA_PIO6 = ATA_PIO5 | (1 << 6), 75 + 76 ATA_UDMA0 = (1 << 0), 77 ATA_UDMA1 = ATA_UDMA0 | (1 << 1), 78 ATA_UDMA2 = ATA_UDMA1 | (1 << 2),
+20 -11
include/linux/ide.h
··· 681 u8 straight8; /* Alan's straight 8 check */ 682 u8 bus_state; /* power state of the IDE bus */ 683 684 u8 atapi_dma; /* host supports atapi_dma */ 685 u8 ultra_mask; 686 u8 mwdma_mask; ··· 1248 1249 enum { 1250 /* Uses ISA control ports not PCI ones. */ 1251 - IDEPCI_FLAG_ISA_PORTS = (1 << 0), 1252 }; 1253 1254 typedef struct ide_pci_device_s { ··· 1266 void (*init_hwif)(ide_hwif_t *); 1267 void (*init_dma)(ide_hwif_t *, unsigned long); 1268 void (*fixup)(ide_hwif_t *); 1269 - u8 channels; 1270 u8 autodma; 1271 ide_pci_enablebit_t enablebits[2]; 1272 u8 bootable; 1273 unsigned int extra; 1274 struct ide_pci_device_s *next; 1275 - u8 flags; 1276 u8 udma_mask; 1277 } ide_pci_device_t; 1278 ··· 1373 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1374 int ide_use_fast_pio(ide_drive_t *); 1375 1376 u8 ide_dump_status(ide_drive_t *, const char *, u8); 1377 1378 typedef struct ide_pio_timings_s { ··· 1387 /* active + recovery (+ setup for some chips) */ 1388 } ide_pio_timings_t; 1389 1390 - typedef struct ide_pio_data_s { 1391 - u8 pio_mode; 1392 - u8 use_iordy; 1393 - u8 overridden; 1394 - unsigned int cycle_time; 1395 - } ide_pio_data_t; 1396 - 1397 - extern u8 ide_get_best_pio_mode (ide_drive_t *drive, u8 mode_wanted, u8 max_mode, ide_pio_data_t *d); 1398 extern const ide_pio_timings_t ide_pio_timings[6]; 1399 1400
··· 681 u8 straight8; /* Alan's straight 8 check */ 682 u8 bus_state; /* power state of the IDE bus */ 683 684 + u8 host_flags; 685 + 686 + u8 pio_mask; 687 + 688 u8 atapi_dma; /* host supports atapi_dma */ 689 u8 ultra_mask; 690 u8 mwdma_mask; ··· 1244 1245 enum { 1246 /* Uses ISA control ports not PCI ones. */ 1247 + IDE_HFLAG_ISA_PORTS = (1 << 0), 1248 + /* single port device */ 1249 + IDE_HFLAG_SINGLE = (1 << 1), 1250 + /* don't use legacy PIO blacklist */ 1251 + IDE_HFLAG_PIO_NO_BLACKLIST = (1 << 2), 1252 + /* don't use conservative PIO "downgrade" */ 1253 + IDE_HFLAG_PIO_NO_DOWNGRADE = (1 << 3), 1254 }; 1255 1256 typedef struct ide_pci_device_s { ··· 1256 void (*init_hwif)(ide_hwif_t *); 1257 void (*init_dma)(ide_hwif_t *, unsigned long); 1258 void (*fixup)(ide_hwif_t *); 1259 u8 autodma; 1260 ide_pci_enablebit_t enablebits[2]; 1261 u8 bootable; 1262 unsigned int extra; 1263 struct ide_pci_device_s *next; 1264 + u8 host_flags; 1265 + u8 pio_mask; 1266 u8 udma_mask; 1267 } ide_pci_device_t; 1268 ··· 1363 extern int ide_set_xfer_rate(ide_drive_t *drive, u8 rate); 1364 int ide_use_fast_pio(ide_drive_t *); 1365 1366 + static inline int ide_dev_has_iordy(struct hd_driveid *id) 1367 + { 1368 + return ((id->field_valid & 2) && (id->capability & 8)) ? 1 : 0; 1369 + } 1370 + 1371 u8 ide_dump_status(ide_drive_t *, const char *, u8); 1372 1373 typedef struct ide_pio_timings_s { ··· 1372 /* active + recovery (+ setup for some chips) */ 1373 } ide_pio_timings_t; 1374 1375 + unsigned int ide_pio_cycle_time(ide_drive_t *, u8); 1376 + u8 ide_get_best_pio_mode(ide_drive_t *, u8, u8); 1377 extern const ide_pio_timings_t ide_pio_timings[6]; 1378 1379