aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ide')
-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-cs.c33
-rw-r--r--drivers/ide/ide-pci-generic.c3
-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/pmac.c92
-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
17 files changed, 107 insertions, 277 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-cs.c b/drivers/ide/ide-cs.c
index 063b933d864a..dd6396384c25 100644
--- a/drivers/ide/ide-cs.c
+++ b/drivers/ide/ide-cs.c
@@ -60,15 +60,6 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
60MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); 60MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver");
61MODULE_LICENSE("Dual MPL/GPL"); 61MODULE_LICENSE("Dual MPL/GPL");
62 62
63#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0)
64
65#ifdef CONFIG_PCMCIA_DEBUG
66INT_MODULE_PARM(pc_debug, 0);
67#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
68#else
69#define DEBUG(n, args...)
70#endif
71
72/*====================================================================*/ 63/*====================================================================*/
73 64
74typedef struct ide_info_t { 65typedef struct ide_info_t {
@@ -98,7 +89,7 @@ static int ide_probe(struct pcmcia_device *link)
98{ 89{
99 ide_info_t *info; 90 ide_info_t *info;
100 91
101 DEBUG(0, "ide_attach()\n"); 92 dev_dbg(&link->dev, "ide_attach()\n");
102 93
103 /* Create new ide device */ 94 /* Create new ide device */
104 info = kzalloc(sizeof(*info), GFP_KERNEL); 95 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -112,7 +103,6 @@ static int ide_probe(struct pcmcia_device *link)
112 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; 103 link->io.Attributes2 = IO_DATA_PATH_WIDTH_8;
113 link->io.IOAddrLines = 3; 104 link->io.IOAddrLines = 3;
114 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; 105 link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
115 link->irq.IRQInfo1 = IRQ_LEVEL_ID;
116 link->conf.Attributes = CONF_ENABLE_IRQ; 106 link->conf.Attributes = CONF_ENABLE_IRQ;
117 link->conf.IntType = INT_MEMORY_AND_IO; 107 link->conf.IntType = INT_MEMORY_AND_IO;
118 108
@@ -134,7 +124,7 @@ static void ide_detach(struct pcmcia_device *link)
134 ide_hwif_t *hwif = info->host->ports[0]; 124 ide_hwif_t *hwif = info->host->ports[0];
135 unsigned long data_addr, ctl_addr; 125 unsigned long data_addr, ctl_addr;
136 126
137 DEBUG(0, "ide_detach(0x%p)\n", link); 127 dev_dbg(&link->dev, "ide_detach(0x%p)\n", link);
138 128
139 data_addr = hwif->io_ports.data_addr; 129 data_addr = hwif->io_ports.data_addr;
140 ctl_addr = hwif->io_ports.ctl_addr; 130 ctl_addr = hwif->io_ports.ctl_addr;
@@ -217,9 +207,6 @@ out_release:
217 207
218======================================================================*/ 208======================================================================*/
219 209
220#define CS_CHECK(fn, ret) \
221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
222
223struct pcmcia_config_check { 210struct pcmcia_config_check {
224 unsigned long ctl_base; 211 unsigned long ctl_base;
225 int skip_vcc; 212 int skip_vcc;
@@ -282,11 +269,11 @@ static int ide_config(struct pcmcia_device *link)
282{ 269{
283 ide_info_t *info = link->priv; 270 ide_info_t *info = link->priv;
284 struct pcmcia_config_check *stk = NULL; 271 struct pcmcia_config_check *stk = NULL;
285 int last_ret = 0, last_fn = 0, is_kme = 0; 272 int ret = 0, is_kme = 0;
286 unsigned long io_base, ctl_base; 273 unsigned long io_base, ctl_base;
287 struct ide_host *host; 274 struct ide_host *host;
288 275
289 DEBUG(0, "ide_config(0x%p)\n", link); 276 dev_dbg(&link->dev, "ide_config(0x%p)\n", link);
290 277
291 is_kme = ((link->manf_id == MANFID_KME) && 278 is_kme = ((link->manf_id == MANFID_KME) &&
292 ((link->card_id == PRODID_KME_KXLC005_A) || 279 ((link->card_id == PRODID_KME_KXLC005_A) ||
@@ -306,8 +293,12 @@ static int ide_config(struct pcmcia_device *link)
306 io_base = link->io.BasePort1; 293 io_base = link->io.BasePort1;
307 ctl_base = stk->ctl_base; 294 ctl_base = stk->ctl_base;
308 295
309 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 296 ret = pcmcia_request_irq(link, &link->irq);
310 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 297 if (ret)
298 goto failed;
299 ret = pcmcia_request_configuration(link, &link->conf);
300 if (ret)
301 goto failed;
311 302
312 /* disable drive interrupts during IDE probe */ 303 /* disable drive interrupts during IDE probe */
313 outb(0x02, ctl_base); 304 outb(0x02, ctl_base);
@@ -342,8 +333,6 @@ err_mem:
342 printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); 333 printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n");
343 goto failed; 334 goto failed;
344 335
345cs_failed:
346 cs_error(link, last_fn, last_ret);
347failed: 336failed:
348 kfree(stk); 337 kfree(stk);
349 ide_release(link); 338 ide_release(link);
@@ -363,7 +352,7 @@ static void ide_release(struct pcmcia_device *link)
363 ide_info_t *info = link->priv; 352 ide_info_t *info = link->priv;
364 struct ide_host *host = info->host; 353 struct ide_host *host = info->host;
365 354
366 DEBUG(0, "ide_release(0x%p)\n", link); 355 dev_dbg(&link->dev, "ide_release(0x%p)\n", link);
367 356
368 if (info->ndev) 357 if (info->ndev)
369 /* FIXME: if this fails we need to queue the cleanup somehow 358 /* FIXME: if this fails we need to queue the cleanup somehow
diff --git a/drivers/ide/ide-pci-generic.c b/drivers/ide/ide-pci-generic.c
index 39d4e01f5c9c..a743e68a8903 100644
--- a/drivers/ide/ide-pci-generic.c
+++ b/drivers/ide/ide-pci-generic.c
@@ -162,9 +162,10 @@ static const struct pci_device_id generic_pci_tbl[] = {
162#ifdef CONFIG_BLK_DEV_IDE_SATA 162#ifdef CONFIG_BLK_DEV_IDE_SATA
163 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237_SATA), 5 }, 163 { PCI_VDEVICE(VIA, PCI_DEVICE_ID_VIA_8237_SATA), 5 },
164#endif 164#endif
165 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO), 4 },
166 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), 4 }, 165 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_1), 4 },
167 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), 4 }, 166 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_2), 4 },
167 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_3), 4 },
168 { PCI_VDEVICE(TOSHIBA, PCI_DEVICE_ID_TOSHIBA_PICCOLO_5), 4 },
168 { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), 6 }, 169 { PCI_VDEVICE(NETCELL, PCI_DEVICE_ID_REVOLUTION), 6 },
169 /* 170 /*
170 * Must come last. If you add entries adjust 171 * Must come last. If you add entries adjust
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/pmac.c b/drivers/ide/pmac.c
index 97642a7a79c4..7a4e788cab2f 100644
--- a/drivers/ide/pmac.c
+++ b/drivers/ide/pmac.c
@@ -43,10 +43,7 @@
43#include <asm/pmac_feature.h> 43#include <asm/pmac_feature.h>
44#include <asm/sections.h> 44#include <asm/sections.h>
45#include <asm/irq.h> 45#include <asm/irq.h>
46
47#ifndef CONFIG_PPC64
48#include <asm/mediabay.h> 46#include <asm/mediabay.h>
49#endif
50 47
51#define DRV_NAME "ide-pmac" 48#define DRV_NAME "ide-pmac"
52 49
@@ -59,13 +56,14 @@ typedef struct pmac_ide_hwif {
59 int irq; 56 int irq;
60 int kind; 57 int kind;
61 int aapl_bus_id; 58 int aapl_bus_id;
62 unsigned mediabay : 1;
63 unsigned broken_dma : 1; 59 unsigned broken_dma : 1;
64 unsigned broken_dma_warn : 1; 60 unsigned broken_dma_warn : 1;
65 struct device_node* node; 61 struct device_node* node;
66 struct macio_dev *mdev; 62 struct macio_dev *mdev;
67 u32 timings[4]; 63 u32 timings[4];
68 volatile u32 __iomem * *kauai_fcr; 64 volatile u32 __iomem * *kauai_fcr;
65 ide_hwif_t *hwif;
66
69 /* Those fields are duplicating what is in hwif. We currently 67 /* Those fields are duplicating what is in hwif. We currently
70 * can't use the hwif ones because of some assumptions that are 68 * can't use the hwif ones because of some assumptions that are
71 * beeing done by the generic code about the kind of dma controller 69 * beeing done by the generic code about the kind of dma controller
@@ -854,6 +852,11 @@ sanitize_timings(pmac_ide_hwif_t *pmif)
854 pmif->timings[2] = pmif->timings[3] = value2; 852 pmif->timings[2] = pmif->timings[3] = value2;
855} 853}
856 854
855static int on_media_bay(pmac_ide_hwif_t *pmif)
856{
857 return pmif->mdev && pmif->mdev->media_bay != NULL;
858}
859
857/* Suspend call back, should be called after the child devices 860/* Suspend call back, should be called after the child devices
858 * have actually been suspended 861 * have actually been suspended
859 */ 862 */
@@ -866,7 +869,7 @@ static int pmac_ide_do_suspend(pmac_ide_hwif_t *pmif)
866 disable_irq(pmif->irq); 869 disable_irq(pmif->irq);
867 870
868 /* The media bay will handle itself just fine */ 871 /* The media bay will handle itself just fine */
869 if (pmif->mediabay) 872 if (on_media_bay(pmif))
870 return 0; 873 return 0;
871 874
872 /* Kauai has bus control FCRs directly here */ 875 /* Kauai has bus control FCRs directly here */
@@ -889,7 +892,7 @@ static int pmac_ide_do_suspend(pmac_ide_hwif_t *pmif)
889static int pmac_ide_do_resume(pmac_ide_hwif_t *pmif) 892static int pmac_ide_do_resume(pmac_ide_hwif_t *pmif)
890{ 893{
891 /* Hard reset & re-enable controller (do we really need to reset ? -BenH) */ 894 /* Hard reset & re-enable controller (do we really need to reset ? -BenH) */
892 if (!pmif->mediabay) { 895 if (!on_media_bay(pmif)) {
893 ppc_md.feature_call(PMAC_FTR_IDE_RESET, pmif->node, pmif->aapl_bus_id, 1); 896 ppc_md.feature_call(PMAC_FTR_IDE_RESET, pmif->node, pmif->aapl_bus_id, 1);
894 ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, pmif->node, pmif->aapl_bus_id, 1); 897 ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, pmif->node, pmif->aapl_bus_id, 1);
895 msleep(10); 898 msleep(10);
@@ -950,13 +953,11 @@ static void pmac_ide_init_dev(ide_drive_t *drive)
950 pmac_ide_hwif_t *pmif = 953 pmac_ide_hwif_t *pmif =
951 (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent); 954 (pmac_ide_hwif_t *)dev_get_drvdata(hwif->gendev.parent);
952 955
953 if (pmif->mediabay) { 956 if (on_media_bay(pmif)) {
954#ifdef CONFIG_PMAC_MEDIABAY 957 if (check_media_bay(pmif->mdev->media_bay) == MB_CD) {
955 if (check_media_bay_by_base(pmif->regbase, MB_CD) == 0) {
956 drive->dev_flags &= ~IDE_DFLAG_NOPROBE; 958 drive->dev_flags &= ~IDE_DFLAG_NOPROBE;
957 return; 959 return;
958 } 960 }
959#endif
960 drive->dev_flags |= IDE_DFLAG_NOPROBE; 961 drive->dev_flags |= IDE_DFLAG_NOPROBE;
961 } 962 }
962} 963}
@@ -1072,26 +1073,23 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif,
1072 writel(KAUAI_FCR_UATA_MAGIC | 1073 writel(KAUAI_FCR_UATA_MAGIC |
1073 KAUAI_FCR_UATA_RESET_N | 1074 KAUAI_FCR_UATA_RESET_N |
1074 KAUAI_FCR_UATA_ENABLE, pmif->kauai_fcr); 1075 KAUAI_FCR_UATA_ENABLE, pmif->kauai_fcr);
1075
1076 pmif->mediabay = 0;
1077 1076
1078 /* Make sure we have sane timings */ 1077 /* Make sure we have sane timings */
1079 sanitize_timings(pmif); 1078 sanitize_timings(pmif);
1080 1079
1080 /* If we are on a media bay, wait for it to settle and lock it */
1081 if (pmif->mdev)
1082 lock_media_bay(pmif->mdev->media_bay);
1083
1081 host = ide_host_alloc(&d, hws, 1); 1084 host = ide_host_alloc(&d, hws, 1);
1082 if (host == NULL) 1085 if (host == NULL) {
1083 return -ENOMEM; 1086 rc = -ENOMEM;
1084 hwif = host->ports[0]; 1087 goto bail;
1088 }
1089 hwif = pmif->hwif = host->ports[0];
1085 1090
1086#ifndef CONFIG_PPC64 1091 if (on_media_bay(pmif)) {
1087 /* XXX FIXME: Media bay stuff need re-organizing */ 1092 /* Fixup bus ID for media bay */
1088 if (np->parent && np->parent->name
1089 && strcasecmp(np->parent->name, "media-bay") == 0) {
1090#ifdef CONFIG_PMAC_MEDIABAY
1091 media_bay_set_ide_infos(np->parent, pmif->regbase, pmif->irq,
1092 hwif);
1093#endif /* CONFIG_PMAC_MEDIABAY */
1094 pmif->mediabay = 1;
1095 if (!bidp) 1093 if (!bidp)
1096 pmif->aapl_bus_id = 1; 1094 pmif->aapl_bus_id = 1;
1097 } else if (pmif->kind == controller_ohare) { 1095 } else if (pmif->kind == controller_ohare) {
@@ -1100,9 +1098,7 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif,
1100 * units, I keep the old way 1098 * units, I keep the old way
1101 */ 1099 */
1102 ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, 0, 1); 1100 ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, 0, 1);
1103 } else 1101 } else {
1104#endif
1105 {
1106 /* This is necessary to enable IDE when net-booting */ 1102 /* This is necessary to enable IDE when net-booting */
1107 ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1); 1103 ppc_md.feature_call(PMAC_FTR_IDE_RESET, np, pmif->aapl_bus_id, 1);
1108 ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1); 1104 ppc_md.feature_call(PMAC_FTR_IDE_ENABLE, np, pmif->aapl_bus_id, 1);
@@ -1112,17 +1108,21 @@ static int __devinit pmac_ide_setup_device(pmac_ide_hwif_t *pmif,
1112 } 1108 }
1113 1109
1114 printk(KERN_INFO DRV_NAME ": Found Apple %s controller (%s), " 1110 printk(KERN_INFO DRV_NAME ": Found Apple %s controller (%s), "
1115 "bus ID %d%s, irq %d\n", model_name[pmif->kind], 1111 "bus ID %d%s, irq %d\n", model_name[pmif->kind],
1116 pmif->mdev ? "macio" : "PCI", pmif->aapl_bus_id, 1112 pmif->mdev ? "macio" : "PCI", pmif->aapl_bus_id,
1117 pmif->mediabay ? " (mediabay)" : "", hw->irq); 1113 on_media_bay(pmif) ? " (mediabay)" : "", hw->irq);
1118 1114
1119 rc = ide_host_register(host, &d, hws); 1115 rc = ide_host_register(host, &d, hws);
1120 if (rc) { 1116 if (rc)
1121 ide_host_free(host); 1117 pmif->hwif = NULL;
1122 return rc;
1123 }
1124 1118
1125 return 0; 1119 if (pmif->mdev)
1120 unlock_media_bay(pmif->mdev->media_bay);
1121
1122 bail:
1123 if (rc && host)
1124 ide_host_free(host);
1125 return rc;
1126} 1126}
1127 1127
1128static void __devinit pmac_ide_init_ports(struct ide_hw *hw, unsigned long base) 1128static void __devinit pmac_ide_init_ports(struct ide_hw *hw, unsigned long base)
@@ -1362,6 +1362,25 @@ pmac_ide_pci_resume(struct pci_dev *pdev)
1362 return rc; 1362 return rc;
1363} 1363}
1364 1364
1365#ifdef CONFIG_PMAC_MEDIABAY
1366static void pmac_ide_macio_mb_event(struct macio_dev* mdev, int mb_state)
1367{
1368 pmac_ide_hwif_t *pmif =
1369 (pmac_ide_hwif_t *)dev_get_drvdata(&mdev->ofdev.dev);
1370
1371 switch(mb_state) {
1372 case MB_CD:
1373 if (!pmif->hwif->present)
1374 ide_port_scan(pmif->hwif);
1375 break;
1376 default:
1377 if (pmif->hwif->present)
1378 ide_port_unregister_devices(pmif->hwif);
1379 }
1380}
1381#endif /* CONFIG_PMAC_MEDIABAY */
1382
1383
1365static struct of_device_id pmac_ide_macio_match[] = 1384static struct of_device_id pmac_ide_macio_match[] =
1366{ 1385{
1367 { 1386 {
@@ -1386,6 +1405,9 @@ static struct macio_driver pmac_ide_macio_driver =
1386 .probe = pmac_ide_macio_attach, 1405 .probe = pmac_ide_macio_attach,
1387 .suspend = pmac_ide_macio_suspend, 1406 .suspend = pmac_ide_macio_suspend,
1388 .resume = pmac_ide_macio_resume, 1407 .resume = pmac_ide_macio_resume,
1408#ifdef CONFIG_PMAC_MEDIABAY
1409 .mediabay_event = pmac_ide_macio_mb_event,
1410#endif
1389}; 1411};
1390 1412
1391static const struct pci_device_id pmac_ide_pci_match[] = { 1413static const struct pci_device_id pmac_ide_pci_match[] = {
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);