aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-01 23:48:42 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-08-01 23:48:42 -0400
commit878701db07db3f0b59f14f0c525b681e4ca81551 (patch)
tree132083fef920c0df6e41379909d3f071f2d68032
parent04668873daa822aa6c806ba28d1143db8dcb26e8 (diff)
parent3fcece66911c9d485c1e2050ba033fde607b5130 (diff)
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: scc_pata: PIO fixes piix/slc90e66: fix PIO1 handling in ->speedproc method (take 2) jmicron: PIO fixes it8213: PIO fixes (take 2) cs5535: PIO fixes cs5520: fix PIO auto-tuning in ->ide_dma_check method drivers/scsi/ide-scsi.c: kmalloc + memset conversion to kzalloc drivers/ide/arm/icside.c: kmalloc + memset conversion to kzalloc ide: eliminate warnings in ide-tape.c ide: fix runtogether printk's in cmd64x IDE driver sis5513: Add FSC Amilo A1630 PCI subvendor/dev to laptops alim15x3: Correct HP detect ide: Fix an overrun found in the CS5535 IDE driver
-rw-r--r--drivers/ide/arm/icside.c3
-rw-r--r--drivers/ide/ide-tape.c2
-rw-r--r--drivers/ide/pci/alim15x3.c2
-rw-r--r--drivers/ide/pci/cmd64x.c4
-rw-r--r--drivers/ide/pci/cs5520.c2
-rw-r--r--drivers/ide/pci/cs5535.c42
-rw-r--r--drivers/ide/pci/it8213.c33
-rw-r--r--drivers/ide/pci/jmicron.c21
-rw-r--r--drivers/ide/pci/piix.c17
-rw-r--r--drivers/ide/pci/scc_pata.c61
-rw-r--r--drivers/ide/pci/sis5513.c1
-rw-r--r--drivers/ide/pci/slc90e66.c15
-rw-r--r--drivers/scsi/ide-scsi.c10
13 files changed, 85 insertions, 128 deletions
diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c
index c89b5f4b2d04..8a9b98fcb66d 100644
--- a/drivers/ide/arm/icside.c
+++ b/drivers/ide/arm/icside.c
@@ -693,13 +693,12 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id)
693 if (ret) 693 if (ret)
694 goto out; 694 goto out;
695 695
696 state = kmalloc(sizeof(struct icside_state), GFP_KERNEL); 696 state = kzalloc(sizeof(struct icside_state), GFP_KERNEL);
697 if (!state) { 697 if (!state) {
698 ret = -ENOMEM; 698 ret = -ENOMEM;
699 goto release; 699 goto release;
700 } 700 }
701 701
702 memset(state, 0, sizeof(state));
703 state->type = ICS_TYPE_NOTYPE; 702 state->type = ICS_TYPE_NOTYPE;
704 state->dev = &ec->dev; 703 state->dev = &ec->dev;
705 704
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index e82bfa5e0ab8..1fa57947bca0 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -640,7 +640,7 @@ typedef enum {
640} idetape_chrdev_direction_t; 640} idetape_chrdev_direction_t;
641 641
642struct idetape_bh { 642struct idetape_bh {
643 unsigned short b_size; 643 u32 b_size;
644 atomic_t b_count; 644 atomic_t b_count;
645 struct idetape_bh *b_reqnext; 645 struct idetape_bh *b_reqnext;
646 char *b_data; 646 char *b_data;
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c
index 5511c86733dc..025689de50e9 100644
--- a/drivers/ide/pci/alim15x3.c
+++ b/drivers/ide/pci/alim15x3.c
@@ -593,7 +593,7 @@ static struct dmi_system_id cable_dmi_table[] = {
593 .ident = "HP Pavilion N5430", 593 .ident = "HP Pavilion N5430",
594 .matches = { 594 .matches = {
595 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"), 595 DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
596 DMI_MATCH(DMI_BOARD_NAME, "OmniBook N32N-736"), 596 DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"),
597 }, 597 },
598 }, 598 },
599 { } 599 { }
diff --git a/drivers/ide/pci/cmd64x.c b/drivers/ide/pci/cmd64x.c
index 19633c5aba15..0e3b5de26e69 100644
--- a/drivers/ide/pci/cmd64x.c
+++ b/drivers/ide/pci/cmd64x.c
@@ -475,11 +475,11 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha
475 switch (rev) { 475 switch (rev) {
476 case 0x07: 476 case 0x07:
477 case 0x05: 477 case 0x05:
478 printk("%s: UltraDMA capable", name); 478 printk("%s: UltraDMA capable\n", name);
479 break; 479 break;
480 case 0x03: 480 case 0x03:
481 default: 481 default:
482 printk("%s: MultiWord DMA force limited", name); 482 printk("%s: MultiWord DMA force limited\n", name);
483 break; 483 break;
484 case 0x01: 484 case 0x01:
485 printk("%s: MultiWord DMA limited, " 485 printk("%s: MultiWord DMA limited, "
diff --git a/drivers/ide/pci/cs5520.c b/drivers/ide/pci/cs5520.c
index bccedf9b8b28..b89e81656875 100644
--- a/drivers/ide/pci/cs5520.c
+++ b/drivers/ide/pci/cs5520.c
@@ -133,7 +133,7 @@ static void cs5520_tune_drive(ide_drive_t *drive, u8 pio)
133static int cs5520_config_drive_xfer_rate(ide_drive_t *drive) 133static int cs5520_config_drive_xfer_rate(ide_drive_t *drive)
134{ 134{
135 /* Tune the drive for PIO modes up to PIO 4 */ 135 /* Tune the drive for PIO modes up to PIO 4 */
136 cs5520_tune_drive(drive, 4); 136 cs5520_tune_drive(drive, 255);
137 137
138 /* Then tell the core to use DMA operations */ 138 /* Then tell the core to use DMA operations */
139 return 0; 139 return 0;
diff --git a/drivers/ide/pci/cs5535.c b/drivers/ide/pci/cs5535.c
index ce44e38390aa..082ca7da2cbc 100644
--- a/drivers/ide/pci/cs5535.c
+++ b/drivers/ide/pci/cs5535.c
@@ -2,6 +2,7 @@
2 * linux/drivers/ide/pci/cs5535.c 2 * linux/drivers/ide/pci/cs5535.c
3 * 3 *
4 * Copyright (C) 2004-2005 Advanced Micro Devices, Inc. 4 * Copyright (C) 2004-2005 Advanced Micro Devices, Inc.
5 * Copyright (C) 2007 Bartlomiej Zolnierkiewicz
5 * 6 *
6 * History: 7 * History:
7 * 09/20/2005 - Jaya Kumar <jayakumar.ide@gmail.com> 8 * 09/20/2005 - Jaya Kumar <jayakumar.ide@gmail.com>
@@ -83,14 +84,17 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
83 84
84 /* Set the PIO timings */ 85 /* Set the PIO timings */
85 if ((speed & XFER_MODE) == XFER_PIO) { 86 if ((speed & XFER_MODE) == XFER_PIO) {
86 u8 pioa; 87 ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1];
87 u8 piob; 88 u8 cmd, pioa;
88 u8 cmd;
89 89
90 pioa = speed - XFER_PIO_0; 90 cmd = pioa = speed - XFER_PIO_0;
91 piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]), 91
92 255, 4); 92 if (pair->present) {
93 cmd = pioa < piob ? pioa : piob; 93 u8 piob = ide_get_best_pio_mode(pair, 255, 4);
94
95 if (piob < cmd)
96 cmd = piob;
97 }
94 98
95 /* Write the speed of the current drive */ 99 /* Write the speed of the current drive */
96 reg = (cs5535_pio_cmd_timings[cmd] << 16) | 100 reg = (cs5535_pio_cmd_timings[cmd] << 16) |
@@ -116,7 +120,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
116 120
117 reg &= 0x80000000UL; /* Preserve the PIO format bit */ 121 reg &= 0x80000000UL; /* Preserve the PIO format bit */
118 122
119 if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_7) 123 if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_4)
120 reg |= cs5535_udma_timings[speed - XFER_UDMA_0]; 124 reg |= cs5535_udma_timings[speed - XFER_UDMA_0];
121 else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2) 125 else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
122 reg |= cs5535_mwdma_timings[speed - XFER_MW_DMA_0]; 126 reg |= cs5535_mwdma_timings[speed - XFER_MW_DMA_0];
@@ -151,32 +155,22 @@ static int cs5535_set_drive(ide_drive_t *drive, u8 speed)
151 * 155 *
152 * A callback from the upper layers for PIO-only tuning. 156 * A callback from the upper layers for PIO-only tuning.
153 */ 157 */
154static void cs5535_tuneproc(ide_drive_t *drive, u8 xferspeed) 158static void cs5535_tuneproc(ide_drive_t *drive, u8 pio)
155{ 159{
156 u8 modes[] = { XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3, 160 pio = ide_get_best_pio_mode(drive, pio, 4);
157 XFER_PIO_4 }; 161 ide_config_drive_speed(drive, XFER_PIO_0 + pio);
158 162 cs5535_set_speed(drive, XFER_PIO_0 + pio);
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} 163}
166 164
167static int cs5535_dma_check(ide_drive_t *drive) 165static int cs5535_dma_check(ide_drive_t *drive)
168{ 166{
169 u8 speed;
170
171 drive->init_speed = 0; 167 drive->init_speed = 0;
172 168
173 if (ide_tune_dma(drive)) 169 if (ide_tune_dma(drive))
174 return 0; 170 return 0;
175 171
176 if (ide_use_fast_pio(drive)) { 172 if (ide_use_fast_pio(drive))
177 speed = ide_get_best_pio_mode(drive, 255, 4); 173 cs5535_tuneproc(drive, 255);
178 cs5535_set_drive(drive, speed);
179 }
180 174
181 return -1; 175 return -1;
182} 176}
diff --git a/drivers/ide/pci/it8213.c b/drivers/ide/pci/it8213.c
index 95dbed7e6022..70b3245dbf62 100644
--- a/drivers/ide/pci/it8213.c
+++ b/drivers/ide/pci/it8213.c
@@ -21,7 +21,7 @@
21 * it8213_dma_2_pio - return the PIO mode matching DMA 21 * it8213_dma_2_pio - return the PIO mode matching DMA
22 * @xfer_rate: transfer speed 22 * @xfer_rate: transfer speed
23 * 23 *
24 * Returns the nearest equivalent PIO timing for the PIO or DMA 24 * Returns the nearest equivalent PIO timing for the DMA
25 * mode requested by the controller. 25 * mode requested by the controller.
26 */ 26 */
27 27
@@ -35,34 +35,28 @@ static u8 it8213_dma_2_pio (u8 xfer_rate) {
35 case XFER_UDMA_1: 35 case XFER_UDMA_1:
36 case XFER_UDMA_0: 36 case XFER_UDMA_0:
37 case XFER_MW_DMA_2: 37 case XFER_MW_DMA_2:
38 case XFER_PIO_4:
39 return 4; 38 return 4;
40 case XFER_MW_DMA_1: 39 case XFER_MW_DMA_1:
41 case XFER_PIO_3:
42 return 3; 40 return 3;
43 case XFER_SW_DMA_2: 41 case XFER_SW_DMA_2:
44 case XFER_PIO_2:
45 return 2; 42 return 2;
46 case XFER_MW_DMA_0: 43 case XFER_MW_DMA_0:
47 case XFER_SW_DMA_1: 44 case XFER_SW_DMA_1:
48 case XFER_SW_DMA_0: 45 case XFER_SW_DMA_0:
49 case XFER_PIO_1:
50 case XFER_PIO_0:
51 case XFER_PIO_SLOW:
52 default: 46 default:
53 return 0; 47 return 0;
54 } 48 }
55} 49}
56 50
57/* 51/*
58 * it8213_tuneproc - tune a drive 52 * it8213_tune_pio - tune a drive
59 * @drive: drive to tune 53 * @drive: drive to tune
60 * @pio: desired PIO mode 54 * @pio: desired PIO mode
61 * 55 *
62 * Set the interface PIO mode. 56 * Set the interface PIO mode.
63 */ 57 */
64 58
65static void it8213_tuneproc (ide_drive_t *drive, u8 pio) 59static void it8213_tune_pio(ide_drive_t *drive, const u8 pio)
66{ 60{
67 ide_hwif_t *hwif = HWIF(drive); 61 ide_hwif_t *hwif = HWIF(drive);
68 struct pci_dev *dev = hwif->pci_dev; 62 struct pci_dev *dev = hwif->pci_dev;
@@ -82,8 +76,6 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
82 { 2, 1 }, 76 { 2, 1 },
83 { 2, 3 }, }; 77 { 2, 3 }, };
84 78
85 pio = ide_get_best_pio_mode(drive, pio, 4);
86
87 spin_lock_irqsave(&tune_lock, flags); 79 spin_lock_irqsave(&tune_lock, flags);
88 pci_read_config_word(dev, master_port, &master_data); 80 pci_read_config_word(dev, master_port, &master_data);
89 81
@@ -113,6 +105,13 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
113 spin_unlock_irqrestore(&tune_lock, flags); 105 spin_unlock_irqrestore(&tune_lock, flags);
114} 106}
115 107
108static void it8213_tuneproc(ide_drive_t *drive, u8 pio)
109{
110 pio = ide_get_best_pio_mode(drive, pio, 4);
111 it8213_tune_pio(drive, pio);
112 ide_config_drive_speed(drive, XFER_PIO_0 + pio);
113}
114
116/** 115/**
117 * it8213_tune_chipset - set controller timings 116 * it8213_tune_chipset - set controller timings
118 * @drive: Drive to set up 117 * @drive: Drive to set up
@@ -193,7 +192,12 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)
193 if (reg55 & w_flag) 192 if (reg55 & w_flag)
194 pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); 193 pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
195 } 194 }
196 it8213_tuneproc(drive, it8213_dma_2_pio(speed)); 195
196 if (speed > XFER_PIO_4)
197 it8213_tune_pio(drive, it8213_dma_2_pio(speed));
198 else
199 it8213_tune_pio(drive, speed - XFER_PIO_0);
200
197 return ide_config_drive_speed(drive, speed); 201 return ide_config_drive_speed(drive, speed);
198} 202}
199 203
@@ -209,13 +213,10 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)
209 213
210static int it8213_config_drive_for_dma (ide_drive_t *drive) 214static int it8213_config_drive_for_dma (ide_drive_t *drive)
211{ 215{
212 u8 pio;
213
214 if (ide_tune_dma(drive)) 216 if (ide_tune_dma(drive))
215 return 0; 217 return 0;
216 218
217 pio = ide_get_best_pio_mode(drive, 255, 4); 219 it8213_tuneproc(drive, 255);
218 it8213_tune_chipset(drive, XFER_PIO_0 + pio);
219 220
220 return -1; 221 return -1;
221} 222}
diff --git a/drivers/ide/pci/jmicron.c b/drivers/ide/pci/jmicron.c
index d7ce9dd8de16..65a0ff352b98 100644
--- a/drivers/ide/pci/jmicron.c
+++ b/drivers/ide/pci/jmicron.c
@@ -83,23 +83,10 @@ static u8 __devinit ata66_jmicron(ide_hwif_t *hwif)
83 return ATA_CBL_PATA80; 83 return ATA_CBL_PATA80;
84} 84}
85 85
86static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted) 86static void jmicron_tuneproc(ide_drive_t *drive, u8 pio)
87{ 87{
88 return; 88 pio = ide_get_best_pio_mode(drive, pio, 5);
89} 89 ide_config_drive_speed(drive, XFER_PIO_0 + pio);
90
91/**
92 * config_jmicron_chipset_for_pio - set drive timings
93 * @drive: drive to tune
94 * @speed we want
95 *
96 */
97
98static 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} 90}
104 91
105/** 92/**
@@ -132,7 +119,7 @@ static int jmicron_config_drive_for_dma (ide_drive_t *drive)
132 if (ide_tune_dma(drive)) 119 if (ide_tune_dma(drive))
133 return 0; 120 return 0;
134 121
135 config_jmicron_chipset_for_pio(drive, 1); 122 jmicron_tuneproc(drive, 255);
136 123
137 return -1; 124 return -1;
138} 125}
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c
index 4f69cd067e5e..5cfa9378bbb8 100644
--- a/drivers/ide/pci/piix.c
+++ b/drivers/ide/pci/piix.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/piix.c Version 0.50 Jun 10, 2007 2 * linux/drivers/ide/pci/piix.c Version 0.51 Jul 6, 2007
3 * 3 *
4 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer 4 * Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
5 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org> 5 * Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
@@ -109,7 +109,7 @@ static int no_piix_dma;
109 * piix_dma_2_pio - return the PIO mode matching DMA 109 * piix_dma_2_pio - return the PIO mode matching DMA
110 * @xfer_rate: transfer speed 110 * @xfer_rate: transfer speed
111 * 111 *
112 * Returns the nearest equivalent PIO timing for the PIO or DMA 112 * Returns the nearest equivalent PIO timing for the DMA
113 * mode requested by the controller. 113 * mode requested by the controller.
114 */ 114 */
115 115
@@ -123,20 +123,14 @@ static u8 piix_dma_2_pio (u8 xfer_rate) {
123 case XFER_UDMA_1: 123 case XFER_UDMA_1:
124 case XFER_UDMA_0: 124 case XFER_UDMA_0:
125 case XFER_MW_DMA_2: 125 case XFER_MW_DMA_2:
126 case XFER_PIO_4:
127 return 4; 126 return 4;
128 case XFER_MW_DMA_1: 127 case XFER_MW_DMA_1:
129 case XFER_PIO_3:
130 return 3; 128 return 3;
131 case XFER_SW_DMA_2: 129 case XFER_SW_DMA_2:
132 case XFER_PIO_2:
133 return 2; 130 return 2;
134 case XFER_MW_DMA_0: 131 case XFER_MW_DMA_0:
135 case XFER_SW_DMA_1: 132 case XFER_SW_DMA_1:
136 case XFER_SW_DMA_0: 133 case XFER_SW_DMA_0:
137 case XFER_PIO_1:
138 case XFER_PIO_0:
139 case XFER_PIO_SLOW:
140 default: 134 default:
141 return 0; 135 return 0;
142 } 136 }
@@ -269,6 +263,7 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
269 case XFER_PIO_4: 263 case XFER_PIO_4:
270 case XFER_PIO_3: 264 case XFER_PIO_3:
271 case XFER_PIO_2: 265 case XFER_PIO_2:
266 case XFER_PIO_1:
272 case XFER_PIO_0: break; 267 case XFER_PIO_0: break;
273 default: return -1; 268 default: return -1;
274 } 269 }
@@ -299,7 +294,11 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
299 pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag); 294 pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
300 } 295 }
301 296
302 piix_tune_pio(drive, piix_dma_2_pio(speed)); 297 if (speed > XFER_PIO_4)
298 piix_tune_pio(drive, piix_dma_2_pio(speed));
299 else
300 piix_tune_pio(drive, speed - XFER_PIO_0);
301
303 return ide_config_drive_speed(drive, speed); 302 return ide_config_drive_speed(drive, speed);
304} 303}
305 304
diff --git a/drivers/ide/pci/scc_pata.c b/drivers/ide/pci/scc_pata.c
index bf19ddfa6cda..eeb0a6d434aa 100644
--- a/drivers/ide/pci/scc_pata.c
+++ b/drivers/ide/pci/scc_pata.c
@@ -190,7 +190,7 @@ scc_ide_outsl(unsigned long port, void *addr, u32 count)
190} 190}
191 191
192/** 192/**
193 * scc_tuneproc - tune a drive PIO mode 193 * scc_tune_pio - tune a drive PIO mode
194 * @drive: drive to tune 194 * @drive: drive to tune
195 * @mode_wanted: the target operating mode 195 * @mode_wanted: the target operating mode
196 * 196 *
@@ -198,7 +198,7 @@ scc_ide_outsl(unsigned long port, void *addr, u32 count)
198 * controller. 198 * controller.
199 */ 199 */
200 200
201static void scc_tuneproc(ide_drive_t *drive, byte mode_wanted) 201static void scc_tune_pio(ide_drive_t *drive, const u8 pio)
202{ 202{
203 ide_hwif_t *hwif = HWIF(drive); 203 ide_hwif_t *hwif = HWIF(drive);
204 struct scc_ports *ports = ide_get_hwifdata(hwif); 204 struct scc_ports *ports = ide_get_hwifdata(hwif);
@@ -207,41 +207,25 @@ static void scc_tuneproc(ide_drive_t *drive, byte mode_wanted)
207 unsigned long piosht_port = ctl_base + 0x000; 207 unsigned long piosht_port = ctl_base + 0x000;
208 unsigned long pioct_port = ctl_base + 0x004; 208 unsigned long pioct_port = ctl_base + 0x004;
209 unsigned long reg; 209 unsigned long reg;
210 unsigned char speed = XFER_PIO_0;
211 int offset; 210 int offset;
212 211
213 mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4);
214 switch (mode_wanted) {
215 case 4:
216 speed = XFER_PIO_4;
217 break;
218 case 3:
219 speed = XFER_PIO_3;
220 break;
221 case 2:
222 speed = XFER_PIO_2;
223 break;
224 case 1:
225 speed = XFER_PIO_1;
226 break;
227 case 0:
228 default:
229 speed = XFER_PIO_0;
230 break;
231 }
232
233 reg = in_be32((void __iomem *)cckctrl_port); 212 reg = in_be32((void __iomem *)cckctrl_port);
234 if (reg & CCKCTRL_ATACLKOEN) { 213 if (reg & CCKCTRL_ATACLKOEN) {
235 offset = 1; /* 133MHz */ 214 offset = 1; /* 133MHz */
236 } else { 215 } else {
237 offset = 0; /* 100MHz */ 216 offset = 0; /* 100MHz */
238 } 217 }
239 reg = JCHSTtbl[offset][mode_wanted] << 16 | JCHHTtbl[offset][mode_wanted]; 218 reg = JCHSTtbl[offset][pio] << 16 | JCHHTtbl[offset][pio];
240 out_be32((void __iomem *)piosht_port, reg); 219 out_be32((void __iomem *)piosht_port, reg);
241 reg = JCHCTtbl[offset][mode_wanted]; 220 reg = JCHCTtbl[offset][pio];
242 out_be32((void __iomem *)pioct_port, reg); 221 out_be32((void __iomem *)pioct_port, reg);
222}
243 223
244 ide_config_drive_speed(drive, speed); 224static void scc_tuneproc(ide_drive_t *drive, u8 pio)
225{
226 pio = ide_get_best_pio_mode(drive, pio, 4);
227 scc_tune_pio(drive, pio);
228 ide_config_drive_speed(drive, XFER_PIO_0 + pio);
245} 229}
246 230
247/** 231/**
@@ -280,26 +264,21 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)
280 264
281 switch (speed) { 265 switch (speed) {
282 case XFER_UDMA_6: 266 case XFER_UDMA_6:
283 idx = 6;
284 break;
285 case XFER_UDMA_5: 267 case XFER_UDMA_5:
286 idx = 5;
287 break;
288 case XFER_UDMA_4: 268 case XFER_UDMA_4:
289 idx = 4;
290 break;
291 case XFER_UDMA_3: 269 case XFER_UDMA_3:
292 idx = 3;
293 break;
294 case XFER_UDMA_2: 270 case XFER_UDMA_2:
295 idx = 2;
296 break;
297 case XFER_UDMA_1: 271 case XFER_UDMA_1:
298 idx = 1;
299 break;
300 case XFER_UDMA_0: 272 case XFER_UDMA_0:
301 idx = 0; 273 idx = speed - XFER_UDMA_0;
302 break; 274 break;
275 case XFER_PIO_4:
276 case XFER_PIO_3:
277 case XFER_PIO_2:
278 case XFER_PIO_1:
279 case XFER_PIO_0:
280 scc_tune_pio(drive, speed - XFER_PIO_0);
281 return ide_config_drive_speed(drive, speed);
303 default: 282 default:
304 return 1; 283 return 1;
305 } 284 }
@@ -329,7 +308,7 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)
329 * required. 308 * required.
330 * If the drive isn't suitable for DMA or we hit other problems 309 * If the drive isn't suitable for DMA or we hit other problems
331 * then we will drop down to PIO and set up PIO appropriately. 310 * then we will drop down to PIO and set up PIO appropriately.
332 * (return 1) 311 * (return -1)
333 */ 312 */
334 313
335static int scc_config_drive_for_dma(ide_drive_t *drive) 314static int scc_config_drive_for_dma(ide_drive_t *drive)
@@ -338,7 +317,7 @@ static int scc_config_drive_for_dma(ide_drive_t *drive)
338 return 0; 317 return 0;
339 318
340 if (ide_use_fast_pio(drive)) 319 if (ide_use_fast_pio(drive))
341 scc_tuneproc(drive, 4); 320 scc_tuneproc(drive, 255);
342 321
343 return -1; 322 return -1;
344} 323}
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c
index 63fbb79e8178..26f24802d3e8 100644
--- a/drivers/ide/pci/sis5513.c
+++ b/drivers/ide/pci/sis5513.c
@@ -801,6 +801,7 @@ struct sis_laptop {
801static const struct sis_laptop sis_laptop[] = { 801static const struct sis_laptop sis_laptop[] = {
802 /* devid, subvendor, subdev */ 802 /* devid, subvendor, subdev */
803 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ 803 { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */
804 { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */
804 /* end marker */ 805 /* end marker */
805 { 0, } 806 { 0, }
806}; 807};
diff --git a/drivers/ide/pci/slc90e66.c b/drivers/ide/pci/slc90e66.c
index 8e655f2db5cb..628b0664f576 100644
--- a/drivers/ide/pci/slc90e66.c
+++ b/drivers/ide/pci/slc90e66.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/drivers/ide/pci/slc90e66.c Version 0.14 February 8, 2007 2 * linux/drivers/ide/pci/slc90e66.c Version 0.15 Jul 6, 2007
3 * 3 *
4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org> 4 * Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
5 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com> 5 * Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com>
@@ -29,20 +29,14 @@ static u8 slc90e66_dma_2_pio (u8 xfer_rate) {
29 case XFER_UDMA_1: 29 case XFER_UDMA_1:
30 case XFER_UDMA_0: 30 case XFER_UDMA_0:
31 case XFER_MW_DMA_2: 31 case XFER_MW_DMA_2:
32 case XFER_PIO_4:
33 return 4; 32 return 4;
34 case XFER_MW_DMA_1: 33 case XFER_MW_DMA_1:
35 case XFER_PIO_3:
36 return 3; 34 return 3;
37 case XFER_SW_DMA_2: 35 case XFER_SW_DMA_2:
38 case XFER_PIO_2:
39 return 2; 36 return 2;
40 case XFER_MW_DMA_0: 37 case XFER_MW_DMA_0:
41 case XFER_SW_DMA_1: 38 case XFER_SW_DMA_1:
42 case XFER_SW_DMA_0: 39 case XFER_SW_DMA_0:
43 case XFER_PIO_1:
44 case XFER_PIO_0:
45 case XFER_PIO_SLOW:
46 default: 40 default:
47 return 0; 41 return 0;
48 } 42 }
@@ -136,6 +130,7 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
136 case XFER_PIO_4: 130 case XFER_PIO_4:
137 case XFER_PIO_3: 131 case XFER_PIO_3:
138 case XFER_PIO_2: 132 case XFER_PIO_2:
133 case XFER_PIO_1:
139 case XFER_PIO_0: break; 134 case XFER_PIO_0: break;
140 default: return -1; 135 default: return -1;
141 } 136 }
@@ -156,7 +151,11 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
156 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed); 151 pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
157 } 152 }
158 153
159 slc90e66_tune_pio(drive, slc90e66_dma_2_pio(speed)); 154 if (speed > XFER_PIO_4)
155 slc90e66_tune_pio(drive, slc90e66_dma_2_pio(speed));
156 else
157 slc90e66_tune_pio(drive, speed - XFER_PIO_0);
158
160 return ide_config_drive_speed(drive, speed); 159 return ide_config_drive_speed(drive, speed);
161} 160}
162 161
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index bb90df8bdce4..1cc01acc2808 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -328,17 +328,15 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co
328 u8 *buf; 328 u8 *buf;
329 329
330 /* stuff a sense request in front of our current request */ 330 /* stuff a sense request in front of our current request */
331 pc = kmalloc (sizeof (idescsi_pc_t), GFP_ATOMIC); 331 pc = kzalloc(sizeof(idescsi_pc_t), GFP_ATOMIC);
332 rq = kmalloc (sizeof (struct request), GFP_ATOMIC); 332 rq = kmalloc(sizeof(struct request), GFP_ATOMIC);
333 buf = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC); 333 buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC);
334 if (pc == NULL || rq == NULL || buf == NULL) { 334 if (!pc || !rq || !buf) {
335 kfree(buf); 335 kfree(buf);
336 kfree(rq); 336 kfree(rq);
337 kfree(pc); 337 kfree(pc);
338 return -ENOMEM; 338 return -ENOMEM;
339 } 339 }
340 memset (pc, 0, sizeof (idescsi_pc_t));
341 memset (buf, 0, SCSI_SENSE_BUFFERSIZE);
342 ide_init_drive_cmd(rq); 340 ide_init_drive_cmd(rq);
343 rq->special = (char *) pc; 341 rq->special = (char *) pc;
344 pc->rq = rq; 342 pc->rq = rq;