diff options
| author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-10-06 18:27:19 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@redhat.com> | 2009-10-06 20:58:23 -0400 |
| commit | c59bcc37cb56e00ae0582339bea948853d600436 (patch) | |
| tree | 4164daee20b9db40862188da113626db89a981f5 /drivers | |
| parent | 64207f59137fd300a869e35b14c15f775c64c6fc (diff) | |
pata_atp867x: PIO support fixes
* use 8 clk setting for active clocks == 7 (was 12 clk)
* use 12 clk setting for active clocks > 12 (was 8 clk)
* do 66MHz bus fixup before mapping active clocks
* fix setup of PIO command timings
Acked-by: Jung-Ik (John) Lee <jilee@google.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/ata/pata_atp867x.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/ata/pata_atp867x.c b/drivers/ata/pata_atp867x.c index 27d3148b3d8e..4a2cd9a7bad1 100644 --- a/drivers/ata/pata_atp867x.c +++ b/drivers/ata/pata_atp867x.c | |||
| @@ -155,30 +155,31 @@ static int atp867x_get_active_clocks_shifted(struct ata_port *ap, | |||
| 155 | struct atp867x_priv *dp = ap->private_data; | 155 | struct atp867x_priv *dp = ap->private_data; |
| 156 | unsigned char clocks = clk; | 156 | unsigned char clocks = clk; |
| 157 | 157 | ||
| 158 | /* | ||
| 159 | * Doc 6.6.9: increase the clock value by 1 for safer PIO speed | ||
| 160 | * on 66MHz bus | ||
| 161 | */ | ||
| 162 | if (dp->pci66mhz) | ||
| 163 | clocks++; | ||
| 164 | |||
| 158 | switch (clocks) { | 165 | switch (clocks) { |
| 159 | case 0: | 166 | case 0: |
| 160 | clocks = 1; | 167 | clocks = 1; |
| 161 | break; | 168 | break; |
| 162 | case 1 ... 7: | 169 | case 1 ... 6: |
| 163 | break; | ||
| 164 | case 9 ... 12: | ||
| 165 | clocks = 7; | ||
| 166 | break; | 170 | break; |
| 167 | default: | 171 | default: |
| 168 | printk(KERN_WARNING "ATP867X: active %dclk is invalid. " | 172 | printk(KERN_WARNING "ATP867X: active %dclk is invalid. " |
| 169 | "Using default 8clk.\n", clk); | 173 | "Using 12clk.\n", clk); |
| 174 | case 9 ... 12: | ||
| 175 | clocks = 7; /* 12 clk */ | ||
| 176 | break; | ||
| 177 | case 7: | ||
| 170 | case 8: /* default 8 clk */ | 178 | case 8: /* default 8 clk */ |
| 171 | clocks = 0; | 179 | clocks = 0; |
| 172 | goto active_clock_shift_done; | 180 | goto active_clock_shift_done; |
| 173 | } | 181 | } |
| 174 | 182 | ||
| 175 | /* | ||
| 176 | * Doc 6.6.9: increase the clock value by 1 for safer PIO speed | ||
| 177 | * on 66MHz bus | ||
| 178 | */ | ||
| 179 | if (dp->pci66mhz && clocks < 7) | ||
| 180 | clocks++; | ||
| 181 | |||
| 182 | active_clock_shift_done: | 183 | active_clock_shift_done: |
| 183 | return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT; | 184 | return clocks << ATP867X_IO_PIOSPD_ACTIVE_SHIFT; |
| 184 | } | 185 | } |
| @@ -193,7 +194,8 @@ static int atp867x_get_recover_clocks_shifted(unsigned int clk) | |||
| 193 | break; | 194 | break; |
| 194 | case 1 ... 11: | 195 | case 1 ... 11: |
| 195 | break; | 196 | break; |
| 196 | case 13: case 14: | 197 | case 13: |
| 198 | case 14: | ||
| 197 | --clocks; /* by the spec */ | 199 | --clocks; /* by the spec */ |
| 198 | break; | 200 | break; |
| 199 | case 15: | 201 | case 15: |
| @@ -235,16 +237,16 @@ static void atp867x_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
| 235 | iowrite8(b, dp->dma_mode); | 237 | iowrite8(b, dp->dma_mode); |
| 236 | 238 | ||
| 237 | b = atp867x_get_active_clocks_shifted(ap, t.active) | | 239 | b = atp867x_get_active_clocks_shifted(ap, t.active) | |
| 238 | atp867x_get_recover_clocks_shifted(t.recover); | 240 | atp867x_get_recover_clocks_shifted(t.recover); |
| 239 | 241 | ||
| 240 | if (adev->devno & 1) | 242 | if (adev->devno & 1) |
| 241 | iowrite8(b, dp->slave_piospd); | 243 | iowrite8(b, dp->slave_piospd); |
| 242 | else | 244 | else |
| 243 | iowrite8(b, dp->mstr_piospd); | 245 | iowrite8(b, dp->mstr_piospd); |
| 244 | 246 | ||
| 245 | /* | 247 | b = atp867x_get_active_clocks_shifted(ap, t.act8b) | |
| 246 | * use the same value for comand timing as for PIO timimg | 248 | atp867x_get_recover_clocks_shifted(t.rec8b); |
| 247 | */ | 249 | |
| 248 | iowrite8(b, dp->eightb_piospd); | 250 | iowrite8(b, dp->eightb_piospd); |
| 249 | } | 251 | } |
| 250 | 252 | ||
