Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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:
ide: Add the MCP73/77 support to PATA driver
Add the PATA controller device ID to pci_ids.h for MCP73/MCP77.
hpt366: disallow Ultra133 for HPT374
ide: generic IDE PCI driver, add another device exception
ide: HPA detect from resume
it821x: RAID mode fixes
serverworks: fix CSB6 tuning logic
serverworks: remove crappy code

+115 -63
+12
drivers/ide/ide-disk.c
··· 1037 1037 1038 1038 static int ide_disk_probe(ide_drive_t *drive); 1039 1039 1040 + /* 1041 + * On HPA drives the capacity needs to be 1042 + * reinitilized on resume otherwise the disk 1043 + * can not be used and a hard reset is required 1044 + */ 1045 + static void ide_disk_resume(ide_drive_t *drive) 1046 + { 1047 + if (idedisk_supports_hpa(drive->id)) 1048 + init_idedisk_capacity(drive); 1049 + } 1050 + 1040 1051 static void ide_device_shutdown(ide_drive_t *drive) 1041 1052 { 1042 1053 #ifdef CONFIG_ALPHA ··· 1082 1071 }, 1083 1072 .probe = ide_disk_probe, 1084 1073 .remove = ide_disk_remove, 1074 + .resume = ide_disk_resume, 1085 1075 .shutdown = ide_device_shutdown, 1086 1076 .version = IDEDISK_VERSION, 1087 1077 .media = ide_disk,
+6 -6
drivers/ide/ide-probe.c
··· 717 717 * This routine only knows how to look for drive units 0 and 1 718 718 * on an interface, so any setting of MAX_DRIVES > 2 won't work here. 719 719 */ 720 - static void probe_hwif(ide_hwif_t *hwif) 720 + static void probe_hwif(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) 721 721 { 722 722 unsigned int unit; 723 723 unsigned long flags; ··· 820 820 return; 821 821 } 822 822 823 + if (fixup) 824 + fixup(hwif); 825 + 823 826 for (unit = 0; unit < MAX_DRIVES; ++unit) { 824 827 ide_drive_t *drive = &hwif->drives[unit]; 825 828 ··· 877 874 878 875 int probe_hwif_init_with_fixup(ide_hwif_t *hwif, void (*fixup)(ide_hwif_t *hwif)) 879 876 { 880 - probe_hwif(hwif); 881 - 882 - if (fixup) 883 - fixup(hwif); 877 + probe_hwif(hwif, fixup); 884 878 885 879 if (!hwif_init(hwif)) { 886 880 printk(KERN_INFO "%s: failed to initialize IDE interface\n", ··· 1404 1404 1405 1405 for (index = 0; index < MAX_HWIFS; ++index) 1406 1406 if (probe[index]) 1407 - probe_hwif(&ide_hwifs[index]); 1407 + probe_hwif(&ide_hwifs[index], NULL); 1408 1408 for (index = 0; index < MAX_HWIFS; ++index) 1409 1409 if (probe[index]) 1410 1410 hwif_init(&ide_hwifs[index]);
+8 -1
drivers/ide/ide.c
··· 1010 1010 { 1011 1011 ide_drive_t *drive = dev->driver_data; 1012 1012 ide_hwif_t *hwif = HWIF(drive); 1013 + ide_driver_t *drv = to_ide_driver(dev->driver); 1013 1014 struct request rq; 1014 1015 struct request_pm_state rqpm; 1015 1016 ide_task_t args; 1017 + int err; 1016 1018 1017 1019 /* Call ACPI _STM only once */ 1018 1020 if (!(drive->dn % 2)) ··· 1031 1029 rqpm.pm_step = ide_pm_state_start_resume; 1032 1030 rqpm.pm_state = PM_EVENT_ON; 1033 1031 1034 - return ide_do_drive_cmd(drive, &rq, ide_head_wait); 1032 + err = ide_do_drive_cmd(drive, &rq, ide_head_wait); 1033 + 1034 + if (err == 0 && drv && drv->resume) 1035 + drv->resume(drive); 1036 + 1037 + return err; 1035 1038 } 1036 1039 1037 1040 int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device *bdev,
+9 -3
drivers/ide/pci/amd74xx.c
··· 1 1 /* 2 - * Version 2.13 2 + * Version 2.15 3 3 * 4 4 * AMD 755/756/766/8111 and nVidia nForce/2/2s/3/3s/CK804/MCP04 5 5 * IDE driver for Linux. ··· 76 76 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, 0x50, AMD_UDMA_133 }, 77 77 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, 0x50, AMD_UDMA_133 }, 78 78 { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE, 0x50, AMD_UDMA_133 }, 79 + { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE, 0x50, AMD_UDMA_133 }, 80 + { PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE, 0x50, AMD_UDMA_133 }, 79 81 { PCI_DEVICE_ID_AMD_CS5536_IDE, 0x40, AMD_UDMA_100 }, 80 82 { 0 } 81 83 }; ··· 496 494 /* 17 */ DECLARE_NV_DEV("NFORCE-MCP61"), 497 495 /* 18 */ DECLARE_NV_DEV("NFORCE-MCP65"), 498 496 /* 19 */ DECLARE_NV_DEV("NFORCE-MCP67"), 499 - /* 20 */ DECLARE_AMD_DEV("AMD5536"), 497 + /* 20 */ DECLARE_NV_DEV("NFORCE-MCP73"), 498 + /* 21 */ DECLARE_NV_DEV("NFORCE-MCP77"), 499 + /* 22 */ DECLARE_AMD_DEV("AMD5536"), 500 500 }; 501 501 502 502 static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) ··· 538 534 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP61_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 17 }, 539 535 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP65_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 18 }, 540 536 { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 19 }, 541 - { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20 }, 537 + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 20 }, 538 + { PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 21 }, 539 + { PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_CS5536_IDE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 22 }, 542 540 { 0, }, 543 541 }; 544 542 MODULE_DEVICE_TABLE(pci, amd74xx_pci_tbl);
+23 -14
drivers/ide/pci/generic.c
··· 198 198 static int __devinit generic_init_one(struct pci_dev *dev, const struct pci_device_id *id) 199 199 { 200 200 ide_pci_device_t *d = &generic_chipsets[id->driver_data]; 201 - u16 command; 202 201 int ret = -ENODEV; 203 202 204 203 /* Don't use the generic entry unless instructed to do so */ 205 204 if (id->driver_data == 0 && ide_generic_all == 0) 206 205 goto out; 207 206 208 - if (dev->vendor == PCI_VENDOR_ID_UMC && 209 - dev->device == PCI_DEVICE_ID_UMC_UM8886A && 210 - (!(PCI_FUNC(dev->devfn) & 1))) 211 - goto out; /* UM8886A/BF pair */ 212 - 213 - if (dev->vendor == PCI_VENDOR_ID_OPTI && 214 - dev->device == PCI_DEVICE_ID_OPTI_82C558 && 215 - (!(PCI_FUNC(dev->devfn) & 1))) 216 - goto out; 217 - 218 - if (dev->vendor == PCI_VENDOR_ID_JMICRON) { 219 - if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && PCI_FUNC(dev->devfn) != 1) 207 + switch (dev->vendor) { 208 + case PCI_VENDOR_ID_UMC: 209 + if (dev->device == PCI_DEVICE_ID_UMC_UM8886A && 210 + !(PCI_FUNC(dev->devfn) & 1)) 211 + goto out; /* UM8886A/BF pair */ 212 + break; 213 + case PCI_VENDOR_ID_OPTI: 214 + if (dev->device == PCI_DEVICE_ID_OPTI_82C558 && 215 + !(PCI_FUNC(dev->devfn) & 1)) 220 216 goto out; 217 + break; 218 + case PCI_VENDOR_ID_JMICRON: 219 + if (dev->device != PCI_DEVICE_ID_JMICRON_JMB368 && 220 + PCI_FUNC(dev->devfn) != 1) 221 + goto out; 222 + break; 223 + case PCI_VENDOR_ID_NS: 224 + if (dev->device == PCI_DEVICE_ID_NS_87410 && 225 + (dev->class >> 8) != PCI_CLASS_STORAGE_IDE) 226 + goto out; 227 + break; 221 228 } 222 229 223 230 if (dev->vendor != PCI_VENDOR_ID_JMICRON) { 231 + u16 command; 224 232 pci_read_config_word(dev, PCI_COMMAND, &command); 225 233 if (!(command & PCI_COMMAND_IO)) { 226 - printk(KERN_INFO "Skipping disabled %s IDE controller.\n", d->name); 234 + printk(KERN_INFO "Skipping disabled %s IDE " 235 + "controller.\n", d->name); 227 236 goto out; 228 237 } 229 238 }
+4 -4
drivers/ide/pci/hpt366.c
··· 1 1 /* 2 - * linux/drivers/ide/pci/hpt366.c Version 1.03 May 4, 2007 2 + * linux/drivers/ide/pci/hpt366.c Version 1.04 Jun 4, 2007 3 3 * 4 4 * Copyright (C) 1999-2003 Andre Hedrick <andre@linux-ide.org> 5 5 * Portions Copyright (C) 2001 Sun Microsystems, Inc. ··· 106 106 * switch to calculating PCI clock frequency based on the chip's base DPLL 107 107 * frequency 108 108 * - switch to using the DPLL clock and enable UltraATA/133 mode by default on 109 - * anything newer than HPT370/A 109 + * anything newer than HPT370/A (except HPT374 that is not capable of this 110 + * mode according to the manual) 110 111 * - fold PCI clock detection and DPLL setup code into init_chipset_hpt366(), 111 112 * also fixing the interchanged 25/40 MHz PCI clock cases for HPT36x chips; 112 113 * unify HPT36x/37x timing setup code and the speedproc handlers by joining ··· 366 365 }; 367 366 368 367 #define HPT366_DEBUG_DRIVE_INFO 0 369 - #define HPT374_ALLOW_ATA133_6 1 370 368 #define HPT371_ALLOW_ATA133_6 1 371 369 #define HPT302_ALLOW_ATA133_6 1 372 370 #define HPT372_ALLOW_ATA133_6 1 ··· 450 450 451 451 static struct hpt_info hpt374 __devinitdata = { 452 452 .chip_type = HPT374, 453 - .max_mode = HPT374_ALLOW_ATA133_6 ? 4 : 3, 453 + .max_mode = 3, 454 454 .dpll_clk = 48, 455 455 .settings = hpt37x_settings 456 456 };
+18 -16
drivers/ide/pci/it821x.c
··· 1 1 2 2 /* 3 - * linux/drivers/ide/pci/it821x.c Version 0.10 Mar 10 2007 3 + * linux/drivers/ide/pci/it821x.c Version 0.15 Jun 2 2007 4 4 * 5 5 * Copyright (C) 2004 Red Hat <alan@redhat.com> 6 6 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz ··· 262 262 } 263 263 264 264 if (itdev->smart) 265 - goto set_drive_speed; 265 + return 0; 266 266 267 267 /* We prefer 66Mhz clock for PIO 0-3, don't care for PIO4 */ 268 268 itdev->want[unit][1] = pio_want[set_pio]; ··· 271 271 it821x_clock_strategy(drive); 272 272 it821x_program(drive, itdev->pio[unit]); 273 273 274 - set_drive_speed: 275 274 return ide_config_drive_speed(drive, XFER_PIO_0 + set_pio); 276 275 } 277 276 ··· 454 455 default: 455 456 return 1; 456 457 } 458 + 459 + return ide_config_drive_speed(drive, speed); 457 460 } 458 - /* 459 - * In smart mode the clocking is done by the host controller 460 - * snooping the mode we picked. The rest of it is not our problem 461 - */ 462 - return ide_config_drive_speed(drive, speed); 461 + 462 + /* don't touch anything in the smart mode */ 463 + return 0; 463 464 } 464 465 465 466 /** ··· 558 559 if(idbits[129] != 1) 559 560 printk("(%dK stripe)", idbits[146]); 560 561 printk(".\n"); 561 - /* Now the core code will have wrongly decided no DMA 562 - so we need to fix this */ 563 - hwif->dma_off_quietly(drive); 564 - #ifdef CONFIG_IDEDMA_ONLYDISK 565 - if (drive->media == ide_disk) 566 - #endif 567 - ide_set_dma(drive); 568 562 } else { 569 563 /* Non RAID volume. Fixups to stop the core code 570 564 doing unsupported things */ 571 - id->field_valid &= 1; 565 + id->field_valid &= 3; 572 566 id->queue_depth = 0; 573 567 id->command_set_1 = 0; 574 568 id->command_set_2 &= 0xC400; ··· 575 583 id->cfa_power = 0; 576 584 printk(KERN_INFO "%s: Performing identify fixups.\n", 577 585 drive->name); 586 + } 587 + 588 + /* 589 + * Set MWDMA0 mode as enabled/support - just to tell 590 + * IDE core that DMA is supported (it821x hardware 591 + * takes care of DMA mode programming). 592 + */ 593 + if (id->capability & 1) { 594 + id->dma_mword |= 0x0101; 595 + drive->current_speed = XFER_MW_DMA_0; 578 596 } 579 597 } 580 598
+32 -19
drivers/ide/pci/serverworks.c
··· 1 1 /* 2 - * linux/drivers/ide/pci/serverworks.c Version 0.9 Mar 4 2007 2 + * linux/drivers/ide/pci/serverworks.c Version 0.11 Jun 2 2007 3 3 * 4 4 * Copyright (C) 1998-2000 Michel Aubry 5 5 * Copyright (C) 1998-2000 Andrzej Krzysztofowicz ··· 170 170 if (!drive->init_speed) { 171 171 u8 dma_stat = inb(hwif->dma_status); 172 172 173 - dma_pio: 174 173 if (((ultra_enable << (7-drive->dn) & 0x80) == 0x80) && 175 174 ((dma_stat & (1<<(5+unit))) == (1<<(5+unit)))) { 176 175 drive->current_speed = drive->init_speed = XFER_UDMA_0 + udma_modes[(ultra_timing >> (4*unit)) & ~(0xF0)]; 177 176 return 0; 178 177 } else if ((dma_timing) && 179 178 ((dma_stat&(1<<(5+unit)))==(1<<(5+unit)))) { 180 - u8 dmaspeed = dma_timing; 179 + u8 dmaspeed; 181 180 182 - dma_timing &= ~0xFFU; 183 - if ((dmaspeed & 0x20) == 0x20) 181 + switch (dma_timing & 0x77) { 182 + case 0x20: 184 183 dmaspeed = XFER_MW_DMA_2; 185 - else if ((dmaspeed & 0x21) == 0x21) 184 + break; 185 + case 0x21: 186 186 dmaspeed = XFER_MW_DMA_1; 187 - else if ((dmaspeed & 0x77) == 0x77) 187 + break; 188 + case 0x77: 188 189 dmaspeed = XFER_MW_DMA_0; 189 - else 190 + break; 191 + default: 190 192 goto dma_pio; 193 + } 194 + 191 195 drive->current_speed = drive->init_speed = dmaspeed; 192 196 return 0; 193 - } else if (pio_timing) { 194 - u8 piospeed = pio_timing; 197 + } 198 + dma_pio: 199 + if (pio_timing) { 200 + u8 piospeed; 195 201 196 - pio_timing &= ~0xFFU; 197 - if ((piospeed & 0x20) == 0x20) 202 + switch (pio_timing & 0x7f) { 203 + case 0x20: 198 204 piospeed = XFER_PIO_4; 199 - else if ((piospeed & 0x22) == 0x22) 205 + break; 206 + case 0x22: 200 207 piospeed = XFER_PIO_3; 201 - else if ((piospeed & 0x34) == 0x34) 208 + break; 209 + case 0x34: 202 210 piospeed = XFER_PIO_2; 203 - else if ((piospeed & 0x47) == 0x47) 211 + break; 212 + case 0x47: 204 213 piospeed = XFER_PIO_1; 205 - else if ((piospeed & 0x5d) == 0x5d) 214 + break; 215 + case 0x5d: 206 216 piospeed = XFER_PIO_0; 207 - else 217 + break; 218 + default: 208 219 goto oem_setup_failed; 220 + } 221 + 209 222 drive->current_speed = drive->init_speed = piospeed; 210 223 return 0; 211 224 } ··· 227 214 228 215 oem_setup_failed: 229 216 230 - pio_timing &= ~0xFFU; 231 - dma_timing &= ~0xFFU; 217 + pio_timing = 0; 218 + dma_timing = 0; 232 219 ultra_timing &= ~(0x0F << (4*unit)); 233 220 ultra_enable &= ~(0x01 << drive->dn); 234 221 csb5_pio &= ~(0x0F << (4*drive->dn));
+1
include/linux/ide.h
··· 1001 1001 struct device_driver gen_driver; 1002 1002 int (*probe)(ide_drive_t *); 1003 1003 void (*remove)(ide_drive_t *); 1004 + void (*resume)(ide_drive_t *); 1004 1005 void (*shutdown)(ide_drive_t *); 1005 1006 #ifdef CONFIG_IDE_PROC_FS 1006 1007 ide_proc_entry_t *proc;
+2
include/linux/pci_ids.h
··· 1233 1233 #define PCI_DEVICE_ID_NVIDIA_NVENET_26 0x054E 1234 1234 #define PCI_DEVICE_ID_NVIDIA_NVENET_27 0x054F 1235 1235 #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP67_IDE 0x0560 1236 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP73_IDE 0x056C 1237 + #define PCI_DEVICE_ID_NVIDIA_NFORCE_MCP77_IDE 0x0759 1236 1238 1237 1239 #define PCI_VENDOR_ID_IMS 0x10e0 1238 1240 #define PCI_DEVICE_ID_IMS_TT128 0x9128