aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:45:38 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:45:38 -0500
commite49aedb594dc9cd4add2f0fd7360952c11017532 (patch)
treed29262a962727020206abd9b4cba70c47041476a
parent4ef58d4e2ad1fa2a3e5bbf41af2284671fca8cf8 (diff)
parent4e5b932c829e9a6bf32ec80c6e1ce60121eef124 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-next-2.6: sl82c105: remove no longer needed debugging code sis5513: remove stale TODO pdc202xx_old: remove no longer needed debugging code cy82c693: remove no longer needed debugging code cmd64x: remove no longer needed debugging code alim15x3: remove obsolete and dangerous wdc_udma parameter ide: Increase WAIT_DRQ to accomodate some CF cards and SSD drives. cs5535: add pci id for AMD based CS5535 controllers slc90e66: fix UDMA handling drivers/ide/tx4938ide.c: use resource_size() drivers/ide/ide_platform.c: use resource_size() drivers/ide/au1xxx-ide.c: use resource_size() hpt366: remove dead old timing tables ide: update Kconfig text to mark as deprecated ide-tape: remove the BKL hpt366: kill unused #define's
-rw-r--r--drivers/ide/Kconfig45
-rw-r--r--drivers/ide/alim15x3.c12
-rw-r--r--drivers/ide/au1xxx-ide.c7
-rw-r--r--drivers/ide/cmd64x.c17
-rw-r--r--drivers/ide/cs5535.c1
-rw-r--r--drivers/ide/cy82c693.c27
-rw-r--r--drivers/ide/hpt366.c65
-rw-r--r--drivers/ide/ide-tape.c21
-rw-r--r--drivers/ide/ide_platform.c8
-rw-r--r--drivers/ide/pdc202xx_old.c15
-rw-r--r--drivers/ide/sis5513.c9
-rw-r--r--drivers/ide/sl82c105.c24
-rw-r--r--drivers/ide/slc90e66.c3
-rw-r--r--drivers/ide/tx4938ide.c2
-rw-r--r--include/linux/ide.h4
15 files changed, 39 insertions, 221 deletions
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index 9a5d0aaac9d0..98ccfeb3f5aa 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -7,50 +7,25 @@ config HAVE_IDE
7 bool 7 bool
8 8
9menuconfig IDE 9menuconfig IDE
10 tristate "ATA/ATAPI/MFM/RLL support" 10 tristate "ATA/ATAPI/MFM/RLL support (DEPRECATED)"
11 depends on HAVE_IDE 11 depends on HAVE_IDE
12 depends on BLOCK 12 depends on BLOCK
13 ---help--- 13 ---help---
14 If you say Y here, your kernel will be able to manage low cost mass 14 If you say Y here, your kernel will be able to manage ATA/(E)IDE and
15 storage units such as ATA/(E)IDE and ATAPI units. The most common 15 ATAPI units. The most common cases are IDE hard drives and ATAPI
16 cases are IDE hard drives and ATAPI CD-ROM drives. 16 CD-ROM drives.
17 17
18 If your system is pure SCSI and doesn't use these interfaces, you 18 This subsystem is currently in maintenance mode with only bug fix
19 can say N here. 19 changes applied. Users of ATA hardware are encouraged to migrate to
20 20 the newer ATA subsystem ("Serial ATA (prod) and Parallel ATA
21 Integrated Disk Electronics (IDE aka ATA-1) is a connecting standard 21 (experimental) drivers") which is more actively maintained.
22 for mass storage units such as hard disks. It was designed by
23 Western Digital and Compaq Computer in 1984. It was then named
24 ST506. Quite a number of disks use the IDE interface.
25
26 AT Attachment (ATA) is the superset of the IDE specifications.
27 ST506 was also called ATA-1.
28
29 Fast-IDE is ATA-2 (also named Fast ATA), Enhanced IDE (EIDE) is
30 ATA-3. It provides support for larger disks (up to 8.4GB by means of
31 the LBA standard), more disks (4 instead of 2) and for other mass
32 storage units such as tapes and cdrom. UDMA/33 (aka UltraDMA/33) is
33 ATA-4 and provides faster (and more CPU friendly) transfer modes
34 than previous PIO (Programmed processor Input/Output) from previous
35 ATA/IDE standards by means of fast DMA controllers.
36
37 ATA Packet Interface (ATAPI) is a protocol used by EIDE tape and
38 CD-ROM drives, similar in many respects to the SCSI protocol.
39
40 SMART IDE (Self Monitoring, Analysis and Reporting Technology) was
41 designed in order to prevent data corruption and disk crash by
42 detecting pre hardware failure conditions (heat, access time, and
43 the like...). Disks built since June 1995 may follow this standard.
44 The kernel itself doesn't manage this; however there are quite a
45 number of user programs such as smart that can query the status of
46 SMART parameters from disk drives.
47 22
48 To compile this driver as a module, choose M here: the 23 To compile this driver as a module, choose M here: the
49 module will be called ide-core. 24 module will be called ide-core.
50 25
51 For further information, please read <file:Documentation/ide/ide.txt>. 26 For further information, please read <file:Documentation/ide/ide.txt>.
52 27
53 If unsure, say Y. 28 If unsure, say N.
54 29
55if IDE 30if IDE
56 31
diff --git a/drivers/ide/alim15x3.c b/drivers/ide/alim15x3.c
index e59b6dee9ae2..0abc43f3101e 100644
--- a/drivers/ide/alim15x3.c
+++ b/drivers/ide/alim15x3.c
@@ -40,16 +40,6 @@
40#define DRV_NAME "alim15x3" 40#define DRV_NAME "alim15x3"
41 41
42/* 42/*
43 * Allow UDMA on M1543C-E chipset for WDC disks that ignore CRC checking
44 * (this is DANGEROUS and could result in data corruption).
45 */
46static int wdc_udma;
47
48module_param(wdc_udma, bool, 0);
49MODULE_PARM_DESC(wdc_udma,
50 "allow UDMA on M1543C-E chipset for WDC disks (DANGEROUS)");
51
52/*
53 * ALi devices are not plug in. Otherwise these static values would 43 * ALi devices are not plug in. Otherwise these static values would
54 * need to go. They ought to go away anyway 44 * need to go. They ought to go away anyway
55 */ 45 */
@@ -132,7 +122,7 @@ static u8 ali_udma_filter(ide_drive_t *drive)
132 if (m5229_revision > 0x20 && m5229_revision < 0xC2) { 122 if (m5229_revision > 0x20 && m5229_revision < 0xC2) {
133 if (drive->media != ide_disk) 123 if (drive->media != ide_disk)
134 return 0; 124 return 0;
135 if (wdc_udma == 0 && chip_is_1543c_e && 125 if (chip_is_1543c_e &&
136 strstr((char *)&drive->id[ATA_ID_PROD], "WDC ")) 126 strstr((char *)&drive->id[ATA_ID_PROD], "WDC "))
137 return 0; 127 return 0;
138 } 128 }
diff --git a/drivers/ide/au1xxx-ide.c b/drivers/ide/au1xxx-ide.c
index 58121bd6c115..87cef0c440ad 100644
--- a/drivers/ide/au1xxx-ide.c
+++ b/drivers/ide/au1xxx-ide.c
@@ -532,14 +532,13 @@ static int au_ide_probe(struct platform_device *dev)
532 goto out; 532 goto out;
533 } 533 }
534 534
535 if (!request_mem_region(res->start, res->end - res->start + 1, 535 if (!request_mem_region(res->start, resource_size(res), dev->name)) {
536 dev->name)) {
537 pr_debug("%s: request_mem_region failed\n", DRV_NAME); 536 pr_debug("%s: request_mem_region failed\n", DRV_NAME);
538 ret = -EBUSY; 537 ret = -EBUSY;
539 goto out; 538 goto out;
540 } 539 }
541 540
542 ahwif->regbase = (u32)ioremap(res->start, res->end - res->start + 1); 541 ahwif->regbase = (u32)ioremap(res->start, resource_size(res));
543 if (ahwif->regbase == 0) { 542 if (ahwif->regbase == 0) {
544 ret = -ENOMEM; 543 ret = -ENOMEM;
545 goto out; 544 goto out;
@@ -575,7 +574,7 @@ static int au_ide_remove(struct platform_device *dev)
575 iounmap((void *)ahwif->regbase); 574 iounmap((void *)ahwif->regbase);
576 575
577 res = platform_get_resource(dev, IORESOURCE_MEM, 0); 576 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
578 release_mem_region(res->start, res->end - res->start + 1); 577 release_mem_region(res->start, resource_size(res));
579 578
580 return 0; 579 return 0;
581} 580}
diff --git a/drivers/ide/cmd64x.c b/drivers/ide/cmd64x.c
index ca0c46f6580a..f2500c8826bb 100644
--- a/drivers/ide/cmd64x.c
+++ b/drivers/ide/cmd64x.c
@@ -20,14 +20,6 @@
20 20
21#define DRV_NAME "cmd64x" 21#define DRV_NAME "cmd64x"
22 22
23#define CMD_DEBUG 0
24
25#if CMD_DEBUG
26#define cmdprintk(x...) printk(x)
27#else
28#define cmdprintk(x...)
29#endif
30
31/* 23/*
32 * CMD64x specific registers definition. 24 * CMD64x specific registers definition.
33 */ 25 */
@@ -76,9 +68,6 @@ static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_
76 {15, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0}; 68 {15, 15, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 0};
77 static const u8 drwtim_regs[4] = {DRWTIM0, DRWTIM1, DRWTIM2, DRWTIM3}; 69 static const u8 drwtim_regs[4] = {DRWTIM0, DRWTIM1, DRWTIM2, DRWTIM3};
78 70
79 cmdprintk("program_cycle_times parameters: total=%d, active=%d\n",
80 cycle_time, active_time);
81
82 cycle_count = quantize_timing( cycle_time, clock_time); 71 cycle_count = quantize_timing( cycle_time, clock_time);
83 active_count = quantize_timing(active_time, clock_time); 72 active_count = quantize_timing(active_time, clock_time);
84 recovery_count = cycle_count - active_count; 73 recovery_count = cycle_count - active_count;
@@ -94,9 +83,6 @@ static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_
94 if (active_count > 16) /* shouldn't actually happen... */ 83 if (active_count > 16) /* shouldn't actually happen... */
95 active_count = 16; 84 active_count = 16;
96 85
97 cmdprintk("Final counts: total=%d, active=%d, recovery=%d\n",
98 cycle_count, active_count, recovery_count);
99
100 /* 86 /*
101 * Convert values to internal chipset representation 87 * Convert values to internal chipset representation
102 */ 88 */
@@ -106,7 +92,6 @@ static void program_cycle_times (ide_drive_t *drive, int cycle_time, int active_
106 /* Program the active/recovery counts into the DRWTIM register */ 92 /* Program the active/recovery counts into the DRWTIM register */
107 drwtim = (active_count << 4) | recovery_count; 93 drwtim = (active_count << 4) | recovery_count;
108 (void) pci_write_config_byte(dev, drwtim_regs[drive->dn], drwtim); 94 (void) pci_write_config_byte(dev, drwtim_regs[drive->dn], drwtim);
109 cmdprintk("Write 0x%02x to reg 0x%x\n", drwtim, drwtim_regs[drive->dn]);
110} 95}
111 96
112/* 97/*
@@ -150,7 +135,6 @@ static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio)
150 135
151 if (setup_count > 5) /* shouldn't actually happen... */ 136 if (setup_count > 5) /* shouldn't actually happen... */
152 setup_count = 5; 137 setup_count = 5;
153 cmdprintk("Final address setup count: %d\n", setup_count);
154 138
155 /* 139 /*
156 * Program the address setup clocks into the ARTTIM registers. 140 * Program the address setup clocks into the ARTTIM registers.
@@ -162,7 +146,6 @@ static void cmd64x_tune_pio(ide_drive_t *drive, const u8 pio)
162 arttim &= ~0xc0; 146 arttim &= ~0xc0;
163 arttim |= setup_values[setup_count]; 147 arttim |= setup_values[setup_count];
164 (void) pci_write_config_byte(dev, arttim_regs[drive->dn], arttim); 148 (void) pci_write_config_byte(dev, arttim_regs[drive->dn], arttim);
165 cmdprintk("Write 0x%02x to reg 0x%x\n", arttim, arttim_regs[drive->dn]);
166} 149}
167 150
168/* 151/*
diff --git a/drivers/ide/cs5535.c b/drivers/ide/cs5535.c
index 983d957a0189..b883838adc24 100644
--- a/drivers/ide/cs5535.c
+++ b/drivers/ide/cs5535.c
@@ -187,6 +187,7 @@ static int __devinit cs5535_init_one(struct pci_dev *dev,
187 187
188static const struct pci_device_id cs5535_pci_tbl[] = { 188static const struct pci_device_id cs5535_pci_tbl[] = {
189 { PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_CS5535_IDE), 0 }, 189 { PCI_VDEVICE(NS, PCI_DEVICE_ID_NS_CS5535_IDE), 0 },
190 { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_CS5535_IDE), },
190 { 0, }, 191 { 0, },
191}; 192};
192 193
diff --git a/drivers/ide/cy82c693.c b/drivers/ide/cy82c693.c
index 74fc5401f407..d6e2cbbc53a0 100644
--- a/drivers/ide/cy82c693.c
+++ b/drivers/ide/cy82c693.c
@@ -51,11 +51,6 @@
51#define DRV_NAME "cy82c693" 51#define DRV_NAME "cy82c693"
52 52
53/* 53/*
54 * The following are used to debug the driver.
55 */
56#define CY82C693_DEBUG_INFO 0
57
58/*
59 * NOTE: the value for busmaster timeout is tricky and I got it by 54 * NOTE: the value for busmaster timeout is tricky and I got it by
60 * trial and error! By using a to low value will cause DMA timeouts 55 * trial and error! By using a to low value will cause DMA timeouts
61 * and drop IDE performance, and by using a to high value will cause 56 * and drop IDE performance, and by using a to high value will cause
@@ -176,11 +171,6 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
176 outb(index, CY82_INDEX_PORT); 171 outb(index, CY82_INDEX_PORT);
177 outb(data, CY82_DATA_PORT); 172 outb(data, CY82_DATA_PORT);
178 173
179#if CY82C693_DEBUG_INFO
180 printk(KERN_INFO "%s (ch=%d, dev=%d): set DMA mode to %d (single=%d)\n",
181 drive->name, hwif->channel, drive->dn & 1, mode & 3, single);
182#endif /* CY82C693_DEBUG_INFO */
183
184 /* 174 /*
185 * note: below we set the value for Bus Master IDE TimeOut Register 175 * note: below we set the value for Bus Master IDE TimeOut Register
186 * I'm not absolutly sure what this does, but it solved my problem 176 * I'm not absolutly sure what this does, but it solved my problem
@@ -194,11 +184,6 @@ static void cy82c693_set_dma_mode(ide_drive_t *drive, const u8 mode)
194 data = BUSMASTER_TIMEOUT; 184 data = BUSMASTER_TIMEOUT;
195 outb(CY82_INDEX_TIMEOUT, CY82_INDEX_PORT); 185 outb(CY82_INDEX_TIMEOUT, CY82_INDEX_PORT);
196 outb(data, CY82_DATA_PORT); 186 outb(data, CY82_DATA_PORT);
197
198#if CY82C693_DEBUG_INFO
199 printk(KERN_INFO "%s: Set IDE Bus Master TimeOut Register to 0x%X\n",
200 drive->name, data);
201#endif /* CY82C693_DEBUG_INFO */
202} 187}
203 188
204static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio) 189static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
@@ -239,8 +224,6 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
239 pci_write_config_byte(dev, CY82_IDE_MASTER_IOR, pclk.time_16r); 224 pci_write_config_byte(dev, CY82_IDE_MASTER_IOR, pclk.time_16r);
240 pci_write_config_byte(dev, CY82_IDE_MASTER_IOW, pclk.time_16w); 225 pci_write_config_byte(dev, CY82_IDE_MASTER_IOW, pclk.time_16w);
241 pci_write_config_byte(dev, CY82_IDE_MASTER_8BIT, pclk.time_8); 226 pci_write_config_byte(dev, CY82_IDE_MASTER_8BIT, pclk.time_8);
242
243 addrCtrl &= 0xF;
244 } else { 227 } else {
245 /* 228 /*
246 * set slave drive 229 * set slave drive
@@ -257,17 +240,7 @@ static void cy82c693_set_pio_mode(ide_drive_t *drive, const u8 pio)
257 pci_write_config_byte(dev, CY82_IDE_SLAVE_IOR, pclk.time_16r); 240 pci_write_config_byte(dev, CY82_IDE_SLAVE_IOR, pclk.time_16r);
258 pci_write_config_byte(dev, CY82_IDE_SLAVE_IOW, pclk.time_16w); 241 pci_write_config_byte(dev, CY82_IDE_SLAVE_IOW, pclk.time_16w);
259 pci_write_config_byte(dev, CY82_IDE_SLAVE_8BIT, pclk.time_8); 242 pci_write_config_byte(dev, CY82_IDE_SLAVE_8BIT, pclk.time_8);
260
261 addrCtrl >>= 4;
262 addrCtrl &= 0xF;
263 } 243 }
264
265#if CY82C693_DEBUG_INFO
266 printk(KERN_INFO "%s (ch=%d, dev=%d): set PIO timing to "
267 "(addr=0x%X, ior=0x%X, iow=0x%X, 8bit=0x%X)\n",
268 drive->name, hwif->channel, drive->dn & 1,
269 addrCtrl, pclk.time_16r, pclk.time_16w, pclk.time_8);
270#endif /* CY82C693_DEBUG_INFO */
271} 244}
272 245
273static void __devinit init_iops_cy82c693(ide_hwif_t *hwif) 246static void __devinit init_iops_cy82c693(ide_hwif_t *hwif)
diff --git a/drivers/ide/hpt366.c b/drivers/ide/hpt366.c
index 7ce68ef6b904..4d90ac2dbb1b 100644
--- a/drivers/ide/hpt366.c
+++ b/drivers/ide/hpt366.c
@@ -297,68 +297,6 @@ static u32 twenty_five_base_hpt36x[] = {
297 /* XFER_PIO_0 */ 0xc0d08585 297 /* XFER_PIO_0 */ 0xc0d08585
298}; 298};
299 299
300#if 0
301/* These are the timing tables from the HighPoint open source drivers... */
302static u32 thirty_three_base_hpt37x[] = {
303 /* XFER_UDMA_6 */ 0x12446231, /* 0x12646231 ?? */
304 /* XFER_UDMA_5 */ 0x12446231,
305 /* XFER_UDMA_4 */ 0x12446231,
306 /* XFER_UDMA_3 */ 0x126c6231,
307 /* XFER_UDMA_2 */ 0x12486231,
308 /* XFER_UDMA_1 */ 0x124c6233,
309 /* XFER_UDMA_0 */ 0x12506297,
310
311 /* XFER_MW_DMA_2 */ 0x22406c31,
312 /* XFER_MW_DMA_1 */ 0x22406c33,
313 /* XFER_MW_DMA_0 */ 0x22406c97,
314
315 /* XFER_PIO_4 */ 0x06414e31,
316 /* XFER_PIO_3 */ 0x06414e42,
317 /* XFER_PIO_2 */ 0x06414e53,
318 /* XFER_PIO_1 */ 0x06814e93,
319 /* XFER_PIO_0 */ 0x06814ea7
320};
321
322static u32 fifty_base_hpt37x[] = {
323 /* XFER_UDMA_6 */ 0x12848242,
324 /* XFER_UDMA_5 */ 0x12848242,
325 /* XFER_UDMA_4 */ 0x12ac8242,
326 /* XFER_UDMA_3 */ 0x128c8242,
327 /* XFER_UDMA_2 */ 0x120c8242,
328 /* XFER_UDMA_1 */ 0x12148254,
329 /* XFER_UDMA_0 */ 0x121882ea,
330
331 /* XFER_MW_DMA_2 */ 0x22808242,
332 /* XFER_MW_DMA_1 */ 0x22808254,
333 /* XFER_MW_DMA_0 */ 0x228082ea,
334
335 /* XFER_PIO_4 */ 0x0a81f442,
336 /* XFER_PIO_3 */ 0x0a81f443,
337 /* XFER_PIO_2 */ 0x0a81f454,
338 /* XFER_PIO_1 */ 0x0ac1f465,
339 /* XFER_PIO_0 */ 0x0ac1f48a
340};
341
342static u32 sixty_six_base_hpt37x[] = {
343 /* XFER_UDMA_6 */ 0x1c869c62,
344 /* XFER_UDMA_5 */ 0x1cae9c62, /* 0x1c8a9c62 */
345 /* XFER_UDMA_4 */ 0x1c8a9c62,
346 /* XFER_UDMA_3 */ 0x1c8e9c62,
347 /* XFER_UDMA_2 */ 0x1c929c62,
348 /* XFER_UDMA_1 */ 0x1c9a9c62,
349 /* XFER_UDMA_0 */ 0x1c829c62,
350
351 /* XFER_MW_DMA_2 */ 0x2c829c62,
352 /* XFER_MW_DMA_1 */ 0x2c829c66,
353 /* XFER_MW_DMA_0 */ 0x2c829d2e,
354
355 /* XFER_PIO_4 */ 0x0c829c62,
356 /* XFER_PIO_3 */ 0x0c829c84,
357 /* XFER_PIO_2 */ 0x0c829ca6,
358 /* XFER_PIO_1 */ 0x0d029d26,
359 /* XFER_PIO_0 */ 0x0d029d5e
360};
361#else
362/* 300/*
363 * The following are the new timing tables with PIO mode data/taskfile transfer 301 * The following are the new timing tables with PIO mode data/taskfile transfer
364 * overclocking fixed... 302 * overclocking fixed...
@@ -424,16 +362,13 @@ static u32 sixty_six_base_hpt37x[] = {
424 /* XFER_PIO_1 */ 0x0d02ff26, 362 /* XFER_PIO_1 */ 0x0d02ff26,
425 /* XFER_PIO_0 */ 0x0d42ff7f 363 /* XFER_PIO_0 */ 0x0d42ff7f
426}; 364};
427#endif
428 365
429#define HPT366_DEBUG_DRIVE_INFO 0
430#define HPT371_ALLOW_ATA133_6 1 366#define HPT371_ALLOW_ATA133_6 1
431#define HPT302_ALLOW_ATA133_6 1 367#define HPT302_ALLOW_ATA133_6 1
432#define HPT372_ALLOW_ATA133_6 1 368#define HPT372_ALLOW_ATA133_6 1
433#define HPT370_ALLOW_ATA100_5 0 369#define HPT370_ALLOW_ATA100_5 0
434#define HPT366_ALLOW_ATA66_4 1 370#define HPT366_ALLOW_ATA66_4 1
435#define HPT366_ALLOW_ATA66_3 1 371#define HPT366_ALLOW_ATA66_3 1
436#define HPT366_MAX_DEVS 8
437 372
438/* Supported ATA clock frequencies */ 373/* Supported ATA clock frequencies */
439enum ata_clock { 374enum ata_clock {
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 58fc920d5c32..6a0e62542167 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -221,6 +221,8 @@ typedef struct ide_tape_obj {
221 221
222static DEFINE_MUTEX(idetape_ref_mutex); 222static DEFINE_MUTEX(idetape_ref_mutex);
223 223
224static DEFINE_MUTEX(idetape_chrdev_mutex);
225
224static struct class *idetape_sysfs_class; 226static struct class *idetape_sysfs_class;
225 227
226static void ide_tape_release(struct device *); 228static void ide_tape_release(struct device *);
@@ -1457,10 +1459,11 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
1457 if (i >= MAX_HWIFS * MAX_DRIVES) 1459 if (i >= MAX_HWIFS * MAX_DRIVES)
1458 return -ENXIO; 1460 return -ENXIO;
1459 1461
1460 lock_kernel(); 1462 mutex_lock(&idetape_chrdev_mutex);
1463
1461 tape = ide_tape_get(NULL, true, i); 1464 tape = ide_tape_get(NULL, true, i);
1462 if (!tape) { 1465 if (!tape) {
1463 unlock_kernel(); 1466 mutex_unlock(&idetape_chrdev_mutex);
1464 return -ENXIO; 1467 return -ENXIO;
1465 } 1468 }
1466 1469
@@ -1519,12 +1522,15 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
1519 tape->door_locked = DOOR_LOCKED; 1522 tape->door_locked = DOOR_LOCKED;
1520 } 1523 }
1521 } 1524 }
1522 unlock_kernel(); 1525 mutex_unlock(&idetape_chrdev_mutex);
1526
1523 return 0; 1527 return 0;
1524 1528
1525out_put_tape: 1529out_put_tape:
1526 ide_tape_put(tape); 1530 ide_tape_put(tape);
1527 unlock_kernel(); 1531
1532 mutex_unlock(&idetape_chrdev_mutex);
1533
1528 return retval; 1534 return retval;
1529} 1535}
1530 1536
@@ -1551,7 +1557,8 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
1551 ide_drive_t *drive = tape->drive; 1557 ide_drive_t *drive = tape->drive;
1552 unsigned int minor = iminor(inode); 1558 unsigned int minor = iminor(inode);
1553 1559
1554 lock_kernel(); 1560 mutex_lock(&idetape_chrdev_mutex);
1561
1555 tape = drive->driver_data; 1562 tape = drive->driver_data;
1556 1563
1557 ide_debug_log(IDE_DBG_FUNC, "enter"); 1564 ide_debug_log(IDE_DBG_FUNC, "enter");
@@ -1575,7 +1582,9 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
1575 } 1582 }
1576 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags); 1583 clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags);
1577 ide_tape_put(tape); 1584 ide_tape_put(tape);
1578 unlock_kernel(); 1585
1586 mutex_unlock(&idetape_chrdev_mutex);
1587
1579 return 0; 1588 return 0;
1580} 1589}
1581 1590
diff --git a/drivers/ide/ide_platform.c b/drivers/ide/ide_platform.c
index b579fbe88370..42965b3e30b9 100644
--- a/drivers/ide/ide_platform.c
+++ b/drivers/ide/ide_platform.c
@@ -81,14 +81,14 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
81 81
82 if (mmio) { 82 if (mmio) {
83 base = devm_ioremap(&pdev->dev, 83 base = devm_ioremap(&pdev->dev,
84 res_base->start, res_base->end - res_base->start + 1); 84 res_base->start, resource_size(res_base));
85 alt_base = devm_ioremap(&pdev->dev, 85 alt_base = devm_ioremap(&pdev->dev,
86 res_alt->start, res_alt->end - res_alt->start + 1); 86 res_alt->start, resource_size(res_alt));
87 } else { 87 } else {
88 base = devm_ioport_map(&pdev->dev, 88 base = devm_ioport_map(&pdev->dev,
89 res_base->start, res_base->end - res_base->start + 1); 89 res_base->start, resource_size(res_base));
90 alt_base = devm_ioport_map(&pdev->dev, 90 alt_base = devm_ioport_map(&pdev->dev,
91 res_alt->start, res_alt->end - res_alt->start + 1); 91 res_alt->start, resource_size(res_alt));
92 } 92 }
93 93
94 memset(&hw, 0, sizeof(hw)); 94 memset(&hw, 0, sizeof(hw));
diff --git a/drivers/ide/pdc202xx_old.c b/drivers/ide/pdc202xx_old.c
index cb812f3700e8..35161dd840a0 100644
--- a/drivers/ide/pdc202xx_old.c
+++ b/drivers/ide/pdc202xx_old.c
@@ -21,8 +21,6 @@
21 21
22#define DRV_NAME "pdc202xx_old" 22#define DRV_NAME "pdc202xx_old"
23 23
24#define PDC202XX_DEBUG_DRIVE_INFO 0
25
26static void pdc_old_disable_66MHz_clock(ide_hwif_t *); 24static void pdc_old_disable_66MHz_clock(ide_hwif_t *);
27 25
28static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed) 26static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed)
@@ -34,11 +32,6 @@ static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed)
34 u8 AP = 0, BP = 0, CP = 0; 32 u8 AP = 0, BP = 0, CP = 0;
35 u8 TA = 0, TB = 0, TC = 0; 33 u8 TA = 0, TB = 0, TC = 0;
36 34
37#if PDC202XX_DEBUG_DRIVE_INFO
38 u32 drive_conf = 0;
39 pci_read_config_dword(dev, drive_pci, &drive_conf);
40#endif
41
42 /* 35 /*
43 * TODO: do this once per channel 36 * TODO: do this once per channel
44 */ 37 */
@@ -89,14 +82,6 @@ static void pdc202xx_set_mode(ide_drive_t *drive, const u8 speed)
89 pci_write_config_byte(dev, drive_pci + 1, BP | TB); 82 pci_write_config_byte(dev, drive_pci + 1, BP | TB);
90 pci_write_config_byte(dev, drive_pci + 2, CP | TC); 83 pci_write_config_byte(dev, drive_pci + 2, CP | TC);
91 } 84 }
92
93#if PDC202XX_DEBUG_DRIVE_INFO
94 printk(KERN_DEBUG "%s: %s drive%d 0x%08x ",
95 drive->name, ide_xfer_verbose(speed),
96 drive->dn, drive_conf);
97 pci_read_config_dword(dev, drive_pci, &drive_conf);
98 printk("0x%08x\n", drive_conf);
99#endif
100} 85}
101 86
102static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio) 87static void pdc202xx_set_pio_mode(ide_drive_t *drive, const u8 pio)
diff --git a/drivers/ide/sis5513.c b/drivers/ide/sis5513.c
index 3b88eba04c9c..468706082fb5 100644
--- a/drivers/ide/sis5513.c
+++ b/drivers/ide/sis5513.c
@@ -632,12 +632,3 @@ module_exit(sis5513_ide_exit);
632MODULE_AUTHOR("Lionel Bouton, L C Chang, Andre Hedrick, Vojtech Pavlik"); 632MODULE_AUTHOR("Lionel Bouton, L C Chang, Andre Hedrick, Vojtech Pavlik");
633MODULE_DESCRIPTION("PCI driver module for SIS IDE"); 633MODULE_DESCRIPTION("PCI driver module for SIS IDE");
634MODULE_LICENSE("GPL"); 634MODULE_LICENSE("GPL");
635
636/*
637 * TODO:
638 * - CLEANUP
639 * - More checks in the config registers (force values instead of
640 * relying on the BIOS setting them correctly).
641 * - Further optimisations ?
642 * . for example ATA66+ regs 0x48 & 0x4A
643 */
diff --git a/drivers/ide/sl82c105.c b/drivers/ide/sl82c105.c
index d698da470d6f..3c2bbf0057ea 100644
--- a/drivers/ide/sl82c105.c
+++ b/drivers/ide/sl82c105.c
@@ -24,13 +24,6 @@
24 24
25#define DRV_NAME "sl82c105" 25#define DRV_NAME "sl82c105"
26 26
27#undef DEBUG
28
29#ifdef DEBUG
30#define DBG(arg) printk arg
31#else
32#define DBG(fmt,...)
33#endif
34/* 27/*
35 * SL82C105 PCI config register 0x40 bits. 28 * SL82C105 PCI config register 0x40 bits.
36 */ 29 */
@@ -104,9 +97,6 @@ static void sl82c105_set_dma_mode(ide_drive_t *drive, const u8 speed)
104 unsigned long timings = (unsigned long)ide_get_drivedata(drive); 97 unsigned long timings = (unsigned long)ide_get_drivedata(drive);
105 u16 drv_ctrl; 98 u16 drv_ctrl;
106 99
107 DBG(("sl82c105_tune_chipset(drive:%s, speed:%s)\n",
108 drive->name, ide_xfer_verbose(speed)));
109
110 drv_ctrl = mwdma_timings[speed - XFER_MW_DMA_0]; 100 drv_ctrl = mwdma_timings[speed - XFER_MW_DMA_0];
111 101
112 /* 102 /*
@@ -196,8 +186,6 @@ static void sl82c105_dma_start(ide_drive_t *drive)
196 struct pci_dev *dev = to_pci_dev(hwif->dev); 186 struct pci_dev *dev = to_pci_dev(hwif->dev);
197 int reg = 0x44 + drive->dn * 4; 187 int reg = 0x44 + drive->dn * 4;
198 188
199 DBG(("%s(drive:%s)\n", __func__, drive->name));
200
201 pci_write_config_word(dev, reg, 189 pci_write_config_word(dev, reg,
202 (unsigned long)ide_get_drivedata(drive) >> 16); 190 (unsigned long)ide_get_drivedata(drive) >> 16);
203 191
@@ -209,8 +197,6 @@ static void sl82c105_dma_clear(ide_drive_t *drive)
209{ 197{
210 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 198 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
211 199
212 DBG(("sl82c105_dma_clear(drive:%s)\n", drive->name));
213
214 sl82c105_reset_host(dev); 200 sl82c105_reset_host(dev);
215} 201}
216 202
@@ -218,11 +204,7 @@ static int sl82c105_dma_end(ide_drive_t *drive)
218{ 204{
219 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 205 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
220 int reg = 0x44 + drive->dn * 4; 206 int reg = 0x44 + drive->dn * 4;
221 int ret; 207 int ret = ide_dma_end(drive);
222
223 DBG(("%s(drive:%s)\n", __func__, drive->name));
224
225 ret = ide_dma_end(drive);
226 208
227 pci_write_config_word(dev, reg, 209 pci_write_config_word(dev, reg,
228 (unsigned long)ide_get_drivedata(drive)); 210 (unsigned long)ide_get_drivedata(drive));
@@ -239,8 +221,6 @@ static void sl82c105_resetproc(ide_drive_t *drive)
239 struct pci_dev *dev = to_pci_dev(drive->hwif->dev); 221 struct pci_dev *dev = to_pci_dev(drive->hwif->dev);
240 u32 val; 222 u32 val;
241 223
242 DBG(("sl82c105_resetproc(drive:%s)\n", drive->name));
243
244 pci_read_config_dword(dev, 0x40, &val); 224 pci_read_config_dword(dev, 0x40, &val);
245 val |= (CTRL_P1F16 | CTRL_P0F16); 225 val |= (CTRL_P1F16 | CTRL_P0F16);
246 pci_write_config_dword(dev, 0x40, val); 226 pci_write_config_dword(dev, 0x40, val);
@@ -291,8 +271,6 @@ static int init_chipset_sl82c105(struct pci_dev *dev)
291{ 271{
292 u32 val; 272 u32 val;
293 273
294 DBG(("init_chipset_sl82c105()\n"));
295
296 pci_read_config_dword(dev, 0x40, &val); 274 pci_read_config_dword(dev, 0x40, &val);
297 val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16; 275 val |= CTRL_P0EN | CTRL_P0F16 | CTRL_P1F16;
298 pci_write_config_dword(dev, 0x40, val); 276 pci_write_config_dword(dev, 0x40, val);
diff --git a/drivers/ide/slc90e66.c b/drivers/ide/slc90e66.c
index 9aec78d3bcff..1ccfb40e7215 100644
--- a/drivers/ide/slc90e66.c
+++ b/drivers/ide/slc90e66.c
@@ -91,8 +91,7 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
91 91
92 if (!(reg48 & u_flag)) 92 if (!(reg48 & u_flag))
93 pci_write_config_word(dev, 0x48, reg48|u_flag); 93 pci_write_config_word(dev, 0x48, reg48|u_flag);
94 /* FIXME: (reg4a & a_speed) ? */ 94 if ((reg4a & a_speed) != u_speed) {
95 if ((reg4a & u_speed) != u_speed) {
96 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); 95 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
97 pci_read_config_word(dev, 0x4a, &reg4a); 96 pci_read_config_word(dev, 0x4a, &reg4a);
98 pci_write_config_word(dev, 0x4a, reg4a|u_speed); 97 pci_write_config_word(dev, 0x4a, reg4a|u_speed);
diff --git a/drivers/ide/tx4938ide.c b/drivers/ide/tx4938ide.c
index ea89fddeed91..fd59c0d235b5 100644
--- a/drivers/ide/tx4938ide.c
+++ b/drivers/ide/tx4938ide.c
@@ -146,7 +146,7 @@ static int __init tx4938ide_probe(struct platform_device *pdev)
146 return -ENODEV; 146 return -ENODEV;
147 147
148 if (!devm_request_mem_region(&pdev->dev, res->start, 148 if (!devm_request_mem_region(&pdev->dev, res->start,
149 res->end - res->start + 1, "tx4938ide")) 149 resource_size(res), "tx4938ide"))
150 return -EBUSY; 150 return -EBUSY;
151 mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start, 151 mapbase = (unsigned long)devm_ioremap(&pdev->dev, res->start,
152 8 << pdata->ioport_shift); 152 8 << pdata->ioport_shift);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e4135d6e0556..0ec612959042 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -125,8 +125,8 @@ struct ide_io_ports {
125 * Timeouts for various operations: 125 * Timeouts for various operations:
126 */ 126 */
127enum { 127enum {
128 /* spec allows up to 20ms */ 128 /* spec allows up to 20ms, but CF cards and SSD drives need more */
129 WAIT_DRQ = HZ / 10, /* 100ms */ 129 WAIT_DRQ = 1 * HZ, /* 1s */
130 /* some laptops are very slow */ 130 /* some laptops are very slow */
131 WAIT_READY = 5 * HZ, /* 5s */ 131 WAIT_READY = 5 * HZ, /* 5s */
132 /* should be less than 3ms (?), if all ATAPI CD is closed at boot */ 132 /* should be less than 3ms (?), if all ATAPI CD is closed at boot */