diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/pata_cmd640.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/ata/pata_cmd640.c b/drivers/ata/pata_cmd640.c index 4d01d4692412..ab9468d16edb 100644 --- a/drivers/ata/pata_cmd640.c +++ b/drivers/ata/pata_cmd640.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/libata.h> | 23 | #include <linux/libata.h> |
24 | 24 | ||
25 | #define DRV_NAME "pata_cmd640" | 25 | #define DRV_NAME "pata_cmd640" |
26 | #define DRV_VERSION "0.0.3" | 26 | #define DRV_VERSION "0.0.5" |
27 | 27 | ||
28 | struct cmd640_reg { | 28 | struct cmd640_reg { |
29 | int last; | 29 | int last; |
@@ -43,6 +43,7 @@ enum { | |||
43 | 43 | ||
44 | /** | 44 | /** |
45 | * cmd640_set_piomode - set initial PIO mode data | 45 | * cmd640_set_piomode - set initial PIO mode data |
46 | * @ap: ATA port | ||
46 | * @adev: ATA device | 47 | * @adev: ATA device |
47 | * | 48 | * |
48 | * Called to do the PIO mode setup. | 49 | * Called to do the PIO mode setup. |
@@ -106,7 +107,7 @@ static void cmd640_set_piomode(struct ata_port *ap, struct ata_device *adev) | |||
106 | pci_write_config_byte(pdev, arttim + 1, (t.active << 4) | t.recover); | 107 | pci_write_config_byte(pdev, arttim + 1, (t.active << 4) | t.recover); |
107 | } else { | 108 | } else { |
108 | /* Save the shared timings for channel, they will be loaded | 109 | /* Save the shared timings for channel, they will be loaded |
109 | by qc_issue_prot. Reloading the setup time is expensive | 110 | by qc_issue_prot. Reloading the setup time is expensive |
110 | so we keep a merged one loaded */ | 111 | so we keep a merged one loaded */ |
111 | pci_read_config_byte(pdev, ARTIM23, ®); | 112 | pci_read_config_byte(pdev, ARTIM23, ®); |
112 | reg &= 0x3F; | 113 | reg &= 0x3F; |
@@ -219,29 +220,20 @@ static struct ata_port_operations cmd640_port_ops = { | |||
219 | .port_start = cmd640_port_start, | 220 | .port_start = cmd640_port_start, |
220 | }; | 221 | }; |
221 | 222 | ||
222 | static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | 223 | static void cmd640_hardware_init(struct pci_dev *pdev) |
223 | { | 224 | { |
224 | u8 r; | 225 | u8 r; |
225 | u8 ctrl; | 226 | u8 ctrl; |
226 | 227 | ||
227 | static struct ata_port_info info = { | ||
228 | .sht = &cmd640_sht, | ||
229 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | ||
230 | .pio_mask = 0x1f, | ||
231 | .port_ops = &cmd640_port_ops | ||
232 | }; | ||
233 | |||
234 | static struct ata_port_info *port_info[2] = { &info, &info }; | ||
235 | |||
236 | /* CMD640 detected, commiserations */ | 228 | /* CMD640 detected, commiserations */ |
237 | pci_write_config_byte(pdev, 0x5C, 0x00); | 229 | pci_write_config_byte(pdev, 0x5B, 0x00); |
238 | /* Get version info */ | 230 | /* Get version info */ |
239 | pci_read_config_byte(pdev, CFR, &r); | 231 | pci_read_config_byte(pdev, CFR, &r); |
240 | /* PIO0 command cycles */ | 232 | /* PIO0 command cycles */ |
241 | pci_write_config_byte(pdev, CMDTIM, 0); | 233 | pci_write_config_byte(pdev, CMDTIM, 0); |
242 | /* 512 byte bursts (sector) */ | 234 | /* 512 byte bursts (sector) */ |
243 | pci_write_config_byte(pdev, BRST, 0x40); | 235 | pci_write_config_byte(pdev, BRST, 0x40); |
244 | /* | 236 | /* |
245 | * A reporter a long time ago | 237 | * A reporter a long time ago |
246 | * Had problems with the data fifo | 238 | * Had problems with the data fifo |
247 | * So don't run the risk | 239 | * So don't run the risk |
@@ -255,12 +247,26 @@ static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | |||
255 | pci_read_config_byte(pdev, ARTIM23, &ctrl); | 247 | pci_read_config_byte(pdev, ARTIM23, &ctrl); |
256 | ctrl |= 0x0C; | 248 | ctrl |= 0x0C; |
257 | pci_write_config_byte(pdev, ARTIM23, ctrl); | 249 | pci_write_config_byte(pdev, ARTIM23, ctrl); |
250 | } | ||
251 | |||
252 | static int cmd640_init_one(struct pci_dev *pdev, const struct pci_device_id *id) | ||
253 | { | ||
254 | static struct ata_port_info info = { | ||
255 | .sht = &cmd640_sht, | ||
256 | .flags = ATA_FLAG_SLAVE_POSS | ATA_FLAG_SRST, | ||
257 | .pio_mask = 0x1f, | ||
258 | .port_ops = &cmd640_port_ops | ||
259 | }; | ||
260 | |||
261 | static struct ata_port_info *port_info[2] = { &info, &info }; | ||
258 | 262 | ||
263 | cmd640_hardware_init(pdev); | ||
259 | return ata_pci_init_one(pdev, port_info, 2); | 264 | return ata_pci_init_one(pdev, port_info, 2); |
260 | } | 265 | } |
261 | 266 | ||
262 | static int cmd640_reinit_one(struct pci_dev *pdev) | 267 | static int cmd640_reinit_one(struct pci_dev *pdev) |
263 | { | 268 | { |
269 | cmd640_hardware_init(pdev); | ||
264 | return ata_pci_device_resume(pdev); | 270 | return ata_pci_device_resume(pdev); |
265 | } | 271 | } |
266 | 272 | ||