diff options
Diffstat (limited to 'drivers/ide/ht6560b.c')
| -rw-r--r-- | drivers/ide/ht6560b.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/ide/ht6560b.c b/drivers/ide/ht6560b.c index 2fb0f2965009..aafed8060e17 100644 --- a/drivers/ide/ht6560b.c +++ b/drivers/ide/ht6560b.c | |||
| @@ -44,7 +44,12 @@ | |||
| 44 | * bit3 (0x08): "1" 3 cycle time, "0" 2 cycle time (?) | 44 | * bit3 (0x08): "1" 3 cycle time, "0" 2 cycle time (?) |
| 45 | */ | 45 | */ |
| 46 | #define HT_CONFIG_PORT 0x3e6 | 46 | #define HT_CONFIG_PORT 0x3e6 |
| 47 | #define HT_CONFIG(drivea) (u8)(((drivea)->drive_data & 0xff00) >> 8) | 47 | |
| 48 | static inline u8 HT_CONFIG(ide_drive_t *drive) | ||
| 49 | { | ||
| 50 | return ((unsigned long)ide_get_drivedata(drive) & 0xff00) >> 8; | ||
| 51 | } | ||
| 52 | |||
| 48 | /* | 53 | /* |
| 49 | * FIFO + PREFETCH (both a/b-model) | 54 | * FIFO + PREFETCH (both a/b-model) |
| 50 | */ | 55 | */ |
| @@ -90,7 +95,11 @@ | |||
| 90 | * Active Time for each drive. Smaller value gives higher speed. | 95 | * Active Time for each drive. Smaller value gives higher speed. |
| 91 | * In case of failures you should probably fall back to a higher value. | 96 | * In case of failures you should probably fall back to a higher value. |
| 92 | */ | 97 | */ |
| 93 | #define HT_TIMING(drivea) (u8)((drivea)->drive_data & 0x00ff) | 98 | static inline u8 HT_TIMING(ide_drive_t *drive) |
| 99 | { | ||
| 100 | return (unsigned long)ide_get_drivedata(drive) & 0x00ff; | ||
| 101 | } | ||
| 102 | |||
| 94 | #define HT_TIMING_DEFAULT 0xff | 103 | #define HT_TIMING_DEFAULT 0xff |
| 95 | 104 | ||
| 96 | /* | 105 | /* |
| @@ -242,23 +251,27 @@ static DEFINE_SPINLOCK(ht6560b_lock); | |||
| 242 | */ | 251 | */ |
| 243 | static void ht_set_prefetch(ide_drive_t *drive, u8 state) | 252 | static void ht_set_prefetch(ide_drive_t *drive, u8 state) |
| 244 | { | 253 | { |
| 245 | unsigned long flags; | 254 | unsigned long flags, config; |
| 246 | int t = HT_PREFETCH_MODE << 8; | 255 | int t = HT_PREFETCH_MODE << 8; |
| 247 | 256 | ||
| 248 | spin_lock_irqsave(&ht6560b_lock, flags); | 257 | spin_lock_irqsave(&ht6560b_lock, flags); |
| 249 | 258 | ||
| 259 | config = (unsigned long)ide_get_drivedata(drive); | ||
| 260 | |||
| 250 | /* | 261 | /* |
| 251 | * Prefetch mode and unmask irq seems to conflict | 262 | * Prefetch mode and unmask irq seems to conflict |
| 252 | */ | 263 | */ |
| 253 | if (state) { | 264 | if (state) { |
| 254 | drive->drive_data |= t; /* enable prefetch mode */ | 265 | config |= t; /* enable prefetch mode */ |
| 255 | drive->dev_flags |= IDE_DFLAG_NO_UNMASK; | 266 | drive->dev_flags |= IDE_DFLAG_NO_UNMASK; |
| 256 | drive->dev_flags &= ~IDE_DFLAG_UNMASK; | 267 | drive->dev_flags &= ~IDE_DFLAG_UNMASK; |
| 257 | } else { | 268 | } else { |
| 258 | drive->drive_data &= ~t; /* disable prefetch mode */ | 269 | config &= ~t; /* disable prefetch mode */ |
| 259 | drive->dev_flags &= ~IDE_DFLAG_NO_UNMASK; | 270 | drive->dev_flags &= ~IDE_DFLAG_NO_UNMASK; |
| 260 | } | 271 | } |
| 261 | 272 | ||
| 273 | ide_set_drivedata(drive, (void *)config); | ||
| 274 | |||
| 262 | spin_unlock_irqrestore(&ht6560b_lock, flags); | 275 | spin_unlock_irqrestore(&ht6560b_lock, flags); |
| 263 | 276 | ||
| 264 | #ifdef DEBUG | 277 | #ifdef DEBUG |
| @@ -268,7 +281,7 @@ static void ht_set_prefetch(ide_drive_t *drive, u8 state) | |||
| 268 | 281 | ||
| 269 | static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio) | 282 | static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio) |
| 270 | { | 283 | { |
| 271 | unsigned long flags; | 284 | unsigned long flags, config; |
| 272 | u8 timing; | 285 | u8 timing; |
| 273 | 286 | ||
| 274 | switch (pio) { | 287 | switch (pio) { |
| @@ -281,8 +294,10 @@ static void ht6560b_set_pio_mode(ide_drive_t *drive, const u8 pio) | |||
| 281 | timing = ht_pio2timings(drive, pio); | 294 | timing = ht_pio2timings(drive, pio); |
| 282 | 295 | ||
| 283 | spin_lock_irqsave(&ht6560b_lock, flags); | 296 | spin_lock_irqsave(&ht6560b_lock, flags); |
| 284 | drive->drive_data &= 0xff00; | 297 | config = (unsigned long)ide_get_drivedata(drive); |
| 285 | drive->drive_data |= timing; | 298 | config &= 0xff00; |
| 299 | config |= timing; | ||
| 300 | ide_set_drivedata(drive, (void *)config); | ||
| 286 | spin_unlock_irqrestore(&ht6560b_lock, flags); | 301 | spin_unlock_irqrestore(&ht6560b_lock, flags); |
| 287 | 302 | ||
| 288 | #ifdef DEBUG | 303 | #ifdef DEBUG |
| @@ -299,7 +314,7 @@ static void __init ht6560b_init_dev(ide_drive_t *drive) | |||
| 299 | if (hwif->channel) | 314 | if (hwif->channel) |
| 300 | t |= (HT_SECONDARY_IF << 8); | 315 | t |= (HT_SECONDARY_IF << 8); |
| 301 | 316 | ||
| 302 | drive->drive_data = t; | 317 | ide_set_drivedata(drive, (void *)t); |
| 303 | } | 318 | } |
| 304 | 319 | ||
| 305 | static int probe_ht6560b; | 320 | static int probe_ht6560b; |
