diff options
Diffstat (limited to 'drivers/ide/pci/opti621.c')
-rw-r--r-- | drivers/ide/pci/opti621.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/ide/pci/opti621.c b/drivers/ide/pci/opti621.c index 3a2bb2723515..9fa06393469a 100644 --- a/drivers/ide/pci/opti621.c +++ b/drivers/ide/pci/opti621.c | |||
@@ -47,7 +47,7 @@ | |||
47 | * The main problem with OPTi is that some timings for master | 47 | * The main problem with OPTi is that some timings for master |
48 | * and slave must be the same. For example, if you have master | 48 | * and slave must be the same. For example, if you have master |
49 | * PIO 3 and slave PIO 0, driver have to set some timings of | 49 | * PIO 3 and slave PIO 0, driver have to set some timings of |
50 | * master for PIO 0. Second problem is that opti621_tune_drive | 50 | * master for PIO 0. Second problem is that opti621_set_pio_mode |
51 | * got only one drive to set, but have to set both drives. | 51 | * got only one drive to set, but have to set both drives. |
52 | * This is solved in compute_pios. If you don't set | 52 | * This is solved in compute_pios. If you don't set |
53 | * the second drive, compute_pios use ide_get_best_pio_mode | 53 | * the second drive, compute_pios use ide_get_best_pio_mode |
@@ -103,7 +103,7 @@ | |||
103 | 103 | ||
104 | #include <asm/io.h> | 104 | #include <asm/io.h> |
105 | 105 | ||
106 | #define OPTI621_MAX_PIO 3 | 106 | //#define OPTI621_MAX_PIO 3 |
107 | /* In fact, I do not have any PIO 4 drive | 107 | /* In fact, I do not have any PIO 4 drive |
108 | * (address: 25 ns, data: 70 ns, recovery: 35 ns), | 108 | * (address: 25 ns, data: 70 ns, recovery: 35 ns), |
109 | * but OPTi 82C621 is programmable and it can do (minimal values): | 109 | * but OPTi 82C621 is programmable and it can do (minimal values): |
@@ -136,8 +136,8 @@ static int reg_base; | |||
136 | #define PIO_NOT_EXIST 254 | 136 | #define PIO_NOT_EXIST 254 |
137 | #define PIO_DONT_KNOW 255 | 137 | #define PIO_DONT_KNOW 255 |
138 | 138 | ||
139 | /* there are stored pio numbers from other calls of opti621_tune_drive */ | 139 | /* there are stored pio numbers from other calls of opti621_set_pio_mode */ |
140 | static void compute_pios(ide_drive_t *drive, u8 pio) | 140 | static void compute_pios(ide_drive_t *drive, const u8 pio) |
141 | /* Store values into drive->drive_data | 141 | /* Store values into drive->drive_data |
142 | * second_contr - 0 for primary controller, 1 for secondary | 142 | * second_contr - 0 for primary controller, 1 for secondary |
143 | * slave_drive - 0 -> pio is for master, 1 -> pio is for slave | 143 | * slave_drive - 0 -> pio is for master, 1 -> pio is for slave |
@@ -147,12 +147,13 @@ static void compute_pios(ide_drive_t *drive, u8 pio) | |||
147 | int d; | 147 | int d; |
148 | ide_hwif_t *hwif = HWIF(drive); | 148 | ide_hwif_t *hwif = HWIF(drive); |
149 | 149 | ||
150 | drive->drive_data = ide_get_best_pio_mode(drive, pio, OPTI621_MAX_PIO); | 150 | drive->drive_data = pio; |
151 | |||
151 | for (d = 0; d < 2; ++d) { | 152 | for (d = 0; d < 2; ++d) { |
152 | drive = &hwif->drives[d]; | 153 | drive = &hwif->drives[d]; |
153 | if (drive->present) { | 154 | if (drive->present) { |
154 | if (drive->drive_data == PIO_DONT_KNOW) | 155 | if (drive->drive_data == PIO_DONT_KNOW) |
155 | drive->drive_data = ide_get_best_pio_mode(drive, 255, OPTI621_MAX_PIO); | 156 | drive->drive_data = ide_get_best_pio_mode(drive, 255, 3); |
156 | #ifdef OPTI621_DEBUG | 157 | #ifdef OPTI621_DEBUG |
157 | printk("%s: Selected PIO mode %d\n", | 158 | printk("%s: Selected PIO mode %d\n", |
158 | drive->name, drive->drive_data); | 159 | drive->name, drive->drive_data); |
@@ -240,8 +241,7 @@ static void compute_clocks(int pio, pio_clocks_t *clks) | |||
240 | 241 | ||
241 | } | 242 | } |
242 | 243 | ||
243 | /* Main tune procedure, called from tuneproc. */ | 244 | static void opti621_set_pio_mode(ide_drive_t *drive, const u8 pio) |
244 | static void opti621_tune_drive (ide_drive_t *drive, u8 pio) | ||
245 | { | 245 | { |
246 | /* primary and secondary drives share some registers, | 246 | /* primary and secondary drives share some registers, |
247 | * so we have to program both drives | 247 | * so we have to program both drives |
@@ -331,7 +331,8 @@ static void __devinit init_hwif_opti621 (ide_hwif_t *hwif) | |||
331 | hwif->autodma = 0; | 331 | hwif->autodma = 0; |
332 | hwif->drives[0].drive_data = PIO_DONT_KNOW; | 332 | hwif->drives[0].drive_data = PIO_DONT_KNOW; |
333 | hwif->drives[1].drive_data = PIO_DONT_KNOW; | 333 | hwif->drives[1].drive_data = PIO_DONT_KNOW; |
334 | hwif->tuneproc = &opti621_tune_drive; | 334 | |
335 | hwif->set_pio_mode = &opti621_set_pio_mode; | ||
335 | 336 | ||
336 | if (!(hwif->dma_base)) | 337 | if (!(hwif->dma_base)) |
337 | return; | 338 | return; |